/* ==========================================================================
   Life OS — Design system
   1. Tokens  2. Base  3. Shell  4. Components  5. Charts  6. Overlays
   7. Utilities  8. Responsive  9. Motion / print
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bg: #f1f2ee;
  --surface: #ffffff;
  --surface-2: #f6f7f3;
  --surface-3: #eceee8;
  --surface-hover: #f3f4f0;
  --border: #e6e8e1;
  --border-2: #d8dbd2;
  --text: #121411;
  --text-2: #5a5e56;
  --text-3: #8b8f86;

  --accent: #d4f55b;
  --accent-2: #b9e025;
  --accent-soft: #f1fad3;
  --accent-ink: #172003;
  --accent-text: #4d6a00; /* accent used as text on light surfaces */

  --ink: #121411;
  --ink-2: #262923;
  --ink-text: #ffffff;
  --ink-text-2: #a7ab9f;

  --good: #1d9a57;
  --good-soft: #e1f4e8;
  --warn: #b97800;
  --warn-soft: #fcf0d6;
  --bad: #d9443e;
  --bad-soft: #fce5e3;
  --info: #2a78d6;
  --info-soft: #e2edfb;
  --sky-soft: #dde9f6;

  /* categorical palette (fixed order, validated) */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
  --c5: #e87ba4; --c6: #008300; --c7: #4a3aa7; --c8: #e34948;
  --c0: #a3a79d; /* "Other" */

  --chart-bar: #1b1d19;
  --chart-hl: #c6ee3a;
  --chart-zero: #e6e8e1;
  --chart-grid: #eceee8;
  --ring-track: #eef0ea;
  --heat-none: #f4f5f1;
  --heat-0: #e9ebe5;
  --heat-1: #e3f4a8;
  --heat-2: #c7ea57;
  --heat-3: #93bf1a;
  --heat-4: #587a06;

  --shadow-xs: 0 1px 2px rgba(18, 20, 17, 0.04);
  --shadow-sm: 0 1px 2px rgba(18, 20, 17, 0.05), 0 2px 8px -2px rgba(18, 20, 17, 0.06);
  --shadow: 0 1px 2px rgba(18, 20, 17, 0.04), 0 8px 24px -8px rgba(18, 20, 17, 0.1);
  --shadow-lg: 0 32px 72px -20px rgba(18, 20, 17, 0.28), 0 4px 12px rgba(18, 20, 17, 0.06);
  --focus: 0 0 0 3px rgba(185, 224, 37, 0.35);

  --r-xs: 8px; --r-sm: 12px; --r: 16px; --r-lg: 22px; --r-xl: 28px; --r-pill: 999px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sidebar: 252px;
  --sidebar-c: 80px;
  --topbar: 76px;
  --gap: 16px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b0c0a;
  --surface: #141613;
  --surface-2: #1a1c18;
  --surface-3: #22251f;
  --surface-hover: #1c1e1a;
  --border: #23261f;
  --border-2: #31352c;
  --text: #f1f3ec;
  --text-2: #a8ada0;
  --text-3: #71766a;

  --accent: #d4f55b;
  --accent-2: #c2ea36;
  --accent-soft: #242d0c;
  --accent-ink: #141a02;
  --accent-text: #d4f55b;

  --ink: #f1f3ec;
  --ink-2: #dfe2d8;
  --ink-text: #0b0c0a;
  --ink-text-2: #5f6358;

  --good: #3fc47d;
  --good-soft: #13291c;
  --warn: #e3a52a;
  --warn-soft: #2d2410;
  --bad: #f06a64;
  --bad-soft: #321614;
  --info: #5a9ef0;
  --info-soft: #132338;
  --sky-soft: #15212e;

  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --c5: #d55181; --c6: #1f9a1f; --c7: #9085e9; --c8: #e66767;
  --c0: #6b7065;

  --chart-bar: #4a4e44;
  --chart-hl: #d4f55b;
  --chart-zero: #262922;
  --chart-grid: #22251f;
  --ring-track: #242720;
  --heat-none: #121411;
  --heat-0: #1e211b;
  --heat-1: #33410f;
  --heat-2: #56711a;
  --heat-3: #8fb726;
  --heat-4: #d4f55b;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 32px 72px -16px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --focus: 0 0 0 3px rgba(212, 245, 91, 0.25);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'cv11';
  text-rendering: optimizeLegibility;
}
body.has-modal { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg.i { flex-shrink: 0; display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }
.tnum, .num { font-variant-numeric: tabular-nums; }
kbd {
  font-family: var(--mono); font-size: 11px; line-height: 1;
  padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-2); box-shadow: 0 1px 0 var(--border-2);
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. Shell ---------- */
.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column; padding: 18px 14px 14px;
  background: var(--bg);
  transition: width 0.28s var(--ease), transform 0.3s var(--ease);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; height: 58px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: var(--ink); color: var(--accent);
  display: grid; place-items: center;
}
.brand-name { font-weight: 650; font-size: 17px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-name span { color: var(--text-3); font-weight: 450; }
.nav { flex: 1; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); padding: 16px 12px 8px; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 6px;
  border-radius: 14px; color: var(--text-2); font-weight: 500; white-space: nowrap;
  transition: background 0.15s, color 0.15s; position: relative;
}
.nav-item .nav-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; transition: background 0.2s, color 0.2s; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.nav-item.active .nav-ic { background: var(--accent); color: var(--accent-ink); }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  font-size: 11px; font-weight: 600; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
}
.nav-badge.alert { background: var(--bad); color: #fff; }
.nav-item.active .nav-badge { background: var(--ink); color: var(--ink-text); }
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 14px; }
.me:hover { background: var(--surface-hover); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #9bd14b); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 650; font-size: 13px;
}
.me-text { min-width: 0; line-height: 1.25; }
.me-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.collapse-btn { justify-content: flex-start; }

