:root {
  color-scheme: light;
  --bg: #f5f6ef;
  --bg-strong: #ecf0e4;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --border: rgba(30, 56, 39, 0.12);
  --border-strong: rgba(30, 56, 39, 0.18);
  --text: #18271d;
  --muted: #627269;
  --accent: #1d7a53;
  --accent-strong: #0f5a3b;
  --accent-soft: #ebf7f0;
  --accent-softer: rgba(29, 122, 83, 0.08);
  --ink: #10231a;
  --warn: #94610d;
  --warn-bg: #fff5df;
  --error: #8d2f2d;
  --error-bg: #fff1ef;
  --error-border: rgba(141, 47, 45, 0.18);
  --shadow: 0 24px 50px rgba(19, 33, 24, 0.08);
  --shadow-soft: 0 14px 30px rgba(19, 33, 24, 0.05);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-sans:
    "Avenir Next", "Segoe UI Variable", "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(29, 122, 83, 0.16), transparent 24%),
    radial-gradient(circle at 100% 0%, rgba(255, 204, 122, 0.18), transparent 22%),
    linear-gradient(180deg, #fafcf7 0%, var(--bg) 40%, #eef1e7 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: min(1600px, 100vw);
  margin: 0 auto;
  padding: 24px clamp(12px, 2vw, 24px) 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.hero-card,
.glass-card,
.stat-card,
.view-surface,
.panel-card,
.status-banner {
  backdrop-filter: blur(18px);
}

.hero-card,
.glass-card,
.view-surface,
.panel-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 250, 246, 0.9)),
    var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-side {
  padding: 24px;
  border-radius: var(--radius-xl);
  display: grid;
  gap: 16px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero-copy h1 {
  margin: 14px 0 10px;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 0.94;
  letter-spacing: -0.045em;
}

.hero-copy p {
  margin: 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.button,
.button-link,
.tab-button {
  border: 0;
  border-radius: 999px;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.button:hover,
.button-link:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.button {
  padding: 12px 18px;
  font-weight: 700;
}

.button.compact {
  justify-self: center;
  padding: 10px 14px;
  font-size: 13px;
}

.button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 28px rgba(29, 122, 83, 0.2);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary,
.button-link.secondary {
  background: rgba(255, 255, 255, 0.76);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 700;
}

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

.metric-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
}

.panel-card,
.view-surface {
  border-radius: var(--radius-xl);
}

.panel-card {
  padding: 20px;
}

.legacy-disclosure {
  display: grid;
  gap: 14px;
}

.legacy-disclosure summary,
.devtools-summary {
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  color: var(--text);
}

.legacy-disclosure summary::-webkit-details-marker,
.devtools-summary::-webkit-details-marker {
  display: none;
}

.legacy-disclosure summary::after,
.devtools-summary::after {
  content: "展开";
  margin-left: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.legacy-disclosure[open] summary::after,
.json-panel[open] .devtools-summary::after {
  content: "收起";
}

.panel-card h2,
.view-heading h2,
.section-header h3 {
  margin: 0 0 10px;
}

.panel-copy,
.inline-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.panel-stack,
.meta-stack,
.utility-links,
.summary-grid,
.view-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.meta-stack {
  margin-top: 14px;
}

.onboarding-callout {
  margin-top: 16px;
}

.meta-row {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(250, 252, 249, 0.9);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.meta-row strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-grid,
.control-grid {
  display: grid;
  gap: 12px;
}

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

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(29, 122, 83, 0.18);
  border-color: rgba(29, 122, 83, 0.35);
}

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

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

.badge-row,
.runtime-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef1eb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.badge.good {
  background: #e8f5ee;
  color: var(--accent-strong);
}

.badge.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.badge.error {
  background: var(--error-bg);
  color: var(--error);
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
  overflow-x: hidden;
}

.workspace > * {
  min-width: 0;
  max-width: 100%;
}

.task-rail {
  padding: 20px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 250, 246, 0.88));
  box-shadow: var(--shadow-soft);
}

.task-rail-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.task-rail-header h2 {
  margin: 0 0 8px;
}

.task-rail-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.task-progress {
  display: grid;
  gap: 4px;
  min-width: 140px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.76);
  text-align: right;
}

