/*
 * Cortex PKMS — Stylesheet
 *
 * Design direction: Refined editorial minimalism.
 * Warm neutrals, precise typography, generous whitespace.
 * Instrument Serif for display, DM Sans for body, JetBrains Mono for data.
 */

/* ═══════════════════════════════════════════════════════════════════════════
   TOKENS
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
    /* Palette: warm stone + muted teal accent */
    --c-bg:           #FAF9F7;
    --c-bg-raised:    #FFFFFF;
    --c-bg-subtle:    #F3F1EE;
    --c-bg-sidebar:   #F7F6F3;
    --c-border:       #E8E5E0;
    --c-border-light: #F0EDE8;
    --c-text:         #2C2825;
    --c-text-mid:     #6B6560;
    --c-text-light:   #9B9590;
    --c-accent:       #3D7A6E;
    --c-accent-soft:  #E8F2EF;
    --c-accent-hover: #2D5F55;
    --c-danger:       #C0413B;
    --c-danger-soft:  #FDF0EF;
    --c-warning:      #C9862A;
    --c-warning-soft: #FEF6EC;
    --c-success:      #3D7A4A;
    --c-success-soft: #EEF6EF;

    /* Credibility gauge */
    --gauge-track:    #E8E5E0;

    /* Typography */
    --f-display: 'Instrument Serif', Georgia, serif;
    --f-body:    'DM Sans', system-ui, -apple-system, sans-serif;
    --f-mono:    'JetBrains Mono', 'SFMono-Regular', monospace;

    /* Spacing scale (4px base) */
    --s-1: 0.25rem;  --s-2: 0.5rem;  --s-3: 0.75rem;
    --s-4: 1rem;     --s-5: 1.25rem; --s-6: 1.5rem;
    --s-8: 2rem;     --s-10: 2.5rem; --s-12: 3rem;
    --s-16: 4rem;    --s-20: 5rem;

    /* Radii */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;
    --r-xl: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(44,40,37,0.04);
    --shadow-md: 0 2px 8px rgba(44,40,37,0.06), 0 1px 2px rgba(44,40,37,0.04);
    --shadow-lg: 0 8px 24px rgba(44,40,37,0.08), 0 2px 6px rgba(44,40,37,0.04);

    /* Transitions */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure the HTML hidden attribute always wins over display rules in this stylesheet */
[hidden] { display: none !important; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--f-body);
    font-weight: 400;
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--c-accent); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--c-accent-hover); }

img { max-width: 100%; height: auto; display: block; }

mark {
    background: var(--c-warning-soft);
    color: var(--c-text);
    padding: 0 2px;
    border-radius: 2px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */
.nav-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250,249,247,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--c-border-light);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--s-8);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    color: var(--c-text);
    font-family: var(--f-display);
    font-size: 1.2rem;
    letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--c-text); }

.nav-logo { width: 28px; height: 28px; }

.nav-links { display: flex; align-items: center; gap: var(--s-1); }

.nav-link {
    padding: var(--s-2) var(--s-3);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-text-mid);
    border-radius: var(--r-md);
    transition: all 0.2s var(--ease);
}
.nav-link:hover { color: var(--c-text); background: var(--c-bg-subtle); }
.nav-link.active { color: var(--c-accent); background: var(--c-accent-soft); }
.nav-link--subtle { color: var(--c-text-light); }


/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ═══════════════════════════════════════════════════════════════════════════ */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--s-8);
}


/* ═══════════════════════════════════════════════════════════════════════════
   FLASH MESSAGES
   ═══════════════════════════════════════════════════════════════════════════ */
.flash {
    max-width: 1400px;
    margin: var(--s-4) auto 0;
    padding: var(--s-3) var(--s-5);
    border-radius: var(--r-md);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: flashIn 0.3s var(--ease);
}
.flash--success { background: var(--c-success-soft); color: var(--c-success); }
.flash--error   { background: var(--c-danger-soft); color: var(--c-danger); }
.flash--info    { background: var(--c-accent-soft); color: var(--c-accent); }
.flash-close {
    background: none; border: none; font-size: 1.2rem; cursor: pointer;
    color: inherit; opacity: 0.6; padding: var(--s-1);
}
.flash-close:hover { opacity: 1; }

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


