:root {
  --bg-top: #eef4ff;
  --bg-bottom: #e3ebf8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-alt: rgba(244, 247, 252, 0.92);
  --ink: #12233d;
  --muted: #60708c;
  --line: rgba(90, 114, 153, 0.14);
  --line-strong: rgba(30, 64, 175, 0.26);
  --brand: #1e40af;
  --brand-strong: #15328a;
  --brand-soft: rgba(59, 130, 246, 0.12);
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --success: #0f9f6e;
  --success-soft: rgba(15, 159, 110, 0.14);
  --danger: #d1435b;
  --danger-soft: rgba(209, 67, 91, 0.14);
  --terminal: #0b1220;
  --terminal-line: rgba(255, 255, 255, 0.06);
  --shadow: 0 24px 60px rgba(26, 50, 94, 0.12);
  --shadow-soft: 0 12px 30px rgba(22, 44, 84, 0.08);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --workspace-offset: 132px;
  --sans: "Fira Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display: "Fira Sans", "Noto Sans SC", "PingFang SC", sans-serif;
  --mono: "Fira Code", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 10%, rgba(59, 130, 246, 0.16), transparent 0 22%),
    radial-gradient(circle at 92% 14%, rgba(30, 64, 175, 0.14), transparent 0 20%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--ink);
  font-family: var(--sans);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(18, 35, 61, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 35, 61, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 62%, transparent 100%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
pre {
  margin: 0;
}

code,
pre {
  font-family: var(--mono);
}

.app-shell {
  width: min(1720px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 14px 0 20px;
}

.workspace-shell {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.workspace-shell[hidden],
.login-shell[hidden] {
  display: none;
}

.login-shell {
  min-height: calc(100vh - 26px);
  display: grid;
  place-items: center;
}

.login-card,
.topbar,
.panel,
.message-card,
.node-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card::after,
.topbar::after,
.panel::after,
.message-card::after,
.node-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), transparent 24%, transparent 72%, rgba(59, 130, 246, 0.14));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.login-card {
  width: min(100%, 620px);
  padding: 42px;
  border-radius: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 255, 0.96));
}

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

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

.brand-logo {
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: 20px;
  box-shadow: 0 18px 36px rgba(30, 64, 175, 0.16);
}

.brand-lockup-topbar {
  flex: 1;
  min-width: 0;
}

.brand-logo-topbar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  box-shadow: 0 14px 28px rgba(30, 64, 175, 0.16);
}

.login-form,
.node-config-form,
.create-node-form,
.quota-body {
  display: grid;
  gap: 16px;
}

.login-form {
  margin-top: 28px;
}

.auth-switcher {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.switch-chip {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.switch-chip.is-active {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #f7fbf8;
  box-shadow: 0 10px 24px rgba(11, 93, 69, 0.18);
}

.login-field {
  display: grid;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.login-field input,
.login-field select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.login-field input {
  min-height: 52px;
  padding: 0 16px;
}

.login-field select {
  min-height: 52px;
  padding: 0 16px;
}

.login-field input:focus,
.login-field select:focus,
textarea:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(11, 93, 69, 0.12);
}

.login-actions {
  display: grid;
  gap: 10px;
}

.login-error {
  color: var(--danger);
  font-size: 14px;
  line-height: 1.7;
}

.eyebrow,
.panel-kicker,
.hint,
.node-mode,
.bundle-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
h3,
.metric-chip strong,
.bundle-block strong {
  font-family: var(--display);
  letter-spacing: -0.04em;
}

h1 {
  margin-top: 4px;
  font-size: clamp(34px, 3vw, 48px);
  line-height: 1.12;
  padding-bottom: 0.08em;
  background: linear-gradient(135deg, #081813 0%, var(--brand) 54%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.topbar-copy {
  max-width: 54ch;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.93)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 246, 255, 0.88));
}

.dashboard-topbar {
  align-items: center;
  padding: 18px 22px;
  border-color: rgba(59, 130, 246, 0.16);
}

