:root {
  color-scheme: light;
  --paper: #f8f1e4;
  --paper-deep: #efe0c8;
  --paper-strong: #e3cfab;
  --ink: #1f2430;
  --muted: #6c6f79;
  --line: rgba(31, 36, 48, 0.12);
  --line-strong: rgba(31, 36, 48, 0.22);
  --card: rgba(255, 250, 241, 0.92);
  --card-strong: rgba(255, 252, 245, 0.98);
  --navy: #23404d;
  --brick: #a4482f;
  --amber: #b67c1f;
  --olive: #697443;
  --green: #2f7252;
  --gray: #7c7070;
  --shadow: 0 18px 40px rgba(41, 38, 30, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --heading-font: "Source Han Serif SC", "Noto Serif SC", "Songti SC", serif;
  --body-font: "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  font-family: var(--body-font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(182, 124, 31, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(164, 72, 47, 0.16), transparent 22%),
    linear-gradient(180deg, #fbf7ef 0%, #f1e5d1 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(31, 36, 48, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 36, 48, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

.page-glow {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.22;
}

.page-glow-left {
  top: -9rem;
  left: -12rem;
  background: rgba(182, 124, 31, 0.45);
}

.page-glow-right {
  top: 12rem;
  right: -8rem;
  background: rgba(35, 64, 77, 0.32);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1680px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.hero,
.summary-panel,
.urgent-panel,
.board-stage,
.filter-panel,
.notice-bar,
.drawer-panel,
.modal-panel {
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  border: 1px solid rgba(31, 36, 48, 0.08);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255, 250, 241, 0.94), rgba(246, 236, 215, 0.88));
  box-shadow: var(--shadow);
}

.hero-copy {
  max-width: 760px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brick);
}

.hero h1,
.toolbar h2,
.board-head h2,
.section-head h2,
.modal-head h2,
.drawer-title,
.data-panel h3 {
  margin: 0;
  font-family: var(--heading-font);
  letter-spacing: -0.02em;
}

.hero h1 {
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.08;
}

.hero-description {
  margin: 16px 0 0;
  max-width: 58ch;
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  min-width: 360px;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.08);
}

.segmented-compact {
  width: fit-content;
}

.segmented-item {
  flex: 1;
  border: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.segmented-item:hover {
  transform: translateY(-1px);
}

.segmented-item.is-active {
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(31, 36, 48, 0.08);
}

.identity-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
}

.identity-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.58);
}

.identity-role,
.clock-label,
.mini-text,
.subtle-text,
.table-cell-meta,
.board-meta,
.toolbar-note,
.empty-state {
  font-size: 13px;
  color: var(--muted);
}

.identity-card strong {
  display: block;
  margin-top: 6px;
  font-size: 16px;
}

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

.notice-bar {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(31, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--shadow);
}

.notice-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.notice-item strong {
  font-size: 14px;
}

.button,
.text-button,
.drawer-close,
.table-action {
  cursor: pointer;
  border: 0;
  font: inherit;
}

.button {
  padding: 12px 18px;
  border-radius: 999px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover,
.text-button:hover,
.drawer-close:hover,
.table-action:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff8f1;
  background: linear-gradient(135deg, #b04a31 0%, #7f311d 100%);
  box-shadow: 0 12px 24px rgba(127, 49, 29, 0.22);
}

.button-secondary {
  color: var(--navy);
  background: rgba(35, 64, 77, 0.1);
}

.button-ghost {
  color: var(--ink);
  border: 1px solid rgba(31, 36, 48, 0.12);
  background: rgba(255, 255, 255, 0.58);
}

.button-muted {
  color: var(--navy);
  background: rgba(255, 246, 232, 0.9);
  border: 1px solid rgba(31, 36, 48, 0.1);
}

.button:disabled,
.segmented-item:disabled,
.table-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--brick);
}

.view-panel {
  display: block;
}

.view-panel.is-hidden {
  display: none;
}

.summary-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(320px, 1fr);
  gap: 20px;
  margin-top: 24px;
  align-items: start;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-self: start;
}

.summary-card,
.urgent-panel,
.filter-panel,
.board-stage,
.drawer-panel,
.modal-panel,
.project-card,
.stage-column,
.data-panel,
.admin-nav-button,
.node-editor-card,
.table-wrapper,
.permission-panel,
.settings-panel,
.metric-card,
.reminder-banner {
  border: 1px solid rgba(31, 36, 48, 0.08);
  background: var(--card);
  box-shadow: var(--shadow);
}

.summary-card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: var(--radius-lg);
  min-height: 190px;
}

.summary-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -35% auto;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), transparent 65%);
}

.summary-card-label {
  font-size: 13px;
  color: var(--muted);
}

.summary-card-value {
  margin-top: 12px;
  font-size: 34px;
  font-family: var(--heading-font);
}

.summary-card-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.urgent-panel {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.section-head,
.board-head,
.modal-head,
.drawer-header,
.toolbar,
.panel-head,
.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.urgent-list,
.admin-nav,
.data-panel-stack,
.settings-grid,
.metric-grid {
  display: grid;
  gap: 12px;
}

.admin-nav {
  margin-top: 16px;
}

.admin-nav-button {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: left;
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.admin-nav-button.is-active {
  border-color: rgba(164, 72, 47, 0.3);
  background: linear-gradient(135deg, rgba(255, 250, 241, 0.98), rgba(255, 239, 222, 0.9));
}

.admin-nav-button strong {
  display: block;
  margin-bottom: 6px;
}

.urgent-item {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.urgent-item button {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
}

.urgent-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.toolbar {
  margin-top: 28px;
}

.toolbar-copy h2 {
  margin-top: 4px;
}

.toolbar-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.field,
.mini-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.mini-field select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(31, 36, 48, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.mini-field select:focus {
  outline: 2px solid rgba(164, 72, 47, 0.16);
  border-color: rgba(164, 72, 47, 0.38);
}

.board-stage,
.admin-stage {
  margin-top: 18px;
  padding: 24px;
  border-radius: var(--radius-xl);
}

#personBoardSection {
  margin-top: 16px;
}

.board-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-top: 20px;
}

.person-board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.stage-column {
  position: relative;
  border-radius: 24px;
  padding: 16px;
  min-height: 560px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(247, 239, 225, 0.86)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.2));
}

