/* =================================================================
 * Dhi-box · dashboard styles
 * Hand-crafted; no Tailwind (CSP forbids the Play CDN runtime, and a
 * build pipeline isn't worth it at this scope). Design tokens below
 * carry both dark (default) and light themes; theme is toggled by
 * adding/removing `.light` on <html>.
 * ================================================================= */

:root {
  /* Brand mascot */
  --brand-1:  #6366f1;       /* indigo body  */
  --brand-2:  #818cf8;       /* lighter top-flap */
  --brand-3:  #4f46e5;       /* shadow side */
  --brand-cheek: #f9a8d4;

  /* Dark theme (default) */
  --bg: #0a0d12;
  --panel: #11151c;
  --panel2: #161b25;
  --panel3: #1c2230;
  --border: #232a3a;
  --border-strong: #2f3849;
  --text: #e8edf5;
  --text-soft: #b1bac9;
  --muted: #7a8497;
  --accent: #6366f1;
  --accent-soft: rgba(99,102,241,0.16);
  --accent-fg: #c7d2fe;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --code-bg: #05080d;
  --shadow: 0 1px 0 rgba(255,255,255,0.02), 0 4px 24px rgba(0,0,0,0.25);

  --radius: 12px;
  --radius-sm: 8px;

  --bottom-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root.light {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel2: #f1f3f9;
  --panel3: #e7eaf3;
  --border: #e2e6ef;
  --border-strong: #cdd3df;
  --text: #14181f;
  --text-soft: #404853;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-soft: rgba(99,102,241,0.12);
  --accent-fg: #4338ca;
  --green: #059669;
  --orange: #d97706;
  --red: #dc2626;
  --code-bg: #f1f3f9;
  --shadow: 0 1px 0 rgba(0,0,0,0.02), 0 4px 24px rgba(15,23,42,0.06);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12.5px;
  background: var(--panel2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}

/* ---------- Mascot ---------- */
.logo, .logo-sm, .logo-lg { display: block; }
.logo { width: 56px; height: 56px; }
.logo-sm { width: 26px; height: 26px; }
.logo-lg { width: 96px; height: 96px; }

/* ---------- Login screen ---------- */
.centered {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.brand-block {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: 8px;
}
.brand-block h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.brand-block p { margin: 0; font-size: 13px; color: var(--muted); }
.errline {
  min-height: 1.2em; color: var(--red); font-size: 12.5px; margin: 0; text-align: center;
}

/* ---------- App shell ---------- */
body.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidenav {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
}
.sidenav .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 18px; margin-bottom: 4px;
  font-weight: 700; font-size: 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.sidenav .brand:hover { text-decoration: none; }
.sidenav nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidenav nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 500; font-size: 13.5px;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.sidenav nav a svg { width: 16px; height: 16px; flex: none; opacity: 0.85; }
.sidenav nav a:hover { background: var(--panel2); color: var(--text); text-decoration: none; }
.sidenav nav a.active { background: var(--accent-soft); color: var(--accent-fg); }
.sidenav nav a.active svg { color: var(--accent); opacity: 1; }

.sidenav-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-top: 1px solid var(--border);
  margin-top: 8px;
  font-size: 13px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  flex: none;
}
.avatar-lg {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 22px;
  flex: none;
}
.sidenav-foot .who { flex: 1; min-width: 0; overflow: hidden; }
.sidenav-foot .who .name { color: var(--text); font-weight: 600; }
.sidenav-foot .who .role { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.sidenav-foot a.signout { color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.sidenav-foot a.signout:hover { color: var(--text); background: var(--panel2); text-decoration: none; }

/* ---------- Bottom toolbar (mobile) ---------- */
.bottombar {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--bottom-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  /* Sits a hair lighter than the page in dark mode for clear separation,
     plus a stronger top shadow + a 1px inner highlight for the lifted feel. */
  background: var(--panel2);
  border-top: 1px solid var(--border-strong);
  box-shadow:
    0 -10px 28px rgba(0,0,0,0.55),
    0 -1px 0 rgba(255,255,255,0.05) inset;
  z-index: 30;
}
:root.light .bottombar {
  background: #ffffff;
  border-top: 1px solid var(--border);
  box-shadow:
    0 -8px 22px rgba(15,23,42,0.10),
    0 -1px 0 rgba(0,0,0,0.02) inset;
}

.bottombar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 500;
  text-decoration: none; padding: 6px 4px;
  transition: color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.bottombar a svg { width: 22px; height: 22px; }
.bottombar a:hover { color: var(--text); text-decoration: none; }
.bottombar a.active { color: var(--accent); }
.bottombar a.active svg { stroke: var(--accent); }

/* Center "Apps" button — the primary action. Floats slightly above the bar
   with a brand-tinted ring; pops into a filled disk when active. */
.bottombar a.center { position: relative; }
.bottombar a.center .ring {
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--panel3);
  border: 1px solid var(--border-strong);
  margin-top: -22px;
  box-shadow:
    0 6px 16px rgba(0,0,0,0.45),
    0 0 0 4px var(--panel2);
  transition: background 0.16s, border-color 0.16s, transform 0.16s;
}
.bottombar a.center svg { width: 24px; height: 24px; color: var(--text-soft); }
.bottombar a.center:hover .ring { transform: translateY(-1px); border-color: var(--accent); }
.bottombar a.center.active .ring {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow:
    0 8px 22px rgba(99,102,241,0.45),
    0 0 0 4px var(--panel2);
}
.bottombar a.center.active svg { color: white; stroke: white; }
:root.light .bottombar a.center .ring {
  box-shadow:
    0 6px 16px rgba(15,23,42,0.18),
    0 0 0 4px #ffffff;
}
:root.light .bottombar a.center.active .ring {
  box-shadow:
    0 8px 22px rgba(99,102,241,0.32),
    0 0 0 4px #ffffff;
}

/* ---------- Slide-up sheet ---------- */
.sheet-root {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-root[hidden] { display: none; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  animation: fadeIn 0.18s ease-out both;
}
.sheet {
  position: relative; width: 100%; max-width: 640px;
  background: var(--panel);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
  padding: 8px 18px calc(18px + var(--safe-bottom));
  animation: slideUp 0.24s cubic-bezier(0.32, 0.72, 0, 1) both;
}
.sheet h2 { margin: 4px 0 12px; font-size: 16px; font-weight: 600; }
.sheet-handle {
  width: 36px; height: 4px; background: var(--border-strong);
  border-radius: 2px; margin: 6px auto 14px;
}
.sheet-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sheet-list li a, .sheet-list li button {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 12px; border-radius: var(--radius-sm);
  font: 500 14.5px inherit; font-family: inherit;
  color: var(--text); text-decoration: none;
  background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer;
  transition: background 0.12s;
}
.sheet-list li a:hover, .sheet-list li button:hover { background: var(--panel2); text-decoration: none; }
.sheet-list li svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.sheet-list li.danger a, .sheet-list li.danger button { color: var(--red); }
.sheet-list li.danger svg { color: var(--red); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---------- Main ---------- */
main {
  padding: 28px 36px 80px;
  max-width: 1180px; width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.page {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.page p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
section { margin-top: 28px; }
section > h2 { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 10px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Card / forms ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.card.pad-0 { padding: 0; overflow: hidden; }
.card.row.between { padding: 16px 20px; }

.profile-card { display: flex; align-items: center; gap: 16px; }
.profile-card .prof-name { font-size: 18px; font-weight: 600; }
.profile-card .prof-role { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

.form-grid { display: flex; flex-direction: column; gap: 16px; max-width: 720px; padding: 22px 24px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-soft); font-weight: 500; }
.form-grid label.grow { flex: 1; min-width: 180px; }
.form-grid label.w-120 { width: 120px; flex: none; }
.form-grid .hint { color: var(--muted); font-size: 11.5px; font-weight: 400; margin: 0; }
.form-grid .actions { margin-top: 4px; }

input, select, textarea {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit; font-size: 14px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
  -webkit-appearance: none; appearance: none;
  width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  background: var(--panel3);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; min-height: 120px; }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 380px; padding: 32px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-soft); }

/* ---------- Rows / utility ---------- */
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap-8 { gap: 8px; }
.row.gap-12 { gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.link { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--border-strong);
  background: var(--panel2);
  color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm);
  font: 500 13.5px inherit; font-family: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--panel3); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn.danger { color: var(--red); border-color: rgba(239,68,68,0.4); }
.btn.danger:hover { background: rgba(239,68,68,0.12); border-color: var(--red); color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel2); border-color: var(--border); }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ---------- Tables ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td {
  padding: 12px 18px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
table.list th {
  background: var(--panel2);
  color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr { transition: background 0.1s ease; }
table.list tbody tr:hover { background: var(--panel2); }
table.list td .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
table.list td.muted, table.list .empty { color: var(--muted); font-style: italic; }

/* ---------- Status pills ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.running, .status.active, .status.success { background: rgba(16,185,129,0.13); color: var(--green); }
.status.sleeping { background: rgba(245,158,11,0.13); color: var(--orange); }
.status.failed, .status.stopped, .status.disabled { background: rgba(239,68,68,0.13); color: var(--red); }
.status.created, .status.queued, .status.building, .status.deploying { background: var(--accent-soft); color: var(--accent-fg); }

/* Generic info pill (e.g. the "private" marker on super-admin-only apps). */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: rgba(245,158,11,0.13); color: var(--orange);
}

/* ---------- Shared table view: toolbar + footer ---------- */
.tbl-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px; align-items: center;
}
.tbl-search {
  position: relative;
  flex: 1 1 240px;
  min-width: 200px;
  max-width: 380px;
}
.tbl-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--muted); pointer-events: none;
}
.tbl-search input {
  padding-left: 36px; height: 38px; width: 100%;
}
.tbl-toolbar select {
  height: 38px;
  width: auto;            /* override the global input/select width:100% */
  min-width: 160px;
  flex: 0 0 auto;
}
@media (max-width: 540px) {
  .tbl-search { flex: 1 1 100%; max-width: none; }
  .tbl-toolbar select { width: 100%; flex: 1 1 100%; }
}
.tbl-footer {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
  margin-top: 12px;
  font-size: 12.5px; color: var(--muted);
}
.tbl-pages { display: flex; align-items: center; gap: 6px; }
.tbl-page-num { padding: 0 6px; font-weight: 500; color: var(--text-soft); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--panel2); border-color: var(--border-strong); }

/* ---------- Stat grid (DB detail) ---------- */
.stat-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 8px;
}
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 600; margin-top: 6px; letter-spacing: -0.01em; }
.stat-foot { margin-top: 10px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- URL chip (app detail) ---------- */
.url-chip {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 7px 12px;
  background: var(--accent-soft); color: var(--accent-fg);
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  max-width: 100%;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.url-chip svg { width: 14px; height: 14px; flex: none; }
.url-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
.url-chip:hover { background: var(--panel3); border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }

/* ---------- Connection string + log boxes ---------- */
.connstring {
  display: inline-block;
  font-family: ui-monospace, monospace; font-size: 11.5px;
  background: var(--panel3); padding: 4px 8px; border-radius: 4px;
  color: var(--text-soft); cursor: pointer;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: middle;
}
.connstring:hover { color: var(--text); }

.logbox {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--text-soft);
  max-height: 520px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  margin: 0;
}

/* ---------- Custom domains ---------- */
.domain-row {
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.domain-row code { word-break: break-all; }
.domain-list .hint { margin: -4px 0 10px; }

/* ---------- Modal ---------- */
.modal-root {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 20px;
}
.modal-root[hidden] { display: none; }
.modal {
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow:
    0 24px 60px rgba(0,0,0,0.55),
    0 1px 0 rgba(255,255,255,0.04) inset;
  width: 100%; max-width: 460px; max-height: 92vh; overflow: auto;
  padding: 24px 24px 22px;
  animation: popIn 0.18s ease-out both;
}
:root.light .modal {
  border: 1px solid #d4d8e2;
  box-shadow:
    0 24px 60px rgba(15,23,42,0.22),
    0 1px 0 rgba(255,255,255,0.5) inset;
}
.modal h2 { margin: 0 0 18px; font-size: 18px; font-weight: 600; }
.modal .form-grid { padding: 0; max-width: none; }
:root.light .modal input,
:root.light .modal select,
:root.light .modal textarea {
  background: #ffffff;
  border-color: #cdd3df;
}
:root.light .modal input:hover,
:root.light .modal select:hover,
:root.light .modal textarea:hover { border-color: #9ba3b3; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
/* (modal heading + form-grid styles moved into the .modal block above) */

/* ---------- Theme toggle ---------- */
.theme-toggle { display: flex; gap: 8px; padding: 12px 16px; }
.theme-toggle button {
  display: flex; align-items: center; gap: 8px;
  flex: 1; padding: 10px 12px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font: 500 13px inherit; font-family: inherit;
  transition: all 0.12s;
}
.theme-toggle button:hover { border-color: var(--accent); }
.theme-toggle button.active {
  background: var(--accent-soft); color: var(--accent-fg);
  border-color: var(--accent);
}
.theme-toggle .dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--border-strong); }
.theme-toggle .dot.light { background: #f6f7fb; }
.theme-toggle .dot.dark { background: #0a0d12; }
.theme-toggle .dot.system { background: linear-gradient(135deg, #f6f7fb 50%, #0a0d12 50%); }

/* ---------- Toasts ---------- */
.toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel); border: 1px solid var(--border);
  padding: 12px 16px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 13px;
  animation: slideIn 0.18s ease-out both;
}
.toast.success { border-color: rgba(16,185,129,0.5); color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,0.5); color: var(--red); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =================================================================
 * RESPONSIVE
 * ================================================================= */
@media (max-width: 768px) {
  body.app {
    grid-template-columns: 1fr;
    padding-bottom: calc(var(--bottom-h) + var(--safe-bottom));
  }
  .sidenav { display: none; }
  .bottombar { display: flex; }
  main { padding: 16px 14px 32px; max-width: none; }
  .page h1 { font-size: 20px; }
  .page p { font-size: 13px; }
  .card { padding: 16px; }
  .card.pad-0 { padding: 0; }
  .form-grid { padding: 16px; gap: 14px; }
  .form { padding: 22px; }
  table.list th, table.list td { padding: 10px 12px; font-size: 12.5px; }
  .toast-root { bottom: calc(var(--bottom-h) + 16px); right: 12px; left: 12px; }
  .toast { width: 100%; }
  .modal { max-width: none; border-radius: var(--radius); }
}

@media (max-width: 540px) {
  .hide-sm { display: none; }
}
@media (max-width: 380px) {
  .hide-xs { display: none; }
}

/* ===== app-type radio cards (new-app form) ===== */
.apptype-toggle { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.apptype-toggle legend { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; padding: 0; }
.apptype-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel2); cursor: pointer; transition: border-color .1s, background .1s; }
.apptype-opt:hover { border-color: var(--border-strong); }
.apptype-opt input[type="radio"] { margin-top: 3px; accent-color: var(--accent); flex: 0 0 auto; }
.apptype-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.apptype-label { display: flex; flex-direction: column; gap: 2px; }
.apptype-label strong { font-size: 14px; }
.apptype-label .hint { font-size: 12px; color: var(--muted); }
@media (max-width: 540px) { .apptype-toggle { grid-template-columns: 1fr; } }

/* tiny admin badge inside app-type radio cards */
.apptype-label .badge { display: inline-block; margin-left: 6px; padding: 1px 7px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-fg); background: var(--accent-soft); border-radius: 999px; vertical-align: middle; }

/* ===== image-upload progress bar ===== */
.upload-progress { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel2); }
.upload-progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.upload-progress-track { height: 6px; background: var(--panel3); border-radius: 3px; overflow: hidden; }
.upload-progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .15s ease-out; }
.upload-progress.done .upload-progress-fill { background: var(--green); }
.upload-progress.failed .upload-progress-fill { background: var(--red); }
.upload-progress.failed .upload-status { color: var(--red); }
