/* ==========================================================
   AI ERM Platform — design system
   Palette: Ink (authority) + Paper (calm) + Brass (the seal /
   sign-off motif) + Sage (approved) + Clay (needs attention).
   Type: Lora for headings (documents, charters, gravitas),
   Inter for UI and body copy, IBM Plex Mono for risk codes
   and figures, so a register full of numbers stays legible.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lora:wght@500;600;700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    --ink: #14213D;
    --ink-soft: #2A3A5C;
    --paper: #F5F6F8;
    --card: #FFFFFF;
    --brass: #A97C34;
    --brass-soft: #F1E6D2;
    --sage: #3F6255;
    --sage-soft: #E1EBE6;
    --clay: #A6462E;
    --clay-soft: #F3E1DB;
    --slate: #5B6472;
    --slate-light: #E4E7EC;
    --border: #DDE1E7;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 33, 61, 0.06), 0 4px 14px rgba(20, 33, 61, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    font-size: 15px;
}

h1, h2, h3, h4 {
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 0.5em;
    color: var(--ink);
}

h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p { margin: 0 0 1em; }

a { color: var(--ink-soft); }
a:hover { color: var(--brass); }

code, .mono, .risk-code {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 2px;
}

/* ---------- App shell: sidebar + top bar + content ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--ink);
    color: #E8EAF0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}

.sidebar .brand {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 18px;
    color: #FFFFFF;
    margin-bottom: 4px;
}

.sidebar .brand-sub {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brass);
    margin-bottom: 28px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #C7CCDA;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #FFFFFF;
}

.sidebar nav a.active {
    background: rgba(169, 124, 52, 0.22);
    color: #FFFFFF;
    box-shadow: inset 3px 0 0 var(--brass);
}

.sidebar .sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 12px;
    color: #9AA1B2;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .company-name {
    font-weight: 600;
    font-size: 15px;
}

.topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--slate);
}

.topbar .user-chip form { margin: 0; }

.topbar .user-chip button {
    background: none;
    border: none;
    color: var(--slate);
    text-decoration: underline;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    font-family: inherit;
}

.content {
    padding: 28px;
    max-width: 1180px;
    width: 100%;
}

.page-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-head p {
    color: var(--slate);
    margin: 4px 0 0;
}

/* ---------- Cards, stats ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 20px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
}

.stat-card .stat-value {
    font-family: 'Lora', serif;
    font-size: 30px;
    font-weight: 700;
    color: var(--ink);
    display: block;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--slate);
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
}

.btn-primary { background: var(--ink); color: #FFFFFF; }
.btn-primary:hover { background: var(--ink-soft); color: #FFFFFF; }

.btn-brass { background: var(--brass); color: #FFFFFF; }
.btn-brass:hover { background: #8E6A2C; color: #FFFFFF; }

.btn-outline { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-outline:hover { border-color: var(--ink); }

.btn-sage { background: var(--sage); color: #FFFFFF; }
.btn-sage:hover { background: #33503F; color: #FFFFFF; }

.btn-clay { background: var(--clay); color: #FFFFFF; }
.btn-clay:hover { background: #8C3924; color: #FFFFFF; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Forms ---------- */

label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--ink-soft);
}

.field { margin-bottom: 18px; }

.hint { font-size: 12px; color: var(--slate); margin-top: 5px; }

input[type=text], input[type=email], input[type=password], input[type=date],
select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #FFFFFF;
    color: var(--ink);
}

textarea { min-height: 90px; resize: vertical; }

input:focus, select:focus, textarea:focus {
    border-color: var(--brass);
}

/* ---------- Tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--slate);
    border-bottom: 2px solid var(--border);
    padding: 10px 12px;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tr:last-child td { border-bottom: none; }

/* ---------- The seal / badge motif for review state ----------
   A hexagon, echoing the review-gate shape from the architecture
   document — draft is an outline, approved is a filled seal. */

.seal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px 4px 6px;
}

.seal::before {
    content: "";
    width: 14px;
    height: 14px;
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    flex-shrink: 0;
}

.seal-draft { color: var(--clay); }
.seal-draft::before { background: var(--clay-soft); border: 2px solid var(--clay); clip-path: none; width: 10px; height: 10px; border-radius: 2px; }

