/* GastroFeedback design system — единые токены для гостевой части и кабинета */
:root {
  --brand: #0F766E; --brand-ink: #fff; --accent: #F59E0B;
  --bg: #F6F7F9; --surface: #FFFFFF; --surface-2: #F1F3F5; --border: #E4E7EB;
  --text: #111827; --text-2: #4B5563; --muted: #6B7280;
  --pos: #16A34A; --pos-bg: #DCFCE7; --neu: #B45309; --neu-bg: #FEF3C7; --neg: #DC2626; --neg-bg: #FEE2E2;
  --info: #2563EB; --info-bg: #DBEAFE;
  --radius: 14px; --radius-sm: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --tap: 48px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0B0F14; --surface: #121821; --surface-2: #1A2230; --border: #263142;
  --text: #E8ECF1; --text-2: #B8C1CC; --muted: #8B96A5;
  --pos-bg: #0F2E1C; --neu-bg: #33260B; --neg-bg: #3A1414; --info-bg: #13233F;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.hidden { display: none !important; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-danger { color: var(--neg); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: .875rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search],
select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; }
textarea { min-height: 96px; resize: vertical; }
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
input[type=color] { width: 56px; height: 40px; border: 1px solid var(--border); border-radius: 8px; background: none; padding: 2px; }

