:root {
  color-scheme: dark;
  --canvas: #0d0d12;
  --surface: #111117;
  --surface-2: #15151c;
  --surface-3: #191922;
  --line: #2c2c38;
  --line-strong: #41414f;
  --text: #d4d3df;
  --text-strong: #f1f0f6;
  --muted: #8d8b9b;
  --faint: #5e5c6a;
  --lime: #b4df72;
  --lime-strong: #c5ef83;
  --lime-ink: #11140d;
  --blue: #83a9eb;
  --rose: #ed8da9;
  --warning: #e5bf70;
  --danger: #ff808f;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0;
}

body {
  min-width: 320px;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

a {
  color: inherit;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-header {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  grid-template-rows: 54px;
  min-height: 54px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}

.brand-block {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  align-items: center;
  width: 122px;
  color: inherit;
  text-decoration: none;
}

.brand-block:focus-visible {
  outline: 1px solid var(--lime);
  outline-offset: -4px;
}

.brand-image-clip {
  position: relative;
  display: block;
  width: 122px;
  height: 28px;
  overflow: hidden;
}

.brand-image-clip img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 172px;
  max-width: none;
  height: auto;
  transform: translate(-50%, -50%);
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--lime);
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
}

.product-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 500;
  line-height: 1.05;
}

.product-title span {
  color: var(--muted);
}

.header-meta {
  display: flex;
  grid-column: 3;
  grid-row: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 22px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}

.model-badge {
  max-width: min(36vw, 460px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--warning);
}

.system-status.ready {
  color: var(--lime);
}

.system-status.ready .status-dot {
  background: var(--lime);
}

.system-status.error {
  color: var(--danger);
}

.system-status.error .status-dot {
  background: var(--danger);
}

.workflow-tabs {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.workflow-tabs::-webkit-scrollbar {
  display: none;
}

.workflow-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.workflow-tab:hover,
.workflow-tab:focus-visible {
  color: var(--text-strong);
  outline: none;
}

.workflow-tab.active,
.workflow-tab[aria-current="page"] {
  color: var(--lime);
}

.workflow-tab.active::after,
.workflow-tab[aria-current="page"]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: var(--lime);
  content: "";
}

.instrument {
  min-width: 0;
  min-height: 0;
  margin: 0;
  border: 1px solid var(--line);
  padding: 17px;
  background: transparent;
}

.instrument > legend {
  padding: 0 9px;
  color: var(--lime);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-transform: lowercase;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field-label,
.field > span,
.section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-transform: none;
}

textarea,
input,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: var(--surface);
  color: var(--text-strong);
}

textarea {
  padding: 11px 12px;
  line-height: 1.45;
  resize: vertical;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 1px var(--lime);
}

.primary,
.secondary,
.icon-button,
.recipe-button,
.sample-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 0;
  text-decoration: none;
}

.primary {
  padding: 0 18px;
  border-color: var(--lime);
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 700;
}

.primary:hover,
.primary:focus-visible {
  border-color: var(--lime-strong);
  background: var(--lime-strong);
  outline: none;
}

.secondary,
.icon-button,
.recipe-button,
.sample-button {
  background: var(--surface);
  color: var(--text);
}

.secondary {
  padding: 0 13px;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.secondary:hover,
.secondary:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.recipe-button:hover,
.recipe-button:focus-visible,
.sample-button:hover,
.sample-button:focus-visible {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--text-strong);
  outline: none;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--line);
  background: var(--surface);
}

.segment {
  min-width: 0;
  height: 36px;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--lime);
  color: var(--lime-ink);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.panel-heading p {
  margin: 0;
}

.panel-heading h2 {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
}

.panel-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.meta-line {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
  font-size: 12px;
}

.status-line.ready {
  color: var(--lime);
}

.status-line.error {
  color: var(--danger);
}

.mobile-only {
  display: none;
}

@media (max-width: 900px) {
  .app-header {
    grid-template-columns: 112px minmax(0, 1fr) auto;
    min-height: 50px;
    grid-template-rows: 50px;
    padding: 0 12px;
  }

  .brand-block,
  .brand-image-clip {
    width: 102px;
  }

  .brand-image-clip {
    height: 24px;
  }

  .brand-image-clip img {
    width: 144px;
  }

  .header-meta .model-badge {
    display: none;
  }

  .workflow-tab {
    min-width: 0;
    flex: 1 1 0;
    padding: 0 8px;
    font-size: 12px;
  }
}

@media (max-width: 560px) {
  .app-header {
    grid-template-columns: 96px minmax(0, 1fr) auto;
    min-height: 48px;
    grid-template-rows: 48px;
    padding: 0 8px;
  }

  .brand-block,
  .brand-image-clip {
    width: 88px;
  }

  .brand-image-clip {
    height: 22px;
  }

  .brand-image-clip img {
    width: 124px;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 9px;
  }

  .product-title {
    font-size: 19px;
  }

  .header-meta {
    padding: 0;
    font-size: 10px;
  }

  .header-meta .system-status {
    display: none;
  }

  .mobile-only {
    display: inline-flex;
  }

  .workflow-tab {
    min-width: 92px;
    flex: 0 0 auto;
    padding: 0 6px;
    font-size: 10px;
  }

  .instrument {
    padding: 12px;
  }
}

.workflow-intro { margin: 0; padding: 10px 20px; color: var(--muted); font-size: 13px; line-height: 1.5; border-bottom: 1px solid var(--line); }
.workflow-tab { flex-shrink: 0; }
@media (max-width: 1600px) {
  :is(.karaoke-shell, .podcast-shell, .movie-shell) .model-badge { display: none; }
}
