/* ==========================================================================
   FixLog — Three-Theme Design System
   Themes: industrial (default) | saas | hybrid
   Applied via data-theme attribute on <html>
   ========================================================================== */

/* --------------------------------------------------------------------------
   THEME 1 — Industrial (dark steel + amber)
   -------------------------------------------------------------------------- */
:root,
[data-theme="industrial"] {
  --bg:         #0f1318;
  --bg-2:       #13181f;
  --panel:      #181e27;
  --panel-2:    #1d2432;
  --panel-3:    #222a3a;
  --ridge:      #0c1016;
  --line:       #252e3d;
  --line-soft:  #1e2636;
  --ink:        #eef2f7;
  --ink-soft:   #9aabbe;
  --ink-dim:    #5c7089;
  --ink-ghost:  #2d3f55;
  --brand:      #f5a623;
  --brand-dim:  #c4821a;
  --brand-glow: rgba(245,166,35,.16);
  --brand-text: #1a0f00;
  --blue:       #3b82f6;
  --blue-hi:    #60a5fa;
  --blue-glow:  rgba(59,130,246,.15);
  --green:      #22c55e;
  --green-glow: rgba(34,197,94,.12);
  --red:        #ef4444;
  --red-glow:   rgba(239,68,68,.12);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.03) inset;
  --shadow-md:  0 4px 16px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.04) inset;
  --shadow-lg:  0 12px 40px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.05) inset;
  --topbar-bg:  rgba(15,19,24,.9);
  --input-bg:   #f0f4f8;
  --input-fg:   #0f1318;
  --input-border: #c8d4e0;
  --r:          8px;
  --r-sm:       6px;
  --r-lg:       12px;
  --sans:       'IBM Plex Sans', system-ui, sans-serif;
  --mono:       'IBM Plex Mono', ui-monospace, monospace;
  --disp:       'Saira Condensed', var(--sans);
  --lid:        rgba(255,255,255,.05);
  --ambient-1:  rgba(245,166,35,.055);
  --ambient-2:  rgba(59,130,246,.05);
  --noise:      1;
}

/* --------------------------------------------------------------------------
   THEME 2 — Modern SaaS (light, clean, Inter)
   -------------------------------------------------------------------------- */
[data-theme="saas"] {
  --bg:         #f8fafc;
  --bg-2:       #f1f5f9;
  --panel:      #ffffff;
  --panel-2:    #f8fafc;
  --panel-3:    #f1f5f9;
  --ridge:      #e2e8f0;
  --line:       #e2e8f0;
  --line-soft:  #eef2f7;
  --ink:        #0f172a;
  --ink-soft:   #475569;
  --ink-dim:    #94a3b8;
  --ink-ghost:  #cbd5e1;
  --brand:      #2563eb;
  --brand-dim:  #1d4ed8;
  --brand-glow: rgba(37,99,235,.12);
  --brand-text: #ffffff;
  --blue:       #2563eb;
  --blue-hi:    #3b82f6;
  --blue-glow:  rgba(37,99,235,.1);
  --green:      #16a34a;
  --green-glow: rgba(22,163,74,.1);
  --red:        #dc2626;
  --red-glow:   rgba(220,38,38,.08);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --topbar-bg:  rgba(255,255,255,.92);
  --input-bg:   #ffffff;
  --input-fg:   #0f172a;
  --input-border: #d1d5db;
  --r:          10px;
  --r-sm:       8px;
  --r-lg:       14px;
  --sans:       'Inter', system-ui, sans-serif;
  --mono:       'IBM Plex Mono', ui-monospace, monospace;
  --disp:       'Inter', var(--sans);
  --lid:        rgba(0,0,0,0);
  --ambient-1:  rgba(37,99,235,.04);
  --ambient-2:  rgba(16,185,129,.03);
  --noise:      0;
}

/* --------------------------------------------------------------------------
   THEME 3 — Hybrid (deep navy + muted amber, softer dark)
   -------------------------------------------------------------------------- */
[data-theme="hybrid"] {
  --bg:         #111827;
  --bg-2:       #161f2e;
  --panel:      #1a2540;
  --panel-2:    #1f2d4a;
  --panel-3:    #243354;
  --ridge:      #0e1520;
  --line:       #2a3d5a;
  --line-soft:  #1e2e45;
  --ink:        #e8f0fe;
  --ink-soft:   #8da4c7;
  --ink-dim:    #4a6585;
  --ink-ghost:  #273a52;
  --brand:      #e8931a;
  --brand-dim:  #b8701a;
  --brand-glow: rgba(232,147,26,.14);
  --brand-text: #1a0f00;
  --blue:       #60a5fa;
  --blue-hi:    #93c5fd;
  --blue-glow:  rgba(96,165,250,.14);
  --green:      #34d399;
  --green-glow: rgba(52,211,153,.12);
  --red:        #f87171;
  --red-glow:   rgba(248,113,113,.12);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.03) inset;
  --shadow-md:  0 4px 16px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.04) inset;
  --shadow-lg:  0 16px 48px rgba(0,0,0,.65), 0 1px 0 rgba(255,255,255,.05) inset;
  --topbar-bg:  rgba(17,24,39,.92);
  --input-bg:   #f0f4f8;
  --input-fg:   #111827;
  --input-border: #c4cfe0;
  --r:          10px;
  --r-sm:       7px;
  --r-lg:       14px;
  --sans:       'IBM Plex Sans', system-ui, sans-serif;
  --mono:       'IBM Plex Mono', ui-monospace, monospace;
  --disp:       'Saira Condensed', var(--sans);
  --lid:        rgba(255,255,255,.04);
  --ambient-1:  rgba(232,147,26,.04);
  --ambient-2:  rgba(96,165,250,.04);
  --noise:      1;
}