.topbar-primary,
.topbar-secondary {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-primary {
  min-width: 0;
  flex: 1;
}

.topbar-secondary {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions-compact .ghost-button {
  min-width: 104px;
}

.topbar-copy-block {
  flex: 1;
  min-width: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.maintenance-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.maintenance-control[hidden] {
  display: none;
}

.maintenance-state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(15, 159, 110, 0.2);
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.maintenance-state-badge.is-enabled {
  border-color: rgba(182, 67, 77, 0.2);
  background: var(--danger-soft);
  color: var(--danger);
}

.maintenance-state-badge.is-error {
  border-color: rgba(182, 67, 77, 0.2);
  background: var(--danger-soft);
  color: var(--danger);
}

.update-notice-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.update-notice-modal[hidden] {
  display: none;
}

.update-notice-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.62);
  backdrop-filter: blur(4px);
  animation: update-notice-fade 180ms ease-out;
}

.update-notice-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 28px;
  border: 1px solid rgba(90, 114, 153, 0.24);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(11, 18, 32, 0.28);
  animation: update-notice-enter 200ms ease-out;
}

.update-notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.update-notice-close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.update-notice-close:hover {
  border-color: var(--line-strong);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.update-notice-panel h2 {
  margin-top: 14px;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: 0;
}

.update-notice-description {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.update-notice-points {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 16px 16px 16px 36px;
  border-left: 3px solid var(--success);
  background: rgba(15, 159, 110, 0.07);
  color: var(--ink);
  line-height: 1.55;
}

.update-notice-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.update-notice-actions .primary-button {
  min-width: 132px;
}

body.has-update-notice,
body.has-reference-image-viewer {
  overflow: hidden;
}

.update-notice-close:focus-visible,
.update-notice-modal .primary-button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.34);
  outline-offset: 3px;
}

.reference-image-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.reference-image-viewer-modal[hidden] {
  display: none;
}

.reference-image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 32, 0.78);
  backdrop-filter: blur(4px);
}

.reference-image-viewer-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1200px, 100%);
  height: min(90dvh, 900px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(11, 18, 32, 0.42);
  animation: update-notice-enter 180ms ease-out;
}

.reference-image-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 8px 10px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.reference-image-viewer-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-image-viewer-close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

.reference-image-viewer-close:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.reference-image-viewer-close:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.34);
  outline-offset: 2px;
}

.reference-image-viewer-stage {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 16px;
  background: #111827;
}

.reference-image-viewer-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

@keyframes update-notice-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes update-notice-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pill-badge,
.status-badge,
.node-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
}

.pill-badge {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 247, 252, 0.92));
  border-color: rgba(30, 64, 175, 0.12);
  color: var(--brand-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.layout {
  display: grid;
  gap: 18px;
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  align-items: start;
}

.dashboard-layout {
  grid-template-columns: minmax(272px, 320px) minmax(0, 1fr);
}

.workspace-shell.sidebar-collapsed .dashboard-layout {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-shell.sidebar-collapsed .left-rail {
  display: none;
}

.left-rail {
  min-height: 0;
  min-width: 0;
}

.left-rail-body {
  min-width: 0;
}

.workspace-main {
  display: grid;
  grid-template-rows: minmax(560px, auto) minmax(420px, auto);
  gap: 16px;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 247, 252, 0.92));
}

.panel-header,
.chat-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand-strong);
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--brand-soft);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.icon-button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.3);
  outline-offset: 2px;
}

.chat-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  font-size: 21px;
  line-height: 1.2;
}

.left-rail .panel-header {
  padding-inline: 14px;
}

.left-rail .panel-header-actions {
  gap: 6px;
}

.left-rail .status-badge {
  min-height: 38px;
  padding-inline: 10px;
}

.compact-header {
  padding-top: 16px;
  padding-bottom: 14px;
}

.section-title {
  display: grid;
  gap: 4px;
}

.server-panel,
.command-panel,
.detail-dock {
  min-height: 0;
}

.command-panel {
  min-height: 620px;
  border-color: rgba(59, 130, 246, 0.16);
}

.command-panel::before,
.server-panel::before,
.detail-dock::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #1e40af, #3b82f6, #8ab4ff);
  pointer-events: none;
  opacity: 0.82;
}

.node-list {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 220px;
  max-height: min(44vh, 520px);
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 16px 16px 18px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.conversation-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0 0 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
}