/* ---------- cards / badges ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.b-positive, .b-resolved, .b-processed { background: var(--pos-bg); color: var(--pos); }
.b-neutral, .b-in_progress, .b-mixed { background: var(--neu-bg); color: var(--neu); }
.b-negative, .b-new-inc, .b-overdue { background: var(--neg-bg); color: var(--neg); }
.b-new { background: var(--info-bg); color: var(--info); }
.b-closed { background: var(--surface-2); color: var(--muted); }
.b-demo { background: #EDE9FE; color: #6D28D9; }
.stars { color: #F59E0B; letter-spacing: 1px; white-space: nowrap; }
.stars-off { color: var(--border); }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-bg); color: var(--text); border: 1px solid transparent; }
.alert-warn { background: var(--neu-bg); } .alert-danger { background: var(--neg-bg); } .alert-ok { background: var(--pos-bg); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.lowdata { font-size: .78rem; color: var(--neu); font-weight: 600; }

/* ---------- language switch ---------- */
.lang-switch { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; border: 1px solid var(--border); }
.lang-switch a { padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: .85rem; color: var(--text-2); text-decoration: none; min-width: 44px; text-align: center; }
.lang-switch a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* =================== GUEST =================== */
.guest { max-width: 560px; margin: 0 auto; padding: 0 0 120px; min-height: 100vh; }
.g-head { background: var(--brand); color: var(--brand-ink); padding: 14px 16px 26px; border-radius: 0 0 24px 24px; }
.g-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.g-venue { display: flex; align-items: center; gap: 10px; min-width: 0; }
.g-logo { width: 44px; height: 44px; border-radius: 12px; background: #fff; object-fit: contain; padding: 3px; flex: none; }
.g-name { font-weight: 800; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-table { font-size: .85rem; opacity: .9; }
.g-head .lang-switch { background: rgba(255,255,255,.18); border-color: transparent; }
.g-head .lang-switch a { color: #fff; }
.g-head .lang-switch a.on { background: #fff; color: var(--brand); }
.g-welcome { margin: 14px 0 0; opacity: .95; font-size: .95rem; }
.g-body { padding: 0 14px; margin-top: -14px; }
.g-card { background: var(--surface); border-radius: 20px; padding: 18px 16px; box-shadow: 0 4px 18px rgba(16,24,40,.08); margin-bottom: 12px; }
.g-title { font-size: 1.35rem; font-weight: 800; text-align: center; margin: 4px 0 14px; }
.rating { display: flex; justify-content: center; gap: 6px; border: 0; padding: 0; margin: 0; }
.rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating label { cursor: pointer; margin: 0; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; transition: transform .12s; }
.rating label svg { width: 46px; height: 46px; fill: var(--border); transition: fill .12s; }
.rating label.lit svg { fill: #F59E0B; }
.rating input:focus-visible + label { outline: 3px solid var(--brand); }
.rating label:active { transform: scale(.92); }
.rating-face { text-align: center; min-height: 28px; font-weight: 700; margin-top: 8px; color: var(--text-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--border);
  font-weight: 600; font-size: .92rem; background: var(--surface); cursor: pointer; user-select: none; }
.chip input:checked + span { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); }
.chip.neg input:checked + span { border-color: var(--neg); background: var(--neg-bg); color: var(--neg); }
.chip input:focus-visible + span { outline: 3px solid var(--brand); }
.sec-title { font-weight: 700; margin: 4px 0 10px; font-size: .95rem; }
details.more > summary { list-style: none; cursor: pointer; font-weight: 700; color: var(--brand); padding: 10px 0; min-height: var(--tap); display: flex; align-items: center; justify-content: space-between; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "▾"; transition: transform .15s; }
details.more[open] > summary::after { transform: rotate(180deg); }
.cat-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cat-row:last-child { border-bottom: 0; }
.cat-name { font-size: .92rem; font-weight: 600; }
.mini-rating { display: flex; gap: 2px; border: 0; padding: 0; margin: 0; flex: none; }
.mini-rating input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mini-rating label { margin: 0; width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer; }
.mini-rating svg { width: 26px; height: 26px; fill: var(--border); }
.mini-rating label.lit svg { fill: #F59E0B; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo { position: relative; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; }
.photo-btns { display: flex; gap: 8px; }
.photo-btns label { flex: 1; margin: 0; }
.photo-btns .btn { width: 100%; }
.g-submit { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); z-index: 5; }
.g-submit .btn { max-width: 532px; margin: 0 auto; display: flex; min-height: 56px; font-size: 1.1rem; border-radius: 16px; box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 35%, transparent); }
.g-submit .hint { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.g-error { margin-top: 8px; }
.thanks { text-align: center; padding: 48px 20px; }
.thanks .ok { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; background: var(--pos-bg); color: var(--pos); font-size: 44px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.demo-ribbon { background: #6D28D9; color: #fff; text-align: center; font-size: .8rem; padding: 4px; font-weight: 700; }
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =================== OWNER =================== */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.logo { font-weight: 800; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; padding: 6px 10px 14px; color: var(--text); }
.logo i { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); display: inline-grid; place-items: center; color: #fff; font-style: normal; font-size: 15px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; text-decoration: none; position: relative; }
.nav a svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); }
.nav .count { margin-left: auto; background: var(--neg); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 7px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: .85rem; }
.main { padding: 20px 24px 40px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.topbar h1 { margin: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--text); position: relative; }
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--neg); color: #fff; font-size: .7rem; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.mobile-nav { display: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select, .filters input { width: auto; min-height: 38px; padding: 6px 10px; font-size: .9rem; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg a { padding: 6px 10px; border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--text-2); text-decoration: none; }
.seg a.on { background: var(--brand); color: #fff; }
.kpi { padding: 14px 16px; }
.kpi .lbl { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.kpi .val { font-size: 1.8rem; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .82rem; color: var(--muted); }
.up { color: var(--pos); } .down { color: var(--neg); }
.kpi.alarm { border-color: var(--neg); }
.split { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--surface-2); margin: 10px 0 6px; }
.split span { display: block; }
.s-pos { background: var(--pos); } .s-neu { background: #F59E0B; } .s-neg { background: var(--neg); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 44px; gap: 10px; align-items: center; font-size: .9rem; }
.bar { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar.neg i { background: var(--neg); } .bar.pos i { background: var(--pos); }
.bar-row .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 600; }
svg.chart-line, svg.chart-cols { width: 100%; height: auto; display: block; overflow: visible; }
.chart-line .grid { stroke: var(--border); stroke-width: 1; }
.chart-line .axis, .chart-cols .axis { fill: var(--muted); font-size: 11px; }
.chart-line .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-line .dot { fill: var(--brand); }
.chart-line .bar-bg { fill: color-mix(in srgb, var(--brand) 18%, transparent); }
.chart-cols .col { fill: color-mix(in srgb, var(--brand) 70%, transparent); }
.chart-cols .col.hl { fill: var(--neg); }
.chart-cols .val { fill: var(--text-2); font-size: 10px; font-weight: 700; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: .72rem; width: 100%; }
.heat td { height: 22px; border-radius: 4px; text-align: center; color: var(--text); min-width: 18px; }
.heat th { color: var(--muted); font-weight: 600; }
.h0 { background: var(--surface-2); } .h1 { background: #FECACA; } .h2 { background: #FCA5A5; } .h3 { background: #F87171; color: #fff !important; } .h4 { background: #DC2626; color: #fff !important; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.rv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.rv:hover { background: var(--surface-2); }
.rv:last-child { border-bottom: 0; }
.rv .meta { font-size: .82rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rv .txt { grid-column: 1 / -1; color: var(--text); font-size: .95rem; overflow-wrap: anywhere; }
.rv .tags { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.list { padding: 0; overflow: hidden; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--border); position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--brand); border-color: var(--brand); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.qr-item { text-align: center; padding: 12px; }
.qr-item img { width: 132px; height: 132px; background: #fff; border-radius: 8px; }
.qr-item .num { font-weight: 800; font-size: 1.05rem; }
.qr-item.off { opacity: .55; }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: 360px; background: var(--surface); border: 1px solid var(--neg); border-left: 5px solid var(--neg); border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.flash { margin-bottom: 14px; }
.auth { max-width: 440px; margin: 6vh auto; padding: 0 16px; }
.auth .card { padding: 24px; }
.landing { max-width: 920px; margin: 0 auto; padding: 48px 20px; }
.hero h1 { font-size: 2.2rem; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 12px 92px; }
  .mobile-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
  .mobile-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: .68rem; font-weight: 600; color: var(--muted); text-decoration: none; position: relative; }
  .mobile-nav a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-nav a.on { color: var(--brand); }
  .mobile-nav .count { position: absolute; top: 4px; left: 54%; background: var(--neg); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 5px; }
  .kpi .val { font-size: 1.45rem; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .bar-row { grid-template-columns: minmax(90px, 42%) 1fr 36px; }
  .toast { left: 12px; right: 12px; bottom: 76px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .side, .mobile-nav, .filters, .topbar .row { display: none !important; } .app { display: block; } }
