/* Microsoft's look: Windows shows its own Segoe UI; every other device gets Selawik, Microsoft's free stand-in for it,
   served with the app (static/duka/fonts, SIL Open Font License) so it works without internet. */
@font-face { font-family: "Selawik"; font-weight: 400; font-display: swap; src: url("fonts/selawik-regular.c1aa8c51674c.woff2") format("woff2"); }
@font-face { font-family: "Selawik"; font-weight: 600; font-display: swap; src: url("fonts/selawik-semibold.17eab24cc0c2.woff2") format("woff2"); }
@font-face { font-family: "Selawik"; font-weight: 700; font-display: swap; src: url("fonts/selawik-bold.685fb6280fec.woff2") format("woff2"); }

/* Calm, light surfaces; one deep green for actions and the headline figure; warm amber for what needs a look. */
:root {
  --brand: #1f5c45;
  --brand-dark: #174a37;
  --brand-soft: #edf3ef;
  --brand-mid: #5f9b80;
  --brand-light: #a9cbb9;
  --ink: #1c2420;
  --muted: #6b736e;
  --faint: #98a09b;
  --line: #e6e6e0;
  --bg: #f7f7f3;
  --card: #ffffff;
  --warn: #9a5a06;
  --warn-soft: #fcf4e4;
  --warn-line: #f0dcb2;
  --bad: #b42318;
  --bad-soft: #fcefed;
  --bad-line: #f3cbc5;
  --good: #2b6a4d;
  --good-soft: #eaf3ed;
  --link: #1f5c45;          /* green as text: links, selected icons */
  --brand-ink: #174a37;     /* text on the soft green */
  --brand-line: #cfe0d6;
  --on-brand: #ffffff;
  --field: #ffffff;         /* inputs, light buttons */
  --sunken: #fafaf7;        /* table headers, order lines */
  --line-strong: #d6d8d2;
  --good-line: #a6e0c3;
  --topbar: rgba(255,255,255,.92);
  --scrim: rgba(20,30,25,.35);
  --shadow-sm: 0 1px 2px rgba(28,36,32,.04);
  --shadow-md: 0 6px 18px rgba(28,36,32,.07);
  --shadow-lg: 0 12px 32px rgba(28,36,32,.14);
  --radius: 12px;
  --sidebar: 236px;
  color-scheme: light;
}

