/* ============================================================
   LGS CAPEX — design tokens & base
   ============================================================ */
:root {
  --font-display: 'Fraunces', Georgia, serif;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---------- DARK (default) ---------- */
.theme-dark {
  --bg-0: #0a0d12;
  --bg-1: #0f131a;
  --bg-2: #141922;
  --bg-3: #1a212c;
  --bg-4: #232c39;
  --line: #232c39;
  --line-strong: #2e3947;
  --text-0: #f4f6f9;
  --text-1: #d5dce6;
  --text-2: #8d98a9;
  --text-3: #5c6676;
  --accent: #d84d3a;        /* mattone industriale */
  --accent-soft: #2a1915;
  --accent-2: #c5a875;      /* ottone */
  --ok: #3f9d6b;
  --ok-soft: #10231a;
  --warn: #d6a429;
  --warn-soft: #231d0e;
  --err: #d84d3a;
  --err-soft: #2a1915;
  --info: #5a8fc9;
  --info-soft: #10202e;
  --overlay: rgba(4, 6, 10, 0.72);
  --grid-line: rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

/* ---------- LIGHT ---------- */
.theme-light {
  --bg-0: #f6f4ef;
  --bg-1: #ffffff;
  --bg-2: #f0ede6;
  --bg-3: #e7e3d9;
  --bg-4: #dcd6c8;
  --line: #e3dfd3;
  --line-strong: #cec7b6;
  --text-0: #14181f;
  --text-1: #2b3340;
  --text-2: #5d6777;
  --text-3: #8c93a0;
  --accent: #b3361f;
  --accent-soft: #f5e4df;
  --accent-2: #8a6a2e;
  --ok: #2f7a51;
  --ok-soft: #e2efe7;
  --warn: #9a761b;
  --warn-soft: #f3ead0;
  --err: #b3361f;
  --err-soft: #f5e4df;
  --info: #2f6aa8;
  --info-soft: #e0ebf5;
  --overlay: rgba(20, 24, 31, 0.38);
  --grid-line: rgba(20, 24, 31, 0.05);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg-0); }
body {
  font-family: var(--font-sans);
  color: var(--text-0);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#root { height: 100vh; }

button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   App layout
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 48px 1fr;
  height: 100vh;
  background: var(--bg-0);
}
.app-shell.collapsed { grid-template-columns: 56px 1fr; }
.topbar { grid-column: 1 / -1; }
.sidebar { grid-row: 2 / 3; border-right: 1px solid var(--line); background: var(--bg-1); overflow-y: auto; }
.main { grid-row: 2 / 3; overflow: auto; position: relative; background: var(--bg-0); }
.main.with-copilot { display: grid; grid-template-columns: 1fr var(--copilot-w, 380px); }
.main.with-copilot > .page { min-width: 0; }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  font-size: 12px;
}
.topbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  width: 232px;
  padding-right: 16px;
  border-right: 1px solid var(--line);
  height: 100%;
}
.app-shell.collapsed .topbar .brand { width: 56px; padding-right: 0; border-right: none; justify-content: center; }
.topbar .brand .mark {
  width: 22px; height: 22px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700; font-family: var(--font-sans);
}
.topbar .brand .sub {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-left: auto;
  font-weight: 500;
}
.app-shell.collapsed .topbar .brand .name,
.app-shell.collapsed .topbar .brand .sub { display: none; }

.topbar .crumbs {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
}
.topbar .crumbs .sep { color: var(--text-3); }
.topbar .crumbs .cur { color: var(--text-0); }

.topbar .search {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  min-width: 260px;
  color: var(--text-2);
  font-size: 12px;
}
.topbar .search .kbd {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-1);
}
.topbar .env {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2);
  padding: 3px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-2);
}
.topbar .env .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.topbar .icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: var(--radius-sm); color: var(--text-2); }
.topbar .icon-btn:hover { background: var(--bg-2); color: var(--text-0); }
.topbar .icon-btn .badge { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--bg-1); }
.topbar .icon-btn { position: relative; }