/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-2) var(--s-5);
    font-family: var(--f-body);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    line-height: 1.4;
}
.btn--primary {
    background: var(--c-accent);
    color: #fff;
}
.btn--primary:hover { background: var(--c-accent-hover); color: #fff; }
.btn--secondary {
    background: var(--c-bg-raised);
    color: var(--c-text);
    border-color: var(--c-border);
}
.btn--secondary:hover { border-color: var(--c-text-light); }
.btn--ghost {
    background: transparent;
    color: var(--c-text-mid);
    border-color: var(--c-border-light);
}
.btn--ghost:hover { border-color: var(--c-border); color: var(--c-text); }
.btn--danger {
    background: transparent;
    color: var(--c-danger);
    border-color: var(--c-danger);
}
.btn--danger:hover { background: var(--c-danger); color: #fff; }
.btn--full { width: 100%; justify-content: center; }

.btn__loading { display: inline-flex; align-items: center; gap: var(--s-2); }
.spinner {
    width: 16px; height: 16px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-field {
    margin-bottom: var(--s-5);
}
.form-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--c-text-mid);
    margin-bottom: var(--s-2);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.form-optional {
    text-transform: none;
    font-weight: 400;
    color: var(--c-text-light);
}

input[type="text"], input[type="url"], input[type="search"],
input[type="password"], input[type="email"], textarea, select {
    width: 100%;
    padding: var(--s-3) var(--s-4);
    font-family: var(--f-body);
    font-size: 0.9375rem;
    color: var(--c-text);
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
    outline: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-soft);
}
textarea { resize: vertical; min-height: 140px; line-height: 1.6; }
select { cursor: pointer; }

.form-actions { margin-top: var(--s-6); }
.inline-form { display: inline-block; }

/* Range slider */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--c-border);
    border-radius: 2px;
    border: none;
    padding: 0;
    margin: var(--s-2) 0;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    background: var(--c-accent);
    border-radius: 50%;
    cursor: pointer;
}
.range-value {
    font-size: 0.8125rem;
    font-family: var(--f-mono);
    color: var(--c-text-mid);
}


/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(61,122,110,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(201,134,42,0.03) 0%, transparent 50%),
        var(--c-bg);
}

.login-wrapper { text-align: center; width: 100%; max-width: 380px; padding: var(--s-8); }

.login-card {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-light);
    border-radius: var(--r-xl);
    padding: var(--s-10) var(--s-8) var(--s-8);
    box-shadow: var(--shadow-lg);
}

.login-header { margin-bottom: var(--s-8); }
.login-logo { width: 48px; height: 48px; color: var(--c-accent); margin: 0 auto var(--s-4); }
.login-title {
    font-family: var(--f-display);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: var(--s-1);
}
.login-subtitle { color: var(--c-text-light); font-size: 0.9375rem; }

.login-form { text-align: left; }
.login-form .form-field label { text-align: left; }
.login-form .btn { margin-top: var(--s-2); padding: var(--s-3) var(--s-5); }

.login-footer {
    margin-top: var(--s-6);
    font-size: 0.75rem;
    color: var(--c-text-light);
}


/* ═══════════════════════════════════════════════════════════════════════════
   INGEST PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.page-header { margin-bottom: var(--s-8); }
.page-title {
    font-family: var(--f-display);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
}
.page-desc {
    color: var(--c-text-mid);
    margin-top: var(--s-2);
    font-size: 0.9375rem;
}

.ingest-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--s-10);
    align-items: start;
}
@media (max-width: 900px) {
    .ingest-layout { grid-template-columns: 1fr; }
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--c-border);
    border-radius: var(--r-lg);
    padding: var(--s-10) var(--s-8);
    text-align: center;
    transition: all 0.25s var(--ease);
    margin-bottom: var(--s-6);
    position: relative;
    cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--c-accent);
    background: var(--c-accent-soft);
}
.drop-zone__input { display: none; }
.drop-zone__icon {
    width: 36px; height: 36px;
    color: var(--c-text-light);
    margin: 0 auto var(--s-3);
}
.drop-zone__text { color: var(--c-text-mid); font-size: 0.9375rem; }
.drop-zone__browse {
    color: var(--c-accent); cursor: pointer; font-weight: 500;
    text-decoration: underline; text-underline-offset: 2px;
}
.drop-zone__hint { display: block; color: var(--c-text-light); font-size: 0.8125rem; margin-top: var(--s-2); }

.drop-zone__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-5);
    background: var(--c-accent-soft);
    border-radius: var(--r-md);
    margin-top: var(--s-3);
}
.drop-zone__filename {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-accent);
}
.drop-zone__remove {
    background: none; border: none; font-size: 1.2rem;
    color: var(--c-text-light); cursor: pointer;
}
.drop-zone__remove:hover { color: var(--c-danger); }

/* Sidebar Stats */
.stat-card {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-light);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
}
.stat-card__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-text-light);
    margin-bottom: var(--s-3);
}
.stat-card__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }

