/* Trigr brand
   Palette   primary    #eae3d6  cream   page background
             secondary  #5c1712  maroon  brand, buttons, links, headings accents
             tertiary   #1f1a1a  ink     text, navigation bar
             quaternary #e39f40  amber   highlights, focus ring, "fired" fills
             quinary    #6d6d6d  gray    tertiary text, icons, borders
   Fonts     display  DM Serif Display (400 only: never set bold on it)
             text     Poppins 400 / 500 / 600
   Amber on cream is only 1.8:1, so amber is used for fills, rings and dots,
   never for text on a light surface. Muted text is quinary mixed 25% toward
   the ink so small print on cream stays above 4.5:1. */

:root {
    /* brand */
    --primary: #eae3d6;
    --secondary: #5c1712;
    --tertiary: #1f1a1a;
    --quaternary: #e39f40;
    --quinary: #6d6d6d;

    /* surfaces */
    --bg: var(--primary);
    --surface: #f5f0e7;            /* cards: a lighter tint of the primary */
    --surface-2: var(--primary);   /* inputs, hovers, inset areas */
    --border: #d9d0bf;
    --border-light: #c8bfad;

    /* text */
    --text: var(--tertiary);
    --text-muted: #5a5858;         /* quinary toward ink: 5.4:1 on cream */
    --text-dim: var(--quinary);

    /* actions and highlights */
    --accent: var(--secondary);
    --accent-glow: rgba(227, 159, 64, 0.40);
    --accent-soft: rgba(227, 159, 64, 0.16);
    --highlight: var(--quaternary);

    /* status (functional colours; the five brand colours have no green or red) */
    --shadow-warn: #8a5a10;        /* dark amber, readable as text */
    --warn-soft: rgba(227, 159, 64, 0.20);
    --warn-line: rgba(227, 159, 64, 0.60);
    --danger: #b3261e;
    --danger-soft: rgba(179, 38, 30, 0.10);
    --success: #2f6b3f;
    --success-soft: rgba(47, 107, 63, 0.14);

    /* navigation bar (dark) */
    --nav-bg: var(--tertiary);
    --nav-text: #bdb6a9;
    --nav-text-hover: var(--primary);

    --display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
    --sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --radius: 6px; --radius-lg: 10px;
}
* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.6; min-height: 100vh;
       -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 400; letter-spacing: 0; line-height: 1.25; }
a { color: var(--accent); }
::selection { background: var(--quaternary); color: var(--tertiary); }

.nav { display: flex; align-items: center; gap: 32px; padding: 0 32px; height: 60px;
       border-bottom: 3px solid var(--quaternary); background: var(--nav-bg); position: sticky; top: 0; z-index: 100; }
.nav-logo { font-family: var(--display); font-size: 28px; font-weight: 400; color: var(--primary);
            text-decoration: none; letter-spacing: 0; line-height: 1; }
.nav-logo { display: flex; align-items: center; }
.nav-logo-img { height: 38px; width: auto; display: block; }
.login-logo-img { height: 84px; width: auto; display: block; margin-bottom: 8px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link { color: var(--nav-text); text-decoration: none; font-size: 13.5px; padding: 6px 10px;
            border-radius: var(--radius); transition: color .15s, background .15s; }
.nav-link:hover { color: var(--nav-text-hover); background: rgba(234, 227, 214, 0.10); }
.nav-link.active { color: var(--nav-text-hover); box-shadow: inset 0 -2px 0 var(--quaternary); border-radius: 0; }
.nav-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.nav-org { font-size: 13px; color: var(--nav-text); }

.main { max-width: 1100px; margin: 0 auto; padding: 40px 32px; }
.page-header { margin-bottom: 32px; }
.page-title { font-family: var(--display); font-size: 32px; font-weight: 400; letter-spacing: 0; line-height: 1.2; }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.card + .card { margin-top: 16px; }
.grid-2 > .card, .grid-3 > .card { margin-top: 0; }
.grid-2 + .grid-2, .grid-2 + .card, .card + .grid-2, .grid-3 + .card, .card + .grid-3 { margin-top: 16px; }
.card-title { font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
              color: var(--accent); margin-bottom: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 32px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
             padding: 20px 24px; border-top: 3px solid var(--quaternary); }
.stat-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px; }
.stat-value { font-family: var(--display); font-size: 34px; font-weight: 400; letter-spacing: 0; line-height: 1.15; }
.stat-value--accent { color: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; letter-spacing: .07em;
     text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border-light); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
/* Tables sit inside a padded card: the first and last columns line up with the card title. */
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 0; }
.table-wrap th:last-child, .table-wrap td:last-child { padding-right: 0; }
/* The button column: named, right-aligned, as narrow as its button. */
.col-action { text-align: right; white-space: nowrap; width: 1%; }
.col-action form { display: inline; }
.mono { font-family: var(--mono); font-size: 12px; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
         font-size: 11px; font-weight: 600; }
.badge--active { background: var(--success-soft); color: var(--success); }
.badge--draft { background: var(--surface-2); color: var(--text-muted); }
.badge--fired { background: var(--quaternary); color: var(--tertiary); }
.badge--no-trigger { background: var(--surface-2); color: var(--text-muted); }
.trigger-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--secondary); display: inline-block; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border-radius: var(--radius);
       font-family: var(--sans); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; border: none; white-space: nowrap;
       transition: background .15s, box-shadow .15s, opacity .15s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-glow); }
.btn--primary { background: var(--secondary); color: var(--primary); } .btn--primary:hover { background: #7a2019; }
.btn--secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-light); }
.btn--secondary:hover { border-color: var(--secondary); }
.btn--ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-light); }
.btn--ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn--sm { padding: 6px 12px; font-size: 13px; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
.form-input, .form-select { width: 100%; background: var(--surface-2); border: 1px solid var(--border-light);
    border-radius: var(--radius); color: var(--text); font-family: var(--sans); font-size: 14px; padding: 10px 14px; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert--success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(47, 107, 63, 0.30); }
.alert--error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(179, 38, 30, 0.30); }

.audit-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; font-family: var(--mono); font-size: 12px; color: var(--text-muted); white-space: pre-wrap; word-break: break-word; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 768px) { .grid-2,.grid-3 { grid-template-columns: 1fr; } .main { padding: 24px 16px; } .nav { padding: 0 16px; gap: 16px; }
                            .page-title { font-size: 26px; } }

.empty-state { text-align: center; padding: 64px 32px; color: var(--text-muted); }
.empty-state h3 { font-size: 22px; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* Calibrate menu. These used to live in a {% block head %} that base.html does not define, so they never applied. */
.menu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 14px; }
.accuracy-big { font-family: var(--display); font-size: 34px; font-weight: 400; letter-spacing: 0; line-height: 1.1; }
.cv-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.cv-badge--validated { background: var(--success-soft); color: var(--success); }
.cv-badge--in-sample { background: var(--warn-soft); color: var(--shadow-warn); }