.topbar .user {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
}
.topbar .user .avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-4); display: inline-flex; align-items: center; justify-content: center; color: var(--text-0); font-weight: 600; font-size: 10px; }
.topbar .user .name { font-size: 11px; font-weight: 600; color: var(--text-0); }
.topbar .user .role { font-size: 9px; color: var(--text-2); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar .group { padding: 10px 0; border-bottom: 1px solid var(--line); }
.sidebar .group-label { font-family: var(--font-mono); font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.14em; padding: 6px 16px; }
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 500;
  border-left: 2px solid transparent;
  position: relative;
}
.sidebar .nav-item:hover { background: var(--bg-2); color: var(--text-0); }
.sidebar .nav-item.active { background: linear-gradient(90deg, var(--accent-soft) 0%, transparent 100%); color: var(--text-0); border-left-color: var(--accent); }
.sidebar .nav-item svg { flex-shrink: 0; opacity: 0.85; }
.sidebar .nav-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  padding: 1px 6px;
  background: var(--bg-2);
  border-radius: 999px;
  border: 1px solid var(--line);
}
.sidebar .nav-item.alert .count { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.app-shell.collapsed .sidebar .nav-item .label,
.app-shell.collapsed .sidebar .nav-item .count,
.app-shell.collapsed .sidebar .group-label { display: none; }
.app-shell.collapsed .sidebar .nav-item { justify-content: center; padding: 10px; }

.sidebar .role-switch {
  padding: 12px 14px;
  font-size: 11px;
}
.sidebar .role-switch select {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-0);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin-top: 4px;
}
.app-shell.collapsed .sidebar .role-switch { display: none; }

/* ============================================================
   Pages — generic
   ============================================================ */
.page { padding: 20px 24px 60px; min-height: 100%; }
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.page-title { font-family: var(--font-display); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; color: var(--text-0); margin: 0; }
.page-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; max-width: 640px; line-height: 1.5; }
.page-header .actions { display: flex; gap: 8px; align-items: center; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 500;
}

/* ============================================================
   Cards / panels
   ============================================================ */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.card.flush { border-radius: 0; border-left: none; border-right: none; }
.card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.card-header .title { font-size: 12px; font-weight: 600; color: var(--text-0); }
.card-header .desc { font-size: 11px; color: var(--text-2); }
.card-header .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 14px; }
.card-body.tight { padding: 10px 14px; }
.card-footer { padding: 10px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-2); background: var(--bg-1); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ============================================================
   Buttons / chips
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-0);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover { background: var(--bg-3); border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-1); }
.btn.ghost:hover { background: var(--bg-2); color: var(--text-0); }
.btn.ai { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); color: #fff; border-color: transparent; }
.btn.ai:hover { filter: brightness(1.08); }
.btn.sm { padding: 4px 9px; font-size: 11px; }
.btn.icon { padding: 6px; }
/* Stato disabilitato: un bottone disabilitato DEVE sembrare disabilitato
   (prima era identico a uno attivo → l'utente cliccava e non capiva perché
   non succedeva nulla). Neutralizza anche gli effetti hover. */
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { filter: none; background: var(--bg-2); border-color: var(--line); }
.btn.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost:disabled:hover { background: transparent; border-color: transparent; }
.btn.ai:disabled:hover { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-1);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chip.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.err { color: var(--err); background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.chip.info { color: var(--info); background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.chip.ai { color: var(--accent-2); background: transparent; border-color: color-mix(in srgb, var(--accent-2) 40%, transparent); }

/* ============================================================
   Tables
   ============================================================ */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.tbl th {
  text-align: left;
  font-weight: 500;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  position: sticky; top: 0;
  z-index: 1;
}
.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-1);
  vertical-align: middle;
}
.tbl tr:hover td { background: var(--bg-2); }
.tbl td.num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.mono { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.tbl tr.clickable { cursor: pointer; }

/* ============================================================
   KPI stat
   ============================================================ */
.stat { padding: 14px; }
.stat .label { font-size: 10px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-2); }
.stat .value { font-family: var(--font-display); font-size: 30px; font-weight: 500; line-height: 1; margin-top: 6px; letter-spacing: -0.02em; color: var(--text-0); }
.stat .value .unit { font-size: 14px; color: var(--text-2); font-family: var(--font-sans); font-weight: 400; margin-left: 4px; }
.stat .delta { font-size: 11px; font-family: var(--font-mono); margin-top: 4px; }
.stat .delta.up { color: var(--ok); }
.stat .delta.down { color: var(--err); }
.stat .spark { margin-top: 8px; }

/* ============================================================
   Progress / meters
   ============================================================ */
.meter { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s var(--ease); }
.meter.ok > span { background: var(--ok); }
.meter.warn > span { background: var(--warn); }
.meter.err > span { background: var(--err); }
.meter.thick { height: 10px; }