/* ==========================================================================
   GLOBAL RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

/* Ambient gradients — mood lighting */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 900px 500px at 75% -5%,  var(--ambient-1) 0%, transparent 65%),
    radial-gradient(ellipse 700px 400px at -5% 95%,  var(--ambient-2) 0%, transparent 60%);
  transition: opacity .25s;
}

#app { position: relative; z-index: 1; }

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4 {
  font-family: var(--disp);
  font-weight: 700;
  letter-spacing: .015em;
  line-height: 1.2;
  margin: 0;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--ink-dim);
}
.mono  { font-family: var(--mono); }
.muted { color: var(--ink-soft); }
.dim   { color: var(--ink-dim); }
a { color: var(--blue-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */
.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.center-wrap { flex: 1; display: grid; place-items: center; padding: 28px 18px; }
.container { width: 100%; max-width: 940px; margin: 0 auto; padding: 24px 20px 72px; }
.spacer { flex: 1; }
.fade { animation: fade .18s ease; }

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 56px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.topbar .who {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: .04em;
}

/* Theme switcher */
.theme-switcher {
  display: flex;
  gap: 2px;
  background: var(--ridge);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
}
.theme-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 4px 7px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--ink-dim);
  font-family: var(--mono);
  letter-spacing: .04em;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.theme-btn.active { background: var(--panel-2); color: var(--brand); }
.theme-btn:hover:not(.active) { color: var(--ink-soft); }

/* ==========================================================================
   BRAND MARK
   ========================================================================== */
.brand {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  text-decoration: none !important;
}
.brand b { color: var(--brand); }
.brand .bolt {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 5px var(--brand-glow));
}
.brand.lg { font-size: 36px; }
.brand.lg .bolt { width: 26px; height: 26px; }

/* ==========================================================================
   TABLER ICONS — global sizing & color
   Override .ti sizing wherever needed with .ti-sm / .ti-lg
   ========================================================================== */
.ti {
  font-size: 18px;
  color: inherit;
  line-height: 1;
  vertical-align: middle;
  flex-shrink: 0;
}
.ti-sm  { font-size: 14px; }
.ti-lg  { font-size: 22px; }
.ti-xl  { font-size: 28px; }
.ti-brand  { color: var(--brand); }
.ti-blue   { color: var(--blue-hi); }
.ti-green  { color: var(--green); }
.ti-red    { color: var(--red); }
.ti-dim    { color: var(--ink-dim); }

/* ==========================================================================
   PANELS & CARDS
   ========================================================================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  position: relative;
}
/* Lid highlight — dark themes only */
.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--lid), transparent);
  border-radius: 1px;
  pointer-events: none;
}
.panel.pad { padding: 22px; }

/* Plant Health widget — clickable card on the org main view */
.health-widget { transition: border-color .15s, transform .15s; }
.health-widget:hover { border-color: var(--brand); }
.health-widget:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 28px 28px;
}
.auth-card .tagline {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--ink-dim);
  margin-bottom: 24px;
  margin-top: 4px;
}
.strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.strip h2 { font-size: 22px; }

/* ==========================================================================
   FORMS
   ========================================================================== */
label.field { display: block; margin-bottom: 16px; }
label.field > span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
input[type=text],
input[type=email],
input[type=password],
textarea,
select {
  width: 100%;
  background: var(--input-bg);
  color: var(--input-fg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  font-family: var(--sans);
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.06);
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:focus, textarea:focus, select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18), inset 0 1px 2px rgba(0,0,0,.04);
}
textarea { resize: vertical; min-height: 82px; line-height: 1.5; }
select { cursor: pointer; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 9px 18px;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform .08s, filter .12s, box-shadow .12s, background .12s;
  white-space: nowrap;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.btn-amber {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dim) 100%);
  color: var(--brand-text);
  border-color: var(--brand-dim);
  box-shadow: 0 2px 8px var(--brand-glow), 0 1px 0 rgba(255,255,255,.12) inset;
}
.btn-amber:hover { filter: brightness(1.07); box-shadow: 0 4px 14px var(--brand-glow); }

.btn-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(59,130,246,.28);
}
.btn-blue:hover { filter: brightness(1.08); }

.btn-ghost {
  background: var(--panel-2);
  color: var(--ink-soft);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--panel-3); color: var(--ink); border-color: rgba(255,255,255,.1); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(239,68,68,.25);
}
.btn-danger:hover { background: var(--red-glow); border-color: rgba(239,68,68,.45); }

.btn-sm    { padding: 5px 11px; font-size: 11px; }
.btn-block { width: 100%; }
.btn-row   { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.linkbtn {
  background: none; border: none; padding: 0;
  cursor: pointer;
  color: var(--blue-hi);
  font-family: var(--sans);
  font-size: 14px;
  transition: color .1s;
}
.linkbtn:hover { color: var(--blue); }

/* ==========================================================================
   SPLASH
   ========================================================================== */
.splash {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  cursor: pointer; background: var(--bg); overflow: hidden;
}
.splash::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--brand-glow) 0%, transparent 70%);
  border-radius: 50%;
  animation: pulse-glow 2.2s ease-in-out infinite;
}
.splash-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  animation: rise .7s cubic-bezier(.2,.8,.2,1) both;
  position: relative; z-index: 1;
}
.splash .tagline {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.splash .progress-bar {
  width: 160px; height: 2px;
  background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 8px;
}
.splash .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  animation: sweep 1.4s ease-in-out infinite;
}

/* ==========================================================================
   ROWS & LISTS
   ========================================================================== */
