:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #6b6862;
  --line: #e2dfd8;
  --accent: #b4441f;
  --accent-text: #ffffff;
  --accent-soft: #fbe9e2;
  --ok: #2f7d4f;
  --warn: #9a6a00;
  --danger: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --surface: #211f1d;
    --text: #f1eee8;
    --muted: #a39f97;
    --line: #36332f;
    --accent: #e57a52;
    --accent-text: #1b0c05;
    --accent-soft: #3a2219;
    --ok: #6ccf93;
    --warn: #e2b44a;
    --danger: #ff8a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.who { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 80px; }

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 16px 0 20px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.tabs a {
  flex: none;
  padding: 10px 14px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  font-weight: 600;
}
.tabs a[aria-current="page"] { color: var(--text); border-color: var(--accent); }

.bar-head { display: flex; align-items: center; gap: 14px; }
.bar-head img { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }

.list { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.item { display: flex; gap: 14px; align-items: center; }
.item .thumb { width: 56px; height: 56px; flex: none; border-radius: 8px; object-fit: cover; background: var(--bg); }
.item .body { flex: 1; min-width: 0; }
.item .body p { margin: 2px 0 0; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
a.item-link { color: inherit; text-decoration: none; }
a.item-link:hover h3 { text-decoration: underline; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  vertical-align: 2px;
  margin-left: 6px;
}
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }

button, .button {
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.3;
}
button:hover, .button:hover { border-color: var(--muted); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--danger); }
button.small { padding: 5px 10px; font-size: 14px; }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

form.card { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; font-weight: 600; }
.field .hint, .hint { font-weight: 400; color: var(--muted); font-size: 14px; }
input[type="text"], input[type="email"], input[type="number"], input[type="datetime-local"], input[type="time"], input[type="date"], select, textarea {
  font: inherit;
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
input[type="number"] { width: 110px; }
input[type="time"] { width: 140px; }
input[type="date"] { width: 180px; }
textarea { min-height: 80px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; display: grid; gap: 10px; }
legend { font-weight: 600; padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; flex-wrap: wrap; }
.check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.days label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
.days input { accent-color: var(--accent); }
.choice { display: grid; gap: 8px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.choice input { margin-top: 4px; accent-color: var(--accent); }
.choice strong { display: block; }

.image-field { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.image-field img { width: 96px; height: 96px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.image-field .placeholder { width: 96px; height: 96px; border-radius: 8px; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; }

.section-edit { display: grid; gap: 10px; }
.menu-item { display: grid; grid-template-columns: 1fr 100px auto; gap: 8px; align-items: start; }
.menu-item textarea { grid-column: 1 / -1; min-height: 44px; }
.item-picture { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-picture img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }

.form-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.danger-zone { border-color: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.25);
  font-weight: 600;
}
.toast.error { background: var(--danger); color: #fff; }

.code-input { text-transform: uppercase; letter-spacing: 0.15em; font-size: 20px; max-width: 200px; }

@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .item { align-items: flex-start; }
  .item .thumb { width: 44px; height: 44px; }
  .menu-item { grid-template-columns: 1fr 84px auto; }
}

/* Color themes */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; font-weight: 600; }
.swatch[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.swatch .chip { width: 28px; height: 28px; border-radius: 6px; border: 3px solid; display: grid; place-items: end; overflow: hidden; }
.swatch .chip span { width: 12px; height: 12px; border-radius: 3px 0 0 0; }
.custom-colors input[type="color"] { width: 72px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.tv-preview {
  aspect-ratio: 16 / 9; max-width: 480px; border-radius: 8px; padding: 10px 12px; display: grid;
  grid-template-rows: auto auto 1fr; gap: 8px; font-size: 11px; position: relative; overflow: hidden;
  border: 6px solid #111; box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}
.tvp-top { display: flex; gap: 8px; align-items: center; }
.tvp-top span { padding: 1px 6px; border-radius: 4px; }
.tvp-hero { display: grid; gap: 1px; }
.tvp-hero strong { font-size: 15px; }
.tvp-grid { display: grid; grid-template-columns: 1fr 2fr 1.4fr; gap: 3px; padding: 3px; border-radius: 4px; align-content: start; }
.tvp-grid span { padding: 6px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvp-banner {
  position: absolute; left: 12px; right: 12px; bottom: 10px; padding: 6px 10px; border: 2px solid; border-radius: 6px;
  display: grid; opacity: 0.9;
}
.tvp-banner strong { font-size: 14px; }
.layout-pick { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.layout-pick select { width: auto; padding: 5px 8px; }

/* Signing in */
.auth { max-width: 460px; margin: 24px auto 0; display: grid; gap: 14px; }
.auth h1 { margin: 0; }
.auth p { margin: 0; }
input[type="password"] {
  font: inherit; width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
.who { display: flex; gap: 14px; align-items: center; }
.link-box input { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }

/* Bar Channel page order */
.page-preview { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }
fieldset:disabled { opacity: 0.5; }
