/* ============================================================
   NOUS — Design System (aligned with agena-hub)
   Brand: Olive (#555725) · Yellow (#FAF185) · Off-white · Black
   Fonts: Syne (display) · DM Sans (body) · DM Mono (code)
   Linked by dash_base.html (app base) and login.html.
   ============================================================ */
:root {
  --black: #0a0a0a; --white: #ffffff; --off-white: #f7f6f0;
  --accent: #FAF185; --accent-dark: #e0c800;
  --brand: #555725; --brand-dark: #3d3f18; --brand-mid: #6e7230;
  --surface: #ffffff; --surface2: #f7f6f0; --surface3: #edecd8;
  --border: #e4e3d4; --border-mid: #cccbb8;
  --text: #0a0a0a; --text-mid: #3a3829; --text-muted: #7a7866;
  --red: #b91c1c; --red-bg: #fef2f2; --green: #166534; --green-bg: #f0fdf4;
  --orange: #9a3412; --orange-bg: #fff7ed; --blue: #1e40af; --blue-bg: #eff6ff;
  --purple: #6d28d9; --purple-bg: #ede9fe; --teal: #0f766e; --teal-bg: #ccfbf1;
  /* aliases used by the dashboard */
  --bg: #f7f6f0; --success: #16a34a; --warn: #b45309; --danger: #dc2626;
  --font-d: 'Syne', sans-serif; --font-b: 'DM Sans', sans-serif; --font-m: 'DM Mono', monospace;
  --font-body: var(--font-b); --font-headline: var(--font-d); --font-subhead: var(--font-b);
  --r: 6px; --r-lg: 12px; --r-xl: 18px; --t: 0.15s ease; --nav-h: 60px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.05);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { background: var(--off-white); color: var(--text); font-family: var(--font-b);
  min-height: 100vh; -webkit-font-smoothing: antialiased; line-height: 1.55; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-b); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-b); outline: none; }
.muted { color: var(--text-muted); } .req { color: var(--red); }

