/* UrbanVend Thrive. Layout: left menu + work area; brand orange accent. */
:root {
  /* UrbanVend brand: vending orange, screen blue, wordmark black */
  --bg: #f6f5f3; --paper: #ffffff; --ink: #141414; --muted: #5f5b57; --line: #e4e0db;
  --accent: #f26522; --accent-ink: #b8470f; --accent-soft: #fde9dd; --on-accent: #141414;
  --blue: #00a9e0; --blue-soft: #e0f4fb;
  --ok: #1d7a4c; --ok-soft: #e3f3ea; --warn: #9a5b00; --warn-soft: #fbefd9; --bad: #c0261c; --bad-soft: #fbe5e3;
  --s1: #00a9e0; --s2: #f26522; --s3: #141414; --s4: #7a3fb0;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212; --paper: #1c1b1a; --ink: #f1efed; --muted: #a8a29c; --line: #34312e;
    --accent: #ff7a3a; --accent-ink: #ff9a66; --accent-soft: #3a2316; --on-accent: #141414;
    --blue: #3cc3f0; --blue-soft: #12303c;
    --ok: #6fcf9b; --ok-soft: #173326; --warn: #e7b25b; --warn-soft: #3a2c12; --bad: #f08a80; --bad-soft: #3d1c1a;
    --s1: #3cc3f0; --s2: #ff7a3a; --s3: #e8e4df; --s4: #c39cf0; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
.boot { padding: 40px; color: var(--muted); }
a { color: var(--accent-ink); }
h1 { font-family: var(--display); font-size: 1.55rem; font-weight: 700; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0; }
h3 { font-size: 12px; font-weight: 650; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.muted { color: var(--muted); } .mono { font-family: var(--mono); } .num { text-align: right; font-variant-numeric: tabular-nums; }
.note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

/* shell */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--paper); border-right: 1px solid var(--line); padding: calc(18px + env(safe-area-inset-top, 0px)) 12px 18px max(12px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; padding: 0 8px; }
.brand img { height: 54px; width: auto; }
.brand .dk { display: none; }
@media (prefers-color-scheme: dark) { .brand .lt, .login .lt { display: none; } .brand .dk, .login .dk { display: block; } }
.navgroup { display: flex; flex-direction: column; gap: 1px; }
.navgroup > span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px 4px; }
.navgroup a { text-decoration: none; color: var(--ink); padding: 7px 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; }
.navgroup a:hover { background: var(--bg); }
.navgroup a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.badge { font-family: var(--mono); font-size: 11px; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 7px; }
.side .me { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 8px; display: flex; flex-direction: column; gap: 6px; }
.main { padding-block: calc(20px + env(safe-area-inset-top, 0px)) 48px; padding-left: max(16px, 2.2vw); padding-right: max(16px, env(safe-area-inset-right, 0px), 2.2vw); min-width: 0; }
.wrap { max-width: 1280px; margin-inline: auto; display: flex; flex-direction: column; gap: 14px; }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; }
.pagehead p { margin: 2px 0 0; color: var(--muted); }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 5; height: auto; flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; padding: calc(8px + env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px)); gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand span, .navgroup > span, .side .me .who { display: none; }
  .navgroup { flex-direction: row; }
  .navgroup a { white-space: nowrap; padding: 6px 9px; }
  .side .me { margin: 0 0 0 6px; }
}