.seal-revision { color: var(--clay); }
.seal-revision::before { background: var(--clay); }

.seal-approved { color: var(--sage); }
.seal-approved::before { background: var(--sage); }

.band {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.band-critical { background: var(--clay); color: #fff; }
.band-high { background: var(--brass); color: #fff; }
.band-medium { background: var(--brass-soft); color: #7A5A26; }
.band-low { background: var(--sage-soft); color: var(--sage); }
.band-none { background: var(--slate-light); color: var(--slate); }

/* ---------- Flash messages ---------- */

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.flash-success { background: var(--sage-soft); color: var(--sage); }
.flash-error { background: var(--clay-soft); color: var(--clay); }

/* ---------- Auth pages ---------- */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    background-image: radial-gradient(circle at 20% 20%, rgba(169,124,52,0.18), transparent 45%);
    padding: 20px;
}

.auth-card {
    background: var(--card);
    border-radius: 14px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.auth-card .brand {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 22px;
    margin-bottom: 2px;
}

.auth-card .brand-sub {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brass);
    margin-bottom: 28px;
}

/* ---------- Empty states ---------- */

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--slate);
}

.empty-state h3 { color: var(--ink); }

/* ---------- Chat-style interview list ---------- */

.qa-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 14px;
}

.qa-item .q-number {
    font-family: 'IBM Plex Mono';
    font-size: 12px;
    color: var(--brass);
    font-weight: 600;
}

.qa-item .q-text {
    font-weight: 600;
    margin: 6px 0 10px;
}

/* ---------- Utility ---------- */

.text-muted { color: var(--slate); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }

/* ---------- Testing mode ---------- */

.testing-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--clay);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    padding: 8px 16px;
}

.testing-banner code {
    background: rgba(255,255,255,0.2);
    padding: 1px 6px;
    border-radius: 4px;
}

.testing-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    margin: 0;
}

.testing-user-row:last-of-type { border-bottom: none; }

/* ---------- Marketing landing page ---------- */

.landing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 40px;
    max-width: 1180px;
    margin: 0 auto;
}

.landing-header .brand-lockup {
    font-family: 'Lora', serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--ink);
}

.landing-header .brand-lockup span {
    color: var(--brass);
}

.hero {
    background: var(--ink);
    background-image: radial-gradient(circle at 15% 0%, rgba(169,124,52,0.20), transparent 45%);
    color: #FFFFFF;
    padding: 70px 40px 90px;
}

.hero-inner {
    max-width: 780px;
    margin: 0 auto;
    text-align: center;
}

.hero .kicker {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 12px;
    font-weight: 700;
    color: var(--brass);
    margin-bottom: 16px;
}

.hero h1 {
    color: #FFFFFF;
    font-size: 38px;
    line-height: 1.2;
    margin-bottom: 18px;
}

.hero p.lead {
    color: #C7CCDA;
    font-size: 17px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.hero-cta {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-cta .btn { padding: 13px 24px; font-size: 15px; }

.landing-section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 64px 40px;
}

.landing-section h2 {
    text-align: center;
    font-size: 26px;
    margin-bottom: 10px;
}

.landing-section .section-lead {
    text-align: center;
    color: var(--slate);
    max-width: 620px;
    margin: 0 auto 40px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
}

.feature-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { color: var(--slate); font-size: 14px; margin-bottom: 0; }

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    counter-reset: step;
}

.step {
    position: relative;
    padding-left: 44px;
}

.step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brass);
    color: #FFFFFF;
    font-family: 'Lora', serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.step h3 { font-size: 15px; margin-bottom: 6px; }
.step p { color: var(--slate); font-size: 13.5px; margin-bottom: 0; }

.landing-band {
    background: var(--sage-soft);
    text-align: center;
    padding: 56px 40px;
}

.landing-band h2 { margin-bottom: 10px; }
.landing-band p { color: var(--ink-soft); max-width: 520px; margin: 0 auto 26px; }

.landing-footer {
    text-align: center;
    padding: 32px 40px;
    color: var(--slate);
    font-size: 13px;
}

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 14px 16px;
        overflow-x: auto;
    }
    .sidebar .brand-sub { display: none; }
    .sidebar nav { flex-direction: row; }
    .sidebar .sidebar-footer { display: none; }
    .content { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