.conversation-header h3 {
  font-size: 21px;
  line-height: 1.2;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(30, 64, 175, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
}

.conversation-list {
  display: grid;
  min-width: 0;
  gap: 8px;
  max-height: min(36vh, 440px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 16px;
  scrollbar-gutter: stable;
}

.conversation-card {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(90, 114, 153, 0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 247, 252, 0.86));
  color: var(--ink);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

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

.conversation-card.is-selected {
  border-color: rgba(59, 130, 246, 0.34);
  box-shadow: 0 16px 28px rgba(30, 64, 175, 0.12);
  background: linear-gradient(180deg, rgba(250, 252, 255, 1), rgba(238, 245, 255, 0.96));
}

.conversation-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-preview {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.user-summary-card {
  display: grid;
  gap: 10px;
  margin: 16px 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 252, 0.9));
}

.user-summary-card h3 {
  font-size: 18px;
}

.user-summary-meta {
  color: var(--muted);
  line-height: 1.7;
}

.node-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 247, 252, 0.92));
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

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

.node-card.is-selected {
  border-color: rgba(59, 130, 246, 0.34);
  box-shadow: 0 24px 42px rgba(30, 64, 175, 0.14);
  background: linear-gradient(180deg, rgba(250, 252, 255, 1), rgba(239, 245, 255, 0.96));
}

.node-card-head,
.node-card-meta,
.message-meta,
.quota-card-head,
.detail-header-actions,
.file-upload-bar,
.file-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.node-card-head {
  align-items: start;
  min-width: 0;
}

.node-card-head > div {
  flex: 1 1 auto;
  min-width: 0;
}

.node-card .node-status {
  flex: 0 0 auto;
}

.node-card h3 {
  margin-top: 8px;
  max-width: 100%;
  overflow: hidden;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-description {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.node-card-meta {
  margin-top: 14px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
}

.node-card-meta span {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-card-meta span:first-child {
  flex: 1 1 100%;
}

.node-status.online,
.status-badge.done {
  background: var(--success-soft);
  border-color: rgba(15, 159, 110, 0.18);
  color: var(--success);
}

.node-status.busy,
.status-badge.busy {
  background: var(--accent-soft);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--accent);
}

.node-status.offline,
.status-badge.idle {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(59, 130, 246, 0.12);
  color: var(--brand-strong);
}

.node-status.disabled,
.status-badge.error {
  background: var(--danger-soft);
  border-color: rgba(182, 67, 77, 0.18);
  color: var(--danger);
}

.create-node-form,
.node-config-form {
  display: grid;
  gap: 16px;
}

.admin-only-block[hidden],
.node-config-form[hidden],
.user-model-config[hidden],
.node-description-editor[hidden],
.read-only-card[hidden],
.bundle-card[hidden] {
  display: none;
}

.create-node-box,
.config-box {
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(242, 246, 252, 0.92));
}

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

.model-config-box {
  display: grid;
  gap: 16px;
  padding: 18px 20px 20px;
  border: 1px solid rgba(30, 64, 175, 0.16);
  border-radius: 8px;
  background: rgba(248, 251, 255, 0.96);
}

.model-config-title,
.model-config-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.model-config-title h3 {
  margin-top: 5px;
  font-size: 20px;
  line-height: 1.3;
}

.field-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.model-sync-badge {
  flex: 0 0 auto;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(32, 142, 104, 0.2);
  border-radius: 999px;
  background: rgba(32, 142, 104, 0.1);
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
}

.model-sync-badge.pending {
  border-color: rgba(184, 117, 19, 0.22);
  background: rgba(245, 181, 68, 0.12);
  color: #8a5a0a;
}

.model-config-footer .form-state {
  min-width: 0;
}

.model-config-footer .primary-button {
  flex: 0 0 auto;
  min-width: 118px;
}

.hero-panel {
  display: grid;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.92), rgba(239, 244, 252, 0.86));
}

.hero-summary,
.hero-meta,
.message-node,
.empty-chat,
.empty-state,
.empty-state-block p,
.form-state,
.quota-state,
.redeem-state,
.bundle-block span,
.metric-chip p,
.metric-chip span {
  color: var(--muted);
}