.stage-column::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  border-radius: 24px 24px 0 0;
  background: var(--column-tone, var(--brick));
}

.stage-header {
  padding-top: 10px;
}

.stage-title-row,
.project-card-top,
.overview-grid,
.detail-actions,
.form-grid,
.log-list,
.follow-list,
.settings-grid,
.metric-grid {
  display: grid;
  gap: 12px;
}

.stage-title-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.stage-title {
  margin: 0;
  font-size: 18px;
  font-family: var(--heading-font);
}

.stage-count,
.pill,
.status-chip,
.permission-badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.stage-count,
.pill {
  background: rgba(31, 36, 48, 0.06);
  color: var(--ink);
}

.stage-cards {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.project-card {
  padding: 16px;
  border-radius: 18px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.person-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(31, 36, 48, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 239, 225, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2));
  box-shadow: var(--shadow);
}

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

.person-card h3 {
  margin: 0;
  font-size: 20px;
  font-family: var(--heading-font);
}

.person-project-list {
  display: grid;
  gap: 10px;
}

.person-project-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(31, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.person-project-item button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  cursor: pointer;
}

.project-card:hover,
.admin-nav-button:hover,
.metric-card:hover,
.reminder-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 28px rgba(31, 36, 48, 0.12);
}

.project-card button {
  width: 100%;
  padding: 0;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  color: inherit;
}

.project-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
}

.project-author {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}

.chip-row,
.inline-chips,
.permission-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(31, 36, 48, 0.06);
  color: var(--ink);
}

.chip-risk-high,
.status-risk-high {
  background: rgba(164, 72, 47, 0.14);
  color: #7f311d;
}

.chip-risk-medium,
.status-risk-medium {
  background: rgba(182, 124, 31, 0.15);
  color: #8b6110;
}

.chip-risk-low,
.status-risk-low {
  background: rgba(47, 114, 82, 0.14);
  color: #245741;
}

.chip-status {
  background: rgba(35, 64, 77, 0.12);
  color: var(--navy);
}

.chip-reminder {
  background: rgba(105, 116, 67, 0.15);
  color: #49512d;
}

.project-card-meta {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(31, 36, 48, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.38);
}

.drawer,
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 20;
}

.drawer.is-open,
.modal.is-open {
  display: block;
}

.drawer-backdrop,
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 20, 16, 0.42);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(860px, 100vw);
  height: 100%;
  overflow-y: auto;
  padding: 28px;
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.98), rgba(244, 236, 223, 0.98));
}

.drawer-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(31, 36, 48, 0.08);
  color: var(--ink);
}

.drawer-content {
  display: grid;
  gap: 20px;
}

.detail-card,
.node-editor-card,
.data-panel,
.metric-card,
.reminder-banner,
.settings-panel {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.74);
}

.detail-card h3,
.detail-card h4,
.data-panel h3,
.settings-panel h3,
.metric-card h3 {
  margin: 0 0 14px;
  font-size: 16px;
}

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

.overview-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.overview-item strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.5;
}

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

.node-editor-list {
  display: grid;
  gap: 14px;
}

.node-editor-card {
  display: grid;
  gap: 14px;
}

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

.node-editor-grid,
.settings-form-grid,
.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.node-editor-grid .field-full,
.settings-form-grid .field-full,
.modal-form-grid .field-full {
  grid-column: 1 / -1;
}

.table-wrapper,
.permission-panel {
  overflow: auto;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid rgba(31, 36, 48, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: rgba(252, 247, 239, 0.98);
  z-index: 1;
}

.table-action {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(35, 64, 77, 0.1);
  color: var(--navy);
}

.permission-table input[type="checkbox"],
.switch-input {
  width: 18px;
  height: 18px;
  accent-color: var(--brick);
}

.permission-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(164, 72, 47, 0.12);
  color: #7f311d;
}

.modal-panel {
  position: relative;
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 252, 245, 0.98), rgba(244, 236, 223, 0.98));
}

.modal-panel-wide {
  width: min(980px, calc(100vw - 32px));
}

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

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

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.data-panel-stack {
  margin-top: 18px;
}

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

.metric-card strong {
  display: block;
  font-size: 28px;
  font-family: var(--heading-font);
}

.metric-card span {
  display: block;
  margin-top: 8px;
}

.reminder-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(31, 36, 48, 0.9);
  color: #fff8f1;
  box-shadow: 0 18px 32px rgba(31, 36, 48, 0.22);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 30;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1320px) {
  .summary-panel,
  .admin-summary {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 980px) {
  .app-shell {
    padding: 24px 16px 60px;
  }

  .hero,
  .section-head,
  .board-head,
  .drawer-header,
  .modal-head,
  .toolbar,
  .toolbar-actions,
  .table-toolbar,
  .notice-item,
  .node-editor-head,
  .reminder-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions {
    min-width: 0;
  }

  .identity-panel,
  .form-grid,
  .overview-grid,
  .detail-actions,
  .node-editor-grid,
  .settings-form-grid,
  .modal-form-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid,
  .filter-panel,
  .person-board-grid {
    grid-template-columns: 1fr;
  }

  .board-grid {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
  }

  .stage-column {
    min-height: auto;
  }

  .drawer-panel,
  .modal-panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
}
