/* ── DEJM Design System ────────────────────────────────────────────────── */
:root {
    --teal:     #1D9E75;
    --teal-dark:#157A5A;
    --teal-dim: rgba(29,158,117,.15);
    --amber:    #EF9F27;
    --amber-dim:rgba(239,159,39,.15);
    --coral:    #D85A30;
    --coral-dim:rgba(216,90,48,.15);
    --navy:     #0D1B2A;
    --navy-mid: #122236;
    --navy-soft:#1A3A52;
    --parchment:#F5F0E8;
    --steel:    #3A7A9C;
    --steel-dim:rgba(58,122,156,.15);
    --muted:    #8ABDD0;
    --deep-navy:#0D1B2A;

    --sidebar-w: 252px;
    --topbar-h:  52px;
    --radius:    6px;
    --shadow:    0 1px 3px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.07);
    --shadow-md: 0 2px 10px rgba(0,0,0,.14);
    --shadow-lg: 0 6px 28px rgba(0,0,0,.22);
    --transition: .18s ease;
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #F0EDE8;
    color: #1A2B3C;
    line-height: 1.6;
}

h1, h2, h3, h4, h5 {
    font-family: Georgia, serif;
    font-weight: 700;
    line-height: 1.25;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Layout ─────────────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: var(--navy-soft) transparent;
    transition: transform var(--transition);
    will-change: transform;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--navy-mid);
}

.sidebar-brand-text {
    font-family: Georgia, serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--parchment);
    letter-spacing: -0.5px;
}

.sidebar-community {
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 8px 20px 4px;
}

.nav-list {
    list-style: none;
    flex: 1;
    padding: 12px 0;
}

.nav-section-label {
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--navy-soft);
    padding: 14px 20px 4px;
    pointer-events: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--muted);
    font-size: .88rem;
    transition: background var(--transition), color var(--transition);
    border-radius: 0;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,.05);
    color: var(--parchment);
    text-decoration: none;
}

.nav-item.active .nav-link {
    background: rgba(29,158,117,.12);
    border-left-color: var(--teal);
    padding-left: 17px;
    color: var(--teal);
    text-decoration: none;
}

.nav-link svg { opacity: .7; flex-shrink: 0; }
.nav-item.active .nav-link svg { opacity: 1; }

.sidebar-user {
    border-top: 1px solid var(--navy-mid);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-user-role {
    font-size: .78rem;
    color: var(--steel);
    letter-spacing: .05em;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    color: var(--muted);
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: color .15s;
}
.btn-logout:hover { color: var(--coral); text-decoration: none; }

/* ── Main Content ───────────────────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.page-header {
    background: white;
    border-bottom: 1px solid #DDD8D0;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 1.3rem;
    color: var(--navy);
    font-weight: 700;
}

.page-body {
    padding: 28px 32px;
    flex: 1;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow var(--transition);
}

.card-title {
    font-family: Georgia, serif;
    font-size: 1.05rem;
    color: var(--navy);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #EDE9E3;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #EDE9E3;
}

.card-header .card-title { margin: 0; padding: 0; border: 0; }

/* ── Stat Tiles ─────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-tile {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    border-left: 4px solid var(--teal);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-tile.amber { border-left-color: var(--amber); }
.stat-tile.coral { border-left-color: var(--coral); }
.stat-tile.steel { border-left-color: var(--steel); }

.stat-value {
    font-family: Georgia, serif;
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1;
}

.stat-label {
    font-size: .78rem;
    color: #6B7280;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ── Grid helpers ───────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius);
    margin: 0 32px 16px;
    font-size: .9rem;
    border-left: 4px solid;
}
.alert-info    { background: var(--steel-dim); border-color: var(--steel); color: #1A3D5A; }
.alert-success { background: var(--teal-dim);  border-color: var(--teal);  color: #0A5C40; }
.alert-warning { background: var(--amber-dim); border-color: var(--amber); color: #5A3800; }
.alert-error   { background: var(--coral-dim); border-color: var(--coral); color: #8B2000; }

/* Dark-context alert overrides (onboarding, login) */
.login-page .alert-info    { color: var(--steel); }
.login-page .alert-success { color: var(--teal); }
.login-page .alert-warning { color: var(--amber); }
.login-page .alert-error   { color: #FF9977; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-size: .83rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    letter-spacing: .02em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #D1CBC0;
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    background: #FDFAF7;
    color: #1A2B3C;
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-dim);
}

