@font-face {
  font-family: Inter;
  src: url("/static/fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/static/fonts/Inter-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("/static/fonts/Inter-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f6f5f4;
  --bg-elev: #ffffff;
  --bg-sunken: #efeeec;
  --ink: #1a1a1a;
  --muted: #6b6762;
  --faint: #8d8882;
  --line: #e6e4e1;
  --line-strong: #d5d2cd;
  --accent: #5b4dff;
  --accent-ink: #ffffff;
  --accent-soft: #eeedfe;
  --good: #0f7a4a;
  --good-soft: #e7f6ee;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
  --bad: #b42318;
  --bad-soft: #feeceb;
  --shadow: 0 1px 2px rgba(22, 18, 14, 0.04), 0 8px 24px rgba(22, 18, 14, 0.06);
  --shadow-lg: 0 12px 40px rgba(22, 18, 14, 0.12);
  --radius: 12px;
  --sidebar: 248px;
  --top: 56px;
  --font: Inter, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101012;
  --bg-elev: #18181b;
  --bg-sunken: #111113;
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: #2a2a2e;
  --line-strong: #3f3f46;
  --accent: #8b83ff;
  --accent-ink: #14121f;
  --accent-soft: #2a2748;
  --good: #4ade80;
  --good-soft: #13281c;
  --warn: #f5c451;
  --warn-soft: #2c2412;
  --bad: #fb7185;
  --bad-soft: #3a1519;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.app-shell.is-collapsed { grid-template-columns: 72px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px;
  gap: 8px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; padding: 4px 8px 12px; font-weight: 600;
}
.mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 14px; flex: none;
}
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-links a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--muted);
}
.nav-links a[aria-current="page"], .nav-links a:hover { background: var(--bg-sunken); color: var(--ink); }
.is-collapsed .nav-label, .is-collapsed .brand span { display: none; }
.side-foot { margin-top: auto; }
.workspace {
  min-width: 0; display: flex; flex-direction: column;
}
.topbar {
  height: var(--top); display: flex; align-items: center; gap: 8px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(10px);
}
.icon-btn, .kbd-btn {
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--ink);
  border-radius: 10px; height: 36px; min-width: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.kbd-btn { color: var(--muted); flex: 1; max-width: 420px; justify-content: space-between; }
.kbd { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.content { padding: 24px 28px 64px; }
h1 { font-size: 32px; letter-spacing: -0.03em; margin: 0 0 8px; font-weight: 600; }
h2 { font-size: 18px; margin: 0 0 8px; font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 16px; margin: 0 0 8px; font-weight: 600; }
.muted, .lede { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 24px; }

.card, .panel, .pin-card, .empty, .banner, .login-card {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel, .card { padding: 16px; margin-bottom: 16px; }
.grid-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi strong { display: block; font-size: 28px; letter-spacing: -0.03em; }
.kpi span { color: var(--muted); font-size: 13px; }

.today-hero { display: grid; grid-template-columns: 220px 1fr; gap: 16px; margin-bottom: 24px; }
.ring-card, .next-card { padding: 20px; display: flex; gap: 16px; align-items: center; }
.ring { width: 84px; height: 84px; }
.pin-group { margin-bottom: 28px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.chip { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.pin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pin {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.pin.is-active { border-color: var(--accent); }
.pin img { width: 100%; aspect-ratio: 2/3; object-fit: cover; background: var(--bg-sunken); display: block; }
.pin-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; }
.slot { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
button, .button {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: 8px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button.secondary, .button.secondary, button.ghost {
  background: var(--bg-elev); color: var(--ink); border: 1px solid var(--line);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.copied { border-color: var(--good); color: var(--good); }

.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.site-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.site-card:hover { border-color: var(--line-strong); }
.initial {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: white; font-weight: 600;
}
.meta-row { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.spark { width: 100%; height: 36px; }

.masonry { columns: 4 220px; gap: 16px; }
.masonry article { break-inside: avoid; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(480px, 100%); background: var(--bg-elev);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 24px; z-index: 40;
  transform: translateX(100%); transition: transform 180ms ease;
}
.drawer.is-open { transform: translateX(0); }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }

.palette, .toast, .command {
  position: fixed; z-index: 50;
}
.command {
  inset: 12vh 0 auto; margin: 0 auto; width: min(560px, calc(100% - 32px));
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.command input { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 14px 16px; background: transparent; }
.command a, .command button.row { display: flex; width: 100%; text-align: left; background: transparent; color: var(--ink); border: 0; border-radius: 0; padding: 10px 16px; }
.command a:hover, .command button.row:hover { background: var(--bg-sunken); }
.toast {
  right: 16px; bottom: 16px; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr;
}
.login-art {
  background:
    radial-gradient(800px 400px at 20% 20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent),
    var(--bg-sunken);
  padding: 48px; display: flex; flex-direction: column; justify-content: flex-end;
}
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(400px, 100%); padding: 28px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select, textarea {
  width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); 
}
.form { display: flex; flex-direction: column; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps span { font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); }
.steps span.is-on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.preview-pin {
  width: 180px; aspect-ratio: 2/3; border-radius: 16px; padding: 16px; color: white;
  display: flex; flex-direction: column; justify-content: flex-end; box-shadow: var(--shadow-lg);
}
.drop {
  border: 1px dashed var(--line-strong); border-radius: 12px; padding: 20px; text-align: center; color: var(--muted);
}
.drop.is-hot { border-color: var(--accent); background: var(--accent-soft); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.bar { flex: 1; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 4px; opacity: 0.9; }
.flash, .banner, .empty { padding: 12px 14px; margin-bottom: 12px; }
.flash[data-cat="error"] { background: var(--bad-soft); color: var(--bad); }
.flash[data-cat="ok"] { background: var(--good-soft); color: var(--good); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--bg-sunken); }
.skeleton { background: linear-gradient(90deg, var(--bg-sunken), var(--bg-elev), var(--bg-sunken)); background-size: 200% 100%; animation: shine 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes shine { to { background-position: -200% 0; } }
@media (max-width: 1100px) {
  .grid-kpis, .today-hero, .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .app-shell { grid-template-columns: 72px 1fr; }
  .nav-label, .brand span { display: none; }
}
