
:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --surface-3: #edf1f5;
  --surface-raised: #ffffff;
  --surface-inset: #f0f3f6;
  --text: #202631;
  --text-2: #566171;
  --muted: #687586;
  --line: #dce2e9;
  --line-strong: #cbd3dd;
  --accent: #285ec7;
  --accent-hover: #315fb3;
  --accent-soft: #e9effb;
  --success: #167a59;
  --success-soft: #e7f6ef;
  --warning: #9a650d;
  --warning-soft: #fff3dc;
  --danger: #c64242;
  --danger-soft: #fdecec;
  --purple: #6f5ec9;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --control-h: 36px;
  --sidebar-w: 204px;
  --topbar-h: 60px;
  --shadow-card: none;
  --shadow-pop: 0 18px 44px rgba(20, 31, 50, .18);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10141a;
  --surface: #171c24;
  --surface-2: #131820;
  --surface-3: #202731;
  --surface-raised: #1b212b;
  --surface-inset: #12171e;
  --text: #e7eaee;
  --text-2: #bdc5cf;
  --muted: #8893a1;
  --line: #2a323d;
  --line-strong: #394452;
  --accent: #86a9e8;
  --accent-hover: #9bb8ec;
  --accent-soft: #202d43;
  --success: #72c7a6;
  --success-soft: #183229;
  --warning: #dcb36f;
  --warning-soft: #332b1d;
  --danger: #ef9292;
  --danger-soft: #382329;
  --purple: #b2a5e8;
  --shadow-card: none;
  --shadow-pop: 0 20px 50px rgba(0, 0, 0, .42);
}


* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.5 "Segoe UI Variable Text", "Aptos", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; transition: background-color .12s ease, color .12s ease; }
:where(button, a, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }
html body [hidden] { display: none; }

:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
:where(input:not([type="checkbox"]):not([type="radio"]), select) {
  height: var(--control-h);
  padding: 0 9px;
}
:where(textarea) { min-height: 96px; padding: 8px 9px; resize: vertical; }
:where(input, select, textarea):focus {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent);
}
:where(input, select, textarea):disabled {
  opacity: .68;
  cursor: default;
  background: var(--surface-2);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.button,
.mini-button {
  min-height: var(--control-h);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  padding: 0 11px;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.button:hover, .mini-button:hover { background: color-mix(in srgb, var(--surface-3) 78%, var(--text) 6%); }
.button.primary { background: var(--accent); color: #fff; }
html[data-theme="dark"] .button.primary { color: #10141a; }
.button.primary:hover { background: var(--accent-hover); }
.button.ghost { background: var(--surface); border: 1px solid var(--line); }
.button.danger { background: var(--danger-soft); color: var(--danger); }
.button:disabled, .mini-button:disabled { opacity: .45; cursor: default; }
.mini-button { width: auto; min-height: 29px; padding: 0 9px; font-size: 11px; }
.icon-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 18px;
}
.icon-button:hover { background: var(--surface-3); color: var(--text); }

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.card-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.card-head b { font-size: 12.5px; letter-spacing: -.01em; }
.card-head span,
.section-title span { display: block; color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}
.section-title h3 { margin: 0; font-size: 12px; }

.chip {
  max-width: 100%;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}
.chip.green { background: var(--success-soft); color: var(--success); }
.chip.red { background: var(--danger-soft); color: var(--danger); }
.chip.amber { background: var(--warning-soft); color: var(--warning); }
.chip.purple { background: color-mix(in srgb, var(--purple) 14%, var(--surface)); color: var(--purple); }

.muted-note, .muted-line { color: var(--muted); font-size: 11px; }
.form-error { min-height: 18px; color: var(--danger); font-weight: 700; }

#toast.toast-stack {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: auto;
  z-index: 120;
  width: min(390px, calc(100vw - 28px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast-item {
  display: grid;
  grid-template-columns: 8px minmax(0,1fr) auto;
  align-items: start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 96%, var(--bg));
  color: var(--text);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(-8px);
  animation: toast-in .16s ease forwards;
  pointer-events: auto;
}
.toast-item::before { content: ''; width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--accent); }
.toast-item.success::before { background: var(--success); }
.toast-item.warning::before { background: var(--warning); }
.toast-item.danger::before { background: var(--danger); }
.toast-item > span { min-width: 0; font-size: 11.5px; line-height: 1.4; overflow-wrap: anywhere; }
.toast-item > button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; color: var(--muted); }
.toast-item > button:hover { background: var(--surface-3); color: var(--text); }
.toast-item > button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.toast-item.leaving { opacity: 0; transform: translateY(-6px); transition: .14s ease; }
@keyframes toast-in { to { opacity: 1; transform: translateY(0); } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 30%, transparent); border: 2px solid transparent; border-radius: 999px; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.ui-close-icon { width: 14px; height: 14px; display: block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.field-close { width: 20px; height: 20px; display: inline-grid; place-items: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms; transition-duration: .01ms; scroll-behavior: auto; }
}
