:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #fff;
  --ink: #17202f;
  --muted: #6b7280;
  --line: #dce1e8;
  --accent: #3157d5;
  --accent-strong: #183aa8;
  --danger: #b42318;
  --ok: #147a45;
  --warn: #9a6700;
  --radius: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 28px; line-height: 1.15; }
h2 { margin-bottom: 8px; font-size: 20px; }
h3 { margin-bottom: 6px; font-size: 16px; }

.brand { display: flex; align-items: center; gap: 11px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { max-width: 160px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(145deg, var(--accent), #7839d8); color: #fff; font-weight: 800; }
.eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.optional { color: var(--muted); font-weight: 400; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 10% 10%, #e5eaff 0, transparent 30%), var(--bg); }
.auth-card { width: min(440px, 100%); display: grid; gap: 28px; padding: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 18px 60px rgba(23, 32, 47, .1); }
.stack, .form-grid { display: grid; gap: 14px; }
.form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-span { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #dfe5ff; border-color: var(--accent); }
input[type="checkbox"] { width: auto; min-height: auto; }
.check { display: flex; align-items: center; gap: 8px; }

button, .nav a, a.button { min-height: 38px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); text-decoration: none; }
.primary { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 750; }
.primary:hover { background: var(--accent-strong); }
.ghost { background: transparent; }
.small { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.danger { border-color: #dc2626; color: #b91c1c; background: #fff7f7; }
.danger:hover { background: #fee2e2; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice { position: sticky; top: 8px; z-index: 10; padding: 10px 12px; border: 1px solid #b9dfc9; border-radius: 10px; background: #f0faf4; color: var(--ok); }
.notice.error { border-color: #f0b5ae; background: #fff4f2; color: var(--danger); }
.hidden { display: none !important; }
.support-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid #e8c35b; border-radius: var(--radius); background: #fff9e8; color: #6f4b00; }
.support-banner strong, .support-banner span { display: block; }
.support-banner span { margin-top: 2px; font-size: 12px; }

.product-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { padding: 22px 16px; border-right: 1px solid var(--line); background: #fff; }
.sidebar .brand { padding: 0 8px 22px; }
.nav { display: grid; gap: 4px; }
.nav button, .nav a { display: flex; align-items: center; width: 100%; border-color: transparent; background: transparent; text-align: left; }
.nav button:hover, .nav a:hover, .nav .active { background: #eef2ff; color: var(--accent-strong); }
.workspace { min-width: 0; padding: 24px 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 0; }
.account { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.view { display: none; }
.view.active { display: block; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat, .panel { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.stat strong { display: block; font-size: 28px; }
.stat span { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-grid { grid-template-columns: minmax(320px, .7fr) minmax(500px, 1.3fr); }
.wide { min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.module-head { margin-bottom: 16px; }
.module-head p:last-child { margin-bottom: 0; }
.module-stack { display: grid; gap: 16px; }
.inline-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.inline-link input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-size: 12px; }
.badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: #edf7f1; color: var(--ok); font-size: 12px; font-weight: 700; }
.badge.warn { background: #fff7df; color: var(--warn); }
.badge.muted { background: #eef0f3; color: var(--muted); }
.empty { min-height: 180px; display: grid; place-items: center; padding: 24px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.detail-card { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.detail-card p { margin-bottom: 0; }
.playground-frame { width: 100%; height: calc(100vh - 190px); min-height: 620px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--muted); }
.status-dot.ok { background: var(--ok); }
details.panel > summary { cursor: pointer; font-weight: 750; }
details.panel[open] > summary { margin-bottom: 16px; }

@media (max-width: 900px) {
  .product-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(3, 1fr); }
  .workspace { padding: 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid.two, .admin-grid, .detail-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .account { flex-direction: column; align-items: flex-end; }
  .support-banner { align-items: flex-start; flex-direction: column; }
  .playground-frame { min-height: 720px; }
}
