:root {
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0b0b0d;
  --bg-elevated: #111114;
  --bg-soft: #151519;
  --panel: #121216;
  --panel-2: #18181d;
  --panel-3: #202027;
  --overlay: rgba(8, 8, 10, .78);
  --stroke: rgba(255, 255, 255, .085);
  --stroke-strong: rgba(255, 255, 255, .16);
  --text: #f6f6f7;
  --text-soft: #d1d1d6;
  --muted: #92929d;
  --muted-2: #666671;
  --accent: #f4f4f5;
  --accent-text: #111113;
  --violet: #9b87f5;
  --violet-soft: rgba(155, 135, 245, .14);
  --cyan: #6ed8e8;
  --green: #68d391;
  --yellow: #f1c75b;
  --red: #ff718d;
  --shadow-lg: 0 28px 90px rgba(0, 0, 0, .38);
  --shadow-md: 0 16px 48px rgba(0, 0, 0, .24);
  --sidebar-w: 284px;
  --topbar-h: 64px;
  --inspector-w: 340px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
}

html[data-theme="light"] {
  --bg: #f7f7f8;
  --bg-elevated: #ffffff;
  --bg-soft: #efeff2;
  --panel: #ffffff;
  --panel-2: #f6f6f8;
  --panel-3: #ececf0;
  --overlay: rgba(235, 235, 239, .8);
  --stroke: rgba(22, 22, 28, .09);
  --stroke-strong: rgba(22, 22, 28, .17);
  --text: #17171b;
  --text-soft: #3b3b43;
  --muted: #73737e;
  --muted-2: #a1a1aa;
  --accent: #17171b;
  --accent-text: #ffffff;
  --violet-soft: rgba(108, 92, 231, .09);
  --shadow-lg: 0 26px 80px rgba(35, 35, 48, .12);
  --shadow-md: 0 12px 36px rgba(35, 35, 48, .09);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body:has(.app-shell:not(.hidden)) { overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, label, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
.hidden { display: none !important; }

::selection { background: rgba(155, 135, 245, .34); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(140, 140, 150, .28); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(140, 140, 150, .48); }

.page-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

/* Shared controls */
.brand-lockup, .mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
  letter-spacing: -.025em;
}
.brand-symbol {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--stroke-strong);
  border-radius: 11px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255,255,255,.16), transparent 40%),
    linear-gradient(145deg, #7461d7, #35313f 72%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 8px 28px rgba(85, 68, 169, .22);
  font-size: 15px;
  font-weight: 850;
}
.icon-action, .top-action, .account-action, .input-action {
  border: 0;
  outline: 0;
  cursor: pointer;
}
.icon-action {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  color: var(--muted);
  background: var(--panel-2);
  transition: color .18s, background .18s, border-color .18s, transform .18s;
}
.icon-action:hover { color: var(--text); border-color: var(--stroke-strong); background: var(--panel-3); }
.icon-action:active { transform: scale(.96); }
.primary-btn, .secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 720;
  transition: transform .18s, opacity .18s, background .18s, border-color .18s;
}
.primary-btn { color: var(--accent-text); background: var(--accent); }
.primary-btn:hover { opacity: .91; }
.primary-btn:active, .secondary-btn:active { transform: scale(.98); }
.secondary-btn {
  border: 1px solid var(--stroke);
  color: var(--text-soft);
  background: var(--panel-2);
}
.secondary-btn:hover { border-color: var(--stroke-strong); background: var(--panel-3); }
.text-button {
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-weight: 680;
}
kbd {
  border: 1px solid var(--stroke);
  border-bottom-color: var(--stroke-strong);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--muted-2);
  background: var(--panel-2);
  font: 10px/1.4 var(--font);
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--stroke);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: var(--panel-2);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
input, select { min-height: 42px; padding: 10px 12px; }
textarea { padding: 12px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(155, 135, 245, .7);
  box-shadow: 0 0 0 3px rgba(155, 135, 245, .11);
  background: var(--panel-3);
}
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) 18px, calc(100% - 12px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
label { color: var(--muted); font-size: 12px; font-weight: 650; }

/* Toasts */
.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: grid;
  gap: 10px;
  width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: 14px 15px;
  border: 1px solid var(--stroke-strong);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  animation: toast-in .24s ease-out;
}
.toast strong { display: block; font-size: 13px; }
.toast small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.toast.good { border-left: 3px solid var(--green); }
.toast.bad { border-left: 3px solid var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Auth */
.auth-screen {
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(circle at 18% 18%, rgba(109, 86, 218, .16), transparent 32%),
    radial-gradient(circle at 74% 86%, rgba(67, 142, 164, .09), transparent 28%),
    var(--bg);
}
.auth-shell {
  width: min(1280px, 100%);
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
  overflow: hidden;
  border: 1px solid var(--stroke);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}
.auth-showcase {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  padding: 38px 42px;
  overflow: hidden;
  border-right: 1px solid var(--stroke);
  background:
    linear-gradient(180deg, rgba(255,255,255,.018), transparent 32%),
    linear-gradient(145deg, rgba(155, 135, 245, .07), transparent 46%),
    #0d0d10;
}
html[data-theme="light"] .auth-showcase {
  background: linear-gradient(145deg, rgba(108,92,231,.08), transparent 50%), #f1f1f4;
}
.auth-showcase::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -240px;
  top: -220px;
  border: 1px solid rgba(155, 135, 245, .18);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(155,135,245,.025), 0 0 0 140px rgba(155,135,245,.018);
}
.auth-showcase-top, .auth-proof {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.auth-badge i, .chat-kicker i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(104,211,145,.09);
}
.auth-copy { position: relative; z-index: 1; margin: 70px 0 46px; }
.eyebrow, .page-eyebrow {
  color: var(--violet);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .17em;
}
.auth-copy h1 {
  max-width: 650px;
  margin: 14px 0 20px;
  font-size: clamp(42px, 5.2vw, 72px);
  line-height: .98;
  letter-spacing: -.062em;
  font-weight: 720;
}
.auth-copy > p:last-child {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}
.auth-demo {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  margin-top: auto;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: 20px;
  background: rgba(19,19,23,.85);
  box-shadow: 0 26px 80px rgba(0,0,0,.24);
  transform: perspective(1200px) rotateX(1deg) rotateY(-2deg);
}
html[data-theme="light"] .auth-demo { background: rgba(255,255,255,.88); }
.demo-topbar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 15px;
  border-bottom: 1px solid var(--stroke);
  color: var(--muted);
  font-size: 11px;
}
.demo-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.demo-model { margin-left: auto; color: var(--muted-2); }
.demo-thread { display: grid; gap: 18px; padding: 24px; }
.demo-user {
  max-width: 76%;
  justify-self: end;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 15px 15px 4px 15px;
  color: var(--text-soft);
  background: var(--panel-3);
  font-size: 12px;
  line-height: 1.5;
}
.demo-assistant { display: grid; grid-template-columns: 28px 1fr; gap: 11px; align-items: start; }
.demo-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: white; background: #6555b5; font-size: 11px; font-weight: 800; }
.demo-assistant strong { font-size: 12px; }
.demo-assistant p { margin: 6px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.demo-progress { height: 4px; overflow: hidden; border-radius: 99px; background: var(--panel-3); }
.demo-progress span { display: block; width: 72%; height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.auth-proof { justify-content: flex-start; flex-wrap: wrap; gap: 8px 18px; margin-top: 24px; color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.auth-proof span { position: relative; }
.auth-proof span:not(:last-child)::after { content: "·"; position: absolute; right: -11px; }
.auth-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 36px clamp(34px, 5vw, 72px);
  background: var(--panel);
}
.auth-panel-top { position: absolute; top: 40px; right: 40px; display: flex; align-items: center; justify-content: flex-end; }
.mobile-brand { display: none; }
#themeButtonAuth { width: auto; padding: 0 13px; font-size: 11px; font-weight: 700; }
.auth-card { width: 100%; max-width: 440px; margin: auto; }
.auth-heading { display: grid; grid-template-columns: 46px 1fr; gap: 15px; align-items: center; margin-bottom: 34px; }
.auth-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid var(--stroke); border-radius: 14px; color: var(--violet); background: var(--violet-soft); font-size: 19px; }
.auth-heading h2 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.auth-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.auth-form { display: grid; gap: 10px; }
.field-label { margin-top: 7px; }
.input-shell { position: relative; }
.input-shell input { height: 50px; padding: 0 76px 0 43px; border-radius: 13px; background: var(--panel-2); }
.input-shell:focus-within .input-icon { color: var(--violet); }
.input-icon { position: absolute; left: 15px; top: 50%; z-index: 1; transform: translateY(-50%); color: var(--muted-2); font-size: 12px; font-weight: 800; }
.input-action { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); padding: 8px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; }
.input-action:hover { color: var(--text); }
.auth-submit { min-height: 50px; margin-top: 15px; justify-content: space-between; padding: 0 18px; border-radius: 13px; }
.auth-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; color: var(--muted-2); font-size: 10px; }
.auth-footnote { margin: 24px auto 0; color: var(--muted-2); font-size: 10px; text-align: center; }

