/* =========================================================
   FLUX — PC Flip OS
   Dark command-center UI
   ========================================================= */

:root {
  --bg: #08090c;
  --bg-soft: #0b0d12;
  --panel: #10131a;
  --panel-2: #151922;
  --panel-3: #1a1f29;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --text: #f3f5f8;
  --muted: #8d95a5;
  --dim: #5f6675;
  --accent: #c9f75b;
  --accent-soft: rgba(201, 247, 91, 0.12);
  --accent-ink: #101408;
  --cyan: #5eead4;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --red: #fb7185;
  --green: #86efac;
  --blue: #7dd3fc;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.75);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Bahnschrift", "Aptos Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 78% -12%, rgba(201, 247, 91, 0.055), transparent 62%),
    radial-gradient(900px 600px at 10% 100%, rgba(94, 234, 212, 0.035), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

body.no-scroll { overflow: hidden; }

::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }

svg { display: block; }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #2a303c transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262c37; border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #363e4c; }

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), transparent 22%),
    #0a0c11;
  border-right: 1px solid var(--line);
  z-index: 50;
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 240px;
  background: radial-gradient(240px 180px at 40% 0%, rgba(201, 247, 91, 0.08), transparent 70%);
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #dcff7c, #a8dc31);
  color: #121707;
  box-shadow: 0 8px 24px -8px rgba(201, 247, 91, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  flex: 0 0 auto;
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
}
.brand-sub {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.29em;
  color: var(--dim);
}

.sidebar .sidebar-close { display: none; margin-left: auto; }

.nav { position: relative; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }

.nav-label {
  padding: 16px 12px 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #565d6b;
}
.nav-label:first-child { padding-top: 4px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 41px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
  flex: 0 0 auto;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.nav-item:active { transform: scale(0.985); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(201, 247, 91, 0.13), rgba(201, 247, 91, 0.04));
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(201, 247, 91, 0.6);
}
.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  min-width: 21px;
  height: 19px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-badge { background: rgba(201, 247, 91, 0.16); color: var(--accent); }

.nav-dot {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 9px rgba(251, 191, 36, 0.8);
}

.sidebar-foot { position: relative; padding-top: 12px; }

.cash-mini {
  padding: 13px 14px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    radial-gradient(160px 80px at 100% 0%, rgba(201, 247, 91, 0.08), transparent 70%),
    #0e1117;
}
.cash-mini-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.cash-mini-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 247, 91, 0.12);
}
.cash-mini-link {
  border: 0; background: none; padding: 0;
  color: var(--dim); font-size: 10.5px; cursor: pointer;
}
.cash-mini-link:hover { color: var(--accent); }
.cash-mini-value {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}
.cash-mini-value.negative { color: var(--red); }
.cash-mini-meter { height: 4px; margin: 9px 0 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.cash-mini-meter span { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #9fd52f, var(--accent)); transition: width 700ms cubic-bezier(.2,.8,.2,1); }
.cash-mini-sub { font-size: 10.5px; color: var(--dim); }
.sidebar-note { margin-top: 10px; padding: 0 4px; font-size: 9.5px; color: #4b515e; text-align: center; }

/* ---------- Compte / synchronisation ---------- */
.account { position: relative; margin-bottom: 10px; }

.account-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.022);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}
.account-btn:hover { background: rgba(255, 255, 255, 0.045); border-color: var(--line-strong); }

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(145deg, #dcff7c, #a8dc31);
  color: #121707;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

.account-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.account-name, .account-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name { font-size: 11.5px; font-weight: 600; }
.account-mail { font-size: 9.5px; color: var(--dim); }

.account-sync-dot {
  flex: 0 0 auto;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--dim);
  transition: background 200ms ease, box-shadow 200ms ease;
}
.account-sync-dot[data-state="saved"] { background: var(--green); box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.11); }
.account-sync-dot[data-state="saving"], .account-sync-dot[data-state="pending"] { background: var(--amber); box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12); animation: syncPulse 1.2s ease-in-out infinite; }
.account-sync-dot[data-state="error"], .account-sync-dot[data-state="offline"] { background: var(--red); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.12); }
.account-sync-dot[data-state="conflict"] { background: var(--red); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.18); animation: syncPulse 1.2s ease-in-out infinite; }
.account-sync-dot[data-state="local"] { background: var(--dim); }

