:root {
  color-scheme: light;
  --navy-950: #071a22;
  --navy-900: #0b2530;
  --navy-800: #123743;
  --teal-600: #0d8d83;
  --teal-500: #17a89b;
  --teal-100: #d9f3ef;
  --ink: #17272d;
  --muted: #677a82;
  --line: #d9e3e6;
  --surface: #ffffff;
  --canvas: #f2f6f6;
  --shadow: 0 12px 34px rgba(7, 26, 34, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
:focus-visible { outline: 3px solid rgba(23, 168, 155, 0.45); outline-offset: 3px; }

.cockpit {
  display: grid;
  grid-template-columns: 224px minmax(640px, 1fr) 330px;
  min-height: 100vh;
}

.app-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.dashboard-main { padding: 42px; }
.utility-main { min-width: 0; padding: 42px; }
.utility-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.project-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 30px; }
.project-card { min-height: 170px; padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow); text-decoration: none; transition: transform 150ms ease, border-color 150ms ease; }
.project-card:hover { transform: translateY(-2px); border-color: var(--teal-500); }
.project-card-static:hover { transform: none; }
.project-card h2 a { text-decoration: none; }
.auth-card { width: min(460px, calc(100% - 32px)); margin: 8vh auto; padding: 30px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow); }
.auth-card form { display: grid; gap: 12px; }
.auth-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 34px; color: var(--navy-900); font-weight: 760; }
.subtle-link { display: inline-block; margin-top: 18px; color: var(--teal-600); font-size: 14px; }