.hero-summary,
.quota-state,
.redeem-state,
.form-state {
  line-height: 1.7;
}

.hero-meta {
  margin-top: 8px;
  font-size: 13px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.hero-card,
.metric-chip,
.quota-card,
.bundle-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(242, 246, 252, 0.92));
  box-shadow: var(--shadow-soft);
}

.hero-card,
.metric-chip {
  padding: 16px;
}

.hero-card {
  min-height: 120px;
  position: relative;
  overflow: hidden;
}

.hero-card::after,
.metric-chip::after {
  content: "";
  position: absolute;
  inset: auto 14px 12px auto;
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: radial-gradient(circle at 35% 35%, rgba(59, 130, 246, 0.22), rgba(30, 64, 175, 0.04));
  pointer-events: none;
}

.hero-card strong,
.metric-chip strong,
.bundle-block strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  line-height: 1.28;
  color: var(--ink);
}

.hero-card strong {
  padding-top: 2px;
  font-family: var(--sans);
  letter-spacing: 0;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.chat-form {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(242, 246, 252, 0.84));
}

.chat-form.is-busy {
  background: linear-gradient(180deg, rgba(244, 249, 246, 0.9), rgba(233, 243, 237, 0.86));
}

.job-failure-notice {
  margin: 16px 20px 0;
  padding: 14px 16px;
  border: 1px solid rgba(182, 67, 77, 0.2);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 245, 246, 0.95), rgba(255, 250, 250, 0.92));
  color: var(--danger);
  line-height: 1.7;
  white-space: pre-wrap;
  box-shadow: var(--shadow-soft);
}

.job-failure-notice.waiting {
  border-color: rgba(59, 130, 246, 0.2);
  background: linear-gradient(180deg, rgba(239, 247, 255, 0.96), rgba(248, 251, 255, 0.94));
  color: var(--accent);
}

#messageInput {
  min-height: 112px;
  max-height: min(68vh, 720px);
}

textarea {
  resize: vertical;
  padding: 16px 18px;
  line-height: 1.75;
}

.composer-meta {
  display: grid;
  gap: 6px;
}

.reference-image-panel {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(30, 64, 175, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
}

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

.reference-image-head,
.reference-image-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reference-image-head {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reference-image-state.loading {
  color: var(--accent);
}

.reference-image-state.success {
  color: var(--success);
}

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

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

.reference-image-item {
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(248, 250, 255, 0.86);
}

.reference-image-item img {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(90, 114, 153, 0.16);
}

.reference-image-info {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.reference-image-info strong,
.reference-image-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-image-info strong {
  color: var(--ink);
  font-size: 13px;
}

.reference-image-info span {
  color: var(--muted);
  font-size: 12px;
}

.reference-image-item.error {
  border-color: rgba(209, 67, 91, 0.22);
  background: rgba(255, 247, 248, 0.92);
}

.reference-image-remove {
  min-height: 36px;
  padding: 0 12px;
}

.composer-state {
  font-size: 13px;
  line-height: 1.6;
}

.composer-state.idle,
.quota-state.idle,
.quota-state.loading,
.redeem-state.idle,
.redeem-state.loading,
.form-state.idle,
.form-state.loading {
  color: var(--brand);
}

.composer-state.busy {
  color: var(--accent);
}

.composer-state.done,
.quota-state.success,
.redeem-state.success,
.form-state.success {
  color: var(--success);
}

.composer-state.error,
.quota-state.error,
.redeem-state.error,
.form-state.error {
  color: var(--danger);
}

.quota-state.warning,
.form-state.warning {
  color: #9a6700;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #ffffff;
  box-shadow: 0 14px 28px rgba(30, 64, 175, 0.2);
}

.ghost-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 247, 252, 0.9));
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  color: var(--danger);
  border-color: rgba(209, 67, 91, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 241, 244, 0.92));
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.56;
}

.chat-messages {
  overflow: auto;
}

.chat-messages {
  min-height: 420px;
  max-height: min(75vh, 1080px);
  flex: 1;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  padding: 14px 16px 16px;
}

.requirement-toolbar {
  display: grid;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 255, 0.78);
}