.list { display: flex; flex-direction: column; gap: 6px; }

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s, transform .08s;
  overflow: hidden;
}
/* Left accent stripe */
.row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand);
  border-radius: 3px 0 0 3px;
  transform: scaleY(0);
  transition: transform .14s cubic-bezier(.2,.8,.2,1);
}
.row:hover { border-color: rgba(245,166,35,.2); background: var(--panel-2); }
.row:hover::before { transform: scaleY(1); }
.row:active { transform: scale(.997); }
.row .name { font-weight: 500; color: var(--ink); }
.row .sub  { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.row .grow { flex: 1; min-width: 0; }
.row .chev { color: var(--ink-ghost); font-size: 18px; transition: transform .14s, color .14s; }
.row:hover .chev { color: var(--ink-dim); transform: translateX(2px); }

.row.static { cursor: default; }
.row.static::before { display: none; }
.row.static:hover { border-color: var(--line-soft); background: var(--panel); transform: none; }

.row.subunit { margin-left: 20px; border-left: 2px solid rgba(245,166,35,.3); }

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */
.badge {
  font-family: var(--mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: .08em;
  color: var(--brand);
  background: var(--brand-glow);
  border: 1px solid rgba(245,166,35,.22);
  padding: 2px 8px; border-radius: 20px;
  white-space: nowrap;
}
.pill {
  font-family: var(--mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 4px;
  white-space: nowrap; border: 1px solid transparent;
}
.pill.owner  { color: #fde68a; background: rgba(245,166,35,.14); border-color: rgba(245,166,35,.28); }
.pill.admin  { color: var(--blue-hi); background: var(--blue-glow); border-color: rgba(59,130,246,.28); }
.pill.member { color: var(--ink-dim); background: rgba(255,255,255,.04); border-color: var(--line); }

/* ==========================================================================
   BREADCRUMB
   ========================================================================== */
.crumb {
  font-family: var(--mono);
  font-size: 11px; color: var(--ink-dim);
  margin-bottom: 16px;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.crumb a { color: var(--ink-soft); transition: color .1s; }
.crumb a:hover { color: var(--brand); text-decoration: none; }
.crumb .sep { color: var(--line); }

/* ==========================================================================
   SECTION HELPERS
   ========================================================================== */
.section-title {
  font-family: var(--mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 10px;
}
.stack   { display: flex; flex-direction: column; gap: 18px; }
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.codechip {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 16px; letter-spacing: .2em;
  background: var(--ridge); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 14px; color: var(--brand);
}

/* ==========================================================================
   NOTICES
   ========================================================================== */
.notice {
  padding: 11px 14px; border-radius: var(--r-sm);
  font-size: 14px; margin-bottom: 14px;
  display: flex; align-items: flex-start; gap: 8px;
}
.notice.err  { background: var(--red-glow);   border: 1px solid rgba(239,68,68,.3);  color: #fca5a5; }
.notice.ok   { background: var(--green-glow); border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.notice.info { background: var(--blue-glow);  border: 1px solid rgba(59,130,246,.3); color: #93c5fd; }

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */
.empty {
  text-align: center; padding: 36px 16px;
  color: var(--ink-dim); border: 1px dashed var(--line);
  border-radius: var(--r); font-family: var(--mono);
  font-size: 12px; letter-spacing: .04em;
}

/* ==========================================================================
   PROBLEM CARDS
   ========================================================================== */
.problem {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r-sm); padding: 16px 18px;
  transition: border-color .15s;
}
.problem:hover { border-color: var(--line); }
.problem h3    { font-size: 17px; margin-bottom: 4px; font-weight: 600; }
.problem .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-bottom: 10px; }
.problem .lbl  {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-dim); margin: 10px 0 3px;
}
.problem .body         { white-space: pre-wrap; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.problem .body.solution { color: var(--ink); border-left: 2px solid var(--green); padding-left: 12px; }
.steps-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ==========================================================================
   SEARCH INPUT
   ========================================================================== */
.search { margin-bottom: 14px; }

/* ==========================================================================
   SPINNER
   ========================================================================== */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  animation: spin .7s linear infinite;
  margin: 48px auto;
}

/* ==========================================================================
   DOCUMENT ROWS
   ========================================================================== */
.row-actions { display: flex; gap: 6px; align-items: center; }
.doc-row { cursor: default; }
.doc-row::before { display: none; }
.doc-row:hover { border-color: var(--line-soft); background: var(--panel); transform: none; }
.doc-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }

/* ==========================================================================
   VIEWER OVERLAY
   ========================================================================== */
.viewer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.82); z-index: 100;
  animation: fade .18s ease;
  backdrop-filter: blur(4px);
}
.viewer-panel {
  position: fixed; inset: 20px; z-index: 101;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: rise-fast .2s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.viewer-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel-2); flex-shrink: 0;
}
.viewer-title {
  flex: 1; font-family: var(--mono); font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.viewer-actions { display: flex; gap: 8px; flex-shrink: 0; }
.viewer-body {
  flex: 1; overflow: auto; background: var(--ridge);
  display: flex; align-items: center; justify-content: center;
}
.viewer-body iframe { width: 100%; height: 100%; border: none; }
.viewer-body img    { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ==========================================================================
   TAB BAR
   ========================================================================== */
.tabbar {
  display: flex; gap: 2px; margin-bottom: 22px;
  background: var(--ridge); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 4px;
  overflow-x: auto; scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }

.tab {
  appearance: none; background: none;
  border: 1px solid transparent; border-radius: 5px;
  padding: 7px 14px;
  font-family: var(--disp); font-weight: 700; font-size: 13px;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color .14s, background .14s, border-color .14s;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; flex-shrink: 0;
}
.tab:hover { color: var(--ink-soft); background: var(--panel); }
.tab.active {
  color: var(--brand); background: var(--panel-2);
  border-color: rgba(245,166,35,.18);
  box-shadow: 0 0 10px var(--brand-glow);
}
.tab-count {
  font-family: var(--mono); font-size: 10px;
  padding: 1px 6px; border-radius: 10px;
  background: var(--panel-3); color: var(--ink-dim);
  border: 1px solid var(--line);
}
.tab.active .tab-count { background: var(--brand-glow); color: var(--brand); border-color: rgba(245,166,35,.28); }

/* ==========================================================================
   SAFETY BANNER
   ========================================================================== */
.safety-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--red-glow); border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--r-sm); margin-bottom: 14px;
  cursor: pointer; transition: background .15s;
}
.safety-banner:hover { background: rgba(239,68,68,.18); }
.safety-icon { flex-shrink: 0; }
.safety-banner-text { flex: 1; font-size: 14px; color: #fca5a5; line-height: 1.4; }
.safety-banner-text strong { color: #fecaca; display: block; margin-bottom: 1px; font-weight: 600; }

/* ==========================================================================
   "NEW TO THIS MACHINE?" BUTTON
   ========================================================================== */
.btn-new-tech {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 18px; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--blue-glow) 0%, var(--brand-glow) 100%);
  border: 1px solid rgba(59,130,246,.22);
  border-radius: var(--r); cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.btn-new-tech:hover {
  border-color: rgba(59,130,246,.4);
  box-shadow: 0 4px 18px var(--blue-glow);
}

/* ==========================================================================
   SAFETY & OVERVIEW FIELDS
   ========================================================================== */
.safety-panel { border-left: 3px solid var(--red); }
.safety-field { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.safety-field:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.safety-field-label {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 5px;
}
.overview-field { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.overview-field:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* ==========================================================================
   DIAGNOSIS SESSION
   ========================================================================== */
.diag-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; background: var(--blue-glow);
  border: 1px solid rgba(59,130,246,.25); border-radius: var(--r-sm);
  margin-bottom: 12px; font-size: 14px; color: var(--blue-hi);
}
.btn-diag-start {
  display: block; width: 100%; padding: 10px 16px; margin-bottom: 14px;
  background: transparent; border: 1px dashed rgba(59,130,246,.28);
  border-radius: var(--r-sm); color: var(--blue-hi);
  font-family: var(--sans); font-size: 14px; cursor: pointer; text-align: left;
  transition: background .14s, border-color .14s;
}
.btn-diag-start:hover { background: var(--blue-glow); border-color: rgba(59,130,246,.48); }

/* ==========================================================================
   GUIDED WALKTHROUGH
   ========================================================================== */
.guided-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.84);
  z-index: 200; animation: fade .18s ease; backdrop-filter: blur(6px);
}
.guided-panel {
  position: fixed; inset: 16px; max-width: 660px; margin: 0 auto;
  z-index: 201; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  animation: rise-fast .2s cubic-bezier(.2,.8,.2,1); overflow: hidden;
}
.guided-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 20px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.guided-progress { display: flex; gap: 5px; padding: 14px 20px 4px; flex-shrink: 0; }
.guided-dot {
  flex: 1; height: 3px; border-radius: 3px; background: var(--line); transition: background .25s;
}
.guided-dot.done   { background: var(--brand-dim); }
.guided-dot.active { background: var(--brand); box-shadow: 0 0 6px var(--brand-glow); }
.guided-panel > p  { padding: 10px 20px 0; flex-shrink: 0; color: var(--ink-soft); font-size: 14px; }
.guided-content    { flex: 1; overflow-y: auto; padding: 16px 20px; }
.guided-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--line); flex-shrink: 0; gap: 10px;
}