/* ============================================================
   Copilot
   ============================================================ */
.copilot {
  border-left: 1px solid var(--line);
  background: var(--bg-1);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
/* s127 — maniglia di resize sul bordo sinistro del Copilot */
.copilot-resize {
  position: absolute; left: -3px; top: 0; bottom: 0; width: 7px;
  cursor: col-resize; z-index: 5; background: transparent;
  transition: background .12s ease;
}
.copilot-resize:hover, .copilot-resize:active { background: color-mix(in oklch, var(--accent) 35%, transparent); }
.copilot-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.copilot-header .mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%); display: inline-flex; align-items: center; justify-content: center; }
.copilot-header .title { font-size: 12px; font-weight: 600; }
.copilot-header .sub { font-size: 10px; font-family: var(--font-mono); color: var(--text-2); text-transform: uppercase; letter-spacing: 0.1em; margin-left: 2px; }
.copilot-header .close { margin-left: auto; }
.copilot-body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.copilot-msg { padding: 10px 12px; border-radius: var(--radius-md); font-size: 12.5px; line-height: 1.55; }
.copilot-msg.user { background: var(--accent-soft); color: var(--text-0); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); align-self: flex-end; max-width: 86%; }
.copilot-msg.assistant { background: var(--bg-2); border: 1px solid var(--line); color: var(--text-1); max-width: 92%; }
.copilot-msg.assistant .meta { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 10px; color: var(--text-2); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }
.copilot-msg .sources { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--text-2); }
.copilot-msg .sources a { color: var(--accent-2); }
.copilot-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.copilot-suggest .s {
  font-size: 11px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-1);
  cursor: pointer;
}
.copilot-suggest .s:hover { background: var(--bg-3); border-color: var(--line-strong); }
.copilot-input {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--bg-1);
}
.copilot-input textarea {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-0);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  min-height: 36px; max-height: 120px;
  font-size: 12.5px;
  resize: none;
  outline: none;
  font-family: var(--font-sans);
}
.copilot-input textarea:focus { border-color: var(--accent); }

/* ============================================================
   Command Palette
   ============================================================ */
.cmdk-backdrop {
  position: fixed; inset: 0; background: var(--overlay); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  backdrop-filter: blur(4px);
}
.cmdk {
  width: min(620px, 92vw);
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  overflow: hidden;
}
.cmdk input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px 18px;
  font-size: 14px;
  color: var(--text-0);
  outline: none;
  border-bottom: 1px solid var(--line);
}
.cmdk-list { max-height: 50vh; overflow: auto; }
.cmdk-group-label { padding: 8px 16px 4px; font-family: var(--font-mono); font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.14em; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  font-size: 12.5px;
  cursor: pointer;
}
.cmdk-item .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }
.cmdk-item.active, .cmdk-item:hover { background: var(--bg-2); }
.cmdk-item .icon { color: var(--text-2); }

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--overlay); z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.modal.lg { width: min(960px, 100%); }
.modal-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-header .title { font-size: 14px; font-weight: 600; }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   Forms
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11px; color: var(--text-2); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }
.field input, .field textarea, .field select {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-0);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field .hint { font-size: 11px; color: var(--text-3); }

/* ============================================================
   Small utilities
   ============================================================ */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }
.sep { height: 1px; background: var(--line); margin: 8px 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em;
}
.divider-v { width: 1px; background: var(--line); align-self: stretch; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }

/* ============================================================
   Login
   ============================================================ */
.login-wrap {
  height: 100vh; width: 100vw;
  display: grid;
  grid-template-columns: 1fr 460px;
  background: var(--bg-0);
}
.login-side {
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-0) 60%, var(--accent-soft) 100%);
  padding: 40px 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-side::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 30% 40%, black, transparent 75%);
  pointer-events: none;
}
.login-side h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 4.5vw, 60px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 640px;
  position: relative;
  color: var(--text-0);
}
.login-side h1 em { font-style: italic; color: var(--accent-2); font-weight: 400; }
.login-side .kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-2); letter-spacing: 0.14em; text-transform: uppercase;
  position: relative;
}
.login-side .kicker .line { height: 1px; width: 40px; background: var(--text-3); }
.login-side .foot { position: relative; font-size: 11px; color: var(--text-2); font-family: var(--font-mono); display: flex; gap: 20px; }
.login-side .meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; position: relative; max-width: 520px; }
.login-side .meta .n { font-family: var(--font-display); font-size: 28px; color: var(--text-0); font-weight: 500; line-height: 1; }
.login-side .meta .l { font-size: 10px; color: var(--text-2); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 4px; }

