/* DML Motion Studio - Premium UI with Logo */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #06080d;
  --bg-2: #0b1018;
  --panel: rgba(13, 19, 28, 0.85);
  --panel-2: rgba(19, 27, 40, 0.7);
  --panel-3: rgba(26, 36, 52, 0.6);
  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --line: rgba(148, 163, 184, 0.08);
  --line-hover: rgba(148, 163, 184, 0.18);
  --text: #f1f5f9;
  --text-2: #cbd5e1;
  --muted: #64748b;
  --faint: #334155;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-deep: #4f46e5;
  --teal: #14b8a6;
  --teal-glow: rgba(20, 184, 166, 0.3);
  --blue: #3b82f6;
  --red: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
  --display: "Space Grotesk", -apple-system, sans-serif;
  --body: "Outfit", -apple-system, "SF Pro Text", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --r-card: 16px;
  --r-ctl: 12px;
  --shadow-sm: 0 2px 8px -4px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 32px -12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(20, 184, 166, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
}
::selection { background: rgba(99, 102, 241, 0.3); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.fine { font-size: 12px; }
a { color: var(--blue); text-decoration: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }
.app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; min-height: 0; overflow: hidden; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.02em; }

/* Logo & Branding */
.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand {
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-text {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-hero {
  text-align: center;
  padding: 10px 0 20px;
}

.brand-logo {
  width: 140px;
  height: auto;
  border-radius: 12px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 20px rgba(99, 102, 241, 0.4));
}

.brand-title {
  font-size: 24px;
  margin: 0;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, rgba(11, 16, 24, 0.95) 0%, rgba(6, 8, 13, 0.98) 100%);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 28px 16px 20px;
  gap: 24px;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  margin: 0 4px;
  border-radius: var(--r-ctl);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}
.nav a .ic {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-size: 14px;
  transition: all 0.2s ease;
  border: 1px solid var(--line);
}
.nav a:hover { color: var(--text-2); background: rgba(148, 163, 184, 0.04); border-color: var(--line); }
.nav a:hover .ic { background: rgba(148, 163, 184, 0.1); border-color: var(--line-hover); }
.nav a.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
  border-color: rgba(99, 102, 241, 0.25);
  font-weight: 600;
}
.nav a.active .ic {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  box-shadow: 0 4px 16px -4px var(--accent-glow);
  border-color: transparent;
}
.nav a.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 0 12px var(--accent-glow);
}
.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 4px 0;
  border-top: 1px solid var(--line);
}
.worker-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  padding: 10px 14px;
  border-radius: var(--r-ctl);
  backdrop-filter: blur(10px);
}
.worker-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}
.worker-pill.busy .dot {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
  animation: pulse 1.5s infinite;
}
.worker-pill.off .dot { background: var(--red); box-shadow: 0 0 10px rgba(239, 68, 68, 0.5); }
@keyframes pulse { 50% { opacity: 0.4; transform: scale(0.9); } }
.user-row { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.user-row .name { font-size: 12px; color: var(--muted); }

/* Main area */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 24, 0.6);
  backdrop-filter: blur(16px);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: -0.02em; }
.topbar-right { display: flex; gap: 12px; align-items: center; }
.page { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 28px 32px; }

/* Buttons */
.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--r-ctl);
  cursor: pointer;
  font: 500 13px var(--body);
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.btn:hover { border-color: var(--line-hover); background: var(--panel-3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border-color: transparent;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 20px -8px var(--accent-glow);
}
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 6px 24px -8px var(--accent-glow); }
.btn.primary:disabled { opacity: 0.4; box-shadow: none; cursor: not-allowed; transform: none; }
.btn.danger { color: var(--red); border-color: rgba(239, 68, 68, 0.25); background: rgba(239, 68, 68, 0.06); }
.btn.danger:hover { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); }
.btn.teal {
  background: linear-gradient(135deg, var(--teal), #0d9488);
  border-color: transparent;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 20px -8px var(--teal-glow);
}
.btn.sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; justify-content: center; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }

/* Inputs */
.input, .select, textarea.input {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--r-ctl);
  font: 400 13px var(--body);
  outline: none;
  width: 100%;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: rgba(19, 27, 40, 0.8);
}
textarea.input { resize: vertical; min-height: 88px; line-height: 1.65; }
.select {
  width: auto;
  min-width: 160px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
select.input, select.select option { background: var(--panel-2); }
label.fld { display: block; margin-bottom: 16px; }
label.fld span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 7px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.9px; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 20px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.kbd {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 1px 6px;
  font: 500 10px var(--mono);
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
}

/* Cards */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-card);
  padding: 22px;
  box-shadow: var(--shadow);
  animation: rise 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 60%);
  pointer-events: none;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card h3 {
  margin: 0 0 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  font-weight: 600;
  font-family: var(--body);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.card h3 .sub { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); font-size: 11px; margin-top: 4px; }