/* ==========================================================================
   TROUBLESHOOTING TREES
   ========================================================================== */
.ts-node-card { margin-bottom: 12px; }
.ts-node-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
.ts-node-type { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 5px; }
.ts-opt-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }
.ts-opt-list li { font-size: 13px; padding: 3px 0; color: var(--ink-soft); }
.ts-trail {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  margin-bottom: 16px; padding: 10px 14px;
  background: var(--ridge); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}
.ts-crumb {
  background: none; border: none; color: var(--blue-hi);
  font-family: var(--mono); font-size: 12px; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; transition: background .1s;
}
.ts-crumb:hover { background: var(--blue-glow); }
.ts-crumb-sep   { color: var(--ink-ghost); font-size: 11px; }
.ts-question {
  font-family: var(--disp); font-size: 22px; font-weight: 700;
  line-height: 1.3; color: var(--ink); margin-bottom: 20px;
}
.ts-options { display: flex; flex-direction: column; gap: 0; margin-bottom: 6px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.ts-option {
  display: flex; align-items: center; gap: 12px;
  text-align: left; font-size: 16px; font-family: var(--sans);
  font-weight: 500; padding: 16px 18px; letter-spacing: 0;
  text-transform: none; border: none; border-bottom: 1px solid var(--line-soft);
  border-radius: 0; color: var(--ink-soft); background: var(--panel);
  width: 100%; cursor: pointer;
  transition: background .12s, color .12s, border-left-color .12s;
  border-left: 3px solid transparent;
}
.ts-option:last-child { border-bottom: none; }
.ts-option::after { content: '›'; margin-left: auto; font-size: 18px; color: var(--ink-ghost); flex-shrink: 0; transition: color .12s, transform .12s; }
.ts-option:hover { background: var(--panel-2); color: var(--ink); border-left-color: var(--brand); }
.ts-option:hover::after { color: var(--brand); transform: translateX(2px); }
.ts-option:active { background: var(--brand-glow); }
.ts-endpoint { padding: 16px 18px; border-radius: var(--r-sm); margin-bottom: 6px; }
.ts-endpoint.resolution { background: var(--green-glow); border: 1px solid rgba(34,197,94,.22); }
.ts-endpoint.escalate   { background: var(--brand-glow); border: 1px solid rgba(245,166,35,.22); }
.ts-endpoint.link       { background: var(--blue-glow);  border: 1px solid rgba(59,130,246,.22); }
.ts-endpoint-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 8px; }

/* ==========================================================================
   VISUAL TREE BUILDER (inline editor)
   ========================================================================== */
