:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-soft: #fbfaf6;
  --ink: #22211d;
  --muted: #6f6b63;
  --line: #ded8cb;
  --line-strong: #c9c0af;
  --teal: #12625d;
  --teal-soft: #e7f1ef;
  --gold: #b8872e;
  --gold-soft: #f4ead8;
  --red: #b43d35;
  --red-soft: #f7e3e0;
  --amber: #c26f19;
  --amber-soft: #f8ead7;
  --green: #34795a;
  --green-soft: #e3f0e8;
  --blue: #395f8f;
  --blue-soft: #e5ebf4;
  --shadow: 0 16px 40px rgba(30, 25, 18, 0.08);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px;
  background: #25241f;
  color: #f5efe2;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  color: #f4d8a0;
  font-weight: 700;
}

.brand-title,
.brand-subtitle {
  margin: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  color: rgba(245, 239, 226, 0.68);
  font-size: 12px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.login-brand .brand-mark {
  border-color: var(--line-strong);
  background: #25241f;
}

.login-brand .brand-title {
  color: var(--ink);
}

.login-brand .brand-subtitle {
  color: var(--muted);
}

.login-heading {
  margin: 22px 0 18px;
}

.login-heading h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.2;
}

.login-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.login-field span,
.login-check {
  color: var(--muted);
  font-size: 13px;
}

.login-field .input {
  min-height: 42px;
}

.login-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 14px;
}

.login-check input {
  width: 16px;
  height: 16px;
}

.login-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--red-soft);
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
}

.login-submit {
  width: 100%;
  justify-content: center;
  min-height: 42px;
}

.nav-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-button {
  width: 100%;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(245, 239, 226, 0.78);
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #f4d8a0;
  font-size: 12px;
  font-weight: 700;
}

.nav-count {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(245, 239, 226, 0.86);
  font-size: 11px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(245, 239, 226, 0.56);
  font-size: 12px;
  line-height: 1.6;
}

.sidebar-footer p {
  margin: 0;
}

.main {
  min-width: 0;
  padding: 22px 28px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 28px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.topbar-actions,
.toolbar,
.table-actions,
.form-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button,
.icon-button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font-weight: 650;
}

.button {
  padding: 7px 12px;
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--teal);
}

.button.danger {
  background: var(--red);
  color: #fff;
}

.button.login-submit {
  min-height: 42px;
}

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