/* App shell */
.app-shell { min-height: 100vh; background: var(--bg); }
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  width: var(--sidebar-w);
  flex-direction: column;
  padding: 16px 13px 12px;
  border-right: 1px solid var(--stroke);
  background: var(--bg-elevated);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; height: 42px; padding: 0 6px; }
.sidebar-close { display: none; }
.new-chat-btn {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 46px;
  margin: 16px 0 10px;
  padding: 0 12px;
  border: 1px solid var(--stroke-strong);
  border-radius: 12px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  transition: background .18s, border-color .18s, transform .18s;
}
.new-chat-btn:hover { background: var(--panel-3); border-color: rgba(155, 135, 245, .4); }
.new-chat-btn:active { transform: scale(.985); }
.new-chat-icon { color: var(--violet); font-size: 18px; font-weight: 400; }
.sidebar-nav { display: grid; gap: 3px; }
.product-tab {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  min-height: 39px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  font-weight: 640;
  transition: color .16s, background .16s;
}
.product-tab:hover { color: var(--text-soft); background: var(--panel-2); }
.product-tab.active { color: var(--text); background: var(--panel-3); }
.nav-icon { color: var(--muted-2); font-size: 14px; }
.product-tab.active .nav-icon { color: var(--violet); }
.sidebar-divider { height: 1px; margin: 11px 7px 14px; background: var(--stroke); }
.history-section { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.history-title-row { display: flex; align-items: center; justify-content: space-between; padding: 0 9px 9px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.history-title-row small { color: var(--muted-2); font-size: 9px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.history-search { position: relative; display: block; margin: 0 4px 8px; }
.history-search > span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-2); }
.history-search input { min-height: 36px; padding: 8px 10px 8px 31px; border-radius: 9px; font-size: 11px; background: transparent; }
.history-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 4px 7px; padding: 3px; border-radius: 9px; background: var(--panel-2); }
.history-tabs button { min-height: 27px; padding: 0 5px; border: 0; border-radius: 6px; color: var(--muted-2); background: transparent; cursor: pointer; font-size: 9px; font-weight: 700; }
.history-tabs button.active { color: var(--text-soft); background: var(--panel-3); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.history-list { display: grid; min-height: 0; gap: 2px; overflow-y: auto; padding: 2px 3px 12px; }
.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  width: 100%;
  padding: 9px 10px 9px 12px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color .16s, background .16s;
}
.history-item::before { content: ""; position: absolute; left: 4px; top: 13px; width: 4px; height: 4px; border-radius: 50%; background: var(--muted-2); }
.history-item:hover { color: var(--text-soft); background: var(--panel-2); }
.history-item.active { color: var(--text); background: var(--panel-3); }
.history-item.active::before { background: var(--violet); box-shadow: 0 0 0 3px rgba(155,135,245,.11); }
.history-item strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 640; }
.history-item small { grid-column: 1 / -1; padding-left: 0; color: var(--muted-2); font-size: 9px; }
.history-status { align-self: center; width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.history-status.running, .history-status.queued, .history-status.submitted { background: var(--yellow); }
.history-status.succeeded { background: var(--green); }
.history-status.failed, .history-status.cancelled { background: var(--red); }
.empty-note { padding: 18px; border: 1px dashed var(--stroke); border-radius: 13px; color: var(--muted); background: var(--panel-2); font-size: 12px; line-height: 1.55; text-align: center; }
.sidebar-bottom { display: grid; gap: 7px; padding-top: 8px; }
.api-widget { display: grid; grid-template-columns: 9px 1fr; gap: 10px; align-items: center; padding: 9px 11px; border: 1px solid var(--stroke); border-radius: 10px; background: var(--panel-2); }
.api-widget b, .api-widget small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-widget b { color: var(--text-soft); font-size: 9px; }
.api-widget small { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.api-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px rgba(255,113,141,.07); }
.api-dot.ready { background: var(--green); box-shadow: 0 0 0 4px rgba(104,211,145,.07); }
.api-dot.warn { background: var(--yellow); box-shadow: 0 0 0 4px rgba(241,199,91,.07); }
.account-card { display: grid; grid-template-columns: 34px 1fr 28px; gap: 9px; align-items: center; padding: 9px 8px; border-radius: 11px; transition: background .16s; }
.account-card:hover { background: var(--panel-2); }
.user-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(145deg, #745fce, #45386f); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.account-copy { min-width: 0; }
.account-copy strong, .account-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 10px; }
.account-copy small { margin-top: 3px; color: var(--muted-2); font-size: 8px; }
.account-action { width: 28px; height: 28px; border-radius: 8px; color: var(--muted-2); background: transparent; }
.account-action:hover { color: var(--text); background: var(--panel-3); }

.app-workspace { min-height: 100vh; margin-left: var(--sidebar-w); }
.workspace-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-w);
  z-index: 40;
  display: flex;
  height: var(--topbar-h);
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 24px;
  border-bottom: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}
