:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #15211b;
  background: #f3f6f2;
  --forest: #1f5c42;
  --forest-dark: #123d2b;
  --mint: #dff0e6;
  --line: #dce5de;
  --paper: #fff;
  --muted: #6b786f;
  --shadow: 0 18px 50px rgba(22, 56, 39, 0.1);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top right, #e5f0e8, transparent 40%), #f3f6f2; }
button, select { font: inherit; }
button, a { transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
button:hover, a:hover { transform: translateY(-1px); }

.center-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.welcome-card { width: min(460px, 100%); padding: 48px; text-align: center; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.brand-mark, .mini-mark { display: grid; place-items: center; color: white; background: var(--forest); border-radius: 18px; font-weight: 800; }
.brand-mark { width: 68px; height: 68px; margin: 0 auto 24px; font-size: 30px; }
.mini-mark { width: 38px; height: 38px; }
.eyebrow { color: var(--forest); font-size: 12px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 8px 0 12px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); }
.primary-button, .secondary-button, .quiet-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border-radius: 12px; border: 0; cursor: pointer; text-decoration: none; font-weight: 700; }
.primary-button { color: white; background: var(--forest); box-shadow: 0 8px 20px rgba(31,92,66,.2); }
.secondary-button { color: var(--forest-dark); background: var(--mint); }
.quiet-button { color: var(--muted); background: #eef2ef; }
.compact { min-height: 36px; padding: 0 14px; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; display: flex; flex-direction: column; gap: 32px; color: white; background: var(--forest-dark); }
.logo-row { display: flex; align-items: center; gap: 12px; font-size: 20px; }
.navigation { display: grid; gap: 8px; }
.navigation-footer { margin-top: auto; }
.nav-button { padding: 12px 14px; text-align: left; color: #dfece5; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.nav-button:hover { color: white; background: rgba(255,255,255,.1); }
.profile { margin-top: 0; display: grid; gap: 3px; color: #dfece5; }
.page { min-width: 0; }
.topbar { min-height: 70px; padding: 16px 34px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.75); backdrop-filter: blur(12px); }
.message[data-tone="error"] { color: #a53535; }
.message[data-tone="success"] { color: var(--forest); }
.content { max-width: 1120px; padding: 42px 34px 80px; }
.section-heading { margin-bottom: 28px; }
.card-grid, .deal-list, .member-list, .audit-list, .connector-list { display: grid; gap: 18px; }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.module-card, .deal-card, .member-card, .writing-card, .connector-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 24px rgba(26,57,40,.05); }
.module-card { display: grid; gap: 8px; text-align: left; cursor: pointer; }
.card-title { font-size: 17px; font-weight: 750; }
.deal-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.stage-pill { display: inline-flex; width: max-content; padding: 5px 10px; color: var(--forest); background: var(--mint); border-radius: 999px; font-size: 12px; font-weight: 750; }
.details { display: grid; grid-template-columns: 100px 1fr; gap: 10px 16px; margin: 18px 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.actions select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.empty-state { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed #bdc9c0; border-radius: 16px; }
.subsection { margin-top: 48px; }
.audit-list { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.audit-item { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f9fbf9; }
.audit-item code { overflow-wrap: anywhere; color: var(--forest); }
.writing-board, .finding-list { display: grid; gap: 16px; margin-top: 20px; }
.writing-board { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.writing-card { display: grid; gap: 14px; text-align: left; cursor: pointer; }
.writing-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 13px; }
.state-pill { display: inline-flex; padding: 5px 10px; border-radius: 999px; color: #315846; background: #e5f2e9; font-size: 12px; font-weight: 750; }
.state-audit_blocked, .state-finalize_failed, .finding-hard { color: #8b3131; background: #fdeaea; }
.state-awaiting_mainline, .state-awaiting_outline, .state-awaiting_final { color: #725313; background: #fff4d8; }
.state-done { color: #1f5c42; background: #dff0e6; }
.writing-details { max-width: 760px; }
.outline-preview { max-width: 900px; padding: 18px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfb; font: inherit; line-height: 1.7; }
.finding { padding: 14px 16px; border-radius: 12px; background: #f7faf8; }
.finding p { margin-bottom: 0; }
.warning-note { max-width: 760px; padding: 14px 16px; color: #725313; background: #fff4d8; border-radius: 12px; }
.connector-list { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.connector-health { display: inline-flex; width: max-content; margin-bottom: 14px; padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.connector-online { color: #1f5c42; background: #dff0e6; }
.connector-stale, .connector-unconfigured { color: #725313; background: #fff4d8; }
.connector-offline, .connector-disabled { color: #8b3131; background: #fdeaea; }
.calendar-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tab-button { min-height: 38px; padding: 0 14px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.tab-button.active { color: white; border-color: var(--forest); background: var(--forest); }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 18px 0; }
.calendar-month, .calendar-week, .conflict-list { display: grid; gap: 14px; }
.calendar-month { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.calendar-event-card, .task-card, .conflict-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.calendar-time, .calendar-timezone, .task-meta { margin: 8px 0 0; font-size: 13px; }
.calendar-timezone, .task-meta { color: var(--muted); }
.sync-state, .conflict-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.sync-synced { color: var(--forest); background: var(--mint); }
.sync-pending, .sync-unbound, .sync-paused { color: #725313; background: #fff4d8; }
.sync-conflict, .sync-error, .conflict-badge { color: #8b3131; background: #fdeaea; }
.task-board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; }
.task-column { min-width: 220px; padding: 14px; border-radius: 16px; background: #eaf0eb; }
.task-column-list { display: grid; gap: 10px; margin-top: 12px; }
.editor-form { display: grid; gap: 16px; max-width: 620px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.form-field { display: grid; gap: 7px; font-weight: 700; }
.form-field input { min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.form-error { min-height: 22px; margin: 0; color: #a53535; }
.conflict-card { display: grid; gap: 14px; }
.conflict-field { padding: 14px; border-radius: 12px; background: #f7faf8; }
.conflict-field p { margin: 6px 0; overflow-wrap: anywhere; }
.conflict-field select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.content-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.content-toolbar { margin-bottom: 20px; }
.content-data-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.content-data-card { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 24px rgba(26,57,40,.05); }
.content-data-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.content-metrics, .content-provenance { display: grid; grid-template-columns: minmax(70px, auto) 1fr; gap: 8px 12px; margin: 0; }
.content-metrics dt, .content-provenance dt { color: var(--muted); }
.content-metrics dd, .content-provenance dd { margin: 0; overflow-wrap: anywhere; }
.content-provenance { padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.freshness-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.freshness-fresh { color: #1f5c42; background: #dff0e6; }
.freshness-stale { color: #725313; background: #fff4d8; }
.freshness-partial { color: #8b5a24; background: #fff0df; }
.freshness-missing { color: #59645d; background: #e8ece9; }
.csv-import-panel { display: grid; gap: 14px; margin: 20px 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.csv-import-panel input[type="file"] { max-width: 100%; padding: 10px; border: 1px dashed #bdc9c0; border-radius: 10px; }
.csv-preview-result, .csv-error-list { display: grid; gap: 8px; }
.csv-error { margin: 0; padding: 9px 11px; color: #8b3131; background: #fdeaea; border-radius: 9px; }
.success-note { color: var(--forest); }
.release-notes-list { display: grid; gap: 18px; max-width: 860px; }
.release-note-card { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 24px rgba(26,57,40,.05); }
.release-note-card h2 { margin: 6px 0 12px; }
.release-note-items { margin: 0; padding-left: 22px; line-height: 1.7; }
.release-note-items li + li { margin-top: 6px; }
.project-center-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; margin-top: 20px; }
.project-center-card { display: grid; gap: 12px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 24px rgba(26,57,40,.05); }
.project-date-grid, .finance-grid { grid-template-columns: 105px 1fr; margin: 4px 0; }
.project-finance { display: grid; gap: 10px; padding: 16px; border: 1px solid #d7e5db; border-radius: 14px; background: #f7fbf8; }
.project-finance h3 { margin: 0; font-size: 15px; }
.project-commercial { color: #725313; background: #fff4d8; }
.project-science { color: #315846; background: #e5f2e9; }
.loss-warning { margin: 0; color: #a53535; font-weight: 800; }

@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; }
  .navigation { grid-template-columns: repeat(3, 1fr); }
  .navigation-footer { margin-top: 0; }
  .navigation-footer .nav-button { grid-column: 3; }
  .nav-button { text-align: center; padding: 10px 6px; }
  .profile { display: none; }
  .topbar, .content { padding-left: 20px; padding-right: 20px; }
  .welcome-card { padding: 34px 24px; }
  .task-board { grid-template-columns: repeat(4, 82vw); }
}
