/* License Service dashboard. Same colours, spacing and layout as the desktop app. */
:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #eef1f6; --line: #dce2eb; --line-strong: #c5cedb;
  --fg: #121925; --muted: #5a6678; --faint: #8a95a6;
  --accent: #2d5be3; --accent-hover: #244ecd; --accent-fg: #ffffff; --accent-soft: #e5ecfd; --accent-line: #b9cbf8;
  --good: #13804e; --good-soft: #e2f4ea; --warn: #a96400; --warn-soft: #fbefd9; --bad: #c0393b; --bad-soft: #fbe5e5;
  --grid: rgba(45, 91, 227, .12); --scrim: rgba(14, 20, 32, .42);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 64px rgba(10, 16, 30, .22);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Segoe UI Variable Display", "Segoe UI Semibold", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: .88em; }
.muted { color: var(--muted); }
.gutter { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding-block: 10px; display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 1.02rem var(--font-head); margin-right: auto; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.nav { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .93rem; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.account { display: flex; align-items: center; gap: 8px; }
.account .who { font-size: .85rem; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { max-width: 1120px; margin: 0 auto; padding-block: 28px 72px; display: flex; flex-direction: column; gap: 26px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .lead { color: var(--muted); margin-top: 4px; max-width: 62ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: 8px; }
.crumb:hover { color: var(--accent); }
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg); padding: 6px 14px; border-radius: 8px; font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn.danger { color: var(--bad); border-color: var(--bad-soft); background: var(--surface); }
.btn.danger:hover, .btn.danger.armed { background: var(--bad-soft); }
.btn.sm { min-height: 28px; padding: 3px 10px; font-size: .84rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { opacity: .7; cursor: progress; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font: 600 1.45rem var(--font-head); font-variant-numeric: tabular-nums; margin-top: 2px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
@media (max-width: 420px) { .grid, .vgrid { grid-template-columns: minmax(0, 1fr); } }
.card { display: flex; flex-direction: column; gap: 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; cursor: pointer; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; min-width: 0; }
.card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.card.add { align-items: center; justify-content: center; border-style: dashed; background: transparent; color: var(--muted); font-weight: 600; min-height: 180px; }
.card.add:hover { color: var(--accent); }
.card.off { opacity: .62; }
.card-top { display: flex; gap: 14px; align-items: center; min-width: 0; }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card .blurb { color: var(--muted); font-size: .9rem; min-height: 2.7em; }
.card-meta { display: flex; gap: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.card-meta b { display: block; color: var(--fg); font: 600 1rem/1.3 var(--font-head); font-variant-numeric: tabular-nums; }
.card-foot { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.plus { width: 40px; height: 40px; border-radius: 50%; border: 1px dashed currentColor; display: grid; place-items: center; font-size: 1.4rem; line-height: 1; }
.monogram { width: 52px; height: 52px; flex: none; border-radius: 12px; display: grid; place-items: center; font: 600 1.05rem/1 var(--font-head); color: var(--accent); background-color: var(--accent-soft); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 8px 8px; border: 1px solid var(--accent-line); }
.monogram.lg { width: 60px; height: 60px; font-size: 1.25rem; border-radius: 14px; }
.monogram.sm { width: 40px; height: 40px; font-size: .9rem; border-radius: 10px; }
.code-pill { display: inline-flex; align-items: center; font: 500 .8rem/1 var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: 6px 8px; border-radius: 7px; color: var(--fg); align-self: flex-start; white-space: nowrap; }
.price { font: 600 1.35rem/1.1 var(--font-head); font-variant-numeric: tabular-nums; }
.price small { font: 400 .8rem var(--font); color: var(--muted); }
.title-row { display: flex; gap: 16px; align-items: center; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.good { color: var(--good); background: var(--good-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.bad { color: var(--bad); background: var(--bad-soft); }
.pill.info { color: var(--accent); background: var(--accent-soft); }
.pill.plain { color: var(--muted); background: var(--surface-2); }

/* lists */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.row { display: grid; grid-template-columns: 36px minmax(0, 1.6fr) minmax(0, 1fr) 110px auto; gap: 14px; align-items: center; padding: 11px 16px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; width: 100%; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row.static { cursor: default; grid-template-columns: 12px 120px minmax(0, 1fr) minmax(0, 1.4fr); }
.row.static:hover { background: transparent; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font: 600 .8rem var(--font-head); color: var(--muted); }
.who { min-width: 0; }
.who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { display: block; font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { font-size: .84rem; color: var(--muted); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); }
.cell-text { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 680px) {
  .row { grid-template-columns: 36px minmax(0, 1fr) auto; } .row .what, .row .when { display: none; }
  .row.static { grid-template-columns: 12px minmax(0, 1fr); } .row.static .when, .row.static .cell-text.detail { display: none; }
}
.empty { padding: 28px; text-align: center; color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 12px; }
.search input { border: 0; background: transparent; padding: 8px 0; width: 100%; outline: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); padding: 5px 12px; border-radius: 99px; font-size: .86rem; cursor: pointer; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-size: .83rem; font-weight: 600; color: var(--muted); }
.hint { font-size: .8rem; color: var(--faint); }
.err { font-size: .88rem; color: var(--bad); min-height: 1.3em; }
.input { width: 100%; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 11px; outline: none; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.input.mono { font-family: var(--mono); font-size: .88rem; }
.input.code { font: 600 1.3rem var(--mono); letter-spacing: .3em; text-align: center; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .fields { grid-template-columns: minmax(0, 1fr); } }
.copyline { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--surface-2); min-width: 0; }
.copyline code { flex: 1; min-width: 0; padding: 8px 11px; font: 500 .82rem/1.45 var(--mono); overflow-wrap: anywhere; user-select: all; }
.copyline button { border: 0; border-left: 1px solid var(--line-strong); background: var(--surface); padding: 0 12px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .84rem; }
.copyline button:hover { color: var(--accent); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: .92rem; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: var(--line-strong); position: relative; cursor: pointer; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }
.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: var(--surface); padding: 7px 10px; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

/* pop-up windows */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; animation: pop .18s ease; }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 22px 14px; }
.modal-head .t { flex: 1; min-width: 0; }
.modal-head .sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.modal-body { padding: 6px 22px 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; background: var(--surface-2); border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@media (max-width: 560px) { .scrim { align-items: flex-end; padding: 0; } .modal { border-radius: 14px 14px 0 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; font-size: .92rem; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.codebox { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 50vh; }
.codebox pre { margin: 0; padding: 14px 16px; font: 400 .8rem/1.6 var(--mono); white-space: pre; tab-size: 4; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: .9rem; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.notice.warn { background: var(--warn-soft); border-color: transparent; }
.result { border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.result.ok { background: var(--good-soft); } .result.no { background: var(--bad-soft); }
.result.ok h3 { color: var(--good); } .result.no h3 { color: var(--bad); }

/* sign-in */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth .brand { margin: 0 0 4px; }
.auth .btn.primary { width: 100%; min-height: 40px; }
.secret { font: 600 1.05rem/1.6 var(--mono); letter-spacing: .06em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; overflow-wrap: anywhere; user-select: all; }
.steps-small { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }

.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 440px; }
.toast { background: var(--fg); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: .9rem; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
.toast.bad { background: var(--bad); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* License Desk additions */
.chipset { display: flex; flex-wrap: wrap; gap: 6px; }
.chip:disabled { opacity: .75; cursor: default; }
.mini-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
.mini-row:first-child { border-top: 0; }
.mini-row .who { flex: 1; }
.card.small { min-height: 0; padding: 14px 16px; gap: 8px; }
.subtle { font-size: .84rem; color: var(--muted); }
.serial { font: 600 .95rem var(--mono); letter-spacing: .02em; }
.serial-list { display: flex; flex-direction: column; gap: 8px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* Phone app: keep clear of the notch and home bar when installed */
.topbar { padding-top: env(safe-area-inset-top, 0px); }
main { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
.toast-wrap { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.auth-wrap { padding-top: calc(24px + env(safe-area-inset-top, 0px)); padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 560px) {
  .topbar-inner { gap: 8px 12px; padding-block: 8px; }
  .topbar { position: static; }
  .account .who { display: none; }
  .nav { order: 3; width: 100%; }
  .account { order: 4; width: 100%; justify-content: flex-end; }
  .account .btn { min-height: 28px; padding: 2px 8px; font-size: .84rem; }
  .nav a { flex: 1; text-align: center; padding: 8px 6px; }
  .modal { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  h1 { font-size: 1.5rem; }
}
.wide-auth { width: min(760px, 100%); }

.chip.owned { background: var(--good-soft); color: var(--good); border-color: transparent; cursor: default; }
.seat-grid { display: grid; gap: 8px; }
.seat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.seat-row > span { display: flex; flex-direction: column; }
.seat-row .input { width: 90px; }
.seat-row .subtle { font-weight: 400; font-size: .86rem; }
.addon-pick { display: grid; gap: 8px; }
.addon-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.addon-row .qty { display: flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); }
.addon-row .qty[hidden] { display: none; }
.addon-row .qty .input { width: 80px; padding-top: 4px; padding-bottom: 4px; }
.check-list { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.check input:disabled + span { color: var(--muted); }