.field-hint {
    font-size: .78rem;
    color: #6B7280;
    margin-top: 4px;
}

.field-error {
    font-size: .78rem;
    color: var(--coral);
    margin-top: 4px;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { margin-top: 24px; display: flex; gap: 10px; align-items: center; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: .88rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, box-shadow .15s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
    box-shadow: 0 2px 8px rgba(29,158,117,.28);
}
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); text-decoration: none; color: white; box-shadow: 0 3px 12px rgba(29,158,117,.38); }

.btn-secondary {
    background: white;
    color: #374151;
    border-color: #D1CBC0;
}
.btn-secondary:hover { background: #F9F5F0; text-decoration: none; color: #374151; }

.btn-danger {
    background: var(--coral);
    color: white;
    border-color: var(--coral);
}
.btn-danger:hover { background: #B84A22; text-decoration: none; color: white; }

.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-icon { padding: 7px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6B7280;
    background: #F9F5F0;
    border-bottom: 2px solid #EDE9E3;
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid #F0EDE8;
    vertical-align: middle;
}

tbody tr:hover td { background: #FDFAF7; }
tbody tr:last-child td { border-bottom: none; }

.table-empty {
    text-align: center;
    color: #9CA3AF;
    padding: 40px 14px;
    font-style: italic;
}

/* ── Risk Band Badges ───────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-benign           { background: var(--teal-dim);  color: #0A5C40; }
.badge-medium           { background: var(--amber-dim); color: #7A4F00; }
.badge-high             { background: var(--coral-dim); color: #7A1A00; }
.badge-archived_silence { background: var(--steel-dim); color: #1A3D5A; }

/* ── TSI Score display ──────────────────────────────────────────────────── */
.tsi-score {
    font-family: Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--navy);
}

.tsi-breakdown {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.tsi-component {
    font-size: .75rem;
    color: #6B7280;
}

.tsi-component strong { color: var(--navy); }

/* ── Expandable rows ────────────────────────────────────────────────────── */
tr.expandable-row { cursor: pointer; }
tr.expandable-row td:first-child::before {
    content: '›';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    font-size: .95rem;
    font-weight: 700;
    line-height: 1;
    color: var(--teal);
    background: var(--teal-dim);
    border-radius: 3px;
    vertical-align: middle;
    transition: transform .2s;
}
tr.expandable-row.expanded td:first-child::before { transform: rotate(90deg); }
tr.expandable-row:hover td:first-child::before { background: rgba(29,158,117,.25); }

/* ── Nav badge (pending count) ──────────────────────────────────────────── */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: auto;
    font-size: .68rem;
    font-weight: 700;
    background: var(--amber);
    color: var(--navy);
    border-radius: 20px;
    line-height: 1;
}

tr.detail-row { display: none; }
tr.detail-row.visible { display: table-row; }
tr.detail-row td { background: #F9F5F0; padding: 16px 24px; }

.rationale {
    font-size: .85rem;
    color: #4B5563;
    font-style: italic;
    line-height: 1.5;
    margin-top: 8px;
    padding: 10px 14px;
    background: white;
    border-left: 3px solid var(--steel);
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* ── Chart containers ───────────────────────────────────────────────────── */
.chart-wrap {
    position: relative;
    padding: 8px 0;
}

.chart-wrap canvas { max-width: 100%; }

/* ── Upload zone ────────────────────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed #C8C2B8;
    border-radius: var(--radius);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #FDFAF7;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--teal);
    background: var(--teal-dim);
}

.upload-zone-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: .5; }
.upload-zone-label { font-size: .9rem; color: #6B7280; }
.upload-zone-label strong { color: var(--teal); }

.progress-bar-wrap {
    background: #EDE9E3;
    border-radius: 20px;
    height: 6px;
    overflow: hidden;
    margin-top: 12px;
    display: none;
}
.progress-bar-wrap.visible { display: block; }
.progress-bar {
    height: 100%;
    background: var(--teal);
    border-radius: 20px;
    width: 0;
    transition: width .3s;
}

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-page {
    background: var(--navy);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #122236;
    border-radius: 10px;
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
    gap: 10px;
}

.login-wordmark {
    font-family: Georgia, serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--parchment);
    letter-spacing: -1px;
    line-height: 1;
}

.login-subtitle {
    font-size: .72rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--steel);
    text-align: center;
    line-height: 1.5;
}

.login-card label { color: var(--muted); }

.login-card input {
    background: var(--navy);
    border-color: var(--navy-soft);
    color: var(--parchment);
}
.login-card input:focus { border-color: var(--teal); }
.login-card input::placeholder { color: var(--navy-soft); }

.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }

.login-tagline {
    text-align: center;
    font-family: Georgia, serif;
    font-style: italic;
    color: var(--teal);
    font-size: .88rem;
    margin-top: 24px;
}

/* ── Google OAuth button ────────────────────────────────────────────────── */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #D1CBC0;
    border-radius: var(--radius);
    color: #3C4043;
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), box-shadow var(--transition);
    box-sizing: border-box;
    margin-bottom: 4px;
}
.btn-google:hover {
    background: #F8F5F1;
    box-shadow: 0 1px 6px rgba(0,0,0,.14);
    color: #3C4043;
}

/* ── Login separator ("or") ─────────────────────────────────────────────── */
.login-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: var(--navy-soft);
    font-size: .8rem;
}
.login-separator::before,
.login-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,.1);
}

