/* BeOnTime design system — billing portal mock
   Ported from the approved "Billing Screen — Subscriptions & Pay" design (2026-10-29). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/inter-500.woff2") format("woff2"); }

:root {
  --bg: #f9fafb;
  --surface: #ffffff;
  --fg: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-wash: rgba(59, 130, 246, 0.1);
  --accent-wash-soft: rgba(59, 130, 246, 0.05);
  --blue-50: #eff6ff;
  --pos: #22c55e;
  --danger: #dc2626;
  --hover-wash: rgba(17, 24, 39, 0.04);
  --ring: rgba(59, 130, 246, 0.55);
  --r: 6px;
  --font: "Inter", system-ui, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; border-radius: var(--r); }
code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}
.muted { color: var(--muted); }
.fine { font-size: 12.5px; color: var(--muted); }
#auth-error, #guest-error, #user-error, #pay-error, #plan-error, #ops-msg { color: var(--danger); }
#desk-msg.danger, #ops-msg.danger { color: var(--danger); }

/* ===== Left rail (white section bar) ===== */
.rail {
  width: 224px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px 16px;
  min-height: 100vh;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 0 8px; text-decoration: none; color: inherit; }
.brand-mark { width: 26px; height: 26px; flex-shrink: 0; object-fit: contain; }
.brand-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--fg);
  white-space: normal;
}
.mark-sub {
  padding: 12px 8px 14px;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.15s ease-out, color 0.15s ease-out;
}
.rail nav a:hover { background: var(--hover-wash); color: var(--fg); text-decoration: none; }
.rail nav a.on {
  background: var(--accent-wash-soft);
  color: var(--fg);
  font-weight: 500;
  box-shadow: inset 2px 0 0 var(--accent);
}
.legal { margin-top: auto; padding: 16px 8px 0; font-size: 12px; line-height: 1.55; color: var(--muted); }

/* ===== Main ===== */
main { flex: 1; min-width: 0; padding: 28px 36px 56px; }
main h1 { margin: 0 0 2px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
main > .muted, .top .muted { margin: 0 0 0; font-size: 13.5px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 4px; }
.top .btn { flex-shrink: 0; }
.actor-name { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
}
.card.wide { margin-top: 16px; }
.card h2 {
  margin: 0 0 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.span-row { grid-column: 1 / -1; }

.big { font-size: 22px; font-weight: 700; line-height: 1.2; margin: 0 0 6px; }
.big.danger { color: var(--danger); }
.pill {
  display: inline-block;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  padding: 3px 12px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill.danger { border-color: var(--danger); color: var(--danger); }

.includes, .plan-includes { margin: 0 0 14px; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.includes li, .plan-includes li { margin: 3px 0; }
.subtotal, .card .big:last-child { margin-bottom: 0; }

.storage-line { font-size: 22px; font-weight: 700; margin: 0 0 10px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; margin: 0 0 14px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.storage-parts { list-style: none; margin: 0 0 12px; padding: 0; font-size: 13px; }
.storage-parts li { padding: 3px 0; }
.storage-parts .muted { font-size: 12.5px; }

/* ===== Tables ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0 10px 9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot th, tfoot td {
  padding-top: 12px;
  border-bottom: none;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
#refill-subtotal { white-space: nowrap; }

.quota {
  width: 76px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  text-align: right;
  background: var(--surface);
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.quota:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }

.totals { width: 100%; max-width: 560px; margin: 0 0 12px; }
.totals th {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--fg);
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.cart-line { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.cart-hint { margin: 4px 0 0; max-width: 28em; font-weight: 400; }
.totals td {
  text-align: right;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.totals tr:last-child th, .totals tr:last-child td { font-weight: 700; font-size: 14px; border-bottom: none; }

/* ===== Buttons ===== */
button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, filter 0.15s ease-out;
  white-space: nowrap;
}
button:hover { filter: brightness(0.92); }
button:active { filter: brightness(0.86); }
button:disabled { opacity: 0.45; filter: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r); font-size: 13.5px; font-weight: 500; border: 1px solid transparent; transition: background-color 0.15s ease-out, border-color 0.15s ease-out, filter 0.15s ease-out; white-space: nowrap; }
a.btn { color: #ffffff; text-decoration: none; }
a.btn:hover { text-decoration: none; }
a.btn-ghost { color: var(--fg); }
.guest-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.btn-primary:hover { filter: brightness(0.92); }
.btn-primary:active { filter: brightness(0.86); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { background: var(--hover-wash); filter: none; }
.pay-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#sim-grant { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }

/* ===== Forms ===== */
.add-user { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.add-user input, .add-user select, .ops-form input, .ops-form select {
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  padding: 0 10px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}
.add-user input:focus, .add-user select:focus, .ops-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.ops-form {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 12px;
  max-width: 36rem;
  align-items: center;
}
.ops-form label { font-size: 13px; color: var(--muted); font-weight: 500; }
.ops-form button { grid-column: 2; justify-self: start; }

/* ===== Finance desk: operator grants ===== */
.ops-tools, .ops-newgrant-head { margin-top: 16px; }
.ops-tool { margin-top: 14px; }
.ops-tool h3 { margin: 0 0 10px; }
.ops-grants-label { display: block; grid-column: 1 / -1; margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.grant-rows { list-style: none; margin: 0; padding: 0; grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.grant-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
}
.grant-row .g-user { flex: 1 1 16rem; max-width: 26rem; }
.grant-row .g-action { flex: 0 1 12rem; min-width: 9rem; }
.grant-row .g-tokens { flex: 0 0 7rem; width: 7rem; }
.grant-row .g-remove { flex: 0 0 auto; }
#newgrant-view { margin-top: 18px; }

/* ===== Pay details ===== */
.pay-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.pay-detail p { margin: 0 0 6px; }
.pay-detail .btn { margin-top: 8px; }
.reqs { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 13px; }
.ops-reqs { grid-template-columns: 168px 1fr; margin-top: 12px; }
#detail > .card.wide { margin-top: 16px; }
#orders-view { margin: 0; }
#orders-view .status-paid { color: var(--pos); font-weight: 500; }
#orders-view .status-unpaid { color: var(--danger); font-weight: 500; }
.order-no { font-family: var(--mono); font-size: 12.5px; }
.reqs dt { color: var(--muted); }
.reqs dd { margin: 0; }

/* ===== Plans page ===== */
.plan-stack { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.plan-card.applied { border-color: var(--accent); background: var(--blue-50); }

@media (max-width: 960px) {
  body { flex-direction: column; }
  .rail { width: 100%; min-height: 0; border-right: none; border-bottom: 1px solid var(--border); }
  .legal { margin-top: 12px; }
  main { padding: 20px 16px 40px; }
  .cards { grid-template-columns: 1fr; }
}

.rail-gap { height: 18px; }