.stat-item { text-align: center; }
.stat-item__value {
    display: block;
    font-family: var(--f-mono);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--c-text);
}
.stat-item__label {
    font-size: 0.75rem;
    color: var(--c-text-light);
}

.format-list { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.format-badge {
    font-family: var(--f-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--c-bg-subtle);
    border-radius: var(--r-sm);
    color: var(--c-text-mid);
    letter-spacing: 0.03em;
}


/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--s-8);
    align-items: start;
}
.dashboard-layout > * { min-width: 0; }
@media (max-width: 960px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .dash-sidebar { order: 2; }
}

/* Sidebar */
.dash-sidebar {
    position: sticky;
    top: 72px; /* below nav */
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    padding-right: var(--s-2);
}

.sidebar-section {
    margin-bottom: var(--s-6);
    padding-bottom: var(--s-6);
    border-bottom: 1px solid var(--c-border-light);
}
.sidebar-section:last-child { border-bottom: none; }

.sidebar-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--c-text-light);
    margin-bottom: var(--s-3);
}

.sidebar-section--alert {
    background: var(--c-warning-soft);
    margin: 0 calc(-1 * var(--s-3));
    padding: var(--s-4);
    border-radius: var(--r-md);
    border-bottom: none;
}
.sidebar-section--alert .sidebar-title { color: var(--c-warning); }

/* Mini stats grid */
.stat-mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3);
}
.stat-mini { text-align: center; padding: var(--s-2); }
.stat-mini__val {
    display: block;
    font-family: var(--f-mono);
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--c-text);
}
.stat-mini__lbl { font-size: 0.6875rem; color: var(--c-text-light); }

/* Filters */
.filter-form .filter-group {
    margin-bottom: var(--s-4);
}
.filter-form label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--c-text-mid);
    margin-bottom: var(--s-1);
}
.filter-form select {
    padding: var(--s-2) var(--s-3);
    font-size: 0.8125rem;
}

/* Category tree */
.category-tree { list-style: none; }
.category-tree ul { list-style: none; padding-left: var(--s-4); }
.category-link {
    display: flex;
    justify-content: space-between;
    padding: var(--s-1) var(--s-2);
    font-size: 0.8125rem;
    color: var(--c-text-mid);
    border-radius: var(--r-sm);
    transition: all 0.15s var(--ease);
}
.category-link:hover { background: var(--c-bg-subtle); color: var(--c-text); }
.category-link.active { color: var(--c-accent); font-weight: 500; }
.category-count {
    font-family: var(--f-mono);
    font-size: 0.6875rem;
    color: var(--c-text-light);
}

