/* FAST Dashboard – Design nach dem FAST-Logo (Navy #1A3C6A) */

:root {
  --navy: #1a3c6a;
  --navy-600: #24518d;
  --navy-700: #163356;
  --navy-800: #10284a;
  --navy-900: #0b1b33;
  --blue: #2f6fc4;
  --sky: #5aa2ff;
  --yellow: #f5c518;
  --yellow-600: #d9a900;

  --bg: #f2f5fa;
  --bg-2: #e9eef6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #0f1b2d;
  --text-2: #3d4b60;
  --muted: #6b7a90;
  --line: #e2e8f1;
  --line-2: #cfd8e5;
  --green: #159a5a;
  --green-bg: #e6f7ee;
  --red: #dc2650;
  --red-bg: #fdeaef;
  --amber: #d98b00;
  --amber-bg: #fff4dc;

  --chart-1: #1a3c6a;
  --chart-2: #5aa2ff;
  --chart-3: #f5c518;
  --chart-4: #19b385;
  --chart-5: #ff7a59;

  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.05), 0 1px 1px rgba(15, 27, 45, 0.03);
  --shadow: 0 6px 20px rgba(26, 60, 106, 0.08), 0 1px 3px rgba(15, 27, 45, 0.05);
  --shadow-lg: 0 20px 50px rgba(26, 60, 106, 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme="dark"] {
  --bg: #0b1626;
  --bg-2: #0f1e33;
  --surface: #12223a;
  --surface-2: #172b47;
  --text: #eaf0f8;
  --text-2: #c2cede;
  --muted: #8fa1b8;
  --line: #22385a;
  --line-2: #2d4770;
  --green-bg: rgba(21, 154, 90, 0.16);
  --red-bg: rgba(220, 38, 80, 0.16);
  --amber-bg: rgba(217, 139, 0, 0.16);
  --chart-1: #7fb4ff;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: rgba(245, 197, 24, 0.45); }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ───────────── Layout ───────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-800) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}
.sidebar .logo { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.sidebar .logo img { height: 30px; width: auto; display: block; }
.sidebar .logo .sub {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.7; font-weight: 600;
  border-left: 1px solid rgba(255, 255, 255, 0.25); padding-left: 12px; line-height: 1.2;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; border: 0; background: transparent;
  color: rgba(255, 255, 255, 0.78); cursor: pointer; text-align: left; width: 100%;
  transition: background 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease);
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: 0.9; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.is-active { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.nav-item.is-active::before { content: ""; width: 3px; height: 18px; border-radius: 3px; background: var(--yellow); margin-left: -12px; margin-right: 1px; }
.nav-item .badge { margin-left: auto; background: var(--yellow); color: var(--navy-900); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.nav-section { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.5; padding: 16px 12px 6px; font-weight: 600; }

.sidebar-bottom { margin-top: auto; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.08);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--yellow); color: var(--navy-900);
  font-weight: 800; display: grid; place-items: center; flex: none; font-size: 14px;
}
.user-card .name { font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.user-card .email { font-size: 11.5px; opacity: 0.65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.icon-btn {
  border: 0; background: transparent; color: inherit; cursor: pointer; padding: 8px; border-radius: 10px;
  display: grid; place-items: center; opacity: 0.8; transition: background 150ms, opacity 150ms;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); opacity: 1; }
.icon-btn svg { width: 18px; height: 18px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 28px 12px; position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}
.topbar .titles { min-width: 0; }
.topbar h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.topbar .subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.back-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 34px; height: 34px;
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 150ms var(--ease), background 150ms;
}
.back-btn:hover { background: var(--surface-2); transform: translateX(-2px); }
.back-btn svg { width: 18px; height: 18px; }

.chips { display: inline-flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.chip {
  border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px;
  color: var(--text-2); transition: background 160ms var(--ease), color 160ms var(--ease);
  white-space: nowrap;
}
.chip:hover { background: var(--bg-2); color: var(--text); }
.chip.is-active { background: var(--navy); color: #fff; box-shadow: 0 2px 8px rgba(26, 60, 106, 0.35); }
:root[data-theme="dark"] .chip.is-active { background: var(--sky); color: var(--navy-900); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform 150ms var(--ease), background 150ms;
}
.pill:hover { background: var(--surface-2); transform: translateY(-1px); }
.pill svg { width: 15px; height: 15px; opacity: 0.8; }
.pill .count { background: var(--yellow); color: var(--navy-900); border-radius: 999px; padding: 0 7px; font-size: 11.5px; font-weight: 800; }
.pill.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(21, 154, 90, 0.5); animation: livepulse 2s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(21, 154, 90, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(21, 154, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(21, 154, 90, 0); } }

.view { padding: 8px 28px 120px; animation: viewin 420ms var(--ease) both; }
@keyframes viewin { from { opacity: 0; transform: translateY(10px) scale(0.992); } to { opacity: 1; transform: none; } }
.view.from-jarvis { animation: viewzoom 620ms var(--ease) both; }
@keyframes viewzoom { 0% { opacity: 0; transform: scale(0.94); filter: blur(6px); } 60% { filter: blur(0); } 100% { opacity: 1; transform: none; } }

/* ───────────── Cards / Grid ───────────── */
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.hero { grid-template-columns: 1.6fr 1fr; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: 1.3fr 1fr 1fr; align-items: start; }
.grid.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.view > * + * { margin-top: 16px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); position: relative; min-width: 0;
  transition: box-shadow 220ms var(--ease), transform 220ms var(--ease), border-color 220ms;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--line-2); }
.card.clickable:hover .card-arrow { opacity: 1; transform: translate(0, 0); }
.card-arrow { position: absolute; top: 16px; right: 16px; opacity: 0; transform: translate(-4px, 4px); transition: all 200ms var(--ease); color: var(--muted); }
.card-arrow svg { width: 16px; height: 16px; }
.card h3 { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; text-transform: uppercase; }
.card h2 { margin: 0 0 14px; font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card h2 .hint { font-weight: 500; color: var(--muted); font-size: 12.5px; margin-left: auto; }
.card.navy { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-800) 100%); color: #fff; border: 0; display: flex; flex-direction: column; }
.card.navy .spark.wide { flex: 1; min-height: 72px; max-height: 230px; }
.card.navy .kpi-foot { margin-top: auto; padding-top: 10px; }
.card.navy h3 { color: rgba(255, 255, 255, 0.7); }
.card.navy .muted { color: rgba(255, 255, 255, 0.65); }
.card.navy .delta { background: rgba(255, 255, 255, 0.14); color: #fff; }
.card.navy .delta.up { color: #7ff0b6; }
.card.navy .delta.down { color: #ffb3c1; }
.card.highlight-jarvis { animation: jarvisglow 2.2s var(--ease); }
@keyframes jarvisglow { 0% { box-shadow: 0 0 0 0 rgba(245, 197, 24, 0.0); } 20% { box-shadow: 0 0 0 4px rgba(245, 197, 24, 0.55), var(--shadow-lg); } 100% { box-shadow: var(--shadow-sm); } }

.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin: 4px 0 6px; }
.kpi-value.hero { font-size: 44px; }
.kpi-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 6px; }
.spark { width: 120px; height: 44px; flex: none; }
.spark.wide { width: 100%; height: 72px; }
.spark-svg { display: block; width: 100%; height: 100%; }
.spark-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--bg-2); color: var(--text-2); white-space: nowrap; }
.delta.up { background: var(--green-bg); color: var(--green); }
.delta.down { background: var(--red-bg); color: var(--red); }
.delta.warn { background: var(--amber-bg); color: var(--amber); }
.delta svg { width: 12px; height: 12px; }

.stat { padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .value { font-size: 20px; font-weight: 800; margin-top: 4px; letter-spacing: -0.01em; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.stat .sub .delta { font-size: 11px; padding: 2px 7px; }

/* ───────────── Charts ───────────── */
.chart { position: relative; width: 100%; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { animation: fadein 900ms var(--ease) both; }
.chart-compare { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 2 4; opacity: 0.55; }
.chart-trend { stroke: var(--yellow-600); stroke-width: 2; stroke-dasharray: 7 6; opacity: 0.95; animation: fadein 1.2s var(--ease) both; }
:root[data-theme="dark"] .chart-trend { stroke: var(--yellow); }
.chart-trend-label { fill: var(--yellow-600); font-size: 11px; font-weight: 700; font-family: var(--font); }
:root[data-theme="dark"] .chart-trend-label { fill: var(--yellow); }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.chart-dot-halo { opacity: 0.2; animation: halo 2s infinite; }
@keyframes halo { 0%, 100% { r: 6; opacity: 0.25; } 50% { r: 10; opacity: 0.08; } }
.chart-cursor { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; transition: opacity 150ms; }
.chart-bar { fill: var(--chart-1); opacity: 0.9; animation: barin 600ms var(--ease) both; transition: fill 150ms; }
.chart-bar:hover { fill: var(--sky); }
.chart-bar.is-highlight { fill: var(--yellow); }
@keyframes barin { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.chart-tip {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; opacity: 0; transition: opacity 120ms;
  background: var(--navy-900); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 10px; white-space: nowrap; box-shadow: var(--shadow); z-index: 5;
  line-height: 1.35;
}
.chart-tip b { font-weight: 700; color: var(--yellow); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 18px; height: 3px; border-radius: 3px; background: var(--chart-1); }
.chart-legend i.trend { background: repeating-linear-gradient(90deg, var(--yellow-600) 0 5px, transparent 5px 9px); }
.chart-legend i.compare { background: repeating-linear-gradient(90deg, var(--muted) 0 2px, transparent 2px 5px); height: 2px; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-svg { display: block; flex: none; }
.donut-track { fill: none; stroke: var(--bg-2); stroke-width: 14; }
.donut-seg { fill: none; stroke-width: 14; transform: rotate(-90deg); transform-origin: 50% 50%; stroke-linecap: butt; animation: fadein 700ms var(--ease) both; }
.donut-value { font-size: 20px; font-weight: 800; fill: var(--text); font-family: var(--font); }
.donut-label { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.donut-legend { display: flex; flex-direction: column; gap: 6px; min-width: 160px; flex: 1; }
.donut-legend-row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; font-size: 13px; }
.donut-legend-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.donut-legend-row .val { font-weight: 700; }
.donut-legend-row .pct { color: var(--muted); font-size: 12px; min-width: 38px; text-align: right; }

.hbar-row { padding: 8px 0; border-bottom: 1px dashed var(--line); animation: viewin 400ms var(--ease) both; cursor: default; }
.hbar-row:last-child { border-bottom: 0; }
.hbar-row.is-highlight .hbar-fill { background: var(--yellow); }
.hbar-row.is-highlight .hbar-label { color: var(--navy); font-weight: 800; }
.hbar-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar-rank { width: 22px; height: 22px; border-radius: 7px; background: var(--bg-2); color: var(--text-2); font-size: 11.5px; font-weight: 800; display: grid; place-items: center; flex: none; }
.hbar-label { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.hbar-track { height: 7px; border-radius: 6px; background: var(--bg-2); margin-top: 7px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--navy), var(--sky)); transform-origin: left; animation: growx 700ms var(--ease) both; }
@keyframes growx { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hbar-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ───────────── Tables / Lists ───────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background 120ms; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-highlight { background: var(--amber-bg); }
.table .name { font-weight: 600; }
.table-wrap { overflow-x: auto; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--bg-2); color: var(--text-2); white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--green-bg); color: var(--green); }
.status.bad { background: var(--red-bg); color: var(--red); }
.status.active { background: var(--amber-bg); color: var(--amber); }
.status.info { background: rgba(90, 162, 255, 0.16); color: var(--blue); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; animation: viewin 400ms var(--ease) both; }
.list-item:last-child { border-bottom: 0; }
.list-item .ico { width: 38px; height: 38px; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center; flex: none; color: var(--navy); font-weight: 800; font-size: 13px; }
:root[data-theme="dark"] .list-item .ico { color: var(--sky); }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.list-item .title .ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .title .time { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.list-item .desc { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list-item.unread .title { color: var(--text); }
.list-item.unread .ico { background: var(--navy); color: #fff; }
.list-item .actions { display: flex; gap: 4px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--amber-bg); color: var(--amber); }

.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.empty b { color: var(--text); }
.notice { background: var(--amber-bg); color: var(--amber); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; }
.notice.info { background: rgba(90, 162, 255, 0.14); color: var(--blue); }
.notice code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

.btn {
  border: 0; border-radius: 11px; padding: 10px 16px; font-weight: 700; cursor: pointer; background: var(--navy); color: #fff;
  display: inline-flex; align-items: center; gap: 8px; transition: transform 150ms var(--ease), box-shadow 150ms, background 150ms;
  box-shadow: 0 4px 12px rgba(26, 60, 106, 0.25);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(26, 60, 106, 0.3); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.btn.yellow { background: var(--yellow); color: var(--navy-900); box-shadow: 0 4px 12px rgba(245, 197, 24, 0.35); }
.btn.danger { background: var(--red); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn svg { width: 16px; height: 16px; }
.input {
  width: 100%; border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 13px; font: inherit; background: var(--surface); color: var(--text);
  outline: none; transition: border-color 150ms, box-shadow 150ms;
}
.input:focus { border-color: var(--navy); box-shadow: 0 0 0 4px rgba(26, 60, 106, 0.12); }
.form-row { display: flex; gap: 10px; align-items: center; }

.skeleton { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 8px; color: transparent !important; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent); animation: shimmer 1.3s infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast {
  background: var(--navy-900); color: #fff; padding: 11px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; animation: toastin 380ms var(--ease) both;
}
.toast.jarvis { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-900) 100%); border: 1px solid rgba(245, 197, 24, 0.5); }
.toast .spark-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 12px var(--yellow); }
.toast.error { background: var(--red); }
@keyframes toastin { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }

/* ───────────── Jarvis ───────────── */
.jarvis-fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 50; border: 0; cursor: pointer;
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--navy-600), var(--navy-900));
  box-shadow: 0 12px 30px rgba(26, 60, 106, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  display: grid; place-items: center; color: #fff; transition: transform 200ms var(--ease), box-shadow 200ms;
}
.jarvis-fab:hover { transform: translateY(-2px) scale(1.04); }
.jarvis-fab .orb { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff 0%, var(--yellow) 40%, rgba(245, 197, 24, 0.2) 75%); box-shadow: 0 0 22px rgba(245, 197, 24, 0.7); transition: transform 300ms var(--ease); }
.jarvis-fab.is-active .orb { animation: orb 1.6s ease-in-out infinite; }
.jarvis-fab.is-speaking .orb { animation: orbtalk 0.5s ease-in-out infinite alternate; }
.jarvis-fab.is-thinking .orb { animation: orbthink 1s linear infinite; background: radial-gradient(circle at 35% 35%, #fff 0%, var(--sky) 45%, rgba(90, 162, 255, 0.15) 75%); box-shadow: 0 0 22px rgba(90, 162, 255, 0.7); }
.jarvis-fab.is-active::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(245, 197, 24, 0.6); animation: ring 1.8s ease-out infinite; }
@keyframes orb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes orbtalk { from { transform: scale(0.9); } to { transform: scale(1.3); } }
@keyframes orbthink { from { transform: rotate(0deg) scale(1); } 50% { transform: rotate(180deg) scale(1.15); } to { transform: rotate(360deg) scale(1); } }
@keyframes ring { 0% { transform: scale(0.9); opacity: 0.9; } 100% { transform: scale(1.5); opacity: 0; } }

.jarvis-panel {
  position: fixed; right: 26px; bottom: 104px; width: 380px; max-width: calc(100vw - 32px); max-height: min(70vh, 620px); z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; transform-origin: bottom right;
  animation: panelin 320ms var(--ease) both;
}
.jarvis-panel.hidden { display: none; }
@keyframes panelin { from { opacity: 0; transform: translateY(16px) scale(0.95); } to { opacity: 1; transform: none; } }
.jarvis-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-800) 100%); color: #fff; }
.jarvis-head .orb-sm { width: 14px; height: 14px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 12px var(--yellow); }
.jarvis-head .t { font-weight: 800; }
.jarvis-head .s { font-size: 12px; opacity: 0.75; }
.jarvis-head .state { margin-left: auto; font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); }
.jarvis-head .state.listening { background: rgba(21, 154, 90, 0.35); }
.jarvis-head .state.thinking { background: rgba(90, 162, 255, 0.35); }
.jarvis-head .state.speaking { background: rgba(245, 197, 24, 0.4); color: #fff; }
.jarvis-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.bubble { max-width: 88%; padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.4; animation: viewin 260ms var(--ease) both; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 5px; }
.bubble.jarvis { align-self: flex-start; background: var(--bg-2); color: var(--text); border-bottom-left-radius: 5px; }
.bubble.event { align-self: center; font-size: 11.5px; color: var(--muted); background: transparent; padding: 0; }
.jarvis-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.jarvis-foot .row { display: flex; gap: 8px; align-items: center; }
.jarvis-foot .input { padding: 9px 12px; border-radius: 12px; }
.jarvis-hint { font-size: 11.5px; color: var(--muted); text-align: center; }
.mic-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: var(--green); color: #fff; box-shadow: 0 6px 14px rgba(21, 154, 90, 0.35); transition: transform 150ms var(--ease); }
.mic-btn:hover { transform: scale(1.06); }
.mic-btn.hang { background: var(--red); box-shadow: 0 6px 14px rgba(220, 38, 80, 0.35); }
.mic-btn svg { width: 18px; height: 18px; }
.mic-btn:disabled { opacity: 0.5; cursor: default; }

/* ───────────── Responsive ───────────── */
@media (max-width: 1240px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .grid.hero, .grid.two, .grid.three { grid-template-columns: 1fr; }
  :root { --sidebar-w: 76px; }
  .sidebar { padding: 18px 10px; }
  .sidebar .logo { justify-content: center; padding-bottom: 16px; }
  .sidebar .logo img { height: 22px; }
  .sidebar .logo .sub, .nav-item span, .nav-section, .user-card .meta { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item.is-active::before { display: none; }
  .nav-item .badge { position: absolute; transform: translate(14px, -12px); }
  .user-card { justify-content: center; padding: 8px; }
  .topbar, .view { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 640px) {
  .app { flex-direction: column; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; width: 100%; flex: none; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); flex-direction: row; align-items: center; z-index: 40; }
  .sidebar .logo, .sidebar-bottom, .nav-section { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-between; gap: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { padding: 8px 9px; border-radius: 10px; width: auto; flex: none; }
  .nav-item .badge { transform: translate(10px, -10px); }
  #briefEventText { display: none; }
  .pill.live { display: none; }
  .main { padding-bottom: 70px; }
  .topbar { padding: 14px 14px 8px; gap: 10px; }
  .topbar h1 { font-size: 19px; }
  .chips { overflow-x: auto; max-width: 100%; }
  .view { padding: 4px 14px 150px; }
  .grid.kpis, .grid.stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 14px 15px; border-radius: 16px; }
  .kpi-value { font-size: 22px; }
  .kpi-value.hero { font-size: 34px; }
  .jarvis-fab { right: 16px; bottom: 84px; width: 58px; height: 58px; }
  .jarvis-panel { right: 8px; left: 8px; bottom: 150px; width: auto; max-height: 60vh; }
  .toast-wrap { bottom: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