.task-progress span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.task-progress strong {
  font-size: 28px;
  line-height: 1;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
}

.trial-finish-card.hidden {
  display: none;
}

.finish-card {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(29, 122, 83, 0.18);
  background: linear-gradient(180deg, rgba(232, 245, 238, 0.9), rgba(255, 255, 255, 0.84));
  box-shadow: var(--shadow-soft);
}

.finish-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.finish-card-header strong {
  font-size: 20px;
}

.finish-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.task-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.74);
}

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

.task-step,
.task-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.task-step {
  background: rgba(24, 39, 29, 0.06);
  color: var(--muted);
}

.task-status.status-done {
  background: #e8f5ee;
  color: var(--accent-strong);
}

.task-status.status-active {
  background: var(--warn-bg);
  color: var(--warn);
}

.task-status.status-todo {
  background: #eef1eb;
  color: var(--muted);
}

.task-copy {
  display: grid;
  gap: 8px;
}

.task-copy h3 {
  margin: 0;
  font-size: 18px;
}

.task-copy p,
.task-copy span {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.task-copy span {
  font-size: 13px;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.task-card.is-done {
  background: linear-gradient(180deg, rgba(232, 245, 238, 0.88), rgba(255, 255, 255, 0.82));
  border-color: rgba(29, 122, 83, 0.14);
}

.task-card.is-active {
  background: linear-gradient(180deg, rgba(255, 245, 223, 0.9), rgba(255, 255, 255, 0.82));
  border-color: rgba(148, 97, 13, 0.16);
}

.tab-button.spotlight {
  box-shadow:
    0 0 0 4px rgba(29, 122, 83, 0.14),
    0 16px 34px rgba(29, 122, 83, 0.18);
}

.view.active.spotlight .section-card:first-child {
  animation: spotlightPulse 1.8s ease-in-out infinite;
  border-color: rgba(29, 122, 83, 0.26);
}

@keyframes spotlightPulse {
  0%,
  100% {
    box-shadow:
      var(--shadow-soft),
      0 0 0 0 rgba(29, 122, 83, 0);
  }
  50% {
    box-shadow:
      var(--shadow-soft),
      0 0 0 8px rgba(29, 122, 83, 0.12);
  }
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.stat-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(245, 249, 245, 0.9));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.stat-card strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  color: var(--muted);
}

.status-banner::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(24, 39, 29, 0.18);
  flex: 0 0 auto;
}

.status-banner.good {
  background: #edf8f1;
  color: var(--accent-strong);
}

.status-banner.good::before {
  background: var(--accent);
}

.status-banner.error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error);
}

.status-banner.error::before {
  background: var(--error);
}

.status-banner.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-banner.warn::before {
  background: var(--warn);
}

.view-surface {
  padding: 20px;
}

.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.view-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-button {
  padding: 12px 16px;
  background: #eef1eb;
  color: var(--text);
  font-weight: 700;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px rgba(29, 122, 83, 0.2);
}

.view {
  display: none;
  min-width: 0;
}

.view.active {
  display: block;
}

.view-grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.view-grid.chat {
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.72fr);
  align-items: start;
}

