:root {
  --paper: #f7f0df; --card: #fffaf0; --ink: #2b2118; --muted: #6f6152; --line: #dccfb4;
  --leaf: #2f6b3a; --leaf-dark: #214d29; --leaf-soft: #dcebd3;
  --wood: #6b4a2f; --gold: #c8962b; --gold-soft: #f6e6b8;
  --rose: #a8323a; --rose-soft: #f4d9d6; --sky: #2f5f8a; --sky-soft: #d9e6f2;
  --shadow: 0 2px 0 rgba(43, 33, 24, .12), 0 10px 24px rgba(43, 33, 24, .08);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17130f; --card: #221c16; --ink: #f3ead9; --muted: #b3a48f; --line: #3b3127;
    --leaf: #6fbf73; --leaf-dark: #8fd692; --leaf-soft: #1f3322;
    --wood: #c9a27c; --gold: #e3b54a; --gold-soft: #3a2f14;
    --rose: #ef8a8f; --rose-soft: #3d1f21; --sky: #8fc0ea; --sky-soft: #1b2a38;
    --shadow: 0 2px 0 rgba(0, 0, 0, .4), 0 10px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1, h2, h3 { font-family: ui-serif, "New York", Georgia, serif; line-height: 1.2; margin: 0; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0; }
a { color: var(--leaf); }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .875rem; } .right { margin-left: auto; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .85rem; word-break: break-all; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; align-content: start; }
.stack > * { min-width: 0; }
pre { margin: 0; white-space: pre-wrap; }
.grow { flex: 1 1 200px; min-width: 0; }
.hidden { display: none !important; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 2px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; }
.brand img { width: 36px; height: 36px; }
.brand strong { font-family: ui-serif, "New York", Georgia, serif; font-size: 1.1rem; display: block; line-height: 1.1; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 650; }
.nav a:hover { background: var(--leaf-soft); }
.nav a[aria-current="page"] { background: var(--leaf); color: #fff; }
@media (prefers-color-scheme: dark) { .nav a[aria-current="page"] { color: #10210f; } }
.nav .glyph { width: 22px; text-align: center; }
.side .who { margin-top: auto; padding: 12px; border-top: 2px solid var(--line); }
.main { padding: 24px clamp(16px, 4vw, 40px) 64px; max-width: 1180px; width: 100%; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead p { color: var(--muted); }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 2px solid var(--line); z-index: 20; overflow-x: auto; gap: 2px; }
  .brand, .side .who { display: none; }
  .nav { display: flex; gap: 2px; width: 100%; }
  .nav a { flex: 1 0 auto; flex-direction: column; gap: 0; padding: 6px 10px; font-size: .72rem; min-width: 62px; }
  .nav .glyph { font-size: 1.15rem; width: auto; }
  .main { padding-bottom: 110px; }
  .mobile-who { display: flex !important; }
}
.mobile-who { display: none; }

/* Cards and tiles */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card > h2 { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.tile .value { font-family: ui-serif, "New York", Georgia, serif; font-size: 1.9rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile.live { border-color: var(--gold); background: var(--gold-soft); }
.banner { border-radius: var(--radius); padding: 12px 16px; border: 2px solid var(--gold); background: var(--gold-soft); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.rose { border-color: var(--rose); background: var(--rose-soft); }
.banner.sky { border-color: var(--sky); background: var(--sky-soft); }

/* Forms */
label { display: grid; gap: 4px; font-weight: 650; font-size: .92rem; }
label .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="password"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
input[type="color"] { width: 56px; height: 44px; padding: 2px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--leaf); flex: none; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 18px; border-radius: 14px;
  border: 2px solid var(--leaf-dark); background: var(--leaf); color: #fff; font-weight: 750; cursor: pointer; box-shadow: 0 3px 0 var(--leaf-dark); text-decoration: none;
}
@media (prefers-color-scheme: dark) { .btn { color: #10210f; } }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--leaf-dark); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.plain { background: var(--card); color: var(--ink); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn.gold { background: var(--gold); border-color: #8a6412; box-shadow: 0 3px 0 #8a6412; color: #2b2118; }
.btn.rose { background: var(--rose); border-color: #6d1c22; box-shadow: 0 3px 0 #6d1c22; color: #fff; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; border-radius: 11px; }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: 12px 24px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); font-weight: 700; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.chip[aria-pressed="true"] { border-color: var(--leaf); background: var(--leaf-soft); }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--dot, var(--gold)); border: 1px solid rgba(0, 0, 0, .25); }
.chip .x { color: var(--muted); font-weight: 600; font-size: .85rem; }

/* Lists */
.list { display: grid; gap: 10px; }
.item { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--paper); display: grid; gap: 4px; }
.item .top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.item .top strong { font-size: 1.02rem; }
.tag { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 9px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); white-space: nowrap; }
.tag.live { border-color: var(--gold); background: var(--gold-soft); }
.tag.scheduled { border-color: var(--sky); background: var(--sky-soft); }
.tag.ended, .tag.cancelled, .tag.removed, .tag.off { color: var(--muted); }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 2px dashed var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.scroll { overflow-x: auto; }

/* Fruit preview for a custom event */
.preview { display: flex; gap: 16px; align-items: center; padding: 14px; border-radius: 14px; border: 2px dashed var(--line); background: var(--paper); }
.fruit { width: 72px; height: 72px; border-radius: 50% 50% 46% 46%; background: radial-gradient(circle at 34% 30%, #fff8, transparent 42%), var(--tint, #e8b93c); border: 3px solid rgba(43, 33, 24, .55); box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .14); flex: none; position: relative; }
.fruit::before { content: ""; position: absolute; top: -12px; left: 30px; width: 16px; height: 16px; border-radius: 0 70% 0 70%; background: var(--leaf); border: 2px solid rgba(43, 33, 24, .55); }
.price { font-family: ui-serif, Georgia, serif; font-size: 1.3rem; font-weight: 700; }

/* Phone preview for news */
.phone { border: 3px solid var(--wood); border-radius: 22px; padding: 14px; background: var(--card); max-width: 320px; box-shadow: var(--shadow); }
.phone .kind { font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--wood); }
.phone .body { white-space: pre-wrap; margin-top: 6px; font-size: .92rem; }

/* Sign-in */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate .card { width: min(100%, 420px); }
.gate .brand { padding: 0 0 12px; }
.error { color: var(--rose); font-weight: 650; }

/* Dialog and toasts */
dialog { border: 2px solid var(--line); border-radius: 18px; background: var(--card); color: var(--ink); padding: 20px; width: min(92vw, 460px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 14, 8, .55); }
dialog h2 { margin-bottom: 8px; }
dialog .facts { margin: 12px 0; padding: 12px; border-radius: 12px; background: var(--paper); border: 2px solid var(--line); display: grid; gap: 4px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(92vw, 380px); }
@media (max-width: 820px) { #toasts { bottom: 96px; left: 16px; } }
.toast { background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 12px; font-weight: 650; box-shadow: var(--shadow); }
.toast.bad { background: var(--rose); color: #fff; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.spark i { flex: 1; background: var(--leaf); border-radius: 3px 3px 0 0; min-height: 2px; height: var(--h, 2px); opacity: .85; }
@media (prefers-reduced-motion: no-preference) { .tag.live { animation: pulse 2s ease-in-out infinite; } @keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(200, 150, 43, .25); } } }
