:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2433;
  --muted: #5e6475;
  --line: #e3e6ee;
  --brand: #3e2a8c;
  --brand-soft: #f7f5fe;
  --ok: #17704a;
  --ok-bg: #e8f7ef;
  --warn: #8a5300;
  --warn-bg: #fff4e0;
  --pink: #fff5fa;
  --pink-line: #f6cfe3;
  --shadow: 0 10px 30px rgba(31, 36, 51, 0.04);
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: #4a4fd1; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.gate-card h1 { font-size: 28px; }
.gate-card > p { margin: 8px 0 20px; color: var(--muted); }
.gate-card label { display: flex; flex-direction: column; gap: 8px; font-weight: 700; }
.gate-card input {
  min-height: 44px;
  border: 1px solid #d6d9e2;
  border-radius: 10px;
  padding: 0 12px;
}
.gate-card button {
  width: 100%;
  margin-top: 16px;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: white;
  font-weight: 700;
}
.login-error { min-height: 1.4em; margin: 10px 0 0; color: #aa2133; font-weight: 700; }

.app {
  max-width: 1560px;
  margin: 0 auto;
  padding: 28px 32px 72px;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.title-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 32px; font-weight: 700; line-height: 1.2; }
.sub { font-size: 16px; color: #5e6475; }
.draft {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #fff8e1;
  color: #7e5300;
  border: 1px solid #ebcf97;
  line-height: 1.5;
}
.draft b { font-weight: 700; }

.tabs {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  border-bottom: 2px solid var(--line);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 12px 8px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 700;
}
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.tab .n {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #fdecee;
  color: #aa2133;
  font-size: 13px;
}
.reload, .btn, .mini {
  border: 1px solid #d6d9e2;
  background: white;
  color: #3f4456;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 14px;
}
.reload { margin-left: auto; margin-bottom: 8px; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: white; }
.btn:hover, .reload:hover, .mini:hover { background: #f4f6fb; }
.btn.pri:hover { background: #2a1b66; }

.error {
  padding: 14px 16px;
  border-radius: 12px;
  background: #fdecee;
  color: #8d1d32;
  border: 1px solid #f3c2c8;
}
.hide { display: none !important; }

.map-card, .objective, .g-card, .s-card, .panel, .icard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.map-card { margin: 0 0 16px; padding: 12px; }
.map-card img { width: 100%; height: auto; display: block; border-radius: 10px; }
.map-switch { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.mini[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); border-color: #d9d0f5; }

.objective {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 22px;
  background: #fff5fa;
  border: 1px solid #f6cfe3;
  border-radius: 14px;
  margin: 8px 0 14px;
}
.o-mark {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #e85a8c;
  color: white;
  font-size: 22px;
  font-weight: 700;
}
.o-kicker { margin: 0; font-size: 13px; color: #a9420e; font-weight: 700; letter-spacing: 0.04em; }
.objective p { margin: 4px 0 0; font-size: 16px; line-height: 1.7; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
}
.stat span { display: block; font-size: 13px; color: #5e6475; }
.stat b { display: block; margin-top: 4px; font-size: 28px; line-height: 1.2; color: #4a4fd1; }
.stat.metric b { color: #c2410c; }
.stat.finance b { color: #c2410c; font-size: 20px; font-weight: 700; }
.chip, .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  font-size: 13px;
  color: #3f4456;
}
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: #f1d9a8; }

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.flt { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: #3f4456; }
.flt select {
  min-width: 148px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #d6d9e2;
  background: white;
  font-weight: 400;
  font-size: 15px;
}
.flt.wide select { width: 240px; max-width: 100%; }
.reset {
  font-size: 14px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid #d6d9e2;
  background: #f6f7fb;
  color: #3f4456;
}
.reset:hover { background: #eef0f6; }
.result { margin: 0 0 6px auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: white;
  border: 1px dashed #d6d9e2;
  border-radius: 14px;
}

.sheet {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.sheet-head, .g-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); }
.sheet-head {
  grid-template-columns: 200px 340px minmax(0, 1fr) 150px 168px;
  background: #eef1f7;
  font-size: 16px;
  font-weight: 700;
  color: #3f4456;
}
.sheet-head > div { display: flex; align-items: center; gap: 8px; padding: 14px 16px; }
.col-m { padding-left: 16px; }
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  flex: none;
}
.tag.g { background: #eef0ff; color: #4a4fd1; border: 1px solid #c9ccf7; }
.tag.s { background: #e6f4fc; color: #0a6690; border: 1px solid #b7e3f5; }
.tag.m { background: #e7f7ef; color: #14663f; border: 1px solid #b7e4cb; }
.g-side {
  padding: 18px 16px;
  background: #f6f7fb;
  border-right: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.g-name { display: flex; gap: 10px; align-items: flex-start; font-size: 18px; font-weight: 700; line-height: 1.4; }
.g-note { font-size: 18px; color: #5e6475; }
.s-stack { display: flex; flex-direction: column; }
.s-row { display: grid; grid-template-columns: 340px minmax(0, 1fr); border-top: 1px solid var(--line); }
.s-cell { padding: 16px 16px 14px; border-right: 1px solid var(--line); }
.s-title { display: flex; gap: 8px; align-items: flex-start; }
.s-title strong { font-size: 16px; line-height: 1.45; font-weight: 700; }
.wait {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: white;
  border: 1px solid #e3e6ee;
  color: #5e6475;
  white-space: nowrap;
}
.wait.warn { background: #fff4e0; color: #8a5300; border-color: #f1d9a8; }
.s-meta { margin: 8px 0 0 40px; font-size: 17px; color: #5e6475; line-height: 1.55; }
.s-meta b { color: #4a4fd1; font-weight: 700; }
.extra { margin: 12px 0 0 40px; display: flex; flex-direction: column; gap: 8px; }
.extra:empty { display: none; }
.fold-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  font-size: 16px;
  font-weight: 700;
  color: #5e6475;
  text-align: left;
  line-height: 1.4;
}
.fold-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid #8b90a0;
  flex: none;
}
.fold-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
.fold-body { margin-top: 4px; }
.fold-body[hidden] { display: none; }
.extra ul { margin: 0; padding-left: 22px; }
.extra li { margin: 2px 0; font-size: 17px; line-height: 1.6; color: #1f2433; }
.why-line { margin: 0; font-size: 17px; line-height: 1.6; color: #3f4456; }
.m-stack { display: flex; flex-direction: column; }
.m-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 168px;
  gap: 0;
  align-items: start;
  padding: 8px 0;
  border-top: 1px solid #eef0f4;
}
.sheet.brief .g-note { font-size: 15px; }
.sheet.brief .s-meta { font-size: 14px; }
.sheet.brief .m-line strong { font-size: 16px; }
.sheet.brief .m-values { font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0 34px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: #fffaf0;
  border: 1px solid #f1d9a8;
  font-size: 15px;
  color: #3f4456;
  line-height: 1.4;
}
.chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid #c57a12;
  flex: none;
}
.chip-dash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #e3cfa6;
  color: #6b7080;
  font-size: 13px;
}
.m-card { margin-right: 8px; }
.m-row:first-child { border-top: none; }
.m-card { border-radius: 10px; padding: 10px 12px; min-width: 0; }
.m-card.project { background: #eff9f4; }
.m-card.data { background: #fff7ee; }
.m-line { display: flex; gap: 8px; align-items: flex-start; }
.m-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}
.project .m-dot { background: #cfeedd; color: #14663f; }
.data .m-dot { background: #fbe3cb; color: #9a3d0c; }
.m-line strong { font-size: 15px; line-height: 1.4; }
.kind {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  vertical-align: 1px;
}
.project .kind { background: #d5f0e2; color: #14663f; }
.data .kind { background: #fde6cc; color: #9a3d0c; }
.m-values { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 6px 0 0 34px; font-size: 17px; color: #4b5163; line-height: 1.6; }
.m-values b { color: #1f2433; font-weight: 600; }
.m-values .due { white-space: nowrap; color: #5e6475; }
.owner-col, .co-col { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 4px; }
.dpill {
  display: inline-block;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.35;
}
.d-fc { background: #f3eeff; color: #5b3cc4; }
.d-ad { background: #e6f4fc; color: #0a6690; }
.d-pd { background: #fff0e6; color: #a9420e; }
.d-bm { background: #fdecf5; color: #a61e6b; }
.d-csi { background: #e7f7f2; color: #0f766e; }
.d-it { background: #f0f1f4; color: #454c5a; }
.d-hr { background: #eef0ff; color: #3e2a8c; }
.d-fin { background: #fdf3e1; color: #7e5300; }
.d-other { background: #f0f1f4; color: #454c5a; }
.g-code { color: var(--brand); font-size: 13px; font-weight: 700; }
.target-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f7f8fc;
  line-height: 1.6;
}
.who { text-align: right; font-size: 13px; color: var(--muted); }
.who b { display: block; color: var(--ink); font-size: 14px; }

.panel { padding: 18px 20px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.board-wrap { overflow-x: auto; }
.board { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14px; }
.board th, .board td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.board th { color: var(--muted); font-weight: 700; }

.agenda { display: flex; flex-direction: column; gap: 8px; }
.agenda a {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.agenda a:hover { border-color: #b9aee6; background: var(--brand-soft); }
.matrix {
  display: grid;
  grid-template-columns: 72px repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.matrix .lab { font-size: 12px; color: var(--muted); display: flex; align-items: end; }
.matrix .h, .matrix .axis { display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #3f4456; }
.cell {
  min-height: 64px;
  border-radius: 10px;
  background: #f4f6fb;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  text-decoration: none;
  font-size: 13px;
}

.icard { overflow: hidden; margin-bottom: 16px; scroll-margin-top: 16px; }
.ih { display: flex; gap: 14px; padding: 18px 20px; background: var(--brand-soft); border-bottom: 1px solid var(--line); }
.inum {
  flex: none;
  color: white;
  background: var(--brand);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  height: fit-content;
}
.ih h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.4; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill.dept { background: #e6f4fc; color: #0a6690; border-color: #a9ddf0; }
.ib { display: grid; grid-template-columns: 1fr 1.15fr; }
.col { padding: 18px 20px; }
.col + .col { border-left: 1px solid var(--line); }
.ask { margin: 0; font-size: 18px; font-weight: 700; color: var(--brand); line-height: 1.5; }
.q { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.q li { font-size: 16px; line-height: 1.5; }
.q-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid #d6d9e2; border-radius: 10px; overflow: hidden; flex: none; }
.sg {
  border: none;
  background: white;
  min-height: 40px;
  min-width: 64px;
  padding: 0 12px;
}
.sg + .sg { border-left: 1px solid #d6d9e2; }
.sg[aria-pressed="true"][data-v="同意"] { background: var(--ok); color: white; }
.sg[aria-pressed="true"][data-v="修正"] { background: var(--warn); color: white; }
.sg[aria-pressed="true"][data-v="暫緩"] { background: #5e6475; color: white; }
.note, .field input, .field select, .field textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fbfcfe;
}
.resolution { padding: 16px 20px 20px; background: #fbfcfe; border-top: 1px solid var(--line); }
.fields { display: flex; flex-wrap: wrap; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: #3f4456; min-width: 180px; }
.field.grow { flex: 1; }
.field.full { width: 100%; margin-top: 12px; }
.field textarea { min-height: 84px; resize: vertical; font-weight: 400; }
.summary-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.summary-actions { display: flex; gap: 8px; }
pre.out {
  margin: 14px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f4f6fb;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .sheet-head { display: none; }
  .g-row, .s-row, .m-row { grid-template-columns: 1fr; }
  .s-cell { border-right: none; border-bottom: 1px solid var(--line); }
  .s-meta, .extra { margin-left: 0; }
  .m-row { padding-left: 12px; }
  .agenda a, .ib { grid-template-columns: 1fr; }
  .col + .col { border-left: none; border-top: 1px solid var(--line); }
  h1 { font-size: 26px; }
}
