:root {
    --accent: #2a6cb6;
    --accent-dark: #1d5390;
    --accent-deep: #0f3b6e;
    --accent-soft: #e8f0f9;
    --accent-mid: #c1d6ec;
    --gold: #c89a3a;
    --text: #0f1a2a;
    --text-muted: #4a5667;
    --text-faint: #8a93a0;
    --border: #e3e7ec;
    --border-strong: #cdd4dc;
    --bg: #f4f7fb;
    --bg-card: #ffffff;
    --bg-code: #f3f5f8;
    --warn: #b8651d;
    --danger: #b1342e;
    --success: #2d6b3a;
    --shadow-sm: 0 1px 3px rgba(15, 30, 60, 0.04), 0 1px 2px rgba(15, 30, 60, 0.03);
    --shadow-md: 0 4px 12px rgba(15, 30, 60, 0.06), 0 2px 4px rgba(15, 30, 60, 0.04);
    --shadow-lg: 0 12px 40px rgba(15, 30, 60, 0.10), 0 4px 12px rgba(15, 30, 60, 0.06);
    --grad-hero: linear-gradient(135deg, #0f3b6e 0%, #1d5390 35%, #2a6cb6 70%, #4a8cd4 100%);
    --grad-soft: linear-gradient(180deg, #f4f7fb 0%, #eaf1f8 100%);
    --grad-card: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    --grad-stat: linear-gradient(135deg, #ffffff 0%, #f3f7fc 100%);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--grad-soft);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

/* --- top bar --- */
.topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1380px;
    margin: 0 auto;
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
    background: var(--grad-hero);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 8px rgba(42, 108, 182, 0.25);
}
.brand-text {
    font-weight: 600;
    font-size: 14.5px;
    letter-spacing: 0.005em;
    color: var(--text);
}
.user-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 13px;
    color: var(--text-muted);
}
.user-email { font-family: "SF Mono", ui-monospace, Consolas, monospace; font-size: 12px; }
.user-admin, .user-logout {
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.12s ease, color 0.12s ease;
}
.user-admin:hover, .user-logout:hover {
    color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
}

/* --- shell layout (doc pages) --- */
.shell {
    max-width: 1380px;
    margin: 0 auto;
    padding: 28px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 36px;
    align-items: start;
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; padding: 18px; }
    .sidebar { position: static !important; }
}

/* Full-bleed wrapper used by the landing page so it does not get squeezed
   into the .shell sidebar grid column. */
.shell--full {
    display: block;
    padding: 0;
    max-width: 100%;
}

/* --- sidebar --- */
.sidebar {
    position: sticky;
    top: 78px;
    background: var(--grad-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 14px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}
.sidebar-section { margin-bottom: 22px; }
.sidebar-section:last-child { margin-bottom: 0; }
.sidebar-heading {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-faint);
    margin: 0 0 10px;
    padding: 0 10px;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
    display: flex;
    align-items: baseline;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 7px;
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.35;
    transition: background 0.1s ease, color 0.1s ease, transform 0.1s ease;
}
.sidebar-link:hover {
    background: var(--accent-soft);
    text-decoration: none;
    color: var(--accent-dark);
}
.sidebar-link.active {
    background: var(--grad-hero);
    color: #fff;
    box-shadow: 0 2px 8px rgba(42, 108, 182, 0.18);
}
.sidebar-link.active:hover {
    background: var(--grad-hero);
    color: #fff;
}
.link-num {
    font-family: "SF Mono", ui-monospace, Consolas, monospace;
    font-size: 10.5px;
    color: var(--text-faint);
    min-width: 18px;
    text-align: right;
    flex-shrink: 0;
    font-weight: 500;
}
.sidebar-link.active .link-num { color: rgba(255,255,255,0.72); }
.link-title { flex: 1; }

/* --- main content --- */
.content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 44px 56px;
    min-width: 0;
    box-shadow: var(--shadow-md);
}
.content-wide { padding: 32px 40px; }
@media (max-width: 700px) { .content { padding: 28px 22px; } }

.doc-eyebrow-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.doc-header {
    margin-bottom: 28px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.doc-eyebrow {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
    font-weight: 700;
}
.pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark);
    padding: 6px 12px;
    border: 1px solid var(--accent-mid);
    border-radius: 6px;
    background: #fff;
    transition: all 0.12s ease;
}
.pdf-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    text-decoration: none;
}
.doc-header h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.18;
    letter-spacing: -0.015em;
    color: var(--text);
    font-weight: 700;
}
.doc-lede {
    color: var(--text-muted);
    margin-top: 12px;
    font-size: 14.5px;
}

