/* Frontier Avatar III Portal - Built directly on Frontier 6.2.1 Studio design tokens */

:root {
  --bg-0: #0B0B0D;
  --bg-1: #111114;
  --bg-2: #17171B;
  --bg-3: #1E1E23;
  --bg-4: #26262C;
  --bg-5: #303037;
  --glass: rgba(23, 23, 27, 0.78);
  --glass-blur: saturate(140%) blur(16px);
  --scrim: rgba(0, 0, 0, 0.65);

  --line-1: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.10);
  --line-3: rgba(255, 255, 255, 0.16);
  --line-input: #4a4a52;
  --sheen: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --text-1: #EDEDF0;
  --text-2: #A3A3AD;
  --text-3: #8A8A93;
  --text-off: #55555D;

  --accent: #FFB224;
  --accent-hover: #FFC24D;
  --accent-press: #F09A00;
  --accent-ink: #1A1104;
  --accent-soft: rgba(255, 178, 36, 0.12);
  --accent-line: rgba(255, 178, 36, 0.40);
  --accent-grad: linear-gradient(135deg, #FFC94D 0%, #FF8A1F 55%, #FF5E3A 100%);
  --accent-glow: 0 0 0 1px rgba(255, 178, 36, 0.40), 0 8px 32px -8px rgba(255, 138, 31, 0.55);

  --blob-amber: radial-gradient(900px 640px at 6% -8%, rgba(255, 128, 32, 0.20), rgba(255, 128, 32, 0.06) 45%, transparent 70%);
  --blob-blue: radial-gradient(820px 600px at 100% -4%, rgba(46, 86, 180, 0.24), rgba(46, 86, 180, 0.07) 45%, transparent 70%);

  --ok: #3DD68C;
  --ok-soft: rgba(61, 214, 140, 0.12);
  --run: #6AA8FF;
  --run-soft: rgba(106, 168, 255, 0.12);
  --warn: #F5C451;
  --warn-soft: rgba(245, 196, 81, 0.12);
  --err: #FF6369;
  --err-soft: rgba(255, 99, 105, 0.12);
  --queued: #A3A3AD;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  --shadow-2: var(--sheen), 0 4px 12px -2px rgba(0, 0, 0, 0.50);
  --shadow-3: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 48px -8px rgba(0, 0, 0, 0.70), 0 4px 12px rgba(0, 0, 0, 0.40);
  --ring: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--accent);

  --font-ui: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --font-accent: "Instrument Serif", Georgia, serif;

  --sb-w: 260px;
  --main-off: calc(var(--sb-w) + 16px);
  --gutter: 32px;
  --topbar-h: 56px;
  --content-max: 1180px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-std: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
}

@media (max-width: 920px) {
  :root {
    --main-off: 0px;
    --gutter: 16px;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: dark; background: var(--bg-0); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text-1);
  font: 400 14px/22px var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video { display: block; max-width: 100%; }
svg { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
pre, code { font-family: var(--font-mono); }
table { border-collapse: collapse; width: 100%; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--ring); }
::selection { background: rgba(255, 178, 36, 0.28); color: var(--text-1); }
[hidden] { display: none !important; }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }

/* Ambient Frontier Studio background blobs */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--blob-amber), var(--blob-blue), var(--bg-0);
}

/* Typography utilities */
.overline {
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-accent); font-style: italic; font-weight: 400; letter-spacing: 0; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.err-text { color: var(--err); }
.accent-text { color: var(--accent); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link { color: var(--accent); font-weight: 500; text-underline-offset: 3px; }
.link:hover { color: var(--accent-hover); text-decoration: underline; }

/* Layout helpers */
.hstack { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vstack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.divider { height: 1px; background: var(--line-1); border: 0; margin: 16px 0; }

/* App shell */
.app { position: relative; z-index: 1; height: 100%; }
.main {
  position: relative;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: var(--main-off);
}
.page {
  position: relative;
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 36px var(--gutter) 84px;
}

/* Inset floating sidebar (Frontier 6.2.1 signature chrome) */
.sidebar {
  position: fixed;
  z-index: 20;
  top: 8px;
  bottom: 8px;
  left: 8px;
  width: var(--sb-w);
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg-1) 93%, transparent);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--sheen), 0 12px 40px -16px rgba(0, 0, 0, 0.72);
}
.sb-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px 12px;
}
.sb-top {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 4px 0 8px;
  margin-bottom: 14px;
}
.sb-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sb-logo img { height: 22px; width: auto; }
.sb-ver {
  margin-left: auto;
  font: 500 10px/16px var(--font-mono);
  color: var(--accent);
  padding: 0 7px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-full);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
}

