/* Supreme Player's look (the tokens of ../../public/css/app.css and the apps' Theme.kt): its blue, its surfaces, its
   corners and the system's own type, light or dark as the device is set. A rail of places on a wide screen, a bar of them
   along the bottom of a phone. The reseller's own app (the live preview) always keeps its own colours. */
:root {
  color-scheme: light;
  --bg: #f4f6fb; --surface: #ffffff; --surface2: #eef1f8; --surface3: #e2e7f2; --border: #dbe1ee; --border-strong: #c3ccdf;
  --text: #141a29; --muted: #5d6882; --accent: #4463f0; --accent-strong: #2f4bd8; --ink: #ffffff;
  --ok: #12915c; --warn: #a86400; --danger: #d93649; --shadow: 0 10px 40px rgba(30, 45, 90, .16);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface)); --accent-line: color-mix(in srgb, var(--accent) 45%, var(--border));
  --ok-soft: color-mix(in srgb, var(--ok) 14%, transparent); --warn-soft: color-mix(in srgb, var(--warn) 14%, transparent); --danger-soft: color-mix(in srgb, var(--danger) 13%, transparent);
  --radius: 14px; --radius-sm: 9px; --rail-w: 84px; --tabbar-h: calc(62px + env(safe-area-inset-bottom, 0px)); --gutter: clamp(16px, 3vw, 32px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b0d12; --surface: #131722; --surface2: #1a2030; --surface3: #232b3f; --border: #252c3e; --border-strong: #36405a;
    --text: #e9edf6; --muted: #8d97ad; --accent: #6f8dff; --accent-strong: #4f6fef; --ink: #ffffff;
    --ok: #3ddc97; --warn: #ffb648; --danger: #ff6272; --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1 { font-size: clamp(24px, 4vw, 30px); line-height: 1.15; margin: 0; letter-spacing: -.02em; font-weight: 700; text-wrap: balance; } h2 { font-size: 17px; margin: 0; font-weight: 700; } h3 { font-size: 14px; margin: 0; }
p { margin: 0; } a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; } .spread { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; } .stack.tight { gap: 8px; }
.label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- the frame */
#app { min-height: 100%; }
#app.shell { padding-left: var(--rail-w); }
.chrome { position: sticky; top: 0; z-index: 30; }
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail-w); z-index: 30; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 6px; overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail .sep { width: 34px; height: 1px; background: var(--border); margin: 8px 0; flex: none; }
.mark { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(140deg, var(--accent), var(--accent-strong)); display: grid; place-items: center; flex: none; margin-bottom: 10px; }
.mark i { display: block; width: 0; height: 0; border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent #fff; margin-left: 3px; }
.mark.small { width: 30px; height: 30px; border-radius: 9px; margin: 0; display: none; } .mark.small i { border-width: 6px 0 6px 10px; margin-left: 2px; }
.dest { width: 72px; flex: none; border: 0; background: transparent; border-radius: 12px; padding: 8px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; line-height: 1.2; text-align: center; cursor: pointer; }
.dest:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.dest.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px var(--gutter); min-height: 56px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); }
.top .where { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { display: none; gap: 6px; padding: 8px var(--gutter); overflow-x: auto; border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: none; }
.sub::-webkit-scrollbar { display: none; }
a.nav { color: var(--muted); padding: 6px 13px; border-radius: 99px; font-weight: 600; font-size: 14px; white-space: nowrap; background: var(--surface2); }
a.nav:hover { color: var(--text); text-decoration: none; } a.nav.on { color: var(--ink); background: var(--accent); }
.tabbar { display: none; }
.brandmark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.brandmark i { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(140deg, var(--accent), var(--accent-strong)); display: block; position: relative; flex: none; }
.brandmark i::after { content: ""; position: absolute; left: 14px; top: 11px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff; }
.credits { font-size: 13px; font-weight: 600; color: var(--text); background: var(--surface2); padding: 6px 12px; border-radius: 99px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.credits:hover { text-decoration: none; background: var(--surface3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface3); display: grid; place-items: center; font-weight: 700; text-transform: uppercase; flex: none; }
.main { padding: 28px var(--gutter) 72px; max-width: 1240px; margin: 0 auto; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head p { color: var(--muted); margin-top: 6px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: block; }

/* ---- pieces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; overflow-wrap: anywhere; }
.card > h2 { margin-bottom: 14px; }
a.card:hover { border-color: var(--border-strong); }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); } .g4 { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.grid > *, .stack > *, .main { min-width: 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
a.tile:hover { border-color: var(--border-strong); text-decoration: none; }
.tile b { display: block; font-weight: 700; font-size: 25px; letter-spacing: -.02em; line-height: 1.25; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; } .tile span { color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); padding: 9px 16px; border-radius: var(--radius-sm); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 40px; }
.btn:hover { background: var(--surface3); text-decoration: none; } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary, .btn.light { background: var(--accent); border-color: transparent; color: var(--ink); font-weight: 700; } .btn.primary:hover, .btn.light:hover { background: var(--accent-strong); }
.btn.danger { color: var(--danger); } .btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 6px 12px; font-size: 13px; min-height: 34px; } .btn.big { padding: 12px 22px; font-size: 16px; }
.btn.pill { border-radius: 99px; background: transparent; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
label.f small, .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input:disabled { color: var(--muted); background: var(--surface3); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type=color] { padding: 3px; width: 46px; height: 42px; flex: none; cursor: pointer; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
.affix { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface2); overflow: hidden; }
.affix span { padding: 10px 0 10px 12px; color: var(--muted); font-family: var(--mono); font-size: 13px; white-space: nowrap; display: flex; align-items: center; }
.affix input { border: 0; border-radius: 0; padding-left: 2px; background: transparent; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--surface3); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--danger-soft); color: var(--danger); } .badge.info { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.note { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface2); color: var(--text); font-size: 14px; border: 1px solid var(--border); }
.note.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); } .note.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.note.small { font-size: 13px; padding: 8px 10px; }
.tablewrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 20px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; } tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface2); }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.plus, .minus { font-weight: 700; font-variant-numeric: tabular-nums; } .plus { color: var(--ok); } .minus { color: var(--danger); }

/* ---- progress */
.bar { height: 10px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.bar i { display: block; height: 100%; background-color: var(--accent); border-radius: 99px; transition: width .6s; }
.bar.waiting i { background: repeating-linear-gradient(-45deg, var(--border-strong) 0 10px, var(--surface3) 10px 20px); background-size: 200% 100%; animation: wait 1.2s linear infinite; }
.bar:not(.waiting) i { background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .4) 50%, rgba(255, 255, 255, 0) 100%); background-size: 200% 100%; animation: wait 1.6s linear infinite; }
@keyframes wait { from { background-position: 200% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .bar i { animation: none !important; } }

/* ---- the app page: the reseller's app on the left (in its own colours), what to do with it on the right */
.stage { border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 20px; color: #f2f4f8; border: 1px solid rgba(128, 140, 170, .25); }
.stage .label { color: inherit; opacity: .7; }
.stage .btn.pill { color: inherit; border-color: rgba(255, 255, 255, .3); }
.stage.light { color: #141a29; }
.stage.light .seg button { color: #141a29; background: rgba(20, 26, 41, .1); }
.stage.light .seg button.on { background: #141a29; color: #f2f4f8; }
.stage.light .btn.pill { color: #141a29; border-color: rgba(20, 26, 41, .3); }
.seg { display: flex; gap: 6px; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; color: #f2f4f8; background: rgba(255, 255, 255, .12); border: 0; padding: 8px 14px; border-radius: 99px; cursor: pointer; min-height: 36px; }
.seg button.on { background: #f2f4f8; color: #0b0d12; }
.screen { border-radius: 14px; border: 8px solid rgba(255, 255, 255, .1); background: #0b0d12; color: #f2f4f8; padding: 36px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 280px; }
.screen.phone { width: 230px; max-width: 100%; margin: 0 auto; border-radius: 28px; min-height: 360px; }
.screen.tvhome { padding: 0; aspect-ratio: 16 / 9; min-height: 0; }
.screen img.wide { max-width: 70%; max-height: 90px; object-fit: contain; }
.screen .fake { width: 240px; max-width: 100%; height: 36px; border-radius: 9px; background: #1a2030; }
.screen .go { width: 240px; max-width: 100%; height: 38px; border-radius: 9px; font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.window { border-radius: 12px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .14); background: #0b0d12; }
.window .titlebar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #1a2030; color: #f2f4f8; font-size: 12px; }
.window .titlebar img { width: 16px; height: 16px; }
.window .screen { border: 0; border-radius: 0; min-height: 240px; }
.icon { border-radius: 22%; display: grid; place-items: center; flex: none; overflow: hidden; background: #0b0d12; }
.icon img { width: 72%; height: 72%; object-fit: contain; } .icon.none { border: 2px dashed var(--border-strong); background: transparent; color: var(--muted); font-size: 22px; }
.appcard { display: flex; gap: 16px; align-items: center; }
.platform { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; background: var(--surface); }
.platform.building { border-color: var(--accent-line); background: var(--accent-soft); }
.platform.empty-state { border-style: dashed; background: transparent; }
.drop { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 14px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.drop .grow { flex-basis: 150px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .thumb { width: 64px; height: 64px; border-radius: 12px; background: repeating-conic-gradient(var(--surface3) 0 25%, var(--surface2) 0 50%) 0 0 / 14px 14px; display: grid; place-items: center; flex: none; overflow: hidden; }
.drop .thumb img { max-width: 100%; max-height: 100%; }
.steps { counter-reset: s; display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--surface3); color: var(--text); display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 700; }
.steps li.done::before { content: "✓"; background: var(--accent); color: var(--ink); }
.copy { display: flex; gap: 8px; } .copy input { font-family: var(--mono); font-size: 13px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* ---- sign-in */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(90% 55% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); }
.auth .card { width: 100%; max-width: 420px; padding: 26px; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; background: var(--surface2); padding: 4px; border-radius: var(--radius-sm); }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 8px; border-radius: 7px; cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.err { color: var(--danger); font-size: 14px; min-height: 20px; }

/* ---- dialogs and toasts */
dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 22px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog.wide { width: min(900px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 8, 16, .6); }
dialog h2 { margin-bottom: 14px; } dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
pre.log { background: var(--surface2); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 14px; max-height: 60vh; overflow: auto; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; max-width: 100%; box-shadow: var(--shadow); }
.toast.bad { background: var(--danger); color: #fff; }

/* ---- a phone, or a narrow window: the rail becomes a bar along the bottom and everything stacks */
@media (max-width: 860px) {
  #app.shell { padding-left: 0; padding-bottom: var(--tabbar-h); }
  .rail { display: none; }
  .mark.small { display: grid; }
  .top .credits, .top .badge { display: none; }
  .sub { display: flex; }
  .tabbar { position: fixed; inset: auto 0 0 0; z-index: 30; display: flex; justify-content: space-around; height: var(--tabbar-h); padding: 6px 4px env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--border); }
  .tabbar .dest { width: auto; flex: 1; max-width: 120px; }
  .main { padding: 18px var(--gutter) 40px; }
  .twocol { grid-template-columns: minmax(0, 1fr) !important; gap: 20px !important; }
  .twocol > div[style*="sticky"] { position: static !important; }
  .head .btn, .head > .row { width: 100%; } .head > .row .btn { flex: 1 1 auto; }
  .stage { padding: 16px; border-radius: 16px; } .screen { min-height: 220px; padding: 24px 14px; }
  .card { padding: 16px; } .tablewrap { margin: 0 -16px -16px; } th, td { padding-left: 16px; padding-right: 16px; }
  .kv { grid-template-columns: 1fr; gap: 0 0; } .kv dd { margin-bottom: 8px; }
  .copy { flex-wrap: wrap; } .copy input { flex: 1 1 180px; }
  #toasts { bottom: calc(var(--tabbar-h) + 12px); }
  dialog { padding: 18px; } dialog .actions .btn { flex: 1; }
}
@media (max-width: 420px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .btn.big { width: 100%; } }