.global-nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px 18px;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
  color: #eaf7f5;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; }
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--teal-500);
  color: var(--navy-950);
}
.global-links { display: grid; gap: 6px; margin-top: 40px; }
.global-links a { padding: 11px 12px; border-radius: 8px; text-decoration: none; }
.global-links a:hover { background: rgba(255, 255, 255, 0.08); }
.global-links a[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.nav-user { display: grid; gap: 8px; margin-top: auto; color: #b8cece; font-size: 13px; }
.button-link { padding: 0; border: 0; background: none; color: #d7efec; cursor: pointer; }

.project-workspace { min-width: 0; padding: 30px 36px 60px; }
.project-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -0.035em; }
h2 { margin-bottom: 12px; font-size: 18px; }
.eyebrow { margin-bottom: 7px; color: var(--teal-600); font-size: 11px; font-weight: 800; letter-spacing: 0.13em; }
.muted, .empty-state { color: var(--muted); line-height: 1.6; }

.stage-nav {
  display: flex;
  gap: 5px;
  margin: 26px 0;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}
.stage-nav a { padding: 9px 14px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.stage-nav a:first-child { background: var(--navy-900); color: white; }

.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { min-height: 170px; padding: 23px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.panel-wide { grid-column: span 2; }
.library-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.record-list { display: grid; gap: 0; }
.record-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 17px 0; border-top: 1px solid var(--line); }
.record-row:first-child { border-top: 0; }
.record-row p { margin: 5px 0 0; }
.metric { margin-bottom: 5px; font-size: 38px; font-weight: 760; color: var(--navy-900); }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; }
.primary-action, .secondary-action { display: inline-flex; align-items: center; justify-content: center; padding: 10px 14px; border-radius: 9px; text-decoration: none; font-weight: 650; }
.primary-action { background: var(--teal-600); color: white; }
.secondary-action { border: 1px solid var(--line); background: white; color: var(--navy-900); }
.text-action { padding: 0; border: 0; background: transparent; color: var(--teal-600); font-weight: 650; text-decoration: none; white-space: nowrap; }
.form-panel { width: min(720px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.form-panel-wide { width: min(900px, 100%); }
.stacked-form { display: grid; gap: 18px; }
.stacked-form p { display: grid; gap: 7px; margin: 0; }
.stacked-form label { font-size: 14px; font-weight: 700; color: var(--navy-900); }
.stacked-form input, .stacked-form select, .stacked-form textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.stacked-form textarea { resize: vertical; line-height: 1.55; }
.stacked-form .errorlist { margin: 0; padding-left: 20px; color: #a13030; }
.model-selector { display: grid; gap: 10px; }
.model-selector > label { font-size: 14px; font-weight: 700; color: var(--navy-900); }
.model-selector select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.model-choice-list { display: grid; gap: 10px; }
.model-choice { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--canvas); }
.model-choice p { margin: 5px 0 0; font-size: 14px; }
.model-choice-label { display: inline-flex; margin-left: 8px; padding: 2px 7px; border-radius: 999px; background: var(--teal-100); color: #075e58; font-size: 12px; font-weight: 700; }
.model-selection-notice { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--teal-100); color: #075e58; line-height: 1.5; }
.checkbox-form p:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 9px; }
.checkbox-form input[type="checkbox"] { width: auto; }
.task-unread-count { margin: 0; color: var(--teal-600); font-weight: 700; }
.task-header-actions { display: grid; justify-items: end; gap: 10px; }
.task-budget-warning { margin-bottom: 18px; border-color: #d6a84a; color: #6f4c08; }
.task-table-wrap { overflow-x: auto; }
.task-center table { width: 100%; border-collapse: collapse; }
.task-center th, .task-center td { padding: 14px 10px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.task-center thead th { border-top: 0; color: var(--muted); font-size: 13px; }
.task-center td form { display: inline; margin-left: 10px; }
.task-stage, .task-error, .task-provenance { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.task-error { color: #a13030; }
.task-result dl { display: grid; gap: 14px; margin: 0; }
.task-result dl div { display: grid; grid-template-columns: 120px 1fr; gap: 16px; }
.task-result dt { color: var(--muted); }
.task-result dd { margin: 0; font-weight: 650; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 22px; }
.cost-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; min-height: 0; margin-bottom: 18px; }
.cost-filters p { display: grid; gap: 7px; margin: 0; }
.cost-filters label { color: var(--navy-900); font-size: 14px; font-weight: 700; }
.cost-filters input, .cost-filters select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
.cost-filter-actions { display: flex; align-items: end; gap: 10px; }
.cost-summary { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 0; margin-bottom: 18px; }
.cost-summary p { margin-bottom: 0; }
.cost-number { color: var(--navy-900); font-size: clamp(26px, 4vw, 38px); font-variant-numeric: tabular-nums; font-weight: 760; }
.numeric-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }

.project-assistant { padding: 28px 22px; border-left: 1px solid var(--line); background: rgba(255, 255, 255, 0.82); }
.assistant-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.assistant-heading button { border: 0; background: none; color: var(--teal-600); cursor: pointer; }
.context-chip { display: inline-flex; margin: 12px 0; padding: 7px 10px; border-radius: 999px; background: var(--teal-100); color: #075e58; font-size: 13px; font-weight: 700; }
.cockpit[data-assistant-state="collapsed"] { grid-template-columns: 224px minmax(640px, 1fr) 84px; }
.cockpit[data-assistant-state="collapsed"] [data-assistant-body],
.cockpit[data-assistant-state="collapsed"] .assistant-heading div { display: none; }

@media (max-width: 1080px) {
  .cockpit, .cockpit[data-assistant-state="collapsed"] { grid-template-columns: 190px minmax(0, 1fr); }
  .project-assistant { grid-column: 2; border-top: 1px solid var(--line); border-left: 0; }
  .project-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .cockpit, .cockpit[data-assistant-state="collapsed"] { display: block; }
  .app-shell { display: block; }
  .global-nav { position: static; min-height: auto; }
  .global-links { margin-top: 20px; }
  .nav-user { margin-top: 20px; }
  .project-workspace { padding: 24px 18px; }
  .dashboard-main { padding: 24px 18px; }
  .utility-main { padding: 24px 18px; }
  .utility-header { display: grid; }
  .task-header-actions { justify-items: start; }
  .project-cards { grid-template-columns: 1fr; }
  .overview-grid { grid-template-columns: 1fr; }
  .library-grid { grid-template-columns: 1fr; }
  .panel-wide { grid-column: span 1; }
  .task-result dl div { grid-template-columns: 1fr; gap: 3px; }
  .cost-filters { grid-template-columns: 1fr; }
  .cost-summary { align-items: flex-start; flex-direction: column; }
}
.site-footer {
  margin: 2rem auto 1rem;
  color: #6b7280;
  font-size: 0.8125rem;
  text-align: center;
}

.site-footer a {
  color: inherit;
}
