/* Shop owner's online view — Conduit & Concrete Engineering Ltd */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --ink: #18202b; --ink-2: #3d4654; --muted: #6b7482; --line: #e1e4e9; --line-2: #c9ced6;
  --brand: #1f2a3a; --bar: #d9600f; --bar-soft: #f6dcc9; --pos: #1f7a3f; --pos-bg: #e3f3e8; --warn: #8a5a00; --warn-bg: #fbefd2;
  --neg: #b3261e; --neg-bg: #fbe4e1; --focus: #2b62c9; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151b; --surface: #1a2029; --ink: #eef1f5; --ink-2: #c8ced8; --muted: #8e97a5; --line: #2a323e; --line-2: #3a4452;
    --brand: #0d1218; --bar: #e27024; --bar-soft: #4a2c18; --pos: #6fcf8e; --pos-bg: #173523; --warn: #e6b65c; --warn-bg: #3b2e12;
    --neg: #f08a80; --neg-bg: #3d1a17; --focus: #7aa7ff; --shadow: none; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* sign in */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 22px; box-shadow: var(--shadow); }
.login-logo { display: block; width: 210px; max-width: 80%; margin: 0 auto 18px; background: #fff; border-radius: 10px; padding: 6px 10px; }
.login h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.login p.sub { margin: 0 0 18px; text-align: center; color: var(--muted); font-size: 14px; }
label.fld { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
label.fld input { display: block; width: 100%; margin-top: 5px; padding: 11px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); font-weight: 400; font-size: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
@media (prefers-color-scheme: dark) { .btn { background: var(--bar); border-color: var(--bar); color: #1a0d04; } }
.btn.full { width: 100%; padding: 12px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .6; cursor: default; }
.err { color: var(--neg); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }
.foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }
.foot a { color: var(--muted); }

/* layout */
.top { background: var(--brand); color: #fff; padding: 12px 16px 0; padding-top: max(12px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 1100px; margin: 0 auto; }
.shopname { font-size: 18px; font-weight: 700; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shopsel { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; padding: 5px 8px; font-weight: 700; max-width: 100%; }
.shopsel option { color: #000; }
.menu-btn { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.seen { font-size: 12.5px; color: #d5dbe4; margin: 3px 0 0; max-width: 1100px; margin-left: auto; margin-right: auto; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #9aa3af; flex: none; }
.dot.ok { background: #4cc77a; } .dot.warn { background: #f0b443; }
.tabs { display: flex; gap: 2px; max-width: 1100px; margin: 10px auto 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { background: transparent; border: 0; color: #cfd6e0; padding: 10px 12px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 14px; }
.tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--bar); }
main { max-width: 1100px; margin: 0 auto; padding: 14px 16px 40px; }

/* date range */
.range { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.range input[type=date] { border: 1px solid var(--line-2); background: var(--surface); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
.range .to { color: var(--muted); font-size: 13px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .l { font-size: 12.5px; color: var(--muted); }
.tile .v { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; }
.tile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.hero .v { font-size: 26px; }

/* panels */
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.panel h2 { font-size: 15px; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel h2 small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.pb { padding: 12px 14px; }
.empty { color: var(--muted); font-size: 14px; padding: 16px 14px; text-align: center; }

/* bars: one series, one hue */
.hbar { display: grid; grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.hbar .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hbar .track { height: 10px; }
.hbar .fill { display: block; width: 0; height: 10px; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { text-align: right; white-space: nowrap; }
.cols { position: relative; height: 170px; display: flex; align-items: flex-end; gap: 2px; padding: 0 0 22px; border-bottom: 1px solid var(--line); }
.cols .gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--muted); }
.cols .gl span { position: absolute; right: 0; top: -14px; background: var(--surface); padding-left: 4px; }
.col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; min-width: 0; }
.col .b { width: 100%; max-width: 34px; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 0; }
.col .x { position: absolute; bottom: -20px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.col:hover .b, .col:focus .b { filter: brightness(.88); }
.tip { position: fixed; z-index: 50; background: var(--ink); color: var(--surface); font-size: 12.5px; padding: 6px 9px; border-radius: 7px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); }

/* tables and lists */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.r, th.r { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.badge.void, .badge.out { background: var(--neg-bg); color: var(--neg); }
.badge.low, .badge.pending { background: var(--warn-bg); color: var(--warn); }
.badge.ok { background: var(--pos-bg); color: var(--pos); }
.badge.mut { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.sub { color: var(--muted); font-size: 12.5px; }
.neg { color: var(--neg); } .pos { color: var(--pos); }
.wrap { overflow-x: auto; }

/* stock */
.stock-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.stock-tools input[type=search] { flex: 1; min-width: 180px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); font-size: 15px; }
.stock-tools label { font-size: 14px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.prod { display: flex; gap: 10px; align-items: center; }
.prod img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.vgrid { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.vchip { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.vchip i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; border: 1px solid var(--line-2); }
.vchip.low { border-color: var(--warn); color: var(--warn); }
.vchip.out { border-color: var(--neg); color: var(--neg); }

/* modal */
.scrim { position: fixed; inset: 0; background: rgba(10,14,20,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
@media (min-width: 640px) { .scrim { align-items: center; } }
.sheet { background: var(--surface); width: 100%; max-width: 460px; max-height: 88vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 18px 18px 24px; }
@media (min-width: 640px) { .sheet { border-radius: 16px; } }
.sheet h3 { margin: 0 0 4px; font-size: 18px; }
.sheet .x { float: right; border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.rline { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rline.tot { font-weight: 700; border-bottom: 0; font-size: 16px; padding-top: 10px; }
.menu-list button { display: block; width: 100%; text-align: left; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 15px; }
.page-foot { max-width: 1100px; margin: 0 auto; padding: 0 16px 30px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.page-foot img { height: 30px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.note { font-size: 13px; color: var(--muted); margin: -6px 0 12px; }

.minw { min-width: 0; } .mt { margin-top: 12px; } .mb { margin-bottom: 10px; } .small { font-size: 14px; } .nowrap { white-space: nowrap; }
/* phone polish: amounts on one line, scale labels clear of the bars, big numbers fit */
td.r, th.r { white-space: nowrap; }
.cols { padding-left: 34px; }
.cols .gl { left: 0; }
.cols .gl span { left: 0; right: auto; top: -7px; padding: 0 4px 0 0; }
@media (max-width: 760px) { .tile .v, .tile.hero .v { font-size: 20px; } th, td { padding: 8px 10px; } .range { gap: 5px; } .chip { padding: 5px 10px; } }
