/* ══════════════════════════════════════════════════════════════════════
   Cellovian Internal Hub — theme
   Brand: primary #00A862 · hover #008A50 · success #00D97E · navy #00122B
   ══════════════════════════════════════════════════════════════════════ */

:root { --brand: #00A862; --brand-strong: #008A50; --brand-success: #00D97E; --navy: #00122B; }

/* Light: clean cool-neutral surfaces, green only as accent. */
body.theme-light {
    --bg-main: #eef1f5;
    --surface: #ffffff;
    --surface-muted: #f4f6f9;
    --text-strong: #0b1726;
    --text-body: #283543;
    --text-muted: #687585;
    --border: #e3e8ee;
    --border-strong: #c3ccd6;
    --brand-soft: rgba(0,168,98,0.10);
    --shadow-soft: 0 6px 20px rgba(15,30,50,0.06);
}
/* Dark: neutral slate (NOT green-tinted). Green reserved for accents/badges. */
body.theme-dark {
    --bg-main: #0e1217;
    --surface: #161b22;
    --surface-muted: #1c222b;
    --text-strong: #f2f5f8;
    --text-body: #ccd5de;
    --text-muted: #8b96a3;
    --border: #28303a;
    --border-strong: #3c4753;
    --brand-soft: rgba(0,168,98,0.15);
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
body {
    margin: 0; font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: radial-gradient(1100px 600px at 12% -10%, var(--brand-soft) 0%, var(--bg-main) 45%);
    color: var(--text-body); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.ph { line-height: 1; }

/* ── Top bar — navy brand bar in BOTH themes (matches public form; white logo needs dark bg) ── */
.topbar {
    position: sticky; top: 0; z-index: 30; height: 57px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem; background: var(--navy);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar-logo { height: 26px; }
.topbar-divider { width: 1px; height: 22px; background: rgba(255,255,255,0.16); }
.topbar-title { font-size: 0.8rem; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.topbar-sub { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.5); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 0.4rem; }
.icon-btn {
    height: 36px; width: 36px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.82); cursor: pointer; font-size: 1.05rem; transition: all 0.15s;
}
.icon-btn:hover { color: #fff; border-color: var(--brand); background: rgba(0,168,98,0.22); }
.ghost-link {
    display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.7rem;
    font-size: 0.82rem; font-weight: 600; color: rgba(255,255,255,0.72); border-radius: 10px; cursor: pointer;
    background: transparent; border: 1px solid transparent; font-family: inherit;
}
.ghost-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.ghost-link:focus-visible { outline: none; border-color: rgba(255,255,255,0.25); }
/* On the detail page the back-link + logo sit in the same navy bar */
.topbar .ghost-link i { font-size: 1rem; }
.nav-disabled { opacity: 0.3; pointer-events: none; }
.btn-primary {
    display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.9rem;
    font-size: 0.82rem; font-weight: 700; color: #fff; background: var(--brand);
    border: none; border-radius: 10px; cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: var(--brand-strong); }

/* ── List page ── */
.main { max-width: 72rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.eyebrow { display: flex; align-items: center; gap: 0.5rem; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--brand); margin: 0 0 0.6rem; }
.eyebrow::before { content: ''; width: 18px; height: 2px; background: var(--brand); border-radius: 2px; }
.page-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text-strong); margin: 0; }
.page-sub { font-size: 0.9rem; color: var(--text-muted); margin: 0.4rem 0 0; }

.toolbar { display: flex; gap: 0.75rem; margin: 1.75rem 0 2rem; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 240px; }
.search-wrap i { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box, .select-box {
    width: 100%; padding: 0.7rem 1rem; font-size: 0.85rem; color: var(--text-body);
    background: var(--surface); border: 1px solid var(--border); border-radius: 11px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box { padding-left: 2.5rem; }
.select-box { width: auto; cursor: pointer; }
.search-box:focus, .select-box:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2.25rem; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow-soft); }
.sc-top { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.sc-icon { height: 30px; width: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.sc-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.sc-value { font-size: 1.7rem; font-weight: 800; color: var(--text-strong); margin: 0; letter-spacing: -0.02em; }

.section-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 0 0 1rem; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }

.intake-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-soft); transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; overflow: hidden; }
.intake-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: 0 14px 32px rgba(0,40,24,0.12); }
.ic-body { padding: 1.25rem 1.25rem 1rem; flex: 1; }
.ic-identity { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.85rem; }
.ic-logo { height: 44px; width: 44px; border-radius: 11px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--navy), #0a3a5c); object-fit: cover; }
.ic-titles h3 { font-size: 0.98rem; font-weight: 700; color: var(--text-strong); margin: 0; letter-spacing: -0.01em; }
.ic-legal { font-size: 0.72rem; color: var(--text-muted); margin: 0.1rem 0 0; }
.ic-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.ic-updated { font-size: 0.7rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.25rem; }
.ic-services { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.svc-chip { font-size: 0.66rem; font-weight: 600; padding: 0.18rem 0.5rem; border-radius: 7px; background: var(--brand-soft); color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); }
.ic-footer { display: flex; align-items: center; justify-content: space-between; padding: 0.8rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-muted); }
.ic-added { font-size: 0.7rem; color: var(--text-muted); }
.ic-cta { font-size: 0.76rem; font-weight: 700; color: var(--brand); display: inline-flex; align-items: center; gap: 0.3rem; }