.tsb-views { display: inline-flex; gap: 3px; background: var(--ridge); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; margin-bottom: 14px; }
.tsb-name-input { font-family: var(--disp); font-size: 18px; font-weight: 700; background: var(--panel); border: 1px solid var(--brand); border-radius: var(--r-sm); color: var(--ink); padding: 2px 8px; }
.tsb-card { margin-bottom: 12px; }
.tsb-card-warn { border-color: rgba(245,166,35,.4); }
.tsb-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tsb-card .tsb-q,
.tsb-card .tsb-ep { width: 100%; font-family: var(--sans); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; }
.tsb-card .tsb-q:focus,
.tsb-card .tsb-ep:focus,
.tsb-opt-label:focus,
.tsb-target:focus,
.tsb-type:focus,
.tsb-link:focus { outline: none; border-color: var(--brand); }
.tsb-eplabel { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 6px; }
.tsb-type, .tsb-link { font-family: var(--sans); font-size: 13px; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 5px 8px; }
.tsb-link { width: 100%; }
.tsb-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.tsb-opt-row { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 8px; }
.tsb-opt-row.dragging { opacity: .5; }
.tsb-opt-row.dragover { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.tsb-drag { cursor: grab; color: var(--ink-ghost); font-size: 14px; line-height: 1; user-select: none; flex-shrink: 0; letter-spacing: -2px; padding: 0 2px; }
.tsb-opt-label { flex: 1 1 120px; min-width: 0; font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
.tsb-target { flex: 0 1 220px; min-width: 0; font-family: var(--sans); font-size: 12px; color: var(--ink-soft); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 6px; }
.tsb-iconbtn { padding: 4px 7px; flex-shrink: 0; }
.tsb-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tsb-flag { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--brand); background: var(--brand-glow); border: 1px solid rgba(245,166,35,.28); padding: 2px 7px; border-radius: 20px; }
.tsb-map-node { padding: 7px 8px; font-size: 14px; color: var(--ink); border-bottom: 1px solid var(--line-soft); cursor: pointer; border-radius: 4px; }
.tsb-map-node:hover { background: var(--panel-2); }
.tsb-map-node.warn { color: var(--brand); }
.tsb-map-opt { font-size: 13px; color: var(--ink-soft); padding: 2px 0 2px 22px; }
.tsb-flash { animation: tsbFlash 1.2s ease; }
@keyframes tsbFlash { 0%, 40% { box-shadow: 0 0 0 2px var(--brand); } 100% { box-shadow: 0 0 0 2px transparent; } }
@media (max-width: 460px) {
  .tsb-opt-row { flex-wrap: wrap; }
  .tsb-opt-label { flex: 1 1 100%; }
  .tsb-target { flex: 1 1 100%; }
}

/* ==========================================================================
   PROBLEM STEPS
   ========================================================================== */
.step-instruction { font-size: 18px; line-height: 1.55; color: var(--ink); white-space: pre-wrap; }
.step-callout       { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 6px; }
.step-callout-tag   { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; margin-bottom: 4px; }
.step-callout-warning { background: var(--red-glow);   border: 1px solid rgba(239,68,68,.28); }
.step-callout-warning .step-callout-tag { color: #fca5a5; }
.step-callout-caution { background: var(--brand-glow); border: 1px solid rgba(245,166,35,.28); }
.step-callout-caution .step-callout-tag { color: var(--brand); }
.step-callout-note    { background: var(--blue-glow);  border: 1px solid rgba(59,130,246,.28); }
.step-callout-note .step-callout-tag    { color: var(--blue-hi); }
.step-builder-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.step-builder-row:last-child { border-bottom: none; }
.step-builder-num { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); padding-top: 10px; min-width: 22px; text-align: right; flex-shrink: 0; }
.step-builder-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.step-callout-sel { font-size: 13px; padding: 6px 10px; }
.step-instr-ta { font-size: 14px; min-height: 56px; resize: vertical; }
.step-builder-acts { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }

/* ==========================================================================
   HISTORY TAB
   ========================================================================== */
.hist-chart { display: flex; align-items: flex-end; gap: 3px; height: 100px; margin-top: 10px; }
.hist-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; cursor: default; }
.hist-bar { width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 3px; transition: filter .12s; }
.hist-bar-wrap:hover .hist-bar { filter: brightness(1.2); }
.hist-bar-lbl { font-family: var(--mono); font-size: 10px; color: var(--ink-dim); text-align: center; }
.hist-fault-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.hist-fault-row:last-child { border-bottom: none; }
.hist-fault-rank  { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); min-width: 18px; text-align: center; }
.hist-fault-title { flex: 1; font-size: 14px; }
.hist-fault-count { font-family: var(--mono); font-size: 13px; color: var(--brand); font-weight: 600; }

/* ==========================================================================
   SUPER-ADMIN
   ========================================================================== */
.sa-org-card { border-left: 3px solid var(--blue); }
.sa-org-card.sa-suspended { border-left-color: var(--red); opacity: .7; }
.sa-org-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sa-stats { display: flex; margin-bottom: 12px; background: var(--ridge); border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line-soft); }
.sa-stat { flex: 1; text-align: center; padding: 10px 8px; border-right: 1px solid var(--line-soft); }
.sa-stat:last-child { border-right: none; }
.sa-stat-n { font-family: var(--disp); font-size: 22px; font-weight: 800; color: var(--brand); line-height: 1; }
.sa-stat-l { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); margin-top: 3px; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fade      { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise      { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes rise-fast { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes sweep     { from { transform: translateX(-150%); } to { transform: translateX(400%); } }
@keyframes pulse-glow {
  0%, 100% { transform: scale(1);   opacity: .6; }
  50%       { transform: scale(1.1); opacity: 1;  }
}

/* ==========================================================================
   Symbol Library
   ========================================================================== */
.symbol-filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 4px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}
.symbol-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .08s;
  text-align: center;
}
.symbol-card:hover {
  border-color: var(--brand);
  background: var(--panel-3);
  transform: translateY(-1px);
}
.symbol-card:active { transform: scale(.97); }
.symbol-svg {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
}
.symbol-svg svg {
  width: 54px;
  height: 54px;
  color: var(--ink-soft);
}
.symbol-card:hover .symbol-svg svg { color: var(--brand); }
.symbol-name {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.3;
  color: var(--ink-soft);
  max-width: 100px;
}
.symbol-std {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-dim);
  letter-spacing: .06em;
}
.symbol-detail-svg {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
}
.symbol-detail-svg svg {
  width: 120px;
  height: 120px;
  color: var(--ink);
}