.doc-body { font-size: 15px; color: var(--text); }
.doc-body h2 {
    font-size: 21px;
    margin-top: 40px;
    margin-bottom: 14px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.005em;
}
.doc-body h3 {
    font-size: 16.5px;
    margin-top: 28px;
    margin-bottom: 9px;
    color: var(--accent-dark);
    font-weight: 600;
}
.doc-body h4 {
    font-size: 14px;
    margin-top: 20px;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 600;
}
.doc-body p { margin: 10px 0 15px; }
.doc-body ul, .doc-body ol { margin: 10px 0 15px; padding-left: 28px; }
.doc-body li { margin: 5px 0; }
.doc-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 18px;
    margin: 16px 0;
    background: linear-gradient(90deg, var(--accent-soft) 0%, rgba(232,240,249,0.4) 100%);
    color: var(--text);
    font-style: normal;
    border-radius: 0 8px 8px 0;
}
.doc-body code {
    background: var(--bg-code);
    padding: 1.5px 7px;
    border-radius: 4px;
    font-family: "SF Mono", ui-monospace, Consolas, monospace;
    font-size: 13px;
    color: #2a4d75;
}
.doc-body pre {
    background: var(--bg-code);
    padding: 16px 18px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.55;
}
.doc-body pre code { background: none; padding: 0; color: var(--text); }
.doc-body table {
    border-collapse: collapse;
    margin: 16px 0;
    width: 100%;
    font-size: 13.5px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.doc-body th, .doc-body td {
    border-bottom: 1px solid var(--border);
    padding: 9px 13px;
    text-align: left;
    vertical-align: top;
}
.doc-body th {
    background: linear-gradient(180deg, var(--accent-soft) 0%, #dde9f4 100%);
    color: var(--accent-deep);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: 0.015em;
    text-transform: uppercase;
}
.doc-body tr:last-child td { border-bottom: none; }
.doc-body td:first-child { font-weight: 500; }
.doc-body tr:nth-child(even) td { background: #fafbfd; }
.doc-body strong { color: var(--text); font-weight: 600; }
.doc-body hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.doc-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* --- doc pager --- */
.doc-pager {
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.pager-side { display: flex; }
.pager-side.right { justify-content: flex-end; }
.pager-link {
    display: block;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 14px 18px;
    max-width: 340px;
    transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
    background: var(--grad-card);
}
.pager-link:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
    transform: translateY(-1px);
}
.pager-link.next { text-align: right; }
.pager-label {
    display: block;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
    font-weight: 600;
}
.pager-title {
    display: block;
    font-size: 14.5px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 3px;
}

/* --- footer --- */
.footer {
    max-width: 1380px;
    margin: 0 auto;
    padding: 32px 28px 40px;
    text-align: center;
    color: var(--text-faint);
    font-size: 12px;
}

/* --- LANDING PAGE --- */
.landing { max-width: 1380px; margin: 0 auto; padding: 0; }

/* Hero */
.hero {
    background: var(--grad-hero);
    color: #fff;
    border-radius: 18px;
    margin: 28px 28px 36px;
    padding: 64px 56px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(15, 59, 110, 0.22), 0 8px 24px rgba(15, 59, 110, 0.14);
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 15% 75%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
}
.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 48px;
    align-items: center;
}
@media (max-width: 900px) { .hero-inner { grid-template-columns: 1fr; } .hero-orb { display: none; } }
.hero-eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.78);
    font-weight: 600;
    margin-bottom: 18px;
}
.hero-title {
    font-size: 38px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 700;
    margin: 0 0 22px;
    color: #fff;
}
.hero-title-accent {
    color: rgba(255, 255, 255, 0.78);
    font-weight: 400;
    font-size: 24px;
    line-height: 1.35;
    display: block;
    margin-top: 14px;
    letter-spacing: -0.01em;
}
.hero-lede {
    font-size: 15.5px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.62;
    margin: 0 0 28px;
    max-width: 600px;
}
.hero-lede strong { color: #fff; font-weight: 600; }
.hero-cta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-btn {
    display: inline-flex;
    align-items: center;
    padding: 11px 22px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s ease;
    letter-spacing: 0.005em;
}
.hero-btn.primary {
    background: #fff;
    color: var(--accent-deep);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.hero-btn.primary:hover {
    background: var(--accent-soft);
    color: var(--accent-deep);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.hero-btn.ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.hero-btn.ghost:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    text-decoration: none;
}

/* Animated orb / globe placeholder */
.hero-orb {
    position: relative;
    width: 320px;
    height: 320px;
    justify-self: end;
}
.orb {
    position: absolute;
    inset: 36px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.45) 0%, transparent 35%),
        linear-gradient(135deg, #4a8cd4 0%, #1d5390 60%, #0f3b6e 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12) inset,
        0 24px 64px rgba(0, 0, 0, 0.25);
    animation: orbDrift 14s ease-in-out infinite;
}
.orb-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, transparent 60%);
    pointer-events: none;
}
.orb-ring {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    animation: ringSpin 22s linear infinite;
}
.orb-ring.r2 {
    inset: 16px;
    border-color: rgba(255, 255, 255, 0.14);
    border-top-color: rgba(255, 255, 255, 0.5);
    animation-duration: 13s;
    animation-direction: reverse;
}
@keyframes ringSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes orbDrift {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.02); }
}

