/* My RegiBot panel — tokens mirror the app's colors.xml (dark navy, gold accent). Dark only. */
:root {
  --bg: #050814;
  --card: #111827;
  --edit: #1F2937;
  --divider: #2D3748;
  --gold: #F7D454;
  --gold-deep: #C9A63C;
  --cyan: #4CC2F0;
  --text: #FFFFFF;
  --text-2: rgba(255, 255, 255, 0.70);
  --ok: #10B981;
  --warn: #FBBF24;
  --bad: #EF4444;
  --ok-bg: rgba(16, 185, 129, 0.15);
  --warn-bg: rgba(251, 191, 36, 0.15);
  --bad-bg: rgba(239, 68, 68, 0.15);
  --neutral-bg: rgba(255, 255, 255, 0.10);
  --radius: 12px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button, input, select { font: inherit; }
a { color: var(--cyan); }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: var(--bg); border-bottom: 1px solid var(--divider);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand h1 { margin: 0; font-size: 18px; font-weight: 700; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { background: none; border: 0; color: var(--text); font-size: 20px; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; }
.iconbtn:hover { background: var(--neutral-bg); }

.view { max-width: 720px; margin: 0 auto; padding: var(--gutter); display: flex; flex-direction: column; gap: 12px; }
.pad { padding: var(--gutter); }

.card { background: var(--card); border: 1px solid var(--divider); border-radius: var(--radius); padding: 16px; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--gold-deep); }
.card h2 { margin: 0 0 4px; font-size: 13px; letter-spacing: 0.06em; color: var(--gold); text-transform: uppercase; }
.card .sub { margin: 0 0 12px; font-size: 12px; color: var(--text-2); }
.title { font-size: 22px; font-weight: 700; color: var(--gold); margin: 4px 0 0; }
.subtitle { font-size: 12px; color: var(--gold-deep); margin: 2px 0 8px; }
.note { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.note.ok { color: var(--ok); }
.note.warn { color: var(--warn); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--neutral-bg); color: var(--text-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--divider); background: transparent; color: var(--text); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--gold-deep); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1400; }
.btn.start { background: var(--ok); border-color: var(--ok); color: #03130c; }
.btn.stop { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-2); }
input[type=text], input[type=url], select { width: 100%; min-height: 46px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--divider); background: var(--edit); color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--gold-deep); outline-offset: 0; }
input.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 26px; letter-spacing: 0.18em; text-align: center; text-transform: uppercase; min-height: 60px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 480px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 680px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--edit); border-radius: 10px; padding: 10px 12px; }
.tile .v { font-size: 22px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tile .k { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; }
.tile.gold .v { color: var(--gold); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .span2 { grid-column: 1 / -1; }

.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--divider); }
.list .item:first-child { border-top: 0; }

.spinner { width: 18px; height: 18px; border: 2px solid var(--divider); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 10; padding: 0 var(--gutter); }
.toast { background: var(--card); border: 1px solid var(--divider); border-left: 4px solid var(--gold); border-radius: 10px; padding: 10px 14px; max-width: 480px; width: 100%; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.5); animation: rise 0.2s ease-out; }
.toast.ok { border-left-color: var(--ok); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.frame { display: block; width: 100%; max-width: 360px; margin: 10px auto 0; border-radius: 10px; border: 1px solid var(--divider); background: #000; aspect-ratio: 9 / 20; object-fit: contain; }
.frame.placeholder { display: flex; align-items: center; justify-content: center; color: var(--text-2); font-size: 13px; text-align: center; padding: 16px; }
/* config forms (schema-driven) */
.frow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--divider); }
.fcol { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-top: 1px solid var(--divider); }
.card .frow:first-of-type, .card .fcol:first-of-type { border-top: 0; }
.flabel { font-size: 14px; color: var(--text); }
.fhint { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.fnum { display: flex; align-items: center; gap: 8px; }
.fnum input { max-width: 180px; }
.funit { font-size: 12px; color: var(--text-2); }
.fmulti { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 12px; }
.fmulti label { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; }
.fswitch { position: relative; width: 46px; height: 26px; flex: none; }
.fswitch input { opacity: 0; width: 0; height: 0; }
.fswitch span { position: absolute; inset: 0; background: var(--edit); border: 1px solid var(--divider); border-radius: 999px; transition: background 0.15s; }
.fswitch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); transition: transform 0.15s, background 0.15s; }
.fswitch input:checked + span { background: var(--gold-deep); border-color: var(--gold-deep); }
.fswitch input:checked + span::after { transform: translateX(20px); background: #1a1400; }
.fswitch input:disabled + span { opacity: 0.45; }
.dim { opacity: 0.45; }

/* Stage B editors */
.picon { width: 28px; height: 28px; object-fit: contain; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 999px; background: var(--edit); border: 1px solid var(--divider); font-size: 13px; }
.chip-x { background: none; border: 0; color: var(--text-2); font-size: 16px; cursor: pointer; padding: 0 2px; line-height: 1; }
.chip-x:hover { color: var(--bad); }
.small-btn { min-height: 36px; padding: 0 12px; font-size: 13px; }
.small-icon { width: 32px; height: 32px; font-size: 16px; }
.psearch { margin-top: 8px; border: 1px solid var(--divider); border-radius: 10px; background: var(--card); overflow: hidden; }
.psearch-input { border: 0 !important; border-bottom: 1px solid var(--divider) !important; border-radius: 0 !important; }
.psearch-results { max-height: 280px; overflow-y: auto; }
.psearch-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; border-top: 1px solid var(--divider); font-size: 14px; }
.psearch-row:hover { background: var(--edit); }
.table-editor { display: flex; flex-direction: column; gap: 8px; }
.trow { background: var(--edit); border-radius: 10px; padding: 8px 10px; }
.trow-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.trow-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 12px; margin-top: 8px; }
.tcell { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.tcell input[type=number], .tcell select { min-height: 38px; background: var(--card); }
.tcell input[type=checkbox] { margin-top: 6px; }
.tspecies { grid-column: 1 / -1; }
.fhint-inline { color: var(--text-2); font-weight: 400; }
.editor-host { margin-top: 4px; }
.card.lock { display: flex; align-items: center; gap: 10px; border-color: var(--warn); }
input[type=checkbox] { accent-color: var(--gold); width: 18px; height: 18px; }
.empty { text-align: center; padding: 32px 16px; color: var(--text-2); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.timer { font-variant-numeric: tabular-nums; }