.icon-button {
  width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 21px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.system-alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.view-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

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

.section-title {
  margin: 0;
  font-size: 18px;
}

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

.section-body {
  padding: 16px 18px;
}

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

.kpi-card {
  min-height: 122px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.kpi-value {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 760;
  line-height: 1.05;
}

.kpi-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.kpi-card.good {
  border-color: #bfd8c9;
  background: var(--green-soft);
}

.kpi-card.warn {
  border-color: #ead0a5;
  background: var(--amber-soft);
}

.kpi-card.bad {
  border-color: #e5b8b2;
  background: var(--red-soft);
}

.kpi-card.gold {
  border-color: #dcc38f;
  background: var(--gold-soft);
}

.kpi-card.info {
  border-color: #c8d6dc;
  background: #eef5f7;
}

.project-scale {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.project-scale span,
.project-scale strong {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  text-align: center;
}

.project-scale span {
  background: #fff;
  color: var(--muted);
}

.project-scale strong {
  background: var(--gold-soft);
  color: #6c4b17;
}

.phase-timeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(180px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.phase-card {
  min-width: 180px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.phase-card.warn {
  border-color: #ead0a5;
  background: #fffaf1;
}

.phase-card.good {
  border-color: #bfd8c9;
  background: #f5fbf7;
}

.phase-card.event,
.phase-card.gold {
  border-color: #d7ba74;
  background: #fff7e4;
}

.phase-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.phase-range {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.phase-card h3 {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.35;
}

.phase-card p {
  margin: 8px 0 0;
  color: #4b4740;
  font-size: 12px;
  line-height: 1.55;
}

.phase-event {
  display: inline-flex;
  margin-top: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f1dcaa;
  color: #6c4b17;
  font-size: 12px;
  font-weight: 760;
}

.phase-outputs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.phase-outputs span {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #4b4740;
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

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

.toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.input,
.select {
  min-height: 34px;
  padding: 6px 9px;
}

.textarea {
  min-height: 92px;
  padding: 8px 9px;
  resize: vertical;
}

.filters .input {
  width: min(280px, 42vw);
}

.filters .select {
  width: 150px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.summary-strip > div {
  min-height: 66px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.summary-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip strong {
  font-size: 22px;
  line-height: 1;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 13px;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  color: #4d4942;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  z-index: 1;
}

.task-table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.task-table-wrap {
  position: relative;
  overflow: visible;
}

.task-header-row th {
  position: sticky;
  top: 0;
  background: var(--surface-soft);
  box-shadow: 0 1px 0 var(--line), 0 8px 16px rgba(48, 39, 25, 0.06);
  overflow: visible;
  vertical-align: middle;
  z-index: 20;
}

.task-header-row th:hover,
.task-header-row th:focus-within {
  z-index: 60;
}

.task-title-head {
  min-width: 260px;
}

.task-head-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
}

.task-head-cell.action {
  justify-content: space-between;
  gap: 8px;
}

.task-head-label {
  color: #4d4942;
  font-size: 12px;
  font-weight: 750;
}

.task-head-cell.is-active .task-head-label {
  color: var(--accent);
}

.task-filter-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #8f846f;
  transform: translateY(1px);
}

.task-head-cell.is-active .task-filter-arrow {
  border-top-color: var(--accent);
}

.task-filter-menu {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  display: grid;
  gap: 4px;
  width: max-content;
  min-width: 150px;
  max-width: 240px;
  max-height: 290px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(55, 43, 25, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 50;
}

.task-filter-menu::before {
  content: "";
  position: absolute;
  right: 0;
  bottom: 100%;
  left: 0;
  height: 12px;
}

.task-head-cell:hover .task-filter-menu,
.task-head-cell:focus-within .task-filter-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.task-search-menu {
  width: 260px;
  max-width: 260px;
}

.table-filter-control {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.table-filter-control,
.task-search-control {
  padding: 5px 7px;
}

.task-filter-option {
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.task-filter-option:hover,
.task-filter-option.is-selected {
  background: #f5ead2;
}

.task-filter-option.is-selected {
  color: var(--accent);
  font-weight: 750;
}

.task-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 4px;
}

.task-action-head {
  min-width: 132px;
}

.task-group-row td {
  padding: 0;
  border-bottom: 1px solid var(--line);
  background: #f7f3ea;
}

.task-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 12px;
}

.task-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  white-space: nowrap;
}

.task-group-title .phase-range {
  flex: 0 0 auto;
  line-height: 1.2;
}

.task-group-title strong {
  flex: 0 0 auto;
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.task-group-goal {
  min-width: 0;
  padding-left: 8px;
  overflow: hidden;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-phase-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  min-width: 166px;
}

.task-phase-add {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 3px 9px;
  border-color: #d8c8a6;
  background: #fffaf0;
  color: var(--accent);
  white-space: nowrap;
}

.task-empty-row td {
  padding: 13px 14px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfaf6;
}

.cell-title {
  max-width: 320px;
  font-weight: 700;
}

.cell-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tooltip-wrap {
  position: relative;
  display: inline-block;
  padding-right: 18px;
}

.tooltip-dot {
  position: absolute;
  top: -8px;
  right: 0;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1px solid #eee7dc;
  border-radius: 50%;
  background: #fbfaf7;
  color: #b9aa96;
  font-size: 10px;
  font-weight: 700;
  cursor: help;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: #5c5448;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
}

.metric-floating-tooltip {
  position: fixed;
  z-index: 100;
  padding: 12px 13px;
  border: 1px solid #e5dccb;
  border-radius: 7px;
  background: rgba(255, 253, 248, 0.98);
  color: var(--ink);
  box-shadow: 0 16px 45px rgba(30, 26, 20, 0.16);
  pointer-events: none;
}

.metric-floating-tooltip p {
  margin: 7px 0 0;
  color: #4b4740;
  font-size: 12px;
  line-height: 1.5;
}

.metrics-groups {
  display: grid;
  gap: 16px;
}

.metrics-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.metrics-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.metrics-group-header h3 {
  margin: 0;
  font-size: 16px;
}

.metrics-group-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.metrics-table-wrap {
  border: 0;
  border-radius: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.pill.good {
  border-color: #b9d8c8;
  background: var(--green-soft);
  color: var(--green);
}

.pill.warn {
  border-color: #ead0a5;
  background: var(--amber-soft);
  color: var(--amber);
}

.pill.bad {
  border-color: #e4b6b0;
  background: var(--red-soft);
  color: var(--red);
}

.pill.info {
  border-color: #c2cde0;
  background: var(--blue-soft);
  color: var(--blue);
}

.pill.gold {
  border-color: #e3c990;
  background: var(--gold-soft);
  color: #8a641d;
}

.progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #ebe5da;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.progress-bar.warn {
  background: var(--amber);
}

.progress-bar.bad {
  background: var(--red);
}

.metric-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 110px;
  align-items: center;
  gap: 10px;
}

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

.metric-value {
  font-weight: 750;
  text-align: right;
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 74px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.timeline-date {
  color: var(--muted);
  font-size: 12px;
}

.timeline-name {
  font-weight: 700;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(22, 20, 16, 0.46);
  z-index: 20;
}

.modal {
  width: min(980px, 100%);
  max-height: min(88vh, 920px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(20, 18, 14, 0.35);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 3px 0 0;
}

.record-form {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px 20px;
}

.record-form.detail-view {
  display: block;
}

.detail-head,
.detail-section {
  margin-bottom: 14px;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-meta {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.detail-meta span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.detail-meta strong {
  font-size: 14px;
  line-height: 1.35;
}

.detail-section {
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.detail-section h3 {
  margin: 0 0 9px;
  font-size: 15px;
}

.detail-section p {
  margin: 0;
  color: #3d3932;
  line-height: 1.65;
}

.detail-section ul {
  margin: 0;
  padding-left: 18px;
}

.detail-section li {
  margin: 6px 0;
  line-height: 1.55;
}

.detail-note {
  margin-top: 8px !important;
  color: var(--muted) !important;
  font-size: 13px;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.source-chip {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #4b4740;
  font-size: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-field label {
  color: #4b4740;
  font-size: 13px;
  font-weight: 700;
}

.form-hint {
  color: var(--muted);
  font-size: 12px;
}

.form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.tiny-button {
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 650;
}

.tiny-button.danger {
  border-color: #e4b6b0;
  color: var(--red);
}

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

.quick-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.quick-card h3 {
  margin: 0;
  font-size: 14px;
}

.quick-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.org-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.org-principle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #d7c9ad;
  border-radius: var(--radius);
  background: #fbf7ee;
}

.org-principle strong {
  flex: 0 0 auto;
}

.org-principle span {
  color: #4b4740;
  line-height: 1.55;
}

.org-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.org-row {
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.org-middle {
  max-width: 760px;
}

.org-node,
.org-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.org-node {
  width: min(520px, 100%);
  padding: 15px;
  text-align: center;
}

.org-node.primary {
  border-color: #b9d1cc;
  background: #f1faf8;
}

.org-node.gold {
  border-color: #d9c392;
  background: #fff8e8;
}

.org-node h3,
.org-group h3,
.growth-center-head h3 {
  margin: 0;
  font-size: 17px;
}

.org-node p,
.org-group p,
.growth-center-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.org-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.org-tags span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: #4b4740;
  font-size: 12px;
}

.org-connector {
  width: 1px;
  height: 24px;
  background: var(--line-strong);
}

.growth-center {
  width: 100%;
  padding: 16px;
  border: 1px solid #b9d1cc;
  border-radius: var(--radius);
  background: #f6fbfa;
}

.growth-center-head {
  max-width: 780px;
  margin: 0 auto 14px;
  text-align: center;
}

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

.org-group {
  padding: 14px;
}

.org-block {
  margin-top: 12px;
}

.org-block strong {
  display: block;
  margin-bottom: 7px;
  color: #4b4740;
  font-size: 13px;
}

.org-block ul {
  margin: 0;
  padding-left: 18px;
}

.org-block li {
  margin: 5px 0;
  color: #4b4740;
  line-height: 1.45;
}

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

.mechanism-item {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.mechanism-item strong {
  display: block;
  margin-bottom: 5px;
}

.mechanism-item span {
  color: var(--muted);
  line-height: 1.5;
}

.knowledge-section .section-body {
  padding: 0;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  min-height: calc(100vh - 188px);
}

.knowledge-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
}

.knowledge-list {
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding-right: 2px;
}

.knowledge-doc-button {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.knowledge-doc-button.active {
  border-color: #b9d1cc;
  background: #edf7f5;
}

.knowledge-doc-button strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.knowledge-doc-button span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.knowledge-reader {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.knowledge-reader-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
}

.knowledge-reader-header h3 {
  margin: 3px 0 6px;
  font-size: 20px;
}

.knowledge-reader-header span {
  color: var(--muted);
  font-size: 12px;
}

.markdown-rendered {
  padding: 22px 28px 40px;
  color: #2b2924;
  font-size: 14px;
  line-height: 1.78;
}

.markdown-rendered h1,
.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4 {
  margin: 24px 0 10px;
  line-height: 1.35;
}

.markdown-rendered h1 {
  margin-top: 0;
  font-size: 26px;
}

.markdown-rendered h2 {
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 21px;
}

.markdown-rendered h3 {
  font-size: 17px;
}

.markdown-rendered h4 {
  font-size: 15px;
}

.markdown-rendered p {
  margin: 9px 0;
}

.markdown-rendered ul,
.markdown-rendered ol {
  margin: 9px 0 14px;
  padding-left: 22px;
}

.markdown-rendered li {
  margin: 5px 0;
}

.markdown-rendered blockquote {
  margin: 14px 0;
  padding: 10px 13px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-soft);
  color: #4b4740;
}

.markdown-rendered code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.markdown-rendered pre {
  overflow-x: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.markdown-rendered pre code {
  padding: 0;
  background: transparent;
}

.md-table-wrap {
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.md-table th,
.md-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.md-table th {
  background: var(--surface-soft);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .sidebar-footer {
    display: none;
  }

  .kpi-grid,
  .dashboard-grid,
  .split-grid,
  .quick-grid,
  .project-scale,
  .summary-strip,
  .org-grid {
    grid-template-columns: 1fr;
  }

  .org-middle,
  .org-row,
  .org-principle {
    flex-direction: column;
    align-items: stretch;
  }

  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  .knowledge-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .knowledge-list {
    max-height: 280px;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px 14px 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .button,
  .file-button {
    flex: 1;
    justify-content: center;
    text-align: center;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .filters .input,
  .filters .select {
    width: 100%;
  }

  .record-form {
    grid-template-columns: 1fr;
  }

  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

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