:root {
  font: 15px/1.55 "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #172f2d;
  background: #f4f7f6;
  --ink: #172f2d;
  --muted: #526965;
  --accent: #086c59;
  --soft: #e3f2eb;
  --line: #dbe7e2;
  --panel: #fff;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0; min-width: 320px }
button, input, select, textarea { font: inherit }
button, select { cursor: pointer }
a { color: var(--accent); text-underline-offset: 3px }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #28836d; outline-offset: 3px;
}
h1, h2, h3, p { margin: 0 }
h1 { font-size: clamp(1.65rem, 3vw, 2.3rem); letter-spacing: -.035em; line-height: 1.2 }
h2 { font-size: 1.16rem }
h3 { font-size: 1rem; overflow-wrap: anywhere }
p, td, .note { overflow-wrap: anywhere }
small, .muted { color: var(--muted) }
.skip { position: fixed; z-index: 10; top: -100px; left: 20px; padding: 8px; background: #fff }
.skip:focus { top: 10px }
.shell { min-height: 100vh; display: grid; grid-template-columns: 218px minmax(0, 1fr) }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 14px 18px;
  display: flex; flex-direction: column; gap: 30px; background: #0d2825; color: #fff;
}
.brand, .identity { display: flex; gap: 10px; align-items: center; padding: 4px 8px }
.mark, .avatar { display: grid; place-items: center; flex: none; border-radius: 10px; font-size: 22px; width: 39px; height: 39px; color: #103d32; background: #a9e4c6 }
.brand strong, .identity strong { display: block }
.brand span:not(.mark), .identity small { display: block; color: #b3cbc4; font-size: .76rem }
.sidebar nav { display: grid; gap: 5px }
.sidebar nav button { white-space: nowrap; border: 0; border-radius: 8px; display: flex; gap: 11px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; color: #d7e8e3; background: transparent }
.sidebar nav button b { width: 20px; text-align: center; font-size: 1.15rem; font-weight: 500; color: #9fd5bf }
.sidebar nav button:hover, .sidebar nav button.active { background: #244840; color: #fff }
.sidebar nav button.active { font-weight: 650 }
.identity { margin-top: auto; border-top: 1px solid #35514a; padding-top: 16px }
.identity .avatar { width: 31px; height: 31px; font-size: 14px; border-radius: 50% }
.identity .quiet { margin-left: auto; color: #d7e8e3; font-size: .78rem }
.quiet { border: 0; color: var(--accent); background: transparent; padding: 4px; font-weight: 600 }
.topbar { min-height: 64px; padding: 12px 30px; display: flex; justify-content: space-between; align-items: center; gap: 15px; background: #fff; border-bottom: 1px solid var(--line) }
.top-label { color: var(--muted); font-size: .88rem }
.top-sep { color: #7b938a; padding: 0 7px }
.content { padding: 30px; max-width: 1450px; margin: auto }
.page-header, .panel-head, .card-head, .actions, .between { display: flex; align-items: center; justify-content: space-between; gap: 12px }
.page-header { align-items: flex-end; margin-bottom: 23px }
.page-header p { margin-top: 8px; color: var(--muted) }
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; background: var(--accent); color: #fff;
  font-size: .88rem; font-weight: 650; white-space: nowrap;
}
.btn:hover { background: #075a4b }
.btn.outline { border-color: #cfdfd7; color: #285147; background: #fff }
.btn.outline:hover { background: #edf6f1 }
.btn.danger { color: #963f2c; background: #f9e8e0 }
.btn:disabled { opacity: .62; cursor: wait }
.phase-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 20px }
.phase-tabs button { border: 1px solid #d9e5de; padding: 7px 12px; border-radius: 8px; color: #31564d; font-size: .89rem; background: #fff }
.phase-tabs .active { background: var(--soft); border-color: #9dceba; font-weight: 650; color: #075f50 }
.phase-tabs span { margin-left: auto; color: var(--muted); font-size: .84rem }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-radius: 14px; background: #194a3f; color: #fff; padding: 23px; margin-bottom: 16px }
.hero p { color: #c9e5da; margin-top: 4px }
.hero strong { font-size: 1.7rem; font-weight: 650; white-space: nowrap }
.stats, .grid, .board, .hardware-grid { display: grid; gap: 13px; grid-template-columns: repeat(3,minmax(0,1fr)) }
.stats { margin-bottom: 16px }
.stat, .panel, .card, .hardware-card, .lane { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel) }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.3 }
.stack { display: grid; gap: 12px }
.panel-head { margin-bottom: 12px }
.member-grid { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)) }
.person-tasks { display: grid; gap: 8px; margin-top: 10px }
.person-tasks div { font-size: .86rem }
progress { display: block; width: 100%; height: 7px; appearance: none; accent-color: var(--accent); border: 0; border-radius: 6px; background: #e5efeb; overflow: hidden; margin: 7px 0 }
progress::-webkit-progress-bar { background: #e5efeb }
progress::-webkit-progress-value { background: #23866d; border-radius: 6px }
progress::-moz-progress-bar { background: #23866d }
.board .lane { background: #eaf0ee; padding: 11px }
.lane h2 { font-size: 1rem }
.lane .card { margin-top: 9px; padding: 13px }
.badge { display: inline-block; padding: 3px 8px; border-radius: 9px; font-size: .76rem; color: #235548; background: #e4f3ec; font-weight: 600; white-space: nowrap }
.badge.ai { color: #254d80; background: #e6edf9 }
.badge.light { color: #526965; background: #ecf1ef }
.badge.warn { color: #823d16; background: #f9eddd }
.note { color: var(--muted); white-space: pre-wrap }
.card p { margin: 7px 0 }
.actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 8px }
.empty { padding: 16px; border: 1px dashed #cbdcd4; border-radius: 9px; color: var(--muted); text-align: center }
.hardware-card { padding: 0; overflow: hidden }
.hardware-card img { display: block; width: 100%; height: 156px; object-fit: contain; background: #f2f6f4; border-bottom: 1px solid var(--line) }
.hardware-card div { padding: 14px }
.hardware-card strong { display: block; color: var(--accent); margin-top: 3px; word-break: break-word }
.hardware-card p { margin-top: 6px; white-space: pre-wrap }
.toolbar { margin-bottom: 14px }
.toolbar input { max-width: 380px }
.handoff-list .card { padding: 16px }
.mini-list { display: grid; gap: 8px; padding: 0; list-style: none; margin: 0 }
.mini-list li { padding: 8px 0; border-bottom: 1px solid var(--line) }
.mini-list li:last-child { border: 0 }
.event-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; font-size: .82rem }
.field { display: grid; gap: 5px; color: #31504a; font-weight: 600; font-size: .88rem }
form { display: grid; gap: 12px }
input, select, textarea { min-width: 0; width: 100%; padding: 8px 10px; border: 1px solid #cbdcd4; border-radius: 7px; color: var(--ink); background: #fff; font-weight: 400 }
input[type=checkbox] { width: auto }
textarea { resize: vertical }
select[multiple] { min-height: 84px }
.form-grid { display: grid; gap: 10px; grid-template-columns: repeat(2,minmax(0,1fr)) }
.form-meta { color: var(--muted); font-size: .83rem; font-weight: 400 }
dialog { border: 1px solid var(--line); border-radius: 15px; padding: 0; color: var(--ink); max-height: 91vh; width: min(640px,calc(100% - 24px)); box-shadow: 0 14px 48px #0c292841 }
dialog::backdrop { background: #0c292888 }
dialog.wide { width: min(1130px,calc(100% - 24px)) }
.dialog-inner { padding: 20px }
.dialog-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px }
.dialog-title button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 7px; width: 30px; height: 30px; padding: 0 }
.dialog-inner section + section { margin-top: 15px }
.dialog-inner section > h3 { margin-bottom: 5px }
.notice, .error { background: #e8f3ec; padding: 8px 10px; border-radius: 7px; color: #265646; font-size: .88rem }
.error { background: #fae9e2; color: #943b2b }
.notify { position: fixed; z-index: 3; bottom: 16px; right: 16px; max-width: calc(100% - 32px); pointer-events: none; border-radius: 8px; padding: 9px 14px; opacity: 0; background: #173b34; color: #fff }
.notify.active { opacity: 1 }
.gate { min-height: 100vh; display: grid; align-items: center; padding: 24px; color: #f7fffb; background: #0e2926 }
.gate-inner { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 32px; width: min(100%,810px); margin: auto }
.gate-copy h1 { margin: 14px 0 8px; font-size: clamp(1.8rem,5vw,3.1rem) }
.gate-copy p { color: #c1d9d0 }
.gate-card { color: var(--ink); background: #fff; padding: 24px; border-radius: 14px }
.gate-card form { margin-top: 14px }
.settings-grid { grid-template-columns: repeat(2,minmax(0,1fr)) }
.reveal { margin: 10px 0 }
.wiring-frame { max-height: 390px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: #f3f8f5 }
.wiring-frame canvas { display: block }
.wire-layout { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(260px,1fr); gap: 14px; align-items: start }
.wire-checks { padding: 0; list-style: none; margin: 8px 0 }
.wire-checks li { padding: 6px 0; font-size: .84rem; border-bottom: 1px solid var(--line) }
.wire-items { padding-left: 20px; margin: 6px 0 }
.wire-items li { overflow-wrap: anywhere }
.wire-items button { margin-left: 5px }
@media (max-width: 950px) {
  .shell { grid-template-columns: 175px minmax(0,1fr) }
  .content, .topbar { padding: 18px }
  .hardware-grid { grid-template-columns: repeat(2,minmax(0,1fr)) }
  .wire-layout { grid-template-columns: 1fr }
}
@media (max-width: 690px) {
  .shell { display: block }
  .sidebar { position: static; height: auto; padding: 9px 12px; gap: 7px; flex-direction: row; flex-wrap: wrap; align-items: center }
  .sidebar nav { order: 3; display: flex; overflow-x: auto; width: 100%; gap: 2px }
  .sidebar nav button { width: auto; font-size: .85rem; padding: 6px 8px; gap: 5px }
  .identity { margin: 0 0 0 auto; padding: 0; border: 0 }
  .identity small, .brand span:not(.mark) { display: none }
  .sidebar .mark { width: 28px; height: 28px; font-size: 16px }
  .board,.settings-grid { grid-template-columns: 1fr }
  .content, .topbar { padding-inline: 12px }
  .page-header { align-items: flex-start; flex-wrap: wrap }
  .hero { padding: 16px }
  .hero strong { font-size: 1.3rem }
  .stat { padding: 11px }
  .phase-tabs span { margin-left: 0 }
  .gate-inner, .form-grid { grid-template-columns: 1fr }
  .hardware-card img { height: 120px }
}