.workspace-topbar-left { display: flex; align-items: center; gap: 12px; }
.workspace-topbar-left > div { display: grid; gap: 3px; }
.workspace-topbar-left strong { font-size: 12px; }
.workspace-topbar-left span { color: var(--muted-2); font-size: 9px; }
.mobile-menu { display: none; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.top-action {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  color: var(--muted);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 10px;
  font-weight: 670;
  transition: color .16s, background .16s, border-color .16s;
}
.top-action:hover { color: var(--text); border-color: var(--stroke-strong); background: var(--panel-3); }
.inspector-toggle { display: none; }
.workbench { height: 100vh; padding-top: var(--topbar-h); }
.view { display: none; height: 100%; }
.view.active-view { display: block; }

/* Studio chat */
.studio-view.active-view { display: grid; grid-template-columns: minmax(0, 1fr) var(--inspector-w); }
.chat-pane { position: relative; display: flex; min-width: 0; height: 100%; flex-direction: column; overflow: hidden; }
.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(24px, 4vw, 54px) 18px;
}
.chat-title-block { min-width: 0; }
.chat-kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--muted-2); font-size: 9px; font-weight: 780; letter-spacing: .14em; }
.chat-title-block h1 { margin: 9px 0 5px; font-size: clamp(23px, 3vw, 34px); line-height: 1.08; letter-spacing: -.045em; }
.chat-title-block p { max-width: 650px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.compact-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.stat-mini { min-width: 72px; padding: 8px 10px; border: 1px solid var(--stroke); border-radius: 10px; background: var(--panel); }
.stat-mini span { display: block; color: var(--muted-2); font-size: 8px; font-weight: 740; letter-spacing: .06em; text-transform: uppercase; }
.stat-mini strong { display: block; margin-top: 4px; font-size: 14px; letter-spacing: -.02em; }
.conversation-stream {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 8px clamp(24px, 4vw, 54px) 190px;
}
.empty-stage { display: grid; place-items: center; }
.empty-state { width: min(760px, 100%); margin: auto; padding: 40px 0 30px; text-align: center; }
.empty-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 0 auto 22px;
  border: 1px solid var(--stroke-strong);
  border-radius: 21px;
  color: #fff;
  background: linear-gradient(145deg, #6f5fc9, #29252f 75%);
  box-shadow: 0 18px 60px rgba(103,83,196,.22);
  font-size: 20px;
  font-weight: 850;
}
.empty-orb::after { content: ""; position: absolute; inset: -8px; border: 1px solid rgba(155,135,245,.12); border-radius: 27px; }
.empty-state h2 { margin: 0; font-size: clamp(28px, 5vw, 46px); letter-spacing: -.055em; }
.empty-state > p { max-width: 560px; margin: 12px auto 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 30px; text-align: left; }
.suggestion-card {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 11px;
  align-items: center;
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 15px;
  color: var(--text-soft);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: border-color .18s, transform .18s, background .18s;
}
.suggestion-card:hover { transform: translateY(-2px); border-color: rgba(155,135,245,.38); background: var(--panel-2); }
.suggestion-card > span:first-child { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--violet); background: var(--violet-soft); }
.suggestion-card strong { display: block; font-size: 11px; }
.suggestion-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.suggestion-arrow { color: var(--muted-2); }

.chat-thread { width: min(900px, 100%); margin: 4px auto 0; }
.chat-message { display: grid; margin-bottom: 26px; }
.user-message { justify-items: end; }
.message-bubble {
  max-width: min(720px, 82%);
  padding: 14px 16px;
  border: 1px solid var(--stroke);
  border-radius: 18px 18px 5px 18px;
  color: var(--text-soft);
  background: var(--panel-3);
  font-size: 13px;
  line-height: 1.62;
  white-space: pre-wrap;
}
.message-meta { margin-top: 7px; color: var(--muted-2); font-size: 9px; }
.assistant-message { grid-template-columns: 34px minmax(0, 1fr); gap: 13px; align-items: start; }
.assistant-avatar { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; color: #fff; background: linear-gradient(145deg, #725fc9, #3a314c); font-size: 11px; font-weight: 850; }
.assistant-body { min-width: 0; }
.assistant-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; margin-bottom: 10px; }
.assistant-head > div { display: flex; align-items: center; gap: 8px; }
.assistant-head strong { font-size: 12px; }
.assistant-head small { color: var(--muted-2); font-size: 9px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 23px;
  padding: 0 8px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 8px;
  font-weight: 760;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--muted-2); }
