/* 2026-05-14 — Proportional rebalance lock (Jez).
   Construction was too loud, identity too quiet. Locked middle ground:
   body 15/1.55, stat 36px, stat-label 14 normal-case, page-h1 28px,
   btn 40/48, input 48, form-label 13/700/0.04em uppercase,
   card padding 24, row padding 16v/24h, section heading 13/0.08em.
   See CONTEXT.md '14 May 2026 proportional rebalance' for rationale. */
/* TORVO LIGHT THEME — single source of truth
   Master: /opt/torvo/design/torvo_light_theme.html
   To regenerate: python3 -c "src=open('/opt/torvo/design/torvo_light_theme.html').read(); css=src[src.rfind('<style>')+7:src.find('</style>')]; open('/opt/torvo/static/css/torvo_theme.css','w').write(css)"
   Loaded by: every Torvo vertical template via nginx alias at /static/css/
   Vertical additions: field.css, construction.css, badge.css
*/

/* ══════════════════════════════════════════════════════════════════
   TORVO LIGHT THEME — CSS custom properties
   ══════════════════════════════════════════════════════════════════ */
:root {
  /* content surface */
  --bg:            #F4F6F9;
  --surface:       #FFFFFF;
  --surface2:      #F0F2F5;
  --border:        #DDE1E9;

  /* text */
  --text:          #1A2033;
  --text2:         #4A5568;
  --text3:         #8A94A6;

  /* accents */
  --red:           #C0392B;
  --red2:          #A93226;
  --red-light:     #FDECEA;
  --red-glow:      rgba(192,57,43,0.15);
  --green:         #1A7A4A;
  --green-light:   #E8F5EE;
  --amber:         #B7770D;
  --amber-light:   #FEF3DC;
  --blue:          #1D4ED8;
  --blue-light:    #EEF2FF;
  --purple:        #6D28D9;
  --purple-light:  #F1EBFF;

  /* sidebar (the only dark surface in the theme) */
  --sidebar-bg:     #1A2033;
  --sidebar-bg2:    #242B40;
  --sidebar-text:   #E8ECF4;
  --sidebar-text2:  #9BA3B5;
  --sidebar-accent: #E23744;

  /* typography + layout */
  --font:          'Outfit', sans-serif;
  --sidebar-w:     260px;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(26,32,51,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100dvh; font-size: 15px; line-height: 1.55; }
a { color: var(--red2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Numbers, amounts, timestamps, codes, IDs — always Outfit tabular-nums. Never a mono font. */
.mono, .tabular, td.mono, .timestamp, .amt, .stat-num, .main-time, .countdown {
  font-family: 'Outfit', sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════════════════════════ */
.app-layout { display: flex; min-height: 100dvh; }

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR (dark)
   ══════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--sidebar-bg); color: #E5E7EB;
  border-right: 1px solid #0A0E18;
  display: flex; flex-direction: column; height: 100dvh;
  position: fixed; left: 0; top: 0; z-index: 50;
  transition: transform 0.3s ease;
}
.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid #2A3142; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.sidebar-logo-mark { width: 30px; height: 30px; background: var(--sidebar-accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 12px rgba(226,55,68,0.3); font-weight: 800; font-size: 13px; color: white; }
.sidebar-logo-text { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 19px; letter-spacing: 0.08em; color: var(--sidebar-accent); }
.sidebar-logo-sub { font-family: 'Outfit', sans-serif; font-size: 11px; font-weight: 700; color: #9BA3B5; letter-spacing: 0.14em; margin-left: 2px; text-transform: uppercase; }
.sidebar-org { font-size: 11px; color: #9CA3AF; margin-top: 4px; margin-left: 40px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Primary CTA under the header (optional per tool — BADGE uses it for "Start Incident") */
.sidebar-cta { margin: 14px 14px 6px; padding: 14px 16px; background: var(--sidebar-accent); border: none; border-radius: 12px; color: white; font-family: var(--font); font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.15s; box-shadow: 0 4px 16px rgba(226,55,68,0.3); text-decoration: none; }
.sidebar-cta:hover { opacity: 0.9; transform: translateY(-1px); text-decoration: none; }
.sidebar-cta-dot { width: 8px; height: 8px; border-radius: 50%; background: white; box-shadow: 0 0 6px white; animation: cta-pulse 1.5s infinite; }
@keyframes cta-pulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

.sidebar-label { padding: 16px 18px 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; color: #6B7280; }
.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 18px; margin: 1px 8px; border-radius: 8px; font-size: 13px; color: #D1D5DB; cursor: pointer; transition: all 0.1s; text-decoration: none; border: 1px solid transparent; }
.nav-item:hover { background: #1F2937; color: white; text-decoration: none; }
.nav-item.active { background: #1F2937; color: white; border-color: #374151; }
.nav-icon { width: 20px; text-align: center; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sidebar-accent); box-shadow: 0 0 6px var(--red); margin-left: auto; animation: cta-pulse 1.8s infinite; }
.nav-count { margin-left: auto; background: var(--sidebar-accent); color: white; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; }

.sidebar-footer { padding: 12px 18px; border-top: 1px solid #2A3142; }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-avatar { width: 32px; height: 32px; border-radius: 8px; background: #1F2937; border: 1px solid #374151; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #D1D5DB; font-family: 'Outfit', sans-serif; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: #9CA3AF; }
.sidebar-signout { font-size: 12px; color: #E5E7EB; text-decoration: none; padding: 6px 10px; border-radius: 6px; border: 1px solid #374151; display: inline-block; font-weight: 600; margin-top: 8px; }
.sidebar-signout:hover { color: white; background: #374151; text-decoration: none; }

/* ══════════════════════════════════════════════════════════════════
   MAIN (light)
   ══════════════════════════════════════════════════════════════════ */
.main { flex: 1; margin-left: var(--sidebar-w); min-height: 100dvh; }
.main-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; position: sticky; top: 0; background: var(--surface); z-index: 40; }
.menu-toggle { display: none; background: none; border: none; color: var(--text2); font-size: 20px; cursor: pointer; padding: 4px; }
.main-title { font-size: 18px; font-weight: 700; flex: 1; color: var(--text); }
.main-title-meta { font-size: 12px; color: var(--text3); font-weight: 400; margin-left: 8px; }
.main-time { font-size: 12px; color: var(--text3); font-weight: 500; }
.main-actions { display: flex; gap: 8px; }

.content { max-width: 1180px; margin: 0 auto; padding: 24px; }
.page-title { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 6px; letter-spacing: -.01em; }
.page-sub { font-size: 13px; color: var(--text2); margin-bottom: 20px; }

/* ══════════════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════════════ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2); margin-bottom: 14px; }
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--text); }

/* ══════════════════════════════════════════════════════════════════
   STATS
   ══════════════════════════════════════════════════════════════════ */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; box-shadow: var(--shadow); position: relative; border-left: 4px solid var(--border); }
.stat-num { font-size: 36px; letter-spacing: -0.02em; color: var(--text); line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 14px; color: var(--text); font-weight: 600; margin-top: 8px; letter-spacing: 0; }
.stat-sub { font-size: 13px; color: var(--text2); font-weight: 400; margin-top: 4px; }
.stat.accent-red { border-left-color: var(--red); }
.stat.accent-amber { border-left-color: var(--amber); }
.stat.accent-blue { border-left-color: var(--blue); }
.stat.accent-green { border-left-color: var(--green); }
.stat.accent-purple { border-left-color: var(--purple); }

/* ══════════════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text2); padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface2); }
.data-table td { padding: 16px 24px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text2); vertical-align: middle; }
.data-table tr:hover td { background: var(--surface2); }
.data-table a { color: var(--text); font-weight: 500; }
.data-table .mono { color: var(--text); }

/* ══════════════════════════════════════════════════════════════════
   BADGES / TAGS
   ══════════════════════════════════════════════════════════════════ */
.badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-amber  { background: var(--amber-light);  color: var(--amber); }
.badge-blue   { background: var(--blue-light);   color: var(--blue); }
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-grey   { background: var(--surface2);     color: var(--text2); }

/* ══════════════════════════════════════════════════════════════════
   COUNTDOWN PILL
   ══════════════════════════════════════════════════════════════════ */
.countdown { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.countdown.red { background: var(--red); color: white; animation: cdpulse 1.8s ease-in-out infinite; }
.countdown.amber { background: var(--amber); color: white; }
.countdown.ok { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }
.countdown.expired { background: #5a1118; color: white; }
@keyframes cdpulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(226,55,68,0.5); } 50%{ box-shadow: 0 0 0 6px rgba(226,55,68,0); } }

/* ══════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 20px; height: 40px; border-radius: 10px; font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; text-decoration: none; }
.btn-primary   { background: var(--red);     color: white; box-shadow: 0 4px 12px var(--red-glow); height: 48px; padding: 0 24px; font-size: 15px; font-weight: 700; }
.btn-primary:hover { opacity: 0.9; text-decoration: none; }
.btn-blue      { background: var(--blue);    color: white; }
.btn-green     { background: var(--green);   color: white; }
.btn-amber     { background: var(--amber);   color: white; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--red); text-decoration: none; }
.btn-sm { padding: 0 14px; height: 32px; font-size: 12px; border-radius: 8px; }

/* ══════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; font-weight: 700; color: var(--text2); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.04em; }
.form-input, .form-select { width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 0 16px; height: 48px; font-family: var(--font); font-size: 15px; font-weight: 500; color: var(--text); outline: none; }
.form-textarea { width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 16px; font-family: var(--font); font-size: 15px; color: var(--text); outline: none; }
.form-textarea { min-height: 160px; resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(226,55,68,0.08); }

/* ══════════════════════════════════════════════════════════════════
   DOC BLOCK (for generated documents / evidence / notes)
   ══════════════════════════════════════════════════════════════════ */
.doc-block { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--blue); border-radius: 12px; padding: 18px 22px; margin-bottom: 14px; }
.doc-block.warning { border-left-color: var(--amber); }
.doc-block.urgent  { border-left-color: var(--red); }
.doc-block.success { border-left-color: var(--green); }
.doc-block pre { white-space: pre-wrap; font-family: 'Outfit', sans-serif; font-size: 13px; line-height: 1.55; color: var(--text2); background: transparent; padding: 0; border: 0; }

/* ══════════════════════════════════════════════════════════════════
   TOP SEARCH (optional — BADGE uses this)
   ══════════════════════════════════════════════════════════════════ */
.top-search { display: flex; align-items: center; flex: 1; max-width: 520px; margin: 0 14px; }
.top-search form { display: flex; width: 100%; }
.top-search input { flex: 1; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 8px 0 0 8px; padding: 8px 12px; font: inherit; font-size: 13px; outline: none; }
.top-search input:focus { border-color: var(--red); }
.top-search button { background: var(--red); color: white; border: none; border-radius: 0 8px 8px 0; padding: 0 14px; cursor: pointer; font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.top-search button:hover { opacity: 0.9; }

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 40; backdrop-filter: blur(2px); }
.overlay.show { display: block; }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,0.2); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; overflow-x: hidden; max-width: 100vw; }
  .menu-toggle { display: flex; }
  .content { padding: 16px; max-width: 100%; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}

/* user-menu dropdown — sidebar logout chip [logout-chip-19apr] */
.user-menu { list-style: none; }
.user-menu summary {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
  transition: background .15s;
}
.user-menu summary:hover { background: rgba(255,255,255,.07); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary::marker { display: none; }
.user-menu-chevron {
  margin-left: auto; font-size: 18px; color: #6B7490;
  line-height: 1; user-select: none;
}
.user-menu-dropdown {
  position: absolute; bottom: calc(100% + 8px); left: 12px; right: 12px;
  background: #242C3D; border: 1px solid #374151; border-radius: 8px;
  padding: 4px; box-shadow: 0 -4px 16px rgba(0,0,0,.35);
  z-index: 200;
}
.user-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px; border-radius: 6px;
  font-family: 'Outfit', sans-serif; font-size: 13px; font-weight: 600;
  background: none; border: none; cursor: pointer; text-align: left;
  transition: background .12s;
}
.user-menu-logout { color: #FCA5A5; }
.user-menu-logout:hover { background: rgba(226,55,68,.18); color: #FCA5A5; }
.sidebar-footer { position: relative; padding: 12px 18px; border-top: 1px solid #2A3142; }
