:root {
  --navy: #12263a;
  --navy-2: #1c3d5c;
  --gold: #8d7340;
  --ink: #1a1c1f;
  --muted: #5e5a53;
  --paper: #f3f1ec;
  --sheet: #ffffff;
  --line: #e3dfd6;
  --line-strong: #cfc8bb;
  --violet: #e7eef6;
  --blue: #e6f2ea;
  --peach: #f7f1e4;
  --lock: #eef0f2;
  --lock-ink: #3d4450;
  --danger: #8c2e2e;
  --danger-bg: #f8ecea;
  --danger-line: #e4cfcb;
  --ok: #1d6a43;
  --ok-bg: #e7f3ec;
  --on-navy: #f7f4ee;
  --accent-soft: #d9c89a;
  --wash: #f7f5f1;
  --tag: #efe8da;
  --shadow: 0 1px 2px rgba(18, 38, 58, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Libre Franklin", sans-serif;
  font-size: 15px;
}
main { max-width: 1440px; margin: 0 auto; padding: 28px 28px 72px; }
a { color: var(--navy-2); }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 28px;
  background: var(--navy);
  color: var(--on-navy);
  border-bottom: 3px solid var(--gold);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  margin-right: auto;
}
.brand strong { display: block; letter-spacing: 0.14em; font-size: 14px; }
.brand small { display: block; color: var(--accent-soft); font-size: 11px; letter-spacing: 0.04em; }
.seal {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: none;
}
.seal img { width: 44px; height: 44px; object-fit: cover; display: block; }
.auth-seal { width: 112px; height: 112px; object-fit: contain; display: block; margin-bottom: 18px; }
.masthead { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.masthead-seal { width: 88px; height: 88px; object-fit: contain; flex: none; }
.masthead .sheet-kicker, .masthead .sheet-title { margin: 0; }
.masthead .sheet-title { font-size: 30px; }
.who { text-align: right; }
.who span { display: block; font-size: 13px; font-weight: 600; }
.who em { display: block; font-style: normal; color: var(--accent-soft); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.text-btn, .btn, .btn-ghost {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}
.text-btn { color: var(--on-navy); font-size: 13px; }
.btn, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}
.btn { background: var(--navy); color: var(--sheet); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line-strong); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger-line); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-wrap {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.auth-copy, .auth-panel { padding: 64px 56px; }
.auth-copy h1, .sheet-title, .page-head h1 {
  font-family: "Source Serif 4", serif;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.auth-copy h1 { font-size: 52px; line-height: 1.02; max-width: 12ch; }
.auth-copy p { max-width: 46ch; color: var(--muted); line-height: 1.6; }
.process { list-style: none; padding: 0; margin: 32px 0 0; }
.process li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; margin: 0 0 14px; }
.process b {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy); color: #fff; font-size: 12px;
}
.process span { display: block; font-weight: 600; }
.process small { display: block; color: var(--muted); line-height: 1.45; }
.auth-panel { display: grid; align-items: center; }
.card, .sheet, .panel {
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card { border-radius: 12px; padding: 28px; }
.card h2 { margin: 0 0 6px; font-family: "Source Serif 4", serif; font-size: 32px; }
.sub { color: var(--muted); margin: 0 0 18px; }
label { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
textarea {
  min-height: 88px;
  resize: none;
  overflow: hidden;
  field-sizing: content;
  scrollbar-width: none;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field { margin-bottom: 14px; }
.alert { background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.alert.is-ok { background: var(--ok-bg); color: var(--ok); }
.notice-panel { margin-bottom: 18px; }
.notice-panel h2 { margin-bottom: 12px; }
.period.notice { border-color: #e0d3b8; background: #fbf8f2; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 18px; }
.page-head h1 { font-size: 34px; }
.page-head p { margin: 0; color: var(--muted); max-width: 62ch; }
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.panel { border-radius: 12px; padding: 18px 18px 16px; }
.panel h2 { margin: 0 0 8px; font-size: 16px; }
.phase-board { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.phase-block { border: 1px solid var(--line); border-radius: 10px; padding: 14px; min-height: 180px; background: #fff; }
.phase-targets { border-top: 3px solid var(--navy); }
.phase-accomplishments { border-top: 3px solid var(--ok); }
.phase-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 4px; }
.phase-head h3 { margin: 0; font-size: 15px; }
.phase-head span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.phase-block > .note { margin: 0 0 10px; }
.archive-folder { margin-top: 16px; }
.archive-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy);
  color: var(--on-navy);
  border: 0;
  border-radius: 8px 8px 0 0;
  padding: 7px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.archive-tab span { color: var(--accent-soft); font-weight: 600; }
.archive-body {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0 10px 10px 10px;
  padding: 12px;
}
.archive-body > .note { margin: 0; }
.period-list { display: grid; gap: 10px; }
.period-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.period-row form, .period-actions { display: flex; align-items: center; gap: 8px; }
.period {
  display: block;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  text-decoration: none;
  color: inherit;
}
.period:hover, .annex-card:hover { border-color: #b7ad9e; }
.period strong { display: block; }
.period em { font-style: normal; color: var(--muted); font-size: 13px; }
.tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--tag);
}
.tag.done { background: var(--ok-bg); color: var(--ok); }

.sheet { border-radius: 12px; padding: 28px 24px; }
.sheet-kicker { color: var(--gold); letter-spacing: 0.16em; font-size: 11px; font-weight: 700; margin: 0 0 6px; }
.sheet-title { font-size: 34px; }
.commit {
  font-family: "Source Serif 4", serif;
  font-size: 17px;
  line-height: 1.45;
  margin: 8px 0 0;
}
.form-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.form-nav a {
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--navy);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
}
.form-block { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.form-block > .section-label { margin-top: 0; }
.block-head { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 12px; }
.block-head .section-label { margin: 0 0 6px; }
.block-head .note { margin: 0; max-width: 62ch; }
.block-head .field { width: 220px; flex: none; }
.identity, .weights, .signoff { display: grid; gap: 12px; }
.identity { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.comments { margin-top: 14px; }
.weights { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
.weights label { text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.3; }
.total-pill { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; }
.signoff { grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.total-pill {
  display: flex; flex-direction: column; justify-content: end;
  border-radius: 10px; padding: 10px 12px; background: var(--navy); color: var(--on-navy);
}
.total-pill b { font-size: 22px; }
.total-pill.is-bad { background: var(--danger); }
.section-label {
  margin: 22px 0 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy);
  font-weight: 700;
}
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.ipcr { width: 100%; border-collapse: collapse; min-width: 1180px; background: #fff; }
.ipcr th, .ipcr td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--wash); padding: 6px; vertical-align: top; }
.ipcr th {
  background: var(--wash);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.ipcr th.group-h { background: var(--navy); color: var(--on-navy); }
.cell { min-width: 72px; }
.calc { min-width: 64px; }
.block {
  width: 132px;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  background: var(--wash);
}
.indicator { min-width: 240px; font-size: 13px; line-height: 1.35; }
.indicator input { font-size: 13px; }
.annex { width: 92px; color: var(--muted); font-size: 11px; }
.cell input {
  border: 0;
  border-radius: 8px;
  text-align: center;
  padding: 8px 4px;
  min-width: 64px;
}
.cell.is-count input { background: var(--violet); }
.cell.is-percent input { background: var(--blue); }
.cell.is-mean input { background: var(--peach); }
.cell.is-locked input { background: var(--lock); color: var(--lock-ink); }
.cell input[readonly] { cursor: default; }
.cell-off, .calc { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.calc b { color: var(--ink); font-weight: 650; }
tr.is-na { color: #8b90a3; }
tr.is-na input { opacity: 0.55; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.swatch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.swatch i { width: 14px; height: 14px; border-radius: 4px; display: block; }
.swatch .c { background: var(--violet); }
.swatch .p { background: var(--blue); }
.swatch .m { background: var(--peach); }
.swatch .l { background: var(--lock); }

.summary { margin-top: 0; display: grid; grid-template-columns: 1fr; gap: 16px; }
.summary table { width: 100%; border-collapse: collapse; }
.summary td { padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.summary td.num, .summary th { text-align: right; font-variant-numeric: tabular-nums; }
.summary tr.parent td { font-weight: 700; background: var(--wash); }
.summary tr:not(.parent):not(.grand) td:first-child { padding-left: 18px; }
.summary tr.grand td { font-weight: 700; border-top: 2px solid var(--navy); }
.flag { color: var(--danger); font-weight: 700; font-size: 12px; }
.final-box {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 28px;
  align-items: center;
  border-radius: 10px;
  padding: 18px 22px;
  background: var(--navy);
  color: var(--on-navy);
}
.final-box span { color: var(--accent-soft); letter-spacing: 0.12em; font-size: 11px; text-transform: uppercase; }
.final-box strong { grid-row: 1 / span 2; font-family: "Source Serif 4", serif; font-size: 52px; line-height: 1; }
.final-box em { font-style: normal; font-size: 18px; }
.final-box .field { grid-column: 1 / -1; margin-top: 8px; }
.formula {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
}
.formula-note { margin: 12px 0 0; }
.savebar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}
.readonly-banner { margin-bottom: 12px; color: var(--muted); }
.annex-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.annex-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: none;
}
.annex-card .tag { background: var(--wash); color: var(--navy); }
.annex-card .tag.done { background: var(--ok-bg); color: var(--ok); }
.annex-card[class*="tone-"] { background: #fff; }
.annex-card strong { display: block; margin-top: 10px; font-size: 18px; letter-spacing: 0.08em; color: var(--navy); }
.annex-card em { display: block; margin-top: 4px; font-style: normal; color: var(--muted); }
.annex-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.annex-table th, .annex-table td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.annex-table th { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.annex-table input, .annex-table select, .annex-ratings input { width: 100%; }
.annex-ratings, .checkline { margin-bottom: 16px; }
.rate-scale { margin: 0 0 16px; padding-left: 18px; color: var(--ink); }
.rate-scale li { margin: 4px 0; }
.rate-table th.num, .rate-table td.num { text-align: center; width: 52px; }
.rate-table input[type="radio"] { width: auto; accent-color: var(--navy); }
.checkline { display: flex; gap: 8px; align-items: center; font-weight: 600; }

@media (max-width: 980px) {
  .auth-wrap, .layout, .summary, .identity, .weights, .signoff, .phase-board { grid-template-columns: 1fr; }
  .block-head, .final-box { display: block; }
  .block-head .field { width: auto; margin-top: 12px; }
  .final-box strong { display: block; margin: 8px 0; }
  .auth-copy, .auth-panel { padding: 32px 20px; }
  .auth-copy h1, .page-head h1 { font-size: 34px; }
  main { padding: 18px 12px 48px; }
}
@media print {
  .topbar, .savebar, .legend, .no-print { display: none !important; }
  body, main { background: white; padding: 0; }
  .sheet { box-shadow: none; border: 0; }
}
