:root {
  color-scheme: dark;
  --bg: #071011;
  --bg-deep: #050b0c;
  --surface: #0d1718;
  --surface-2: #111e20;
  --surface-3: #162527;
  --surface-glass: rgba(13, 23, 24, 0.82);
  --border: rgba(185, 220, 216, 0.11);
  --border-strong: rgba(185, 220, 216, 0.2);
  --text: #edf7f5;
  --text-soft: #c5d5d2;
  --muted: #78908d;
  --accent: #58e0cc;
  --accent-strong: #72f2de;
  --accent-dim: rgba(88, 224, 204, 0.1);
  --accent-line: rgba(88, 224, 204, 0.3);
  --success: #67e8b5;
  --warning: #f2c96d;
  --danger: #ff8585;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.26);
  --sidebar: 236px;
  --sidebar-head: 132px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  scrollbar-color: rgba(120, 144, 141, 0.42) transparent;
  scrollbar-width: thin;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;
}

body {
  background-image:
    linear-gradient(rgba(88, 224, 204, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 224, 204, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 73% -12%, rgba(47, 143, 133, 0.17), transparent 31rem);
  background-position: center center;
  background-size: 40px 40px, 40px 40px, auto;
  min-width: 320px;
}

body::before {
  background: linear-gradient(90deg, transparent, rgba(88, 224, 204, 0.9), transparent);
  content: "";
  height: 1px;
  left: 0;
  opacity: 0.5;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 100;
}

::selection {
  background: rgba(88, 224, 204, 0.24);
  color: var(--text);
}

#app {
  display: block;
  margin: 0;
  max-width: none;
  min-width: 0;
  min-height: 100vh;
  overflow-x: clip;
  padding: 0;
  width: 100%;
}

.topbar {
  align-items: stretch;
  background: rgba(7, 16, 17, 0.9);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  height: var(--sidebar-head);
  justify-content: flex-start;
  left: 0;
  margin: 0;
  padding: 26px 22px 18px;
  position: fixed;
  top: 0;
  width: var(--sidebar);
  z-index: 30;
}

.brand {
  align-items: center;
  display: flex;
  gap: 11px;
}

.logo {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 7px 20px rgba(31, 20, 71, 0.35);
  color: var(--accent-strong);
  display: flex;
  flex: 0 0 auto;
  height: 38px;
  justify-content: center;
  overflow: hidden;
  width: 38px;
}

.logo img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.brand h1 {
  font-size: 0.93rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin: 0;
}

.subtitle {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.025em;
  line-height: 1.45;
  margin: 3px 0 0;
  text-transform: uppercase;
}

.status-pill {
  align-items: center;
  align-self: stretch;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  display: flex;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  gap: 8px;
  margin-top: 22px;
  padding: 12px 0 0;
  position: relative;
}

.status-pill::before {
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(120, 144, 141, 0.08);
  content: "";
  height: 6px;
  width: 6px;
}

.status-pill.ok {
  background: transparent;
  border-color: transparent;
  color: var(--success);
}

.status-pill.ok::before {
  box-shadow: 0 0 0 4px rgba(103, 232, 181, 0.09), 0 0 15px rgba(103, 232, 181, 0.55);
}

.status-pill.err {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}

.topbar-controls {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.topbar-controls .status-pill {
  flex: 1 1 auto;
  margin: 0;
  padding: 0;
}

.theme-toggle {
  align-items: center;
  background: rgba(185, 220, 216, 0.045);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #78908d;
  cursor: pointer;
  display: flex;
  flex: 0 0 auto;
  height: 30px;
  justify-content: center;
  padding: 0;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease;
  width: 30px;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--accent-dim);
  border-color: var(--accent-line);
  box-shadow: 0 0 16px rgba(88, 224, 204, 0.1);
  color: var(--accent);
  outline: none;
}

.theme-icon {
  align-items: center;
  display: none;
  justify-content: center;
}

.theme-icon svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  width: 15px;
}

html[data-theme="dark"] .theme-icon-sun,
html[data-theme="light"] .theme-icon-moon {
  display: inline-flex;
}

.desktop-nav {
  align-items: stretch;
  background: rgba(7, 16, 17, 0.9);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
  bottom: 0;
  left: 0;
  margin: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 14px 24px;
  position: fixed;
  top: var(--sidebar-head);
  width: var(--sidebar);
  z-index: 29;
}

.desktop-nav::before {
  color: #4f6562;
  content: "WORKSPACE";
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  margin: 0 10px 8px;
}

.nav-btn {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  display: flex;
  font-size: 0.78rem;
  font-weight: 550;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  position: relative;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.nav-btn:hover {
  background: rgba(185, 220, 216, 0.045);
  color: var(--text-soft);
}

.nav-btn.active {
  background: var(--accent-dim);
  border-color: rgba(88, 224, 204, 0.13);
  color: var(--accent-strong);
}

.nav-btn.active::after {
  background: var(--accent);
  border-radius: 2px;
  content: "";
  height: 18px;
  position: absolute;
  right: -15px;
  width: 2px;
}

.nav-icon {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
}

.nav-icon svg {
  fill: none;
  height: 17px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
  width: 17px;
}

.mobile-nav {
  display: none;
}

.page-root {
  margin: 0 auto 0 var(--sidebar);
  max-width: none;
  min-width: 0;
  padding: 62px clamp(28px, 3vw, 56px) 80px;
  width: calc(100% - var(--sidebar));
}

.boot-state {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  gap: 10px;
  min-height: 160px;
}

.boot-state-dot {
  animation: boot-pulse 1.4s ease-in-out infinite;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(88, 224, 204, 0.65);
  height: 7px;
  width: 7px;
}

.boot-state-error {
  color: var(--danger);
}

.boot-state-error .boot-state-dot {
  animation: none;
  background: var(--danger);
  box-shadow: 0 0 14px rgba(255, 133, 133, 0.42);
}

@keyframes boot-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1); }
}

.section {
  margin: 0 auto 38px;
  max-width: 1800px;
  min-width: 0;
  width: 100%;
}

body[data-page="models"] .section {
  max-width: 1720px;
}

