:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d9e2ec;
  --text: #102033;
  --muted: #667085;
  --primary: #2057d8;
  --primary-dark: #132f68;
  --accent: #c9932b;
  --accent-soft: #fff6df;
  --teal: #0f8b8d;
  --success: #188a53;
  --warning: #b86100;
  --danger: #c93535;
  --sidebar: #0a1220;
  --sidebar-soft: #172235;
  --shadow: 0 14px 34px rgba(15, 31, 56, 0.09);
  --shadow-strong: 0 22px 60px rgba(15, 31, 56, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(226, 235, 244, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 235, 244, 0.55) 1px, transparent 1px),
    linear-gradient(180deg, #f7fafc 0%, var(--bg) 320px, #f5f7fa 100%);
  background-size: 36px 36px, 36px 36px, auto;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background:
    linear-gradient(180deg, #08101d 0%, var(--sidebar) 58%, #102525 100%);
  color: #eef2f7;
  padding: 20px 14px;
  box-shadow: 8px 0 30px rgba(7, 18, 34, 0.18);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(201, 147, 43, 0.36);
  background: linear-gradient(145deg, #ffffff 0%, #fff6df 100%);
  color: var(--primary-dark);
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.brand-logo {
  width: 33px;
  height: 33px;
}

.logo-shield {
  fill: #ffffff;
  stroke: var(--primary-dark);
  stroke-width: 2.4;
}

.logo-mane,
.logo-face,
.logo-node {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-mane {
  stroke: var(--accent);
  stroke-width: 3.4;
}

.logo-face {
  stroke: var(--primary-dark);
  stroke-width: 3.2;
}

.logo-node {
  stroke: var(--teal);
  stroke-width: 2.8;
}

.brand-copy {
  min-width: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0;
}

.brand small {
  margin-top: 2px;
  color: #aab3c2;
  font-size: 12px;
  line-height: 1.45;
}

.nav-list {
  display: grid;
  gap: 4px;
  padding-top: 16px;
}

.nav-section-label {
  margin: 14px 8px 4px;
  color: #8792a5;
  font-size: 12px;
  font-weight: 800;
}

.nav-link {
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: #cfd6e4;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-link:hover,
.nav-link.active {
  background: var(--sidebar-soft);
  color: #ffffff;
}

.nav-link:hover {
  transform: translateX(2px);
}

.nav-link.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.main-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(217, 226, 236, 0.88);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
}

.topbar h1,
.section-heading h2,
.detail-header h2,
.intro-band h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 24px;
  color: #0b1728;
}

.breadcrumb,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions,
.inline-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.command-trigger {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 250px;
  padding: 8px 10px 8px 12px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 31, 56, 0.05);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.command-trigger:hover {
  border-color: rgba(32, 87, 216, 0.35);
  color: var(--text);
  box-shadow: 0 12px 26px rgba(15, 31, 56, 0.08);
}

.command-trigger kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
}

.command-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: start center;
  padding: 90px 18px 18px;
  background: rgba(15, 23, 42, 0.36);
}

.cost-overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.command-overlay[hidden] {
  display: none;
}

.cost-overlay[hidden] {
  display: none;
}

.command-panel {
  display: grid;
  width: min(680px, 100%);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.cost-panel {
  display: grid;
  width: min(480px, 100%);
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

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

.cost-panel p {
  color: var(--muted);
  line-height: 1.7;
  white-space: pre-line;
}

.cost-badge {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(31, 94, 255, 0.1);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.cost-meta {
  display: grid;
  gap: 8px;
  margin: 0;
}

.cost-meta div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.cost-meta dt,
.cost-meta dd {
  margin: 0;
}

.cost-meta dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.cost-meta dd {
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.command-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.command-input-row input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.command-list {
  display: grid;
  max-height: 420px;
  overflow: auto;
}

.command-list a {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: 8px;
}

.command-list a:hover {
  background: var(--panel-soft);
}

.command-list span {
  color: var(--muted);
  font-size: 13px;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.inline-actions.compact {
  justify-content: flex-start;
  gap: 12px;
}

.user-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  border-color: rgba(32, 87, 216, 0.2);
  background: rgba(32, 87, 216, 0.08);
  color: var(--primary-dark);
}

.status-pill.large {
  min-height: 38px;
  padding-inline: 14px;
}

.model-test-ok {
  border-color: rgba(24, 138, 83, 0.28);
  background: rgba(24, 138, 83, 0.1);
  color: var(--success);
}

.model-test-error {
  border-color: rgba(201, 53, 53, 0.28);
  background: rgba(201, 53, 53, 0.1);
  color: var(--danger);
}

.model-test-idle {
  border-color: rgba(102, 112, 133, 0.22);
  background: rgba(102, 112, 133, 0.08);
  color: var(--muted);
}

.queue-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.queue-card {
  display: grid;
  min-height: 92px;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.queue-card:hover,
.queue-card.active {
  border-color: rgba(31, 94, 255, 0.32);
  background: rgba(31, 94, 255, 0.08);
}

.queue-card span,
.context-assistant span {
  color: var(--muted);
  font-size: 13px;
}

.queue-card strong {
  font-size: 24px;
  line-height: 1;
}

.queue-card small {
  color: var(--muted);
}

.content {
  display: grid;
  gap: 20px;
  padding: 26px 30px 44px;
  animation: page-enter 0.22s ease-out both;
}

.flash-stack {
  display: grid;
  gap: 8px;
}

.flash-message {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.flash-message.success {
  border-color: rgba(24, 138, 83, 0.28);
  background: rgba(24, 138, 83, 0.08);
  color: var(--success);
}

.flash-message.error {
  border-color: rgba(201, 53, 53, 0.28);
  background: rgba(201, 53, 53, 0.08);
  color: var(--danger);
}

.intro-band,
.detail-header,
.section-block,
.metric-card,
.module-card {
  border: 1px solid rgba(217, 226, 236, 0.92);
  border-radius: 8px;
  background: var(--panel);
}

.intro-band,
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px;
  box-shadow: var(--shadow);
}

.dashboard-hero {
  align-items: center;
  border-color: rgba(201, 147, 43, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 249, 252, 0.98) 66%, rgba(237, 249, 247, 0.95) 100%);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.intro-band h2,
.detail-header h2 {
  font-size: 28px;
  line-height: 1.25;
}

.intro-band p:last-child,
.detail-header p:last-child {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--muted);
}

.section-block {
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 31, 56, 0.055);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 19px;
}

.metric-grid,
.module-grid,
.quick-grid,
.split-grid,
.dashboard-grid,
.detail-grid,
.three-column-workbench,
.form-columns {
  display: grid;
  gap: 14px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  align-items: stretch;
}

.todo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.todo-card,
.status-dashboard a {
  display: grid;
  gap: 8px;
  padding: 15px;
  border: 1px solid rgba(217, 226, 236, 0.92);
  border-radius: 8px;
  background: var(--panel-soft);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.todo-card:hover,
.status-dashboard a:hover {
  border-color: rgba(32, 87, 216, 0.36);
  box-shadow: 0 12px 28px rgba(15, 31, 56, 0.08);
  transform: translateY(-1px);
}

.todo-card span,
.status-dashboard span {
  color: var(--muted);
  font-size: 13px;
}

.todo-card strong {
  font-size: 28px;
}

.todo-card p {
  margin: 0;
  color: var(--muted);
}

.status-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.status-dashboard strong {
  font-size: 22px;
}

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

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 17px;
  box-shadow: var(--shadow);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--teal), var(--accent));
}

.metric-card span,
.metric-card small,
.module-card p,
.compact-list span,
.muted {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 6px 0;
  color: #0b1728;
  font-size: 29px;
}

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

.mode-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.mode-grid article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.mode-grid span {
  color: var(--muted);
  font-size: 13px;
}

.model-setup-panel {
  border-color: rgba(31, 94, 255, 0.2);
}

.model-setup-grid,
.model-command-grid,
.preset-grid {
  display: grid;
  gap: 12px;
}

.model-setup-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

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

.model-setup-grid article,
.model-command-grid article,
.preset-grid article {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.model-setup-grid span,
.model-command-grid span,
.preset-grid span,
.preset-grid small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.model-command-grid code,
.model-table code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef2ff;
  color: var(--primary-dark);
}

.model-table {
  min-width: 1320px;
}

.model-table small {
  display: block;
  max-width: 260px;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.model-url {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.model-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.model-row-actions form,
.detail-header .inline-actions form {
  margin: 0;
}

.module-card {
  display: flex;
  position: relative;
  overflow: hidden;
  min-height: 156px;
  flex-direction: column;
  justify-content: space-between;
  padding: 19px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.module-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.module-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-strong);
  transform: translateY(-1px);
}

.module-card:hover::before {
  opacity: 1;
}

.module-card.featured {
  border-color: rgba(201, 147, 43, 0.42);
  background: linear-gradient(180deg, #fffdf7 0%, #ffffff 100%);
}

.module-card span {
  font-size: 18px;
  font-weight: 800;
  color: #0b1728;
}

.module-card p {
  margin: 12px 0 0;
}

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

.split-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.detail-grid {
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
}

.three-column-workbench {
  grid-template-columns: 260px minmax(0, 0.9fr) minmax(420px, 1fr);
  align-items: start;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-list a,
.compact-list article {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.tool-button,
.ghost-button,
.primary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  white-space: normal;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--primary) 0%, #173ea5 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(32, 87, 216, 0.24);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(32, 87, 216, 0.3);
}

.primary-button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 14px;
}

.ghost-button,
.tool-button {
  border-color: rgba(217, 226, 236, 0.95);
  background: #ffffff;
  color: var(--text);
}

.tool-button:hover,
.ghost-button:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(15, 31, 56, 0.08);
  transform: translateY(-1px);
}

.danger-link {
  color: var(--danger);
  font-size: 14px;
}

.text-link {
  color: var(--primary-dark);
  font-weight: 700;
}

.status-strip,
.tab-row,
.ai-button-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-strip span,
.tab-row span,
.tab-row button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}

.status-strip a {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}

.status-strip a.active {
  border-color: rgba(31, 94, 255, 0.32);
  background: rgba(31, 94, 255, 0.1);
  color: var(--primary-dark);
  font-weight: 800;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 220px auto;
  gap: 12px;
  align-items: end;
  margin: 14px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tab-row button {
  cursor: pointer;
}

.tab-row button.active {
  border-color: rgba(31, 94, 255, 0.32);
  background: rgba(31, 94, 255, 0.1);
  color: var(--primary-dark);
  font-weight: 800;
}

.tab-panel {
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-soft);
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.form-grid,
.form-columns {
  display: grid;
  gap: 14px;
}

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

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

label {
  display: grid;
  gap: 6px;
}

label span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(32, 87, 216, 0.55);
  box-shadow: 0 0 0 3px rgba(32, 87, 216, 0.12);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.project-form {
  display: grid;
  gap: 18px;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.check-card {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.check-card input {
  width: auto;
  min-height: 0;
}

.status-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-form select {
  width: 170px;
}

.quote-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.quote-list {
  margin-bottom: 14px;
}

.quote-editor {
  display: grid;
  gap: 18px;
}

.quote-total {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 800;
}

.quote-table {
  min-width: 1180px;
}

.quote-table input {
  min-width: 96px;
  min-height: 34px;
  padding: 6px 8px;
}

.quote-table td:nth-child(4) input,
.quote-table td:nth-child(10) input {
  min-width: 180px;
}

.quote-builder-toolbar,
.quote-builder-total {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
}

.quote-builder-table {
  min-width: 1280px;
}

.quote-builder-table input {
  width: 100%;
  min-width: 100px;
}

.quote-builder-table .quote-item-name,
.quote-builder-table .quote-item-process,
.quote-builder-table .quote-item-size,
.quote-builder-table .quote-item-remark {
  min-width: 170px;
}

.quote-builder-total {
  justify-content: flex-end;
  font-size: 18px;
}

.quote-builder-total strong {
  color: var(--primary-dark);
  font-size: 22px;
}

.ghost-button.tiny {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.creative-stack {
  display: grid;
  gap: 18px;
}

.creative-panel {
  display: grid;
  gap: 16px;
}

.creative-control-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, var(--panel-soft) 100%);
}

.creative-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: stretch;
}

.creative-body-wide {
  grid-template-columns: 1fr;
}

.creative-input-main textarea {
  min-height: 248px;
  font-size: 15px;
  line-height: 1.7;
}

.creative-side {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 226, 236, 0.95);
  border-radius: 8px;
  background: var(--panel-soft);
}

.assist-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.assist-panel summary {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.assist-panel summary::-webkit-details-marker {
  display: none;
}

.assist-panel summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--primary);
  background: var(--panel);
}

