/*
 * Matterline Studio OS
 * Original vanilla CSS adaptation of the cinematic workbench language studied
 * in Jiro's Luma/Bubble references. Functional contracts stay in the base CSS.
 */

:root {
  color-scheme: dark;
  --bg: #07090d;
  --sidebar: #090c11;
  --surface: #0e1218;
  --surface-2: #131923;
  --surface-3: #19212d;
  --line: rgba(255, 255, 255, .075);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #f5f7fa;
  --text-soft: #c2c9d3;
  --muted: #8c95a2;
  --muted-2: #68717e;
  --purple: #9d85ff;
  --purple-strong: #7359d7;
  --lime: #c7ff5b;
  --lime-ink: #101508;
  --danger: #ff7885;
  --warning: #f4c76d;
  --success: #76e39c;
  --topbar: 60px;
  --sidebar-width: 216px;
  --inspector-width: 320px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sans: "Avenir Next", Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --ease-studio: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-popover: 0 18px 50px rgba(0, 0, 0, .48);
  --shadow-dialog: 0 30px 100px rgba(0, 0, 0, .64);
}

html { background: var(--bg); }
body {
  background:
    radial-gradient(900px 500px at 48% -180px, rgba(157, 133, 255, .08), transparent 72%),
    var(--bg);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.006em;
}

button,
input,
textarea { letter-spacing: inherit; }

button {
  transition: color 160ms var(--ease-studio), border-color 160ms var(--ease-studio), background-color 160ms var(--ease-studio), opacity 160ms var(--ease-studio), transform 160ms var(--ease-studio), box-shadow 160ms var(--ease-studio);
}

button:active:not(:disabled) { transform: translateY(1px); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
::selection { background: rgba(157, 133, 255, .36); color: white; }

/* Application shell */
.app-topbar {
  height: var(--topbar);
  padding: 0 14px;
  grid-template-columns: var(--sidebar-width) 224px minmax(160px, 1fr) auto;
  border-color: var(--line);
  background: rgba(7, 9, 13, .9);
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
}

.brand { min-height: 44px; gap: 9px; }
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(115, 89, 215, .2);
}
.brand b { font-size: 16px; font-weight: 750; letter-spacing: -.55px; }
.brand small { font-size: 8px; letter-spacing: 1.3px; }

.project-switch {
  height: 38px;
  padding: 0 10px;
  border-color: transparent;
  border-radius: 9px;
  background: transparent;
}
.project-switch:hover { border-color: var(--line); background: rgba(255, 255, 255, .025); }
.project-switch small { font-size: 8px; }
.project-switch b { font-size: 11px; }