body[data-page="inference"] .section {
  max-width: 1400px;
}

body[data-page="history"] .section {
  max-width: 1800px;
}

.section + .section {
  border-top: 1px solid rgba(185, 220, 216, 0.07);
  padding-top: 38px;
}

.section-head {
  margin-bottom: 17px;
  max-width: 760px;
}

.section:first-child .section-head::before {
  color: var(--accent);
  content: "MOS / " attr(data-section);
  display: block;
  font-family: var(--font-mono);
  font-size: 0.61rem;
  letter-spacing: 0.1em;
  margin-bottom: 9px;
  text-transform: uppercase;
}

body[data-page="models"] .section:first-child .section-head::before { content: "MOS / MODEL OPERATIONS"; }
body[data-page="inference"] .section:first-child .section-head::before { content: "MOS / CREATIVE INFERENCE"; }
body[data-page="history"] .section:first-child .section-head::before { content: "MOS / GENERATION ARCHIVE"; }

.section-head h2 {
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  font-weight: 590;
  letter-spacing: -0.045em;
  line-height: 1.1;
  margin: 0 0 8px;
}

.section-head p {
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.65;
  margin: 0;
}

.card {
  background: linear-gradient(145deg, rgba(17, 30, 32, 0.92), rgba(11, 21, 22, 0.94));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 0;
  padding: clamp(18px, 2.6vw, 28px);
  position: relative;
}

.card::before {
  background: linear-gradient(90deg, rgba(88, 224, 204, 0.65), transparent 70%);
  content: "";
  height: 1px;
  left: 28px;
  opacity: 0.42;
  position: absolute;
  right: 58%;
  top: -1px;
}

.runtime-card {
  margin-bottom: 14px;
}

.card-head {
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.card h3 {
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  margin: 0 0 18px;
  text-transform: uppercase;
}

.card-head h3 {
  margin: 0;
}

.gpu-grid {
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-bottom: 14px;
}

.gpu-card {
  background: linear-gradient(145deg, rgba(17, 30, 32, 0.85), rgba(9, 18, 19, 0.88));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 108px;
  overflow: hidden;
  padding: 18px;
  position: relative;
}

.gpu-card::after {
  border: 1px solid rgba(88, 224, 204, 0.08);
  border-radius: 50%;
  content: "";
  height: 82px;
  position: absolute;
  right: -25px;
  top: -25px;
  width: 82px;
}

.gpu-card h4 {
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0 0 9px;
}

.gpu-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.7;
}