.login-form {
  padding: 60px 48px;
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
  border-left: 1px solid var(--line);
  background: var(--bg-1);
}
.login-form .ttl { font-family: var(--font-display); font-size: 28px; font-weight: 500; letter-spacing: -0.02em; margin: 0; }
.login-form .sub { font-size: 12.5px; color: var(--text-2); margin-top: -10px; }
.login-form .profiles { display: grid; gap: 8px; margin-top: 8px; }
.login-form .profile {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.login-form .profile:hover { border-color: var(--accent); background: var(--bg-3); }
.login-form .profile .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-4); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; color: var(--text-0); }
.login-form .profile .name { font-size: 13px; font-weight: 600; }
.login-form .profile .role { font-size: 10.5px; color: var(--text-2); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }

/* ============================================================
   Gantt
   ============================================================ */
.gantt { font-size: 11px; }
.gantt-row { display: grid; grid-template-columns: 240px 1fr; border-bottom: 1px solid var(--line); min-height: 36px; align-items: center; }
.gantt-row.header { border-bottom: 1px solid var(--line-strong); background: var(--bg-2); position: sticky; top: 0; z-index: 1; }
.gantt-row.header .label { font-family: var(--font-mono); font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.12em; padding: 10px 12px; }
.gantt-row .label { padding: 8px 12px; font-size: 11.5px; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.gantt-row .label .phase-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.gantt-row .bars { position: relative; height: 100%; padding: 6px 0; min-height: 28px; }
.gantt-row .bar {
  position: absolute; top: 8px; height: 18px;
  background: var(--accent);
  border-radius: 4px;
  font-size: 10px;
  color: #fff;
  display: inline-flex; align-items: center;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  font-family: var(--font-mono);
}
.gantt-row .bar.planned { background: var(--bg-4); color: var(--text-2); }
.gantt-row .bar.done { background: var(--ok); }
.gantt-row .bar.risk { background: var(--warn); color: #000; }
.gantt-row .bar.delay { background: var(--err); }
.gantt-row .milestone { position: absolute; top: 6px; width: 14px; height: 14px; transform: translateX(-7px) rotate(45deg); background: var(--accent-2); border: 1px solid var(--line-strong); }
.gantt-row .today { position: absolute; top: 0; bottom: 0; width: 1.5px; background: var(--accent); z-index: 2; }
.gantt-row .today::before { content: 'OGGI'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-size: 8px; font-family: var(--font-mono); color: var(--accent); background: var(--bg-0); padding: 0 4px; }

/* ============================================================
   Timeline / activity
   ============================================================ */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 16px; }
.timeline-item::before { content: ''; position: absolute; left: -18px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--text-3); }
.timeline-item.accent::before { background: var(--accent); border-color: var(--accent); }
.timeline-item.ok::before { background: var(--ok); border-color: var(--ok); }
.timeline-item.warn::before { background: var(--warn); border-color: var(--warn); }
.timeline-item.err::before { background: var(--err); border-color: var(--err); }
.timeline-item .t { font-size: 10px; font-family: var(--font-mono); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; }
.timeline-item .head { font-size: 12.5px; font-weight: 500; margin-top: 2px; }
.timeline-item .body { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ============================================================
   Workflow diagram
   ============================================================ */
.workflow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  position: relative;
}
.wf-phase {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
}
.wf-phase.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.wf-phase .num { font-family: var(--font-mono); font-size: 10px; color: var(--accent); letter-spacing: 0.12em; }
.wf-phase h4 { font-family: var(--font-display); font-size: 18px; font-weight: 500; margin: 4px 0 6px; letter-spacing: -0.01em; }
.wf-phase .desc { font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.wf-phase .ai-line {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 10.5px;
  color: var(--accent-2);
  font-family: var(--font-mono);
  display: flex; align-items: center; gap: 6px;
}
.wf-arrow {
  position: absolute; top: 50%; right: -12px;
  width: 12px; height: 1px; background: var(--line-strong);
  z-index: 1;
}

/* ============================================================
   Sparkline (svg)
   ============================================================ */
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.spark path.area { fill: var(--accent-soft); }
.spark.ok path.line { stroke: var(--ok); }
.spark.warn path.line { stroke: var(--warn); }

/* ============================================================
   Early warning / alerts
   ============================================================ */
.alert-card {
  display: grid; grid-template-columns: 6px 1fr auto; gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-1);
  align-items: center;
}
.alert-card .bar { align-self: stretch; border-radius: 3px; background: var(--warn); }
.alert-card.err .bar { background: var(--err); }
.alert-card.ok .bar { background: var(--ok); }
.alert-card.info .bar { background: var(--info); }
.alert-card .ttl { font-size: 12.5px; font-weight: 600; }
.alert-card .meta { font-size: 11px; color: var(--text-2); font-family: var(--font-mono); margin-top: 2px; }
.alert-card .reason { font-size: 12px; color: var(--text-1); margin-top: 4px; line-height: 1.5; }

