/* sabahkk — shared chrome for built-in apps · flat design system */
:root,
:root[data-theme="dark"] {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1b1b1f;
  --inset: #0e0e10;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --muted: #a1a1aa;
  --accent: #4f46e5;
  --accent-ink: #818cf8;
  --accent-text: #ffffff;
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --track: #26262b;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --inset: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --muted: #71717a;
  --accent: #4f46e5;
  --accent-ink: #4338ca;
  --accent-text: #ffffff;
  --good: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --track: #e4e4e7;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.5;
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 16px 60px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- app bar ---------- */
.appbar {
  width: min(980px, 100%);
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text); text-decoration: none; font-size: .88rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  padding: 9px 15px; border-radius: 10px;
  transition: background .15s, border-color .15s;
}
.back:hover { background: var(--surface-2); border-color: var(--border-strong); }
.appbar .title { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.appbar .title .em {
  font-size: 1.2rem; background: var(--surface); border: 1px solid var(--border);
  padding: 6px 9px; border-radius: 10px; line-height: 1;
}
.appbar .spacer { flex: 1; }
.hint { color: var(--muted); font-size: .8rem; }

.theme-btn {
  width: 38px; height: 38px; padding: 0;
  display: inline-grid; place-items: center;
  font-size: 1rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.theme-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* ---------- panels & controls ---------- */
.panel {
  width: min(980px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
}
.panel + .panel { margin-top: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 140px; }

input[type="text"], input[type="search"], input[type="number"], input[type="date"], textarea, select {
  background: var(--inset);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: .94rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea { resize: vertical; min-height: 70px; width: 100%; }
select option { background: var(--surface); color: var(--text); }
input[type="range"] { accent-color: var(--accent); }
input[type="color"] { border: 1px solid var(--border); border-radius: 9px; height: 42px; width: 52px; background: var(--inset); padding: 3px; cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer; }

button, .btn {
  font-family: inherit; font-size: .9rem; font-weight: 600;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 17px; cursor: pointer;
  transition: background .15s, border-color .15s;
  text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: var(--border); border-color: var(--border-strong); }
button:active { background: var(--surface-2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
}
button.primary:hover { background: #4338ca; border-color: #4338ca; }
:root[data-theme="dark"] button.primary:hover { background: #6366f1; border-color: #6366f1; }
button.danger { background: var(--surface-2); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); color: var(--bad); }
button.danger:hover { background: color-mix(in srgb, var(--bad) 12%, var(--surface-2)); }
button.ghost { background: transparent; }
button.small { padding: 6px 12px; font-size: .8rem; border-radius: 8px; }
button.sel {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
}

/* ---------- chips / badges ---------- */
.chip {
  font-size: .74rem; font-weight: 600; color: var(--muted);
  background: var(--inset); border: 1px solid var(--border);
  padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}
.chip.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, var(--border)); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.chip.bad  { color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }

/* ---------- empty state ---------- */
.empty { text-align: center; color: var(--muted); padding: 34px 12px; font-size: .92rem; }
.empty .big { font-size: 2rem; display: block; margin-bottom: 8px; }

/* ---------- lists ---------- */
.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 14px; margin-top: 10px;
  transition: border-color .15s;
  animation: pop .2s ease both;
}
/* ---------- tabs (multi-tool apps) ---------- */
.tabbar {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border); margin-bottom: 18px;
}
.tab {
  background: transparent; border: none;
  border-bottom: 2px solid transparent; border-radius: 0;
  padding: 9px 15px; font-size: .88rem; color: var(--muted);
}
.tab:hover { background: transparent; border-color: transparent; color: var(--text); }
.tab.on {
  color: var(--text); border-bottom-color: var(--accent); font-weight: 700;
}
.tab.on:hover { background: transparent; }

/* ---------- stat blocks / forms ---------- */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat {
  background: var(--inset); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px 14px; text-align: center;
}
.stat .v { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .74rem; margin-top: 2px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; color: var(--muted); font-weight: 600; }
label.field > input, label.field > select { width: 100%; }
.swatch-lg { width: 100%; height: 90px; border-radius: 11px; border: 1px solid var(--border); cursor: pointer; }

.item:hover { border-color: var(--border-strong); }
.item .grow { min-width: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- confetti ---------- */
.confetti { position: fixed; top: -14px; font-size: 1.3rem; pointer-events: none; animation: fall linear forwards; z-index: 99; }
@keyframes fall { to { transform: translateY(110vh) rotate(700deg); opacity: .5; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