.sb-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 11px;
  width: 100%;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  transition: background-color var(--dur-1) var(--ease-std), color var(--dur-1) var(--ease-std);
}
.nav-item svg { width: 16px; height: 16px; color: var(--text-3); transition: color var(--dur-1); }
.nav-item:hover { background: var(--bg-3); color: var(--text-1); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item[aria-current="page"] {
  background: var(--bg-4);
  color: var(--text-1);
  box-shadow: var(--sheen);
}
.nav-item[aria-current="page"] svg { color: var(--accent); }
.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2.5px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 11px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.sb-sep { height: 1px; background: var(--line-1); margin: 14px 4px; }
.sb-spacer { flex: 1 0 16px; }

/* Sidebar balance / quota card */
.bal-card {
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  box-shadow: var(--sheen);
}
.bal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.bal-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.bal-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  margin: 0;
  font-size: 12px;
}
.bal-rows dt { color: var(--text-2); }
.bal-rows dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-1);
  text-align: right;
}

.sb-cluster-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-2);
  font-size: 12px;
  color: var(--text-3);
}
.sb-cluster-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--text-1); font-weight: 600; }
.sb-conn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ok);
}
.sb-conn i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--ok-soft); }
.sb-conn.warn { color: var(--warn); }
.sb-conn.warn i { background: var(--warn); box-shadow: 0 0 0 2px var(--warn-soft); }

/* Mobile topbar + drawer */
.topbar { display: none; }
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-std);
}
html.sb-open .drawer-scrim { opacity: 1; pointer-events: auto; }

@media (max-width: 920px) {
  .topbar {
    position: fixed;
    z-index: 30;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    background: var(--glass);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--line-1);
  }
  .topbar .tb-logo img { height: 20px; width: auto; }
  .main {
    margin-top: var(--topbar-h);
    height: calc(100dvh - var(--topbar-h));
  }
  .page { padding: 20px var(--gutter) 72px; }
  .sidebar {
    z-index: 40;
    width: min(300px, calc(100vw - 44px));
    transform: translateX(calc(-100% - 20px));
    visibility: hidden;
    transition: transform var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
  }
  html.sb-open .sidebar {
    transform: none;
    visibility: visible;
    transition: transform var(--dur-3) var(--ease-out), visibility 0s;
    box-shadow: var(--shadow-3);
  }
}

/* Page headers */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.ph-left { display: flex; align-items: flex-start; gap: 14px; min-width: 0; flex: 1 1 360px; }
.ph-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  box-shadow: var(--sheen);
  color: var(--accent);
}
.ph-text { min-width: 0; flex: 1; }
.ph-text h1 {
  font-size: 28px;
  line-height: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ph-text h1 .serif { font-size: 1.12em; color: var(--accent-hover); font-weight: 400; }
.ph-text p { color: var(--text-2); margin-top: 4px; max-width: 66ch; }
.ph-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
@media (max-width: 760px) {
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 20px; }
  .ph-left { flex: none; width: 100%; }
  .ph-text h1 { font-size: 23px; line-height: 29px; }
  .ph-actions { width: 100%; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--text-1);
  font-weight: 500;
  font-size: 13.5px;
  white-space: nowrap;
  box-shadow: var(--sheen);
  transition: background-color var(--dur-1), border-color var(--dur-1), box-shadow var(--dur-1), transform 80ms;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--bg-4); border-color: var(--line-3); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 1px 2px rgba(0, 0, 0, 0.4);
}
.btn.primary:hover {
  background: var(--accent-hover);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), var(--accent-glow);
}
.btn.grad {
  background: var(--accent-grad);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), 0 6px 20px -6px rgba(255, 138, 31, 0.55);
}
.btn.grad:hover { filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), var(--accent-glow); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-3); color: var(--text-1); }
.btn.danger { background: var(--err-soft); border-color: rgba(255, 99, 105, 0.28); color: var(--err); box-shadow: none; }
.btn.danger:hover { background: rgba(255, 99, 105, 0.20); border-color: rgba(255, 99, 105, 0.50); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: var(--r-xs); }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; border-radius: var(--r-md); }
.btn.icon { width: 34px; height: 34px; padding: 0; }
.btn.block { width: 100%; }

/* Cards & grids */
.card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-lg);
  box-shadow: var(--sheen);
}
.card.pad { padding: 20px; }
.card.pad-sm { padding: 14px 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.card-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 1080px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }

.kpi-card {
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  box-shadow: var(--sheen);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-val {
  font-size: 24px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 12px; color: var(--text-3); }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 980px) { .two-col { grid-template-columns: 1fr; } }