/* controls */
button, .btn { font: inherit; font-weight: 550; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: var(--r); padding: 7px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.danger { color: var(--bad); }
button.small { padding: 3px 9px; font-size: 12px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent-ink); font-weight: 500; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; width: 100%; min-width: 0; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
textarea { min-height: 4.5rem; resize: vertical; }
td input, td select { padding: 4px 6px; font-size: 13px; }
td input[type="number"] { width: 6rem; text-align: right; font-family: var(--mono); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 550; }
label.f.wide { grid-column: 1 / -1; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 10px 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.seg button { white-space: nowrap; border: 0; border-radius: 0; padding: 6px 12px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.checks { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

/* range bar */
.rangebar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
.rangebar .seg { max-width: 100%; overflow-x: auto; }
.rangebar .dates { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.rangebar input[type="date"] { width: auto; padding: 4px 6px; }

/* panels */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.panel > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; margin-bottom: 10px; }
.panel > header p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 14px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: 10px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tile .v small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.tile .d { font-size: 12px; color: var(--muted); }
.tile.alert { border-color: var(--warn); }
.up { color: var(--ok); } .down { color: var(--bad); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

/* tables */
.tbox { overflow-x: auto; }
.tbox.tall { max-height: 30rem; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--paper); position: sticky; top: 0; }
th.sortable { cursor: pointer; } th[aria-sort="descending"]::after { content: " ↓"; } th[aria-sort="ascending"]::after { content: " ↑"; }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 650; border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--bg); }
.cellbar { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.cellbar i { display: block; height: 6px; border-radius: 2px; background: var(--blue); opacity: .7; }
.empty { color: var(--muted); padding: 10px 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; border-radius: 999px; padding: 2px 9px; background: var(--blue-soft); color: var(--ink); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.plain { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.msg { font-size: 13px; padding: 9px 12px; border-radius: 6px; background: var(--accent-soft); color: var(--ink); }
.msg.warn { background: var(--warn-soft); } .msg.bad { background: var(--bad-soft); } .msg.ok { background: var(--ok-soft); }

/* charts */
.chart { position: relative; min-height: 260px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.grid-line { stroke: var(--line); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 14px rgb(0 0 0 / .12); padding: 6px 9px; font-size: 12px; white-space: nowrap; z-index: 3; }
.tip b { display: block; color: var(--muted); font-weight: 500; margin-bottom: 2px; }

/* trays */
.trays { display: flex; flex-direction: column; gap: 8px; }
.tray { display: flex; gap: 8px; align-items: stretch; }
.tray > span { flex: 0 0 3.4rem; font-size: 12px; color: var(--muted); padding-top: 4px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.8rem, 1fr)); gap: 6px; flex: 1; min-width: 0; }
.slot { position: relative; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px 8px; font-size: 12px; background: var(--bg); overflow: hidden; }
.slot.empty { border-color: var(--bad); } .slot.off { opacity: .45; }
.slot .p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; min-height: 2.5em; }
.slot .n { color: var(--muted); display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.slot .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--blue); }
.slot .bar.low { background: var(--bad); }

/* purchases board */
.board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .board { grid-template-columns: 1fr; } }
.col { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--r); padding: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.col > header { display: flex; justify-content: space-between; font-size: 12px; font-weight: 650; color: var(--muted); padding: 2px 4px; }
.card { align-items: stretch; text-align: left; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 10px; display: flex; flex-direction: column; gap: 4px; font-weight: 400; width: 100%; }
.card[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card .po { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.card .sup { font-weight: 650; }
.card .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.steps { display: grid; gap: 10px; }
.step { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.step.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.step.now { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.step .hd { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.step .hd b { font-weight: 650; }
.step .n { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-right: 6px; }
.hist { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; max-height: 15rem; overflow: auto; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.login .box { width: min(100%, 25rem); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.login .box img { height: 64px; width: auto; align-self: flex-start; }
.login .dk { display: none; }
.login .key { font-family: var(--mono); font-size: 16px; letter-spacing: .05em; background: var(--bg); border: 1px dashed var(--line); border-radius: 6px; padding: 10px; text-align: center; word-break: break-all; user-select: all; }
.login ol { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; }
.code-input { font-family: var(--mono); font-size: 22px; letter-spacing: .3em; text-align: center; }

.toast { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--paper); padding: 9px 14px; border-radius: var(--r); font-size: 13px; z-index: 20; max-width: min(90vw, 28rem); }
.skel { display: block; height: 1em; border-radius: 4px; background: linear-gradient(90deg, var(--line), var(--bg), var(--line)); background-size: 200% 100%; }
@media (prefers-reduced-motion: no-preference) { .skel { animation: sk 1.2s linear infinite; } @keyframes sk { to { background-position: -200% 0; } } }

/* brand touches */
.side { border-top: 4px solid var(--accent); }
button.primary { font-weight: 650; }
button.primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.tile.alert { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.pagehead h1::after { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--blue); margin-top: 6px; }
.seg button[aria-pressed="true"] { font-weight: 650; }
.step.now { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
@media (max-width: 860px) { .brand img { height: 30px; } .side { border-top-width: 3px; } }

/* home */
.tiles.five { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.tile.big .v { font-size: 1.7rem; }
.tile.big { border-top: 3px solid var(--accent); }
select.inline { width: auto; display: inline; padding: 1px 4px; font-size: 12px; border-radius: 4px; }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.donutbox { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.donut { width: min(100%, 210px); height: auto; }
.donut text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.donut text.donut-c { fill: var(--ink); font-size: 19px; font-weight: 650; }
.legend { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 3.2rem; gap: 8px; align-items: center; }
.legend .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.chip { text-decoration: none; }
/* profit & loss */
table.pl td { padding: 8px; }
table.pl tr.strong td { font-weight: 650; }
table.pl tr.total td { font-size: 15px; border-top: 2px solid var(--ink); border-bottom: 0; }
/* staff money */
img.receipt { max-width: 100%; max-height: 70vh; border-radius: 6px; border: 1px solid var(--line); display: block; }
/* tasks */
.tasks { display: flex; flex-direction: column; gap: 8px; }
.task { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.task .body { flex: 1; min-width: 0; }
.task.done .body > b { text-decoration: line-through; color: var(--muted); }
.task .tick input { width: 18px; height: 18px; margin-top: 2px; }
table.pl td.num { white-space: nowrap; }