/* Stat row */
.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 0 28px 36px;
}
@media (max-width: 900px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-card {
    background: var(--grad-stat);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px 22px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-deep);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 6px;
}
.stat-label {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Card grid */
.card-grid {
    margin: 0 28px 36px;
}
.card-grid-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-faint);
    margin-bottom: 14px;
    padding-left: 4px;
}
.card-grid-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: -8px 4px 16px;
    line-height: 1.5;
    max-width: 720px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.doc-card {
    background: var(--grad-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px 22px 24px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    min-height: 110px;
}
.doc-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}
.doc-card.accent {
    background: linear-gradient(135deg, var(--accent-deep) 0%, var(--accent-dark) 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(29, 83, 144, 0.25);
}
.doc-card.accent:hover {
    background: linear-gradient(135deg, var(--accent-deep) 0%, var(--accent) 100%);
}
.doc-card.alt { background: #fff; }
.doc-card-num {
    font-family: "SF Mono", ui-monospace, Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-faint);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.doc-card.accent .doc-card-num { color: rgba(255,255,255,0.72); }
.doc-card-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: inherit;
    letter-spacing: -0.005em;
}

/* --- login page --- */
.login-page {
    background: var(--grad-hero);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 20% 70%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    pointer-events: none;
}
.login-wrap {
    width: 100%;
    max-width: 460px;
    padding: 24px;
    position: relative;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 44px 38px;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.08);
}
.login-mark {
    width: 60px;
    height: 60px;
    margin: 0 auto 22px;
    background: var(--grad-hero);
    color: #fff;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(42, 108, 182, 0.32);
}
.login-card h1 {
    font-size: 20px;
    margin: 0 0 10px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.01em;
}
.login-sub {
    color: var(--text-muted);
    font-size: 13.5px;
    margin: 8px 0;
    line-height: 1.55;
}
.login-err {
    background: #fde8e8;
    color: #8a1c1c;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin: 14px 0;
}
.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    margin-top: 22px;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(42, 108, 182, 0.28);
    transition: all 0.15s ease;
}
.login-btn:hover {
    background: var(--accent-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(42, 108, 182, 0.36);
}
.login-btn svg {
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 2px;
    padding: 1px;
}
.login-lock {
    color: var(--text-faint);
    font-size: 11px;
    margin-top: 22px;
    letter-spacing: 0.04em;
}
.login-footnote {
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    margin-top: 22px;
}
.email-pill {
    background: var(--bg-code);
    padding: 4px 11px;
    border-radius: 5px;
    font-family: "SF Mono", ui-monospace, Consolas, monospace;
    font-size: 12px;
    color: var(--text);
}

/* --- admin table --- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 14px;
}
.admin-table th, .admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 11px 13px;
    text-align: left;
    vertical-align: middle;
}
.admin-table th {
    background: linear-gradient(180deg, var(--accent-soft) 0%, #dce8f3 100%);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-deep);
}
.mono { font-family: "SF Mono", ui-monospace, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--text-muted); font-size: 12px; }
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-approved { background: #e9f4ec; color: var(--success); }
.badge-pending  { background: #fef3e3; color: var(--warn); }
.badge-denied   { background: #fde8e8; color: var(--danger); }
.badge-revoked  { background: #f3f5f8; color: var(--text-muted); }
.row-actions { display: flex; gap: 4px; margin: 0; }
.btn-action {
    border: 1px solid var(--border);
    background: #fff;
    padding: 5px 11px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.1s ease;
}
.btn-action:hover { border-color: var(--accent); color: var(--accent); }
.btn-action.approve:hover { border-color: var(--success); color: var(--success); }
.btn-action.deny:hover    { border-color: var(--danger); color: var(--danger); }
.btn-action.revoke:hover  { border-color: var(--warn); color: var(--warn); }