/* Dark: its own steps, not an inversion. Surfaces get lighter as they come forward; green for text is lifted so
   it reads on the dark surface, while buttons keep a deeper green under white text. Screens only: print stays light. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #2a6e52; --brand-dark: #235d45; --brand-soft: #1c2f27; --brand-mid: #4d9677; --brand-light: #93c9ad;
    --link: #8fd1ad; --brand-ink: #bfe6d0; --brand-line: #2d4a3d;
    --ink: #e9eeeb; --muted: #a9b3ad; --faint: #7f8a84; --line: #2b3531; --line-strong: #3b4842;
    --bg: #131917; --card: #1a211e; --field: #212925; --sunken: #1f2723;
    --warn: #e6b35f; --warn-soft: #2c2619; --warn-line: #4f4022;
    --bad: #f1938a; --bad-soft: #301f1d; --bad-line: #5b332e;
    --good: #82cfa8; --good-soft: #1b3027; --good-line: #2f5545;
    --topbar: rgba(26,33,30,.9); --scrim: rgba(0,0,0,.55);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.025);
    --shadow-md: 0 8px 22px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.03);
    --shadow-lg: 0 14px 36px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
@media screen {
  :root[data-theme="dark"] {
    --brand: #2a6e52; --brand-dark: #235d45; --brand-soft: #1c2f27; --brand-mid: #4d9677; --brand-light: #93c9ad;
    --link: #8fd1ad; --brand-ink: #bfe6d0; --brand-line: #2d4a3d;
    --ink: #e9eeeb; --muted: #a9b3ad; --faint: #7f8a84; --line: #2b3531; --line-strong: #3b4842;
    --bg: #131917; --card: #1a211e; --field: #212925; --sunken: #1f2723;
    --warn: #e6b35f; --warn-soft: #2c2619; --warn-line: #4f4022;
    --bad: #f1938a; --bad-soft: #301f1d; --bad-line: #5b332e;
    --good: #82cfa8; --good-soft: #1b3027; --good-line: #2f5545;
    --topbar: rgba(26,33,30,.9); --scrim: rgba(0,0,0,.55);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.025);
    --shadow-md: 0 8px 22px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.03);
    --shadow-lg: 0 14px 36px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14.5px/1.55 "Segoe UI Variable Text", "Segoe UI", "Selawik", sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-family: "Segoe UI Variable Display", "Segoe UI", "Selawik", sans-serif; font-size: 1.8rem; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .3rem; }
h2 { font-size: 1.02rem; font-weight: 600; letter-spacing: 0; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.icon { flex: none; vertical-align: -3px; }

/* ---------- the shell: sidebar on the left, top bar and page on the right ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar); flex: none; overflow-y: auto;
  display: flex; flex-direction: column; gap: .75rem;
  background: var(--card); border-right: 1px solid var(--line); padding: 1.25rem .9rem 1rem;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.logo { display: flex; align-items: center; gap: .6rem; min-width: 0; color: var(--ink); font-weight: 700; font-size: .98rem; line-height: 1.2; }
.logo:hover { text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: var(--on-brand); flex: none; }
.place { display: flex; align-items: center; gap: .5rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; font-size: .85rem; color: var(--muted); }
.place span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-order { margin: .25rem 0 .35rem; }

/* Menu: the main working areas, with secondary screens on their page tabs. */
.nav { display: grid; gap: 1px; }
.nav-section { display: grid; gap: 1px; }
.nav-section + .nav-section { margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--line); }
.nav-heading {
  padding: .95rem .75rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint);
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: .7rem; padding: .5rem .75rem; border-radius: 9px;
  color: var(--ink); font-size: .9rem; font-weight: 500; transition: background .12s, color .12s;
}
.nav-item .icon { color: var(--muted); transition: color .12s; }
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item:hover .icon { color: var(--ink); }
.nav-item.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-item.on .icon { color: var(--link); }
.nav-item.on::before {  /* a small accent bar marks the page that is open */
  content: ""; position: absolute; left: -.9rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center; }