/* Tag cloud */
.tag-cloud { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.tag-pill {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 100px;
    background: var(--c-bg-subtle);
    color: var(--c-text-mid);
    transition: all 0.15s var(--ease);
    border: 1px solid transparent;
}
.tag-pill:hover { background: var(--c-accent-soft); color: var(--c-accent); border-color: var(--c-accent-soft); }
.tag-pill--active { background: var(--c-accent); color: #fff; }

/* Expiring list */
.expiring-list { list-style: none; }
.expiring-link {
    display: flex;
    justify-content: space-between;
    padding: var(--s-1) 0;
    font-size: 0.8125rem;
    color: var(--c-text);
}
.expiring-link time { font-family: var(--f-mono); font-size: 0.75rem; color: var(--c-warning); }

/* Search bar */
.search-bar {
    position: relative;
    margin-bottom: var(--s-5);
}
.search-bar__icon {
    position: absolute;
    left: var(--s-4);
    top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    color: var(--c-text-light);
    pointer-events: none;
}
.search-bar__input {
    padding-left: calc(var(--s-4) + 26px) !important;
    font-size: 1rem !important;
    height: 48px;
}

/* Results meta */
.results-meta {
    display: flex;
    align-items: baseline;
    gap: var(--s-2);
    margin-bottom: var(--s-5);
    font-size: 0.8125rem;
    color: var(--c-text-light);
}
.results-count { font-weight: 500; color: var(--c-text-mid); }
.results-clear {
    color: var(--c-danger);
    font-size: 0.75rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--s-16) var(--s-8);
    color: var(--c-text-light);
}
.empty-state__icon { width: 48px; height: 48px; margin: 0 auto var(--s-4); opacity: 0.5; }
.empty-state p { margin-bottom: var(--s-5); }


/* ═══════════════════════════════════════════════════════════════════════════
   ENTRY CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.entry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--s-4);
}

.entry-card {
    display: flex;
    flex-direction: column;
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-light);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    transition: all 0.25s var(--ease);
    color: var(--c-text);
    text-decoration: none;
}
.entry-card:hover {
    border-color: var(--c-border);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: var(--c-text);
}

.entry-card__header {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-3);
}

.entry-card__type {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    background: var(--c-bg-subtle);
    color: var(--c-text-mid);
}
.type--quote { background: #F3EEFF; color: #6E42C1; }
.type--image { background: #FFF3E0; color: #BF6A02; }
.type--link, .type--bookmark { background: #E8F2EF; color: var(--c-accent); }
.type--document { background: #EEF0F8; color: #4458A0; }

.entry-card__validity {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: var(--r-sm);
}
.validity--perm  { background: var(--c-success-soft); color: var(--c-success); }
.validity--semi  { background: var(--c-accent-soft); color: var(--c-accent); }
.validity--temp  { background: var(--c-warning-soft); color: var(--c-warning); }

.entry-card__title {
    font-family: var(--f-display);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.35;
    margin-bottom: var(--s-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.entry-card__excerpt {
    font-size: 0.8125rem;
    color: var(--c-text-mid);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--s-3);
}

.entry-card__footer {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding-top: var(--s-3);
    border-top: 1px solid var(--c-border-light);
    font-size: 0.75rem;
}

.entry-card__cred {
    font-family: var(--f-mono);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: var(--r-sm);
}
.cred--high    { background: var(--c-success-soft); color: var(--c-success); --gauge-fill: var(--c-success); }
.cred--mid     { background: var(--c-warning-soft); color: var(--c-warning); --gauge-fill: var(--c-warning); }
.cred--low     { background: var(--c-danger-soft); color: var(--c-danger); --gauge-fill: var(--c-danger); }
.cred--unknown { background: var(--c-bg-subtle); color: var(--c-text-light); --gauge-fill: var(--c-text-light); }

.entry-card__date { color: var(--c-text-light); }
.entry-card__tags { display: flex; gap: var(--s-1); margin-left: auto; }
.micro-tag {
    font-size: 0.625rem;
    padding: 1px 6px;
    background: var(--c-bg-subtle);
    border-radius: var(--r-sm);
    color: var(--c-text-light);
}


/* ═══════════════════════════════════════════════════════════════════════════
   ENTRY DETAIL PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--s-10);
    align-items: start;
}
/* Prevent grid children from overflowing their column */
.detail-layout > * { min-width: 0; }
@media (max-width: 900px) {
    .detail-layout { grid-template-columns: 1fr; }
}

.breadcrumb {
    font-size: 0.8125rem;
    color: var(--c-text-light);
    margin-bottom: var(--s-5);
}
.breadcrumb a { color: var(--c-text-light); }
.breadcrumb a:hover { color: var(--c-accent); }
.breadcrumb__sep { margin: 0 var(--s-2); }

.detail-header { margin-bottom: var(--s-6); }
.detail-header__meta {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
    font-size: 0.8125rem;
    color: var(--c-text-light);
}

.status-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: var(--r-sm);
}
.status--active   { background: var(--c-success-soft); color: var(--c-success); }
.status--pending  { background: var(--c-warning-soft); color: var(--c-warning); }
.status--archived { background: var(--c-bg-subtle); color: var(--c-text-light); }
.status--obsolete { background: var(--c-danger-soft); color: var(--c-danger); }
.status--failed   { background: var(--c-danger-soft); color: var(--c-danger); }