.status-pill.running::before, .status-pill.queued::before, .status-pill.submitted::before { background: var(--yellow); }
.status-pill.succeeded::before { background: var(--green); }
.status-pill.failed::before, .status-pill.cancelled::before { background: var(--red); }
.result-card { overflow: hidden; border: 1px solid var(--stroke); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow-md); }
.video-shell { position: relative; display: grid; min-height: 260px; place-items: center; overflow: hidden; background: #050506; }
.video-shell video { width: 100%; max-height: 520px; object-fit: contain; background: #050506; }
.rendering-box { display: grid; min-height: 300px; place-items: center; padding: 34px; text-align: center; background: radial-gradient(circle at 50% 44%, rgba(155,135,245,.1), transparent 36%), var(--panel-2); }
.loader-ring { width: 42px; height: 42px; margin: 0 auto 16px; border: 2px solid var(--stroke-strong); border-top-color: var(--violet); border-radius: 50%; animation: spin .95s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rendering-box h2 { margin: 0; font-size: 16px; }
.rendering-box p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.result-footer { padding: 15px; }
.result-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.result-data { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 9px; }
.result-data b { color: var(--text-soft); font-weight: 650; }
.progress-bar { height: 4px; margin: 12px 0; overflow: hidden; border-radius: 99px; background: var(--panel-3); }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .35s ease; }
.job-prompt { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.error-text { margin-top: 10px; padding: 10px 12px; border: 1px solid rgba(255,113,141,.18); border-radius: 10px; color: #ff91a8; background: rgba(255,113,141,.06); font-size: 10px; line-height: 1.5; }
.card-actions, .asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 13px;
}
.card-actions button, .card-actions a, .asset-actions button {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 9px;
  font-weight: 690;
  transition: color .16s, background .16s, border-color .16s;
}
.card-actions button:hover, .card-actions a:hover, .asset-actions button:hover { color: var(--text); border-color: var(--stroke-strong); background: var(--panel-3); }
.card-actions .primary-action { color: var(--accent-text); border-color: var(--accent); background: var(--accent); }

.composer-area {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  padding: 30px clamp(24px, 4vw, 54px) 17px;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.composer-dock {
  position: relative;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 9px;
  border: 1px solid var(--stroke-strong);
  border-radius: 19px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  box-shadow: 0 18px 60px rgba(0,0,0,.22);
  backdrop-filter: blur(20px);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.composer-dock:focus-within { border-color: rgba(155,135,245,.55); box-shadow: 0 18px 60px rgba(0,0,0,.24), 0 0 0 3px rgba(155,135,245,.07); }
.composer-dock.dragging { transform: scale(1.008); border-color: var(--violet); }
.composer-dock textarea {
  min-height: 48px;
  max-height: 220px;
  padding: 11px 12px 8px;
  border: 0;
  border-radius: 12px;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  resize: none;
  font-size: 13px;
  line-height: 1.55;
}
.composer-dock textarea:focus { border: 0; background: transparent; box-shadow: none; }
.selected-assets { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px; }
.selected-assets:empty { display: none; }
.asset-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 220px; min-height: 27px; padding: 0 7px 0 9px; border: 1px solid var(--stroke); border-radius: 8px; color: var(--muted); background: var(--panel-2); font-size: 9px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.asset-chip button { border: 0; color: var(--muted-2); background: transparent; cursor: pointer; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px; }
.dock-tools, .dock-submit, .composer-info { display: flex; align-items: center; }
.dock-tools { gap: 5px; min-width: 0; }
.attach-menu { position: relative; }
.attach-main {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px solid var(--stroke);
  border-radius: 9px;
  color: var(--text-soft);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 17px;
}
.attach-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: none;
  width: 150px;
  padding: 5px;
  border: 1px solid var(--stroke-strong);
  border-radius: 11px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
}
.attach-menu:hover .attach-popover, .attach-menu:focus-within .attach-popover { display: grid; }
.attach-popover label { min-height: 34px; padding: 0 9px; border-radius: 7px; color: var(--muted); cursor: pointer; line-height: 34px; }
.attach-popover label:hover { color: var(--text); background: var(--panel-2); }
.prompt-chip {
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  transition: color .16s, background .16s, border-color .16s;
}
.prompt-chip:hover { color: var(--text); border-color: var(--stroke); background: var(--panel-2); }
.prompt-chip.accent { color: var(--violet); background: var(--violet-soft); }
.dock-submit { gap: 10px; flex-shrink: 0; }
.composer-info { gap: 5px; color: var(--muted-2); font-size: 8px; white-space: nowrap; }
.composer-separator { opacity: .6; }
.send-btn {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 13px;
  border: 0;
  border-radius: 10px;
  color: var(--accent-text);
  background: var(--accent);
  cursor: pointer;
  font-size: 10px;
  font-weight: 760;
  transition: opacity .18s, transform .18s;
}
.send-btn b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: var(--accent); background: var(--accent-text); font-size: 13px; }
.send-btn:hover { opacity: .9; }
.send-btn:active { transform: scale(.98); }
.send-btn:disabled { opacity: .4; cursor: wait; }
.composer-hint { width: min(900px, 100%); margin: 7px auto 0; color: var(--muted-2); font-size: 8px; text-align: center; }

/* Inspector */
.inspector-panel {
  position: relative;
  z-index: 20;
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  border-left: 1px solid var(--stroke);
  background: var(--bg-elevated);
}
.inspector-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 17px 15px; border-bottom: 1px solid var(--stroke); }
.inspector-head > div > span { color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.inspector-head h3 { margin: 5px 0 0; font-size: 15px; letter-spacing: -.025em; }
.inspector-scroll { display: grid; min-height: 0; gap: 8px; overflow-y: auto; padding: 12px 12px 24px; }
.parameter-card { padding: 14px; border: 1px solid var(--stroke); border-radius: 14px; background: var(--panel); }
.parameter-title { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.parameter-title span, .details-card summary em { color: var(--violet); font-size: 8px; font-style: normal; font-weight: 850; letter-spacing: .1em; }
.parameter-title strong, .details-card summary strong { font-size: 10px; }
.parameter-card > label, .details-body > label { display: grid; gap: 6px; }
.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.parameter-grid label { display: grid; gap: 6px; }
.wide-field { grid-column: 1 / -1; }
.switch-line {
  display: flex !important;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--stroke);
  cursor: pointer;
}
.switch-line:last-child { border-bottom: 0; padding-bottom: 0; }
.switch-line > span { display: grid; gap: 3px; }
.switch-line b { color: var(--text-soft); font-size: 10px; }
.switch-line small { color: var(--muted-2); font-size: 8px; font-weight: 500; }
.switch-line input { position: absolute; opacity: 0; pointer-events: none; }
.switch-line i { position: relative; width: 34px; height: 20px; flex: 0 0 34px; border-radius: 999px; background: var(--panel-3); transition: background .18s; }
.switch-line i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .18s, background .18s; }
.switch-line input:checked + i { background: rgba(155,135,245,.28); }
.switch-line input:checked + i::after { transform: translateX(14px); background: var(--violet); }
.details-card { padding: 0; }
.details-card summary { display: flex; min-height: 48px; align-items: center; justify-content: space-between; padding: 0 14px; cursor: pointer; list-style: none; }
.details-card summary::-webkit-details-marker { display: none; }
.details-card summary > span { display: flex; align-items: center; gap: 9px; }
.details-card summary > b { color: var(--muted); font-size: 15px; transition: transform .18s; }
.details-card[open] summary > b { transform: rotate(45deg); }
.details-body { display: grid; gap: 10px; padding: 0 14px 14px; }
.help-text { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

/* Library, assets, admin, settings */
.library-view, .assets-view, .admin-view, .settings-view { overflow-y: auto; padding: 34px clamp(24px, 4vw, 52px) 70px; }
.view-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.view-page-head h1 { margin: 7px 0 6px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.052em; }
.view-page-head p { margin: 0; color: var(--muted); font-size: 12px; }
.masonry-grid, .asset-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.job-card, .asset-card { min-width: 0; overflow: hidden; border: 1px solid var(--stroke); border-radius: 17px; background: var(--panel); transition: border-color .18s, transform .18s, box-shadow .18s; }
.job-card:hover, .asset-card:hover { transform: translateY(-2px); border-color: var(--stroke-strong); box-shadow: var(--shadow-md); }
.card-video, .asset-preview { display: grid; min-height: 185px; place-items: center; overflow: hidden; border-bottom: 1px solid var(--stroke); background: #08080a; }
.card-video video, .asset-preview img, .asset-preview video { width: 100%; height: 100%; min-height: 185px; max-height: 300px; object-fit: cover; }
.asset-preview audio { width: calc(100% - 24px); }
.job-card > h4, .job-card > p, .job-card > .job-status-row, .job-card > .error-text, .job-card > .card-actions,
.asset-card > h4, .asset-card > p, .asset-card > .asset-actions { margin-right: 14px; margin-left: 14px; }
.job-card > h4, .asset-card > h4 { margin-top: 14px; margin-bottom: 6px; font-size: 11px; }
.job-card > p, .asset-card > p { margin-top: 0; margin-bottom: 10px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.job-status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted-2); font-size: 9px; }
.job-card > .card-actions, .asset-card > .asset-actions { margin-bottom: 14px; }
.asset-upload-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.big-drop { display: grid; min-height: 112px; place-items: center; align-content: center; gap: 5px; border: 1px dashed var(--stroke-strong); border-radius: 15px; color: var(--muted); background: var(--panel); cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.big-drop:hover { transform: translateY(-2px); border-color: var(--violet); background: var(--violet-soft); }
.big-drop > span { color: var(--violet); font-size: 20px; }
.big-drop b { color: var(--text-soft); font-size: 11px; }
.big-drop small { color: var(--muted-2); font-size: 8px; }
.admin-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 14px; }
.admin-card, .settings-card { min-width: 0; padding: 17px; border: 1px solid var(--stroke); border-radius: 17px; background: var(--panel); }
.full-span { grid-column: 1 / -1; }
.card-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-heading span { color: var(--muted-2); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.card-heading h3 { margin: 5px 0 0; font-size: 14px; }
.create-user-row { display: grid; grid-template-columns: 1fr 1fr 100px auto; gap: 7px; margin-bottom: 15px; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--stroke); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; color: var(--muted); font-size: 9px; }
th, td { padding: 10px; border-bottom: 1px solid var(--stroke); text-align: left; white-space: nowrap; }
th { color: var(--muted-2); background: var(--panel-2); font-size: 8px; font-weight: 780; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-2); }
.table-actions { display: flex; gap: 4px; }
.table-actions button { min-height: 25px; padding: 0 7px; border: 1px solid var(--stroke); border-radius: 6px; color: var(--muted); background: var(--panel-2); cursor: pointer; font-size: 8px; }
.online-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--muted-2); }
.online-dot.on { background: var(--green); }
.log-list { display: grid; gap: 5px; max-height: 420px; overflow-y: auto; }
.log-item { padding: 10px 11px; border: 1px solid var(--stroke); border-radius: 9px; background: var(--panel-2); }
.log-item strong, .log-item small { display: block; }
.log-item strong { font-size: 9px; }
.log-item small { margin-top: 4px; color: var(--muted-2); font-size: 8px; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 14px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 16px; }
.settings-grid label { display: grid; gap: 6px; }
.code-box { min-height: 300px; margin: 0; overflow: auto; padding: 15px; border: 1px solid var(--stroke); border-radius: 12px; color: #b9aaff; background: #0a0a0d; font: 10px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
html[data-theme="light"] .code-box { color: #5f4caf; background: #f4f4f7; }

.sidebar-backdrop { display: none; }

@media (max-width: 1240px) {
  :root { --sidebar-w: 258px; --inspector-w: 314px; }
  .chat-header, .conversation-stream, .composer-area { padding-right: 28px; padding-left: 28px; }
  .compact-stats .stat-mini:nth-child(-n+2) { display: none; }
  .masonry-grid, .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1020px) {
  :root { --sidebar-w: 270px; }
  .app-sidebar { transform: translateX(-101%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
  .sidebar-backdrop.open { display: block; }
  .app-workspace { margin-left: 0; }
  .workspace-topbar { left: 0; }
  .mobile-menu { display: grid; }
  .inspector-toggle { display: inline-flex; }
  .studio-view.active-view { grid-template-columns: 1fr; }
  .inspector-panel { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; z-index: 50; width: min(var(--inspector-w), calc(100vw - 24px)); height: auto; transform: translateX(102%); box-shadow: var(--shadow-lg); transition: transform .22s ease; }
  .inspector-panel.open { transform: translateX(0); }
  .admin-layout, .settings-layout { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 58px; }
  .auth-screen { padding: 0; }
  .auth-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .auth-showcase { display: none; }
  .auth-panel { min-height: 100vh; justify-content: flex-start; padding: 22px 22px 28px; }
  .auth-panel-top { position: static; justify-content: space-between; }
  .mobile-brand { display: inline-flex; }
  #themeButtonAuth { margin-left: auto; }
  .auth-card { margin: auto; padding: 48px 0; }
  .auth-heading h2 { font-size: 25px; }
  .workspace-topbar { padding: 0 12px; }
  .workspace-topbar-left span { display: none; }
  .top-action-label { display: none; }
  .top-action { width: 34px; padding: 0; justify-content: center; }
  .chat-header { padding: 20px 16px 10px; }
  .chat-title-block h1 { font-size: 25px; }
  .chat-title-block p { font-size: 11px; }
  .compact-stats { display: none; }
  .conversation-stream { padding: 7px 14px 177px; }
  .empty-state { padding-top: 22px; }
  .empty-state h2 { font-size: 30px; }
  .empty-state > p { font-size: 11px; }
  .suggestion-grid { grid-template-columns: 1fr; gap: 7px; margin-top: 22px; }
  .suggestion-card { min-height: 65px; }
  .message-bubble { max-width: 92%; font-size: 12px; }
  .assistant-message { grid-template-columns: 30px minmax(0, 1fr); gap: 9px; }
  .assistant-avatar { width: 30px; height: 30px; border-radius: 9px; }
  .assistant-head { align-items: flex-start; }
  .assistant-head > div { flex-wrap: wrap; }
  .video-shell, .rendering-box { min-height: 220px; }
  .result-topline { align-items: flex-start; flex-direction: column; }
  .composer-area { padding: 28px 10px 9px; }
  .composer-dock { border-radius: 16px; }
  .composer-toolbar { align-items: flex-end; }
  .dock-tools { flex-wrap: wrap; }
  .prompt-chip { display: none; }
  .prompt-chip.accent { display: inline-flex; align-items: center; }
  .composer-info { display: none; }
  .send-btn span { display: none; }
  .send-btn { width: 35px; padding: 0; justify-content: center; }
  .send-btn b { background: transparent; }
  .composer-hint { display: none; }
  .library-view, .assets-view, .admin-view, .settings-view { padding: 24px 14px 50px; }
  .view-page-head { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .view-page-head h1 { font-size: 30px; }
  .masonry-grid, .asset-grid, .asset-upload-row { grid-template-columns: 1fr; }
  .admin-summary { grid-template-columns: repeat(2, 1fr); }
  .create-user-row, .settings-grid { grid-template-columns: 1fr; }
  .settings-card, .admin-card { padding: 13px; }
}

@media (max-width: 420px) {
  .app-sidebar { width: min(292px, calc(100vw - 34px)); }
  .chat-title-block h1 { font-size: 22px; }
  .chat-kicker { font-size: 8px; }
  .empty-orb { width: 58px; height: 58px; }
  .suggestion-card { grid-template-columns: 30px 1fr auto; padding: 10px; }
  .auth-panel { padding-right: 18px; padding-left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.app-shell { height: 100vh; overflow: hidden; }
.primary-btn:disabled, .secondary-btn:disabled, .top-action:disabled, .send-btn:disabled { opacity: .45; cursor: wait; }

/* ==========================================================================
   Art Banda UI v4 — focused Seedance workspace
   ========================================================================== */
:root {
  --bg: #0c0c0f;
  --bg-elevated: #101014;
  --bg-soft: #121217;
  --panel: #141419;
  --panel-2: #18181e;
  --panel-3: #202027;
  --stroke: #292932;
  --stroke-strong: #3a3947;
  --text: #f5f4f8;
  --text-soft: #d7d5dd;
  --muted: #8d8a98;
  --muted-2: #625f6d;
  --accent: #8067f5;
  --accent-text: #fff;
  --violet: #8c73fa;
  --violet-soft: rgba(128, 103, 245, .13);
  --cyan: #71d7e8;
  --sidebar-w: 232px;
  --topbar-h: 70px;
  --inspector-w: 304px;
  --shadow-lg: 0 30px 100px rgba(0, 0, 0, .46);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, .25);
}

body { background: var(--bg); }
.page-noise { opacity: .012; }

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, #765bea, #8b6ff6);
}

/* Login */
.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 18% 34%, rgba(128,103,245,.09), transparent 27%),
    var(--bg);
}
.auth-shell {
  width: min(1180px, 100%);
  min-height: 680px;
  max-height: calc(100vh - 64px);
  grid-template-columns: minmax(0, 1.18fr) minmax(390px, .82fr);
  border-radius: 22px;
  background: #101014;
}
.auth-showcase {
  padding: 34px 42px;
  border-right-color: var(--stroke);
  background: #0f0f13;
}
.auth-showcase::before {
  top: -280px;
  right: -205px;
  width: 600px;
  height: 600px;
  border-color: rgba(128,103,245,.13);
  box-shadow: 0 0 0 76px rgba(128,103,245,.018), 0 0 0 152px rgba(128,103,245,.012);
}
.auth-showcase-top { align-items: center; }
.auth-badge {
  color: var(--muted);
  background: transparent;
  border: 0;
  letter-spacing: .13em;
}
.auth-copy { margin: 44px 0 28px; }
.auth-copy .eyebrow { margin-bottom: 18px; color: var(--violet); }
.auth-copy h1 {
  max-width: 590px;
  margin: 0;
  font-size: clamp(44px, 4.3vw, 66px);
  line-height: .98;
  letter-spacing: -.06em;
}
.auth-copy > p:last-child {
  max-width: 520px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.auth-demo {
  width: min(590px, 100%);
  padding: 0;
  overflow: hidden;
  border-color: var(--stroke);
  border-radius: 15px;
  background: #111116;
  box-shadow: 0 24px 55px rgba(0,0,0,.28);
}
.demo-topbar {
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--stroke);
}
.demo-model { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.demo-model i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.demo-thread { gap: 12px; padding: 14px; }
.demo-video {
  position: relative;
  display: flex;
  min-height: 138px;
  align-items: flex-end;
  gap: 12px;
  padding: 13px;
  border: 1px solid #24242b;
  border-radius: 10px;
  color: var(--text-soft);
  background:
    radial-gradient(circle at 64% 48%, rgba(113,215,232,.09), transparent 24%),
    linear-gradient(145deg, #08080a, #12121a);
}
.demo-play {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(128,103,245,.9);
  font-size: 9px;
}
.demo-time { font-size: 10px; }
.demo-assistant {
  display: block;
  padding: 0;
  background: transparent;
}
.demo-assistant > div { width: 100%; }
.demo-assistant p { margin-top: 5px; }
.demo-progress { height: 3px; margin-top: 12px; background: #25252d; }
.demo-progress span { width: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.auth-proof { justify-content: flex-start; gap: 22px; color: var(--muted-2); }
.auth-proof span + span::before { content: "·"; margin-right: 22px; }

.auth-panel {
  padding: 36px 48px;
  background: #121217;
}
.auth-panel-top { right: 24px; top: 24px; }
.auth-card { width: 100%; max-width: 390px; }
.auth-heading { margin-bottom: 34px; }
.auth-icon {
  width: 50px;
  height: 50px;
  border-color: rgba(128,103,245,.35);
  border-radius: 13px;
  color: #b4a4ff;
  background: var(--violet-soft);
  font-size: 23px;
}
.auth-heading h2 { margin-bottom: 8px; font-size: 28px; letter-spacing: -.04em; }
.auth-heading p { font-size: 13px; }
.auth-form { gap: 10px; }
.field-label { margin-top: 8px; color: var(--muted); font-size: 12px; }
.input-shell {
  min-height: 52px;
  border-color: var(--stroke);
  border-radius: 12px;
  background: #18181e;
}
.input-shell:focus-within {
  border-color: rgba(128,103,245,.68);
  box-shadow: 0 0 0 3px rgba(128,103,245,.1);
}
.input-shell input { color: var(--text); background: transparent; font-size: 14px; }
.auth-submit { min-height: 54px; margin-top: 14px; padding: 0 17px; }
.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
}
.auth-options label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.auth-options input { width: 16px; min-height: 16px; accent-color: var(--violet); }
.auth-help { color: #a794ff; font-size: 11px; }
.auth-switch-row { justify-content: flex-start; margin-top: 48px; color: var(--muted-2); }
.auth-footnote { display: none; }
#themeButtonAuth { font-size: 0; }
#themeButtonAuth::before { content: "◐"; font-size: 16px; }

/* App shell */
.app-sidebar {
  width: var(--sidebar-w);
  padding: 18px 12px 14px;
  border-right-color: var(--stroke);
  background: #111115;
}
.sidebar-head { padding: 0 8px 15px; }
.new-chat-btn {
  min-height: 46px;
  margin-bottom: 12px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #765bea, #8a6cf3);
}
.new-chat-btn:hover { border-color: transparent; background: linear-gradient(135deg, #8065ef, #9275f8); }
.new-chat-btn kbd { display: none; }
.sidebar-nav { gap: 3px; }
.product-tab { min-height: 42px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.product-tab.active { color: var(--text); background: #202027; }
.nav-icon { color: var(--muted); }
.product-tab.active .nav-icon { color: var(--violet); }
.sidebar-divider { margin: 14px 5px; }
.history-title-row { padding: 0 7px 9px; }
.history-title-row > span { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.history-title-row small, .history-search, .history-tabs { display: none; }
.history-list { gap: 3px; padding-right: 0; overflow: visible; }
.history-item {
  min-height: 52px;
  padding: 8px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.history-item:hover, .history-item.active { border-color: transparent; background: #1b1b21; box-shadow: none; }
.history-item strong { font-size: 11px; }
.history-item small { font-size: 9px; }
.api-widget { display: none; }
.sidebar-bottom { margin-top: auto; }
.account-card { border-top: 1px solid var(--stroke); border-radius: 0; padding: 14px 7px 0; }
.account-copy small { display: none; }

.workspace-topbar {
  height: var(--topbar-h);
  padding: 0 22px;
  border-bottom-color: var(--stroke);
  background: rgba(12,12,15,.92);
}
.workspace-topbar-left strong { font-size: 15px; }
.workspace-topbar-left span { font-size: 10px; }
#refreshButton { display: none; }
.top-action {
  min-height: 36px;
  border-color: var(--stroke);
  border-radius: 10px;
  background: #17171c;
}
.workbench { padding-top: var(--topbar-h); }
.studio-view.active-view { grid-template-columns: minmax(0, 1fr) var(--inspector-w); }
.chat-pane { background: var(--bg); }
.chat-header {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 22px 28px 10px;
}
.chat-kicker { color: var(--violet); }
.chat-title-block h1 { margin-top: 8px; font-size: clamp(23px, 2.1vw, 30px); }
.chat-title-block p { font-size: 11px; }
.compact-stats { display: none; }
.conversation-stream {
  width: 100%;
  padding: 8px 28px 192px;
}
.chat-thread { width: min(980px, 100%); margin: 0 auto; }
.job-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}
.job-heading-row > div { display: flex; align-items: baseline; gap: 12px; }
.job-heading-row strong { font-size: 13px; }
.job-heading-row small { color: var(--muted-2); font-size: 10px; }
.result-card { border-radius: 14px; box-shadow: none; }
.video-shell, .rendering-box { min-height: 320px; }
.video-shell { aspect-ratio: 16 / 9; }
.video-shell video { width: 100%; height: 100%; max-height: none; object-fit: contain; }
.result-footer { padding: 13px 14px 14px; }
.result-specs {
  gap: 8px 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--stroke);
  font-size: 10px;
}
.result-specs b { margin-left: 4px; }
.job-prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
}
.job-prompt { color: var(--muted); font-size: 11px; }
.copy-prompt {
  width: 32px;
  height: 32px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-2);
  cursor: pointer;
}
.card-actions { margin-top: 0; padding-top: 0; border-top: 0; }
.card-actions button, .card-actions a {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 9px;
  font-size: 10px;
}
.card-actions .primary-action { color: #fff; border-color: transparent; background: var(--accent); }
.card-actions .more-action { width: 38px; padding: 0; }

.empty-state { padding-top: 24px; }
.empty-orb { width: 62px; height: 62px; border-radius: 17px; }
.empty-state h2 { font-size: 34px; }
.suggestion-grid { width: min(720px, 100%); margin: 24px auto 0; }

.composer-area {
  padding: 30px 28px 13px;
  background: linear-gradient(180deg, transparent, var(--bg) 24%);
}
.composer-dock {
  width: min(980px, 100%);
  padding: 10px;
  border-color: var(--stroke-strong);
  border-radius: 15px;
  background: #15151a;
  box-shadow: 0 18px 55px rgba(0,0,0,.32);
}
.composer-dock textarea {
  min-height: 58px;
  max-height: 150px;
  padding: 6px 7px;
  color: var(--text);
  font-size: 13px;
}
.composer-toolbar { padding: 3px 1px 0; }
.attach-main { width: 36px; height: 36px; border-radius: 9px; }
.prompt-chip { min-height: 36px; border-radius: 9px; }
.prompt-chip.accent { color: #b6a7ff; }
.send-btn {
  min-height: 42px;
  padding: 0 8px 0 17px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #765bea, #8b6ff6);
}
.send-btn b { color: #fff; background: rgba(255,255,255,.13); }
.composer-hint { display: none; }

.inspector-panel { border-left-color: var(--stroke); background: #111115; }
.inspector-head { padding: 20px 18px; }
.inspector-head > div > span { display: none; }
.inspector-head h3 { margin: 0; font-size: 16px; }
.inspector-scroll { gap: 0; padding: 8px 18px 24px; }
.parameter-card {
  padding: 17px 0;
  border: 0;
  border-bottom: 1px solid var(--stroke);
  border-radius: 0;
  background: transparent;
}
.parameter-title { margin-bottom: 11px; }
.parameter-title strong { color: var(--muted); font-size: 11px; }
.parameter-grid { gap: 8px; }
.parameter-card label { color: var(--muted-2); font-size: 10px; }
.parameter-card select, .details-body input, .details-body textarea {
  min-height: 42px;
  border-radius: 9px;
  background-color: #18181e;
}
.switch-line { min-height: 46px; padding: 9px 0; }
.switch-line b { font-size: 11px; }
.switch-line small { display: none; }
.utility-switch { display: none; }
.details-card { padding: 0; }
.details-card summary { min-height: 54px; padding: 0; }
.details-card summary strong { font-size: 11px; }
.details-card summary em { display: none; }
.details-body { padding: 0 0 16px; }

/* Secondary screens */
.library-view, .assets-view, .admin-view, .settings-view {
  padding: 34px clamp(22px, 4vw, 48px) 70px;
  background: var(--bg);
}
.view-page-head h1 { font-size: 34px; }
.job-card, .asset-card, .admin-card, .settings-card { border-color: var(--stroke); background: var(--panel); }

@media (max-width: 1180px) {
  :root { --sidebar-w: 218px; --inspector-w: 286px; }
  .conversation-stream, .chat-header, .composer-area { padding-right: 20px; padding-left: 20px; }
}

@media (max-width: 1020px) {
  :root { --sidebar-w: 248px; --inspector-w: 320px; }
  .app-sidebar { transform: translateX(-101%); }
  .app-sidebar.open { transform: translateX(0); }
  .app-workspace { margin-left: 0; }
  .workspace-topbar { left: 0; }
  .mobile-menu { display: grid; }
  .inspector-toggle { display: inline-flex; }
  .studio-view.active-view { grid-template-columns: 1fr; }
  .inspector-panel {
    position: fixed;
    top: var(--topbar-h);
    right: 0;
    bottom: 0;
    z-index: 60;
    width: min(var(--inspector-w), calc(100vw - 20px));
    transform: translateX(102%);
    box-shadow: var(--shadow-lg);
    transition: transform .22s ease;
  }
  .inspector-panel.open { transform: translateX(0); }
}

@media (max-width: 760px) {
  :root { --topbar-h: 58px; }
  .auth-screen { padding: 0; }
  .auth-shell { min-height: 100dvh; max-height: none; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .auth-showcase { display: none; }
  .auth-panel { min-height: 100dvh; padding: 20px; }
  .auth-panel-top { position: static; }
  .mobile-brand { display: inline-flex; }
  .auth-card { max-width: 420px; margin: auto; padding: 40px 0 70px; }
  .auth-heading { margin-bottom: 28px; }
  .auth-heading h2 { font-size: 27px; }
  .auth-options { align-items: flex-start; flex-direction: column; gap: 12px; }
  .auth-switch-row { margin-top: 34px; }

  .workspace-topbar { padding: 0 10px; }
  .workspace-topbar-left span { display: none; }
  .top-action-label { display: none; }
  .top-action { width: 36px; padding: 0; justify-content: center; }
  .chat-header { padding: 16px 14px 8px; }
  .chat-title-block h1 { font-size: 22px; }
  .chat-title-block p { display: none; }
  .conversation-stream { padding: 5px 10px 178px; }
  .job-heading-row { margin: 0 2px 9px; }
  .job-heading-row > div { display: grid; gap: 3px; }
  .video-shell, .rendering-box { min-height: 0; aspect-ratio: 16 / 9; }
  .result-footer { padding: 10px; }
  .result-specs { gap: 7px 13px; }
  .result-specs span:nth-child(4) { width: 100%; }
  .job-prompt-row { padding: 10px 0; }
  .card-actions button, .card-actions a { flex: 1; }
  .card-actions .more-action { flex: 0 0 38px; }
  .composer-area { padding: 28px 8px max(8px, env(safe-area-inset-bottom)); }
  .composer-dock { padding: 8px; border-radius: 14px; }
  .composer-dock textarea { min-height: 50px; font-size: 16px; }
  .composer-toolbar { align-items: center; }
  .composer-info { display: none; }
  .prompt-chip.accent { font-size: 0; }
  .prompt-chip.accent::after { content: "✦"; font-size: 14px; }
  .send-btn { width: auto; min-width: 98px; padding: 0 7px 0 13px; }
  .send-btn span { display: inline; }
  .empty-state { padding: 26px 4px 0; }
  .empty-state h2 { font-size: 27px; }
  .empty-state > p { font-size: 11px; }
  .suggestion-grid { grid-template-columns: 1fr; }
  .library-view, .assets-view, .admin-view, .settings-view { padding: 22px 12px 48px; }
}

@media (max-width: 420px) {
  .auth-panel { padding: 16px; }
  .auth-card { padding-top: 24px; }
  .auth-icon { width: 44px; height: 44px; }
  .auth-heading { grid-template-columns: 44px 1fr; gap: 13px; }
  .auth-heading h2 { font-size: 24px; }
  .new-chat-btn { min-height: 44px; }
  .chat-kicker { font-size: 8px; }
  .result-specs { font-size: 9px; }
  .card-actions { gap: 6px; }
  .card-actions button, .card-actions a { padding: 0 9px; }
  .send-btn { min-width: 92px; }
}