.nav-item.on .count { background: var(--card); }
.rail-btn { width: 32px; height: 32px; flex: none; }
.side-head .close-menu { display: none; flex: none; }
.me { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.me div { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.me strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me span { font-size: .78rem; color: var(--muted); }
.me .me-password { margin-top: .18rem; font-size: .76rem; line-height: 1.25; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: .78rem; font-weight: 700; flex: none; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

.frame { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  background: var(--topbar); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
  padding: .8rem 2rem; min-height: 64px;
}
.crumbs { display: flex; align-items: center; gap: .45rem; flex: 1; min-width: 0; color: var(--muted); font-size: .9rem; }
.crumbs strong { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { position: relative; display: flex; align-items: center; width: min(320px, 32vw); }
.search .icon { position: absolute; left: .75rem; color: var(--faint); }
.search input { width: 100%; height: 40px; padding: 0 3.6rem 0 2.2rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font: inherit; font-size: .88rem; color: var(--ink); }
.search input:focus { outline: 2px solid var(--brand); outline-offset: 0; background: var(--field); }
.search kbd { position: absolute; right: .6rem; font-family: inherit; font-size: .7rem; line-height: 1; color: var(--faint); }
.bell { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted); }
.bell:hover { background: var(--bg); text-decoration: none; }
.bell #bell-count { display: none; }
.bell.hot #bell-count {
  display: grid; place-items: center; position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #e0892b; color: #fff; font-size: .66rem; font-weight: 700;
}
/* The bell's panel: open notifications under the bell, the full page one tap further. */
.bell-wrap { position: relative; }
.bell-panel {
  position: absolute; right: -8px; top: calc(100% + 10px); z-index: 45; width: 380px; max-height: min(70vh, 560px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: bell-in .14s ease-out;
}
.bell-panel[hidden] { display: none; }
@keyframes bell-in { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .bell-panel { animation: none; } }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.bell-head strong { display: flex; align-items: center; gap: .45rem; }
.bell-list { list-style: none; margin: 0; padding: .35rem; overflow-y: auto; }
.bell-list a { display: flex; align-items: flex-start; gap: .7rem; padding: .6rem .65rem; border-radius: 10px; color: var(--ink); }
.bell-list a:hover { background: var(--bg); text-decoration: none; }
.bell-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; background: var(--brand-soft); color: var(--link); }
.bell-text { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.bell-text b { font-size: .88rem; font-weight: 600; }
.bell-text span { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-list time { flex: none; padding-top: .1rem; }
.bell-empty { display: grid; justify-items: center; gap: .3rem; padding: 2rem 1rem; text-align: center; color: var(--muted); }
.bell-empty .icon { color: var(--good); }
.bell-empty strong { color: var(--ink); }
.bell-all { display: flex; align-items: center; justify-content: center; gap: .35rem; padding: .75rem; border-top: 1px solid var(--line); font-size: .86rem; font-weight: 600; }
@media (max-width: 960px) {
  .bell-wrap { position: static; }
  .bell-panel { position: fixed; left: .75rem; right: .75rem; top: 64px; width: auto; max-height: calc(100vh - 170px); }
}
.day-state { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--good); white-space: nowrap; }
.day-state i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.day-state.closed { color: var(--muted); }
.lang { display: inline-flex; gap: .15rem; font-size: .78rem; }
.lang a { padding: .2rem .4rem; border-radius: 6px; color: var(--muted); }
.lang a.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
.main { flex: 1; padding: 2rem; padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px)); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1.4rem; }
.page-head .sub { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .88rem; }
.page-tabs {
  display: flex; gap: .2rem; margin: -.35rem 0 1.4rem; overflow-x: auto;
  border-bottom: 1px solid var(--line); scrollbar-width: thin;
}
.page-tabs a {
  flex: none; padding: .6rem .8rem .55rem; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: .88rem; font-weight: 500;
}
.page-tabs a:hover { color: var(--ink); text-decoration: none; }
.page-tabs a.on { border-bottom-color: var(--brand); color: var(--link); font-weight: 650; }
.scrim { display: none; }

/* The slim menu (computers and tablets): icons only, groups split by thin lines, a page's name on hover. */
@media (min-width: 961px) {
  .rail { --sidebar: 76px; }
  .rail .sidebar { padding: 1.1rem .65rem 1rem; align-items: center; scrollbar-width: none; }
  .rail .side-head { flex-direction: column; gap: .6rem; }
  .rail .logo-text, .rail .place, .rail .nav-label, .rail .me > div { display: none; }
  .rail .btn.new-order { width: 44px; min-height: 44px; padding: 0; }
  .rail .new-order .nav-label { display: none; }
  .rail .nav { width: 100%; }
  .rail .nav-heading { height: 1px; margin: .55rem .5rem; padding: 0; overflow: hidden; background: var(--line); color: transparent; }
  .rail .nav-item { justify-content: center; padding: .62rem; }
  .rail .nav-item.on::before { left: -.65rem; }
  .rail .nav-item > .count {
    position: absolute; top: 2px; right: 2px; min-width: 16px; padding: 0 4px; line-height: 16px; font-size: .62rem;
    background: #e0892b; color: #fff;
  }
  .rail .me { flex-direction: column; gap: .4rem; }
}

/* Phone bottom bar: the places used most, "Oda mpya" raised in the middle, "Zaidi" opening the whole menu. */
.tabbar { display: none; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .25rem 0; border: 0; background: none;
  font: inherit; font-size: .7rem; font-weight: 500; color: var(--muted); cursor: pointer;
}
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.on { color: var(--link); font-weight: 600; }
.tab-icon { display: grid; place-items: center; width: 48px; height: 28px; border-radius: 999px; transition: background .15s; }
.tab.on .tab-icon { background: var(--brand-soft); }
.tab-new .tab-icon {
  width: 52px; height: 52px; margin-top: -24px; border-radius: 50%; border: 4px solid var(--card);
  background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px rgba(0, 0, 0, .2);
}
.tab-new.on .tab-icon { background: var(--brand-dark); }

/* Phones and small tablets: the bottom bar, the search under the top bar, the whole menu sliding in from "Zaidi". */
@media (max-width: 960px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--scrim); }
  .rail-btn { display: none; }
  .side-head .close-menu { display: grid; }
  .topbar { flex-wrap: wrap; padding: .6rem 1rem; gap: .5rem .6rem; }
  .search { display: flex; order: 9; flex-basis: 100%; width: 100%; }
  .search kbd { display: none; }
  .search input { padding-right: .8rem; }
  .main { padding: 1.1rem 1rem calc(96px + env(safe-area-inset-bottom, 0px)); }
  h1 { font-size: 1.45rem; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(5, 1fr);
    padding: .4rem .25rem calc(.4rem + env(safe-area-inset-bottom, 0px));
    background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
  }
  .session-warning { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 520px) { .crumbs > span, .crumbs > .icon, .day-state { display: none; } }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.section-title { font-size: .95rem; margin: 1.2rem 0 .6rem; color: var(--muted); }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font-size: 1.35rem; font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.stat.good .value { color: var(--good); }
