:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --ink: #17201d;
  --muted: #66736d;
  --line: #d9dfdc;
  --line-strong: #c3cbc7;
  --teal: #157b72;
  --green: #4f8a58;
  --amber: #b87716;
  --red: #b5463f;
  --blue: #3f6fa8;
  --shadow: 0 18px 50px rgba(23, 32, 29, 0.08);
  --radius: 8px;
  font-family: "Microsoft JhengHei", "Noto Sans TC", "PingFang TC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 24px 18px;
  background: #202823;
  color: #f6f7f4;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: #f6f7f4;
  color: #202823;
  font-weight: 800;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 2px;
  color: rgba(246, 247, 244, 0.66);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-list a {
  padding: 10px 11px;
  border-radius: 7px;
  color: rgba(246, 247, 244, 0.78);
  font-size: 14px;
  text-decoration: none;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}

.sidebar-note {
  position: absolute;
  right: 18px;
  bottom: 22px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(246, 247, 244, 0.72);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
}

.status-dot.blue {
  background: #6fa6e6;
}

.workspace {
  min-width: 0;
  padding: 26px 30px 56px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

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

h1 {
  font-size: 34px;
  line-height: 1.18;
  font-weight: 800;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 800;
}

h3 {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 800;
}

p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

#page-purpose {
  max-width: 760px;
  margin-top: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.status-chip,
button {
  min-height: 32px;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 700;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
}

.draft {
  color: var(--blue);
}

.p0 {
  border-color: rgba(181, 70, 63, 0.28);
  background: rgba(181, 70, 63, 0.08);
  color: var(--red);
}

button {
  cursor: pointer;
  border: 1px solid #1f2a24;
  background: #1f2a24;
  color: #fff;
}

button:hover {
  background: #2c3932;
}

.section {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(23, 32, 29, 0.02);
}

.section-label {
  margin-bottom: 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.section-head,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.intro-panel,
.action-panel,
.module-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 22px;
}

#doc-scope {
  margin-top: 8px;
}

.principle-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.principle {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 7px;
  color: #26312d;
  font-size: 14px;
  line-height: 1.55;
  background: #fbfcfa;
}

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

.action-item {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.action-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.action-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.action-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
}

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

.line-card {
  min-height: 164px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfa;
}

.line-card p {
  margin-top: 8px;
  font-size: 13px;
}

.line-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface-soft);
  color: #41514a;
  font-size: 11px;
  font-weight: 700;
}

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

.risk-item {
  padding: 15px;
  border: 1px solid rgba(181, 70, 63, 0.18);
  border-left: 4px solid var(--red);
  border-radius: 7px;
  background: #fffafa;
}

.risk-item h3 {
  margin-bottom: 8px;
}

.risk-class {
  margin-top: 12px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

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

.rhythm-column {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.rhythm-column h3 {
  padding: 13px;
  background: #eef4ef;
}

.rhythm-column ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 13px 16px 16px;
  list-style: none;
}

.rhythm-column li {
  color: #34423c;
  font-size: 13px;
  line-height: 1.55;
}

.split-section {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: #394640;
  font-size: 12px;
  font-weight: 800;
  background: #f2f5f2;
}

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

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.compact-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-key {
  color: #27342f;
  font-size: 13px;
  font-weight: 800;
}

.compact-value {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.roadmap-block {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.roadmap-block h3 {
  padding: 13px;
  background: #f2f5f2;
}

.roadmap-block .compact-table {
  padding: 0 13px 8px;
}

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

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

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

  .sidebar-note {
    position: static;
    margin-top: 18px;
  }

  .overview-grid,
  .split-section,
  .two-column {
    grid-template-columns: 1fr;
  }

  .line-grid,
  .risk-strip,
  .rhythm-board,
  .roadmap-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .workspace {
    padding: 20px 14px 42px;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 28px;
  }

  .nav-list,
  .principle-list,
  .line-grid,
  .risk-strip,
  .rhythm-board,
  .roadmap-board {
    grid-template-columns: 1fr;
  }

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

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfa;
  }

  td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
  }

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

  td::before {
    content: attr(data-label);
    color: #3b4842;
    font-size: 12px;
    font-weight: 800;
  }
}