.stat { font-family: var(--display); font-size: 28px; font-weight: 700; letter-spacing: -0.03em; background: linear-gradient(135deg, var(--text), var(--text-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(20, 184, 166, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.15);
  padding: 26px 28px;
  border-radius: var(--r-card);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.1), transparent 60%);
  pointer-events: none;
}
.hero h2 { font-family: var(--display); font-size: 20px; margin: 0 0 6px; font-weight: 600; position: relative; }
.hero p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 480px; position: relative; }
.hero .actions { display: flex; gap: 10px; flex: none; position: relative; }

/* Chips & badges */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--glass);
  letter-spacing: 0.2px;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.chip.ok { color: var(--green); border-color: rgba(34, 197, 94, 0.25); background: rgba(34, 197, 94, 0.06); }
.chip.run { color: var(--amber); border-color: rgba(245, 158, 11, 0.25); background: rgba(245, 158, 11, 0.06); }
.chip.run::before { animation: pulse 1.3s infinite; }
.chip.fail { color: var(--red); border-color: rgba(239, 68, 68, 0.25); background: rgba(239, 68, 68, 0.06); }
.chip.done { color: var(--teal); border-color: rgba(20, 184, 166, 0.25); background: rgba(20, 184, 166, 0.06); }
.chip.stop { color: var(--faint); }
a.chip { cursor: pointer; text-decoration: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { justify-content: space-between; }

/* Progress */
.bar { height: 4px; background: rgba(148, 163, 184, 0.1); border-radius: 99px; overflow: hidden; }
.bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent), #818cf8);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: rgba(148, 163, 184, 0.02); }
details.log { color: var(--muted); font: 11px var(--mono); }
details.log summary { cursor: pointer; color: var(--faint); letter-spacing: 0.4px; }
details.log pre { margin: 8px 0 0; white-space: pre-wrap; color: var(--faint); font-family: var(--mono); }

/* Login */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(99, 102, 241, 0.08), var(--bg) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(20px);
}
.login-card {
  width: 400px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 42px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03);
  animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  backdrop-filter: blur(24px);
}
#login-pw {
  background: var(--glass);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--r-ctl);
  font: 400 14px var(--body);
  outline: none;
  width: 100%;
  transition: all 0.2s ease;
}
#login-pw:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }

/* Studio layout */
.studio {
  display: grid;
  /* flexible so the centre preview never collapses on smaller laptops */
  grid-template-columns: minmax(220px, 300px) minmax(320px, 1fr) minmax(300px, 420px);
  gap: 18px;
  height: calc(100vh - 155px);
  min-height: 0;
}
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; overflow: auto; padding-right: 2px; }
/* cards must not shrink and clip their own fields — the column scrolls instead */
.col > .card { flex-shrink: 0; }
.col::-webkit-scrollbar { width: 4px; }
.col::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.15); border-radius: 2px; }
.dropzone {
  border: 1.5px dashed var(--line-hover);
  border-radius: var(--r-card);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.7;
  transition: all 0.2s ease;
  background: var(--glass);
}
.dropzone:hover, .dropzone.over {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
  box-shadow: 0 0 40px -16px var(--accent-glow);
}
.thumb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.thumb {
  position: relative;
  aspect-ratio: 1;
  background: #0a0f18;
  border: 2px solid transparent;
  outline: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.thumb:hover img { transform: scale(1.05); }
.thumb.sel {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 24px -8px var(--accent-glow);
  border-color: transparent;
}
.thumb .badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font: 500 10px var(--mono);
  color: white;
  background: rgba(0, 0, 0, 0.65);
  padding: 3px 8px;
  border-radius: 6px;
  backdrop-filter: blur(6px);
}
.preview-stage {
  flex: 1;
  background: #050810;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
}
.preview-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.04) 0%, transparent 40%, transparent 60%, rgba(20, 184, 166, 0.03) 100%);
}
.preview-stage img, .preview-stage video { max-width: 100%; max-height: 100%; object-fit: contain; position: relative; z-index: 1; border-radius: 4px; }
.preview-meta { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 16px; }
.dir-block { margin-bottom: 16px; }
.dir-block .lbl { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 1.1px; font-weight: 600; margin-bottom: 7px; }
.obs-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.expl { list-style: none; margin: 8px 0 0; padding: 0; }
.expl li { font-size: 12.5px; color: var(--muted); padding-left: 18px; position: relative; margin-bottom: 7px; line-height: 1.6; }
.expl li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  transform: rotate(45deg);
}

