/* Октагон · cyber club — стиль как на плакате тарифов: тёмный фон, неоновые рамки, оранжевый акцент.
   Светлая тема (кнопка в шапке) — для чтения отчётов и печати. */
:root {
  --bg: #07080e; --surface: #0d1019; --surface-2: #151a2b; --text: #eef0f7; --muted: #9097b0; --line: #242a45;
  --accent: #ff7a1a; --accent-2: #ff4d2e; --accent-ink: #1b0b00;
  --blue: #3b8bff; --purple: #a463ff; --pink: #ff4fa3; --orange: #ff7a1a; --green: #38e0a0; --red: #ff5468; --yellow: #ffc247;
  --cash: var(--blue); --noncash: var(--orange); --expense: var(--pink);
  --ok: var(--green); --warn: var(--yellow); --bad: var(--red);
  --radius: 14px; --shadow: 0 8px 28px rgba(0, 0, 0, .35);
  --title-grad: linear-gradient(180deg, #ffffff 0%, #b9bfd3 100%);
  --page-bg: radial-gradient(1100px 500px at 8% -10%, rgba(59, 139, 255, .13), transparent 60%), radial-gradient(900px 500px at 100% -5%, rgba(255, 122, 26, .16), transparent 55%), var(--bg);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f4f8; --surface: #ffffff; --surface-2: #eef0f6; --text: #151824; --muted: #5d6479; --line: #dcdfe9;
  --accent: #e8590c; --accent-2: #d6336c; --accent-ink: #ffffff;
  --blue: #2563eb; --purple: #7c3aed; --pink: #db2777; --orange: #e8590c; --green: #15803d; --red: #c8202f; --yellow: #b45309;
  --shadow: 0 2px 4px rgba(20, 24, 36, .06), 0 8px 24px rgba(20, 24, 36, .06);
  --title-grad: linear-gradient(180deg, #151824, #151824);
  --page-bg: var(--bg);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page-bg); background-attachment: fixed; color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
.boot { padding: 40px; color: var(--muted); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: 30px; font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .01em; background: var(--title-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.pos { color: var(--ok); } .neg { color: var(--bad); } .warn { color: var(--warn); }

/* шапка и меню */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 20px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand { text-decoration: none; color: inherit; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; display: block; flex: none; background: #000; box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent); }
.auth-logo { display: block; width: min(240px, 68%); height: auto; margin: 0 auto -4px; border-radius: 26px; box-shadow: 0 0 36px color-mix(in srgb, var(--accent) 35%, transparent); }
.brand-mark { width: 34px; height: 34px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 70%, transparent)); }
.brand-name { font-weight: 900; font-size: 22px; letter-spacing: .06em; background: linear-gradient(180deg, #ffb347, var(--accent) 60%, var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }
.brand-sub { display: block; font-size: 9px; letter-spacing: .2em; color: var(--muted); font-weight: 600; margin-top: 3px; }
.spacer { flex: 1; }
.nav { display: flex; gap: 6px; padding: 10px 20px; overflow-x: auto; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.nav a { padding: 9px 16px; border-radius: 99px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 600; border: 1px solid transparent; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent); }
.page { max-width: 1200px; margin: 0 auto; padding: 22px 18px 70px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.page > * { min-width: 0; }   /* широкое содержимое (вкладки, таблицы) прокручивается внутри себя и не растягивает страницу на телефоне */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.demo-banner { background: linear-gradient(90deg, color-mix(in srgb, var(--yellow) 22%, transparent), transparent); border-bottom: 1px solid color-mix(in srgb, var(--yellow) 40%, transparent); padding: 6px 20px; font-size: 13px; color: var(--yellow); }

/* карточки: неоновая рамка, цвет задаётся классом glow-* */
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card > h3 + * { margin-top: 12px; }
.glow-orange { border-color: color-mix(in srgb, var(--orange) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--orange) 25%, transparent), 0 0 24px color-mix(in srgb, var(--orange) 18%, transparent); }
.glow-blue { border-color: color-mix(in srgb, var(--blue) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 25%, transparent), 0 0 24px color-mix(in srgb, var(--blue) 18%, transparent); }
.glow-purple { border-color: color-mix(in srgb, var(--purple) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--purple) 25%, transparent), 0 0 24px color-mix(in srgb, var(--purple) 18%, transparent); }
.glow-pink { border-color: color-mix(in srgb, var(--pink) 70%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--pink) 25%, transparent), 0 0 24px color-mix(in srgb, var(--pink) 18%, transparent); }
.glow-green { border-color: color-mix(in srgb, var(--green) 60%, transparent); box-shadow: 0 0 24px color-mix(in srgb, var(--green) 12%, transparent); }
.grid { display: grid; gap: 18px; }
.grid > *, .tab-panel > *, .tabs-wrap, .tab-panels { min-width: 0; max-width: 100%; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; box-shadow: var(--shadow); overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kc, var(--accent)); box-shadow: 0 0 14px var(--kc, var(--accent)); }
.kpi.k-blue { --kc: var(--blue); } .kpi.k-orange { --kc: var(--orange); } .kpi.k-purple { --kc: var(--purple); } .kpi.k-pink { --kc: var(--pink); } .kpi.k-green { --kc: var(--green); }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 28px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 16px 22px; font-size: 18px; border-radius: 14px; width: 100%; justify-content: center; flex-direction: column; gap: 2px; text-align: center; }
.btn.big .small { font-weight: 500; opacity: .8; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); }
.chip:hover { color: var(--text); }
.chip.active { background: color-mix(in srgb, var(--accent) 20%, transparent); border-color: var(--accent); color: var(--text); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent); }
label.field { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 76px; resize: vertical; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); align-items: end; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row > input[type="date"], .row > input[type="time"], .row > input:not([type="checkbox"]):not([type="date"]) { width: auto; min-width: 140px; }
.row input[type="checkbox"], label.chip input[type="checkbox"] { width: auto; }
.row > .row { gap: 8px; }
.checklist { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.checklist label { display: flex; align-items: center; gap: 8px; }
.checklist input { width: auto; flex: none; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; background: var(--surface); }
td.num, th.num { text-align: right; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.notice { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.notice.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.notice.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.toast { position: fixed; inset: auto auto 24px 50%; margin: 0; border: 0; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; z-index: 30; max-width: 92vw; font-weight: 600; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }

/* отчёт в виде «сообщения Telegram» */
.report { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; max-width: 640px; line-height: 1.55; }
.report p { margin: 0; min-height: 1.2em; }
.report p.gap { min-height: .7em; }
.report strong { color: var(--text); }
.report .ind { padding-left: 18px; color: var(--muted); }

/* вход */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(440px, 100%); display: grid; gap: 16px; padding: 26px; }
.auth h1 { font-size: 26px; }
.secret { font: 15px ui-monospace, Menlo, monospace; word-break: break-all; background: var(--surface-2); padding: 10px; border-radius: 8px; user-select: all; }

/* графики */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar-cash { fill: var(--cash); } .chart .bar-noncash { fill: var(--noncash); } .chart .bar-expense { fill: var(--expense); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; }
.i-cash { background: var(--cash); } .i-noncash { background: var(--noncash); } .i-expense { background: var(--expense); }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; margin: 8px 0; font-size: 14px; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.hbar .fill { height: 100%; background: linear-gradient(90deg, var(--pink), var(--orange)); border-radius: 5px; }

details.shift { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
details.shift > summary { cursor: pointer; padding: 12px 14px; display: grid; gap: 4px 14px; grid-template-columns: auto 1fr auto; align-items: center; list-style: none; }
details.shift > summary::-webkit-details-marker { display: none; }
details.shift[open] { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
details.shift[open] > summary { border-bottom: 1px solid var(--line); }
details.shift .body { padding: 14px; display: grid; gap: 14px; }
details > summary { cursor: pointer; font-weight: 600; }

/* безопасность */
.sec-summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.sec-pill { padding: 10px 18px; border-radius: 99px; font-weight: 800; font-size: 18px; }
.sec-pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.sec-pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.sec-pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.sec-list { display: grid; gap: 12px; }
.sec-item { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.sec-item .ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; }
.sec-item.ok .ico { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.sec-item.warn .ico { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.sec-item.bad .ico { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.sec-item.bad { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.sec-item strong { display: block; margin-bottom: 2px; }

/* касса */
.cash-big { font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; margin: 6px 0; }
.diff-ok { color: var(--ok); font-weight: 700; } .diff-bad { color: var(--bad); font-weight: 700; }

/* «Ещё» */
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.tile { display: block; text-decoration: none; color: var(--text); padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.tile:hover { border-color: var(--accent); box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 25%, transparent); }
.tile strong { display: block; font-size: 17px; margin-bottom: 4px; }
.tile span { color: var(--muted); font-size: 14px; }

/* тарифы (как на плакате) */
.tariffs { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); }
.tariff { position: relative; border-radius: 16px; padding: 18px 18px 16px; background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 9%, var(--surface)), var(--surface)); border: 1.5px solid var(--tc); box-shadow: 0 0 0 1px color-mix(in srgb, var(--tc) 30%, transparent), 0 0 26px color-mix(in srgb, var(--tc) 28%, transparent); display: grid; gap: 12px; align-content: start; }
.tariff.t-orange { --tc: var(--orange); } .tariff.t-blue { --tc: var(--blue); } .tariff.t-purple { --tc: var(--purple); } .tariff.t-pink { --tc: var(--pink); }
.tariff.wide { grid-column: 1 / -1; }
.tariff h2 { font-size: 26px; font-style: italic; font-weight: 800; text-transform: uppercase; }
.tariff .desc { color: var(--muted); font-size: 14px; margin-top: -6px; }
.tariff .crown { color: var(--yellow); }
.tariff .new { display: inline-block; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 6px; vertical-align: middle; margin-left: 8px; letter-spacing: .06em; }
.t-sec { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding-left: 10px; border-left: 4px solid var(--orange); color: var(--orange); margin-top: 4px; }
.t-sec.pk { border-left-color: var(--blue); color: var(--blue); }
.t-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent); font-weight: 600; }
.t-row:last-child { border-bottom: 0; }
.t-row .p { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.t-row .p small { font-size: 13px; color: var(--muted); font-weight: 600; }
.perks { display: flex; flex-wrap: wrap; gap: 8px; }
.perk { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.t-note { font-size: 13px; color: var(--muted); }
.t-window { font-size: 22px; font-weight: 800; text-align: center; }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .kpi .value { font-size: 24px; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .nav { padding: 8px 14px; }
  details.shift > summary { grid-template-columns: 1fr auto; }
  th, td { padding: 8px 8px; }
}
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f4f6; --text: #111; --muted: #555; --line: #ccc; --page-bg: #fff; --title-grad: linear-gradient(#111, #111); }
  .topbar, .nav, .btn, .chips, .demo-banner { display: none !important; }
  .card, .kpi, .tariff { box-shadow: none !important; }
}

/* ---------- диалоги ---------- */
dialog.modal { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); padding: 22px; width: min(440px, 92vw); box-shadow: var(--shadow), 0 0 40px color-mix(in srgb, var(--accent) 18%, transparent); }
dialog.modal::backdrop { background: rgba(3, 4, 10, .7); backdrop-filter: blur(3px); }
dialog.modal h2 { margin-bottom: 8px; }
dialog.modal p { margin: 0 0 14px; }
.row.end { justify-content: flex-end; margin-top: 14px; }
.btn.danger-bg { background: linear-gradient(135deg, #ff5468, #d6203b); color: #fff; box-shadow: none; }

/* ---------- QR, резервные коды ---------- */
.qr { border-radius: 10px; background: #fff; padding: 6px; max-width: 100%; height: auto; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 8px; font: 16px ui-monospace, Menlo, monospace; }
.codes span { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; text-align: center; user-select: all; }
.setup-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); align-items: start; }

/* ---------- главная: «сейчас на смене» ---------- */
.hero { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.hero .card { display: grid; gap: 6px; }
.hero .big { font-size: 22px; font-weight: 800; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); margin-right: 8px; animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } * { scroll-behavior: auto !important; } }
.glossary dt { font-weight: 700; margin-top: 8px; }
.glossary dd { margin: 2px 0 0; color: var(--muted); }
.loading { color: var(--muted); padding: 30px; text-align: center; }
.strength { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.strength i { display: block; height: 100%; width: 0; transition: width .2s; background: var(--bad); }
.strength.s2 i { background: var(--warn); } .strength.s3 i { background: var(--ok); }

/* ---------- график смен ---------- */
.sched-head + .notice:empty, .sched-slot-empty:empty { display: none; }
.sched-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.sched { display: grid; gap: 8px; }
.sched-day { display: grid; grid-template-columns: 78px 1fr 1fr; gap: 8px; align-items: stretch; }
.sched-date { display: grid; align-content: center; padding: 6px 8px; border-radius: 10px; background: var(--surface-2); text-align: center; font-weight: 700; line-height: 1.2; }
.sched-date small { color: var(--muted); font-weight: 600; text-transform: uppercase; }
.sched-date.weekend { color: var(--orange); }
.sched-date.today { outline: 2px solid var(--accent); }
.slot { text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); padding: 8px 10px; min-height: 58px; font: inherit; cursor: pointer; display: grid; gap: 4px; align-content: start; }
.slot:disabled { cursor: default; opacity: .75; }
.slot:hover:not(:disabled) { border-color: var(--accent); }
.slot .k { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.slot.taken { border-color: color-mix(in srgb, var(--orange) 60%, transparent); background: color-mix(in srgb, var(--orange) 8%, var(--surface)); }
.slot.mine { box-shadow: 0 0 0 2px var(--accent) inset; }
.slot.past { opacity: .65; }
.slot.want { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--surface)); }
.slot.avoid { border-color: var(--line); background: var(--surface-2); }
.mark { font-weight: 800; font-size: 15px; }
.mark.want { color: var(--green); }
.mark.avoid { color: var(--muted); }
.mark.ok { color: var(--accent); }
.who { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tag.set { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.tag.want { border-color: var(--green); color: var(--green); }
.tag.avoid { border-color: var(--line); color: var(--muted); text-decoration: line-through; }
.tag.me { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 60%, transparent); }
.free { color: var(--muted); font-size: 13px; }

/* ---------- телефон: нижнее меню, таблицы-карточки, крупные кнопки ---------- */
@media (max-width: 640px) {
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 2px; justify-content: space-around; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); border-bottom: 0; overflow-x: auto; overflow-y: hidden; justify-content: flex-start; scrollbar-width: none; overscroll-behavior-x: contain; }
  .nav::-webkit-scrollbar { display: none; }
  /* пунктов больше, чем влезает: меню листается в стороны само, а не раздувает страницу */
  .nav a { display: grid; gap: 1px; justify-items: center; padding: 6px 2px; font-size: 10.5px; border-radius: 12px; flex: 1 1 0; min-width: 52px; text-align: center; overflow: hidden; text-overflow: ellipsis; }
  .nav a .ico { font-size: 20px; line-height: 1; }
  .nav a.active { box-shadow: none; }
  .page { padding-bottom: 110px; }
  .btn { min-height: 44px; } .btn.small { min-height: 36px; }
  input, select, textarea { min-height: 46px; font-size: 16px; }
  .chip { min-height: 40px; display: inline-flex; align-items: center; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  table.stack td { display: flex; justify-content: space-between; gap: 14px; border: 0; padding: 5px 0; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; max-width: 45%; }
  table.stack td:empty { display: none; }
  table.stack td.num { text-align: right; }
  .sched-day { grid-template-columns: 1fr 1fr; }
  .sched-date { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; gap: 8px; text-align: left; padding: 4px 10px; }
  .demo-banner { font-size: 12px; padding: 5px 14px; }
}

.nav a { display: inline-flex; align-items: center; gap: 8px; }
.nav a .ico { font-size: 16px; }
@media (max-width: 640px) { .nav a { display: grid; } .nav a.desk-only { display: none; } }

@media (max-width: 640px) { .topbar { flex-wrap: nowrap; gap: 8px; } .topbar .userlabel { display: none; } .brand-sub { letter-spacing: .25em; } }

/* ---- склад: приход и инвентаризация ---- */
dialog.modal.wide { width: min(920px, 96vw); max-height: 92vh; overflow: auto; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumbs figure { margin: 0; display: grid; gap: 4px; justify-items: center; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; background: var(--surface-2); }
img.photo-full { max-width: 100%; max-height: 78vh; display: block; margin: 0 auto 12px; border-radius: 10px; }
.lines-edit { display: grid; gap: 8px; }
.lines-edit .line { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.lines-edit .line .sum { text-align: right; font-variant-numeric: tabular-nums; min-width: 84px; }
.count-input { width: 110px; text-align: right; }
tr.diff-bad td { background: color-mix(in srgb, var(--bad) 9%, transparent); }
@media (max-width: 640px) {
  .lines-edit .line { grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
  .lines-edit .line > :first-child { grid-column: 1 / -1; }
  .count-input { width: 96px; }
}

/* ---- вкладки и раскрывающиеся блоки ---- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.tab { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 8px 14px; border-radius: 99px; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { background: linear-gradient(135deg, var(--orange), #ff4d2e); color: #120a05; border-color: transparent; }
.tab-badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; }
.tab-panels { margin-top: 14px; }
.tab-panel[hidden] { display: none; }
details.fold { padding: 0; }
details.fold > summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-weight: 800; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '▸'; color: var(--orange); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold .fold-body { padding: 0 18px 18px; }
.single-day { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }

/* ---- печать бланка инвентаризации ---- */
.print-sheet { display: none; }
@media print {
  body.print-sheet-mode > *:not(.print-sheet) { display: none !important; }
  body.print-sheet-mode dialog { display: none !important; }
  body.print-sheet-mode .print-sheet { display: block; color: #000; background: #fff; font: 12pt/1.3 system-ui, sans-serif; }
  body.print-sheet-mode { background: #fff; }
  .print-sheet h1 { font-size: 16pt; margin: 0 0 6pt; }
  .print-sheet h2 { font-size: 12pt; margin: 12pt 0 4pt; }
  .print-sheet table { width: 100%; border-collapse: collapse; page-break-inside: auto; }
  .print-sheet tr { page-break-inside: avoid; }
  .print-sheet th, .print-sheet td { border: 1px solid #000; padding: 4pt 6pt; text-align: left; }
  .print-sheet td.blank { width: 22%; height: 18pt; }
}

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input[type="checkbox"] { width: auto; margin-top: 3px; }

/* очень узкие телефоны (320–380 px): компактная шапка и поля, чтобы ничего не выступало за экран */
@media (max-width: 380px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .brand { gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-name { font-size: 18px; }
  .brand-sub { letter-spacing: .18em; font-size: 9px; }
  .topbar .btn.small { padding-left: 10px; padding-right: 10px; }
  .page { padding-left: 12px; padding-right: 12px; }
}

/* обновление данных касс в шапке */
.sync-chip { display: inline-flex; align-items: center; gap: 8px; }
.sync-chip .sync-label { white-space: nowrap; }
@media (max-width: 640px) { .sync-chip .sync-label { display: none; } }
.break-all { word-break: break-all; overflow-wrap: anywhere; }

/* инвентаризация на телефоне: поиск, прогресс и кнопки всегда под рукой; строки скрываются фильтром без перерисовки */
[hidden] { display: none !important; }
.inv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: sticky; top: -22px; z-index: 3; padding: 10px 0; background: var(--surface); }
.inv-search { flex: 1 1 200px; min-width: 0; }
.inv-progress { font-weight: 700; }
.sticky-actions { position: sticky; bottom: -22px; z-index: 3; background: var(--surface); padding: 12px 0 4px; margin-top: 12px; border-top: 1px solid var(--line); }

/* подсчёт на телефоне: компактная строка — товар, остаток и короткая заметка (единица измерения — рядом с названием) */
@media (max-width: 640px) {
  .count-table table.stack tr { padding: 6px 10px; margin-bottom: 6px; }
  .count-table table.stack td { padding: 2px 0; align-items: center; }
  .count-table table.stack td:nth-child(2) { display: none; }
  .count-table table.stack td:nth-child(1)::before { display: none; }
  .count-table table.stack td:nth-child(1) { justify-content: flex-start; text-align: left; font-weight: 600; }
  .count-table table.stack td input:not(.count-input) { width: 100%; min-width: 0; }
}

/* ---- Главная: деньги крупно, нал и безнал рядом ---- */
.hero.hero-money { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: stretch; }
@media (max-width: 860px) { .hero.hero-money { grid-template-columns: minmax(0, 1fr); } }
.hero-money .card, .period-money { display: grid; gap: 14px; align-content: start; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.now-clock { display: flex; align-items: baseline; gap: 10px; }
.clock-time { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.clock-date { color: var(--muted); font-size: 15px; font-weight: 600; }
.money { display: grid; gap: 12px; }
.money-total { font-size: clamp(34px, 8vw, 46px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.02; letter-spacing: -.01em; }
.money-big .money-total { font-size: clamp(40px, 10vw, 64px); }
.split-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.split { --c: var(--cash); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 11%, var(--surface)); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.split.noncash { --c: var(--noncash); }
.split-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.split-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); flex: none; }
.split-share { margin-left: auto; color: var(--c); }
.split-value { font-size: clamp(22px, 5.5vw, 30px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: 4px; }
.split-note { font-size: 12px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.split-bar { width: 100%; height: 8px; border-radius: 99px; display: block; overflow: hidden; background: var(--surface-2); }
.sb-cash { fill: var(--cash); } .sb-noncash { fill: var(--noncash); }
.who { margin-top: -4px; }
@media (max-width: 420px) { .brand-sub { display: none; } .brand-logo { width: 36px; height: 36px; } .clock-time { font-size: 24px; } .split { padding: 10px 11px; } }

.badge-group { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.form-note { grid-column: 1 / -1; margin: 0; }

.recent { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.recent-row { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 12px; align-items: baseline; color: inherit; text-decoration: none; padding: 4px 2px; border-radius: 8px; }
.recent-row:hover { background: var(--surface-2); }
.recent-row .muted { justify-self: end; text-align: right; }
.kind-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kind-chip { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.kind-chip strong { font-size: 20px; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .kind-chips { grid-template-columns: 1fr; } .recent-row { grid-template-columns: 1fr auto; } .recent-row .muted { grid-column: 1 / -1; justify-self: start; text-align: left; } }

/* Идеи и акции */
.idea > summary { list-style: none; cursor: pointer; }
.idea > summary::-webkit-details-marker { display: none; }
.idea-head { display: grid; gap: 8px; }
.idea-head h3 { margin: 0; }
.idea-summary { margin: 0; color: var(--muted); }
.idea-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.idea-body h4 { margin: 0 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.idea-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.idea[open] { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.idea-go { border-left: 4px solid var(--ok); } .idea-test { border-left: 4px solid var(--warn); } .idea-no { border-left: 4px solid var(--bad); } .idea-need_data { border-left: 4px solid var(--line); }
.promo { display: grid; gap: 10px; } .promo h3 { margin: 0; } .promo-closed { opacity: .8; }

.tg-alert { text-decoration: none; margin-right: 8px; white-space: nowrap; }
.sync-chip .tg-alert[hidden] { display: none; }
