:root {
  --bg: #f3efe7;
  --paper: #fffcf7;
  --ink: #1b2421;
  --muted: #5e6a64;
  --line: #e3dbd0;
  --side: #172421;
  --side-ink: #e7efe9;
  --accent: #c65a2e;
  --accent-dark: #a34822;
  --teal: #1f6f64;
  --ok: #1d7a45;
  --danger: #9d341f;
  --shadow: 0 16px 40px rgba(28, 36, 32, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 320px at 100% -10%, rgba(31, 111, 100, 0.09), transparent 55%),
    var(--bg);
  font: 16px/1.5 "Segoe UI", "Helvetica Neue", sans-serif;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 32px; letter-spacing: -0.03em; line-height: 1.15; }
h2 { margin-bottom: 0; font-size: 18px; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: Consolas, ui-monospace, monospace; font-size: 0.92em; }

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; padding: 0 8px 18px; }
.brand strong, .brand small { display: block; }
.brand small { color: #9aada4; font-size: 13px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: white;
  display: grid; place-items: center; flex: 0 0 auto;
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { margin: 16px 12px 6px; color: #9aada4; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.nav a { color: inherit; text-decoration: none; padding: 10px 12px; border-radius: 12px; }
.nav a:hover, .nav a.is-active { background: rgba(255, 255, 255, 0.07); }
.side-user { margin-top: auto; padding: 18px 8px 0; display: flex; flex-direction: column; gap: 2px; }
.side-user span { color: #9aada4; font-size: 13px; word-break: break-all; }
.side-version { font-size: 12px; }
.main { padding: 28px 32px 72px; max-width: 1180px; }
.banner, .flash {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  padding: 12px 14px; border-radius: 14px; margin-bottom: 16px;
}
.banner { background: #e7f3ef; color: #16483f; }
.flash-ok { background: #e5f4ea; color: #145c32; }
.flash-error { background: #fde8e2; color: #8a2d1c; }
.page-head, .page-actions, .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.page-head { justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.lead, .help { color: var(--muted); }
.lead { margin: 6px 0 0; }
.eyebrow { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card, .stats + .card, .card + .empty, .upload + .empty, .filters + .card { margin-top: 16px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-narrow { max-width: 640px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; font-weight: 650; color: var(--muted); }
.field small { color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line); background: white; border-radius: 12px; padding: 11px 12px;
}
textarea { min-height: 88px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 10px 16px; border: 1px solid transparent;
  background: transparent; text-decoration: none; cursor: pointer; font-weight: 650;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: white; border-color: var(--line); color: var(--ink); }
.btn-danger { color: var(--danger); border-color: #f0cfc6; background: white; }
.btn-quiet { color: var(--side-ink); padding-left: 0; }
.btn-small { padding: 7px 12px; font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat span { color: var(--muted); display: block; }
.stat strong { font-size: 32px; letter-spacing: -0.04em; }
.card-table { padding: 0; overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.actions { justify-content: flex-end; }
.actions form { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 4px 10px; background: #f3efe7; font-size: 13px; font-weight: 700; }
.pill.is-on { background: #e5f4ea; color: #145c32; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #8d8478; display: block; }
.pill.is-on .dot { background: var(--ok); }
.empty { margin-top: 16px; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; margin-bottom: 16px; }
.code { margin: 0; font-family: Consolas, ui-monospace, monospace; font-size: 64px; letter-spacing: 0.14em; font-weight: 700; line-height: 1; }
.danger-zone { margin-top: 16px; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.filters { max-width: 320px; margin-bottom: 16px; }
.media-grid { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-card { display: flex; flex-direction: column; gap: 10px; }
.thumb { aspect-ratio: 16/10; border-radius: 12px; background: #ece6dc; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-meta { display: flex; flex-direction: column; min-width: 0; }
.media-meta strong, .media-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta span { color: var(--muted); font-size: 13px; }
.upload { display: flex; flex-direction: column; gap: 12px; }
.upload.is-dragover { outline: 2px dashed var(--accent); }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 6px 0 6px 22px; position: relative; }
.checks li::before { position: absolute; left: 0; }
.checks .is-ok::before { content: "✓"; color: var(--ok); }
.checks .is-bad::before { content: "!"; color: var(--danger); font-weight: 700; }
.steps { margin: 0; padding-left: 18px; }
.snippet { background: #172421; color: #e7efe9; border-radius: 12px; padding: 12px 14px; overflow: auto; }
.install-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 28px; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-wrap { width: min(480px, 100%); }
.auth-wrap.is-wide { width: min(1040px, 100%); }
.brand-auth { color: var(--ink); padding-bottom: 14px; }
.brand-auth small { color: var(--muted); }

.editor-top { margin-bottom: 16px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.canvas-frame { background: #121816; border-radius: 18px; padding: 12px; }
.canvas { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; touch-action: none; user-select: none; }
.zone-box { position: absolute; box-sizing: border-box; border: 2px solid rgba(255,255,255,.55); overflow: hidden; cursor: move; }
.zone-box.is-selected { border-color: #ffb088; }
.zone-label, .zone-sub {
  position: absolute; left: 8px; color: white; background: rgba(0,0,0,.5);
  border-radius: 7px; padding: 2px 7px; pointer-events: none;
}
.zone-label { top: 8px; font-size: 13px; font-weight: 700; }
.zone-sub { top: 34px; font-size: 12px; }
.resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; }
.resize::before { content: ""; position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px; border-right: 2px solid white; border-bottom: 2px solid white; }
.inspector { max-height: calc(100vh - 120px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.zone-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.zone-tabs button.is-selected { background: var(--side); color: white; border-color: var(--side); }
.item-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.editor-extra { margin-top: 16px; }
:focus-visible { outline: 3px solid #e7b59a; outline-offset: 2px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .side-user { margin-top: 16px; }
  .main { padding: 20px 16px 48px; }
  .stats, .split, .install-grid, .editor-grid, .row { grid-template-columns: 1fr; }
  .code { font-size: 42px; }
  .danger-zone { flex-direction: column; align-items: flex-start; }
}