/* Toasts */
#toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 99; }
.toast {
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--teal);
  padding: 13px 18px;
  border-radius: var(--r-ctl);
  font-size: 13px;
  max-width: 380px;
  box-shadow: var(--shadow);
  animation: tin 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
  backdrop-filter: blur(12px);
}
.toast.err { border-left-color: var(--red); }
@keyframes tin { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Storyboard */
.sb-cards { display: flex; gap: 16px; overflow-x: auto; padding: 6px 2px 16px; }
.sb-card {
  flex: 0 0 260px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--glass-border);
  border-radius: var(--r-card);
  padding: 14px;
  cursor: grab;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.sb-card:hover { transform: translateY(-3px); border-color: var(--line-hover); box-shadow: var(--shadow-lg); }
.sb-card.drag { opacity: 0.3; }
.sb-card.over { border-color: var(--accent); box-shadow: 0 0 30px -10px var(--accent-glow); }
.sb-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 10px; background: #050810; }
.sb-card .num {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font: 600 11px var(--display);
  color: white;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  padding: 3px 10px;
  backdrop-filter: blur(6px);
}
.meter { font: 11px var(--mono); color: var(--faint); }

/* Switch */
.switch { display: flex; gap: 10px; align-items: center; cursor: pointer; font-size: 13px; user-select: none; padding: 4px 0; }

/* Modal */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.modal {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 28px;
  width: 460px;
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: rise 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  backdrop-filter: blur(20px);
}
ul.plain { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; }
ul.plain li { margin-bottom: 8px; line-height: 1.65; }
.tag {
  font: 500 10px var(--mono);
  color: var(--teal);
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: 6px;
  padding: 2px 9px;
  letter-spacing: 0.5px;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.empty-state { text-align: center; padding: 60px 24px; color: var(--faint); }
.empty-state .glyph { font-size: 32px; margin-bottom: 12px; opacity: 0.4; }

/* Model cards */
.model-card { position: relative; overflow: hidden; }
.model-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
  opacity: 0;
  transition: opacity 0.2s;
}
.model-card:hover::after { opacity: 1; }
.model-head { font-family: var(--display); font-size: 15px; font-weight: 600; }

/* Settings */
.policy-lock { color: var(--faint); font-size: 11px; }

/* Responsive */
@media (max-width: 1200px) {
  .studio { grid-template-columns: 1fr; }
  .studio .col { max-height: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 68px 1fr; }
  .brand { justify-content: center; }
  .brand-text { display: none; }
  .nav a { justify-content: center; padding: 11px; }
  .nav a .ic { margin: 0; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

/* ---- brand marks (logo asset served from /logo.png) ---- */
.brand-art {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: url("/logo.png") center / cover no-repeat;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.login-art {
  width: 168px;
  height: 168px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: url("/logo.png") center / cover no-repeat;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ---------------- responsive ---------------- */
.menu-btn { display: none; }
#nav-backdrop { display: none; }

@media (max-width: 900px) {
  /* single column shell — the fixed 280px column was squeezing content to a sliver */
  .app { grid-template-columns: 1fr; height: 100dvh; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    max-width: 84vw;
    height: 100dvh;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }

  #nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  #nav-backdrop.show { opacity: 1; pointer-events: auto; }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin-right: 10px;
    border-radius: 10px;
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  .menu-btn:active { transform: scale(0.96); }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }
  #page-title { font-size: 20px; flex: 1 1 auto; min-width: 0; }
  .topbar-right {
    flex: 1 1 100%;
    width: 100%;
    gap: 8px;
  }
  #project-select { flex: 1 1 auto; min-width: 0; }
  .btn { white-space: nowrap; }

  .page { padding: 16px 14px 28px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

  /* Studio workbench: 3 fixed columns with their own scrollbars don't work on a
     phone. Collapse to one column and let the page scroll instead of the columns. */
  .studio {
    grid-template-columns: 1fr;
    height: auto;
    gap: 14px;
  }
  .col {
    overflow: visible;
    padding-right: 0;
  }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }

  /* keep wide tables usable instead of blowing out the layout */
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .login-card {
    width: min(92vw, 400px);
    padding: 26px 20px;
    gap: 12px;
  }
  .login-art { width: 132px; height: 132px; }
}

@media (max-width: 480px) {
  #page-title { font-size: 18px; }
  .topbar-right { flex-direction: column; align-items: stretch; }
  .topbar-right #new-project-btn,
  .topbar-right .btn { width: 100%; }
  .page { padding: 12px 10px 24px; }
  .btn { padding: 10px 14px; font-size: 14px; }
}
