/* «Кофе с соВой». День — кремовая тема, ночь — тёмная. Цвета с логотипа и бумажной карты. */

@font-face {
  font-family: "Rubik";
  src: url("/static/fonts/rubik-cyrillic.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Rubik";
  src: url("/static/fonts/rubik-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --bg: #fbf1df;
  --surface: #f1dfbd;
  --line: #e6d3ae;
  --text: #2e2420;
  --muted: #7a6a5e;
  --accent: #f2a23a;
  --on-accent: #2e2420;
  --teal: #36a594;
  --owl: #5b7085;
  --sticker: #fff6e6;
  --danger: #a1301f;
  /* Цвета графиков проверены валидатором dataviz на фоне #fbf1df и #151b22. */
  --chart-stamps: #008f7c;
  --chart-gifts: #b8680a;
  --radius: 22px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151b22;
    --surface: #212a34;
    --line: #2a3440;
    --text: #f6ebd6;
    --muted: #9fa9b3;
    --teal: #2f8f82;
    --sticker: #f6ebd6;
    --danger: #ff8f7a;
    --chart-stamps: #1f9483;
    --chart-gifts: #c47a12;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 "Rubik", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.eyebrow, .muted { margin: 0; color: var(--muted); font-size: 14px; }

.headline {
  margin: 4px 0 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero { display: flex; flex-direction: column; gap: 8px; padding-top: 6vh; }
.hero-owl { width: 112px; height: 112px; margin-bottom: 8px; }

.slots { display: flex; justify-content: center; gap: 10px; }
.slot, .gift { flex: none; width: 44px; height: 44px; }
.oct { fill: var(--teal); }
.sticker rect { fill: var(--sticker); stroke: var(--line); stroke-width: 0.5; }
.slot:not(.on) .sticker { display: none; }
.owl-body { fill: var(--owl); }
.owl-eye { fill: #ffd447; }
.owl-pupil { fill: #1b1b1b; }
.owl-beak { fill: #f2a23a; }
.gift-bg { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2.5 2; }
.gift-cup { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.gift.on .gift-bg { fill: var(--accent); stroke: none; }
.gift.on .gift-cup { stroke: var(--on-accent); }

.qr { align-self: center; padding: 14px; border-radius: var(--radius); background: #fff; }
.qr svg { display: block; width: min(64vw, 220px); height: auto; }

.pill {
  display: block;
  width: 100%;
  padding: 15px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.pill:active { transform: scale(0.98); }
.pill.primary { background: var(--accent); color: var(--on-accent); }
.pill:disabled { opacity: 0.6; cursor: progress; }
.link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.notice { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 14px; }
.addresses { margin-top: auto; color: var(--muted); font-size: 13px; text-align: center; }
.addresses p { margin: 2px 0; }

.menu { position: relative; }
.menu > summary { padding: 6px 12px; border-radius: 999px; color: var(--muted); list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }

.menu-body {
  position: absolute;
  top: 40px;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 270px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg);
  box-shadow: 0 12px 32px rgb(0 0 0 / 0.14);
}

.menu-body a { text-decoration: none; }

.prose h2 { margin: 24px 0 8px; font-size: 22px; }
.prose h3 { margin: 16px 0 6px; font-size: 16px; }
.prose ol { margin: 0; padding-left: 20px; }
.back { color: var(--muted); text-decoration: none; }

select, input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Бариста */
.viewfinder video { display: block; width: 100%; aspect-ratio: 1; border-radius: var(--radius); background: #000; object-fit: cover; }
.result { display: flex; flex-direction: column; gap: 12px; }
.big { margin: 0; font-size: 44px; font-weight: 700; line-height: 1; }
.stepper { display: flex; align-items: center; justify-content: space-between; padding: 6px; border-radius: 999px; background: var(--surface); }
.stepper span { font-weight: 600; }

.stepper button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}

/* Админка */
.admin { max-width: 1100px; margin: 0 auto; padding: 20px; }
.admin-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 24px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-nav a { padding: 8px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; }
.admin-nav a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; }
.admin-me { display: flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); font-size: 14px; }
.admin h2 { margin: 28px 0 12px; font-size: 20px; }
.table-scroll { overflow-x: auto; }
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 500; text-align: left; }
.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.data tr.cancelled td:not(:last-child) { color: var(--muted); text-decoration: line-through; }
.filters, .inline-form, .row-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters { margin-bottom: 20px; }
.rows { display: flex; flex-direction: column; gap: 10px; }

.chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.chip.on { border-color: var(--text); background: var(--text); color: var(--bg); }
.chip.danger { color: var(--danger); }

/* Дашборд. Правила графиков — из навыка dataviz. */
.chips { display: flex; gap: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { padding: 16px 18px; border-radius: 18px; background: var(--surface); }
.tile-label { margin: 0; color: var(--muted); font-size: 14px; }
.tile-value { margin: 6px 0 0; font-size: 34px; font-weight: 700; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 24px; margin-top: 24px; }
.charts figure { margin: 0; }
.charts figcaption { margin-bottom: 8px; font-weight: 600; }
.chart-wrap { overflow-x: auto; }
.chart { display: block; width: 100%; min-width: 520px; height: auto; }
.chart text { fill: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.chart .peak { fill: var(--text); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .bar { outline: none; }
.chart .bar:hover path, .chart .bar:focus path { opacity: 0.75; }
.chart .bar:focus-visible .hit { stroke: var(--text); stroke-width: 1; }
.series-stamps { fill: var(--chart-stamps); }
.series-gifts { fill: var(--chart-gifts); }
.table-view { margin-top: 12px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 24px; }

.tooltip {
  position: fixed;
  z-index: 10;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -100%);
}

/* Бариста: точка на смену и скан из фото */
.places { display: flex; flex-direction: column; gap: 10px; }
.place-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--surface); font-size: 14px; }
.work { display: flex; flex-direction: column; gap: 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Админка на телефоне */
@media (max-width: 640px) {
  .admin { padding: 16px 14px 28px; }
  .admin-top { gap: 10px; margin-bottom: 16px; }
  .admin-nav { flex-wrap: nowrap; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a { flex: none; }
  .admin-me { width: 100%; margin-left: 0; justify-content: space-between; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 26px; }
  .filters > label, .filters > select, .row-form > input { width: 100%; }
  .filters > label { display: flex; align-items: center; gap: 8px; }
  .filters > label input { flex: 1; }
  .data.stack thead { display: none; }
  .data.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .data.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .data.stack td::before { content: attr(data-label); color: var(--muted); text-align: left; }
}
