:root {
  --bg: #f5f1e7;
  --paper: #fffaf0;
  --ink: #17211c;
  --muted: #69736b;
  --line: rgba(23, 33, 28, 0.12);
  --green: #143f34;
  --green-2: #1f5b49;
  --mint: #dcebdd;
  --orange: #ef8d3a;
  --red: #d95b47;
  --yellow: #f4c95d;
  --blue: #6d8fcf;
  --shadow: 0 22px 60px rgba(23, 33, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 0 0, rgba(239, 141, 58, 0.16), transparent 28rem),
    radial-gradient(circle at 88% 4%, rgba(20, 63, 52, 0.12), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.72);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--green);
  color: white;
  font-weight: 950;
}

.brand strong,
.brand em {
  display: block;
}

.brand strong {
  font-size: 21px;
  letter-spacing: -0.04em;
}

.brand em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 8px;
  margin-top: 34px;
}

.nav-item {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 850;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--line);
  background: var(--green);
  color: white;
}

.side-card {
  margin-top: 34px;
  padding: 18px;
  border-radius: 22px;
  background: var(--green);
  color: white;
}

.side-card p {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.side-card strong,
.side-card span {
  display: block;
}

.side-card strong {
  line-height: 1.42;
}

.side-card span {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  line-height: 1.55;
}

.main {
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
  padding: 36px 0 70px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1;
  letter-spacing: -0.07em;
}

h2 {
  margin-bottom: 0;
  font-size: 26px;
  letter-spacing: -0.045em;
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 560px;
}

body[data-view="pipeline"] .top-actions {
  display: none;
}

.primary-btn,
.ghost-btn,
.tiny-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  border: 0;
  font-weight: 900;
}

.primary-btn {
  padding: 0 18px;
  background: var(--green);
  color: white;
}

.ghost-btn,
.tiny-btn {
  padding: 0 15px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.7);
  color: var(--green);
}

.tiny-btn {
  min-height: 36px;
  font-size: 13px;
}

.link-btn {
  text-decoration: none;
}

.tiny-btn.strong {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 22px;
}

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

.metric {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  color: var(--green);
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.08em;
}

.metric span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.flow-steps div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.4);
}

.flow-steps span {
  color: var(--orange);
  font-size: 12px;
  font-weight: 950;
}

.flow-steps strong {
  display: block;
  margin: 12px 0 8px;
}

.flow-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sync-panel {
  background:
    linear-gradient(135deg, rgba(20, 63, 52, 0.08), rgba(239, 141, 58, 0.1)),
    rgba(255, 250, 240, 0.78);
}

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

.sync-grid article {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
}

.sync-grid span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 13px;
  background: var(--green);
  color: white;
  font-weight: 950;
}

.sync-grid strong {
  font-size: 18px;
}

.sync-grid p {
  min-height: 68px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.action-list,
.people-list,
.growth-grid {
  display: grid;
  gap: 12px;
}

.action-item,
.person-card,
.growth-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.42);
}

.person-card {
  display: grid;
  gap: 12px;
  text-align: left;
}

.action-item strong,
.person-card strong,
.growth-card strong {
  display: block;
  margin-bottom: 6px;
}

.action-item p,
.person-card p,
.growth-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.person-summary {
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.person-meta {
  display: grid;
  gap: 7px;
}

.person-meta > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.resource-pill {
  background: #f1e5cf;
  color: #79552a;
}

.muted-pill {
  background: rgba(23, 33, 28, 0.07);
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 170px;
  gap: 12px;
  margin-bottom: 18px;
}

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

.capture-lane article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
}

.capture-lane span {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 950;
}

.capture-lane strong {
  display: block;
  margin-bottom: 7px;
  font-size: 16px;
}

.capture-lane p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.62;
}

.capture-output {
  background:
    linear-gradient(145deg, rgba(20, 63, 52, 0.08), rgba(239, 141, 58, 0.12)),
    rgba(255, 255, 255, 0.42) !important;
}

.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.review-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  outline: none;
}

.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select {
  min-height: 44px;
  padding: 0 13px;
}

.form-grid textarea,
.review-box textarea {
  min-height: 92px;
  padding: 12px 13px;
  resize: vertical;
}

.form-grid .source-textarea {
  min-height: 72px;
}

.capture-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.capture-switch button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 950;
}

.capture-switch button.active {
  background: var(--green);
  color: white;
}

.quick-input {
  padding: 16px;
  border: 1px solid rgba(20, 63, 52, 0.16);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(220, 235, 221, 0.76), rgba(255, 250, 240, 0.88)),
    var(--paper);
}

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

.item-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.item-card {
  display: grid;
  gap: 14px;
  min-height: 250px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.44);
  text-align: left;
}