/* collapsed rail */
.app.collapsed .sidebar { width: var(--sidebar-c); }
.app.collapsed .brand-name, .app.collapsed .nav-text, .app.collapsed .nav-badge:not(.alert),
.app.collapsed .me-text, .app.collapsed .nav-label { display: none; }
.app.collapsed .nav-label + * { margin-top: 0; }
.app.collapsed .nav-group + .nav-group { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.app.collapsed .nav-item { justify-content: center; padding: 0; }
.app.collapsed .nav-badge.alert { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
.app.collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app.collapsed .me { justify-content: center; }
.app.collapsed .collapse-btn svg { transform: scaleX(-1); }

.main { margin-left: var(--sidebar); min-width: 0; transition: margin 0.28s var(--ease); }
.app.collapsed .main { margin-left: var(--sidebar-c); }

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar);
  display: flex; align-items: center; gap: 10px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.topbar.scrolled { box-shadow: 0 1px 0 var(--border); }
.topbar .mobile-only { display: none; }
.searchbar {
  display: flex; align-items: center; gap: 10px; height: 44px; width: min(420px, 100%);
  padding: 0 8px 0 16px; border-radius: var(--r-pill); background: var(--surface);
  border: 1px solid var(--border); color: var(--text-3); box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.searchbar:hover { border-color: var(--border-2); }
.searchbar span { flex: 1; text-align: left; }
.searchbar kbd { box-shadow: none; }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.bell-dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }

.page { max-width: 1480px; margin: 0 auto; padding: 4px 32px 56px; }
.page.enter { animation: page-in 0.38s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin: 6px 0 22px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; color: var(--text-3); margin-bottom: 4px; font-weight: 500; }
.page-title { font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -0.035em; }
.page-sub { color: var(--text-2); margin-top: 6px; font-size: 14.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.scrim { position: fixed; inset: 0; background: rgba(10, 12, 8, 0.4); z-index: 39; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.bottom-nav { display: none; }

/* ---------- 4. Components ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; } .span-9 { grid-column: span 9; } .span-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.section-gap { margin-top: var(--gap); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 22px; box-shadow: var(--shadow-xs); min-width: 0; position: relative;
}
.card.flush { padding: 0; overflow: hidden; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.ink { background: #121411; color: #f1f3ec; border-color: #121411; }
:root[data-theme='dark'] .card.ink { background: #1c1f18; border-color: #2a2e25; }
.card.ink .muted, .card.ink .card-sub { color: #9ea396; }
.card.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-2); }
.card.accent .muted, .card.accent .card-sub { color: rgba(23, 32, 3, 0.62); }
.card.sky { background: var(--sky-soft); border-color: transparent; }
.card.interactive { transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s; cursor: pointer; }
.card.interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head-text { display: flex; align-items: center; gap: 10px; min-width: 0; }
.card-icon { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; flex-shrink: 0; }
.card.ink .card-icon { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.08); }
.card-title { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.card-sub { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  font-weight: 550; font-size: 14px; white-space: nowrap; letter-spacing: -0.005em;
  transition: background 0.15s, color 0.15s, transform 0.12s var(--ease), box-shadow 0.15s, border-color 0.15s;
  border: 1px solid transparent; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--ink); color: var(--ink-text); }
.btn.primary:hover { background: var(--ink-2); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-2); }
.btn.accent:hover { background: var(--accent-2); }
.btn.soft { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-xs); }
.btn.soft:hover { border-color: var(--border-2); background: var(--surface-hover); }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(0.94); }
.btn.danger-text { color: var(--bad); }
.btn.danger-text:hover { background: var(--bad-soft); color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn .arrow-chip { width: 26px; height: 26px; border-radius: 50%; background: var(--ink-text); color: var(--ink); display: grid; place-items: center; margin-right: -10px; }
.card.ink .btn.soft { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.1); color: #fff; }
.card.ink .btn.soft:hover { background: rgba(255, 255, 255, 0.14); }
.btn-icon {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2); position: relative;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
}
.btn-icon:hover { color: var(--text); border-color: var(--border-2); }
.btn-icon:active { transform: scale(0.94); }
.btn-icon.ghost { background: transparent; border-color: transparent; }
.btn-icon.ghost:hover { background: var(--surface-3); }
.btn-icon.sm { width: 30px; height: 30px; }
.btn-icon.xs { width: 26px; height: 26px; }
.btn-icon.ink { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.btn-icon.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-2); }
.card.ink .btn-icon { background: rgba(255, 255, 255, 0.08); border-color: transparent; color: #fff; }
.card.ink .btn-icon.accent { background: var(--accent); color: var(--accent-ink); }

/* Inputs */
.input {
  width: 100%; height: 42px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--border); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; font-size: 14px;
}
.input:hover { border-color: var(--border-2); }
.input:focus { border-color: var(--accent-2); box-shadow: var(--focus); background: var(--surface); }
textarea.input { height: auto; padding: 11px 14px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: var(--text-3); }
.input[type='date'], .input[type='time'], .input[type='datetime-local'] { font-variant-numeric: tabular-nums; }
.select-wrap { position: relative; }
.select-wrap select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-3); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-prefix, .input-suffix { position: absolute; color: var(--text-3); font-size: 13.5px; pointer-events: none; }
.input-prefix { left: 14px; }
.input-suffix { right: 14px; }
.has-prefix .input { padding-left: 32px; }
.has-suffix .input { padding-right: 46px; }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-input .input { padding-left: 38px; height: 40px; border-radius: var(--r-pill); background: var(--surface); }
.select-sm { height: 40px; border-radius: var(--r-pill); background: var(--surface); padding-left: 14px; font-size: 13.5px; }
.range { width: 100%; accent-color: var(--text); }
.range-row { display: flex; align-items: center; gap: 14px; height: 42px; }
.range-out { min-width: 48px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Form */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 14px; }
.field { min-width: 0; }
.field.w-full { grid-column: span 6; } .field.w-half { grid-column: span 3; }
.field.w-third { grid-column: span 2; } .field.w-twothird { grid-column: span 4; }
.label { display: block; font-size: 12.5px; font-weight: 550; color: var(--text-2); margin-bottom: 7px; }
.label .muted { font-weight: 400; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.field-err { font-size: 12px; color: var(--bad); margin-top: 6px; display: none; }
.field.invalid .field-err { display: block; }
.field.invalid .input { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.form-section { grid-column: span 6; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; }

.toggle-row { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 42px; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch-ui { position: absolute; inset: 0; border-radius: 12px; background: var(--border-2); transition: background 0.2s; pointer-events: none; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.25s var(--spring); }
.switch input:checked + .switch-ui { background: var(--text); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: var(--accent); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--focus); }

.swatches, .icon-pick, .days-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--sw); position: relative; transition: transform 0.15s var(--spring); }
.swatch:hover { transform: scale(1.1); }
.swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.icon-opt { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); transition: all 0.15s; }
.icon-opt:hover { color: var(--text); border-color: var(--border-2); }
.icon-opt.active { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.day-opt { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all 0.15s; }
.day-opt.active { background: var(--accent); border-color: var(--accent-2); color: var(--accent-ink); }

.list-edit { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--border); }
.list-item .list-title { flex: 1; background: none; border: 0; outline: none; height: 30px; font-size: 14px; min-width: 0; }
.list-item.done .list-title { text-decoration: line-through; color: var(--text-3); }
.list-add { display: flex; align-items: center; gap: 10px; padding: 4px 12px; color: var(--text-3); }
.list-add input { flex: 1; background: none; border: 0; outline: none; height: 36px; font-size: 14px; }
.mini-check { width: 18px; height: 18px; border-radius: 6px; border: 1.75px solid var(--border-2); display: grid; place-items: center; color: transparent; flex-shrink: 0; transition: all 0.15s; }
.mini-check.on { background: var(--accent); border-color: var(--accent-2); color: var(--accent-ink); }