/* ============================================================
   File / doc chips
   ============================================================ */
.doc-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.doc-row:hover { background: var(--bg-2); }
.doc-row .ico {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--bg-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 9px; color: var(--text-2);
  font-weight: 600;
}
.doc-row .name { font-size: 12.5px; font-weight: 500; }
.doc-row .path { font-size: 10.5px; color: var(--text-3); font-family: var(--font-mono); margin-top: 2px; }

/* ============================================================
   Chat full page
   ============================================================ */
.chat-full { display: grid; grid-template-rows: 1fr auto; height: 100%; }
.chat-list { padding: 24px; overflow: auto; display: flex; flex-direction: column; gap: 18px; max-width: 900px; margin: 0 auto; width: 100%; }
.chat-empty {
  text-align: center;
  padding: 80px 20px;
}
.chat-empty h2 { font-family: var(--font-display); font-size: 32px; font-weight: 500; letter-spacing: -0.02em; }
.chat-empty .ex {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  max-width: 680px; margin: 24px auto 0;
}
.chat-empty .ex .e {
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-1);
  cursor: pointer;
  font-size: 12.5px;
}
.chat-empty .ex .e:hover { border-color: var(--accent); }

/* ============================================================
   Placeholder image
   ============================================================ */
.placeholder-img {
  background:
    repeating-linear-gradient(
      135deg,
      var(--bg-2) 0,
      var(--bg-2) 8px,
      var(--bg-3) 8px,
      var(--bg-3) 16px
    );
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* ============================================================
   Uploader
   ============================================================ */
.uploader { display: flex; flex-direction: column; gap: 10px; }
.uploader .drop {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg-1);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.uploader .drop.compact { padding: 10px 14px; }
.uploader .drop:hover { border-color: var(--accent); background: var(--bg-2); }
.uploader .drop.over { border-color: var(--accent); background: var(--accent-soft); border-style: solid; }
.uploader .drop-ico {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-1); flex-shrink: 0;
}
.uploader .drop.compact .drop-ico { width: 28px; height: 28px; }
.uploader .drop-text { flex: 1; min-width: 0; }
.uploader .drop-t { font-size: 13px; font-weight: 600; color: var(--text-0); }
.uploader .drop-s { font-size: 11.5px; color: var(--text-2); margin-top: 3px; line-height: 1.4; }
.uploader .drop-hint { display: flex; align-items: center; gap: 0; flex-shrink: 0; }
.uploader .drop-hint .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding: 2px 8px; border-radius: 4px;
  background: var(--accent-soft);
  letter-spacing: 0.08em;
}
.upload-list { display: flex; flex-direction: column; gap: 6px; }
.upload-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-1);
}
.upload-row .ur-ico {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.upload-row .ur-main { flex: 1; min-width: 0; }
.upload-row .ur-name { font-size: 12px; font-weight: 500; color: var(--text-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-row .ur-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-2);
  margin-top: 2px;
}
.upload-row .ur-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.upload-row .ur-actions .btn.sm { padding: 4px 8px; }

@keyframes pulseBar {
  0%,100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* ============================================================
   Toast
   ============================================================ */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}
.toast .t { font-weight: 600; }
.toast .d { color: var(--text-2); font-size: 11.5px; margin-top: 2px; }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.err { border-left-color: var(--err); }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fade-in 0.25s var(--ease); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.pulse { animation: pulse 2s infinite; }
@keyframes skeleton { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.skeleton { background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%); background-size: 400px 100%; animation: skeleton 1.4s infinite linear; border-radius: 4px; }

/* ============================================================
   Dot grid background
   ============================================================ */
.dot-grid {
  background-image: radial-gradient(var(--grid-line) 1px, transparent 1px);
  background-size: 18px 18px;
}