/* ── Smart-view chips ── */
.view-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.view-chip { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0.45rem 0.9rem; cursor: pointer; transition: all 0.15s; }
.view-chip:hover { border-color: var(--border-strong); color: var(--text-body); }
.view-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.view-chip i { font-size: 0.95rem; }

/* ── Card internal line (owner + follow-up) ── */
.ic-internal { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px dashed var(--border); }
.ic-owner { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.74rem; font-weight: 600; color: var(--text-body); }
.ic-owner i { color: var(--brand); }
.fu-pill { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; }
.fu-overdue { background: #fee2e2; color: #b91c1c; }
.fu-soon { background: #fef3c7; color: #92400e; }
.fu-future { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); }
body.theme-dark .fu-overdue { background: #4c1d1d; color: #fca5a5; }
body.theme-dark .fu-soon { background: #4a3a17; color: #fcd34d; }

/* ── Status badges ── */
.status-badge { font-size: 0.62rem; font-weight: 700; padding: 0.18rem 0.55rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
body.theme-light .status-pending   { background: #fef3c7; color: #92400e; }
body.theme-light .status-reviewed  { background: #dbeafe; color: #1e40af; }
body.theme-light .status-onboarded { background: #d1fae5; color: #065f46; }
body.theme-dark  .status-pending   { background: #4a3a17; color: #fcd34d; }
body.theme-dark  .status-reviewed  { background: #1c3a5e; color: #93c5fd; }
body.theme-dark  .status-onboarded { background: #0f4035; color: #6ee7b7; }

/* ── Skeleton + empty ── */
.skeleton { background: linear-gradient(90deg, var(--surface-muted) 25%, var(--border) 37%, var(--surface-muted) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 16px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); }
.empty-icon { height: 60px; width: 60px; border-radius: 16px; margin: 0 auto 1rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; background: var(--brand-soft); color: var(--brand); }

/* ── Detail page layout ── */
.detail-wrap { display: flex; min-height: calc(100vh - 57px); }
.sidebar { position: fixed; top: 57px; left: 0; bottom: 0; width: 230px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 1rem 0; z-index: 20; }
.sidebar-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); padding: 0.5rem 1rem 0.3rem; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding-right: 0.6rem; }
.sidebar-toggle { font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand); background: none; border: none; cursor: pointer; padding: 0.5rem 0; }
.sidebar-toggle:hover { color: var(--brand-strong); }
.nav-item.nav-empty { opacity: 0.5; }
.nav-item.nav-empty .nav-pct { background: transparent; border: 1px dashed var(--border-strong); }
.nav-item { display: flex; align-items: center; gap: 0.55rem; padding: 0.55rem 1rem; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; border-left: 3px solid transparent; transition: all 0.12s; }
.nav-item:hover { background: var(--surface-muted); color: var(--text-body); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); border-left-color: var(--brand); font-weight: 700; }
.nav-item i { font-size: 1rem; }
.detail-main { margin-left: 230px; margin-right: 300px; flex: 1; padding: 2rem 2.25rem 5rem; min-width: 0; }

/* ── Right quick-action rail ── */
.right-rail { position: fixed; top: 57px; right: 0; bottom: 0; width: 300px; background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 1.25rem; z-index: 19; }
.rail-title { font-size: 0.8rem; font-weight: 800; color: var(--text-strong); margin-bottom: 1rem; }
.rail-cta { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; font-size: 0.85rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-strong)); border: none; border-radius: 11px; padding: 0.7rem; cursor: pointer; margin-bottom: 1.25rem; box-shadow: 0 4px 14px rgba(0,168,98,0.25); transition: transform 0.12s, box-shadow 0.12s; }
.rail-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,168,98,0.35); }
.rail-cta i { font-size: 1.05rem; }
.rail-cta-badge { font-size: 0.58rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; background: rgba(255,255,255,0.25); padding: 0.1rem 0.4rem; border-radius: 5px; }
.rail-group { margin-bottom: 1.1rem; }
.rail-label { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.4rem; }
.rail-select, .rail-input, .rail-textarea { width: 100%; font-size: 0.82rem; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-muted); color: var(--text-body); outline: none; font-family: inherit; }
.rail-select:focus, .rail-input:focus, .rail-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.rail-select { cursor: pointer; text-transform: capitalize; }
.rail-textarea { min-height: 62px; resize: vertical; margin-bottom: 0.5rem; }
.rail-add { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; font-size: 0.78rem; font-weight: 700; color: #fff; background: var(--brand); border: none; border-radius: 9px; padding: 0.5rem; cursor: pointer; }
.rail-add:hover { background: var(--brand-strong); }
.rail-activity { display: flex; flex-direction: column; gap: 0.7rem; }
.rail-act { display: flex; flex-direction: column; gap: 0.15rem; }
.rail-act-text { font-size: 0.78rem; color: var(--text-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-act-by { font-size: 0.66rem; color: var(--text-muted); }

.detail-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.detail-logo { height: 56px; width: 56px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem; color: #fff; background: linear-gradient(135deg, var(--navy), #0a3a5c); object-fit: cover; flex-shrink: 0; }
.detail-title { font-size: 1.5rem; font-weight: 800; color: var(--text-strong); margin: 0; letter-spacing: -0.02em; }
.detail-subtitle { font-size: 0.85rem; color: var(--text-muted); margin: 0.25rem 0 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.5rem; box-shadow: var(--shadow-soft); margin-bottom: 1.5rem; scroll-margin-top: 75px; }
.section-card-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; }
.section-card-head .sch-icon { height: 34px; width: 34px; border-radius: 10px; background: var(--surface-muted); border: 1px solid var(--border); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.section-card-head h2 { font-size: 1.05rem; font-weight: 700; color: var(--text-strong); margin: 0; }
.fields-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }

/* ── Field cards (display + inline edit) ── */
.field-card { background: var(--surface-muted); border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 0.9rem; position: relative; transition: border-color 0.12s; }
.field-card:hover { border-color: var(--border-strong); }
.field-card.span2 { grid-column: 1 / -1; }
.fc-label { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.3rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
/* Visible by default (was hover-only — failed on touch devices) */
.fc-edit-btn { opacity: 0.45; cursor: pointer; color: var(--text-muted); font-size: 0.95rem; transition: opacity 0.12s, color 0.12s; border: none; background: none; padding: 0.1rem; }
.field-card:hover .fc-edit-btn { opacity: 1; }
.fc-edit-btn:hover { color: var(--brand); }
.fc-value { font-size: 0.88rem; color: var(--text-strong); font-weight: 500; word-break: break-word; white-space: pre-wrap; }
.fc-value.empty { color: var(--text-muted); font-weight: 400; font-style: italic; }
.fc-value a { color: var(--brand); text-decoration: underline; }
.fc-copywrap { display: inline-flex; align-items: center; gap: 0.4rem; max-width: 100%; }
.copy-btn { opacity: 0.4; border: none; background: none; cursor: pointer; color: var(--text-muted); font-size: 0.9rem; padding: 0.05rem; flex-shrink: 0; }
.field-card:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--brand); }
.fc-bool { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; }
.fc-bool.yes { color: var(--brand); }
.fc-bool.no { color: var(--text-muted); }
.swatch-row { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border-strong); }

/* edit mode */
.fc-input, .fc-textarea, .fc-select { width: 100%; font-size: 0.85rem; color: var(--text-body); background: var(--surface); border: 1px solid var(--brand); border-radius: 8px; padding: 0.45rem 0.6rem; outline: none; font-family: inherit; }
.fc-textarea { resize: vertical; min-height: 64px; }
.fc-edit-actions { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.fc-save, .fc-cancel { font-size: 0.72rem; font-weight: 700; padding: 0.3rem 0.7rem; border-radius: 7px; cursor: pointer; border: 1px solid var(--border); }
.fc-save { background: var(--brand); color: #fff; border-color: var(--brand); }
.fc-save:hover { background: var(--brand-strong); }
.fc-cancel { background: var(--surface); color: var(--text-muted); }
.fc-cancel:hover { color: var(--text-strong); }
.fc-checkbox { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* editable status badge in the detail header */
.header-status { appearance: none; -webkit-appearance: none; border: none; cursor: pointer; padding: 0.2rem 1.3rem 0.2rem 0.6rem; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor'%3e%3cpath d='M5.5 7.5L10 12l4.5-4.5z'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.35rem center; background-size: 0.85rem; }

/* status select inline */
.status-select { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.25rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-body); cursor: pointer; }

/* toast */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--navy); color: #fff; padding: 0.7rem 1.2rem; border-radius: 11px; font-size: 0.82rem; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 60; transition: transform 0.3s ease; display: flex; align-items: center; gap: 0.5rem; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #b91c1c; }

/* ── Login ── */
/* Navy page bg so the white-text logo (placed above the card) stays visible. */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: radial-gradient(900px 500px at 50% -10%, #062a1c 0%, var(--navy) 60%); }
.login-stack { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; width: 100%; max-width: 380px; }
.login-card { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 2.5rem; box-shadow: 0 20px 50px rgba(0,0,0,0.35); }
.login-logo { height: 34px; display: block; }
.login-label { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.4rem; }
.login-input { width: 100%; padding: 0.7rem 0.9rem; font-size: 0.88rem; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 11px; outline: none; margin-bottom: 1rem; color: var(--text-body); }
.login-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.login-btn { width: 100%; padding: 0.75rem; font-size: 0.88rem; font-weight: 700; color: #fff; background: var(--brand); border: none; border-radius: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.login-btn:hover { background: var(--brand-strong); }
.login-error { color: #dc2626; font-size: 0.8rem; margin-bottom: 0.75rem; }

/* ── Sidebar completion pill ── */
.nav-item { justify-content: flex-start; }
.nav-pct { margin-left: auto; font-size: 0.6rem; font-weight: 700; padding: 0.05rem 0.35rem; border-radius: 5px; background: var(--border); color: var(--text-muted); }
.nav-item.active .nav-pct { background: var(--brand); color: #fff; }
.nav-pct.full { background: var(--brand-soft); color: var(--brand); }

/* ── Key Facts strip ── */
.key-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.1rem 1.25rem; box-shadow: var(--shadow-soft); margin-bottom: 1.5rem; }
.kf-item { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.kf-label { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.kf-value { font-size: 0.92rem; font-weight: 700; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kf-value a { color: var(--brand); }

/* ── Internal section (subtle accent, NOT a green block) ── */
.section-card.internal { border: 1px solid var(--border); border-left: 3px solid var(--brand); background: var(--surface); }
.section-card.internal .sch-icon { background: var(--navy); color: #fff; }
.internal-tag { font-size: 0.58rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--border-strong); padding: 0.1rem 0.4rem; border-radius: 5px; margin-left: 0.5rem; }
.nav-item.internal-nav { color: var(--text-muted); }

/* ── Collapsible sections ── */
.section-card-head { cursor: pointer; user-select: none; }
.section-caret { margin-left: auto; color: var(--text-muted); transition: transform 0.2s; font-size: 1.05rem; }
.section-card.collapsed .section-caret { transform: rotate(-90deg); }
.section-card.collapsed .fields-grid { display: none; }

/* ── Not-in-submission sections ── */
.empty-tag { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.58rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #b45309; background: #fef3c7; border: 1px solid #fcd34d; padding: 0.12rem 0.45rem; border-radius: 5px; margin-left: 0.5rem; }
body.theme-dark .empty-tag { background: #4a3a17; color: #fcd34d; border-color: #6b521f; }
.section-empty .sch-icon { opacity: 0.55; }
.section-empty > .section-card-head h2 { color: var(--text-muted); }

/* ── Bulk "Edit all" ── */
.sec-editall { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; font-weight: 700; color: var(--text-muted); background: var(--surface-muted); border: 1px solid var(--border); border-radius: 8px; padding: 0.35rem 0.7rem; cursor: pointer; transition: all 0.15s; }
.sec-editall:hover { color: var(--brand); border-color: var(--brand); }
.section-card.editing .sec-editall { display: none; }
.section-card.editing .section-caret { display: none; }
.section-card.editing .fc-edit-btn { display: none; }
.section-edit-bar { display: none; gap: 0.5rem; justify-content: flex-end; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.section-card.editing .section-edit-bar { display: flex; }
.section-card.editing .section-caret + .fields-grid,
.section-card.editing .fields-grid { display: grid; }

/* ── Dense-section subgroup labels ── */
.subgroup-label { grid-column: 1 / -1; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--brand); margin: 0.4rem 0 0.1rem; padding-top: 0.4rem; border-top: 1px dashed var(--border); }
.subgroup-label:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* ── Directory card contact line ── */
.ic-contact { display: flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--text-muted); margin-top: 0.7rem; }
.ic-contact i { font-size: 0.9rem; color: var(--brand); }
.ic-contact .ic-email { color: var(--text-muted); }

/* ── Priority badges ── */
.prio-badge { font-size: 0.62rem; font-weight: 700; padding: 0.18rem 0.55rem; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.04em; }
.prio-low { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); }
.prio-normal { background: #dbeafe; color: #1e40af; }
.prio-high { background: #fef3c7; color: #92400e; }
.prio-urgent { background: #fee2e2; color: #b91c1c; }
body.theme-dark .prio-normal { background: #1c3a5e; color: #93c5fd; }
body.theme-dark .prio-high { background: #4a3a17; color: #fcd34d; }
body.theme-dark .prio-urgent { background: #4c1d1d; color: #fca5a5; }

/* ── "Acting as" identity bar ── */
.actor-bar { display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 1.25rem; flex-wrap: wrap; }
.actor-bar i { color: var(--brand); }
.actor-input { font-size: 0.8rem; padding: 0.35rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-body); outline: none; }
.actor-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ── Internal Files ── */
.files-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.file-card { display: flex; align-items: center; gap: 0.7rem; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 12px; padding: 0.7rem 0.85rem; transition: border-color 0.12s; }
.file-card:hover { border-color: var(--border-strong); }
.file-ic { font-size: 1.5rem; color: var(--brand); flex-shrink: 0; }
.file-thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0; display: block; border: 1px solid var(--border); }
.file-meta { min-width: 0; flex: 1; }
.file-name { font-size: 0.82rem; font-weight: 600; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name a { color: inherit; }
.file-name a:hover { color: var(--brand); }
.file-sub { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.1rem; }
.file-del { opacity: 0.4; cursor: pointer; color: var(--text-muted); border: none; background: none; font-size: 1rem; padding: 0.1rem; }
.file-card:hover .file-del { opacity: 1; }
.file-del:hover { color: #dc2626; }
.upload-drop { display: flex; align-items: center; justify-content: center; gap: 0.5rem; border: 1.5px dashed var(--border-strong); border-radius: 12px; padding: 1rem; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.15s; }
.upload-drop:hover, .upload-drop.drag { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.upload-drop i { font-size: 1.2rem; }
.files-empty { font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin-bottom: 0.75rem; }

/* ── Activity Log ── */
.log-composer { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.25rem; }
.log-textarea { width: 100%; min-height: 70px; resize: vertical; font-family: inherit; font-size: 0.85rem; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-body); outline: none; }
.log-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.log-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.log-add-btn { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 700; color: #fff; background: var(--brand); border: none; border-radius: 9px; padding: 0.5rem 1rem; cursor: pointer; }
.log-add-btn:hover { background: var(--brand-strong); }
.log-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.log-timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.log-entry { display: flex; gap: 0.85rem; padding-bottom: 1.1rem; position: relative; }
.log-entry::before { content: ''; position: absolute; left: 11px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.log-entry:last-child::before { display: none; }
.log-dot { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; flex-shrink: 0; z-index: 1; }
.log-body { flex: 1; min-width: 0; }
.log-text { font-size: 0.86rem; color: var(--text-body); white-space: pre-wrap; word-break: break-word; }
.log-byline { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }
.log-byline strong { color: var(--text-strong); font-weight: 600; }
.log-empty { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }
.log-system .log-dot { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); }
.log-system .log-text { color: var(--text-muted); font-size: 0.82rem; font-style: italic; }

/* ── Responsive ── */
@media (max-width: 1024px) { .summary-grid { grid-template-columns: repeat(2, 1fr); } .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1200px) {
    /* Hide the rail on narrower screens — its controls also live in the header + Internal section. */
    .right-rail { display: none; }
    .detail-main { margin-right: 0; }
}
@media (max-width: 860px) {
    .sidebar { position: static; width: 100%; height: auto; bottom: auto; border-right: none; border-bottom: 1px solid var(--border); display: flex; overflow-x: auto; padding: 0.4rem; gap: 0.25rem; }
    .sidebar-label { display: none; }
    .nav-item { flex-shrink: 0; white-space: nowrap; border-left: none; border-radius: 8px; padding: 0.45rem 0.7rem; }
    .nav-item.active { border-left: none; }
    .detail-main { margin-left: 0; margin-right: 0; padding: 1.25rem; }
    .detail-wrap { flex-direction: column; }
}
@media (max-width: 640px) { .card-grid, .summary-grid, .fields-grid { grid-template-columns: 1fr; } .main { padding: 1.5rem 1rem 3rem; } }
.hidden { display: none !important; }