.form-grid {
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.form-grid > *,
.card > *,
.model-list,
.model-item,
.alias-list,
.alias-item,
.item-actions,
label {
  min-width: 0;
}

.span-full { grid-column: 1 / -1; }
.span-2 { grid-column: span 2; }

label,
.field-label {
  color: #8ba19e;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  gap: 7px;
  letter-spacing: 0.015em;
}

input,
select,
textarea {
  background-color: rgba(6, 14, 15, 0.72);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  outline: none;
  padding: 10px 12px;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

select {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select {
  min-width: 0;
  position: relative;
  width: 100%;
}

.custom-select-native {
  display: none !important;
}

.custom-select-trigger {
  align-items: center;
  background-color: rgba(6, 14, 15, 0.72);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  gap: 10px;
  justify-content: space-between;
  min-height: 42px;
  min-width: 0;
  padding: 10px 11px 10px 12px;
  text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
  width: 100%;
}

.custom-select-trigger:hover {
  border-color: var(--border-strong);
}

.custom-select-trigger:focus-visible,
.custom-select.open .custom-select-trigger {
  background-color: rgba(9, 19, 20, 0.96);
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(88, 224, 204, 0.06), 0 0 18px rgba(88, 224, 204, 0.08);
  outline: none;
}

.custom-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.custom-select-trigger.placeholder .custom-select-value {
  color: #617774;
}

.custom-select-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  align-items: center;
  color: #6f8985;
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
  transition: color 150ms ease, transform 150ms ease;
}

.custom-select-chevron svg {
  fill: none;
  height: 15px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  width: 15px;
}

.custom-select.open .custom-select-chevron {
  color: var(--accent-strong);
  transform: rotate(180deg);
}

.custom-select-panel {
  background: linear-gradient(155deg, rgba(17, 31, 32, 0.99), rgba(7, 16, 17, 0.995));
  border: 1px solid rgba(88, 224, 204, 0.22);
  border-radius: 12px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.55), 0 0 26px rgba(88, 224, 204, 0.08);
  left: 0;
  min-width: 100%;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 111;
}

.custom-select.open-up .custom-select-panel {
  bottom: calc(100% + 7px);
  top: auto;
}

.custom-select-panel-head {
  display: none;
}

.custom-select-list {
  display: grid;
  gap: 3px;
  max-height: min(330px, 46vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.custom-select-option {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #a9bfbc;
  cursor: pointer;
  display: flex;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  gap: 10px;
  justify-content: space-between;
  line-height: 1.4;
  min-height: 38px;
  padding: 8px 34px 8px 10px;
  position: relative;
  text-align: left;
  width: 100%;
}

.custom-select-option span {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: rgba(185, 220, 216, 0.055);
  border-color: rgba(185, 220, 216, 0.1);
  color: var(--text-soft);
  outline: none;
}

.custom-select-option.selected {
  background: rgba(88, 224, 204, 0.1);
  border-color: rgba(88, 224, 204, 0.18);
  color: var(--accent-strong);
}

.custom-select-option.selected::after {
  background: var(--accent-strong);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(88, 224, 204, 0.72);
  content: "";
  height: 6px;
  position: absolute;
  right: 13px;
  width: 6px;
}

.custom-select-option:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.custom-select-backdrop {
  display: none !important;
}

body.custom-select-open {
  overflow-x: hidden;
}

.custom-select.open {
  z-index: 112;
}

textarea {
  line-height: 1.55;
  min-height: 78px;
}

input::placeholder,
textarea::placeholder {
  color: #4c6260;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  background-color: rgba(9, 19, 20, 0.92);
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(88, 224, 204, 0.06);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.compile-components {
  margin-top: 3px;
}

.chip-grid {
  gap: 7px;
}

.chip-check {
  background: rgba(6, 14, 15, 0.55);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  padding: 8px 11px;
}

.chip-check:hover {
  border-color: var(--border-strong);
}

.chip-check:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent-line);
  color: var(--accent-strong);
}

.chip-check input,
.checkbox-row input {
  accent-color: var(--accent);
  min-height: auto;
}

.slider-field {
  gap: 5px;
}

.slider-row {
  align-items: center;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 76px;
  min-height: 36px;
}

.slider-input {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  min-height: 36px;
  padding: 8px;
}

.history-page-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.slider-context {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

input[type="range"] {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: block;
  height: 24px;
  margin: 0;
  min-height: 24px;
  outline: 0;
  padding: 0;
}

input[type="range"]:hover,
input[type="range"]:focus,
input[type="range"]:focus-visible {
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: 0;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  border-color: var(--accent-strong);
  box-shadow:
    0 0 7px rgba(114, 242, 222, 0.92),
    0 0 17px rgba(88, 224, 204, 0.56),
    0 0 28px rgba(88, 224, 204, 0.2);
}

input[type="range"]:focus-visible::-moz-range-thumb {
  border-color: var(--accent-strong);
  box-shadow:
    0 0 7px rgba(114, 242, 222, 0.92),
    0 0 17px rgba(88, 224, 204, 0.56),
    0 0 28px rgba(88, 224, 204, 0.2);
}

input[type="range"]::-webkit-slider-runnable-track {
  background: rgba(185, 220, 216, 0.09);
  background-clip: padding-box;
  border: 1px solid rgba(185, 220, 216, 0.16);
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
  height: 16px;
}

input[type="range"]::-webkit-slider-thumb {
  background: #071514;
  border: 2px solid var(--accent-strong);
  box-sizing: border-box;
  box-shadow:
    0 0 5px rgba(114, 242, 222, 0.86),
    0 0 12px rgba(88, 224, 204, 0.42);
  height: 16px;
  margin-top: 0;
  width: 16px;
}

input[type="range"]::-moz-range-thumb {
  background: #071514;
  border: 2px solid var(--accent-strong);
  box-sizing: border-box;
  box-shadow:
    0 0 5px rgba(114, 242, 222, 0.86),
    0 0 12px rgba(88, 224, 204, 0.42);
  height: 16px;
  width: 16px;
}

input[type="range"]::-moz-range-track {
  background: rgba(185, 220, 216, 0.09);
  background-clip: padding-box;
  border: 1px solid rgba(185, 220, 216, 0.16);
  border-radius: 8px;
  box-sizing: border-box;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
  height: 16px;
}

input[type="range"]:hover::-webkit-slider-thumb {
  box-shadow:
    0 0 7px rgba(114, 242, 222, 0.92),
    0 0 17px rgba(88, 224, 204, 0.56),
    0 0 28px rgba(88, 224, 204, 0.2);
}

input[type="range"]:hover::-moz-range-thumb {
  box-shadow:
    0 0 7px rgba(114, 242, 222, 0.92),
    0 0 17px rgba(88, 224, 204, 0.56),
    0 0 28px rgba(88, 224, 204, 0.2);
}

.checkbox-row {
  color: var(--text-soft);
  font-family: var(--font-sans);
  font-size: 0.73rem;
  gap: 8px;
  padding-top: 11px;
}

.btn-row {
  gap: 8px;
  margin-top: 18px;
}

.btn {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  display: inline-flex;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 650;
  justify-content: center;
  min-height: 39px;
  padding: 9px 15px;
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, color 150ms ease, transform 150ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--accent);
  box-shadow: 0 8px 30px rgba(40, 175, 158, 0.17);
  color: #04100f;
}

.btn.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 10px 34px rgba(40, 175, 158, 0.25);
}

.btn.secondary {
  background: rgba(185, 220, 216, 0.08);
  border-color: var(--border);
  color: var(--text-soft);
}

.btn.secondary:hover {
  background: rgba(185, 220, 216, 0.12);
  border-color: var(--border-strong);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
  min-height: 32px;
  padding: 7px 11px;
}

.btn.ghost:hover {
  border-color: var(--accent-line);
  color: var(--accent);
}

.btn.small {
  font-family: var(--font-mono);
  font-size: 0.59rem;
  min-height: 30px;
}

.exp-panel,
.inference-details {
  background: rgba(4, 11, 12, 0.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.exp-panel {
  margin-top: 18px;
}

.exp-count,
.manual-ckpt,
.experiment-original,
.inference-summary,
.history-stats {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.manual-ckpt summary,
.inference-details summary {
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.67rem;
  font-weight: 600;
  outline: none;
}

.alias-divider,
.form-section {
  border-color: var(--border);
}

.alias-divider {
  margin: 22px 0 18px;
}

.section-label,
.alias-section-label {
  color: #617774;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
}

.form-section {
  margin-top: 20px;
  padding-top: 20px;
}

.parameter-group,
.parameter-group-content {
  min-width: 0;
}

.parameter-group-toggle {
  display: none;
}

.mobile-fold-content {
  min-width: 0;
}

.mobile-fold-toggle {
  display: none;
}

.alias-list {
  gap: 8px;
}

.alias-item,
.model-item,
.history-run {
  background: rgba(6, 14, 15, 0.54);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.alias-item {
  padding: 12px 14px;
}

.alias-item:hover,
.model-item:hover,
.history-run:hover {
  border-color: var(--border-strong);
}

.alias-item-name,
.model-title,
.history-run-title {
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 600;
}

.alias-item-original,
.model-meta,
.muted,
.history-run-sub,
.history-negative {
  color: var(--muted);
  font-size: 0.66rem;
}

.alias-item-name,
.alias-item-original,
.model-title,
.model-meta,
#inference-model-hint,
.manual-ckpt,
.experiment-original {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.model-list,
.history-list {
  gap: 10px;
  margin-top: 16px;
}

.model-item {
  padding: 14px;
  position: relative;
}

.model-item.active {
  border-color: rgba(103, 232, 181, 0.28);
  box-shadow: inset 2px 0 0 var(--success), 0 0 28px rgba(103, 232, 181, 0.025);
}

.item-actions {
  gap: 6px;
  margin-top: 10px;
}

.prompt-token-stats,
.meta-chips {
  gap: 6px;
}

.prompt-token-stats {
  align-items: center;
  margin-bottom: 4px;
  margin-top: 8px;
  min-height: 0;
}

.token-chip,
.meta-chip {
  background: rgba(185, 220, 216, 0.055);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.59rem;
  padding: 5px 8px;
}

.token-chip strong,
.meta-chip strong {
  color: var(--text-soft);
}

.token-chip-truncated {
  border-color: rgba(242, 201, 109, 0.35);
  color: var(--warning);
}

.schedule-error {
  color: var(--warning);
  font-family: var(--font-mono);
  font-size: 0.62rem;
}

.progress,
.job-status {
  background: rgba(88, 224, 204, 0.055);
  border: 1px solid rgba(88, 224, 204, 0.15);
  border-radius: 9px;
  color: #99cfc7;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  line-height: 1.6;
  margin-top: 14px;
  padding: 11px 13px;
}

.generation-progress {
  background:
    linear-gradient(135deg, rgba(88, 224, 204, 0.07), transparent 55%),
    rgba(4, 11, 12, 0.72);
  border: 1px solid rgba(88, 224, 204, 0.18);
  border-radius: 11px;
  margin-top: 10px;
  padding: 13px;
}

.generation-progress-head {
  align-items: center;
  color: var(--text-soft);
  display: flex;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  justify-content: space-between;
  margin-bottom: 9px;
}

#job-progress-percent {
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.generation-progress-track {
  background: rgba(185, 220, 216, 0.08);
  border: 1px solid rgba(185, 220, 216, 0.16);
  border-radius: 5px;
  box-sizing: border-box;
  height: 10px;
  overflow: hidden;
  width: 100%;
}

.generation-progress-fill {
  background: linear-gradient(90deg, #249f91, var(--accent-strong));
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(88, 224, 204, 0.7), 0 0 18px rgba(88, 224, 204, 0.28);
  height: 100%;
  min-width: 0;
  transition: width 350ms ease;
  width: 0%;
}

.generation-progress-metrics {
  display: grid;
  gap: 6px 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.generation-progress-metrics span {
  color: #607774;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  min-width: 0;
}

.generation-progress-metrics strong {
  color: #a4bfbb;
  display: block;
  font-size: 0.6rem;
  font-weight: 500;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-progress.error {
  border-color: rgba(255, 133, 133, 0.25);
}

.generation-progress.error .generation-progress-fill {
  background: #ff8585;
  box-shadow: 0 0 10px rgba(255, 133, 133, 0.42);
}

.result-grid {
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 16px;
}

.result-grid > div {
  background: #050b0c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.result-media-visual {
  aspect-ratio: 4 / 3;
  background: #03090a;
  max-height: 250px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.result-media-visual > img,
.result-media-visual > video {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: filter 180ms ease, transform 220ms ease;
  width: 100%;
}

.result-media-visual:hover > img,
.result-media-visual:hover > video {
  filter: brightness(0.82);
  transform: scale(1.025);
}

.result-grid img,
.result-grid video {
  border-radius: 0;
  display: block;
}

.history-run {
  overflow: hidden;
}

.history-run-head {
  align-items: center;
  background: rgba(185, 220, 216, 0.025);
  border-color: var(--border);
  padding: 13px 16px;
}

.history-run-body {
  padding: 16px;
}

.history-prompt {
  background: rgba(4, 11, 12, 0.52);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 0.76rem;
  line-height: 1.65;
  margin: 0 0 10px;
  max-height: 10rem;
  overflow-wrap: anywhere;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
}

.history-negative {
  background: rgba(4, 11, 12, 0.34);
  border: 1px solid rgba(185, 220, 216, 0.075);
  border-radius: 9px;
  line-height: 1.6;
  margin: 0 0 12px;
  max-height: 6.5rem;
  overflow-wrap: anywhere;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  padding: 9px 11px;
  white-space: pre-wrap;
}

.history-prompt::-webkit-scrollbar,
.history-negative::-webkit-scrollbar {
  width: 6px;
}

.history-prompt::-webkit-scrollbar-thumb,
.history-negative::-webkit-scrollbar-thumb {
  background: rgba(120, 144, 141, 0.34);
  border-radius: 999px;
}

.history-media-grid {
  gap: 9px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.history-media-card {
  background: #050b0c;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.history-media-visual {
  aspect-ratio: 4 / 3;
  background: #03090a;
  max-height: 250px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.history-media-visual > img,
.history-media-visual > video {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: filter 180ms ease, transform 220ms ease;
  width: 100%;
}

.history-media-open {
  cursor: zoom-in;
}

.history-media-open::after {
  background: rgba(3, 10, 11, 0.76);
  border: 1px solid rgba(185, 220, 216, 0.15);
  border-radius: 6px;
  bottom: 7px;
  color: #9fb6b2;
  content: "VIEW";
  font-family: var(--font-mono);
  font-size: 0.48rem;
  letter-spacing: 0.08em;
  opacity: 0;
  padding: 4px 6px;
  pointer-events: none;
  position: absolute;
  right: 7px;
  transition: opacity 160ms ease;
}

.history-media-open.video::before {
  border-bottom: 7px solid transparent;
  border-left: 11px solid rgba(237, 247, 245, 0.9);
  border-top: 7px solid transparent;
  content: "";
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-42%, -50%);
  z-index: 1;
}

.history-media-open:hover::after,
.history-media-open:focus-visible::after {
  opacity: 1;
}

.history-media-open:hover > img,
.history-media-open:hover > video {
  filter: brightness(0.82);
  transform: scale(1.025);
}

.history-media-open:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent);
  outline: none;
}

.history-media-name {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  padding: 7px 9px;
}

.history-lightbox {
  align-items: center;
  background: rgba(1, 6, 7, 0.92);
  backdrop-filter: blur(12px);
  display: grid;
  inset: 0;
  justify-items: center;
  padding: 56px 70px 46px;
  position: fixed;
  z-index: 300;
}

.history-lightbox-stage {
  align-items: center;
  display: flex;
  height: calc(100vh - 128px);
  justify-content: center;
  max-width: 100%;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  width: 100%;
}

.history-lightbox-stage img,
.history-lightbox-stage video {
  background: #020708;
  border: 1px solid rgba(185, 220, 216, 0.14);
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62), 0 0 34px rgba(88, 224, 204, 0.06);
  display: block;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  opacity: 1;
  transform: translate3d(var(--swipe-x, 0), 0, 0);
  transition: opacity 150ms ease, transform 180ms cubic-bezier(0.22, 0.8, 0.28, 1);
  -webkit-user-drag: none;
}

.history-lightbox-stage.dragging img,
.history-lightbox-stage.dragging video {
  transition: none;
}

.history-lightbox-stage.leave-left img,
.history-lightbox-stage.leave-left video {
  opacity: 0;
  transform: translate3d(-18%, 0, 0);
}

.history-lightbox-stage.leave-right img,
.history-lightbox-stage.leave-right video {
  opacity: 0;
  transform: translate3d(18%, 0, 0);
}

.history-lightbox-stage.enter-right img,
.history-lightbox-stage.enter-right video {
  opacity: 0;
  transform: translate3d(18%, 0, 0);
  transition: none;
}

.history-lightbox-stage.enter-left img,
.history-lightbox-stage.enter-left video {
  opacity: 0;
  transform: translate3d(-18%, 0, 0);
  transition: none;
}

.history-lightbox-close,
.history-lightbox-nav {
  align-items: center;
  background: rgba(10, 22, 23, 0.82);
  border: 1px solid rgba(185, 220, 216, 0.15);
  color: #a9bfbc;
  cursor: pointer;
  display: flex;
  justify-content: center;
  position: absolute;
}

.history-lightbox-close {
  border-radius: 10px;
  font-size: 1.25rem;
  height: 38px;
  right: 18px;
  top: 18px;
  width: 38px;
}

.history-lightbox-nav {
  border-radius: 50%;
  font-size: 1.8rem;
  height: 44px;
  line-height: 1;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
}

.history-lightbox-nav.prev {
  left: 16px;
}

.history-lightbox-nav.next {
  right: 16px;
}

.history-lightbox-close:hover,
.history-lightbox-nav:hover,
.history-lightbox-close:focus-visible,
.history-lightbox-nav:focus-visible {
  border-color: var(--accent-line);
  box-shadow: 0 0 18px rgba(88, 224, 204, 0.14);
  color: var(--accent-strong);
  outline: none;
}

.history-lightbox-caption {
  bottom: 16px;
  color: #78908d;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  left: 68px;
  overflow: hidden;
  position: absolute;
  right: 68px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.history-lightbox-open {
  overflow: hidden;
}

.empty {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  padding: 12px 0;
}

.hidden {
  display: none !important;
}

@media (min-width: 1180px) {
  body[data-page="models"] .section:first-child {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  }

  body[data-page="models"] .section:first-child .section-head,
  body[data-page="models"] .section:first-child .gpu-grid {
    grid-column: 1 / -1;
  }

  body[data-page="models"] .section:first-child .runtime-card,
  body[data-page="models"] .section:first-child > .card:last-child {
    margin: 0;
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar: 196px;
  }

  .topbar {
    padding-left: 17px;
    padding-right: 17px;
  }

  .brand h1 {
    font-size: 0.84rem;
  }

  .subtitle {
    font-size: 0.53rem;
  }

  .page-root {
    padding-left: 26px;
    padding-right: 26px;
  }
}

@media (max-width: 820px) {
  body {
    background-size: 32px 32px, 32px 32px, auto;
  }

  #app {
    display: block;
    padding: 0 0 calc(76px + env(safe-area-inset-bottom));
  }

  .topbar {
    align-items: center;
    backdrop-filter: blur(18px);
    background: rgba(7, 16, 17, 0.88);
    border-bottom: 1px solid var(--border);
    border-right: 0;
    flex-direction: row;
    height: auto;
    justify-content: space-between;
    left: 0;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    position: fixed;
    right: 0;
    top: 0;
    width: 100%;
    z-index: 60;
  }

  .logo {
    height: 34px;
    width: 34px;
  }

  .subtitle {
    display: none;
  }

  .status-pill {
    align-self: auto;
    font-size: 0;
    margin: 0;
    padding: 8px;
    width: auto;
  }

  .topbar-controls {
    gap: 7px;
    margin: 0;
  }

  .theme-toggle {
    height: 34px;
    width: 34px;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    backdrop-filter: blur(20px);
    background: rgba(7, 16, 17, 0.92);
    border-top: 1px solid var(--border);
    bottom: 0;
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(3, 1fr);
    left: 0;
    margin: 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    z-index: 50;
  }

  .mobile-nav .nav-btn {
    flex-direction: column;
    font-size: 0.6rem;
    gap: 3px;
    justify-content: center;
    min-height: 48px;
    padding: 5px;
    text-align: center;
  }

  .mobile-nav .nav-btn.active::after {
    display: none;
  }

  .mobile-nav .nav-icon svg {
    height: 16px;
    width: 16px;
  }

  .page-root {
    margin: 0;
    max-width: none;
    min-width: 0;
    overflow-x: clip;
    padding: calc(76px + env(safe-area-inset-top)) 14px 34px;
    width: 100%;
  }

  .section,
  .section-head,
  .card,
  .form-section,
  .form-grid,
  .slider-field,
  .slider-row,
  .model-list,
  .model-item,
  .alias-list,
  .alias-item {
    max-width: 100%;
    min-width: 0;
  }

  .model-title,
  .model-meta,
  #inference-model-hint {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #inference-model-hint {
    line-height: 1.45;
    max-height: 4.35em;
    overflow: auto;
  }

  input:not([type="range"]),
  select,
  textarea,
  .btn {
    min-height: 44px;
  }

  .custom-select-trigger {
    min-height: 44px;
  }

  .custom-select-panel {
    border-radius: 12px;
    bottom: auto;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.58), 0 0 26px rgba(88, 224, 204, 0.09);
    left: 0;
    max-height: none;
    min-width: 100%;
    padding: 6px;
    position: absolute;
    right: 0;
    top: calc(100% + 7px);
    width: 100%;
    z-index: 121;
  }

  .custom-select-panel-head {
    display: none;
  }

  .custom-select-close {
    align-items: center;
    background: rgba(185, 220, 216, 0.055);
    border: 1px solid rgba(185, 220, 216, 0.1);
    border-radius: 8px;
    color: #8ca5a1;
    display: flex;
    font-size: 1rem;
    height: 30px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 30px;
  }

  .custom-select-list {
    max-height: min(280px, 38vh);
  }

  .custom-select-option {
    font-size: 0.8rem;
    min-height: 44px;
    padding-bottom: 10px;
    padding-top: 10px;
  }

  .custom-select-backdrop {
    display: none !important;
  }

  input[type="range"] {
    height: 24px;
    min-height: 24px;
  }

  .section {
    margin-bottom: 28px;
  }

  .section + .section {
    padding-top: 28px;
  }

  .section-head h2 {
    font-size: 1.45rem;
  }

  body[data-page="models"] .section:first-child {
    display: flex;
    flex-direction: column;
  }

  body[data-page="models"] .section:first-child .section-head {
    order: 0;
  }

  body[data-page="models"] .section:first-child .gpu-grid {
    order: 1;
  }

  body[data-page="models"] .section:first-child .loaded-models-card {
    order: 2;
  }

  body[data-page="models"] .section:first-child .runtime-card {
    order: 3;
  }

  .gpu-grid {
    gap: 8px;
    grid-template-columns: repeat(var(--gpu-columns, 2), minmax(0, 1fr));
    margin-bottom: 10px;
  }

  .gpu-card {
    min-width: 0;
    padding: 10px;
  }

  .gpu-card h4 {
    display: -webkit-box;
    font-size: 0.7rem;
    line-height: 1.3;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .gpu-meta {
    font-size: 0.54rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .mobile-fold-desktop-title {
    display: none;
  }

  .mobile-fold-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text-soft);
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 56px;
    padding: 11px 13px;
    text-align: left;
    width: 100%;
  }

  .mobile-fold-heading {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
  }

  .mobile-fold-heading strong {
    color: #b9cbc8;
    font-size: 0.72rem;
    font-weight: 600;
  }

  .mobile-fold-heading > span {
    color: #617774;
    font-family: var(--font-mono);
    font-size: 0.55rem;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-fold-chevron {
    border-bottom: 1.5px solid #6f8985;
    border-right: 1.5px solid #6f8985;
    flex: 0 0 auto;
    height: 8px;
    margin-right: 4px;
    transform: rotate(225deg);
    transition: border-color 150ms ease, transform 180ms ease;
    width: 8px;
  }

  .mobile-fold.collapsed > .mobile-fold-toggle .mobile-fold-chevron {
    transform: rotate(45deg);
  }

  .mobile-fold:not(.collapsed) > .mobile-fold-toggle .mobile-fold-chevron {
    border-color: var(--accent-strong);
  }

  .mobile-fold.collapsed > .mobile-fold-content {
    display: none;
  }

  .runtime-card.mobile-fold {
    margin: 10px 0 0;
    padding: 0;
  }

  .runtime-card.mobile-fold > .mobile-fold-content {
    border-top: 1px solid rgba(185, 220, 216, 0.08);
    padding: 13px;
  }

  .mobile-fold-section {
    border-top: 0 !important;
    margin-bottom: 10px;
    padding-top: 0 !important;
  }

  .mobile-fold-section > .section-head {
    display: none;
  }

  .mobile-fold-section > .mobile-fold-toggle {
    background: linear-gradient(145deg, rgba(17, 30, 32, 0.84), rgba(9, 18, 19, 0.9));
    border: 1px solid var(--border);
    border-radius: 12px;
  }

  .mobile-fold-section:not(.collapsed) > .mobile-fold-toggle {
    border-color: rgba(88, 224, 204, 0.18);
  }

  .mobile-fold-section > .mobile-fold-content {
    margin-top: 8px;
  }

  .mobile-fold-inline {
    background: rgba(6, 15, 16, 0.4);
    border: 1px solid rgba(185, 220, 216, 0.09);
    border-radius: 10px;
    margin-top: 8px;
  }

  .mobile-fold-inline > .mobile-fold-toggle {
    min-height: 46px;
    padding: 8px 11px;
  }

  .mobile-fold-inline > .mobile-fold-content {
    border-top: 1px solid rgba(185, 220, 216, 0.07);
    padding: 10px 11px 11px;
  }

  .extra-params-group {
    background: rgba(6, 15, 16, 0.48);
    border: 1px solid rgba(185, 220, 216, 0.1);
    border-radius: 12px;
    margin-top: 8px;
  }

  .extra-params-group > .mobile-fold-toggle {
    min-height: 52px;
    padding: 9px 12px;
  }

  .extra-params-group:not(.collapsed) > .mobile-fold-toggle {
    border-bottom: 1px solid rgba(185, 220, 216, 0.08);
  }

  .extra-params-group > .extra-params-content {
    padding: 12px;
  }

  .extra-params-group .mobile-fold-inline {
    background: transparent;
    border: 0;
    border-radius: 0;
    margin-top: 12px;
  }

  .extra-params-group .mobile-fold-inline > .mobile-fold-toggle,
  .extra-params-group .parameter-group > .parameter-group-toggle {
    display: none;
  }

  .extra-params-group .mobile-fold-inline > .mobile-fold-content,
  .extra-params-group .parameter-group > .parameter-group-content {
    border: 0;
    display: block !important;
    padding: 0;
  }

  .extra-params-group .parameter-group {
    background: transparent;
    border: 0;
    border-radius: 0;
    margin-top: 14px;
  }

  .extra-params-group #output-parameters .parameter-group-content::before {
    color: #617774;
    content: "OUTPUT & DIMENSIONS";
    display: block;
    font-family: var(--font-mono);
    font-size: 0.56rem;
    letter-spacing: 0.1em;
    margin-bottom: 11px;
  }

  .extra-params-group .parameter-group-desktop-label {
    display: block;
    margin-bottom: 11px;
  }

  body[data-page="inference"] .page-root {
    padding-top: calc(70px + env(safe-area-inset-top));
  }

  body[data-page="inference"] .section-head {
    display: none;
  }

  body[data-page="inference"] .section-head h2 {
    font-size: 1.25rem;
    margin-bottom: 5px;
  }

  body[data-page="inference"] .section-head p {
    font-size: 0.7rem;
    line-height: 1.45;
  }

  body[data-page="inference"] .card {
    padding: 13px;
  }

  body[data-page="inference"] #prompt {
    height: 72px;
    min-height: 72px;
  }

  body[data-page="inference"] #negative-prompt {
    height: 58px;
    min-height: 58px;
  }

  body[data-page="inference"] #inference-model-hint {
    font-size: 0.56rem;
    max-height: 2.9em;
  }

  body[data-page="inference"] .parameter-group {
    margin-top: 8px;
  }

  body[data-page="inference"] .parameter-group-toggle {
    min-height: 52px;
    padding-bottom: 9px;
    padding-top: 9px;
  }

  body[data-page="inference"] #inference-summary {
    font-size: 0.55rem;
    margin-top: 8px;
  }

  .card {
    border-radius: 14px;
    padding: 17px;
  }

  .card::before {
    left: 17px;
  }

  .parameter-group {
    background: rgba(6, 15, 16, 0.48);
    border: 1px solid rgba(185, 220, 216, 0.1);
    border-radius: 12px;
    margin-top: 11px;
    overflow: visible;
  }

  .parameter-group.form-section {
    border-top: 1px solid rgba(185, 220, 216, 0.1);
    margin-top: 10px;
    padding-top: 0;
  }

  .parameter-group-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text-soft);
    cursor: pointer;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-height: 60px;
    padding: 11px 13px;
    text-align: left;
    width: 100%;
  }

  .parameter-group-toggle:focus-visible {
    border-radius: 11px;
    box-shadow: inset 0 0 0 1px var(--accent-line), 0 0 18px rgba(88, 224, 204, 0.08);
    outline: none;
  }

  .parameter-group-heading {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
  }

  .parameter-group-heading strong {
    color: #b9cbc8;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .parameter-group-heading > span {
    color: #617774;
    font-family: var(--font-mono);
    font-size: 0.56rem;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .parameter-group-chevron {
    border-bottom: 1.5px solid #6f8985;
    border-right: 1.5px solid #6f8985;
    flex: 0 0 auto;
    height: 8px;
    margin-right: 4px;
    transform: rotate(225deg);
    transition: border-color 150ms ease, transform 180ms ease;
    width: 8px;
  }

  .parameter-group.collapsed .parameter-group-chevron {
    transform: rotate(45deg);
  }

  .parameter-group:not(.collapsed) .parameter-group-toggle {
    border-bottom: 1px solid rgba(185, 220, 216, 0.08);
  }

  .parameter-group:not(.collapsed) .parameter-group-chevron {
    border-color: var(--accent-strong);
  }

  .parameter-group-content {
    padding: 13px;
  }

  .parameter-group.collapsed .parameter-group-content {
    display: none;
  }

  .parameter-group-desktop-label {
    display: none;
  }

  #inference-summary {
    line-height: 1.55;
    margin-top: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-full {
    grid-column: 1;
  }

  .alias-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .btn-row .btn {
    flex: 1 1 auto;
  }

  .btn-row .btn.primary,
  .btn-row .btn.secondary {
    flex-basis: 100%;
  }

  .slider-row {
    grid-template-columns: minmax(0, 1fr) 68px;
  }

  .result-grid {
    gap: 5px;
    grid-template-columns: repeat(var(--result-media-columns, 1), minmax(0, 1fr));
  }

  .result-media-card {
    min-width: 0;
  }

  .result-media-visual {
    aspect-ratio: 1 / 1;
    max-height: 180px;
  }

  .history-media-grid {
    gap: 5px;
    grid-template-columns: repeat(var(--history-media-columns, 1), minmax(0, 1fr));
  }

  .history-prompt,
  .history-negative {
    overscroll-behavior-y: auto;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .history-media-card {
    min-width: 0;
  }

  .history-media-visual {
    aspect-ratio: 1 / 1;
    max-height: 180px;
  }

  .history-media-name {
    display: none;
  }

  .history-media-open::after {
    display: none;
  }

  .history-lightbox {
    padding: 54px 12px 46px;
  }

  .history-lightbox-stage {
    height: calc(100dvh - 112px);
  }

  .history-lightbox-stage img,
  .history-lightbox-stage video {
    border-radius: 8px;
  }

  .history-lightbox-close {
    right: 12px;
    top: 10px;
  }

  .history-lightbox-nav {
    background: rgba(5, 14, 15, 0.76);
    height: 38px;
    top: auto;
    transform: none;
    width: 38px;
  }

  .history-lightbox-nav.prev {
    bottom: 10px;
    left: 12px;
  }

  .history-lightbox-nav.next {
    bottom: 10px;
    right: 12px;
  }

  .history-lightbox-caption {
    bottom: 19px;
    left: 58px;
    right: 58px;
  }

  .generation-progress-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 641px) and (max-width: 820px) {
  .page-root {
    padding-left: 22px;
    padding-right: 22px;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-2,
  .span-full {
    grid-column: 1 / -1;
  }

  .alias-item {
    align-items: center;
    flex-direction: row;
  }

  .history-media-grid {
    grid-template-columns: repeat(var(--history-media-columns, 1), minmax(0, 1fr));
  }

  .result-grid {
    grid-template-columns: repeat(var(--result-media-columns, 1), minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #edf4f3;
  --bg-deep: #e3edeb;
  --surface: #f8fbfa;
  --surface-2: #eef5f3;
  --surface-3: #e2eeeb;
  --surface-glass: rgba(249, 252, 251, 0.88);
  --border: rgba(31, 78, 71, 0.14);
  --border-strong: rgba(31, 78, 71, 0.25);
  --text: #102521;
  --text-soft: #29443f;
  --muted: #687f7b;
  --accent: #087f72;
  --accent-strong: #05685f;
  --accent-dim: rgba(8, 127, 114, 0.09);
  --accent-line: rgba(8, 127, 114, 0.3);
  --success: #07875f;
  --warning: #9a6500;
  --danger: #c44747;
  --shadow: 0 20px 54px rgba(41, 76, 70, 0.12);
}

html[data-theme="light"] body {
  background-image:
    linear-gradient(rgba(8, 127, 114, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 127, 114, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 73% -12%, rgba(32, 157, 142, 0.16), transparent 31rem);
}

html[data-theme="light"] body::before {
  background: linear-gradient(90deg, transparent, rgba(8, 127, 114, 0.68), transparent);
}

html[data-theme="light"] .topbar,
html[data-theme="light"] .desktop-nav,
html[data-theme="light"] .mobile-nav {
  background: rgba(244, 250, 248, 0.9);
  border-color: var(--border);
}

html[data-theme="light"] .theme-toggle {
  background: rgba(8, 127, 114, 0.055);
  color: #5e7772;
}

html[data-theme="light"] .nav-btn:hover {
  background: rgba(8, 127, 114, 0.055);
}

html[data-theme="light"] .nav-btn.active {
  background: rgba(8, 127, 114, 0.1);
  border-color: rgba(8, 127, 114, 0.16);
  color: var(--accent-strong);
}

html[data-theme="light"] .card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 250, 248, 0.97));
}

html[data-theme="light"] .gpu-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(239, 247, 245, 0.95));
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .custom-select-trigger {
  background-color: rgba(250, 253, 252, 0.94);
  color: var(--text);
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #8ba09c;
}

html[data-theme="light"] input:focus,
html[data-theme="light"] select:focus,
html[data-theme="light"] textarea:focus,
html[data-theme="light"] .custom-select-trigger:focus-visible,
html[data-theme="light"] .custom-select.open .custom-select-trigger {
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(8, 127, 114, 0.08);
}

html[data-theme="light"] .custom-select-panel {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.995), rgba(238, 247, 244, 0.995));
  border-color: rgba(8, 127, 114, 0.24);
  box-shadow: 0 18px 44px rgba(41, 76, 70, 0.2), 0 0 20px rgba(8, 127, 114, 0.06);
}

