:root {
    --navy: #0d3b4c;
    --navy-dark: #082833;
    --ink: #1c2e35;
    --muted: #5b7179;
    --turquoise: #2bbbad;
    --turquoise-dark: #1e9a90;
    --cream: #f4f1ea;
    --paper: #fffdf9;
    --line: #d5e0e4;
    --gold: #c4a35a;
    --danger: #b42318;
    --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
    --sans: "Source Sans 3", "Segoe UI", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--cream);
    line-height: 1.6;
}

h1, h2, h3, .brand strong, .footer-brand {
    font-family: var(--serif);
    font-weight: 650;
    letter-spacing: -0.02em;
}

a { color: var(--navy); }
a:hover { color: var(--turquoise-dark); }

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--turquoise);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 1000;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.site-header {
    background: var(--navy);
    border-bottom: 3px solid var(--turquoise);
}

.site-nav { padding: 0.85rem 0; }
.site-nav .nav-link { color: rgba(255,255,255,0.86) !important; font-weight: 600; }
.site-nav .nav-link.active,
.site-nav .nav-link:hover { color: #fff !important; }

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-decoration: none;
    color: #fff !important;
}
.brand small { display: block; font-size: 0.72rem; opacity: 0.75; font-family: var(--sans); font-weight: 500; }
.brand img { border-radius: 8px; }

.btn-accent {
    background: var(--turquoise);
    border-color: var(--turquoise);
    color: var(--navy-dark);
    font-weight: 700;
}
.btn-accent:hover {
    background: var(--turquoise-dark);
    border-color: var(--turquoise-dark);
    color: #fff;
}
.btn-ghost {
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
}
.btn-outline-navy {
    color: var(--navy);
    border: 1px solid var(--navy);
    background: transparent;
    font-weight: 600;
}
.btn-outline-navy:hover { background: var(--navy); color: #fff; }

.hero {
    background:
        linear-gradient(160deg, rgba(13,59,76,0.94), rgba(13,59,76,0.78)),
        radial-gradient(circle at 80% 20%, rgba(43,187,173,0.35), transparent 45%);
    color: #fff;
    padding: 4.5rem 0 3.5rem;
}
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--turquoise);
    margin-bottom: 0.7rem;
}
.hero h1 {
    max-width: 16ch;
    font-size: clamp(2.1rem, 5vw, 3.6rem);
    line-height: 1.12;
    margin-bottom: 1rem;
}
.hero-lead { max-width: 46rem; font-size: 1.15rem; color: rgba(255,255,255,0.88); }
.hero-search {
    display: flex;
    gap: 0.75rem;
    margin: 2rem 0 2.2rem;
    max-width: 42rem;
}
.hero-search input {
    flex: 1;
    border: 0;
    border-radius: 999px;
    padding: 0.9rem 1.2rem;
}
.hero-search .btn { border-radius: 999px; padding: 0.9rem 1.3rem; }
.stat-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
    max-width: 40rem;
}
.stat-row dt { font-family: var(--serif); font-size: 2rem; }
.stat-row dd { margin: 0; color: rgba(255,255,255,0.75); }

.section { padding: 3.5rem 0; }
.section-muted { background: #efeae1; }
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.section-heading h2 { margin: 0; }

.paper-grid, .paper-list { display: grid; gap: 1.1rem; }
.paper-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.paper-card, .category-card, .how-card, .side-card, .panel, .content-block, .auth-panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(13,59,76,0.05);
}