/* ==========================================================================
   AI Tree Generator
   ========================================================================== */
/* Shake animation for inline validation */
@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}
.field-shake { animation: inputShake 0.3s ease; border-color: var(--red) !important; }

.btn-blue .spinner,
.btn-amber .spinner {
  border-color: rgba(255,255,255,.3);
  border-top-color: #fff;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   Reference Library — category chips
   ========================================================================== */
.gen-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.gen-chip {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: .04em;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: border-color .14s, color .14s, background .14s;
  white-space: nowrap;
}
.gen-chip:hover { border-color: var(--brand); color: var(--ink); }
.gen-chip.active {
  background: var(--brand-glow);
  border-color: var(--brand);
  color: var(--brand);
}

/* ==========================================================================
   Equipment View — Vertical Flow Redesign (Item 04)
   ========================================================================== */

/* Font aliases for equip view */
.ev-disp   { font-family: 'Barlow Condensed', 'Saira Condensed', sans-serif; }
.ev-body   { font-family: 'Barlow', 'IBM Plex Sans', sans-serif; }
.ev-mono   { font-family: 'JetBrains Mono', 'IBM Plex Mono', monospace; }

/* Equip view wrapper */
.ev-wrap {
  background: #0a0b0d;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 80px;
  position: relative;
}

/* Subtle 24px grid texture */
.ev-wrap::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(245,166,35,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,166,35,.025) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Sticky topbar */
.ev-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  background: rgba(10,11,13,.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(245,166,35,.12);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}
.ev-topbar-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}
.ev-topbar-crumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .08em;
  color: rgba(245,166,35,.7);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ev-topbar-name {
  font-family: 'Barlow Condensed', 'Saira Condensed', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #eef2f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}
.ev-topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ev-icon-btn {
  background: none;
  border: none;
  color: rgba(238,242,247,.6);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: color .14s, background .14s;
  position: relative;
}
.ev-icon-btn:hover { color: #eef2f7; background: rgba(255,255,255,.06); }
.ev-notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  background: #f5a623;
  border-radius: 50%;
  border: 1.5px solid #0a0b0d;
}

/* Zone container */
.ev-zone {
  position: relative;
  z-index: 1;
  margin: 12px 12px 0;
  border-radius: 10px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
}
.ev-zone.ev-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .32s ease, transform .32s ease;
}

/* Zone header */
.ev-zone-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  padding: 10px 14px 6px;
  text-transform: uppercase;
}
.ev-zone-header.amber { color: #f5a623; }
.ev-zone-header.grey  { color: rgba(238,242,247,.3); }

/* Zone 01 — Safety */
.ev-zone-safety {
  background: rgba(229,62,62,.08);
  border: 1.5px solid rgba(229,62,62,.3);
  animation: safetyPulse 3s ease-in-out infinite;
}
@keyframes safetyPulse {
  0%, 100% { border-color: rgba(229,62,62,.3); }
  50%       { border-color: rgba(229,62,62,.55); }
}
.ev-safety-body { padding: 0 14px 14px; }
.ev-safety-empty {
  color: #ef4444;
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  padding: 4px 0 6px;
}
.ev-safety-field { margin-bottom: 14px; }
.ev-safety-field:last-child { margin-bottom: 0; }
.ev-safety-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(239,68,68,.8);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ev-safety-label i { font-size: 13px; }
.ev-safety-value {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: #eef2f7;
  white-space: pre-wrap;
  line-height: 1.5;
}
.ev-safety-loto {
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(229,62,62,.1);
  border-radius: 6px;
  border-left: 2px solid rgba(239,68,68,.5);
}
.ev-safety-loto-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(239,68,68,.7);
  margin-bottom: 3px;
}
.ev-approval-chain {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(239,68,68,.15);
}
/* R2 — unified trust line. One grammar across safety, overview, tree cards and
   problem cards. Theme-driven colors; 13px so it's legible on a phone. */
.trust-line  { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--mono); font-size: 13px; margin-top: 8px; }
.trust-stage { display: inline-flex; align-items: center; gap: 4px; }
.trust-stage.wait       { color: var(--ink-dim); }
.trust-stage.mid        { color: var(--brand); }
.trust-stage.ok         { color: var(--green); }
.trust-stage.stale      { opacity: .45; text-decoration: line-through; }
.trust-stage.stale-note { color: var(--red); text-decoration: none; opacity: 1; }

/* The equipment-view dark zones (.ev-zone, always #0a0b0d) never re-theme, so
   the theme-var colors above (tuned for light/themed panels) lose contrast on
   near-black — and the zone design system uses JetBrains Mono, not var(--mono).
   Restore fixed, dark-legible values here. Scoped to .ev-zone only: the tabs
   render on themed .panel surfaces and correctly keep the theme-var colors. */