/* ── Forgot password link ───────────────────────────────────────────────── */
.login-forgot-link {
    font-size: .8rem;
    color: var(--steel);
    text-decoration: none;
}
.login-forgot-link:hover { color: var(--teal); text-decoration: underline; }

/* ── Settings URI display ───────────────────────────────────────────────── */
.uri-display {
    display: block;
    margin-top: 6px;
    padding: 6px 10px;
    background: rgba(29,158,117,.08);
    border: 1px solid rgba(29,158,117,.2);
    border-radius: 6px;
    font-size: .82rem;
    word-break: break-all;
    color: var(--teal);
}

/* ── Setup card (settings.php step-by-step UI) ──────────────────────────── */
.setup-card {
    max-width: 600px;
    margin: 0 auto;
}

.setup-step {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}
.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}
.step-body { flex: 1; }
.step-title { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.step-desc { font-size: .85rem; color: #6B7280; }

/* ── Onboarding wizard ──────────────────────────────────────────────────── */
.onboarding-outer {
    max-width: 700px;
    margin: 0 auto;
    padding: 48px 24px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.onboarding-card {
    width: 100%;
    background: #122236;
    border-radius: 10px;
    padding: 40px 44px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(58,122,156,.18);
}

.onboarding-card label {
    color: var(--muted);
}

.onboarding-card input,
.onboarding-card select,
.onboarding-card textarea {
    background: var(--navy);
    border-color: var(--navy-soft);
    color: var(--parchment);
}
.onboarding-card input:focus,
.onboarding-card select:focus,
.onboarding-card textarea:focus {
    border-color: var(--teal);
}
.onboarding-card input::placeholder { color: var(--navy-soft); }

.onboarding-step-title {
    font-family: Georgia, serif;
    font-size: 1.3rem;
    color: var(--parchment);
    margin-bottom: 10px;
    font-weight: 700;
}

.onboarding-intro {
    color: var(--steel);
    font-size: .9rem;
    line-height: 1.75;
    margin-bottom: 22px;
}

.onboarding-intro strong { color: var(--parchment); }

.onboarding-progress {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 32px;
}

.onboarding-progress-step {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--navy-soft);
    transition: background .3s;
}

.onboarding-progress-step.done   { background: var(--teal); }
.onboarding-progress-step.active { background: var(--amber); }

.onboarding-divider {
    border: none;
    border-top: 1px solid rgba(58,122,156,.15);
    margin: 0 0 18px;
}

.principle-list { list-style: none; }

.principle-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 13px 0;
    border-bottom: 1px solid rgba(58,122,156,.12);
}

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

.principle-check {
    margin-top: 3px;
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    accent-color: var(--teal);
    cursor: pointer;
}

.principle-label {
    font-size: .88rem;
    color: var(--muted);
    line-height: 1.65;
    cursor: pointer;
}

.principle-label strong { color: var(--parchment); display: block; margin-bottom: 2px; }

.readiness-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    background: var(--navy);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.readiness-row:last-child { margin-bottom: 0; }

.readiness-label {
    font-size: .9rem;
    color: var(--parchment);
    font-weight: 600;
}

.readiness-hint {
    font-size: .78rem;
    color: var(--muted);
    margin-top: 2px;
}

.readiness-count {
    font-family: Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

.readiness-count.ok   { color: var(--teal); }
.readiness-count.warn { color: var(--amber); }

.onboarding-tip {
    font-size: .82rem;
    color: var(--muted);
    margin-top: 14px;
    line-height: 1.6;
}

.onboarding-tip a { color: var(--steel); text-decoration: underline; }
.onboarding-tip a:hover { color: var(--teal); }

.onboarding-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(58,122,156,.15);
}

.onboarding-footer {
    margin-top: 22px;
    font-size: .74rem;
    color: var(--navy-soft);
    letter-spacing: .04em;
    text-align: center;
}

.highlight-box {
    background: rgba(29,158,117,.1);
    border-left: 3px solid var(--teal);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 18px;
    margin: 16px 0 22px;
}

.highlight-box-title {
    font-family: Georgia, serif;
    font-size: .92rem;
    color: var(--parchment);
    margin-bottom: 6px;
}

.highlight-box ul {
    color: var(--muted);
    font-size: .84rem;
    padding-left: 18px;
    line-height: 1.9;
    margin: 0;
}

/* ── Code / monospace ───────────────────────────────────────────────────── */
code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: .83rem;
    background: #F0EDE8;
    padding: 1px 5px;
    border-radius: 3px;
    color: #5A1A00;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid #EDE9E3;
    margin-bottom: 20px;
    gap: 4px;
}