.paper-card {
    padding: 1.25rem 1.3rem 1.3rem;
    border-left: 4px solid var(--turquoise);
}
.paper-card-title { font-size: 1.25rem; margin: 0.35rem 0 0.4rem; }
.paper-card-title a { text-decoration: none; color: var(--navy); }
.paper-card-authors, .paper-card-excerpt, .paper-card-meta { color: var(--muted); }
.paper-card-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; font-size: 0.88rem; }

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.chip {
    display: inline-block;
    background: #e7f6f4;
    color: var(--navy);
    text-decoration: none;
    border-radius: 999px;
    padding: 0.15rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.verify-badge, .status-pill, .meta-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 0.18rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
}
.verify-ai { background: #f3ead4; color: #7a5b16; }
.verify-partial { background: #d9f3ef; color: #14685f; }
.verify-full { background: #e5f2e2; color: #215c28; }
.status-draft { background: #eef2f4; color: #42555d; }
.status-submitted { background: #e7eefc; color: #27448c; }
.status-approved { background: #e5f2e2; color: #215c28; }
.status-returned { background: #fff3d6; color: #8a5a00; }
.status-rejected, .status-archived { background: #fde8e6; color: var(--danger); }
.status-published { background: #d9f3ef; color: #14685f; }
.status-unpublished { background: #eee; color: #555; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.category-card { padding: 1.2rem; text-decoration: none; color: inherit; }
.category-card span { display: block; color: var(--muted); font-size: 0.9rem; }

.how-card { padding: 1.4rem; height: 100%; }
.how-num { color: var(--turquoise-dark); font-weight: 700; letter-spacing: 0.08em; }

.page-header { padding: 3rem 0 0.5rem; }
.page-header h1 { margin-bottom: 0.4rem; }

.filter-bar { margin-bottom: 1.5rem; }
.result-count, .empty-note, .form-help { color: var(--muted); }

.paper-page { padding: 2.5rem 0 4rem; }
.paper-hero { margin-bottom: 2rem; }
.paper-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.paper-authors { font-size: 1.1rem; }
.paper-biblio, .paper-status-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; color: var(--muted); }
.content-block { padding: 1.3rem 1.4rem; margin-bottom: 1rem; }
.lead-block { border-left: 4px solid var(--turquoise); }
.side-card { padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.side-card h2, .content-block h2, .form-section h2, .panel-head h2 { font-size: 1.15rem; }
.detail-list { margin: 0; }
.detail-list div { margin-bottom: 0.75rem; }
.detail-list dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.detail-list dd { margin: 0; }
.citation { font-size: 0.95rem; }
.version-list { padding-left: 1.1rem; margin: 0; }

.site-footer {
    background: var(--navy-dark);
    color: rgba(255,255,255,0.82);
    padding: 2.5rem 0;
    margin-top: 1rem;
}
.footer-brand { font-size: 1.4rem; color: #fff; margin-bottom: 0.3rem; }
.footer-tagline { color: var(--turquoise); }
.footer-meta { font-size: 0.95rem; }

.layout-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        linear-gradient(160deg, var(--navy), #135264);
    padding: 2rem 1rem;
}
.auth-panel { width: min(440px, 100%); padding: 2rem; }
.brand-auth { color: var(--navy) !important; margin-bottom: 1.2rem; }
.brand-auth small { color: var(--muted); }
.auth-copy, .auth-back { color: var(--muted); }

.layout-dash { background: #eef3f4; }
.dash-wrap { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.dash-sidebar {
    background: var(--navy);
    color: #fff;
    padding: 1.3rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sidebar-user { margin: 0; color: rgba(255,255,255,0.8); }
.dash-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.dash-nav a {
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    padding: 0.45rem 0.7rem;
    border-radius: 8px;
}
.dash-nav a.active, .dash-nav a:hover { background: rgba(43,187,173,0.18); color: #fff; }
.sidebar-logout button {
    background: none;
    border: 0;
    color: rgba(255,255,255,0.7);
    padding: 0;
}
.dash-topbar, .dash-content, .dash-footer { padding: 1.25rem 1.6rem; }
.dash-topbar { display: flex; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); background: #f7fafb; }
.dash-topbar h1 { font-size: 1.45rem; margin: 0; }
.dash-footer { color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }
.panel { padding: 1rem 1.1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.panel-head h2 { margin: 0; }

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}
.stat-cards article {
    background: var(--paper);
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid var(--line);
}
.stat-cards strong { display: block; font-family: var(--serif); font-size: 1.8rem; }
.queue-list, .log-list { list-style: none; padding: 0; margin: 0; }
.queue-list li, .log-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--line);
}
.queue-list small, .log-list span { display: block; color: var(--muted); }

.form-section {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.3rem;
    margin-bottom: 1rem;
}
.form-actions, .admin-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.category-checks { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.check-pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    background: #fff;
}
.meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    margin-bottom: 1rem;
    color: var(--muted);
}
.flash-stack { margin: 1rem 0; }
.layout-public .flash-stack { margin: 1rem auto; max-width: 1140px; padding: 0 0.75rem; }
.pagination { justify-content: center; margin-top: 1.5rem; }
.table { margin: 0; }

.sidebar-toggle {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 0.35rem 0.7rem;
}

@media (max-width: 991px) {
    .hero-search, .stat-row, .stat-cards, .dash-wrap { grid-template-columns: 1fr; display: flex; flex-direction: column; }
    .hero-search { display: flex; }
    .dash-sidebar { display: none; }
    .dash-sidebar.open { display: flex; position: sticky; top: 0; z-index: 20; }
}

@media print {
    .site-header, .site-footer, .hero-search { display: none; }
    body { background: #fff; }
}