/* Status pills & badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: var(--r-xs);
  background: var(--bg-4);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.run { background: var(--run-soft); color: var(--run); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  background: var(--bg-4);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.status .dot { position: relative; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(61, 214, 140, 0.22); }
.status.run { background: var(--run-soft); color: var(--run); border-color: rgba(106, 168, 255, 0.28); }
.status.run .dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: ping 1.6s var(--ease-out) infinite;
}
.status.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(245, 196, 81, 0.24); }
.status.err { background: var(--err-soft); color: var(--err); border-color: rgba(255, 99, 105, 0.28); }
.status.queued { background: transparent; color: var(--text-2); border-color: var(--line-2); }
.status.queued .dot { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.65; } 80%, 100% { transform: scale(2.8); opacity: 0; } }

/* Progress bar */
.progress {
  position: relative;
  height: 6px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  border-radius: inherit;
  background: var(--accent-grad);
  transition: width 600ms var(--ease-std);
}
.progress.run > i { background: var(--run); }
.progress.ok > i { background: var(--ok); }

/* Callout */
.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 18px;
}
.callout svg { width: 16px; height: 16px; margin-top: 2px; color: var(--accent); }
.callout.info { background: var(--run-soft); border-color: rgba(106, 168, 255, 0.22); }
.callout.info svg { color: var(--run); }
.callout.warn { background: var(--warn-soft); border-color: rgba(245, 196, 81, 0.28); }
.callout.warn svg { color: var(--warn); }
.callout.err { background: var(--err-soft); border-color: rgba(255, 99, 105, 0.30); }
.callout.err svg { color: var(--err); }
.callout.ok { background: var(--ok-soft); border-color: rgba(61, 214, 140, 0.24); }
.callout.ok svg { color: var(--ok); }
.callout b { color: var(--text-1); font-weight: 600; display: block; margin-bottom: 2px; }

/* Queue rows */
.queue-list { display: flex; flex-direction: column; gap: 8px; }
.queue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  background: var(--bg-1);
  border: 1px solid var(--line-1);
}
.queue-item.mine {
  border-color: var(--accent-line);
  background: color-mix(in srgb, var(--bg-2) 90%, #FFB224);
}
.queue-rank {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  font: 600 12px/1 var(--font-mono);
  color: var(--text-2);
}
.queue-item.mine .queue-rank { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* Form fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.field-hint { font-size: 12px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  background: var(--bg-1);
  border: 1px solid var(--line-input);
  color: var(--text-1);
  font-size: 13.5px;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.textarea { height: auto; min-height: 82px; padding: 9px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 178, 36, 0.18);
}
.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8A93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.select option { background: var(--bg-2); color: var(--text-1); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* Upload dropzone */
.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-3);
  background: var(--bg-1);
  cursor: pointer;
  transition: border-color var(--dur-1), background-color var(--dur-1);
}
.dropzone:hover { border-color: var(--accent-line); background: var(--bg-3); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
  color: var(--text-2);
}
.dz-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Code / Setup blocks */
.code-block {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--bg-0);
  border: 1px solid var(--line-2);
  font: 400 12px/19px var(--font-mono);
  color: #D8D8E0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.setup-row {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--bg-1);
  border: 1px solid var(--line-1);
}
@media (max-width: 640px) {
  .setup-row { grid-template-columns: 1fr auto; }
  .setup-row .setup-k { grid-column: 1 / -1; }
}
.setup-k { font-size: 12px; font-weight: 500; color: var(--text-2); }
.setup-v { font-family: var(--font-mono); font-size: 12px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line-1); background: var(--bg-1); }
.tbl th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--line-1);
  white-space: nowrap;
}
.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-1);
  font-size: 13px;
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* Tabs & chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-full);
  background: var(--bg-3);
  border: 1px solid var(--line-1);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
}
.chip:hover { background: var(--bg-4); color: var(--text-1); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-1); margin-bottom: 18px; overflow-x: auto; }
.tab {
  position: relative;
  height: 38px;
  padding: 0 14px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab:hover { color: var(--text-1); }
.tab[aria-selected="true"] { color: var(--text-1); }
.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 40px 20px;
  color: var(--text-2);
}
.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  display: grid;
  place-items: center;
  color: var(--text-3);
  margin-bottom: 6px;
}
.empty h3 { font-size: 15px; font-weight: 600; color: var(--text-1); }
.empty p { max-width: 44ch; font-size: 13px; color: var(--text-2); }

/* Modal overlay */
.modal-ov {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal {
  width: 100%;
  max-width: 540px;
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.modal.lg { max-width: 780px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-1);
}
.modal-head h2 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-1);
}

/* Toasts */
.toasts {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-3);
  font-size: 13px;
  color: var(--text-1);
}
.toast.ok { border-color: rgba(61, 214, 140, 0.35); }
.toast.err { border-color: rgba(255, 99, 105, 0.35); }