.topbar-center { min-width: 0; justify-content: flex-start; gap: 16px; padding-left: 18px; }
.workspace-location { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.workspace-location small { color: var(--muted-2); font-size: 9px; font-weight: 800; letter-spacing: .9px; }
.workspace-location b { overflow: hidden; color: var(--text-soft); font-size: 12px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.connection-state {
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 600;
}
.connection-state i,
.secure-dot i,
.inspector-footer i { width: 6px; height: 6px; box-shadow: none; }

.topbar-actions { gap: 6px; }
.credit-pill,
.account-button {
  min-height: 38px;
  border-color: transparent;
  border-radius: 9px;
  background: transparent;
}
.credit-pill:hover,
.account-button:hover { border-color: var(--line); background: rgba(255, 255, 255, .035); }
.credit-pill { padding: 0 9px; }
.credit-pill .ui-icon { width: 16px; }
.credit-pill b { font-size: 13px; }
.credit-pill small { font-size: 10px; }
.account-button { padding: 0 8px 0 4px; }
.account-button > span:first-child { width: 30px; height: 30px; border-radius: 8px; background: #242031; font-size: 10px; }
.account-copy b { font-size: 11px; }
.account-copy small { font-size: 9px; }

.workspace-shell {
  height: calc(100vh - var(--topbar));
  grid-template-columns: var(--sidebar-width) minmax(560px, 1fr) var(--inspector-width);
}

.app-sidebar {
  padding: 14px 10px 12px;
  border-color: var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .012), transparent 26%), var(--sidebar);
}
.tool-nav { gap: 2px; }
.tool-nav > p {
  margin: 20px 11px 7px;
  color: #565e6a;
  font-size: 9px;
  letter-spacing: 1.05px;
}
.tool-nav > p:first-child { margin-top: 4px; }
.tool-nav button {
  position: relative;
  min-height: 42px;
  padding: 0 10px;
  grid-template-columns: 21px minmax(0, 1fr) auto;
  gap: 9px;
  border-radius: 9px;
}
.tool-nav button:hover { background: rgba(255, 255, 255, .032); }
.tool-nav button.is-active,
.tool-nav button.is-workspace-active {
  border-color: rgba(157, 133, 255, .17);
  background: rgba(157, 133, 255, .085);
  color: #eeeaff;
}
.tool-nav button.is-active::before,
.tool-nav button.is-workspace-active::before {
  content: "";
  position: absolute;
  width: 2px;
  height: 20px;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 2px;
  background: var(--purple);
}
.tool-nav button > .ui-icon { width: 18px; }
.tool-nav b { overflow: hidden; font-size: 12px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.tool-nav small { font-size: 9px; }

.sidebar-upgrade {
  padding: 14px;
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.upgrade-icon { width: 30px; height: 30px; border-radius: 8px; }
.sidebar-upgrade b { margin-top: 10px; font-size: 13px; }
.sidebar-upgrade p { margin: 5px 0 12px; font-size: 11px; }
.sidebar-upgrade button { min-height: 40px; border-radius: 8px; font-size: 11px; }

/* Video-first creative workbench */
.catalog-pane {
  padding: 22px clamp(18px, 2.4vw, 34px) 64px;
  background:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px),
    radial-gradient(700px 370px at 52% -80px, rgba(115, 89, 215, .095), transparent 74%),
    #0a0d12;
  background-size: 64px 64px, 64px 64px, auto, auto;
}
.create-studio,
.catalog-content { max-width: 1180px; }
.studio-heading { align-items: center; }
.studio-heading p,
.catalog-eyebrow { margin-bottom: 5px; color: var(--purple); font-size: 9px; letter-spacing: 1.15px; }
.studio-heading h1 { font-size: clamp(25px, 2.1vw, 34px); font-weight: 700; letter-spacing: -.04em; }
.availability-badge {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 8px;
  letter-spacing: .6px;
}

.creative-stage-shell {
  position: relative;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #080b0f;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .24);
}
.stage-chrome {
  height: 36px;
  padding: 0 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #0d1117;
}
.stage-chrome > span { display: flex; gap: 5px; }
.stage-chrome > span i { width: 6px; height: 6px; border-radius: 50%; background: #343a44; }
.stage-chrome > span i:nth-child(2) { background: #454b56; }
.stage-chrome > span i:nth-child(3) { background: rgba(199, 255, 91, .55); }
.stage-chrome b { color: #717987; font-size: 8px; font-weight: 800; letter-spacing: 1.15px; }
.stage-chrome small { justify-self: end; color: #58606d; font-size: 9px; }
.creative-stage-shell > footer {
  min-height: 38px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  background: #0d1117;
  color: var(--muted-2);
  font-size: 10px;
}
.creative-stage-shell > footer span { display: inline-flex; align-items: center; gap: 7px; }
.creative-stage-shell > footer span i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.creative-stage-shell > footer small { color: #616976; font-size: 10px; }

.creative-stage-shell .output-preview {
  min-height: 300px;
  aspect-ratio: 16 / 7.4;
  padding: 18px;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 52% 38%, rgba(157, 133, 255, .22), transparent 23%),
    radial-gradient(ellipse at 50% 120%, rgba(199, 255, 91, .06), transparent 40%),
    linear-gradient(145deg, #111722, #07090d 62%);
}
.creative-stage-shell .output-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .34;
  background:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 76%);
}
.creative-stage-shell .output-preview::after { background: linear-gradient(transparent 42%, rgba(7, 9, 13, .88)); }
.creative-stage-shell .output-preview header { z-index: 3; }
.creative-stage-shell .output-preview header span { color: #aeb5c0; font-size: 9px; letter-spacing: 1.15px; }
.creative-stage-shell .output-preview header i { padding: 5px 8px; border-radius: 999px; font-size: 9px; }
.creative-stage-shell .preview-art { inset: 46px 16% 42px; }
.creative-stage-shell .preview-art span {
  width: 150px;
  height: 210px;
  border-color: rgba(255, 255, 255, .13);
  background: linear-gradient(150deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .01));
  box-shadow: 0 0 65px rgba(157, 133, 255, .25);
}
.creative-stage-shell .preview-art span:nth-child(2) { width: 104px; height: 150px; }
.creative-stage-shell .preview-art span:nth-child(3) { width: 38px; height: 38px; box-shadow: 0 0 40px rgba(199, 255, 91, .22); }
.creative-stage-shell .preview-copy { inset: auto 18px 18px; gap: 5px; }
.creative-stage-shell .preview-copy small { font-size: 9px; }
.creative-stage-shell .preview-copy b { max-width: 70%; font-size: clamp(18px, 2vw, 26px); font-weight: 650; letter-spacing: -.035em; }
.creative-stage-shell .preview-copy p { max-width: 620px; font-size: 12px; }

.composer {
  margin-top: 12px;
  padding: 16px;
  border-color: var(--line-strong);
  border-radius: 14px;
  background: rgba(14, 18, 24, .97);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .19);
}
.composer-head { margin-bottom: 10px; }
.composer-head > div > span { font-size: 9px; letter-spacing: .85px; }
.composer-head h2 { font-size: 14px; font-weight: 700; }
.change-model-button { min-height: 38px; border-radius: 8px; background: transparent; font-size: 11px; }
.prompt-field textarea {
  min-height: 90px;
  max-height: 190px;
  padding: 14px 14px 28px;
  border-color: var(--line);
  border-radius: 10px;
  background: #090c11;
  font-size: 14px;
  line-height: 1.55;
}
.prompt-field textarea:focus { border-color: rgba(157, 133, 255, .6); box-shadow: 0 0 0 3px rgba(157, 133, 255, .085); }
.prompt-field small { font-size: 10px; }
.parameter-row { margin-top: 8px; gap: 7px; }
.parameter-control {
  min-width: 108px;
  min-height: 62px;
  padding: 6px 9px;
  border-radius: 9px;
  background: #0d1117;
}
.parameter-control--enum { min-width: 130px; }
.parameter-control > span { font-size: 8px; }
.parameter-control input,
.parameter-select-trigger { height: 38px; }
.parameter-select-value { font-size: 12px; }
.parameter-select-menu {
  padding: 5px;
  border-color: var(--line-strong);
  border-radius: 11px;
  background: #151a22;
  box-shadow: var(--shadow-popover);
}
.parameter-select-option { min-height: 42px; border-radius: 7px; font-size: 12px; }
.frame-controls { margin-top: 9px; padding: 12px; border-color: var(--line); border-radius: 10px; background: #0b0f14; }
.frame-controls > header b { font-size: 12px; }
.frame-controls > header small,
.frame-controls > header > span { font-size: 10px; }
.frame-slot { min-height: 76px; border-radius: 9px; background: #090c11; }
.asset-button,
.quote-button { min-height: 44px; border-radius: 9px; font-size: 12px; }
.quote-button { box-shadow: none; }
.composer-message { min-height: 16px; margin-top: 7px; font-size: 11px; }

/* Model gallery */
.catalog-content { margin-top: 46px; }
.catalog-header { align-items: center; }
.catalog-header h2 { font-size: clamp(23px, 2vw, 30px); font-weight: 680; }
.catalog-header > div > p:last-child { margin-top: 6px; font-size: 12px; }
.model-search { height: 42px; }
.model-search input { border-radius: 9px; background: #0d1117; font-size: 12px; }
.content-toolbar { margin: 16px 0 12px; }
.availability-filters button { min-height: 36px; border-radius: 8px; font-size: 11px; }
.app-model-grid { grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 10px; }
.app-model-card {
  min-height: 300px;
  padding: 13px;
  border-radius: 12px;
  background: #0e1218;
  text-align: left;
}
.app-model-card:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, .16); background: #11161d; box-shadow: 0 18px 42px rgba(0, 0, 0, .24); }
.app-model-card.is-selected { border-color: rgba(157, 133, 255, .72); box-shadow: 0 0 0 2px rgba(157, 133, 255, .1), 0 20px 48px rgba(0, 0, 0, .28); }
.app-model-card.is-selected::after { width: 10px; height: 10px; right: 10px; top: 10px; border-width: 4px; }
.card-visual {
  height: 148px;
  margin: -13px -13px 12px;
  border-bottom-color: var(--line);
  background:
    radial-gradient(circle at 72% 24%, var(--accent), transparent 23%),
    linear-gradient(145deg, #222a36, #0b0e13 68%);
}
.card-visual::before {
  width: 112px;
  height: 176px;
  top: -12px;
  border-color: rgba(255, 255, 255, .14);
  background: linear-gradient(155deg, rgba(255, 255, 255, .12), transparent 64%);
  box-shadow: 0 0 42px color-mix(in srgb, var(--accent), transparent 35%);
}
.card-visual::after { height: 72%; background: linear-gradient(transparent, rgba(7, 9, 13, .8)); }
.card-visual-name {
  position: absolute;
  z-index: 2;
  left: 13px;
  bottom: 11px;
  max-width: calc(100% - 26px);
  overflow: hidden;
  color: rgba(255, 255, 255, .88);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.045em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.app-model-card[data-model-family^="kling"] .card-visual { background: radial-gradient(circle at 76% 25%, rgba(199, 255, 91, .34), transparent 25%), linear-gradient(140deg, #1a2228, #080b0f 68%); }
.app-model-card[data-model-family^="seedance"] .card-visual { background: radial-gradient(circle at 74% 20%, rgba(92, 141, 255, .44), transparent 25%), linear-gradient(140deg, #1d2031, #090b11 68%); }
.app-model-card[data-model-family^="veo"] .card-visual { background: radial-gradient(circle at 72% 24%, rgba(248, 121, 98, .36), transparent 25%), linear-gradient(140deg, #241c22, #090b10 68%); }
.app-model-card[data-model-family^="wan"] .card-visual { background: radial-gradient(circle at 72% 24%, rgba(157, 133, 255, .43), transparent 25%), linear-gradient(140deg, #211d2e, #090b10 68%); }
.card-tag { font-size: 8px; }
.card-tag > i { padding: 4px 6px; border-radius: 999px; font-size: 7px; }
.app-model-card h3 { margin: 8px 0 4px; font-size: 14px; font-weight: 700; }
.app-model-card p { min-height: 34px; font-size: 10px; line-height: 1.5; }
.card-capabilities { min-height: 24px; margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.card-capabilities > span { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; color: #9099a6; background: rgba(255, 255, 255, .018); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.card-footer { margin-top: auto; padding-top: 9px; }
.card-price { font-size: 9px; }
.card-action { font-size: 9px; }

/* Quote inspector */
.quote-inspector {
  padding: 18px 16px 14px;
  border-color: var(--line);
  background: #090c11;
}
.inspector-head { margin-top: 0; padding-bottom: 14px; }
.inspector-head p { font-size: 8px; }
.inspector-head h2 { font-size: 18px; font-weight: 680; }
.secure-dot { font-size: 9px; }
.quote-empty { min-height: 220px; padding: 28px 12px; }
.quote-empty > .ui-icon { width: 40px; height: 40px; border-radius: 10px; }
.quote-empty b { font-size: 13px; }
.quote-empty p { font-size: 11px; }
.quote-model span { font-size: 8px; }
.quote-model b { font-size: 11px; }
.quote-total { border-radius: 11px; background: #0e1218; }
.quote-total strong b { font-size: 32px; }
.quote-result dl { border-radius: 9px; }
.quote-result dt { font-size: 10px; }
.quote-result dd { font-size: 11px; }
.generation-state > span { font-size: 8px; }
.generation-state > button { min-height: 44px; border-radius: 9px; font-size: 11px; }
.generation-state > p { font-size: 10px; }

/* Shared tool workspaces */
.workspace-shell.is-tool-workspace { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.tool-workspace {
  padding: 24px clamp(20px, 3vw, 44px) 64px;
  background:
    linear-gradient(rgba(255, 255, 255, .016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .016) 1px, transparent 1px),
    radial-gradient(760px 420px at 16% -8%, rgba(115, 89, 215, .085), transparent 70%),
    #0a0d12;
  background-size: 64px 64px, 64px 64px, auto, auto;
}
.tool-workspace-heading { max-width: 1480px; margin-bottom: 18px; align-items: center; }
.tool-workspace-heading > div:first-child { max-width: 800px; }
.tool-workspace-heading p { margin-bottom: 5px; font-size: 9px; letter-spacing: 1.15px; }
.tool-workspace-heading h1 { font-size: clamp(27px, 2.5vw, 38px); font-weight: 680; line-height: 1.06; letter-spacing: -.045em; }
.tool-workspace-heading > div:first-child > span { margin-top: 8px; font-size: 12px; line-height: 1.5; }
.method-chip { min-width: 160px; padding: 10px 12px; border-color: var(--line); border-radius: 9px; background: #0e1218; }
.method-chip small { font-size: 8px; }
.method-chip b { font-size: 11px; }
.tool-card { border-color: var(--line); border-radius: 14px; background: rgba(14, 18, 24, .97); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }

/* Script editor */
.script-workspace-grid { max-width: 1480px; grid-template-columns: minmax(480px, .86fr) minmax(460px, 1.14fr); gap: 14px; }
.narrative-method { padding: 14px 17px; border-radius: 14px 14px 0 0; background: rgba(157, 133, 255, .045); }
.narrative-method header small { font-size: 8px; }
.narrative-method header b { font-size: 10px; }
.narrative-method ol { margin-top: 12px; }
.narrative-method li { padding-inline: 9px; }
.narrative-method li span { font-size: 8px; }
.narrative-method li b { font-size: 10px; }
.narrative-method li small { font-size: 8px; }
.builder-section { padding: 19px; }
.builder-section-title { margin-bottom: 14px; }
.builder-section-title > span { width: 28px; height: 28px; border-radius: 8px; }
.builder-section-title b { font-size: 13px; }
.builder-section-title small { font-size: 10px; }
.workspace-field > span,
.style-selector legend,
.preset-selector legend { font-size: 11px; }
.workspace-field input,
.workspace-field textarea,
.agent-composer textarea { border-radius: 9px; background: #090c11; font-size: 13px; }
.workspace-field input { min-height: 44px; }
.workspace-field textarea { line-height: 1.55; }
.workspace-field > small { font-size: 10px; }
.choice-grid label > span { min-height: 62px; border-radius: 9px; background: #0b0f14; }
.choice-grid b { font-size: 11px; }
.choice-grid small { font-size: 9px; }
.style-selector label > span,
.preset-selector label > span { min-height: 38px; border-radius: 8px; background: #0b0f14; font-size: 10px; }
.output-mode-grid label > span { min-height: 104px; border-radius: 10px; background: #0b0f14; }
.output-mode-grid b { font-size: 12px; }
.output-mode-grid small { font-size: 10px; }
.builder-submit {
  position: static;
  min-height: 76px;
  padding: 13px 16px;
  border-radius: 0 0 14px 14px;
  background: #10151c;
}
.builder-submit > div > span { font-size: 11px; }
.builder-submit > div > small { font-size: 10px; }
.builder-submit button,
.agent-composer button { min-height: 44px; border-radius: 9px; font-size: 11px; }
.script-output { top: 14px; min-height: 680px; padding: 18px; }
.script-output > header p { font-size: 8px; }
.script-output > header h2 { font-size: 20px; font-weight: 680; }
.script-output > header > span { border-radius: 6px; font-size: 8px; }
.script-output-empty p { font-size: 11px; }
.script-result-body { border-radius: 10px; background: #090c11; font-size: 14px; line-height: 1.72; }
.script-result footer button,
.script-history button { border-radius: 8px; font-size: 10px; }
.history-item { border-radius: 8px; background: #0b0f14; }

/* Agent */
.agent-workspace-grid { max-width: 1480px; min-height: 670px; grid-template-columns: 276px minmax(520px, 1fr); gap: 14px; }
.agent-context { padding: 18px; }
.agent-context > p { font-size: 8px; }
.agent-context h2 { font-size: 20px; }
.agent-quick-prompts { margin-top: 16px; gap: 7px; }
.agent-quick-prompts button { min-height: 48px; border-radius: 9px; background: #0b0f14; font-size: 11px; }
.agent-canvas-context { margin-top: 16px; border-radius: 9px; }
.agent-canvas-context b { font-size: 10px; }
.agent-canvas-context small { font-size: 9px; }
.agent-chat { min-height: 670px; }
.agent-chat > header { min-height: 60px; }
.agent-chat > header b { font-size: 12px; }
.agent-chat > header small { font-size: 9px; }
.agent-orb { width: 32px; height: 32px; border-radius: 10px; box-shadow: none; }
.agent-messages { padding: 20px; }
.agent-messages article > div { border-radius: 4px 11px 11px; background: #141a23; }
.agent-messages p { font-size: 13px; }
.agent-composer { padding: 11px; background: #0d1117; }
.agent-composer textarea { min-height: 82px; }
.agent-composer footer > span { font-size: 10px; }

/* Canvas */
.canvas-board { max-width: 1660px; min-height: 600px; padding: 10px; gap: 9px; }
.canvas-heading-actions button { min-height: 40px; border-radius: 8px; font-size: 11px; }
.canvas-lane { min-width: 250px; padding: 9px; border-color: var(--line); border-radius: 11px; background: #0b0f14; }
.canvas-lane > header { grid-template-columns: 8px 1fr 32px; }
.canvas-lane > header b { font-size: 11px; }
.canvas-lane > header small { font-size: 9px; }
.canvas-lane > header button { width: 32px; height: 32px; border-radius: 8px; font-size: 16px; }
.canvas-lane > div { min-height: 500px; }
.canvas-lane > div:empty::before {
  content: "Solte ou crie um card";
  min-height: 90px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, .09);
  border-radius: 9px;
  color: #5f6875;
  font-size: 10px;
}
.canvas-card { border-radius: 9px; background: #151b24; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.canvas-card > header small { font-size: 8px; }
.canvas-card h3 { font-size: 12px; }
.canvas-card p { font-size: 10px; }
.canvas-card footer button { border-radius: 7px; font-size: 9px; }

/* Plans, account and feedback surfaces */
.auth-dialog,
.plans-dialog {
  border-color: var(--line-strong);
  border-radius: 18px;
  background: #10151c;
  box-shadow: var(--shadow-dialog);
}
.auth-dialog::backdrop,
.plans-dialog::backdrop { background: rgba(2, 3, 6, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.auth-dialog h2,
.plans-header h2 { font-weight: 680; }
.dialog-close-form button,
.sheet-close { border-radius: 9px; }
.auth-mode-switch { border-radius: 10px; background: #090c11; }
.auth-mode-switch button { border-radius: 7px; }
.auth-form input { border-radius: 9px; background: #090c11; }
.auth-form > button[type="submit"] { border-radius: 9px; }
.dialog-pricing-grid { gap: 10px; }
.dialog-plan { border-radius: 13px; background: #0b0f14; }
.dialog-plan.is-featured { background: linear-gradient(150deg, rgba(157, 133, 255, .1), transparent 46%), #0f141b; }
.dialog-credit-block { border-radius: 10px; }
.dialog-plan button { border-radius: 9px; }
.app-toast { top: 76px; bottom: auto; border-radius: 10px; background: #161c25; box-shadow: var(--shadow-popover); }

@media (max-width: 1400px) {
  :root { --sidebar-width: 200px; --inspector-width: 300px; }
  .app-topbar { grid-template-columns: var(--sidebar-width) 210px minmax(130px, 1fr) auto; }
  .app-model-grid { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .creative-stage-shell .output-preview { aspect-ratio: 16 / 8.2; }
}

@media (max-width: 1120px) {
  :root { --inspector-width: 300px; }
  .app-topbar { grid-template-columns: 190px minmax(130px, 1fr) auto; }
  .app-topbar .project-switch { display: none; }
  .topbar-center { padding-left: 8px; }
  .workspace-shell { height: calc(100vh - var(--topbar) - 64px); grid-template-columns: minmax(450px, 1fr) var(--inspector-width); }
  .workspace-shell.is-tool-workspace { grid-template-columns: minmax(0, 1fr); }
  .app-sidebar { display: none; }
  .tool-workspace { grid-column: 1; }
  .mobile-bottom-nav {
    position: fixed;
    z-index: 70;
    inset: auto 0 0;
    height: 64px;
    padding: 5px max(10px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    background: rgba(9, 12, 17, .96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .mobile-bottom-nav button { min-height: 52px; display: grid; place-items: center; align-content: center; gap: 3px; border: 0; border-radius: 8px; background: transparent; color: var(--muted-2); font-size: 10px; font-weight: 650; }
  .mobile-bottom-nav button.is-active { color: #e2d9ff; background: rgba(157, 133, 255, .07); }
  .mobile-bottom-nav .ui-icon { width: 20px; height: 20px; }
  .script-workspace-grid { grid-template-columns: minmax(430px, .92fr) minmax(390px, 1.08fr); }
  .agent-workspace-grid { grid-template-columns: 250px minmax(420px, 1fr); }
}

@media (max-width: 800px) {
  :root { --topbar: 56px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .app-topbar { grid-template-columns: 1fr auto; }
  .app-topbar .topbar-center { display: none; }
  .workspace-shell { height: auto; min-height: calc(100vh - var(--topbar)); display: block; }
  .catalog-pane { padding: 20px 15px 50px; }
  .quote-inspector { display: none; }
  .studio-heading { align-items: flex-start; }
  .studio-heading h1 { font-size: 28px; }
  .creative-stage-shell .output-preview { min-height: 260px; aspect-ratio: 4 / 3; }
  .creative-stage-shell .preview-art span { width: 118px; height: 168px; }
  .creative-stage-shell .preview-art span:nth-child(2) { width: 82px; height: 118px; }
  .composer { padding: 14px; }
  .catalog-content { margin-top: 36px; }
  .catalog-header { align-items: flex-start; }
  .app-model-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .tool-workspace { padding: 21px 15px 46px; }
  .tool-workspace-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .tool-workspace-heading h1 { font-size: 29px; }
  .script-workspace-grid { grid-template-columns: 1fr; }
  .script-output { position: static; min-height: 500px; }
  .agent-workspace-grid { grid-template-columns: 1fr; }
  .agent-context { order: 0; }
  .agent-chat { min-height: 620px; }
  .mobile-quote-sheet { border-radius: 18px 18px 0 0; background: #10151c; }
  .mobile-quote-sheet .quote-inspector { display: flex; }
}

@media (max-width: 620px) {
  .brand b { font-size: 15px; }
  .catalog-pane { padding-inline: 12px; }
  .studio-heading { gap: 10px; }
  .studio-heading h1 { font-size: 25px; }
  .availability-badge { align-self: flex-start; }
  .creative-stage-shell { margin-top: 13px; border-radius: 12px; }
  .stage-chrome { height: 32px; }
  .creative-stage-shell .output-preview { min-height: 228px; aspect-ratio: 1 / 1; }
  .creative-stage-shell .preview-copy b { max-width: 88%; font-size: 19px; }
  .creative-stage-shell .preview-copy p { max-width: 92%; font-size: 10px; }
  .creative-stage-shell > footer small { display: none; }
  .composer { padding: 12px; border-radius: 11px; }
  .composer-head { align-items: center; }
  .composer-head > div { display: grid; gap: 2px; }
  .prompt-field textarea { min-height: 88px; }
  .parameter-row { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; }
  .parameter-control { flex: 0 0 118px; scroll-snap-align: start; }
  .parameter-control--enum { flex-basis: 138px; }
  .frame-controls > div { grid-template-columns: 1fr; }
  .composer-actions { gap: 7px; }
  .asset-button { max-width: 44%; }
  .catalog-header h2 { font-size: 25px; }
  .app-model-grid {
    margin-inline: -12px;
    padding: 0 12px 8px;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(248px, 82vw);
    grid-template-columns: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .app-model-grid::-webkit-scrollbar { display: none; }
  .app-model-card { min-height: 294px; scroll-snap-align: start; }
  .tool-workspace { padding-inline: 12px; }
  .tool-workspace-heading h1 { font-size: 27px; }
  .method-chip { width: 100%; }
  .narrative-method { overflow-x: auto; }
  .narrative-method header,
  .narrative-method ol { min-width: 470px; }
  .builder-section { padding: 16px 13px; }
  .builder-submit { align-items: stretch; flex-direction: column; }
  .builder-submit button { width: 100%; }
  .script-output { padding: 14px; }
  .agent-messages { padding: 14px; }
  .canvas-board { margin-inline: -12px; padding-inline: 12px; scroll-snap-type: x mandatory; }
  .canvas-lane { min-width: 82vw; scroll-snap-align: center; }
  .plans-dialog { border-radius: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