/* ── NAV ── */
.nav { position: sticky; top: 0; z-index: 100; height: var(--nav-h); background: var(--brand); }
.nav-inner { max-width: 1200px; margin: 0 auto; height: 100%; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; }
.nav-brand { display: flex; align-items: center; font-family: var(--font-d); font-weight: 800; font-size: 1.05rem; color: #fff; letter-spacing: -.01em; }
.nav-brand .dot { color: var(--accent); }
.nav-label { font-family: var(--font-d); font-size: .62rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.55); margin-left: .15rem; }
.nav-divider { color: rgba(255,255,255,.2); font-weight: 300; font-size: 1.1rem; }
.nav-links { display: flex; gap: .125rem; flex: 1; margin-left: .5rem; }
.nav-link { color: rgba(255,255,255,.6); font-size: .84rem; font-weight: 500; padding: .35rem .7rem; border-radius: var(--r); transition: color var(--t), background var(--t); }
.nav-link:hover { color: rgba(255,255,255,.9); background: rgba(0,0,0,.15); }
.nav-link.active { color: #fff; background: rgba(0,0,0,.2); }
.nav-user { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.nav-user-name { font-size: .875rem; color: rgba(255,255,255,.75); }
.btn-ghost { background: transparent; color: rgba(255,255,255,.55); font-size: .8rem; padding: .28rem .6rem; border-radius: var(--r); transition: color var(--t), background var(--t); white-space: nowrap; }
.btn-ghost:hover { color: #fff; background: rgba(0,0,0,.2); }

/* ── MAIN / layout ── */
.main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 3rem; }
.main-auth { display: flex; min-height: 100vh; background: var(--brand-dark); }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* ── FLASH ── */
.flash-wrap { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.flash { padding: .75rem 1rem; border-radius: var(--r); font-size: .875rem; margin: 0 auto .5rem; max-width: 1200px; }
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.flash-danger { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.flash-info, .flash-message { background: var(--blue-bg); color: var(--blue); border: 1px solid #bfdbfe; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1.1rem; border-radius: var(--r); font-size: .875rem; font-weight: 600; cursor: pointer; border: none; transition: background var(--t), box-shadow var(--t), transform .1s; white-space: nowrap; font-family: var(--font-b); }
.btn:active { transform: scale(.98); }
.btn-brand, .btn-primary { background: var(--brand); color: #fff; }
.btn-brand:hover, .btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: var(--brand-dark); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface3); color: var(--text-mid); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; font-size: .85rem; padding: 0; font-weight: 500; font-family: var(--font-b); }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--red); }
.w-full, .btn-full { width: 100%; }

/* ── AUTH (split-screen login) ── */
.auth-brand { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; background: var(--brand); padding: 3rem 2rem; }
.auth-brand-mark { font-family: var(--font-d); font-weight: 800; font-size: 3.2rem; line-height: 1; color: #fff; letter-spacing: -.02em; }
.auth-brand-mark .dot { color: var(--accent); }
.auth-brand-tagline { font-family: var(--font-d); font-size: .85rem; font-weight: 600; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .12em; }
.auth-form-pane { flex: 1; display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; background: var(--off-white); }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 2.5rem 2rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.auth-logo { margin-bottom: 1.75rem; }
.auth-title { font-family: var(--font-d); font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.auth-title strong { color: var(--brand); }
.auth-subtitle { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.auth-footer { margin-top: 1.5rem; font-size: .73rem; color: var(--text-muted); text-align: center; }
@media (max-width: 640px) { .auth-brand { display: none; } }

/* ── FORMS ── */
.field { margin-bottom: 1.1rem; }
.label, .field label, .field-label { display: block; font-size: .75rem; font-weight: 600; color: var(--text-muted); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .06em; }
.input, .field input, .field select, .field textarea { width: 100%; padding: .6rem .8rem; border: 1.5px solid var(--border); border-radius: var(--r); font-size: .9rem; font-family: var(--font-b); background: var(--surface); color: var(--text); transition: border-color var(--t), box-shadow var(--t); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus,
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(85,87,37,.12); }
.inline-form { display: flex; flex-wrap: wrap; gap: .9rem; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; }
.checkbox-label, .check { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; color: var(--text); }
.check input, .checkbox-label input { width: auto; accent-color: var(--brand); }

/* ── CARD / PANEL ── */
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); margin-bottom: 1.25rem; }
.panel-title, .card-title { font-family: var(--font-d); font-size: 1rem; font-weight: 700; margin-bottom: .25rem; color: var(--text); }
.panel-sub, .card-sub { font-size: .82rem; color: var(--text-muted); margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.col-span-2 { grid-column: 1 / span 2; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } .col-span-2 { grid-column: auto; } }

/* ── PAGE HEADER + HERO ── */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-header h1 { font-family: var(--font-d); font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.page-header p { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }
.page-hero { background: var(--brand); color: #fff; padding: 1.75rem 0 1.5rem; margin-bottom: 1.5rem; }
.page-hero h1 { font-family: var(--font-d); font-size: 1.6rem; font-weight: 700; color: #fff; letter-spacing: -.02em; }
.page-hero p { color: rgba(255,255,255,.72); font-size: .85rem; margin-top: 3px; }

/* ── TABLE ── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table, .dt { width: 100%; border-collapse: collapse; }
.table th, .dt th { padding: .7rem 1rem; text-align: left; font-size: .7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .09em; background: var(--surface2); border-bottom: 1px solid var(--border); }
.table td, .dt td { padding: .8rem 1rem; font-size: .875rem; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-mid); }
.table tr:last-child td, .dt tr:last-child td { border-bottom: none; }
.table tbody tr, .dt tbody tr { transition: background var(--t); }
.table tbody tr:hover, .dt tbody tr:hover { background: var(--surface2); }
.dt .num { text-align: right; font-variant-numeric: tabular-nums; }
.dt .code, td .code { font-family: var(--font-m); font-size: .72rem; color: var(--text-muted); }
.row-inactive td { color: var(--text-muted); }
.table td.actions, .dt td.actions { display: flex; gap: .75rem; align-items: center; }
.empty { text-align: center; color: var(--text-muted); padding: 3rem 1rem; font-size: .9rem; }
.empty-icon { font-size: 40px; margin-bottom: 12px; } .empty-msg { font-size: .95rem; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.badge-green, .badge-ok { background: var(--green-bg); color: var(--green); }
.badge-gray { background: var(--surface3); color: var(--text-muted); }
.badge-olive { background: #ecf0cc; color: var(--brand-dark); }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-yellow { background: var(--accent); color: var(--brand-dark); }
.badge-warn { background: var(--orange-bg); color: var(--orange); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.pill { display: inline-block; padding: .15rem .55rem; border-radius: 999px; background: var(--surface3); color: var(--text-mid); font-size: .72rem; margin: 0 .15rem .15rem 0; }

/* ── ALERTS (inline) ── */
.alert { padding: .85rem 1.1rem; border-radius: var(--r); margin-bottom: 1.25rem; font-size: .875rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.alert-danger { background: var(--red-bg); border: 1px solid #fecaca; color: var(--red); }
.alert-warn { background: var(--orange-bg); border: 1px solid #fed7aa; color: var(--orange); }
.alert-ok { background: var(--green-bg); border: 1px solid #bbf7d0; color: var(--green); }

/* ── STATUS + LIVE RUN ── */
.s-success { color: var(--green); font-weight: 600; }
.s-failed { color: var(--red); font-weight: 600; }
.s-running, .s-queued { color: var(--orange); font-weight: 600; }
.bar-wrap { background: var(--surface3); border-radius: 4px; height: 14px; overflow: hidden; margin: .5rem 0; }
.bar { background: var(--brand); height: 100%; width: 0%; transition: width .4s; }
pre.log { background: #0b0b0b; color: #e6e6e6; padding: .9rem; border-radius: var(--r); max-height: 360px; overflow: auto; font-family: var(--font-m); font-size: .76rem; line-height: 1.5; white-space: pre-wrap; }
code.cmd { font-family: var(--font-m); background: var(--surface3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-size: .82rem; }

/* ── KPI tiles (dashboard) ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.5rem 0; }
@media (max-width: 760px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.kpi-label { font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.kpi-value { font-family: var(--font-d); font-size: 1.9rem; font-weight: 700; margin-top: 6px; line-height: 1.05; letter-spacing: -.02em; }
.kpi-sub { font-size: .78rem; color: var(--text-muted); margin-top: 6px; }
.delta-up { color: var(--success); font-weight: 600; } .delta-down { color: var(--danger); font-weight: 600; } .delta-flat { color: var(--text-muted); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 820px) { .dash-grid { grid-template-columns: 1fr; } }

/* ── trend bars (dashboard) ── */
.trend { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bar { width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 2px; }
.trend-col:last-child .trend-bar { background: var(--accent-dark); }
.trend-x { font-size: 9px; color: var(--text-muted); margin-top: 4px; }

/* ── LANDING (app cards) ── */
.landing-wrap { display: flex; flex-direction: column; align-items: center; padding: 3rem 1rem 4rem; gap: 2.5rem; }
.landing-greeting { font-family: var(--font-d); font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; text-align: center; margin-bottom: .4rem; }
.landing-sub { font-size: .9rem; color: var(--text-muted); text-align: center; }
.app-cards { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; max-width: 800px; }
.app-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 2rem 1.75rem; min-width: 180px; flex: 1; max-width: 220px; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s; }
.app-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-mid); }
.card-icon-wrap { width: 48px; height: 48px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: .9rem; background: var(--surface3); }
.card-label { font-family: var(--font-d); font-size: 1rem; font-weight: 700; margin-bottom: .25rem; }
.card-role { font-size: .78rem; color: var(--text-muted); text-transform: capitalize; }