.requirement-search-field,
.requirement-filter-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.requirement-search-field > span,
.requirement-filter-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.requirement-search-field input,
.requirement-filter-field select {
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 10px;
  font-size: 13px;
}

.requirement-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}

.requirement-clear-button {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.requirement-latest-button {
  min-height: 38px;
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  font-size: 20px;
}

.requirement-filter-summary {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.message-item {
  border: 1px solid rgba(90, 114, 153, 0.12);
  min-height: 64px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.94));
  box-shadow: 0 8px 18px rgba(22, 44, 84, 0.06);
  overflow: hidden;
}

.message-item.user {
  border-color: rgba(59, 130, 246, 0.18);
  background: linear-gradient(180deg, rgba(242, 247, 255, 0.98), rgba(235, 243, 255, 0.96));
}

.message-item.assistant {
  border-color: rgba(90, 114, 153, 0.12);
}

.message-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  min-height: 64px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

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

.message-time,
.message-preview {
  font-size: 13px;
}

.message-preview {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.message-time {
  color: var(--muted);
  white-space: nowrap;
  align-self: start;
  padding-top: 2px;
}

.message-item[open] .message-time {
  justify-self: end;
}

.message-item[open] .message-preview {
  overflow: auto;
  display: block;
  max-height: min(68vh, 860px);
  white-space: pre-wrap;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.message-item[open] .message-preview::selection {
  background: rgba(59, 130, 246, 0.24);
}

.message-turn {
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 249, 253, 0.96));
}

.message-turn.status-processing {
  border-color: rgba(59, 130, 246, 0.28);
}

.message-turn.status-failed {
  border-color: rgba(182, 67, 77, 0.26);
}

.turn-summary {
  min-height: 68px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.turn-summary-main,
.turn-summary-meta,
.turn-role-line,
.turn-solution-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.turn-summary-main {
  gap: 10px;
}

.turn-sequence {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.turn-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-summary-reference {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.turn-summary-reference img {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(90, 114, 153, 0.2);
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-alt);
}

.turn-summary-reference span {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  border-radius: 10px;
  background: var(--brand-strong);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.turn-summary-meta {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.turn-category,
.turn-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(90, 114, 153, 0.14);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.turn-category {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.turn-status.status-pending,
.turn-status.status-processing {
  color: #8a5a0a;
  background: rgba(245, 181, 68, 0.13);
  border-color: rgba(184, 117, 19, 0.2);
}

.turn-status.status-completed {
  color: var(--success);
  background: rgba(32, 142, 104, 0.1);
  border-color: rgba(32, 142, 104, 0.18);
}

.turn-status.status-failed {
  color: var(--danger);
  background: rgba(182, 67, 77, 0.08);
  border-color: rgba(182, 67, 77, 0.18);
}

.turn-cost {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(90, 114, 153, 0.14);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(90, 114, 153, 0.08);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.turn-body {
  display: grid;
  gap: 12px;
  padding: 0 14px 16px;
}

.turn-question,
.turn-answer {
  padding: 12px 14px;
  border-left: 3px solid rgba(59, 130, 246, 0.45);
  background: rgba(242, 247, 255, 0.72);
}

.turn-answer {
  border-left-color: rgba(32, 142, 104, 0.48);
  background: rgba(245, 251, 248, 0.82);
}

.turn-role-line {
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.turn-role {
  font-size: 12px;
  font-weight: 850;
}

.question-role {
  color: var(--accent);
}

.answer-role {
  color: var(--success);
}

.turn-content {
  margin-top: 8px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.turn-reference-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 128px));
  gap: 10px;
  margin-top: 12px;
}

.turn-reference-image-button {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(90, 114, 153, 0.2);
  border-radius: 8px;
  background: var(--surface-alt);
  cursor: zoom-in;
}

.turn-reference-image-button:hover {
  border-color: rgba(59, 130, 246, 0.52);
  box-shadow: 0 8px 20px rgba(22, 44, 84, 0.14);
}

.turn-reference-image-button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.34);
  outline-offset: 2px;
}

.turn-reference-image-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 180ms ease;
}

.turn-reference-image-button:hover img {
  transform: scale(1.03);
}

.turn-solution-label {
  justify-content: space-between;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.turn-message-count {
  font-weight: 600;
}

.turn-answer-divider {
  height: 1px;
  margin: 12px 0 0;
  background: rgba(90, 114, 153, 0.12);
}

.turn-empty {
  margin: 0;
  padding: 14px;
  border-left: 3px solid rgba(245, 181, 68, 0.48);
  color: var(--muted);
  background: rgba(255, 250, 237, 0.78);
  line-height: 1.6;
}

div.turn-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.turn-empty-copy {
  min-width: 0;
}

.turn-retry-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  font-size: 12px;
}

.turn-continue-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.08);
  font-size: 12px;
}