/* Segmented / tabs */
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-3); flex-shrink: 0; }
.seg-btn { height: 32px; padding: 0 14px; border-radius: var(--r-pill); font-size: 13px; font-weight: 550; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; transition: all 0.18s var(--ease); white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
:root[data-theme='dark'] .seg-btn.active { background: var(--border-2); }
.seg-field { display: flex; width: 100%; }
.seg-field .seg-btn { flex: 1; justify-content: center; height: 34px; }
.seg.sm .seg-btn { height: 28px; padding: 0 11px; font-size: 12.5px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.tab {
  height: 38px; padding: 0 16px; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 550; font-size: 13.5px;
  transition: all 0.18s var(--ease);
}
.tab:hover { color: var(--text); border-color: var(--border-2); }
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent-2); }
.tab-count { font-size: 11.5px; padding: 1px 7px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); }
.tab.active .tab-count { background: rgba(23, 32, 3, 0.1); color: var(--accent-ink); }

/* Chips & badges */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.chip.sm { height: 20px; padding: 0 7px; font-size: 11px; }
.chip.accent { background: var(--accent); color: var(--accent-ink); }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.ink { background: var(--ink); color: var(--ink-text); }
.chip.outline { background: transparent; border: 1px solid var(--border-2); }
.card.ink .chip { background: rgba(255, 255, 255, 0.1); color: #e6e9df; }
.card.ink .chip.accent { background: var(--accent); color: var(--accent-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.delta { display: inline-flex; align-items: center; gap: 2px; height: 22px; padding: 0 7px 0 5px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.good { background: var(--accent); color: var(--accent-ink); }
.delta.bad { background: var(--bad-soft); color: var(--bad); }
.delta.flat { background: var(--surface-3); color: var(--text-3); padding: 0 8px; }

/* KPI */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
  transition: border-color 0.15s, transform 0.2s var(--ease), box-shadow 0.2s;
  box-shadow: var(--shadow-xs);
}
a.kpi:hover { border-color: var(--border-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-icon { width: 28px; height: 28px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text); flex-shrink: 0; }
.kpi-value { font-size: 30px; line-height: 1.05; font-weight: 550; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--text-3); letter-spacing: -0.01em; margin-left: 3px; }
.kpi-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.accent { background: var(--accent); border-color: var(--accent-2); color: var(--accent-ink); }
.kpi.accent .kpi-label, .kpi.accent .kpi-sub, .kpi.accent .kpi-value small { color: rgba(23, 32, 3, 0.66); }
.kpi.accent .kpi-icon { background: rgba(255, 255, 255, 0.4); border-color: transparent; color: var(--accent-ink); }
.kpi.ink { background: #121411; border-color: #121411; color: #f1f3ec; }
:root[data-theme='dark'] .kpi.ink { background: #1c1f18; border-color: #2a2e25; }
.kpi.ink .kpi-label, .kpi.ink .kpi-sub, .kpi.ink .kpi-value small { color: #9ea396; }
.kpi.ink .kpi-icon { background: rgba(255, 255, 255, 0.08); border-color: transparent; color: var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }

/* Big number */
.big { font-size: 56px; line-height: 1; font-weight: 500; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.big small { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; color: var(--text-3); margin-left: 4px; }
.card.ink .big small, .card.accent .big small { color: inherit; opacity: 0.6; }
.mid { font-size: 28px; line-height: 1.1; font-weight: 550; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.mid small { font-size: 13px; color: var(--text-3); font-weight: 500; margin-left: 2px; letter-spacing: 0; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.warn-text { color: var(--warn); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Progress */
.pbar { height: 8px; border-radius: var(--r-pill); background: var(--ring-track); overflow: hidden; width: 100%; }
.pbar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; animation: grow-x 0.8s var(--ease) both; }
.pbar.over > span { background: var(--bad); }
.pbar.thin { height: 5px; }
.pbar.thick { height: 12px; }
.card.ink .pbar { background: rgba(255, 255, 255, 0.1); }
@keyframes grow-x { from { transform: scaleX(0); } }
.ring { position: relative; flex-shrink: 0; }
.ring svg { display: block; }
.ring-val { animation: ring-in 1s var(--ease) both; }
@keyframes ring-in { from { stroke-dashoffset: var(--c); } }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.1; }
.ring-label strong { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.card.ink .ring-label span { color: #9ea396; }
.card.ink { --ring-track: rgba(255, 255, 255, 0.1); }

/* Check (completion) */
.check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-2); flex-shrink: 0;
  display: grid; place-items: center; color: transparent; background: var(--surface);
  transition: border-color 0.15s, background 0.2s, transform 0.2s var(--spring);
}
.check:hover { border-color: var(--text-3); }
.check svg { transform: scale(0.4); opacity: 0; transition: transform 0.25s var(--spring), opacity 0.15s; }
.check.on { background: var(--accent); border-color: var(--accent-2); color: var(--accent-ink); }
.check.on svg { transform: scale(1); opacity: 1; }
.check.pop { animation: pop 0.45s var(--spring); }
.check.lg { width: 30px; height: 30px; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }
.check.p-urgent { border-color: var(--bad); background: var(--bad-soft); }
.check.p-high { border-color: var(--c2); }
.check.p-medium { border-color: var(--c1); }
.check.on.p-urgent, .check.on.p-high, .check.on.p-medium { background: var(--accent); border-color: var(--accent-2); }
.card.ink .check { background: transparent; border-color: rgba(255, 255, 255, 0.25); }
.card.ink .check.on { background: var(--accent); border-color: var(--accent); }
.burst { position: absolute; pointer-events: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); animation: burst 0.6s var(--ease) forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } }

/* Lists */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border);
  min-width: 0; transition: background 0.15s;
}
.list-row:last-child { border-bottom: 0; }
.list-row.hoverable { padding-left: 10px; padding-right: 10px; margin: 0 -10px; border-radius: 14px; border-bottom-color: transparent; cursor: pointer; }
.list-row.hoverable:hover { background: var(--surface-hover); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-end { text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.list-row:hover .row-actions, .tr:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.ic-chip { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.ic-chip.sm { width: 32px; height: 32px; border-radius: 10px; }
.ic-chip.tint { background: color-mix(in srgb, var(--tint) 14%, var(--surface)); border-color: color-mix(in srgb, var(--tint) 22%, var(--surface)); color: var(--tint); }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 550; color: var(--text-3); padding: 0 12px 10px; white-space: nowrap; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: var(--surface-hover); }
.table td:first-child, .table th:first-child { padding-left: 4px; }
.table td:last-child, .table th:last-child { padding-right: 4px; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

/* Empty / skeleton */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px; gap: 8px; }
.empty.compact { padding: 22px 12px; }
.empty-art { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 6px; position: relative; }
.empty.compact .empty-art { width: 44px; height: 44px; border-radius: 14px; }
.empty-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.empty-text { color: var(--text-3); font-size: 13px; max-width: 300px; margin-bottom: 8px; }
.card.ink .empty-art { background: rgba(212, 245, 91, 0.12); color: var(--accent); }
.skel { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-title { height: 36px; width: 280px; margin: 8px 0 10px; }
.skel-sub { height: 16px; width: 200px; margin-bottom: 28px; }
.skel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.skel-grid.two { grid-template-columns: 2fr 1fr; }
.skel-card { height: 118px; border-radius: 22px; }
.skel-block { height: 320px; border-radius: 28px; }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-item b { font-weight: 600; color: var(--text); margin-left: 2px; font-variant-numeric: tabular-nums; }

/* ---------- 5. Charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; overflow: visible; }
.ch-grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.ch-ytick, .ch-xtick { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.ch-xtick.hl { fill: var(--text); font-weight: 600; }
.ch-bar { transition: opacity 0.2s, filter 0.2s; transform-box: fill-box; transform-origin: bottom; animation: bar-in 0.7s var(--ease) both; }
@keyframes bar-in { from { transform: scaleY(0); } }
.chart svg:hover .ch-band:not(:hover) .ch-bar { opacity: 0.35; }
.ch-hit { fill: transparent; cursor: crosshair; }
.ch-pill rect { fill: var(--ink); }
.ch-pill text { fill: var(--ink-text); font-size: 11px; font-weight: 600; font-family: var(--font); font-variant-numeric: tabular-nums; }
.ch-line { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.ch-dot, .ch-hdot { stroke: var(--surface); stroke-width: 2.5; }
.ch-hover .ch-guide { stroke: var(--border-2); stroke-width: 1; opacity: 0; }
.ch-hover .ch-hdot { opacity: 0; }
.ch-hover:hover .ch-guide, .ch-hover:hover .ch-hdot { opacity: 1; }
.ch-target { stroke: var(--text-3); stroke-width: 1.25; stroke-dasharray: 4 4; }
.ch-target-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-weight: 500; }
.ch-seg { transition: stroke-width 0.2s var(--ease), opacity 0.2s; cursor: crosshair; }
.chart svg:hover .ch-seg:not(:hover) { opacity: 0.45; }
.donut-wrap { position: relative; margin: 0 auto; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.15; pointer-events: none; }
.donut-center strong { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 12px; color: var(--text-3); }
.chart-heat { overflow-x: auto; }
.hm { transition: opacity 0.15s; }
.hm-none { fill: var(--heat-none); }
.hm-0 { fill: var(--heat-0); } .hm-1 { fill: var(--heat-1); } .hm-2 { fill: var(--heat-2); }
.hm-3 { fill: var(--heat-3); } .hm-4 { fill: var(--heat-4); }
.hm-today { stroke: var(--text); stroke-width: 1.5; }
.hm[data-date] { cursor: pointer; }
.hm:hover { opacity: 0.75; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.spark { width: 100%; height: 100%; display: block; overflow: visible; }
.tt-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; white-space: nowrap; }
.tt-row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tt-row b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
.tt-row .muted { color: var(--ink-text-2); }

/* ---------- 6. Overlays ---------- */
.tooltip {
  position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none;
  background: var(--ink); color: var(--ink-text); font-size: 12px; line-height: 1.4;
  padding: 8px 11px; border-radius: 11px; box-shadow: var(--shadow-lg); max-width: 260px;
  opacity: 0; transition: opacity 0.12s; will-change: transform;
}
.tooltip.show { opacity: 1; }
.tooltip b { font-weight: 600; }

.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 900; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 420px;
  padding: 10px 10px 10px 12px; border-radius: 18px; background: #121411; color: #f1f3ec;
  box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in 0.35s var(--spring) both;
}
:root[data-theme='dark'] .toast { background: #23261f; border: 1px solid #31352c; }
.toast.leaving { animation: toast-out 0.2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.97); } }
.toast-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex-shrink: 0; }
.toast-error .toast-icon { background: #f06a64; color: #fff; }
.toast-info .toast-icon, .toast-reminder .toast-icon { background: #3987e5; color: #fff; }
.toast-msg { flex: 1; min-width: 0; }
.toast-msg b { font-weight: 600; }
.toast-action { color: var(--accent); font-weight: 600; padding: 6px 10px; border-radius: 10px; font-size: 13px; }
.toast-action:hover { background: rgba(255, 255, 255, 0.08); }
.toast-close { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #8d9286; }
.toast-close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.modal-back {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(12, 14, 10, 0); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0);
  transition: background 0.22s var(--ease), backdrop-filter 0.22s;
}
.modal-back.open { background: rgba(12, 14, 10, 0.38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal {
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 100%;
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  opacity: 0; transform: translateY(10px) scale(0.97); transition: opacity 0.22s var(--ease), transform 0.28s var(--spring);
  border: 1px solid var(--border);
}
.modal-back.open .modal { opacity: 1; transform: none; }
.modal-back.closing .modal { opacity: 0; transform: translateY(6px) scale(0.98); transition-duration: 0.16s; }
.modal-sm { max-width: 420px; } .modal-md { max-width: 580px; } .modal-lg { max-width: 820px; } .modal-xl { max-width: 1040px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 6px; }
.modal-title { font-size: 20px; font-weight: 600; letter-spacing: -0.025em; }
.modal-sub { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.modal-x { margin: -6px -8px 0 0; }
.modal-body { padding: 16px 24px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 24px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.modal.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.confirm .modal-body { text-align: center; padding-top: 28px; }
.confirm .modal-foot { border-top: 0; justify-content: center; padding-top: 4px; }
.confirm .modal-foot .btn { flex: 1; }
.confirm-icon { width: 52px; height: 52px; border-radius: 18px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--text); }
.confirm-icon.danger { background: var(--bad-soft); color: var(--bad); }
.confirm-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.confirm-text { color: var(--text-2); margin-top: 6px; font-size: 13.5px; }

.menu {
  position: fixed; z-index: 800; min-width: 200px; padding: 6px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-4px) scale(0.98); transform-origin: top right; transition: opacity 0.14s, transform 0.18s var(--ease);
}
.menu.open { opacity: 1; transform: none; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 10px; font-size: 13.5px; color: var(--text); text-align: left; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--bad); }
.menu-item.danger:hover { background: var(--bad-soft); }
.menu-item svg { color: var(--text-3); }
.menu-item.danger svg { color: var(--bad); }
.menu-item kbd, .menu-check { margin-left: auto; }
.menu-check { color: var(--text); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 8px 10px 4px; }

/* Command palette */
.palette-back { align-items: flex-start; padding-top: 12vh; }
.palette { max-width: 640px; overflow: hidden; }
.palette .modal-body { padding: 0; }
.pal-input { display: flex; align-items: center; gap: 12px; padding: 0 20px; height: 62px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.pal-input input { flex: 1; border: 0; outline: none; background: none; font-size: 17px; height: 100%; color: var(--text); letter-spacing: -0.01em; }
.pal-input input::placeholder { color: var(--text-3); }
.pal-list { max-height: min(440px, 56vh); overflow-y: auto; padding: 8px; }
.pal-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); padding: 12px 12px 6px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; cursor: pointer; min-width: 0; }
.pal-item.active { background: var(--surface-3); }
.pal-item .ic-chip { width: 32px; height: 32px; border-radius: 10px; }
.pal-item.active .ic-chip { background: var(--accent); border-color: var(--accent-2); color: var(--accent-ink); }
.pal-title { font-weight: 550; }
.pal-sub { font-size: 12px; color: var(--text-3); }
.pal-hint { margin-left: auto; font-size: 12px; color: var(--text-3); display: flex; gap: 4px; flex-shrink: 0; }
.pal-foot { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); }
.pal-foot span { display: inline-flex; align-items: center; gap: 6px; }
.pal-empty { padding: 36px; text-align: center; color: var(--text-3); }

.shortcut-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; }
.shortcut { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.shortcut span:last-child { display: flex; gap: 4px; }

/* ---------- 7. Utilities ---------- */
.hide { display: none !important; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.gap-6 { gap: 6px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link { color: var(--text); font-weight: 550; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link.muted { color: var(--text-3); }

/* ---------- 8. Responsive ---------- */
@media (max-width: 1280px) {
  .span-3 { grid-column: span 6; }
  .span-4, .span-5 { grid-column: span 6; }
  .span-7, .span-8 { grid-column: span 12; }
  .span-7 + .span-5, .span-8 + .span-4 { grid-column: span 12; }
  .span-4.keep, .span-3.keep { grid-column: span 4; }
}
@media (max-width: 1024px) {
  .app .sidebar { width: var(--sidebar-c); }
  .app .main { margin-left: var(--sidebar-c); }
  .app .brand-name, .app .nav-text, .app .nav-badge:not(.alert), .app .me-text, .app .nav-label { display: none; }
  .app .nav-group + .nav-group { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
  .app .nav-item { justify-content: center; padding: 0; }
  .app .nav-badge.alert { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
  .app .brand, .app .me { justify-content: center; padding-left: 0; padding-right: 0; }
  .collapse-btn { display: none !important; }
  .topbar { padding: 0 24px; }
  .page { padding: 4px 24px 48px; }
  .span-6 { grid-column: span 12; }
  .span-4.keep, .span-3.keep { grid-column: span 6; }
}
@media (max-width: 760px) {
  :root { --gap: 12px; --topbar: 62px; }
  body { font-size: 14.5px; }
  .app .sidebar { width: 280px; transform: translateX(-100%); box-shadow: var(--shadow-lg); background: var(--surface); }
  .app.drawer-open .sidebar { transform: none; }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .app .brand-name, .app .nav-text, .app .nav-badge:not(.alert), .app .me-text, .app .nav-label { display: initial; }
  .app .nav-label { display: block; }
  .app .nav-group + .nav-group { border-top: 0; margin-top: 0; padding-top: 0; }
  .app .nav-item { justify-content: flex-start; padding: 0 6px; }
  .app .nav-badge.alert { position: static; }
  .app .brand, .app .me { justify-content: flex-start; padding-left: 8px; }
  .app .main { margin-left: 0; }
  .topbar { padding: 0 16px; gap: 8px; }
  .topbar .mobile-only { display: inline-grid; }
  .topbar .desktop-only { display: none !important; }
  .mobile-title { font-weight: 650; font-size: 17px; letter-spacing: -0.02em; display: flex !important; align-items: center; gap: 8px; }
  .page { padding: 0 16px calc(104px + env(safe-area-inset-bottom)); }
  .page-head { margin: 4px 0 16px; align-items: flex-start; }
  .page-title { font-size: 27px; }
  .page-actions { width: 100%; }
  .page-actions > .btn.primary:last-child { margin-left: auto; }
  .grid > [class*='span-'] { grid-column: span 12; }
  .grid > .span-3.keep, .grid > .span-4.keep, .grid > .span-6.keep { grid-column: span 6; }
  .card { padding: 18px; border-radius: 24px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 14px; border-radius: 20px; }
  .kpi-value { font-size: 24px; }
  .big { font-size: 46px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; }
  .row-actions { opacity: 1; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { max-width: none !important; border-radius: 26px 26px 0 0; max-height: 92vh; transform: translateY(100%); transition: transform 0.34s var(--ease), opacity 0.2s; padding-bottom: env(safe-area-inset-bottom); }
  .modal-back.open .modal { transform: none; }
  .modal-back.closing .modal { transform: translateY(100%); opacity: 1; }
  .modal::before { content: ''; width: 40px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 8px auto 0; flex-shrink: 0; }
  .palette-back { padding-top: 0; align-items: flex-end; }
  .form-grid { gap: 14px 12px; }
  .field.w-third { grid-column: span 3; }
  .field.w-twothird { grid-column: span 6; }
  .toasts { left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
  .shortcut-list { grid-template-columns: 1fr; }
  .skel-grid { grid-template-columns: 1fr 1fr; }
  .skel-grid.two { grid-template-columns: 1fr; }

  .bottom-nav {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 35;
    height: 64px; padding: 6px; border-radius: 24px; background: #121411; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.45);
    justify-content: space-around; align-items: center;
  }
  :root[data-theme='dark'] .bottom-nav { background: #1c1f18; border: 1px solid #2a2e25; }
  .bn-item { flex: 1; height: 52px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #8d9286; font-size: 10.5px; font-weight: 550; transition: color 0.15s, background 0.2s; }
  .bn-item.active { color: var(--accent-ink); background: var(--accent); }
  .bn-item:active { transform: scale(0.95); }
}
@media (hover: none) {
  .row-actions { opacity: 1; }
}

/* ---------- 9. Motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .toasts, .page-actions, .tabs, .no-print { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
