
/* Orbic Stock Point. Orbic Grey carries structure, Orbic Blue marks action. Shared by the kiosk and the portal. */
:root {
  --bg: #EDF0F2; --surface: #FFFFFF; --surface-2: #F4F6F7; --fg: #252524; --muted: #5E6A72; --line: #D8DEE2;
  --side: #5E6A72; --side-fg: #FFFFFF; --side-muted: #D5DBDF; --side-active: rgba(255,255,255,.14);
  --accent: #12A0DC; --accent-ink: #FFFFFF; --accent-soft: #E2F3FB; --accent-text: #0B7DB0;
  --good: #1E8E4F; --good-soft: #E1F4E8; --warn: #A86500; --warn-soft: #FCF0DA; --bad: #C93434; --bad-soft: #FBE6E6;
  --bezel: #1D2226; --shadow: 0 1px 2px rgba(37,37,36,.06), 0 10px 30px rgba(37,37,36,.07);
  --logo-col: block; --logo-rev: none;
  /* The email preview is deliberately fixed light, like a real inbox message */
  --mail-bg: #FFFFFF; --mail-fg: #252524; --mail-muted: #5E6A72; --mail-line: #E1E5E8; --mail-band: #5E6A72; --mail-tint: #F3F6F7;
  --display: "Barlow", "Arial Narrow", Arial, sans-serif;
  --body: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0F1316; --surface: #171C20; --surface-2: #1E2429; --fg: #E6EAEC; --muted: #9AA6AD; --line: #2C343A;
  --side: #22292E; --side-fg: #FFFFFF; --side-muted: #AAB5BB; --side-active: rgba(255,255,255,.08);
  --accent: #34AEE6; --accent-ink: #04202D; --accent-soft: #0F2D3C; --accent-text: #5CC2F0;
  --good: #4CC07D; --good-soft: #12301F; --warn: #E6A443; --warn-soft: #33260F; --bad: #EF6E6E; --bad-soft: #3A1818;
  --bezel: #050708; --shadow: 0 1px 2px rgba(0,0,0,.4);
  --logo-col: none; --logo-rev: block; color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0F1316; --surface: #171C20; --surface-2: #1E2429; --fg: #E6EAEC; --muted: #9AA6AD; --line: #2C343A;
  --side: #22292E; --side-fg: #FFFFFF; --side-muted: #AAB5BB; --side-active: rgba(255,255,255,.08);
  --accent: #34AEE6; --accent-ink: #04202D; --accent-soft: #0F2D3C; --accent-text: #5CC2F0;
  --good: #4CC07D; --good-soft: #12301F; --warn: #E6A443; --warn-soft: #33260F; --bad: #EF6E6E; --bad-soft: #3A1818;
  --bezel: #050708; --shadow: 0 1px 2px rgba(0,0,0,.4);
  --logo-col: none; --logo-rev: block; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--fg); font: 14px/1.5 var(--body); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 20px 40px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: .005em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num, td.n { font-variant-numeric: tabular-nums; }
.code { font-family: var(--mono); font-size: .86em; letter-spacing: .02em; color: var(--muted); }
.logo-col { display: var(--logo-col); }
.logo-rev { display: var(--logo-rev); }

/* ---------- Top bar ---------- */
.wrap { max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.proto { display: flex; align-items: center; gap: 10px; min-width: 0; }
.proto-tag { font: 600 11px/1 var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); background: var(--accent-soft); padding: 6px 8px; border-radius: 6px; white-space: nowrap; }
.proto p { margin: 0; color: var(--muted); font-size: 13px; }
.modes { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.modes button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.modes button[aria-pressed="true"] { background: var(--side); color: var(--side-fg); }

/* ---------- Buttons, pills ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 10px; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--good); background: var(--good-soft); }
.pill.low { color: var(--warn); background: var(--warn-soft); }
.pill.out { color: var(--bad); background: var(--bad-soft); }
.pill.info { color: var(--accent-text); background: var(--accent-soft); }

/* ---------- Kiosk ---------- */
.tablet { background: var(--bezel); border-radius: 30px; padding: 16px; box-shadow: var(--shadow); max-width: 1120px; margin: 0 auto; width: 100%; }
.screen { background: var(--bg); border-radius: 16px; height: clamp(600px, 64vw, 740px); display: flex; flex-direction: column; overflow: hidden; position: relative; }
.k-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.k-head img { height: 34px; width: auto; }
.k-head .where { font-family: var(--display); font-weight: 600; color: var(--muted); font-size: 15px; }
.k-head .right { display: flex; align-items: center; gap: 12px; }
.k-clock { font-family: var(--display); font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; }
.net { border: 0; }
.k-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1.05fr 1fr; gap: 24px; padding: 24px; }
.k-body > * { min-width: 0; min-height: 0; }