.detail-title {
    font-family: var(--f-display);
    font-size: 2.25rem;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

/* Content body */
.detail-body { margin-bottom: var(--s-8); }
.prose {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--c-text);
    overflow-wrap: break-word;
    word-break: break-word;
}
.prose--raw { font-family: var(--f-mono); font-size: 0.875rem; white-space: pre-wrap; overflow-wrap: break-word; }

.detail-media {
    margin: var(--s-6) 0;
}
.detail-image {
    border-radius: var(--r-lg);
    border: 1px solid var(--c-border-light);
    max-height: 600px;
    object-fit: contain;
}
.detail-source {
    margin-top: var(--s-4);
    font-size: 0.8125rem;
    color: var(--c-text-light);
    word-break: break-all;
}

/* AI Reasoning */
.detail-section { margin-bottom: var(--s-8); }
.detail-section__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-text-light);
    margin-bottom: var(--s-3);
    padding-bottom: var(--s-2);
    border-bottom: 1px solid var(--c-border-light);
}
.ai-reasoning {
    background: var(--c-bg-subtle);
    border-radius: var(--r-md);
    padding: var(--s-5);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--c-text-mid);
    overflow-wrap: break-word;
    word-break: break-word;
}
.ai-reasoning p + p { margin-top: var(--s-3); }

/* Actions */
.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    padding-top: var(--s-6);
    border-top: 1px solid var(--c-border-light);
}

/* Metadata sidebar */
.detail-sidebar {}
.meta-card {
    background: var(--c-bg-raised);
    border: 1px solid var(--c-border-light);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
}
.meta-card__title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--c-text-light);
    margin-bottom: var(--s-3);
}
.meta-card__detail {
    font-size: 0.8125rem;
    color: var(--c-text-mid);
    margin-top: var(--s-1);
}
.meta-card__empty { font-size: 0.8125rem; color: var(--c-text-light); font-style: italic; }
.meta-list { list-style: none; }
.meta-list li { padding: var(--s-1) 0; font-size: 0.8125rem; }

/* Credibility Gauge */
.cred-gauge { text-align: center; position: relative; }
.cred-gauge__svg { width: 120px; margin: 0 auto; }
.cred-gauge__value {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--f-mono);
    font-size: 1.5rem;
    font-weight: 500;
}

/* Validity badge */
.validity-badge {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: var(--s-1) var(--s-3);
    border-radius: var(--r-md);
}
.validity--permanent { background: var(--c-success-soft); color: var(--c-success); }
.validity--semipermanent { background: var(--c-accent-soft); color: var(--c-accent); }
.validity--temporary { background: var(--c-warning-soft); color: var(--c-warning); }


/* ═══════════════════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-4);
    margin-top: var(--s-8);
    padding-top: var(--s-6);
    border-top: 1px solid var(--c-border-light);
}
.pagination__link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--c-accent);
}
.pagination__info {
    font-size: 0.8125rem;
    color: var(--c-text-light);
    font-family: var(--f-mono);
}


/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY ANIMATION
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.entry-card { animation: fadeIn 0.35s var(--ease) both; }
.entry-card:nth-child(2)  { animation-delay: 0.03s; }
.entry-card:nth-child(3)  { animation-delay: 0.06s; }
.entry-card:nth-child(4)  { animation-delay: 0.09s; }
.entry-card:nth-child(5)  { animation-delay: 0.12s; }
.entry-card:nth-child(6)  { animation-delay: 0.15s; }
.entry-card:nth-child(n+7){ animation-delay: 0.18s; }