.account-chevron { width: 13px; height: 13px; fill: none; stroke: var(--dim); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 180ms ease; }
.account-btn[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }

.account-pop {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% + 8px);
  z-index: 70;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #12151d;
  box-shadow: 0 26px 60px -18px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: accountIn 160ms ease both;
}
@keyframes accountIn { from { opacity: 0; transform: translateY(5px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes syncPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.account-pop-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 9px 9px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.account-pop-label { font-size: 8.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.account-pop-head strong { font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pop-head > span:last-child { font-size: 9.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.account-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.account-item svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.account-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.account-item.danger:hover { background: rgba(251, 113, 133, 0.09); color: var(--red); }
.account-item.conflict { color: var(--red); }
.account-item.conflict:hover { background: rgba(251, 113, 133, 0.1); color: var(--red); }
.account-item-meta { margin-left: auto; font-size: 9px; color: var(--dim); }
.account-sep { height: 1px; margin: 4px 3px; background: var(--line); }

.sync-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 9px;
  font-size: 9.5px;
  color: #4f5664;
  text-align: center;
}
.sync-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--dim); transition: background 200ms ease; }
.sync-note[data-state="saved"] { color: #6f8a72; }
.sync-note[data-state="saved"] .sync-dot { background: var(--green); }
.sync-note[data-state="saving"], .sync-note[data-state="pending"] { color: #8a7a4d; }
.sync-note[data-state="saving"] .sync-dot, .sync-note[data-state="pending"] .sync-dot { background: var(--amber); animation: syncPulse 1.2s ease-in-out infinite; }
.sync-note[data-state="error"], .sync-note[data-state="offline"] { color: #8a5a63; }
.sync-note[data-state="error"] .sync-dot, .sync-note[data-state="offline"] .sync-dot { background: var(--red); }
.sync-note[data-state="conflict"] { color: #b07a84; }
.sync-note[data-state="conflict"] .sync-dot { background: var(--red); animation: syncPulse 1.2s ease-in-out infinite; }

.mobile-avatar { padding: 0; }
.mobile-avatar .avatar { width: 26px; height: 26px; font-size: 11px; }

/* ---------- Écran de démarrage ---------- */
.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background:
    radial-gradient(700px 460px at 50% 40%, rgba(201, 247, 91, 0.055), transparent 65%),
    var(--bg);
  transition: opacity 280ms ease, visibility 280ms ease;
}
.boot-screen.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 13px;
  background: linear-gradient(145deg, #dcff7c, #a8dc31);
  color: #121707;
  box-shadow: 0 14px 36px -12px rgba(201, 247, 91, 0.6);
}
.boot-mark svg { width: 25px; height: 25px; }
.boot-brand { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: 0.22em; }
.boot-text { font-size: 11px; color: var(--dim); }
.boot-bar { width: 116px; height: 3px; margin-top: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; border-radius: 3px; background: var(--accent); animation: bootSlide 1.1s ease-in-out infinite; }
@keyframes bootSlide { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }
.boot-link { margin-top: 8px; font-size: 11px; font-weight: 600; color: var(--accent); text-decoration: none; }
.boot-link:hover { text-decoration: underline; }


.sidebar-scrim {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(3, 4, 7, 0.68);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity 200ms ease;
}

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.view-wrap {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 34px 38px 90px;
  outline: none;
}

.mobile-bar { display: none; }

/* ---------- Bandeau de conflit de synchronisation ---------- */
.conflict-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 76px);
  max-width: 1404px;
  margin: 16px auto 0;
  padding: 11px 14px;
  border: 1px solid rgba(251, 113, 133, 0.34);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(251, 113, 133, 0.13), rgba(251, 113, 133, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.conflict-banner-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: rgba(251, 113, 133, 0.16);
  color: var(--red);
  font-weight: 800;
  font-size: 12px;
}
.conflict-banner-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.conflict-banner-text strong { font-size: 11.5px; font-weight: 600; }
.conflict-banner-text span { font-size: 10.5px; color: var(--muted); }

.conflict-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.06);
}
.conflict-inline > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conflict-inline strong { font-size: 11.5px; color: var(--red); }
.conflict-inline span { font-size: 10.5px; color: var(--muted); }

.conflict-lead { font-size: 12.5px; line-height: 1.65; color: var(--muted); }
.conflict-lead strong { color: var(--text); }
.conflict-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.conflict-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-2);
}
.conflict-card.cloud { border-color: rgba(94, 234, 212, 0.24); background: rgba(94, 234, 212, 0.045); }
.conflict-label { font-size: 8.5px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; color: var(--accent); }
.conflict-card.cloud .conflict-label { color: var(--cyan); }
.conflict-card strong { font-size: 12px; }
.conflict-card span:last-child { font-size: 10px; color: var(--dim); }

/* =========================================================
   Page header
   ========================================================= */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}