.tab-btn {
    padding: 8px 18px;
    font-size: .88rem;
    font-weight: 600;
    color: #6B7280;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s;
    font-family: inherit;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Silence panel ──────────────────────────────────────────────────────── */
.silence-panel {
    background: linear-gradient(135deg, var(--navy) 0%, #1A3A52 100%);
    border-radius: var(--radius);
    padding: 28px;
    color: var(--parchment);
    margin-bottom: 24px;
}

.silence-prompt {
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 1.05rem;
    color: var(--muted);
    margin-bottom: 18px;
    line-height: 1.6;
}

.silence-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.silence-item:last-child { border-bottom: none; }
.silence-item-label { font-size: .9rem; }
.silence-item-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.silence-potential { font-family: Georgia, serif; font-size: 1.1rem; color: var(--amber); font-weight: 700; }

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    align-items: center;
}

.page-link {
    padding: 6px 12px;
    border: 1px solid #D1CBC0;
    border-radius: var(--radius);
    font-size: .83rem;
    color: #374151;
    transition: background .15s;
}
.page-link:hover { background: #F9F5F0; text-decoration: none; color: #374151; }
.page-link.active { background: var(--teal); border-color: var(--teal); color: white; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ── Utilities ──────────────────────────────────────────────────────────── */
.text-muted  { color: #6B7280; }
.text-sm     { font-size: .83rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-1  { margin-top:  6px; }
.mt-2  { margin-top: 12px; }
.mt-3  { margin-top: 20px; }
.mb-0  { margin-bottom: 0; }
.flex  { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 14px; }
.w-full { width: 100%; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filter-bar .form-group { margin-bottom: 0; }
.form-group-inline { margin-bottom: 0; }
.inline-edit-form { background: var(--navy-soft); border-radius: 6px; padding: 16px; }

/* ── Analysis page ──────────────────────────────────────────────────────── */
.analysis-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
}

.analysis-main { min-width: 0; }

.analysis-sidebar { display: flex; flex-direction: column; gap: 0; }
.analysis-sidebar .card { margin-bottom: 16px; }

.analysis-report-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.analysis-report-header {
    background: linear-gradient(135deg, var(--navy) 0%, #1A3A52 100%);
    padding: 28px 32px;
}

.analysis-report-title {
    font-family: Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--parchment);
    margin-bottom: 10px;
    line-height: 1.3;
}

.analysis-report-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: .78rem;
    color: var(--steel);
    align-items: center;
}

.analysis-claude-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .72rem;
    color: var(--muted);
    background: rgba(58,122,156,.18);
    padding: 3px 8px;
    border-radius: 20px;
    font-style: italic;
}

.analysis-report-body {
    padding: 32px;
}

.analysis-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid #F0EDE8;
}
.analysis-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.analysis-section-title {
    font-family: Georgia, serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-section-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.analysis-section-body {
    font-size: .92rem;
    color: #374151;
    line-height: 1.8;
}

.analysis-history-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius);
    margin: 0 -12px;
    transition: background var(--transition);
    gap: 8px;
}
.analysis-history-item:hover { background: #F9F5F0; }
.analysis-history-item.active { background: var(--teal-dim); }

.analysis-history-period {
    font-size: .83rem;
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.analysis-history-meta { font-size: .74rem; color: #9CA3AF; margin-top: 2px; }
.analysis-history-item.active .analysis-history-period { color: var(--teal-dark); }

.analysis-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .analysis-layout { grid-template-columns: 1fr; }
    .analysis-report-header { padding: 20px 20px; }
    .analysis-report-body  { padding: 20px; }
}

/* ── Mobile topbar ──────────────────────────────────────────────────────── */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 80;
    height: var(--topbar-h);
    background: var(--navy);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    border-bottom: 1px solid var(--navy-mid);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius);
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
}
.menu-toggle:hover { color: var(--parchment); background: rgba(255,255,255,.07); }

.mobile-brand {
    font-family: Georgia, serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--parchment);
    letter-spacing: -.3px;
    flex-shrink: 0;
}