.turn-continue-block {
  margin-top: 10px;
  border-left-color: rgba(59, 130, 246, 0.48);
  background: rgba(239, 246, 255, 0.78);
}

.turn-retry-error {
  margin: -4px 0 0;
  padding: 0 14px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.turn-collapse-button {
  justify-self: end;
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.message-history-load-more {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
}

.message-history-load-more .ghost-button {
  min-height: 44px;
  padding: 0 18px;
  font-size: 12px;
}

.message-search-hit {
  padding: 0 2px;
  border-radius: 3px;
  background: rgba(245, 181, 68, 0.42);
  color: inherit;
}

.bundle-card {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
  margin: 0;
}

.read-only-card {
  margin-top: 0;
}

.node-description-editor {
  display: grid;
  gap: 16px;
  padding: 18px 20px 20px;
  border: 1px solid rgba(30, 64, 175, 0.16);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.98), rgba(238, 244, 253, 0.94));
  box-shadow: 0 12px 30px rgba(22, 44, 84, 0.07);
}

.node-description-editor-head,
.node-description-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.node-description-editor-head h3 {
  margin-top: 5px;
  font-size: 20px;
  line-height: 1.3;
}

.node-description-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid rgba(30, 64, 175, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.node-description-editor textarea {
  min-height: 116px;
  padding: 14px 16px;
  resize: vertical;
  line-height: 1.65;
}

.node-description-editor-footer .form-state {
  min-width: 0;
}

.node-description-editor-footer .primary-button {
  flex: 0 0 auto;
  min-width: 118px;
}

.detail-dock {
  overflow: hidden;
  border-color: rgba(59, 130, 246, 0.14);
}

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.94), rgba(239, 244, 252, 0.9));
}

.detail-tab {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(30, 64, 175, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-weight: 800;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

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

.detail-tab.is-active {
  border-color: rgba(30, 64, 175, 0.24);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.14), rgba(30, 64, 175, 0.08));
  color: var(--brand-strong);
  box-shadow: inset 0 -2px 0 rgba(59, 130, 246, 0.42);
}

.detail-panel {
  display: none;
  min-height: 0;
}

.detail-panel.is-active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.detail-panel-scroll {
  flex: 1;
  min-height: 360px;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 14px 16px 16px;
}

.project-versions-body {
  flex: 1;
  min-height: 360px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px 16px 16px;
}

.project-version-save-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.project-version-save-form .login-field {
  gap: 8px;
}

.project-version-save-form input {
  min-height: 48px;
}

.project-versions-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.project-version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.project-version-row.is-auto {
  border-color: rgba(15, 159, 110, 0.24);
  background: rgba(239, 251, 246, 0.84);
}

.project-version-main,
.project-version-actions {
  min-width: 0;
}

.project-version-main {
  display: grid;
  gap: 5px;
}

.project-version-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.project-version-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.file-panel-body {
  flex: 1;
  min-height: 460px;
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(320px, 1fr) auto;
  gap: 10px;
  padding: 14px 16px 16px;
}

.file-toolbar {
  display: grid;
  gap: 14px;
}

.file-path-field {
  gap: 8px;
}

.file-path-input-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.file-upload-bar {
  flex-wrap: wrap;
}