html[data-theme="light"] .custom-select-option {
  color: #4c6762;
}

html[data-theme="light"] .custom-select-option:hover,
html[data-theme="light"] .custom-select-option:focus-visible {
  background: rgba(8, 127, 114, 0.06);
  border-color: rgba(8, 127, 114, 0.1);
  color: var(--text-soft);
}

html[data-theme="light"] .custom-select-option.selected {
  background: rgba(8, 127, 114, 0.1);
  border-color: rgba(8, 127, 114, 0.18);
  color: var(--accent-strong);
}

html[data-theme="light"] label,
html[data-theme="light"] .field-label {
  color: #58716c;
}

html[data-theme="light"] .chip-check,
html[data-theme="light"] .alias-item,
html[data-theme="light"] .model-item,
html[data-theme="light"] .history-run,
html[data-theme="light"] .parameter-group,
html[data-theme="light"] .mobile-fold-inline,
html[data-theme="light"] .extra-params-group {
  background: rgba(248, 252, 251, 0.82);
}

html[data-theme="light"] .chip-check:has(input:checked) {
  background: rgba(8, 127, 114, 0.1);
  color: var(--accent-strong);
}

html[data-theme="light"] .btn.secondary {
  background: rgba(31, 78, 71, 0.07);
}

html[data-theme="light"] .btn.secondary:hover {
  background: rgba(31, 78, 71, 0.11);
}