.pin-intro { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-left: 16px; }
.pin-intro h2 { font-size: clamp(34px, 4.4vw, 52px); font-weight: 800; line-height: 1.02; color: var(--fg); }
.pin-intro h2 span { color: var(--accent); }
.pin-intro p { margin: 0; font-size: 18px; color: var(--muted); max-width: 30ch; }
.demo-hint { margin-top: 10px; background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; color: var(--muted); max-width: 380px; }
.demo-hint b { color: var(--fg); }
.demo-hint .row { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.pad { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.dots { display: flex; justify-content: center; gap: 16px; height: 22px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); }
.dots i.on { background: var(--accent); border-color: var(--accent); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }
.pin-msg { text-align: center; min-height: 20px; font-size: 14px; color: var(--muted); }
.pin-msg.err { color: var(--bad); font-weight: 600; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button { height: clamp(52px, 6.4vw, 70px); border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); font: 600 26px var(--display); }
.keys button:active { background: var(--accent-soft); border-color: var(--accent); }
.keys .fn { font-size: 15px; font-family: var(--body); color: var(--muted); }

.scan-side { display: flex; flex-direction: column; gap: 16px; }
.hello { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hello h2 { font-size: 30px; font-weight: 700; }
.idle { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.target { flex: 1; min-height: 170px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; text-align: center; padding: 20px; position: relative; overflow: hidden; }
.target .bars { width: 180px; height: 74px; position: relative; margin: 0 auto 14px; background: repeating-linear-gradient(90deg, var(--fg) 0 3px, transparent 3px 6px, var(--fg) 6px 7px, transparent 7px 11px, var(--fg) 11px 15px, transparent 15px 17px); opacity: .85; border-radius: 2px; }
.target .beam { position: absolute; left: -10px; right: -10px; height: 3px; top: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); animation: beam 2.2s ease-in-out infinite; }
@keyframes beam { 0%,100% { top: 8%; } 50% { top: 88%; } }
.target h3 { font-size: 24px; font-weight: 700; }
.target p { margin: 4px 0 0; color: var(--muted); }
.flash { position: absolute; inset: auto 12px 12px 12px; border-radius: 12px; padding: 10px 14px; text-align: left; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.flash small { display: block; font-weight: 400; }
.flash.good { background: var(--good-soft); color: var(--good); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash.warn .ico { background: var(--warn); }
.flash .ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--surface); flex: none; font-size: 16px; }
.flash.good .ico { background: var(--good); }
.flash.bad .ico { background: var(--bad); }
.flash span:last-child { color: var(--fg); }
.sim { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; }
.sim > * { min-width: 0; }
.sim label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.sim .row { display: flex; gap: 8px; flex-wrap: wrap; }
.sim select { flex: 1 1 200px; min-width: 0; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }

.basket { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; }
.basket-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 10px; }
.basket-head h3 { font-size: 20px; }
.lines { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px; }
.line { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 8px; border-top: 1px solid var(--line); }
.line:first-child { border-top: 0; }
.line .nm { font-weight: 600; line-height: 1.3; }
.line .warn { color: var(--warn); font-size: 12px; font-weight: 600; }
.step { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.step button { width: 42px; height: 42px; border: 0; background: var(--surface-2); font-size: 20px; font-weight: 600; }
.step span { min-width: 38px; text-align: center; font: 700 18px var(--display); font-variant-numeric: tabular-nums; }
.rm { border: 0; background: none; color: var(--muted); font-size: 22px; width: 36px; height: 36px; border-radius: 8px; }
.rm:hover { background: var(--bad-soft); color: var(--bad); }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; }
.basket-foot { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.basket-foot .btn { padding: 16px 18px; font-size: 16px; border-radius: 14px; }

.done { grid-column: 1 / -1; display: grid; place-items: center; text-align: center; }
.done .tick { width: 112px; height: 112px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; margin: 0 auto 18px; }
.done h2 { font-size: 44px; font-weight: 800; }
.done p { font-size: 18px; color: var(--muted); margin: 8px 0 20px; }
.done.queued .tick { background: var(--warn); }

/* ---------- Portal ---------- */
.portal { display: grid; grid-template-columns: 220px 1fr; background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); min-height: 720px; }
.side { background: var(--side); color: var(--side-fg); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.side img { width: 150px; height: auto; margin: 4px 8px 6px; }
.side nav { display: grid; gap: 2px; }
.side nav button { text-align: left; border: 0; background: none; color: var(--side-muted); padding: 10px 12px; border-radius: 10px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.side nav button:hover { color: var(--side-fg); }
.side nav button[aria-current="page"] { background: var(--side-active); color: var(--side-fg); font-weight: 600; box-shadow: inset 3px 0 0 #12A0DC; }
.side nav .count { font-size: 11px; background: #12A0DC; color: #fff; border-radius: 999px; padding: 1px 7px; font-weight: 700; }
.side .foot { margin-top: auto; font-size: 12px; color: var(--side-muted); padding: 0 8px; }
.main { min-width: 0; padding: 24px 28px 32px; display: grid; gap: 20px; align-content: start; background: var(--bg); }
.main-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.main-head h1 { font-size: 30px; font-weight: 700; }
.main-head p { margin: 2px 0 0; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.tile .k { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tile .v { font: 700 34px/1.1 var(--display); margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12.5px; color: var(--muted); }
.tile.warn .v { color: var(--warn); }
.tile.bad .v { color: var(--bad); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 19px; font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h2 .link { font: 600 13px var(--body); color: var(--accent-text); background: none; border: 0; padding: 0; }
.need { display: grid; grid-template-columns: 1fr 110px auto; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.need:first-of-type { border-top: 0; }
.need .nm { font-weight: 600; line-height: 1.3; }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.meter b { display: block; height: 100%; border-radius: 99px; }
.feed { display: grid; }
.feed .it { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: start; }
.feed .it:first-child { border-top: 0; }
.feed time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 1px; }
.feed .who { font-weight: 600; }
.feed .what { color: var(--muted); font-size: 13px; }
.feed .q { font: 700 16px var(--display); font-variant-numeric: tabular-nums; }
.feed .q.plus { color: var(--good); }
.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tools input, .tools select, .form input, .form select { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.tools input[type="search"] { flex: 1 1 220px; }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; }
td.code, .stockcell .num { white-space: nowrap; }
td.prod { min-width: 240px; }
.stockcell { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.stockcell .meter { width: 70px; }
.form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); flex: 0 1 auto; }
.form label.grow { flex: 1 1 260px; }
.form label.grow select, .form label.grow input { width: 100%; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; }

.rolebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.rolebar .modes button { padding: 6px 12px; font-size: 13px; }

/* ---------- Email ---------- */
.mailwrap { max-width: 760px; margin: 0 auto; width: 100%; display: grid; gap: 12px; }
.mail-meta { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; display: grid; gap: 4px; font-size: 13px; }
.mail-meta div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.mail-meta dt { color: var(--muted); }
.mail-meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mail-meta .subj { font-weight: 600; font-size: 15px; }
.attach { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface-2); width: fit-content; margin-top: 6px; }
.attach .x { width: 28px; height: 32px; border-radius: 4px; background: #1E8E4F; color: #fff; display: grid; place-items: center; font: 700 10px var(--body); }
.mail { background: var(--mail-bg); color: var(--mail-fg); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.mail-band { background: var(--mail-band); padding: 18px 24px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mail-band img { height: 30px; width: auto; }
.mail-band span { color: #fff; font-family: var(--display); font-weight: 600; }
.mail-body { padding: 24px; display: grid; gap: 20px; }
.mail-body h2 { font-size: 24px; font-weight: 700; color: var(--mail-fg); }
.mail-body p { margin: 0; color: var(--mail-muted); }
.mail-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mail-stats div { background: var(--mail-tint); border-radius: 10px; padding: 12px 14px; }
.mail-stats b { display: block; font: 700 28px/1.1 var(--display); font-variant-numeric: tabular-nums; color: var(--mail-fg); }
.mail-stats span { font-size: 12px; color: var(--mail-muted); }
.mail h3 { font-size: 16px; font-weight: 700; color: var(--mail-fg); margin-bottom: 6px; border-bottom: 2px solid #12A0DC; padding-bottom: 4px; }
.mail-tbl { overflow-x: auto; }
.mail table { min-width: 460px; }
.mail th { background: var(--mail-tint); color: var(--mail-muted); border-bottom: 1px solid var(--mail-line); }
.mail td { border-bottom: 1px solid var(--mail-line); color: var(--mail-fg); }
.mail .lowtxt { color: #A86500; font-weight: 600; }
.mail .outtxt { color: #C93434; font-weight: 600; }
.mail-foot { font-size: 12px; color: var(--mail-muted); border-top: 1px solid var(--mail-line); padding: 14px 24px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow); z-index: 20; max-width: calc(100% - 32px); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .portal { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 10px; }
  .side img { width: 110px; margin: 0 6px; }
  .side nav { display: flex; overflow-x: auto; gap: 4px; flex: 1 1 100%; }
  .side nav button { white-space: nowrap; gap: 6px; }
  .side .foot { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: 1fr; }
  .main { padding: 18px 16px 24px; }
}
@media (max-width: 760px) {
  .tablet { padding: 8px; border-radius: 20px; }
  .screen { height: auto; min-height: 560px; }
  .k-body { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
  .k-head { padding: 10px 14px; }
  .k-head img { height: 26px; }
  .k-head .where { display: none; }
  .pin-intro { padding-left: 0; }
  .basket { min-height: 300px; }
  .target { min-height: 190px; }
  .need { grid-template-columns: 1fr auto; }
  .target { display: block; }
  .flash { position: static; margin-top: 14px; }
  .sim select { flex-basis: 100%; width: 100%; }
  .step button { width: 36px; height: 40px; }
  .step span { min-width: 30px; }
  .rm { width: 30px; }
  .need .meter { display: none; }
  .mail-stats { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .target .beam { animation: none; top: 50%; }
  .dots.shake { animation: none; }
}

/* ================= Live app additions ================= */
html, body { min-height: 100%; }
body.app { padding-block: 0; padding-left: 0; padding-right: 0; }

/* Kiosk fills the tablet screen */
body.kiosk { overflow: hidden; height: 100%; }
body.kiosk .screen { height: 100vh; height: 100dvh; border-radius: 0; }
body.kiosk .k-head { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.k-center { grid-column: 1 / -1; display: grid; place-items: center; text-align: center; }
.k-card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); padding: 32px; width: min(520px, 100%); display: grid; gap: 16px; }
.k-card h2 { font-size: 30px; font-weight: 700; }
.k-card p { margin: 0; color: var(--muted); }
.k-card input { font: 600 28px var(--display); text-align: center; letter-spacing: .12em; text-transform: uppercase; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); color: var(--fg); }
.k-card .btn { padding: 16px; font-size: 17px; border-radius: 14px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice button { padding: 28px 16px; border-radius: 18px; border: 2px solid var(--line); background: var(--surface); font: 700 22px var(--display); display: grid; gap: 6px; }
.choice button small { font: 400 14px var(--body); color: var(--muted); }
.choice button:hover { border-color: var(--accent); }
.mode-tag { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); }
.err-text { color: var(--bad); font-weight: 600; min-height: 1.4em; }

/* Portal fills the window */
body.portal-page .portal { border-radius: 0; min-height: 100vh; box-shadow: none; }
body.portal-page .main { padding-left: max(28px, env(safe-area-inset-right, 0px)); }
.storebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.storebar select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.side .user { font-size: 12px; color: var(--side-muted); padding: 0 8px; display: grid; gap: 6px; }
.side .user button { justify-self: start; background: none; border: 1px solid rgba(255,255,255,.3); color: var(--side-fg); border-radius: 8px; padding: 4px 10px; font-size: 12px; }

/* Sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.login form { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 32px; width: min(400px, 100%); display: grid; gap: 14px; }
.login img { width: 170px; height: auto; margin-bottom: 6px; }
.login h1 { font-size: 24px; }

/* Forms and dialogs */
.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { font: 400 15px var(--body); color: var(--fg); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.field .help { font-weight: 400; font-size: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--fg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-back { position: fixed; inset: 0; background: rgba(15, 19, 22, .45); display: grid; place-items: center; padding: 16px; z-index: 30; }
.dialog { background: var(--surface); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; display: grid; gap: 14px; }
.dialog h2 { font-size: 22px; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.dialog .errors { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 13px; max-height: 200px; overflow: auto; }
.code-big { font: 700 34px var(--mono); letter-spacing: .1em; text-align: center; padding: 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--bad); }
.muted { color: var(--muted); }
.empty-state { color: var(--muted); padding: 24px; text-align: center; }
.inactive td { color: var(--muted); }
.toast.err { background: var(--bad); color: #fff; }
@media (max-width: 760px) { .grid2, .choice { grid-template-columns: 1fr; } }
body { margin: 0; }
a.btn { text-decoration: none; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
a.btn.primary { color: var(--accent-ink); }
td .row-actions { flex-wrap: nowrap; }
