:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #dfe3e8;
  --text: #1f2933;
  --muted: #6b7280;
  --soft: #f1f4f8;
  --accent: #176b87;
  --accent-2: #2f7d57;
  --warn: #b45309;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --warn-bg: #fff7e6;
  --ok-bg: #ecfdf3;
  --readonly: #fff9d8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

.sidebar {
  flex: 0 0 260px;
  background: #17212b;
  color: #f8fafc;
  min-height: 100vh;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #f5c542;
  color: #17212b;
  font-weight: 800;
  border-radius: 8px;
}

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

.brand small,
.source-note span {
  color: #b8c2cc;
  font-size: 12px;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  text-align: left;
  color: #d8dee8;
  background: transparent;
  padding: 11px 12px;
  border-radius: 6px;
}

.nav button.active,
.nav button:hover {
  background: #263340;
  color: #ffffff;
}

.source-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid #334252;
  border-radius: 8px;
}

.source-note strong {
  display: block;
  margin-bottom: 6px;
}

.app-shell {
  flex: 1 1 auto;
  min-width: 0;
  width: calc(100vw - 260px);
}

.topbar {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
}

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

h1 {
  font-size: 24px;
  margin-bottom: 0;
}

h2 {
  font-size: 17px;
  margin-bottom: 10px;
}

h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

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

.content {
  padding: 26px 28px 40px;
}

.primary,
.secondary,
.ghost,
.danger-btn {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 650;
}

.primary {
  background: var(--accent);
  color: white;
}

.secondary {
  background: #e8f2f5;
  color: #0f5268;
}

.ghost {
  background: #eef1f5;
  color: var(--text);
}

.danger-btn {
  background: var(--danger-bg);
  color: var(--danger);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.7fr);
}

.grid.two.form-workbench {
  grid-template-columns: minmax(560px, 0.9fr) minmax(560px, 1.1fr);
  align-items: start;
}

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

.panel,
.metric-card,
.risk-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.panel {
  padding: 14px;
}

.metric-card {
  padding: 16px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  font-size: 25px;
  margin: 8px 0 4px;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

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

th {
  color: #475467;
  background: #f8fafc;
  font-size: 13px;
  white-space: nowrap;
}

td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status.draft {
  background: #edf2f7;
  color: #475467;
}

.status.pending {
  background: #e8f2f5;
  color: #0f5268;
}

.status.approved {
  background: var(--ok-bg);
  color: #067647;
}

.tag.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.tag.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.tag.ok {
  background: var(--ok-bg);
  color: #067647;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.filters input,
.filters select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
}

.form-section {
  display: grid;
  gap: 7px;
  margin-bottom: 9px;
  padding: 10px;
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-section.decision-section {
  border-left: 4px solid var(--accent);
  background: #f8fcfd;
}

.form-section.internal-section {
  border-left: 4px solid #2f7d57;
  background: #f7fcf9;
}

.form-section.external-section {
  border-left: 4px solid #b45309;
  background: #fffaf0;
}

.form-section.risk-section {
  border-left: 4px solid var(--danger);
  background: #fff8f7;
}

.form-section.hiring-section {
  border-left: 4px solid #475467;
  background: #f8fafc;
}

.form-section.internal-section h2::before,
.form-section.external-section h2::before,
.form-section.risk-section h2::before,
.form-section.hiring-section h2::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 8px;
  vertical-align: 2px;
  background: currentColor;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 7px;
}

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

.field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

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

.form-workbench .field.wide {
  grid-column: span 1;
}

.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  color: #344054;
  font-size: 11px;
  font-weight: 650;
}

.requirement {
  flex: 0 0 auto;
  padding: 1px 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.requirement.required {
  color: var(--danger);
  background: var(--danger-bg);
}

.requirement.optional {
  color: #667085;
  background: #eef1f5;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  min-height: 30px;
  padding: 5px 8px;
  width: 100%;
}

.field textarea {
  min-height: 42px;
  resize: vertical;
}

.live-panel {
  position: static;
}

.stage-grid {
  display: grid;
  gap: 10px;
}

.stage-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stage-card.highlight {
  background: #eef8fb;
  border-color: #b9dce6;
}

.stage-card h3 {
  padding-left: 30px;
  margin-bottom: 2px;
}

.stage-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #e5e7eb;
  padding-top: 7px;
}