html[data-theme="light"] .exp-panel,
html[data-theme="light"] .inference-details,
html[data-theme="light"] .history-prompt,
html[data-theme="light"] .history-negative {
  background: rgba(239, 247, 245, 0.82);
}

html[data-theme="light"] .token-chip,
html[data-theme="light"] .meta-chip {
  background: rgba(31, 78, 71, 0.055);
}

html[data-theme="light"] .progress,
html[data-theme="light"] .job-status {
  background: rgba(8, 127, 114, 0.055);
  border-color: rgba(8, 127, 114, 0.16);
  color: #416d66;
}

html[data-theme="light"] .generation-progress {
  background:
    linear-gradient(135deg, rgba(8, 127, 114, 0.08), transparent 55%),
    rgba(245, 251, 249, 0.9);
  border-color: rgba(8, 127, 114, 0.18);
}

html[data-theme="light"] .generation-progress-metrics span,
html[data-theme="light"] .section-label,
html[data-theme="light"] .alias-section-label,
html[data-theme="light"] .parameter-group-heading > span,
html[data-theme="light"] .mobile-fold-heading > span {
  color: #708984;
}

html[data-theme="light"] .generation-progress-metrics strong,
html[data-theme="light"] .parameter-group-heading strong,
html[data-theme="light"] .mobile-fold-heading strong {
  color: #38554f;
}

html[data-theme="light"] .history-run-head {
  background: rgba(31, 78, 71, 0.035);
}

html[data-theme="light"] .mobile-fold-section > .mobile-fold-toggle {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(239, 247, 245, 0.95));
}

html[data-theme="light"] .runtime-card.mobile-fold > .mobile-fold-content,
html[data-theme="light"] .mobile-fold-inline > .mobile-fold-content,
html[data-theme="light"] .parameter-group:not(.collapsed) .parameter-group-toggle {
  border-color: rgba(31, 78, 71, 0.1);
}

html[data-theme="light"] input[type="range"]::-webkit-slider-runnable-track {
  background: rgba(31, 78, 71, 0.1);
  border-color: rgba(31, 78, 71, 0.16);
}

html[data-theme="light"] input[type="range"]::-moz-range-track {
  background: rgba(31, 78, 71, 0.1);
  border-color: rgba(31, 78, 71, 0.16);
}

html[data-theme="light"] input[type="range"]::-webkit-slider-thumb {
  background: #f5fbf9;
  border-color: var(--accent);
}

html[data-theme="light"] input[type="range"]::-moz-range-thumb {
  background: #f5fbf9;
  border-color: var(--accent);
}