.section-card {
  padding: 18px;
  min-width: 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.section-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-stream {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  max-height: 560px;
  overflow: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.message {
  justify-self: start;
  width: fit-content;
  max-width: min(100%, 82%);
  min-width: 0;
  padding: 14px 16px;
  border-radius: 22px;
  line-height: 1.7;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message.user {
  justify-self: end;
  max-width: min(100%, 56%);
  background: linear-gradient(135deg, #1d7a53, #156644);
  color: #fff;
  border-color: transparent;
}

.message .message-meta {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.75;
}

.message > div {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.view[data-view-panel="chat"] .view-grid,
.view[data-view-panel="chat"] .view-stack,
.view[data-view-panel="chat"] .section-card,
.view[data-view-panel="chat"] .composer,
.view[data-view-panel="chat"] label {
  min-width: 0;
}

.composer {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.split-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pending-action-card,
.clarification-card,
.transaction-row,
.report-card,
.json-panel {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-md);
}

.pending-action-card,
.clarification-card,
.report-card {
  padding: 16px;
}

.pending-action-card.hidden,
.json-panel.hidden {
  display: none;
}

.detail-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.detail-list strong {
  color: var(--text);
}

.clarification-list,
.report-list {
  display: grid;
  gap: 14px;
}

.clarification-card textarea {
  min-height: 92px;
  margin-top: 12px;
}

.transaction-toolbar,
.report-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

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

.mini-stat {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--accent-softer);
  border: 1px solid rgba(29, 122, 83, 0.08);
}

.mini-stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.mini-stat strong {
  font-size: 24px;
}

.table-shell {
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(30, 56, 39, 0.08);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  background: #f7faf7;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(29, 122, 83, 0.03);
}

.type-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.type-pill.expense {
  background: #fff1ef;
  color: var(--error);
}

.type-pill.income {
  background: #e8f5ee;
  color: var(--accent-strong);
}

.json-panel {
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 16px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.json-panel > * {
  min-width: 0;
  max-width: 100%;
}

.json-panel pre {
  display: block;
  margin: 0;
  padding: 16px;
  inline-size: 100%;
  max-inline-size: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-radius: var(--radius-sm);
  background: #0f1714;
  color: #dbe4e0;
  font-size: 13px;
  line-height: 1.55;
}

.empty-state {
  display: grid;
  gap: 8px;
  padding: 28px 20px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(30, 56, 39, 0.18);
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.empty-state em {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(29, 122, 83, 0.08);
  color: var(--accent-strong);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.empty-state p {
  margin: 0;
  line-height: 1.7;
}

.empty-state span {
  font-size: 13px;
}

.empty-state.is-first-use {
  background: linear-gradient(180deg, rgba(235, 247, 240, 0.86), rgba(255, 255, 255, 0.72));
  border-style: solid;
  border-color: rgba(29, 122, 83, 0.18);
}

.empty-state.is-neutral {
  background: rgba(255, 255, 255, 0.72);
}

.empty-state.is-error {
  background: rgba(255, 241, 239, 0.82);
  border-style: solid;
  border-color: rgba(141, 47, 45, 0.2);
}

.empty-state.is-error em {
  background: rgba(141, 47, 45, 0.1);
  color: var(--error);
}

.empty-state.is-attention {
  background: rgba(255, 245, 223, 0.84);
  border-style: solid;
  border-color: rgba(148, 97, 13, 0.16);
}

.empty-state.is-attention em {
  background: rgba(148, 97, 13, 0.1);
  color: var(--warn);
}

.utility-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.footnote {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.json-panel {
  margin-top: 4px;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

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

.hero-copy,
.hero-side,
.panel-card,
.stat-card,
.status-banner,
.view-surface {
  animation: riseIn 280ms ease;
}

@media (max-width: 1480px) {
  .view-grid.chat {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1320px) {
  .hero,
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 980px) {
  .summary-grid,
  .task-grid,
  .transaction-summary,
  .report-summary {
    grid-template-columns: 1fr;
  }

  .hero-copy h1 {
    font-size: clamp(34px, 8vw, 52px);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px 12px 28px;
  }

  .hero-copy,
  .hero-side,
  .panel-card,
  .view-surface,
  .task-rail {
    padding: 18px;
  }

  .summary-grid,
  .task-grid,
  .transaction-summary,
  .report-summary,
  .control-grid.dual,
  .hero-metrics,
  .button-row {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 560px;
  }

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

  .tab-button,
  .button,
  .button-link {
    justify-content: center;
  }
}