.ev-zone .trust-line             { font-family: 'JetBrains Mono', monospace; }
.ev-zone .trust-stage.wait       { color: rgba(238,242,247,.6); }
.ev-zone .trust-stage.mid        { color: #f5a623; }
.ev-zone .trust-stage.ok         { color: #22c55e; }
.ev-zone .trust-stage.stale-note { color: #ef4444; }

.ev-safety-edit-btn {
  margin-top: 10px;
  background: none;
  border: 1px solid rgba(239,68,68,.3);
  color: rgba(239,68,68,.8);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: .06em;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.ev-safety-edit-btn:hover { background: rgba(239,68,68,.1); color: #ef4444; }

/* Zone 02 — Fault Status */
.ev-zone-fault {
  background: rgba(25,30,40,.9);
  border: 1px solid rgba(245,166,35,.12);
}
.ev-diag-active {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(245,166,35,.07);
  border-bottom: 1px solid rgba(245,166,35,.12);
  margin-bottom: 10px;
}
.ev-diag-dot {
  width: 8px;
  height: 8px;
  background: #f5a623;
  border-radius: 50%;
  flex-shrink: 0;
  animation: diagPulse 1.4s ease-in-out infinite;
}
@keyframes diagPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}
.ev-diag-text {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #f5a623;
}
.ev-diag-close {
  background: none;
  border: 1px solid rgba(245,166,35,.3);
  color: #f5a623;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.ev-cta-troubleshoot {
  display: block;
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  padding: 16px;
  background: #f5a623;
  color: #1a0f00;
  border: none;
  border-radius: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  cursor: pointer;
  transition: background .14s, transform .08s;
}
.ev-cta-troubleshoot:hover { background: #e8951a; }
.ev-cta-troubleshoot:active { transform: scale(.98); }
.ev-cta-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  opacity: .7;
  display: block;
  margin-top: 2px;
}
.ev-fault-cards { padding: 0 14px 6px; }
.ev-fault-card {
  background: rgba(13,16,21,.6);
  border-radius: 7px;
  border-left: 3px solid #5c7089;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .14s;
}
.ev-fault-card:hover { background: rgba(25,30,40,.9); }
.ev-fault-card.sev-critical { border-left-color: #ef4444; }
.ev-fault-card.sev-high     { border-left-color: #f5a623; }
.ev-fault-card.sev-medium   { border-left-color: #3b82f6; }
.ev-fault-card.sev-low      { border-left-color: #5c7089; }
.ev-fault-title {
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #eef2f7;
  margin-bottom: 4px;
}
.ev-fault-meta-row {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(238,242,247,.4);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}
.ev-freq-grey   { color: rgba(238,242,247,.35); }
.ev-freq-amber  { color: #f5a623; }
.ev-freq-red    { color: #ef4444; }
.ev-sev-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
}
.ev-sev-badge.critical { background: rgba(239,68,68,.15); color: #ef4444; }
.ev-sev-badge.high     { background: rgba(245,166,35,.15); color: #f5a623; }
.ev-sev-badge.medium   { background: rgba(59,130,246,.15); color: #3b82f6; }
.ev-sev-badge.low      { background: rgba(92,112,137,.15); color: #9aabbe; }
.ev-steps-hint {
  font-family: 'Barlow', sans-serif;
  font-size: 11px;
  color: rgba(245,166,35,.7);
  margin-top: 3px;
}
.ev-view-all-faults {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(245,166,35,.6);
  text-align: center;
  padding: 8px 14px 14px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  transition: color .14s;
}
.ev-view-all-faults:hover { color: #f5a623; }

/* Zone 03 — How To Fix It */
.ev-zone-fix {
  background: rgba(25,30,40,.9);
  border: 1px solid rgba(245,166,35,.1);
}
.ev-tree-card {
  background: rgba(13,16,21,.5);
  border-radius: 7px;
  border: 1px solid rgba(245,166,35,.1);
  padding: 12px 14px;
  margin: 0 14px 8px;
  cursor: pointer;
  transition: border-color .14s, background .14s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ev-tree-card:hover { border-color: rgba(245,166,35,.3); background: rgba(25,30,40,.8); }
.ev-tree-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #eef2f7;
  flex: 1;
}
.ev-tree-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(238,242,247,.4);
  margin-top: 2px;
}
.ev-tree-progress {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: #f5a623;
  margin-top: 3px;
}
.ev-no-trees {
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  color: rgba(238,242,247,.35);
  text-align: center;
  padding: 16px 14px;
}
.ev-report-btn {
  display: block;
  margin: 4px 14px 14px;
  padding: 12px 14px;
  border: 1.5px dashed rgba(245,166,35,.3);
  background: none;
  border-radius: 8px;
  color: rgba(245,166,35,.7);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  width: calc(100% - 28px);
  transition: border-color .14s, color .14s, background .14s;
  line-height: 1.4;
}
.ev-report-btn:hover {
  border-color: #f5a623;
  color: #f5a623;
  background: rgba(245,166,35,.04);
}

/* Zone 04 — Reference */
.ev-zone-ref {
  background: rgba(25,30,40,.7);
  border: 1px solid rgba(238,242,247,.06);
}
.ev-ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 6px 14px 14px;
}
.ev-ref-card {
  background: rgba(13,16,21,.5);
  border: 1px solid rgba(238,242,247,.07);
  border-radius: 8px;
  padding: 14px 12px 12px;
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .08s;
}
.ev-ref-card:hover { border-color: rgba(238,242,247,.18); background: rgba(25,30,40,.8); }
.ev-ref-card:active { transform: scale(.97); }
.ev-ref-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin-bottom: 8px;
}
.ev-ref-icon.amber   { background: rgba(245,166,35,.15); color: #f5a623; }
.ev-ref-icon.blue    { background: rgba(59,130,246,.15);  color: #3b82f6; }
.ev-ref-icon.purple  { background: rgba(139,92,246,.15);  color: #a78bfa; }
.ev-ref-icon.green   { background: rgba(34,197,94,.15);   color: #22c55e; }
.ev-ref-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #eef2f7;
  margin-bottom: 2px;
}
.ev-ref-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: rgba(238,242,247,.35);
}

/* Staleness flag (for Item 06 integration) */
.ev-stale-flag {
  margin: 0 14px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #f5a623;
  opacity: .75;
}

/* Bottom bar */
.ev-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 200;
  background: rgba(10,11,13,.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(245,166,35,.15);
  padding: 10px 14px;
  display: flex;
  gap: 10px;
}
.ev-bar-new-here {
  flex: 0 0 auto;
  padding: 12px 16px;
  background: rgba(238,242,247,.05);
  border: 1px solid rgba(238,242,247,.12);
  border-radius: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: rgba(238,242,247,.75);
  cursor: pointer;
  transition: background .14s, color .14s;
  white-space: nowrap;
}
.ev-bar-new-here:hover { background: rgba(238,242,247,.1); color: #eef2f7; }
.ev-bar-troubleshoot {
  flex: 1;
  padding: 12px 16px;
  background: #f5a623;
  border: none;
  border-radius: 8px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #1a0f00;
  cursor: pointer;
  transition: background .14s, transform .08s;
}
.ev-bar-troubleshoot:hover { background: #e8951a; }
.ev-bar-troubleshoot:active { transform: scale(.98); }

/* Subview layout */
.ev-subview-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  background: rgba(10,11,13,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(238,242,247,.08);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 12px;
}
.ev-back-btn {
  background: none;
  border: none;
  color: rgba(245,166,35,.9);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ev-subview-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #eef2f7;
  flex: 1;
}
.ev-subview-body {
  padding: 14px;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Tree outcomes / analytics (R4)
   ========================================================================== */
.outcome-confirm { padding: 20px 0; }
.outcome-confirm .btn { width: 100%; margin-bottom: 10px; padding: 14px 16px; font-size: 16px; }
.outcome-q { font-size: 16px; margin-bottom: 16px; font-weight: 700; }
.node-stats { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-stats.warn { color: var(--brand); }

/* ==========================================================================
   Blank-org first-run setup card (R9)
   ========================================================================== */
.setup-card  { background: var(--panel); border: 1px solid var(--brand); border-radius: var(--r); padding: 20px; margin-bottom: 20px; }
.setup-title { font-family: var(--disp); font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.setup-step  { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 4px; cursor: pointer; font-size: 16px; border-radius: var(--r-sm); }
.setup-step:not(.done):active { background: var(--panel-2); }
.setup-step.done   { color: var(--ink-dim); cursor: default; }
.setup-step.done i { color: var(--green); }

/* ==========================================================================
   System banner (R3) — single global offline bar; in-zone banners go compact
   ========================================================================== */
.sys-banner { padding: 10px 16px; font-family: var(--mono); font-size: 13px; text-align: center; }
/* Theme-independent solid amber: the slot sits on the page body (light in SaaS,
   dark otherwise), so a var(--brand) text would either mismatch the amber tint
   (SaaS blue) or be illegible. Dark-on-amber reads clearly in all three themes. */
.sys-banner.offline { color: #241a06; background: #f5a623; border-bottom: 1px solid rgba(0,0,0,.18); }
/* Base padding lives here (not inline) so the compact override below can win. */
.ev-stale-banner { padding: 10px 12px; }
body.banners-compact .ev-diag-active { padding: 6px 12px; }
body.banners-compact .ev-stale-banner { padding: 6px 10px; }
body.banners-compact .ev-stale-banner .detail { display: none; }

/* ==========================================================================
   Voice input
   ========================================================================== */
/* R5 — floating mic on data-voice textareas. 44×44 tap target (mobile standard);
   textareas get bottom padding + 16px font (iOS zoom prevention). */
.voice-btn {
  position: absolute; right: 8px; bottom: 8px; z-index: 10;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; color: var(--ink-dim);
  opacity: .85; transition: opacity .15s;
}
.voice-btn:active { background: var(--panel); }
textarea[data-voice] { padding-bottom: 52px; font-size: 16px; }
.mic-btn:hover { opacity: 1 !important; }
.mic-btn.mic-active { background: var(--red) !important; border-color: var(--red) !important; color: #fff; opacity: 1 !important; }
@keyframes recordPulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.4)} 50%{box-shadow:0 0 0 6px rgba(239,68,68,0)} }
.btn-red-pulse { animation: recordPulse 1.2s infinite; background: var(--red) !important; color: #fff !important; }
.voice-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--ridge); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 12px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
}
.voice-chip-del {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--ink-ghost); font-size: 14px; line-height: 1; padding: 0 2px;
}
.voice-chip-del:hover { color: var(--red); }

/* ==========================================================================
   Photo grid
   ========================================================================== */
.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px;
}
.photo-thumb {
  position: relative; aspect-ratio: 1; border-radius: var(--r-sm);
  overflow: hidden; border: 1px solid var(--line); background: var(--ridge); cursor: zoom-in;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del-btn {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%;
  width: 20px; height: 20px; cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s;
}
.photo-thumb:hover .photo-del-btn { opacity: 1; }

/* ==========================================================================
   Share page — R5/R6 (read-only public view)
   ========================================================================== */
.share-footer {
  margin-top: 40px; padding: 16px; border-top: 1px solid var(--line-soft);
  font-family: var(--mono); font-size: 13px; color: var(--ink-dim); text-align: center;
}
.share-footer a { color: var(--brand); }
/* Read-only photo thumbnails (share page + share-follow linked problems) */
.share-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.share-photo-thumb {
  width: 72px; height: 72px; object-fit: cover; border-radius: var(--r-sm);
  border: 1px solid var(--line); cursor: zoom-in; background: var(--ridge);
}
.photo-offline {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  border: 1px dashed var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin-top: 10px;
}
.share-lightbox {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out;
}
.share-lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--r-sm); }