.stage-card small {
  color: var(--muted);
}

.stage-card strong {
  text-align: right;
}

.stage-num {
  position: absolute;
  top: 10px;
  left: 12px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.comp-matrix {
  display: grid;
  grid-template-columns: minmax(112px, 0.8fr) repeat(5, minmax(128px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  background: white;
}

.comp-matrix.compact {
  grid-template-columns: minmax(64px, 0.7fr) repeat(5, minmax(66px, 1fr));
  font-size: 11px;
}

.comp-head,
.comp-label,
.comp-cell {
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.comp-matrix.compact .comp-head,
.comp-matrix.compact .comp-label,
.comp-matrix.compact .comp-cell {
  padding: 7px 6px;
}

.comp-head {
  font-weight: 800;
  color: #344054;
  background: #f8fafc;
}

.comp-head.current,
.comp-cell.current {
  background: #f7fbff;
}

.comp-head.external,
.comp-cell.external {
  background: #fffaf0;
}

.comp-head.offer,
.comp-cell.offer {
  background: #eef8fb;
}

.comp-head.raise,
.comp-cell.raise {
  background: #f0fdf4;
}

.comp-head.expected,
.comp-cell.expected {
  background: #f5f3ff;
  border-right: 0;
}

.comp-label {
  background: #ffffff;
}

.comp-label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.comp-label strong {
  display: block;
}

.comp-cell strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}

.comp-matrix.compact .comp-cell strong {
  font-size: 13px;
}

.comp-cell small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.comp-label.section-start,
.comp-cell.section-start {
  border-top: 3px solid #ccd6e0;
}

.compare-pill {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 5px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #dff3f8;
  color: #0f5268;
  font-size: 12px;
  font-weight: 800;
}

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

.readonly-item {
  border: 1px solid #eadf9a;
  background: var(--readonly);
  border-radius: 6px;
  padding: 10px;
}

.readonly-item small {
  display: block;
  color: #6b5b18;
  margin-bottom: 5px;
}

.readonly-item strong {
  font-size: 18px;
}

.formula-line {
  font-size: 12px;
  color: #7a6414;
  margin-top: 5px;
}

.summary-hero {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 20px;
}

.summary-hero.danger {
  border-left-color: var(--danger);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.money-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.money-strip div {
  background: var(--soft);
  border-radius: 6px;
  padding: 12px;
}

.money-strip small {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.money-strip strong {
  font-size: 20px;
}

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

.risk-box {
  padding: 12px;
  border-left: 4px solid var(--line);
}

.risk-box.warn {
  background: var(--warn-bg);
  border-left-color: var(--warn);
}

.risk-box.danger {
  background: var(--danger-bg);
  border-left-color: var(--danger);
}

.risk-box.ok {
  background: var(--ok-bg);
  border-left-color: var(--accent-2);
}

.muted {
  color: var(--muted);
}

.link-btn {
  color: var(--accent);
  background: transparent;
  padding: 0;
  font-weight: 700;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 80px;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
  font-size: 14px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

@media (max-width: 760px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    min-height: auto;
    width: 100%;
  }

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

  .nav button {
    text-align: center;
    padding: 10px 6px;
    word-break: keep-all;
  }

  .content {
    padding: 18px;
    min-width: 0;
  }

  .app-shell,
  .topbar {
    min-width: 0;
    width: 100%;
  }

  .grid.metrics,
  .grid.two,
  .grid.two.form-workbench,
  .grid.three,
  .form-grid,
  .money-strip {
    grid-template-columns: 1fr;
  }

  .field.wide {
    grid-column: auto;
  }

  .live-panel {
    position: static;
  }

  .topbar {
    height: auto;
    padding: 18px;
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }
}

@media (min-width: 761px) and (max-width: 1320px) {
  .grid.two.form-workbench {
    grid-template-columns: 1fr;
  }

  .live-panel {
    position: static;
  }

  .form-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .form-workbench .field.wide {
    grid-column: span 2;
  }

  .comp-matrix.compact {
    grid-template-columns: minmax(112px, 0.8fr) repeat(5, minmax(120px, 1fr));
    font-size: 13px;
  }

  .comp-matrix.compact .comp-cell strong {
    font-size: 16px;
  }
}