.assist-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.assist-panel[open] summary::after {
  content: "-";
}

.assist-panel summary small {
  margin-right: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.assist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.assist-grid-full {
  grid-column: 1 / -1;
}

.simple-upload-field {
  margin-top: 12px;
}

.generate-action-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(32, 87, 216, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.98) 100%);
  box-shadow: 0 -12px 30px rgba(15, 31, 56, 0.09);
}

.generate-action-bar span,
.generate-action-bar .generation-note {
  min-width: 0;
  max-width: 72%;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.generate-button {
  min-width: 220px;
  min-height: 52px;
  padding-inline: 22px;
  font-size: 17px;
}

.image-result-shell {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.image-result-shell[hidden] {
  display: none;
}

.image-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.image-result-head h2 {
  margin: 0;
  font-size: 20px;
}

.image-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.image-result-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-result-preview {
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

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

.image-result-preview video {
  display: block;
  width: 100%;
  height: 100%;
  background: #0f172a;
  object-fit: contain;
}

.image-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.image-result-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.file-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.file-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.file-type {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(31, 94, 255, 0.08);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.file-card small {
  color: var(--muted);
}

.file-preview {
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.info-grid div,
.note-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.info-grid dt {
  color: var(--muted);
  font-size: 13px;
}

.info-grid dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.project-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.project-overview-grid article {
  display: grid;
  min-height: 168px;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.project-overview-grid article > span,
.flow-mini strong {
  color: var(--primary-dark);
  font-weight: 800;
}

.project-overview-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.project-overview-grid .text-link {
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.project-notes-card {
  grid-column: span 2;
}

.project-notes-card form {
  display: grid;
  gap: 10px;
}

.project-notes-card textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
}

.flow-mini {
  display: grid;
  min-width: 138px;
  gap: 2px;
}

.flow-mini span {
  color: var(--muted);
  font-size: 13px;
}

.note-box p {
  margin: 8px 0 0;
  color: var(--muted);
}

.customer-profile-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.customer-profile-form textarea {
  min-height: 150px;
  resize: vertical;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.workflow-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workflow-steps article {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.workflow-steps article.done {
  border-color: rgba(24, 138, 83, 0.25);
  background: rgba(24, 138, 83, 0.08);
}

.workflow-steps article.current {
  border-color: rgba(31, 94, 255, 0.32);
  background: rgba(31, 94, 255, 0.09);
}

.workflow-steps article.pending {
  opacity: 0.72;
}

.workflow-steps strong,
.workflow-steps span {
  display: block;
}

.workflow-steps span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.workflow-list li {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.workflow-click-list {
  display: grid;
  gap: 10px;
}

.workflow-click-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px 10px;
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.context-assistant {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(31, 94, 255, 0.18);
  border-radius: 8px;
  background: rgba(31, 94, 255, 0.06);
}

.context-assistant strong {
  color: var(--primary-dark);
}

.context-assistant p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.missing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.missing-chips small {
  padding: 4px 8px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
}

.tool-button.recommended {
  border-color: rgba(31, 94, 255, 0.4);
  background: rgba(31, 94, 255, 0.09);
  color: var(--primary-dark);
  font-weight: 800;
}

.workflow-click-card:hover,
.workflow-click-card.active {
  border-color: rgba(31, 94, 255, 0.32);
  background: rgba(31, 94, 255, 0.08);
}

.workflow-click-card.active {
  box-shadow: inset 4px 0 0 var(--primary);
}

.workflow-click-card span {
  grid-row: span 2;
  color: var(--primary-dark);
  font-weight: 800;
}

.workflow-click-card strong,
.workflow-click-card small {
  min-width: 0;
}

.workflow-click-card small {
  color: var(--muted);
  line-height: 1.5;
}

.workflow-assistant-form {
  display: grid;
  gap: 12px;
}

.workflow-assistant-shell {
  position: sticky;
  top: 96px;
  display: grid;
  max-height: calc(100vh - 116px);
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  border-color: rgba(31, 94, 255, 0.24);
  box-shadow: 0 18px 44px rgba(31, 94, 255, 0.12);
}

.assistant-status-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(31, 94, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(31, 94, 255, 0.08), rgba(24, 138, 83, 0.08));
}

.assistant-status-card span {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.assistant-status-card strong {
  font-size: 15px;
}

.assistant-status-card small {
  color: var(--muted);
  line-height: 1.5;
}

.workflow-panel[hidden] {
  display: none;
}

.workflow-panel.is-active {
  position: relative;
}

.workflow-panel.panel-pop {
  animation: assistantPanelPop 180ms ease-out;
}

.assistant-guide {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(31, 94, 255, 0.16);
  border-radius: 8px;
  background: rgba(31, 94, 255, 0.06);
  color: var(--muted);
  line-height: 1.7;
}

.workflow-checklist {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.workflow-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.workflow-checklist input {
  width: auto;
}

.editable-result {
  width: 100%;
  min-height: 320px;
  white-space: pre-wrap;
  resize: vertical;
}

@keyframes assistantPanelPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-box {
  min-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f172a;
  color: #e6edf7;
  white-space: pre-wrap;
}

.mini-result {
  overflow: auto;
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  white-space: pre-wrap;
}

.record-card {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.design-record-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.design-record-card.is-final {
  border-color: rgba(24, 138, 83, 0.36);
  box-shadow: inset 4px 0 0 var(--success);
}

.record-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-card header span {
  color: var(--muted);
  font-size: 13px;
}

.final-badge {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(24, 138, 83, 0.12);
  color: var(--success);
  font-size: 12px;
  font-style: normal;
}

.project-image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.project-image-item {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.project-image-item > a {
  display: block;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

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

.project-image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.record-more {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.record-more summary {
  cursor: pointer;
  color: var(--primary-dark);
  font-weight: 800;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(215, 225, 236, 0.44) 1px, transparent 1px),
    linear-gradient(90deg, rgba(215, 225, 236, 0.44) 1px, transparent 1px),
    linear-gradient(135deg, #f8fafc 0%, #eef4f8 58%, #f7f2e8 100%);
  background-size: 40px 40px, 40px 40px, auto;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(500px, 100%);
  padding: 34px;
  border: 1px solid rgba(217, 226, 236, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-strong);
  animation: page-enter 0.24s ease-out both;
}

.register-panel {
  width: min(720px, 100%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(217, 226, 236, 0.86);
}

.login-eyebrow {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.login-panel h1 {
  margin: 2px 0 0;
  font-size: 30px;
  line-height: 1.25;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.75;
}

.login-hint {
  padding: 10px 12px;
  border: 1px solid rgba(201, 147, 43, 0.28);
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 13px;
}

.auth-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid rgba(201, 53, 53, 0.28);
  border-radius: 8px;
  background: rgba(201, 53, 53, 0.08);
  color: var(--danger);
}

@media (max-width: 1180px) {
  .metric-grid,
  .module-grid,
  .mode-grid,
  .model-setup-grid,
  .model-command-grid,
  .preset-grid,
  .project-overview-grid,
  .queue-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-grid,
  .dashboard-grid,
  .detail-grid,
  .creative-body,
  .assist-grid,
  .three-column-workbench,
  .upload-panel,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .workflow-assistant-shell {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 6;
    height: auto;
    max-height: 44vh;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  }

  .brand {
    gap: 10px;
    padding: 6px 6px 10px;
  }

  .brand-copy small {
    display: none;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 2px 2px;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-section-label {
    display: none;
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 38px;
    padding-inline: 12px;
    white-space: nowrap;
  }

  .nav-link.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }

  .topbar {
    position: sticky;
    top: 76px;
    z-index: 5;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    min-height: auto;
    padding: 14px 16px;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.25;
  }

  .topbar-actions,
  .command-trigger {
    width: 100%;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .topbar-actions .ghost-button,
  .topbar-actions .danger-link,
  .user-pill {
    min-height: 40px;
  }

  .command-trigger {
    min-width: 0;
  }

  .command-input-row {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 14px;
    padding-bottom: 96px;
  }

  .section-block {
    padding: 14px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-actions {
    justify-content: flex-start;
  }

  .inline-actions .ghost-button,
  .inline-actions .primary-button {
    flex: 1 1 120px;
    min-height: 42px;
  }

  .metric-grid,
  .module-grid,
  .mode-grid,
  .model-setup-grid,
  .model-command-grid,
  .preset-grid,
  .quick-grid,
  .todo-grid,
  .status-dashboard,
  .workflow-steps,
  .project-overview-grid,
  .queue-strip,
  .creative-control-strip,
  .assist-grid,
  .form-columns,
  .info-grid {
    grid-template-columns: 1fr;
  }

  .creative-input-main textarea {
    min-height: 190px;
  }

  .generate-action-bar {
    position: sticky;
    bottom: 10px;
    z-index: 7;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .generate-action-bar span,
  .generate-action-bar .generation-note {
    max-width: 100%;
    font-size: 13px;
  }

  .generate-button {
    width: 100%;
    min-height: 56px;
    font-size: 18px;
  }

  .image-result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-result-grid {
    grid-template-columns: 1fr;
  }

  .image-result-card {
    padding: 12px;
  }

  .image-result-actions .ghost-button,
  .image-result-actions .primary-button {
    flex: 1 1 calc(50% - 8px);
    min-height: 42px;
  }

  .result-box,
  .editable-result {
    min-height: 200px;
    max-height: 54vh;
    font-size: 14px;
  }

  .assist-panel summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .assist-panel summary::after {
    position: absolute;
    right: 14px;
  }

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

  .project-notes-card {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