.eyebrow .sep { color: #343a45; }
.eyebrow .accent { color: var(--accent); }

.page-title {
  font-family: var(--display);
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.page-sub { margin-top: 7px; color: var(--muted); font-size: 13px; max-width: 620px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-left: auto; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: var(--panel-3); border-color: rgba(255, 255, 255, 0.2); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #d6ff70, #bdec45);
  color: var(--accent-ink);
  box-shadow: 0 5px 20px -8px rgba(201, 247, 91, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.btn-primary:hover { background: linear-gradient(180deg, #e2ff92, #c9f75b); border-color: transparent; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); border-color: transparent; }

.btn-danger { border-color: rgba(251, 113, 133, 0.28); background: rgba(251, 113, 133, 0.08); color: #ffb3bf; }
.btn-danger:hover { background: rgba(251, 113, 133, 0.15); border-color: rgba(251, 113, 133, 0.45); }

.btn-sm { height: 31px; padding: 0 10px; font-size: 11.5px; border-radius: 8px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  flex: 0 0 auto;
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); }
.icon-btn.accent:hover { background: #dcff7c; }

.row-actions { display: flex; align-items: center; gap: 1px; justify-content: flex-end; }
.row-actions .icon-btn { width: 29px; height: 29px; border-radius: 7px; }
.row-actions .icon-btn svg { width: 15px; height: 15px; }
.icon-btn.danger:hover { background: rgba(251, 113, 133, 0.12); color: var(--red); }

/* =========================================================
   Panels / cards
   ========================================================= */
.panel {
  position: relative;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 40%), var(--panel);
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.panel-title { font-size: 13.5px; font-weight: 650; letter-spacing: -0.01em; }
.panel-sub { margin-top: 3px; font-size: 11.5px; color: var(--dim); }
.panel-link {
  border: 0; background: none; padding: 0;
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.panel-link:hover { color: var(--accent); }
.panel-link svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 30px 0 14px;
}
.section-title {
  font-family: var(--display);
  font-size: 17px; font-weight: 600; letter-spacing: 0.005em;
}
.section-sub { margin-top: 2px; font-size: 11.5px; color: var(--dim); }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi {
  position: relative;
  padding: 16px 17px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(140px 90px at 100% 0%, rgba(255, 255, 255, 0.035), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 55%),
    var(--panel);
  overflow: hidden;
  transition: border-color 180ms ease, transform 180ms ease;
}
.kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kpi::after {
  content: "";
  position: absolute; inset: auto 16px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}
.kpi-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--muted);
}
.kpi-label svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.7; opacity: 0.7; }
.kpi-value {
  margin-top: 9px;
  font-family: var(--display);
  font-size: clamp(24px, 2.3vw, 31px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  display: flex; align-items: baseline; gap: 4px;
}
.kpi-value .unit { font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--dim); letter-spacing: 0; }
.kpi-value.accent { color: var(--accent); }
.kpi-value.negative { color: var(--red); }
.kpi-value.cyan { color: var(--cyan); }
.kpi-foot { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 10.5px; color: var(--dim); min-height: 19px; flex-wrap: wrap; }
.kpi-value-wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.spark { width: 76px; height: 30px; flex: 0 0 auto; opacity: 0.95; }

.delta {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10px; font-weight: 700;
  background: rgba(134, 239, 172, 0.1); color: var(--green);
}
.delta svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.delta.down { background: rgba(251, 113, 133, 0.1); color: var(--red); }
.delta.flat { background: rgba(255, 255, 255, 0.06); color: var(--muted); }

/* =========================================================
   Forms
   ========================================================= */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label,
.label {
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.field-hint { font-size: 10.5px; color: var(--dim); line-height: 1.4; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #0b0e14;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.textarea { height: auto; min-height: 74px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d95a5' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
  cursor: pointer;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(201, 247, 91, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 247, 91, 0.09);
  background: #0d1119;
}
.input::placeholder, .textarea::placeholder { color: #4f5663; }
.input:disabled, .select:disabled { opacity: 0.5; cursor: not-allowed; }
.input.invalid, .select.invalid { border-color: rgba(251, 113, 133, 0.7); }

.input-prefix, .input-suffix { position: relative; display: flex; align-items: center; }
.input-prefix .input { padding-left: 27px; }
.input-suffix .input { padding-right: 34px; }
.input-prefix > span, .input-suffix > span {
  position: absolute; color: var(--dim); font-size: 12px; pointer-events: none;
}
.input-prefix > span { left: 11px; }
.input-suffix > span { right: 11px; }
.input-suffix .input { font-variant-numeric: tabular-nums; }

.check {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--muted); cursor: pointer;
}
.check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b0e14;
}
.segmented button {
  height: 28px;
  padding: 0 10px;
  border: 0; border-radius: 6px;
  background: transparent;
  color: var(--dim);
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }

.filter-bar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-wrap { position: relative; width: 260px; max-width: 100%; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; fill: none; stroke: var(--dim); stroke-width: 1.8;
}
.search-wrap .input { padding-left: 33px; height: 36px; }
.filter-spacer { flex: 1; }

/* =========================================================
   Tables
   ========================================================= */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  overflow: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  position: sticky; top: 0; z-index: 2;
  padding: 10px 13px;
  background: #0d1016;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  text-align: left; white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--muted); }
.table th .sort-ind { margin-left: 4px; color: var(--accent); }
.table td {
  padding: 11px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 120ms ease; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.024); }
.table tbody tr.clickable { cursor: pointer; }
.table .strong { font-weight: 600; color: var(--text); }
.table .muted { color: var(--muted); }
.table .dim { color: var(--dim); }
.amber-text { color: var(--amber); }
.dim { color: var(--dim); }
.kv-row b.amber-text { color: var(--amber); }
.kv-row b.dim { color: var(--dim); }
.table .nowrap { white-space: nowrap; }
.table .pos { color: var(--green); font-weight: 600; }
.table .neg { color: var(--red); font-weight: 600; }
.table .accent { color: var(--accent); font-weight: 600; }
.table-empty { padding: 36px 20px; text-align: center; color: var(--dim); font-size: 12.5px; }

.cell-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cell-icon {
  width: 28px; height: 28px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}
.cell-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.cell-stack { min-width: 0; }
.cell-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.cell-sub { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }

.cat-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 10px; font-weight: 650; letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.green { background: rgba(134, 239, 172, 0.1); color: var(--green); }
.pill.amber { background: rgba(251, 191, 36, 0.1); color: var(--amber); }
.pill.cyan { background: rgba(94, 234, 212, 0.1); color: var(--cyan); }
.pill.violet { background: rgba(167, 139, 250, 0.12); color: #c4b5fd; }
.pill.red { background: rgba(251, 113, 133, 0.1); color: var(--red); }
.pill.blue { background: rgba(125, 211, 252, 0.1); color: var(--blue); }
.pill.dim { background: rgba(255, 255, 255, 0.045); color: var(--dim); }

.tag {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 9.5px; font-weight: 600;
}

/* Progress */
.progress { height: 7px; border-radius: 7px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress > span {
  display: block; height: 100%; width: 0;
  border-radius: 7px;
  background: linear-gradient(90deg, #9fd52f, var(--accent));
  box-shadow: 0 0 12px rgba(201, 247, 91, 0.35);
  transition: width 700ms cubic-bezier(.2,.8,.2,1);
}
.progress.cyan > span { background: linear-gradient(90deg, #2dd4bf, var(--cyan)); box-shadow: 0 0 12px rgba(94, 234, 212, 0.3); }
.progress.amber > span { background: linear-gradient(90deg, #f59e0b, var(--amber)); box-shadow: none; }

/* =========================================================
   Dashboard
   ========================================================= */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.dash-grid.equal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 10px; fill: var(--dim); }
.chart .grid-line { stroke: rgba(255, 255, 255, 0.055); stroke-width: 1; }
.chart .axis-line { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .bar { transition: opacity 140ms ease; }
.chart .hover-band { fill: rgba(255, 255, 255, 0.035); opacity: 0; transition: opacity 120ms ease; }
.chart .focus-line { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .focus-dot { opacity: 0; }

.chart-tooltip {
  position: absolute;
  z-index: 10;
  min-width: 110px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(16, 19, 26, 0.97);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8);
  font-size: 10.5px;
  color: var(--muted);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity 100ms ease;
  white-space: nowrap;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip .tt-title { font-size: 10px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chart-tooltip .tt-row b { color: var(--text); font-weight: 600; margin-left: auto; padding-left: 10px; }
.chart-tooltip .tt-dot { width: 6px; height: 6px; border-radius: 2px; }

.legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; }

.chart-empty {
  display: grid; place-items: center; gap: 6px;
  min-height: 200px; text-align: center;
  color: var(--dim); font-size: 12px;
}
.chart-empty strong { color: var(--muted); font-weight: 600; font-size: 12.5px; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-box { position: relative; width: 148px; height: 148px; flex: 0 0 auto; }
.donut-box svg { width: 100%; height: 100%; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; pointer-events: none;
}
.donut-center .dc-value { font-family: var(--display); font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.donut-center .dc-label { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.donut-legend-row { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.donut-legend-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend-row .val { margin-left: auto; color: var(--text); font-weight: 600; font-size: 10.5px; }
.donut-legend-row .pct { width: 31px; text-align: right; color: var(--dim); font-size: 9.5px; }

/* Bar list */
.barlist { display: flex; flex-direction: column; gap: 12px; }
.barlist-row { display: grid; grid-template-columns: 118px 1fr 78px; align-items: center; gap: 10px; }
.barlist-label { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barlist-track { display: block; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.barlist-fill { display: block; height: 100%; border-radius: 6px; transition: width 700ms cubic-bezier(.2,.8,.2,1); }
.barlist-value { text-align: right; font-size: 11px; font-weight: 600; color: var(--text); }
.barlist-value small { display: block; font-size: 9px; font-weight: 500; color: var(--dim); }

/* Alerts */
.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  transition: border-color 150ms ease, background 150ms ease;
}
.alert-item:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.03); }
.alert-icon {
  width: 26px; height: 26px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 7px;
  background: rgba(251, 191, 36, 0.1); color: var(--amber);
}
.alert-icon.red { background: rgba(251, 113, 133, 0.1); color: var(--red); }
.alert-icon.cyan { background: rgba(94, 234, 212, 0.1); color: var(--cyan); }
.alert-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.alert-body { min-width: 0; flex: 1; }
.alert-title { font-size: 11.5px; font-weight: 600; line-height: 1.35; }
.alert-sub { margin-top: 1px; font-size: 10px; color: var(--dim); }
.alert-action {
  border: 0; background: none; padding: 2px;
  color: var(--dim); cursor: pointer; flex: 0 0 auto;
}
.alert-action:hover { color: var(--text); }
.alert-action svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Goal */
.goal-card { display: flex; flex-direction: column; gap: 13px; }
.goal-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.goal-value { font-family: var(--display); font-size: 27px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
.goal-value small { font-family: var(--font); font-size: 12px; color: var(--dim); font-weight: 500; }
.goal-pct { font-size: 12px; font-weight: 700; color: var(--accent); }
.goal-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: var(--dim); }

/* Build overview mini cards */
.build-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.build-card {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 170ms ease, transform 170ms ease, background 170ms ease;
}
.build-card:hover { border-color: var(--line-strong); transform: translateY(-2px); background: var(--panel-2); }
.build-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.build-card-title { font-size: 13.5px; font-weight: 650; line-height: 1.3; }
.build-card-sub { margin-top: 3px; font-size: 10.5px; color: var(--dim); }
.build-card-parts { display: flex; flex-wrap: wrap; gap: 4px; }
.part-chip {
  padding: 2px 6px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted); font-size: 9.5px; font-weight: 500;
  white-space: nowrap;
}
.build-card-money { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 11px; border-top: 1px solid var(--line); }
.build-card-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.build-card-value { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -0.015em; margin-top: 1px; }
.build-card-value.pos { color: var(--green); }
.build-card-value.neg { color: var(--red); }

/* =========================================================
   Calculator
   ========================================================= */
.calc-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 14px; align-items: start; }
.calc-rows { display: flex; flex-direction: column; gap: 8px; }
.calc-row { display: grid; grid-template-columns: 1fr 110px 30px; gap: 8px; align-items: center; }
.calc-row .input { height: 35px; }
.calc-row .icon-btn { width: 30px; height: 30px; }
.calc-row-head { display: grid; grid-template-columns: 1fr 110px 30px; gap: 8px; font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); padding: 0 2px; }
.calc-row-head span:last-child { text-align: right; }

.result-hero {
  position: relative;
  padding: 24px;
  border: 1px solid rgba(201, 247, 91, 0.22);
  border-radius: var(--radius);
  background:
    radial-gradient(320px 200px at 90% -10%, rgba(201, 247, 91, 0.16), transparent 65%),
    linear-gradient(160deg, #151b0f, #0f1310 55%);
  overflow: hidden;
}
.result-hero::before {
  content: "";
  position: absolute; inset: auto -30px -60px auto;
  width: 180px; height: 180px;
  border-radius: 50%;
  border: 1px solid rgba(201, 247, 91, 0.1);
  box-shadow: 0 0 0 30px rgba(201, 247, 91, 0.025), 0 0 0 60px rgba(201, 247, 91, 0.015);
}
.result-label { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(201, 247, 91, 0.65); }
.result-big { position: relative; font-family: var(--display); font-size: clamp(36px, 4.5vw, 50px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; margin-top: 5px; color: var(--accent); }
.result-big.neg { color: var(--red); }
.result-sub { position: relative; margin-top: 5px; font-size: 11.5px; color: rgba(255, 255, 255, 0.5); }
.result-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 20px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.result-cell { padding: 11px 12px; background: rgba(10, 12, 8, 0.55); }
.result-cell .rc-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.09em; color: rgba(255, 255, 255, 0.35); }
.result-cell .rc-value { margin-top: 3px; font-size: 16px; font-weight: 600; font-family: var(--display); letter-spacing: -0.01em; }
.result-cell .rc-value.pos { color: var(--green); }
.result-cell .rc-value.neg { color: var(--red); }

/* =========================================================
   Modal / Drawer
   ========================================================= */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2, 3, 5, 0.68);
  backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  animation: fadeIn 160ms ease;
}
.overlay.drawer-overlay { justify-content: flex-end; padding: 0; }

.modal {
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 44px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #0e1118;
  box-shadow: var(--shadow);
  animation: modalIn 200ms cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.modal.wide { max-width: 880px; }
.modal.slim { max-width: 460px; }

.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 19px 22px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal-title { font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.modal-sub { margin-top: 3px; font-size: 11.5px; color: var(--dim); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #0b0e14;
  flex: 0 0 auto;
}
.modal-foot .left { margin-right: auto; }

.drawer {
  width: min(560px, 100%);
  height: 100%;
  border-left: 1px solid var(--line-strong);
  background: #0c0f15;
  box-shadow: -30px 0 80px -30px rgba(0, 0, 0, 0.9);
  display: flex; flex-direction: column;
  animation: drawerIn 230ms cubic-bezier(.2,.8,.2,1);
}
.drawer-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.drawer-body { padding: 20px 22px 30px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: #0b0e14; display: flex; gap: 9px; flex-wrap: wrap; }

/* Component picker */
.picker { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #0b0e14; }
.picker-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #0d1017; }
.picker-title { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.picker-count { font-size: 10.5px; color: var(--dim); }
.picker-list { max-height: 250px; overflow-y: auto; padding: 4px; }
.picker-group-label {
  padding: 8px 9px 4px; display: flex; align-items: center; gap: 6px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim);
}
.picker-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 7px; cursor: pointer;
  transition: background 120ms ease;
}
.picker-item:hover { background: rgba(255, 255, 255, 0.04); }
.picker-item.selected { background: rgba(201, 247, 91, 0.07); }
.picker-item input { width: 14px; height: 14px; accent-color: var(--accent); flex: 0 0 auto; cursor: pointer; }
.picker-item .pi-name { font-size: 11.5px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-item .pi-price { font-size: 11px; color: var(--muted); font-weight: 600; flex: 0 0 auto; }
.picker-item .pi-date { font-size: 9px; color: var(--dim); flex: 0 0 auto; width: 46px; text-align: right; }
.picker-empty { padding: 22px; text-align: center; color: var(--dim); font-size: 11.5px; }

/* Build form layout */
.build-form-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr); gap: 18px; }
.build-summary {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0e14;
  padding: 14px;
  align-self: start;
  position: sticky; top: 0;
}
.summary-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--dim); margin-bottom: 12px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 11.5px; color: var(--muted); }
.summary-row b { color: var(--text); font-weight: 600; }
.summary-row.total { margin-top: 6px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 12.5px; }
.summary-row.total b { font-family: var(--display); font-size: 17px; }
.summary-divider { height: 1px; background: var(--line); margin: 10px 0; }
.summary-profit { margin-top: 10px; padding: 11px; border-radius: 9px; background: rgba(201, 247, 91, 0.06); border: 1px solid rgba(201, 247, 91, 0.13); }
.summary-profit .sp-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(201, 247, 91, 0.6); }
.summary-profit .sp-value { font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; color: var(--accent); }
.summary-profit .sp-meta { display: flex; gap: 12px; margin-top: 4px; font-size: 10px; color: var(--dim); }

.extra-row { display: grid; grid-template-columns: 1fr 96px 28px; gap: 7px; align-items: center; margin-bottom: 7px; }
.extra-row .input { height: 33px; font-size: 12px; }
.extra-row .icon-btn { width: 28px; height: 28px; }

/* Detail drawer */
.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-name { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.detail-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 18px 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--line); }
.detail-stat { padding: 12px; background: #0b0e14; }
.detail-stat .ds-label { font-size: 9px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--dim); }
.detail-stat .ds-value { margin-top: 3px; font-family: var(--display); font-size: 19px; font-weight: 600; letter-spacing: -0.015em; }
.detail-stat .ds-value.pos { color: var(--green); }
.detail-stat .ds-value.accent { color: var(--accent); }
.detail-stat .ds-value.neg { color: var(--red); }
.detail-block { margin-top: 20px; }
.detail-block-title { display: flex; align-items: center; justify-content: space-between; font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.detail-line { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); font-size: 11.5px; }
.detail-line:last-child { border-bottom: 0; }
.detail-line .name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-line .price { color: var(--muted); font-weight: 600; }
.detail-total { display: flex; justify-content: space-between; padding-top: 9px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 12px; }
.detail-timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { position: relative; display: flex; gap: 11px; padding-bottom: 14px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 4px; top: 12px; bottom: 0; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line-strong); margin-top: 3px; flex: 0 0 auto; }
.tl-dot.done { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(201, 247, 91, 0.45); }
.tl-body { font-size: 11px; color: var(--muted); }
.tl-body b { color: var(--text); font-weight: 600; display: block; font-size: 11.5px; }
.tl-date { color: var(--dim); font-size: 10px; }

/* =========================================================
   Toasts / misc
   ========================================================= */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #121620;
  box-shadow: var(--shadow);
  font-size: 12px; font-weight: 500;
  animation: toastIn 220ms cubic-bezier(.2,.8,.2,1);
  max-width: 380px;
}
.toast.out { animation: toastOut 180ms ease forwards; }
.toast .t-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; box-shadow: 0 0 8px rgba(201, 247, 91, 0.5); }
.toast.error .t-dot { background: var(--red); box-shadow: 0 0 8px rgba(251, 113, 133, 0.5); }
.toast.info .t-dot { background: var(--cyan); box-shadow: 0 0 8px rgba(94, 234, 212, 0.5); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 46px 20px; text-align: center;
}
.empty-icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 255, 255, 0.025); color: var(--dim);
  margin-bottom: 4px;
}
.empty-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.empty-title { font-size: 13.5px; font-weight: 600; }
.empty-text { font-size: 11.5px; color: var(--dim); max-width: 320px; }
.empty .btn { margin-top: 10px; }

.toolbar-note { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--dim); }
.toolbar-note svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-zone { border-color: rgba(251, 113, 133, 0.18); }
.danger-zone .panel-title { color: #ffb3bf; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 20px;
  padding: 0 5px;
  margin-right: 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  vertical-align: middle;
}

.kv-table { display: flex; flex-direction: column; gap: 0; }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.kv-row:last-child { border-bottom: 0; }
.kv-row b { color: var(--text); font-weight: 600; }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.016); }
.mini-stat .ms-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.mini-stat .ms-value { margin-top: 2px; font-family: var(--display); font-size: 16px; font-weight: 600; }

