/* account-wiz dashboard. Dark only, colours from the wizard icon. No inline styles (CSP style-src 'self'). */
:root {
  --bg: #0b0820;
  --bg-2: #120d33;
  --surface: #17113d;
  --surface-2: #1f1750;
  --line: #2e2468;
  --line-2: #43379a;
  --text: #ece8ff;
  --muted: #a49ccc;
  --faint: #6f679c;
  --accent: #7d52f5;
  --accent-hi: #b48cff;
  --accent-ink: #ffffff;
  --cyan: #5ef0ff;
  --gold: #ffd34d;
  --ok: #4ade80;
  --bad: #ff6b81;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -200px, #24186a 0%, var(--bg) 70%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
a { color: var(--accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: rgba(11, 8, 32, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand img { border-radius: 7px; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav .link { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 14px; }
.nav a:hover, .nav .link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--surface-2); }

.app { max-width: 1200px; margin: 0 auto; padding: 24px 16px 80px; }
.narrow { max-width: 720px; margin: 0 auto; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 40px 0; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

h1 { font-size: 24px; margin: 0; letter-spacing: -.2px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.back { display: inline-block; color: var(--muted); font-size: 14px; margin-bottom: 10px; }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, transform .05s;
}
button:hover, .btn:hover { background: #2a2066; border-color: #5747b8; text-decoration: none; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; transform: none; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.primary:hover { background: #8d66ff; border-color: #8d66ff; }
.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.danger { background: transparent; border-color: #6b2a3f; color: var(--bad); }
.danger:hover { background: #3a1426; border-color: var(--bad); }
.danger.solid { background: #b3264a; border-color: #b3264a; color: #fff; }
.danger.solid:hover { background: #cc2e56; }
.link { background: none; border: 0; min-height: 0; padding: 0; color: var(--accent-hi); font-weight: 500; }
.link:hover { background: none; text-decoration: underline; }
.icon-btn { width: 38px; padding: 0; font-size: 18px; line-height: 1; }

/* ---------- forms ---------- */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel { padding: 20px; }
.panel + .panel { margin-top: 16px; }
.form { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label:not(.drop), .label { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.hint { font-size: 12.5px; color: var(--faint); }
.count { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--faint); }
.count.over { color: var(--bad); }
input[type=text], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 9px 11px; min-height: 40px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-hi); box-shadow: 0 0 0 3px rgba(125, 82, 245, .25); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[readonly] { color: var(--muted); background: transparent; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.problems { background: #2a0f22; border: 1px solid #6b2a3f; color: #ffc2cd; border-radius: var(--radius-sm); padding: 10px 14px; margin: 0; }
.problems ul { margin: 0; padding-left: 18px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); font-weight: 700; margin: 4px 0 -4px; }

/* file pickers + previews */
.drop {
  position: relative; display: grid; place-items: center; gap: 6px; text-align: center;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-2);
  color: var(--muted); font-size: 13px; padding: 14px; cursor: pointer; min-height: 96px; overflow: hidden;
}
.drop:hover, .drop.over { border-color: var(--accent-hi); color: var(--text); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop img, .drop video { display: block; max-height: 160px; border-radius: var(--radius-sm); object-fit: cover; }
.drop.pick-avatar img { width: 96px; height: 96px; border-radius: 50%; }
.drop.pick-banner img { width: 100%; aspect-ratio: 3 / 1; max-height: none; }
.drop .clear-file { position: relative; z-index: 2; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; min-height: 0; width: 24px; height: 24px; padding: 0; border-radius: 50%; background: rgba(11, 8, 32, .8); font-size: 14px; }

/* ---------- account cards ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar select { width: auto; min-width: 180px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.acct { padding: 16px; display: grid; gap: 14px; position: relative; transition: border-color .15s; }
.acct:hover { border-color: var(--line-2); }
.acct-head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; object-fit: cover; background: linear-gradient(135deg, #3b2a8f, #6a3df0); display: grid; place-items: center; font-weight: 700; font-size: 18px; color: #fff; position: relative; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .dot { position: absolute; right: 0; bottom: 0; border: 2px solid var(--surface); width: 14px; height: 14px; }
.acct-id { min-width: 0; flex: 1; }
.acct-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.acct-name code { font-size: 12px; font-weight: 500; color: var(--muted); }
.acct-display { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.acct-meta dt { color: var(--faint); }
.acct-meta dd { margin: 0; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btns { display: flex; gap: 8px; }
.acct-btns > :not(.icon-btn) { flex: 1; }
.acct.busy { border-color: #2a6f8a; }
.flag { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.logged_in { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, .15); }
.dot.logged_out { background: var(--gold); }
.dot.needs_attention { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 107, 129, .2); }

.reveal { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
.reveal .mono { flex: 1; word-break: break-all; color: var(--text); }
.reveal .timer { color: var(--faint); font-variant-numeric: tabular-nums; }

/* overflow menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 210px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 6px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); display: grid;
}
.menu button { justify-content: flex-start; background: none; border: 0; font-weight: 500; min-height: 36px; padding: 0 10px; }
.menu button:hover { background: #2e2470; }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 4px; }
.menu .danger { color: var(--bad); }

/* active jobs strip */
.activity { margin-bottom: 18px; padding: 12px 14px; display: grid; gap: 8px; border-color: #24577a; background: linear-gradient(180deg, #13214a, var(--surface)); }
.activity-row { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.activity-row .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row.waiting { color: var(--gold); }

/* ---------- jobs ---------- */
.job { display: grid; gap: 14px; }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.job-title { font-weight: 700; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-2); }
.chip.running, .chip.queued { color: var(--cyan); border-color: #24577a; }
.chip.waiting { color: var(--gold); border-color: #6b5a1f; }
.chip.done { color: var(--ok); border-color: #1f5a3a; }
.chip.failed, .chip.interrupted { color: var(--bad); border-color: #6b2a3f; }
.chip.running::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .chip.running::before { animation: none; } }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 14px; max-height: 280px; overflow-y: auto; }
.steps li { display: flex; gap: 10px; padding: 5px 0; color: var(--muted); }
.steps li::before { content: "✓"; color: var(--faint); width: 14px; flex: none; text-align: center; }
.steps li:last-child { color: var(--text); }
.job.live .steps li:last-child::before { content: "›"; color: var(--cyan); font-weight: 700; }
.steps .empty::before { content: ""; }

.question { border: 1px solid #6b5a1f; background: #241d0b; border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.question p { margin: 0; color: #ffe9a6; }
.question form { display: flex; gap: 8px; }
.question input { flex: 1; }

.result { border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; border: 1px solid #1f5a3a; background: #0d2219; }
.result.bad { border-color: #6b2a3f; background: #22101b; }
.result-title { font-weight: 700; }
.result.bad .result-title { color: #ffc2cd; }
.result.ok .result-title { color: #b7f5cc; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; word-break: break-word; }
.warns { margin: 0; padding: 10px 12px 10px 30px; border-radius: var(--radius-sm); background: #241d0b; color: #ffe9a6; border: 1px solid #6b5a1f; font-size: 14px; }
.ba { width: 100%; border-collapse: collapse; font-size: 14px; }
.ba th, .ba td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.ba th { color: var(--faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.ba td:first-child { color: var(--faint); white-space: nowrap; }
.ba .changed { color: var(--text); font-weight: 600; }
.shot { display: block; border-radius: var(--radius-sm); border: 1px solid var(--line-2); overflow: hidden; }
.shot img { display: block; width: 100%; max-height: 380px; object-fit: contain; background: var(--bg); }
.big-link { font-weight: 700; word-break: break-all; }

/* ---------- history ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.hrow { cursor: pointer; }
.table tr.hrow:hover td { background: #1b1446; }
.table tr.open td { background: #1b1446; border-bottom-color: transparent; }
.table .detail td { background: var(--bg-2); padding: 16px; cursor: default; }
.table .when { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.table .summary { color: var(--muted); max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
details.raw summary { cursor: pointer; color: var(--faint); font-size: 13px; }
details.raw pre { font-family: var(--mono); font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; overflow: auto; max-height: 300px; white-space: pre-wrap; word-break: break-word; }

/* ---------- login ---------- */
.login { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.login .panel { width: min(380px, 100%); padding: 28px; display: grid; gap: 18px; text-align: center; }
.login img { margin: 0 auto; border-radius: 18px; box-shadow: 0 10px 40px rgba(125, 82, 245, .35); }
.login form { display: grid; gap: 12px; text-align: left; }

/* ---------- modal + toasts ---------- */
.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0; border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal::backdrop { background: rgba(5, 3, 18, .7); backdrop-filter: blur(3px); }
.modal-body { padding: 20px; display: grid; gap: 16px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { margin: 0; }
.toasts { position: fixed; z-index: 50; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 11px 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: up .18s ease-out; }
.toast.bad { border-color: #6b2a3f; color: #ffc2cd; }
.toast.ok { border-color: #1f5a3a; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

.empty-state { text-align: center; padding: 56px 20px; display: grid; gap: 12px; justify-items: center; }
.empty-state img { opacity: .9; border-radius: 14px; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .app { padding: 16px 16px 72px; }
  .top { padding: 8px 12px; gap: 8px; }
  .brand span { display: none; }
  .nav a, .nav .link { padding: 6px 8px; }
  .grid { grid-template-columns: 1fr; }
  .grid-2, .detail-grid { grid-template-columns: 1fr; }
  h1 { font-size: 21px; }
  .panel { padding: 16px; }
  .toolbar { width: 100%; }
  .toolbar > * { flex: 1; }
  .actions > * { flex: 1; }
  .thumbs { grid-template-columns: repeat(2, 1fr); }
  /* history table becomes stacked rows */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr.hrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table tr.hrow td { padding: 0; border: 0; background: none; }
  .table tr.open { background: #1b1446; }
  .table .summary { grid-column: 1 / -1; max-width: none; }
  .table .detail td { padding: 14px; }
}