.file-picker {
  display: grid;
  gap: 8px;
  flex: 1;
  min-width: min(280px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.file-picker input {
  min-height: 52px;
  width: 100%;
  padding: 10px 14px;
  border: 1px dashed rgba(11, 93, 69, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
}

.file-panel-state {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.file-selection-bar,
.file-list-head,
.file-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1.5fr) minmax(88px, 0.6fr) minmax(96px, 0.6fr) minmax(170px, 0.9fr) minmax(164px, 0.8fr);
  gap: 10px;
  align-items: center;
}

.file-selection-bar {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.file-select-all,
.file-select-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.file-selection-summary {
  grid-column: 2 / -1;
  color: var(--muted);
  font-size: 13px;
}

.file-list-head {
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.file-panel-state.loading {
  color: var(--brand);
}

.file-panel-state.success {
  color: var(--success);
}

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

.file-list {
  min-height: 320px;
  max-height: 62vh;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
  resize: vertical;
}

.file-row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(243, 247, 252, 0.93));
  box-shadow: var(--shadow-soft);
}

.file-row.is-selected {
  border-color: rgba(59, 130, 246, 0.28);
  background: linear-gradient(180deg, rgba(240, 246, 255, 0.98), rgba(233, 241, 255, 0.94));
}

.file-row-main {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
}

.file-row.is-directory .file-row-main {
  cursor: pointer;
}

.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 56px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.file-name {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-meta {
  color: var(--muted);
  font-size: 13px;
}

.file-action-button {
  min-width: 72px;
  min-height: 38px;
  padding: 0 12px;
}

.file-action-button.danger {
  color: var(--danger);
  border-color: rgba(182, 67, 77, 0.18);
  background: rgba(255, 247, 248, 0.9);
}

.file-discovery-section {
  display: grid;
  min-width: 0;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.file-discovery-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-discovery-heading h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.file-discovery-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.file-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 12px;
}

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

.file-search-form select {
  min-width: 170px;
  min-height: 48px;
  max-width: 100%;
}

.file-search-progress {
  display: grid;
  min-width: 0;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.file-search-progress[hidden],
.file-search-skipped[hidden] {
  display: none;
}

.file-search-progress progress {
  width: 100%;
  height: 8px;
  accent-color: var(--brand);
}

.file-search-progress p {
  margin: 0;
  overflow-wrap: anywhere;
}

.file-search-skipped {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.file-search-skipped summary {
  cursor: pointer;
}

.file-search-skipped ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.file-discovery-list {
  display: grid;
  min-width: 0;
  max-height: 50vh;
  gap: 8px;
  overflow: auto;
}

.file-discovery-list:empty {
  display: none;
}

.file-discovery-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(155px, auto) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(243, 247, 252, 0.93));
  box-shadow: var(--shadow-soft);
}

.file-discovery-main,
.file-discovery-meta {
  display: grid;
  min-width: 0;
  gap: 6px;
  overflow-wrap: anywhere;
}

.file-discovery-path,
.file-discovery-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.file-discovery-actions,
.file-history-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-history-pagination {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
}

.file-history-pagination span {
  padding: 4px;
}

.bundle-block {
  display: grid;
  gap: 8px;
}

.bundle-block pre {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(10, 18, 34, 0.96);
  color: #dbeafe;
  overflow: auto;
  white-space: pre-wrap;
}

.bundle-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  width: fit-content;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  text-decoration: none;
  font-weight: 700;
}

.quota-body {
  flex: 1;
  min-height: 420px;
  padding: 18px 20px 20px;
  overflow: auto;
}

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

.quota-body-large {
  gap: 18px;
}

.quota-card {
  padding: 16px;
}

.quota-card h3 {
  font-size: 18px;
}

.quota-card-head p {
  margin-top: 6px;
}

.time-limit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
}

.time-limit-form .primary-button {
  min-width: 150px;
}

.time-limit-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.time-limit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.time-limit-row-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.time-limit-row-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-limit-row-meta {
  color: var(--muted);
  font-size: 12px;
}

.time-limit-row-meta.is-expired {
  color: var(--danger);
}

.time-limit-remove-button {
  min-height: 36px;
  padding: 0 12px;
  flex: 0 0 auto;
}

.time-limit-countdown {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.time-limit-countdown strong {
  color: var(--brand-strong);
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.redeem-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.redeem-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.redeem-form input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px rgba(11, 93, 69, 0.12);
}

.empty-chat,
.empty-state,
.empty-state-block {
  border: 1px dashed rgba(59, 130, 246, 0.24);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.64);
  line-height: 1.75;
}

.empty-state-block {
  margin: 18px 20px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1320px) {
  .dashboard-layout {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .workspace-main {
    grid-template-rows: auto auto;
  }
}

@media (max-width: 1024px) {
  .dashboard-layout,
  .workspace-main {
    grid-template-columns: 1fr;
  }

  .workspace-main {
    grid-template-rows: auto auto;
  }

  .workspace-shell {
    min-height: 0;
  }

  .dashboard-layout {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .node-list,
  .conversation-list,
  .chat-messages,
  .detail-panel-scroll,
  .quota-body {
    min-height: 320px;
    max-height: none;
  }

  .config-grid,
  .hero-grid,
  .quota-summary,
  .file-row-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .file-selection-bar,
  .file-list-head,
  .file-row {
    grid-template-columns: 64px minmax(0, 1fr) minmax(88px, 0.7fr) minmax(88px, 0.7fr);
  }

  .file-selection-summary,
  .file-row-actions {
    grid-column: 2 / -1;
  }

  .file-list-head span:nth-child(5),
  .file-list-head span:nth-child(6) {
    display: none;
  }

  .file-row > .file-meta:nth-of-type(3) {
    display: none;
  }

  .file-discovery-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .file-discovery-actions {
    grid-column: 1 / -1;
  }

  .command-panel {
    min-height: 760px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 100%);
    padding: 12px 0 18px;
  }

  .login-card,
  .topbar,
  .panel {
    border-radius: 24px;
  }

  .login-card,
  .topbar,
  .panel-header,
  .chat-form,
  .bundle-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar,
  .topbar-actions,
  .chat-form-actions,
  .chat-form-footer,
  .panel-header,
  .quota-card-head,
  .node-description-editor-footer,
  .model-config-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .model-config-footer .primary-button {
    width: 100%;
  }

  .brand-lockup {
    align-items: flex-start;
  }

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

  .update-notice-modal {
    align-items: end;
    padding: 12px;
  }

  .update-notice-panel {
    max-height: calc(100dvh - 24px);
    padding: 22px 20px;
  }

  .update-notice-panel h2 {
    font-size: 22px;
  }

  .update-notice-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .update-notice-actions .primary-button {
    width: 100%;
  }

  .reference-image-viewer-modal {
    padding: 10px;
  }

  .reference-image-viewer-panel {
    width: 100%;
    height: calc(100dvh - 20px);
  }

  .reference-image-viewer-header {
    min-height: 56px;
    padding-left: 14px;
  }

  .reference-image-viewer-stage {
    padding: 8px;
  }

  .redeem-form,
  .time-limit-form {
    grid-template-columns: 1fr;
  }

  .time-limit-countdown {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .time-limit-countdown strong {
    font-size: 24px;
    text-align: left;
  }

  .detail-tabs,
  .config-grid,
  .quota-summary {
    grid-template-columns: 1fr;
  }

  .project-version-save-form,
  .project-version-row {
    grid-template-columns: 1fr;
  }

  .project-version-actions {
    justify-content: flex-start;
  }

  .file-path-input-wrap,
  .file-row-main {
    grid-template-columns: 1fr;
  }

  .file-selection-bar,
  .file-list-head,
  .file-row {
    grid-template-columns: 1fr;
  }

  .file-selection-summary,
  .file-row-actions {
    grid-column: auto;
  }

  .file-row-actions,
  .detail-header-actions,
  .file-upload-bar {
    width: 100%;
  }

  .file-list {
    max-height: none;
    resize: none;
  }

  .file-search-form,
  .file-discovery-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .file-search-actions,
  .file-search-form select {
    width: 100%;
  }

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

  .file-discovery-list {
    max-height: 65vh;
  }

  .file-discovery-actions {
    grid-column: auto;
    width: 100%;
  }

  .file-history-pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .file-history-pagination span {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .message-card {
    max-width: 100%;
  }

  .message-summary {
    grid-template-columns: 1fr;
  }

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

  .requirement-filter-row {
    grid-template-columns: 1fr;
  }

  .requirement-clear-button {
    width: 100%;
  }

  .requirement-latest-button {
    justify-self: end;
  }

  div.turn-empty {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