/* =========================================================
   Animations
   ========================================================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0.5; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }

.reveal { animation: rise 380ms cubic-bezier(.2,.8,.2,1) both; }
.reveal-1 { animation-delay: 30ms; }
.reveal-2 { animation-delay: 60ms; }
.reveal-3 { animation-delay: 90ms; }
.reveal-4 { animation-delay: 120ms; }

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

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-wrap { padding: 30px 28px 80px; }
  .conflict-banner { width: calc(100% - 56px); }
}

@media (max-width: 1060px) {
  .dash-grid, .dash-grid.equal, .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .build-form-grid { grid-template-columns: minmax(0, 1fr); }
  .build-summary { position: static; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 220ms cubic-bezier(.2,.8,.2,1); box-shadow: 30px 0 80px rgba(0,0,0,.6); }
  .sidebar.open { transform: none; }
  .sidebar .sidebar-close { display: inline-grid; }
  .sidebar-scrim.open { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .mobile-bar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px;
    background: rgba(8, 9, 12, 0.82);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .mobile-brand { display: flex; flex-direction: column; align-items: center; gap: 1px; }
  .view-wrap { padding: 22px 18px 80px; }
  .conflict-banner { width: calc(100% - 36px); margin-top: 12px; }
  .page-head { margin-bottom: 20px; }
}

@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-box { margin: 0 auto; }
  .modal { max-height: calc(100vh - 20px); border-radius: 14px; }
  .overlay { padding: 10px; }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .conflict-compare { grid-template-columns: 1fr; }
  .conflict-banner { flex-wrap: wrap; }
  .conflict-banner .btn { width: 100%; }
  .conflict-inline { flex-direction: column; align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .filter-bar .search-wrap { width: 100%; }
  .filter-bar .filter-spacer { display: none; }
  .barlist-row { grid-template-columns: 80px 1fr 64px; }
  .page-title { font-size: 26px; }
  .toast-stack { left: 12px; right: 12px; align-items: stretch; }
  .toast { max-width: none; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .calc-row { grid-template-columns: 1fr 92px 28px; }
  .calc-row-head { grid-template-columns: 1fr 92px 28px; }
  .detail-name { font-size: 19px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .build-mini-grid { grid-template-columns: 1fr; }
  .view-wrap { padding: 18px 14px 70px; }
  .result-big { font-size: 38px; }
}