.stat.bad .value { color: var(--bad); }
.stat.warn { background: var(--warn-soft); border-color: var(--warn-line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  background: var(--brand); color: var(--on-brand); border: 1px solid var(--brand); border-radius: 10px;
  padding: .6rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 42px;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-ink); text-decoration: none; }
.btn.secondary { background: var(--field); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--bg); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.warn { background: #f0b545; border-color: #f0b545; color: #1c2420; }
.btn.small { padding: .35rem .7rem; min-height: 34px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn.big { font-size: 1.05rem; min-height: 50px; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.input, select, textarea {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--field); min-height: 42px; color: var(--ink);
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[readonly] { background: var(--bg); }
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
.field { margin-bottom: .85rem; }
/* A box you must fill in is marked, so nothing is discovered only when saving fails. The mark follows the
   `required` attribute itself, including where a script switches it on and off, so it can never disagree
   with what the form will actually accept. The sign-in page is left plain: both of its boxes are obvious. */
.field:has(:required) > label::after { content: " *"; color: var(--bad); font-weight: 700; }
body.signin .field > label::after { content: none; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.field .error, .errorlist { color: var(--bad); font-size: .82rem; margin: .2rem 0 0; padding: 0; list-style: none; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.check input { width: 20px; height: 20px; }
.row { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.filters .field { margin: 0; min-width: 130px; flex: 1; }

/* A table wider than the screen scrolls sideways; a soft shadow shows on the side that has more columns. */
.table-wrap {
  overflow-x: auto;
  background:
    linear-gradient(to right, var(--card) 30%, transparent) left center / 28px 100% no-repeat local,
    linear-gradient(to left, var(--card) 30%, transparent) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.18), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.18), transparent) right center / 12px 100% no-repeat scroll;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; background: var(--sunken); }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.low td { background: var(--bad-soft); }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.CANCEL_REQUESTED, .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.CONFIRMED, .badge.good { background: var(--good-soft); color: var(--good); }
.badge.CANCELLED, .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.neutral { background: var(--bg); color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--bad); font-weight: 600; }

.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
.messages li { padding: .7rem 1rem; border-radius: 10px; margin-bottom: .5rem; border: 1px solid; }
.messages .success { background: var(--good-soft); border-color: var(--good-line); color: var(--good); }
.messages .error { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }
.messages .warning { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

.callout { border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; border: 1px solid; }
.callout.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.callout.bad { background: var(--bad-soft); border-color: var(--bad-line); }
.callout.good { background: var(--good-soft); border-color: var(--good-line); }
.session-warning {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 30; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem; box-shadow: var(--shadow-lg);
}
.session-warning[hidden] { display: none; }

/* Bar charts: one bar per row, the value written beside it, the table below holds the detail. */
.bars { display: grid; gap: .45rem; margin: .5rem 0 1rem; }
.bar-row { display: grid; grid-template-columns: minmax(5rem, 9rem) 1fr minmax(4.5rem, auto); align-items: center; gap: .6rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; }
.bar { display: block; height: 100%; min-width: 2px; background: var(--brand); border-radius: 0 4px 4px 0; }
.bar.loss { background: var(--bad); }
.bar-row:hover .bar { background: var(--brand-dark); }
.bar-row:hover .bar.loss { filter: brightness(.85); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; }
td.share { width: 35%; min-width: 5rem; }
td.share .bar-track { display: block; }

/* Printing a page (or saving it as PDF) keeps the content and drops the menus and buttons. */
@media print {
  .topbar, .sidebar, .tabbar, .actions, .filters, .messages, .session-warning, .notice { display: none !important; }
  body { background: #fff; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .card { border-color: #ccc; }
  .table-wrap { overflow: visible; }
  a { color: inherit; }
}

/* drinks in a table cell: one per line, crates lined up on the right */
.items { list-style: none; margin: 0; padding: 0; min-width: 11rem; }
.items li { display: flex; justify-content: space-between; gap: 1rem; padding: .15rem 0; }
.items li + li { border-top: 1px dashed var(--line); }
.items b { font-weight: 600; font-variant-numeric: tabular-nums; }
.line .items { max-width: 22rem; margin: .3rem 0 .5rem; }

/* ---------- sale form ---------- */
.line { border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin-bottom: .6rem; background: var(--sunken); }
.line .row { grid-template-columns: 2fr 1fr 1.2fr; align-items: end; }
.line .price-box { font-variant-numeric: tabular-nums; }
.line .price-box strong { font-size: 1.05rem; }
.line .req { display: none; margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.line.requesting .req { display: grid; }
.line .meta { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; font-size: .82rem; color: var(--muted); }
.link-btn { background: none; border: 0; color: var(--link); font: inherit; font-size: .82rem; cursor: pointer; padding: 0; text-decoration: underline; }
.link-btn.danger { color: var(--bad); }
.grand { display: flex; justify-content: space-between; align-items: center; font-size: 1.15rem; font-weight: 700; padding: .75rem 0; }
@media (max-width: 560px) { .line .row { grid-template-columns: 1fr 1fr; } .line .row > :first-child { grid-column: 1 / -1; } }

/* ---------- sign-in page: one card, centred. A working tool, not a sales page. ---------- */
.signin-main { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--sunken); }
.signin-box { width: 100%; max-width: 384px; }

.signin-brand { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }
.signin-brand .logo-mark {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; background: var(--brand); color: var(--on-brand);
}
.signin-brand strong { display: block; font-size: 1rem; line-height: 1.3; }
.signin-brand span { display: block; font-size: .82rem; color: var(--muted); }

.signin-card { padding: 1.75rem; box-shadow: var(--shadow-md); }
.signin-card h1 { font-size: 1.2rem; margin: 0 0 1.25rem; }
.signin-card .field { margin-bottom: .95rem; }
.signin-card .callout { margin-bottom: 1rem; }

.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: .8rem; color: var(--faint); pointer-events: none; }
.input-icon .input { height: 46px; padding-left: 2.5rem; }
.input-icon .peek {
  position: absolute; right: .3rem; display: grid; place-items: center; width: 38px; height: 38px; border: 0;
  border-radius: 8px; background: none; color: var(--muted); cursor: pointer;
}
.input-icon .peek:hover { background: var(--sunken); color: var(--ink); }
.input-icon .peek[aria-pressed="true"] { color: var(--link); }
.caps-warning { margin-top: .4rem; color: var(--warn); }

#signin-btn { margin-top: .4rem; height: 46px; }
#signin-btn:disabled { opacity: .75; cursor: progress; }
.signin-help { margin: 1rem 0 0; text-align: center; }

.signin-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1.1rem; }

@media (max-width: 420px) {
  .signin-main { padding: 1.25rem 1rem; align-items: start; }
  .signin-card { padding: 1.35rem; }
}
.receipt-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Delivery steps on the sale page */
.steps { list-style: none; padding: 0; margin: .5rem 0 .75rem; }
.steps li { padding: .2rem 0 .2rem 1.6rem; position: relative; color: var(--faint); }
.steps li::before { content: "\25CB"; position: absolute; left: .2rem; }
.steps li.done { color: inherit; }
.steps li.done::before { content: "\2713"; color: var(--link); font-weight: 700; }

/* Printed receipts (sales and debt payments), sized for 80mm paper */
body.print-page { background: var(--bg); }
.paper {
  /* paper keeps light colours in dark mode too, buttons included */
  --ink: #1c2420; --card: #fff; --field: #fff; --line: #e6e6e0; --brand: #1f5c45; --brand-dark: #174a37; --link: #1f5c45;
  max-width: 340px; margin: 1rem auto; padding: 16px; background: #fff; color: #111; color-scheme: light; font-family: ui-monospace, "Courier New", monospace; font-size: 13px; }
.paper h1 { font-size: 16px; text-align: center; margin: 0; }
.paper .center { text-align: center; }
.paper table td { border: 0; padding: 2px 0; }
.paper .dash { border-top: 1px dashed #000; margin: 8px 0; }
.paper .big { font-size: 15px; font-weight: 700; }
.paper .stamp { border: 2px solid #b42318; color: #b42318; padding: 4px; text-align: center; font-weight: 700; margin: 8px 0; }
.print-link { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: .3rem; border-radius: 7px; color: var(--muted); vertical-align: middle; }
.print-link:hover { background: var(--brand-soft); color: var(--link); text-decoration: none; }
@media print { .print-link { display: none; } }
.receipt-actions { max-width: 372px; margin: 1rem auto .9rem; padding: 0 16px; }

/* The receipt printer: the receipt comes out of the slot line by line, in short steps like a thermal printer. */
.printer { max-width: 372px; margin: 0 auto; padding: 0 0; position: relative; z-index: 2; }
.printer-body {
  display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 16px;
  border-radius: 14px 14px 8px 8px; background: linear-gradient(#3b4541, #252c29); color: rgba(255,255,255,.55);
  box-shadow: 0 6px 16px rgba(0,0,0,.18); font: 600 .72rem/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
}
.printer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.printer-light { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #5fd39a; box-shadow: 0 0 8px #5fd39a; }
.printer.busy .printer-light { background: #f0b545; box-shadow: 0 0 10px #f0b545; animation: blink .35s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.printer-slot { height: 7px; margin: 0 12px; border-radius: 0 0 6px 6px; background: #121614; }
.paper-feed { max-width: 340px; margin: 0 auto 2rem; padding-bottom: 12px; overflow: hidden; }
.paper-feed .paper { position: relative; margin: 0 auto; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.paper.feed { animation: feed 1.5s steps(22, end) both; }  /* printed top line first, the torn edge last */
@keyframes feed { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 -12px 0); } }
.paper-feed .paper::after {  /* the torn edge */
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: linear-gradient(135deg, #fff 50%, transparent 50%) 0 0 / 12px 12px repeat-x,
              linear-gradient(225deg, #fff 50%, transparent 50%) 0 0 / 12px 12px repeat-x;
}
@media (prefers-reduced-motion: reduce) { .paper.feed { animation: none; } }
@media print {
  .no-print { display: none !important; }
  .paper-feed { max-width: none; margin: 0; padding: 0; overflow: visible; }
  /* Centred: on an 80mm roll the auto margins come to nothing, and on a wider sheet it sits in the
     middle instead of hugging the left edge. */
  .paper, .paper.feed { margin: 0 auto; max-width: 80mm; padding: 0; animation: none; clip-path: none; box-shadow: none; }
  .paper-feed .paper::after { display: none; }
  @page { margin: 3mm; }
}

/* Pay page: what the money is for, one big row each */
.choices { display: grid; gap: .5rem; }
.choice { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
label.choice { cursor: pointer; }
label.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { width: 20px; height: 20px; flex: none; }
.choice > span:first-of-type { flex: 1; display: grid; }
.input.big-input { font-size: 1.4rem; font-weight: 700; }

/* Quick date ranges above a filter: a row of chips, the one on screen filled in. */
.periods { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: .3rem .85rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: .85rem; font-weight: 500;
}
.chip:hover { border-color: var(--line-strong); text-decoration: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; }
@media print { .periods { display: none; } }
@media print { .page-tabs { display: none; } }

/* ---------- the owner's dashboard ---------- */
.eyebrow { font-size: .9rem; color: var(--muted); margin-bottom: .15rem; }
.quick { display: grid; gap: 1.1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1.6rem; }
.quick-tile {
  display: flex; align-items: center; gap: .85rem; padding: .95rem 1.05rem; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 600;
  box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.quick-tile:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.quick-tile > span:last-child { display: grid; line-height: 1.3; }
.quick-tile small { font-weight: 400; font-size: .78rem; color: var(--muted); }
.tile-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); color: var(--link); flex: none; }
.quick-tile.main { background: var(--brand-soft); border-color: var(--brand-line); }
.quick-tile.main .tile-icon { background: var(--brand); color: var(--on-brand); }
.kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--bg); color: var(--muted); }
.kpi.hero .kpi-icon { background: rgba(255,255,255,.14); color: var(--on-brand); }
.kpi, .panel { box-shadow: var(--shadow-sm); }
.kpi { transition: transform .12s, box-shadow .12s, border-color .12s; }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.empty-state { display: grid; justify-items: center; gap: .3rem; text-align: center; padding: 1.6rem .5rem; margin: auto 0; color: var(--faint); list-style: none; }
.empty-state strong { color: var(--ink); font-weight: 600; font-size: .92rem; }
.empty-state span { font-size: .8rem; color: var(--muted); max-width: 30ch; }
.empty-state .btn { margin-top: .5rem; }
.empty-state.good > .icon { color: var(--good); }
.people li.empty-state { display: grid; border-bottom: 0; }
.who { display: inline-flex; align-items: center; gap: .5rem; }
.avatar.tiny { width: 24px; height: 24px; font-size: .62rem; }
.notice {
  display: flex; align-items: center; gap: .9rem; margin-bottom: 1.4rem; padding: .9rem 1.1rem;
  background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: var(--radius); color: var(--warn);
}
.notice:hover { text-decoration: none; border-color: var(--warn); }
.notice-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--card); border: 1px solid var(--warn-line); flex: none; }
.notice-text { flex: 1; display: grid; font-size: .85rem; }
.notice-text strong { font-size: .9rem; }
.notice-go { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .88rem; white-space: nowrap; }

.kpis { display: grid; gap: 1.1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.6rem; }
.kpi.hero { grid-column: span 2; }
.kpi { display: flex; flex-direction: column; gap: .25rem; padding: 1.35rem 1.5rem; min-height: 168px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi-head { display: flex; justify-content: space-between; align-items: center; font-size: .83rem; color: var(--muted); margin-bottom: .5rem; }
.kpi-value { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-value small, .figure small { font-size: .7rem; font-weight: 500; color: var(--muted); margin-right: .2rem; letter-spacing: 0; }
.kpi-note { font-size: .82rem; color: var(--muted); }
.kpi-foot { margin-top: auto; padding-top: .5rem; font-size: .76rem; color: var(--faint); }
.kpi-foot.warn { color: var(--warn); }
.kpi.hero { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.kpi.hero .kpi-head, .kpi.hero .kpi-note, .kpi.hero .kpi-value small, .kpi.hero .kpi-foot { color: rgba(255,255,255,.78); }
.kpi-foot .icon { vertical-align: -2px; }

.panels { display: grid; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.25rem; }
.panel { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.6rem; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; margin-bottom: .9rem; }
.panel-head h2 { margin: 0; }
.panel-head p { margin: .2rem 0 0; font-size: .8rem; color: var(--muted); }
.more { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.panel-foot { margin-top: auto; padding-top: .8rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .45rem; }
.panel-foot a { display: inline-flex; align-items: center; gap: .45rem; }
.panel table td, .panel table th { padding: .55rem 0; }
.panel table th { background: none; }
.panel table tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); font-size: .88rem; }

.figure { font-size: 1.8rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: .1rem 0 .8rem; }
.split { display: flex; gap: 2px; height: 8px; margin-bottom: .9rem; }
.split span { min-width: 4px; border-radius: 2px; }
.tone-1 { background: var(--brand); }
.tone-2 { background: var(--brand-mid); }
.tone-3 { background: var(--brand-light); }
.key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: .6rem; }
.legend td { border: 0; padding: .3rem 0 !important; font-size: .88rem; }
.legend .share { width: 4.5rem; color: var(--faint); font-size: .8rem; }

.state { display: flex; align-items: center; gap: .8rem; padding-bottom: .9rem; margin-bottom: .5rem; border-bottom: 1px solid var(--line); }
.state-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex: none; background: var(--bg); color: var(--muted); }
.state.good .state-mark { background: var(--good-soft); color: var(--good); }
.state.bad .state-mark { background: var(--bad-soft); color: var(--bad); }
.state > div { display: grid; }
.state strong { font-size: 1rem; font-weight: 600; }
.state.good strong { color: var(--good); }
.state.bad strong { color: var(--bad); }
.state span { font-size: .8rem; color: var(--muted); }
.kv { margin: 0 0 .9rem; display: grid; gap: .45rem; }
.kv div { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.box { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .7rem .9rem; border-radius: 9px; font-size: .85rem; }
.box.good { background: var(--good-soft); color: var(--good); }
.box.bad { background: var(--bad-soft); color: var(--bad); align-items: flex-start; justify-content: flex-start; }
.box.warn { background: var(--warn-soft); color: var(--warn); justify-content: flex-start; }
.box > div { display: grid; }
.box span { font-size: .78rem; }

.tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: .9rem 1rem; margin-bottom: .6rem; background: var(--bg); border-radius: 10px; }
.tally b { display: block; font-size: 1.4rem; font-weight: 600; }
.tally span { font-size: .75rem; color: var(--muted); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people li > div { flex: 1; min-width: 0; display: grid; }
.people strong { font-weight: 500; font-size: .92rem; }
.people span { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-block; padding: .2rem .6rem; border-radius: 7px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--bg); color: var(--muted); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.rows td { vertical-align: middle; }
.rows .sub { display: block; font-size: .76rem; color: var(--muted); }

.activity td { vertical-align: middle; font-size: .86rem; }
.activity .what { display: inline-flex; align-items: center; gap: .5rem; }
.activity .what .icon { color: var(--muted); }
.activity .warn, .activity .warn .icon { color: var(--warn); }
.activity .bad, .activity .bad .icon { color: var(--bad); }
.page-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; font-size: .78rem; color: var(--faint); }

@media (max-width: 1100px) {
  .quick, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi.hero { grid-column: 1 / -1; min-height: 0; }
}
@media (max-width: 900px) { .panels { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .quick { gap: .6rem; }
  .quick-tile { padding: .75rem; gap: .6rem; }
  .quick-tile small { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi.hero { grid-column: 1 / -1; }
  .kpi { min-height: 0; }
  .panels { grid-template-columns: 1fr; }
  .notice { flex-wrap: wrap; }
}

/* Light / dark switch: the icon shows the mode it switches to. */
.theme-btn .sun { display: none; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .sun { display: block; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }

/* Dark mode details: the menu sits a step darker than the cards, and the green headline card keeps a gentle depth. */
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar { background: #161c1a; }
  :root:not([data-theme="light"]) .kpi.hero { background: linear-gradient(160deg, #2c7556, #1f5a42); border-color: #2c7556; }
}
@media screen {
  :root[data-theme="dark"] .sidebar { background: #161c1a; }
  :root[data-theme="dark"] .kpi.hero { background: linear-gradient(160deg, #2c7556, #1f5a42); border-color: #2c7556; }
}

/* Phone controls need room for a thumb, and narrow screens should not squeeze money or order fields. */
@media (max-width: 960px) {
  .icon-btn, .bell { width: 42px; height: 42px; }
  .lang a { display: grid; place-items: center; min-width: 38px; min-height: 40px; padding: 0; }
  .btn.small { min-height: 42px; }
  .link-btn { display: inline-flex; align-items: center; min-height: 40px; padding: .35rem .15rem; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi.hero { grid-column: auto; }
}
@media (max-width: 360px) {
  .line .row { grid-template-columns: 1fr; }
  .line .row > :first-child { grid-column: auto; }
}
