/* LPG POS admin panel. Mobile first: the base rules are for a 360px phone, wider screens add to them.
   Same brand greens as the Android app. No inline styles anywhere (the CSP forbids them). */
:root {
  --bg: #f4f8f5; --card: #ffffff; --ink: #16251b; --sub: #62756a; --line: #e1eae3; --soft: #edf3ee;
  --brand: #0f6a38; --brand-ink: #ffffff; --brand-soft: #e3f3e9;
  --warn: #b25e00; --warn-soft: #fdf0dc; --bad: #b3261e; --bad-soft: #fbe6e4; --info: #1457a8; --info-soft: #e4eefb;
  --radius: 14px; --shadow: 0 1px 2px rgba(20, 40, 28, .06), 0 4px 14px rgba(20, 40, 28, .05);
  --bar: 60px; --gap: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111713; --card: #1a231d; --ink: #e8efe9; --sub: #9db0a4; --line: #2b372f; --soft: #222d25;
    --brand: #39c172; --brand-ink: #07210f; --brand-soft: #1b3326;
    --warn: #f0a347; --warn-soft: #3a2b14; --bad: #ff8a80; --bad-soft: #3d1f1d; --info: #7db3f5; --info-soft: #182a40;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 6px; }
.sub { color: var(--sub); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.hidden { display: none !important; }
.block { width: 100%; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 50; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

/* ---- shell ---------------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: var(--card); border-bottom: 1px solid var(--line); }
.top .brand { font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.top .brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.top .grow { flex: 1; }
.top form { margin: 0; }
.side { display: none; }
.page { padding: 16px 16px calc(var(--bar) + 24px); max-width: 1180px; margin: 0 auto; }
.page > header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.page > header .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--bar); display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--sub); font-size: 11px; min-height: 48px; }
.bottom a:hover { text-decoration: none; }
.bottom a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.bottom svg, .side svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.badge-dot { position: relative; }
.badge-dot b { position: absolute; top: 2px; right: calc(50% - 20px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; display: grid; place-items: center; }

@media (min-width: 900px) {
  .bottom { display: none; }
  .side { display: flex; flex-direction: column; gap: 2px; position: fixed; top: 52px; bottom: 0; left: 0; width: 220px; padding: 14px 10px; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; }
  .side a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink); font-weight: 500; }
  .side a:hover { background: var(--soft); text-decoration: none; }
  .side a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
  .side .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 7px; }
  .side hr { border: 0; border-top: 1px solid var(--line); margin: 8px 4px; width: calc(100% - 8px); }
  .page { margin-left: 220px; max-width: none; padding: 24px 28px 40px; }
  .page > * { max-width: 1180px; }
}

/* ---- cards, grids ---------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.grid.kpis { grid-template-columns: repeat(2, 1fr); }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid.kpis { grid-template-columns: repeat(3, 1fr); } .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .grid.kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { display: block; color: inherit; }
a.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi .label { color: var(--sub); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .value { font-size: 28px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.kpi .delta { font-size: 12px; color: var(--sub); margin-top: 2px; }
.kpi.alert .value { color: var(--bad); }
.up { color: var(--brand); } .down { color: var(--bad); }

/* ---- badges, buttons, forms ------------------------------------------------ */
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--sub); white-space: nowrap; }
.pill.ok { background: var(--brand-soft); color: var(--brand); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
input[type=text], input[type=search], input[type=number], input[type=email], input[type=date], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; }
textarea { min-height: 110px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > * { flex: 0 0 auto; }
.row .grow { flex: 1 1 160px; }
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.filters .wide { grid-column: 1 / -1; }
.filters input, .filters select { min-height: 40px; }
@media (min-width: 700px) { .filters { grid-template-columns: 2fr repeat(4, 1fr) auto; } .filters .wide { grid-column: auto; } }
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert.ok { background: var(--brand-soft); color: var(--brand); } .alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); } .alert.info { background: var(--info-soft); color: var(--info); }
.err { color: var(--bad); font-size: 13px; margin-top: 4px; }
.empty { text-align: center; color: var(--sub); padding: 28px 8px; }

/* ---- tabs ------------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--sub); font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }

/* ---- data lists: cards on a phone, a table from 760px ---------------------- */
.list { display: grid; gap: 10px; }
.item { display: block; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
a.item:hover { text-decoration: none; border-color: var(--brand); }
.item .l1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item .l1 strong { overflow-wrap: anywhere; }
.item .l2 { color: var(--sub); font-size: 13px; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
table.t { display: none; width: 100%; border-collapse: collapse; }
@media (min-width: 760px) {
  .list.cards-only .item { display: block; }
  .list.has-table { display: none; }
  table.t { display: table; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--sub); padding: 10px 12px; background: var(--soft); }
  table.t td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
  table.t tbody tr:hover { background: var(--soft); }
}
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--sub); font-size: 13px; } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 8px; }

/* ---- charts (inline SVG; colours come from here) ----------------------------- */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--brand); } .chart .bar.alt { fill: var(--info); } .chart .bar.dim { fill: var(--line); }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--brand-soft); }
.chart .axis { stroke: var(--line); stroke-width: 1; } .chart text { fill: var(--sub); font-size: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--sub); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 90px 1fr 52px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbar progress { width: 100%; height: 12px; accent-color: var(--brand); }
.funnel { display: grid; gap: 6px; }

/* ---- thread (tickets) -------------------------------------------------------- */
.msg { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); max-width: 760px; }
.msg.admin { background: var(--brand-soft); border-color: transparent; }
.msg.note { background: var(--warn-soft); border-color: transparent; }
.msg .who { font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.thread { display: grid; gap: 10px; margin-bottom: 14px; }

/* ---- sign-in / authenticator pages -------------------------------------------- */
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.box { width: 100%; max-width: 400px; }
.box .logo { width: 44px; height: 44px; border-radius: 13px; font-size: 20px; margin: 0 auto 14px; }
.box h1 { text-align: center; } .box p { text-align: center; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.codes code { background: var(--soft); padding: 8px; border-radius: 8px; text-align: center; font-size: 15px; }
.secret { background: var(--soft); padding: 10px 12px; border-radius: 10px; font-size: 16px; letter-spacing: .06em; word-break: break-all; text-align: center; }
.code-input { text-align: center; font-size: 24px; letter-spacing: .3em; }
@media (prefers-reduced-motion: no-preference) { .btn, .item, .kpi { transition: border-color .12s; } }

.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

label.radio { display: block; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; font-weight: 400; cursor: pointer; }
label.radio input { margin-right: 8px; }
label.radio .sub { display: block; margin-left: 26px; }
