/* Food Good Ratings — quiet app-style dashboard. Brand yellow is the accent; data colours are separate. */
:root {
  --bg: #F5F4F0; --card: #FFFFFF; --line: #E6E3DB; --ink: #16150F; --ink2: #5E5B52; --ink3: #8B877C;
  --accent: #FFC416; --accent-ink: #16150F;
  --pos: #D8D4C7; --neg: #C8372D; --good: #1E7A3C; --bad: #B3261E;
  --wolt: #0B84C6; --glovo: #C77700; --bolt: #12936A;
  --r: 14px; --gap: 14px;
  --font: Inter, "Noto Sans Georgian", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
h2 { font-size: 14px; font-weight: 600; margin: 0; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.bar-in, .filters-in, .wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.bar-in { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { display: flex; align-items: baseline; gap: 8px; flex: none; }
.brand-mark { font-family: "Arial Narrow", "Helvetica Neue", Helvetica, Arial, sans-serif; font-stretch: condensed; font-weight: 800; font-size: 20px; letter-spacing: 0.02em; }
.brand-sub { font-size: 13px; color: var(--ink2); font-weight: 500; }
.tabs { display: flex; gap: 4px; flex: 1; min-width: 0; height: 100%; }
.tabs .tab-link { display: flex; align-items: center; padding: 0 12px; font-weight: 500; color: var(--ink2); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; white-space: nowrap; }
.tabs .tab-link:hover { color: var(--ink); }
.tabs .tab-link.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* segmented + chips */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 2px; flex: none; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 500; color: var(--ink2); cursor: pointer; transition: background .15s, color .15s; min-height: 32px; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.lang button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.filters { border-top: 1px solid var(--line); }
.filters-in { display: flex; align-items: center; gap: 10px; padding-top: 8px; padding-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.filters-in::-webkit-scrollbar { display: none; }
.chips { display: inline-flex; gap: 6px; flex: none; }
.chips button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-weight: 500; color: var(--ink2); cursor: pointer; min-height: 34px; white-space: nowrap; transition: background .15s, color .15s, border-color .15s; display: inline-flex; align-items: center; gap: 6px; }
.chips button:hover { border-color: var(--ink3); color: var(--ink); }
.chips button.on { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.fresh { margin-left: auto; color: var(--ink3); font-size: 12px; white-space: nowrap; flex: none; padding-left: 8px; }

/* layout */
.wrap { padding-top: 18px; padding-bottom: 40px; }
.tab { display: flex; flex-direction: column; gap: var(--gap); animation: rise .28s ease both; }
.tab[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cols { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.cols.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sub, .hint { color: var(--ink3); font-size: 12px; margin: 0; }
.state, .empty { color: var(--ink2); margin: 24px 0; }
.empty { margin: 4px 0; font-size: 13px; }
.foot { color: var(--ink3); font-size: 12px; margin: 22px 0 0; max-width: 80ch; }
.scroll { overflow-x: auto; }

/* day strip */
.day-strip { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink2); font-size: 13px; }
.day-strip b { color: var(--ink); font-weight: 600; }
.day-strip .tag-neg { color: var(--bad); font-weight: 600; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: end; min-width: 0; }
.kpi-label { grid-column: 1 / -1; color: var(--ink2); font-size: 12px; font-weight: 500; }
.kpi-num { font-size: 30px; line-height: 1.05; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-spark { width: 84px; height: 30px; }
.kpi-spark path { fill: none; stroke: var(--ink3); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.kpi-delta { grid-column: 1 / -1; font-size: 12px; color: var(--ink3); font-variant-numeric: tabular-nums; }
.delta { font-weight: 600; margin-right: 4px; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--ink2); }

/* charts */
.chart-box { position: relative; height: 280px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend b { font-weight: 500; }

/* findings */
.findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.findings li { padding: 10px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 6px 1fr; gap: 10px; font-size: 13px; color: var(--ink2); }
.findings li:first-child { border-top: 0; padding-top: 0; }
.findings li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 7px; }
.findings li.warn::before { background: var(--neg); }
.findings li.ok::before { background: var(--good); }
.findings b { color: var(--ink); font-weight: 600; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink3); padding: 0 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.pname { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.mini-bar { display: inline-block; width: 64px; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.mini-bar i { display: block; height: 100%; background: var(--neg); border-radius: 3px; transition: width .4s ease; }
.matrix th, .matrix td { padding: 6px; border: 0; }
.matrix th { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: 0; font-weight: 600; white-space: nowrap; }
.cell { border-radius: 10px; padding: 10px 8px; text-align: center; min-width: 92px; background: var(--bg); transition: background .3s; }
.cell-v { font-size: 18px; font-weight: 700; display: block; line-height: 1.2; }
.cell-s { font-size: 11px; color: var(--ink2); display: block; }
.cell.none { color: var(--ink3); background: transparent; border: 1px dashed var(--line); }

/* bar lists */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.bar-row .track { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 4px; min-width: 2px; transition: width .45s ease; }
.bar-row .val { font-weight: 600; white-space: nowrap; }
.bar-row .val small { font-weight: 400; color: var(--ink3); font-size: 12px; margin-left: 4px; }
.bar-row .lbl small { color: var(--ink3); font-size: 12px; margin-left: 4px; }

/* rating mix */
.mixes { display: flex; flex-direction: column; gap: 16px; }
.mix-h { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.mix-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--card); }
.mix-bar span { display: block; height: 100%; min-width: 2px; transition: flex-basis .4s ease; }
.mix-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.mix-key span { display: inline-flex; align-items: center; gap: 5px; }
.mix-key i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* reviews */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.search { flex: 1 1 220px; max-width: 360px; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 12px; min-height: 40px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 36px; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.reviews { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--gap); }
.review { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.review-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink3); }
.review-top .who { color: var(--ink); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.review-top .when { margin-left: auto; white-space: nowrap; }
.score { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: #FBE9E7; color: var(--bad); font-weight: 600; font-size: 12px; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: var(--bg); border-radius: 6px; padding: 2px 8px; font-size: 12px; color: var(--ink2); }
.tag.down { background: #FBE9E7; color: var(--bad); }
.review p { margin: 0; overflow-wrap: anywhere; }
.more { align-self: center; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 18px; font-weight: 600; cursor: pointer; min-height: 40px; }
.more:hover { border-color: var(--ink3); }

/* bottom nav (phones) */
.bottom { display: none; }

@media (max-width: 860px) {
  .tabs { display: none; }
  .bar-in { height: 50px; justify-content: space-between; }
  .bottom { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottom .tab-link { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 11px; font-weight: 500; color: var(--ink3); min-width: 0; }
  .bottom .tab-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .bottom svg { width: 22px; height: 22px; fill: currentColor; }
  .bottom .tab-link.on { color: var(--ink); }
  .bottom .tab-link.on svg { fill: var(--ink); filter: drop-shadow(0 2px 0 var(--accent)); }
  .wrap { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); padding-top: 14px; }
  .cols, .cols.even { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi-num { font-size: 24px; }
  .kpi-spark { width: 56px; height: 24px; }
  .chart-box { height: 230px; }
  .card { padding: 14px; }
  .fresh { display: none; }
  :root { --gap: 10px; }
  .matrix { table-layout: fixed; }
  .matrix th:first-child, .matrix td:first-child { width: 78px; white-space: normal; font-size: 13px; }
  .matrix th:last-child, .matrix td:last-child { display: none; }
  .matrix th, .matrix td { padding: 3px; }
  .cell { min-width: 0; padding: 8px 2px; }
  .cell-v { font-size: 15px; }
  .cell-s { font-size: 10px; }
  .reviews { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .tab { animation: none; }
  * { transition: none !important; }
}

/* sign-in */
body.signed-out .bar, body.signed-out .wrap, body.signed-out .bottom { display: none; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth[hidden] { display: none; }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: baseline; gap: 8px; }
.auth-brand .brand-mark { font-size: 26px; }
.auth-card h1 { font-size: 18px; margin: 4px 0 0; }
.auth-lang { align-self: center; margin-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink2); border: 0; padding: 0; margin: 0; min-width: 0; }
.field[hidden], .check[hidden] { display: none; }
.field legend { padding: 0; margin-bottom: 6px; }
.field input, .field select { border: 1px solid var(--line); background: #FFFFFF; border-radius: 10px; padding: 10px 12px; min-height: 42px; font-size: 16px; color: var(--ink); width: 100%; }
.field input:focus, .field select:focus, .search:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--ink); }
.primary { border: 0; background: var(--ink); color: #FFFFFF; border-radius: 10px; padding: 12px 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.primary:hover { background: #2B2A22; }
.primary:disabled { opacity: 0.6; cursor: default; }
.primary.small { padding: 8px 14px; min-height: 38px; margin-left: auto; }
.ghost { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer; min-height: 40px; white-space: nowrap; }
.ghost:hover { border-color: var(--ink3); }
.ghost[hidden] { display: none; }
.danger { color: var(--bad); }
.form-error { margin: 0; color: var(--bad); font-size: 13px; }
.form-error.ok { color: var(--good); }

/* account + dialogs */
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--ink); color: #FFFFFF; font-weight: 700; cursor: pointer; flex: none; }
.sheet { border: 0; padding: 0; border-radius: 18px; width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.sheet::backdrop { background: rgba(22, 21, 15, 0.45); }
.sheet-in { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.sheet-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-h b { font-size: 16px; display: block; }
.x { border: 0; background: var(--bg); width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; flex: none; }
.sheet-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.sheet-row.col { flex-direction: column; align-items: stretch; }
.sheet-row .hint { margin-top: 2px; }
.sheet-link { font-weight: 600; padding-top: 14px; border-top: 1px solid var(--line); text-decoration: underline; text-underline-offset: 3px; }
.sheet-link[hidden], .tab-link[hidden] { display: none; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.link { border: 0; background: none; padding: 4px 0; margin-left: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.actions { white-space: nowrap; }
.filters[hidden] { display: none; }
#tab-users .toolbar h2 { font-size: 16px; }
@media (max-width: 860px) {
  .bar-in { gap: 10px; }
  .bar-in .lang { margin-left: auto; }
  .brand-sub { display: none; }
}

/* order popup */
.review { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.review:hover, .review:focus-visible { border-color: var(--ink3); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06); }
.open-order { margin-top: auto; align-self: flex-end; font-size: 12px; font-weight: 600; color: var(--ink2); }
.od-body { display: flex; flex-direction: column; gap: 10px; }
.od-body h3 { font-size: 12px; font-weight: 600; color: var(--ink3); margin: 6px 0 0; text-transform: uppercase; letter-spacing: 0.04em; }
.od-items { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; }
.od-items li { padding: 9px 12px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.od-items li:first-child { border-top: 0; }
.od-comment { margin: 0; overflow-wrap: anywhere; }
.od-row { display: flex; gap: 8px; align-items: center; }
#order-dialog { width: min(480px, calc(100vw - 24px)); }
#order-dialog .sub { display: block; margin-top: 2px; }

/* products */
.products tbody tr { cursor: pointer; transition: background .15s; }
.products tbody tr:hover, .products tbody tr:focus-visible { background: var(--bg); }
.products .p-name { font-weight: 600; overflow-wrap: anywhere; min-width: 150px; }
.products small { color: var(--ink3); font-size: 12px; }
.products .mini-bar { width: 90px; }
.pcount { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-variant-numeric: tabular-nums; }
#product-dialog { width: min(560px, calc(100vw - 24px)); }
#product-dialog .sub { display: block; margin-top: 2px; }
.pd-body { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 62vh; padding-right: 2px; }
.pd-body .review p.sub { color: var(--ink2); }
#tab-products .more { margin-top: 4px; }
@media (max-width: 860px) {
  .bottom { grid-template-columns: repeat(5, 1fr); }
  .hide-s { display: none; }
  .products .mini-bar { width: 44px; }
  .products .p-name { min-width: 0; }
}

.products .p-avg { white-space: nowrap; }
.products .avg { font-size: 15px; }
.products .avg.good { color: var(--good); }
.products .avg.bad { color: var(--bad); }
.products .avg.flat { color: var(--ink); }
#tab-products .toolbar .seg { overflow-x: auto; max-width: 100%; }

.subtabs { align-self: flex-start; max-width: 100%; overflow-x: auto; }
.subtabs button { padding: 8px 16px; min-height: 38px; }
.subtabs button.on { background: var(--ink); color: #FFFFFF; box-shadow: none; }