.item-card:hover {
  border-color: rgba(20, 63, 52, 0.34);
  transform: translateY(-1px);
}

.item-card h3 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.22;
  letter-spacing: -0.04em;
}

.item-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
  font-size: 14px;
}

.item-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  object-position: top;
  border-radius: 16px;
  background: #111;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border: 0;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.pill.status {
  background: #f1e5cf;
  color: #79552a;
}

.kind-pill {
  background: rgba(109, 143, 207, 0.18);
  color: #355889;
}

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

.drawer-card {
  display: block;
  width: 100%;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 250, 240, 0.88), rgba(220, 235, 221, 0.34)),
    rgba(255, 255, 255, 0.42);
  color: inherit;
  text-align: left;
  box-shadow: var(--shadow);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.drawer-card:hover {
  transform: translateY(-2px);
  border-color: rgba(20, 63, 52, 0.34);
  background: rgba(220, 235, 221, 0.56);
}

.drawer-card h3 {
  margin: 14px 0 10px;
  font-size: 24px;
  letter-spacing: -0.05em;
}

.drawer-card p {
  min-height: 70px;
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.66;
}

.drawer-card .count {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--green);
  color: white;
  font-weight: 950;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.panel-intro {
  max-width: 760px;
  margin: -4px 0 18px;
}

.record-grid {
  display: grid;
  gap: 18px;
}

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

.record-type-card,
.record-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
  text-align: left;
}

.record-type-card {
  padding: 18px;
}

.record-type-card span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 13px;
  background: var(--green);
  color: white;
  font-weight: 950;
}

.record-type-card h3 {
  margin: 14px 0 8px;
  font-size: 18px;
  letter-spacing: -0.04em;
}

.record-type-card p,
.record-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}

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

.record-card {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.record-card strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.035em;
}

.record-card em {
  color: var(--green);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.kanban-col {
  min-width: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.32);
}

.kanban-col h3 {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 15px;
}

.kanban-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  margin-bottom: 10px;
}

.kanban-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

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

.template-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--green);
  color: white;
}

.template-card p {
  color: rgba(255, 255, 255, 0.74);
  line-height: 1.8;
}

.review-box {
  display: grid;
  gap: 12px;
}

.review-box label,
.form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.quick-input {
  padding: 16px;
  border: 1px solid rgba(20, 63, 52, 0.18);
  border-radius: 22px;
  background: rgba(220, 235, 221, 0.42);
}

.quick-input textarea {
  min-height: 150px;
  font-size: 17px;
  line-height: 1.75;
}

.quick-input small {
  color: var(--green);
  font-size: 13px;
  line-height: 1.55;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  width: min(520px, 100%);
  height: 100vh;
  padding: 26px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  box-shadow: -22px 0 60px rgba(23, 33, 28, 0.14);
  transform: translateX(105%);
  transition: transform 0.22s ease;
  overflow: auto;
}

.detail-panel.open {
  transform: translateX(0);
}

.close-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
  font-size: 24px;
}

.detail-image {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  object-position: top;
  border-radius: 22px;
  margin: 18px 0;
}

.detail-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.detail-section h4 {
  margin: 0 0 8px;
}

.detail-section p {
  color: var(--muted);
  line-height: 1.75;
}

.link-list {
  display: grid;
  gap: 8px;
}

.link-chip {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(220, 235, 221, 0.42);
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  word-break: break-all;
}

.relation-pill {
  cursor: pointer;
}

.relation-pill:hover,
.link-chip:hover {
  background: var(--green);
  color: white;
}

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

.danger-btn {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(217, 91, 71, 0.24);
  border-radius: 999px;
  background: rgba(217, 91, 71, 0.12);
  color: #a33b2c;
  font-weight: 900;
}

.danger-btn:hover {
  background: #d95b47;
  color: white;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(16, 21, 18, 0.46);
}

.modal.open {
  display: grid;
}

.modal-card {
  width: min(960px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 28px;
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(247, 241, 226, 0.98)),
    var(--paper);
  box-shadow: 0 30px 90px rgba(16, 21, 18, 0.28);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.span-2 {
  grid-column: span 2;
}

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

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

  .side-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar,
  .two-col {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .metric-grid,
  .flow-steps,
  .sync-grid,
  .capture-lane,
  .item-grid,
  .item-grid.compact,
  .record-type-grid,
  .record-list,
  .drawer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .main {
    width: min(100% - 28px, 1180px);
  }

  .side-nav,
  .metric-grid,
  .flow-steps,
  .sync-grid,
  .capture-lane,
  .item-grid,
  .item-grid.compact,
  .record-type-grid,
  .record-list,
  .drawer-grid,
  .form-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }
}
