/* ==========================================================================
   HomeBiz Zim - base.css
   Design tokens, reset, shell, sidebar and top bar
   Load order: 1 of 7
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f5f3f7;
  --sidebar: rgba(255, 255, 255, 0.76);
  --surface: #ffffff;
  --surface-2: #faf9fc;
  --surface-3: #f1eef5;
  --field: #ffffff;
  --text: #1b1620;
  --text-2: #4b4456;
  --muted: #6f687c;
  --line: #e9e4ee;
  --line-strong: #d8d1e0;
  --brand: #d6246e;
  --brand-2: #f0629b;
  --brand-soft: #fdeaf2;
  --brand-text: #b11458;
  --green: #0c8f64;
  --green-soft: #e1f7ef;
  --red: #d8354a;
  --red-soft: #fdebee;
  --amber: #b26a06;
  --amber-soft: #fdf2df;
  --blue: #3465cf;
  --blue-soft: #e9effc;
  --violet: #7747d4;
  --violet-soft: #f1eafd;
  --teal: #0d8a8a;
  --teal-soft: #e2f6f6;
  --shadow-sm: 0 1px 2px rgba(27, 18, 38, 0.05);
  --shadow-md: 0 14px 32px -18px rgba(27, 18, 38, 0.28), 0 2px 6px rgba(27, 18, 38, 0.04);
  --shadow-lg: 0 40px 70px -28px rgba(20, 12, 30, 0.4);
  --r-lg: 20px;
  --r-md: 13px;
  --r-sm: 9px;
  --focus: 0 0 0 3px rgba(214, 36, 110, 0.2);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0c13;
  --sidebar: rgba(21, 18, 28, 0.78);
  --surface: #17141f;
  --surface-2: #1c1825;
  --surface-3: #241f2e;
  --field: #1a1623;
  --text: #f5f2f8;
  --text-2: #cec7d8;
  --muted: #9b93a8;
  --line: #2c2637;
  --line-strong: #3b3449;
  --brand: #f2569a;
  --brand-2: #ff86ba;
  --brand-soft: rgba(242, 86, 154, 0.15);
  --brand-text: #ffa7cc;
  --green: #37d3a0;
  --green-soft: rgba(55, 211, 160, 0.13);
  --red: #ff7185;
  --red-soft: rgba(255, 113, 133, 0.14);
  --amber: #edb45a;
  --amber-soft: rgba(237, 180, 90, 0.14);
  --blue: #86a7ff;
  --blue-soft: rgba(134, 167, 255, 0.14);
  --violet: #b795ff;
  --violet-soft: rgba(183, 149, 255, 0.14);
  --teal: #4fd1cd;
  --teal-soft: rgba(79, 209, 205, 0.13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 18px 40px -20px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 44px 80px -30px rgba(0, 0, 0, 0.9);
  --focus: 0 0 0 3px rgba(242, 86, 154, 0.28);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.008em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 4% -10%, rgba(214, 36, 110, 0.1), transparent 62%),
    radial-gradient(760px 460px at 102% -6%, rgba(52, 101, 207, 0.09), transparent 62%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(900px 520px at 4% -10%, rgba(242, 86, 154, 0.13), transparent 62%),
    radial-gradient(760px 460px at 102% -6%, rgba(134, 167, 255, 0.09), transparent 62%);
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-soft); color: var(--brand-text); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 258px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 24px 16px 18px;
  overflow-y: auto;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(140deg, #f472b6, var(--brand) 58%, #9d174d);
  box-shadow: 0 12px 24px -12px rgba(214, 36, 110, 0.75);
}
.brand-mark .icon { width: 21px; height: 21px; stroke-width: 2; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.brand-copy strong span { color: var(--brand); }
.brand-copy small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.nav-item .icon { color: var(--muted); transition: color 0.16s; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item.is-active { background: var(--brand-soft); color: var(--brand-text); border-color: rgba(214, 36, 110, 0.16); }
.nav-item.is-active .icon { color: var(--brand); }
.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.6;
}
.side-tip {
  margin-top: auto;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-2);
}
.side-tip-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.side-tip-title .icon { width: 13px; height: 13px; color: var(--brand); }
.side-tip-text { font-size: 11.5px; line-height: 1.6; color: var(--muted); }
kbd {
  display: inline-block;
  min-width: 17px;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}
.side-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 10.5px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); flex: none; }
.shell { display: flex; flex-direction: column; min-width: 0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(16px);
}
.page-heading { min-width: 0; }
.eyebrow {
  margin-bottom: 2px;
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.page-heading h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.028em; line-height: 1.2; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
main { width: 100%; max-width: 1380px; margin: 0 auto; padding: 24px 32px 64px; }
.view { display: none; }
.view.is-active { display: block; animation: fadeUp 0.3s ease; }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(9px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes grow { from { height: 0; } }
