@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #f4f4f5;
  --bg-aside: #e4e4e7;
  --bg-main: #f4f4f5;
  --fg: #18181b;
  --muted: #71717a;
  --line: #d4d4d8;
  --card: #ffffff;
  --accent: #3f3f46;
  --accent-fg: #fff;
  --nav-on: #3f3f46;
  --sidebar: 18rem;
  --ui: 13px;
  --aside-fg: #18181b;
  --aside-line: #d4d4d8;
  --aside-hover-bg: rgb(24 24 27 / 0.08);
  --aside-shadow: 8px 0 20px rgb(24 24 27 / 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: var(--ui)/1.45 Inter, ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgb(24 24 27 / 0.06), transparent 28%),
    radial-gradient(circle at top right, rgb(24 24 27 / 0.05), transparent 24%),
    var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
body.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.7rem 1.4rem;
  background: var(--bg-aside);
  border-right: 1px solid var(--aside-line);
  box-shadow: var(--aside-shadow);
  color: var(--aside-fg);
  min-height: 100vh;
  width: auto;
  overflow: auto;
}
.sidebar.collapsed { width: 3.25rem; padding-inline: 0.4rem; }
.sidebar.collapsed .sb-logo-text,
.sidebar.collapsed .sb-logo-sub,
.sidebar.collapsed .sb-section,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed #who { display: none; }
.sb-header { display: flex; align-items: center; justify-content: space-between; min-height: 2rem; }
.sb-logo { display: flex; align-items: center; gap: 9px; }
.sb-logo-text {
  font-weight: 700;
  background: linear-gradient(90deg, #71717a, #3f3f46 22%, #fff 40%, #a1a1aa 58%, #fff 74%, #3f3f46);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sb-logo-sub { font-size: 10px; color: var(--muted); }
.sb-toggle {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
}
.sb-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.55rem 0.65rem;
  font: inherit;
  color: var(--aside-fg);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--aside-hover-bg); }
.nav-item.active {
  background: var(--nav-on);
  color: #fff;
  font-weight: 600;
}
.nav-icon { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.sb-bottom { margin-top: auto; padding: 10px 6px; font-size: 12px; color: var(--muted); }

.main { padding: 22px 24px 32px; overflow: auto; height: 100vh; background: var(--bg-main); }
.page-title { margin: 0 0 4px; font-size: 22px; color: var(--fg); font-weight: 650; }
.sub { color: var(--muted); font-size: 12px; }
.settings-group, .chat-card, .auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.settings-group h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.ctor { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 8px 0; }
.hidden { display: none !important; }
.msg { min-height: 18px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.warn { color: #b45309; }
.ok { color: #166534; }
.err { color: #991b1b; }
.admin-banner { padding: 8px 10px; border-radius: 8px; margin-bottom: 12px; }
.admin-banner-ok { background: #dcfce7; color: #166534; }
.admin-banner-err { background: #fee2e2; color: #991b1b; }

.admin-monitor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 12px 0 20px;
}
.admin-stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: left;
  cursor: default;
  color: var(--fg);
}
.admin-stat strong { display: block; font-size: 22px; margin-top: 6px; }
.admin-stat.is-ok { box-shadow: inset 0 -3px 0 #16a34a; }
.admin-stat.is-err { box-shadow: inset 0 -3px 0 #a1a1aa; }
.admin-dot {
  width: 8px; height: 8px; border-radius: 99px; background: #16a34a; display: inline-block; margin-top: 10px;
}
.admin-stat.is-err .admin-dot { background: #a1a1aa; }

input, select, textarea {
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
}
textarea { width: 100%; min-height: 80px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
button, .btn {
  background: var(--accent);
  color: var(--accent-fg);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
}
button:hover, .btn:hover { filter: brightness(1.08); }
.icon-btn { padding: 6px 10px; line-height: 0; }
.ico { display: inline-flex; width: 18px; height: 18px; color: currentColor; }
.ico svg { width: 18px; height: 18px; display: block; }

.has-tip { position: relative; }
.has-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #18181b;
  color: #fafafa;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
}
.has-tip:hover::after, .has-tip:focus-visible::after { opacity: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.td-mono { font-family: ui-monospace, monospace; font-size: 11px; word-break: break-all; }
code, .snippet {
  background: #18181b;
  color: #fafafa;
  padding: 8px 10px;
  border-radius: 8px;
  display: block;
  white-space: pre-wrap;
  font-size: 12px;
}
.chart-box { position: relative; min-height: 220px; }
.gc-subnav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.gc-subnav button.on { background: #18181b; }
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card { width: min(420px, 100%); }
.auth-card h1 { margin: 0 0 6px; font-size: 22px; }
.auth-card p { margin: 0 0 16px; color: var(--muted); }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.gate-nav { display: flex; flex-wrap: wrap; gap: 10px; }
.gate-nav a {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
}
.steps { counter-reset: step; }
.steps li { margin: 0 0 12px; line-height: 1.45; }
.help-page { max-width: 760px; margin: 0 auto; padding: 28px 18px 48px; }
.donut-wrap { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; }
.donut-center { text-align: center; min-width: 160px; }
.donut-center .big { font-size: 22px; font-variant-numeric: tabular-nums; }
.legend-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.chat-msg { font-size: 13px; margin: 6px 0; }
.chat-msg .who { color: var(--muted); font-size: 11px; }
.document-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  background: #fff;
}

.skin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.skin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  background: #fff;
}
.skin-card.on { border-color: #18181b; box-shadow: 0 0 0 1px #18181b; }
.skin-card img { width: 100%; height: 160px; object-fit: cover; border-radius: 6px; background: #f4f4f5; }
.skin-card h4 { margin: 8px 0 0; font-size: 13px; color: var(--fg); }
.preview-frame {
  width: 100%;
  height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.demo-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.demo-aside {
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: var(--bg-aside);
}
.demo-aside h1 { margin: 0 0 6px; font-size: 22px; }
.demo-aside p { margin: 0 0 16px; color: var(--muted); }
.demo-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-stage { padding: 36px 32px; }
.demo-stage h2 { margin: 0 0 18px; font-size: 15px; font-weight: 500; color: var(--muted); }
.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}
.preview {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 280 / 420;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgb(24 24 27 / 0.12);
}
.preview span { display: block; margin-top: 10px; font-size: 13px; color: var(--accent); }
.stage.picking .preview:not(.selected) { opacity: 0; pointer-events: none; }
.preview.docked { position: fixed; right: 16px; bottom: 16px; width: 360px; z-index: 4; }
.preview.hidden-live { opacity: 0; pointer-events: none; }
@media (max-width: 960px) {
  .demo-layout { grid-template-columns: 1fr; }
  .demo-grid { grid-template-columns: 1fr; }
}