.mobile-page-title {
    font-size: .82rem;
    color: var(--steel);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Sidebar overlay (mobile) ───────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 95;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--transition);
}

body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

/* ── Sidebar close button (mobile only) ────────────────────────────────── */
.sidebar-close {
    display: none;
    position: absolute;
    top: 14px;
    right: 12px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    line-height: 0;
    transition: color var(--transition);
    z-index: 1;
}
.sidebar-close:hover { color: var(--parchment); }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    /* Sidebar becomes off-canvas drawer */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    body.sidebar-open { overflow: hidden; }

    .sidebar-close { display: block; }
    .sidebar-brand { padding-right: 48px; }

    /* Mobile topbar replaces the sticky page-header as top anchor */
    .mobile-topbar { display: flex; }

    /* Page header hidden on mobile (topbar takes its place) */
    .page-header { display: none; }

    .main-content { margin-left: 0; }
    .page-body { padding: 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .alert { margin: 0 0 16px; }
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.8rem; }
    .tabs { overflow-x: auto; gap: 0; }
    .tab-btn { white-space: nowrap; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ── Focus visible (WCAG 2.1 AA) ───────────────────────────────────────── */
:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

/* ── Download links (login page) ────────────────────────────────────────── */
.login-downloads {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.login-downloads-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.dl-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 13px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    color: var(--parchment);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 6px;
    transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}

.dl-link:last-child { margin-bottom: 0; }

.dl-link:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(29,158,117,.08);
    box-shadow: 0 1px 4px rgba(29,158,117,.18);
    text-decoration: none;
}

.dl-link svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--teal);
    opacity: 0.8;
}

.dl-link:hover svg { opacity: 1; }
