:root {
    --bg1: #f5fbfa;
    --bg2: #fffaf2;
    --ink: #132226;
    --muted: #4f646d;
    --accent: #0c7d74;
    --accent-2: #ea8f2d;
    --card: #ffffff;
    --line: #d4e4e2;
    --danger: #a22a2a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    color: var(--ink);
    min-height: 100vh;
    background: linear-gradient(140deg, var(--bg1), var(--bg2));
}

.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle at 10% 10%, rgba(12, 125, 116, 0.12), transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(234, 143, 45, 0.14), transparent 28%),
        radial-gradient(circle at 70% 80%, rgba(12, 125, 116, 0.1), transparent 25%);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.74);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-weight: 700;
    letter-spacing: 0.04em;
}

nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

nav a,
.link-button {
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
}

.inline-form {
    display: inline;
}

.link-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.layout {
    max-width: 1080px;
    margin: 0 auto;
    padding: 1.25rem;
    position: relative;
}

.panel,
.auth-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 14px 34px rgba(19, 34, 38, 0.08);
    animation: rise 240ms ease-out;
}

@keyframes rise {
    from {
        transform: translateY(8px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

h1,
h2,
h3 {
    margin-top: 0;
}

.subtitle,
.helper {
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 0.6rem;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
}

.primary {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    cursor: pointer;
    color: #ffffff;
    background: linear-gradient(120deg, var(--accent), #0b6d7f);
    text-decoration: none;
    text-align: center;
    font-weight: 600;
}

.small {
    padding: 0.5rem 0.7rem;
    font-size: 0.92rem;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.example-card,
.content-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1rem;
    background: #ffffff;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
}

.compare-pane {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.8rem;
    background: #fbfefe;
}

.compare-pane h4 {
    margin: 0 0 0.5rem;
}

.input-text {
    white-space: pre-wrap;
    line-height: 1.45;
}

.input-text.scrollable {
    max-height: 220px;
    overflow: auto;
}

.input-text-edit {
    width: 100%;
    resize: vertical;
}

.registry-box {
    border-radius: 10px;
    border: 1px solid #cfe3e5;
    background: #f7fbfc;
    padding: 0.7rem;
}

.registry-prefix {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    color: #8a9ea5;
    line-height: 1.35;
}

.registry-main-text {
    margin: 0;
    line-height: 1.45;
    color: var(--ink);
}

.compare-right .registry-box {
    background: #fff8ea;
    border-color: #f1d6aa;
}

.mono {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.9rem;
    color: var(--muted);
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    background: #e5f7f4;
    color: #12514b;
    border: 1px solid #b8e2db;
    border-radius: 999px;
    padding: 0.32rem 0.64rem;
    cursor: default;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
}

.tooltip-panel {
    border-left: 4px solid var(--accent-2);
    background: #fff7e7;
    border-radius: 8px;
    padding: 0.8rem;
    color: #56350d;
    min-height: 2.8rem;
}

.radio-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.review-form .corrected-field {
    transition: opacity 160ms ease;
}

.review-table {
    width: 100%;
    border-collapse: collapse;
}

.review-table th,
.review-table td {
    border-bottom: 1px solid var(--line);
    text-align: left;
    padding: 0.6rem;
}

.flash-list {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.flash {
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    border: 1px solid transparent;
}

.flash-success {
    background: #e8f8f2;
    border-color: #b8ead7;
}

.flash-error {
    background: #fdeeee;
    border-color: #f3c2c2;
    color: var(--danger);
}

.category-block {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    margin-top: 0.8rem;
    background: #ffffff;
}

.category-block summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    list-style: none;
}

.category-block summary::-webkit-details-marker {
    display: none;
}

.category-title {
    color: var(--ink);
}

.category-count {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.86rem;
    color: var(--muted);
}

.category-block .example-grid {
    margin-top: 0.8rem;
}

.status-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-done {
    background: #e8f8f2;
    color: #126e50;
    border: 1px solid #b8ead7;
}

.status-not-done {
    background: #fff2df;
    color: #7d4c14;
    border: 1px solid #f1d6aa;
}

.kdl-lookup-form {
    display: grid;
    gap: 0.5rem;
}

.kdl-lookup-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.kdl-lookup-row input {
    flex: 1;
}

.lookup-result-box {
    margin-top: 0.85rem;
    display: grid;
    gap: 0.45rem;
}

.stats-toggle-row {
    margin-top: 0.8rem;
}

@media (max-width: 720px) {
    .site-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }

    .layout {
        padding: 0.8rem;
    }

    .panel,
    .auth-card {
        padding: 1rem;
    }

    .kdl-lookup-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ── Input value display (read-only) ── */
.input-value-display {
    white-space: pre-wrap;
    line-height: 1.5;
    padding: 0.6rem 0.75rem;
    background: #f4f8f7;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    font-size: 0.93rem;
    margin-bottom: 0.5rem;
}

/* ── Autocomplete ── */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(19, 34, 38, 0.12);
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.autocomplete-dropdown.visible {
    display: block;
}

.autocomplete-item {
    display: flex;
    flex-direction: column;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f4f3;
    transition: background 100ms;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #e8f6f4;
}

.ac-code {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--accent);
}

.ac-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.3;
    margin-top: 0.15rem;
}

.corrected-code-description {
    display: none;
    margin-top: 0.4rem;
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
    color: var(--muted);
    background: #f9fcfb;
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    line-height: 1.4;
}

.corrected-code-description .registry-main-text {
    color: var(--muted);
    font-size: 0.82rem;
}

/* ═══════════════════════════════════════
   DASHBOARD – Full-Viewport Layout
═══════════════════════════════════════ */

.dash-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Top bar ── */
.dash-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.dash-topbar-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.dash-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #0b6d7f);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-user-info { min-width: 0; }

.dash-email {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    color: var(--ink);
}

.dash-review-count {
    font-size: 0.74rem;
    color: var(--muted);
}

.dash-topbar-center {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    justify-content: center;
    background: #f3f7f6;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.28rem 0.9rem;
    max-width: 420px;
}

.dash-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 120ms;
    user-select: none;
}

.dash-pill:hover { background: rgba(0,0,0,0.04); }

.dash-pill-num {
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1;
}

.dash-pill.nein .dash-pill-num { color: #c07010; }
.dash-pill.done .dash-pill-num { color: #126e50; }
.dash-pill.corr .dash-pill-num { color: var(--accent); }

.dash-pill-lbl {
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.dash-pill-sep {
    width: 1px;
    height: 1.4rem;
    background: var(--line);
    flex-shrink: 0;
}

.dash-topbar-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.kdl-topbar-form { display: flex; }

.kdl-topbar-row {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.kdl-topbar-row input {
    padding: 0.42rem 0.7rem;
    font-size: 0.85rem;
    border-radius: 8px;
    width: 150px;
}

.kdl-result-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.5rem;
    background: #f7fbfc;
    border-bottom: 1px solid var(--line);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.kdl-result-text {
    color: var(--ink);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kdl-result-error { color: var(--danger); }

/* ── Main area ── */
.dash-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.dash-tabs {
    display: flex;
    border-bottom: 1px solid var(--line);
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px);
    flex-shrink: 0;
}

.dash-tab {
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 1rem 1.25rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: -1px;
    transition: color 120ms;
}

.dash-tab:hover { color: var(--ink); }

.dash-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-badge {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.77rem;
    font-weight: 500;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--line);
    color: var(--muted);
    transition: background 120ms, color 120ms;
}

.dash-tab.active .nein-badge { background: #fff2df; color: #7d4c14; }
.dash-tab.active .ja-badge  { background: #e8f8f2; color: #126e50; }

.dash-list-panel {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 1.5rem;
    display: none;
    flex-direction: column;
    gap: 0.4rem;
    scroll-behavior: smooth;
}

.dash-list-panel.active { display: flex; }

.ex-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    text-decoration: none;
    color: var(--ink);
    transition: border-color 120ms, background 120ms, transform 100ms;
    gap: 0.75rem;
    flex-shrink: 0;
}

.ex-row:hover {
    border-color: var(--accent);
    background: #f2fefc;
    transform: translateX(3px);
}

.ex-row-done { opacity: 0.65; }
.ex-row-done:hover { opacity: 1; }

.ex-info { flex: 1; min-width: 0; }

.ex-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ex-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.18rem;
}

.ex-arrow {
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0.4;
    flex-shrink: 0;
    line-height: 1;
    transition: opacity 100ms;
}

.ex-row:hover .ex-arrow { opacity: 1; }

.ex-empty {
    color: var(--muted);
    text-align: center;
    padding: 4rem 1rem;
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════
   REVIEW – Full-Viewport Layout
═══════════════════════════════════════ */

.rv-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ── Top bar ── */
.rv-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

.rv-back {
    text-decoration: none;
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    flex-shrink: 0;
    transition: background 120ms;
}
.rv-back:hover { background: #e8f6f4; }

.rv-topbar-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ink);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rv-tag-list {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

/* ── Body: two columns ── */
.rv-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* ── Left column ── */
.rv-left {
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    overflow: hidden;
}

.rv-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.rv-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.rv-code-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.rv-code-badge {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
    font-weight: 600;
    background: #e5f7f4;
    color: #12514b;
    border: 1px solid #b8e2db;
    border-radius: 6px;
    padding: 0.18rem 0.5rem;
}

.rv-code-corrected {
    background: #fff8ea;
    color: #7a4e0f;
    border-color: #f1d6aa;
}

/* ── Input Data card (always open, scrollable text) ── */
.rv-input-card {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.rv-input-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    margin-top: 0.5rem;
}

.rv-input-text {
    white-space: pre-wrap;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink);
    background: #f4f8f7;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
}

.rv-tags-line {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
}

/* ── Right column ── */
.rv-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
}

.rv-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.rv-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-bottom: 0.15rem;
}

.rv-corrected-block {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.rv-corrected-block.hidden { display: none; }

.rv-save-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    letter-spacing: 0.02em;
    border-radius: 12px;
    margin-top: auto;
}

/* ── Recent reviews strip ── */
.rv-recent {
    border-top: 1px solid var(--line);
    padding-top: 0.65rem;
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 28%;
}

.rv-recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.rv-recent-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
}

.rv-recent-time {
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.76rem;
    flex-shrink: 0;
}

.rv-arrow { color: var(--muted); font-size: 0.8rem; }

/* ═══════════════════════════════════════
   REVIEW – Passt radio buttons
═══════════════════════════════════════ */

.passt-label {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.passt-row {
    display: flex;
    gap: 0.75rem;
}

.passt-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.4rem;
    border: 2px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: background 120ms, border-color 120ms, color 120ms;
    user-select: none;
    background: var(--card);
    color: var(--muted);
}

.passt-btn input[type="radio"] { display: none; }

.passt-btn.passt-ja:has(input:checked) {
    background: #e8f8f2;
    border-color: #52c0a2;
    color: #126e50;
    box-shadow: 0 0 0 3px rgba(82, 192, 162, 0.2);
}

.passt-btn.passt-nein:has(input:checked) {
    background: #fff0f0;
    border-color: #e05252;
    color: #a22a2a;
    box-shadow: 0 0 0 3px rgba(224, 82, 82, 0.18);
}

.passt-btn:not(:has(input:checked)):hover {
    background: #f5f7f6;
    border-color: #aab;
    color: var(--ink);
}

/* ── Corrected-field visibility ── */
.corrected-field.hidden { display: none; }

.corrected-code-description.visible {
    display: block;
}

/* ── Design polish ── */
.content-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.25rem;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(19, 34, 38, 0.04);
    margin-bottom: 1rem;
}

.compare-pane h4 {
    font-size: 0.95rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--line);
    padding-bottom: 0.4rem;
    margin-bottom: 0.7rem;
}

.example-card {
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.example-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(19, 34, 38, 0.1);
}

.primary {
    transition: transform 100ms ease, box-shadow 100ms ease;
}

.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12, 125, 116, 0.3);
}

.review-table th {
    background: #f4f8f7;
    font-weight: 600;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.review-table tr:hover td {
    background: #f9fcfb;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234f646d' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.category-block summary {
    padding: 0.4rem 0;
    transition: color 100ms;
}

.category-block[open] summary {
    color: var(--accent);
}
