:root {
  color-scheme: light;
  --ink: #20242b;
  --muted: #68707d;
  --line: #d9dee7;
  --panel: #ffffff;
  --canvas: #f3f5f8;
  --main: #1f5fae;
  --main-soft: #eaf2fc;
  --sub: #9a5a12;
  --sub-soft: #fff3e2;
  --total: #0d4f92;
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% -10%, #dfeaf8 0, transparent 32rem),
    var(--canvas);
}

button, select { font: inherit; }

.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 32px; }
.hero { margin-bottom: 28px; }
.hero h1 { margin: 4px 0 10px; font-size: clamp(1.8rem, 4vw, 2.8rem); letter-spacing: .03em; }
.hero p:last-child { margin: 0; color: var(--muted); }
.eyebrow { margin: 0; color: var(--main); font-size: .78rem; font-weight: 800; letter-spacing: .12em; }

.controls {
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
}

.job-card, .results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(30, 48, 72, .07);
}

.job-card { padding: 22px; }
.main-card { border-top: 4px solid var(--main); max-width: 540px; }
.sub-card { border-top: 4px solid var(--sub); }
.card-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-heading { margin-bottom: 18px; }
.role-badge { font-weight: 800; }
.main-card .role-badge { color: var(--main); }
.sub-card .role-badge { color: var(--sub); }
.map-label, .level-max { color: var(--muted); font-size: .82rem; }
.job-card > label, .level-row label { display: block; margin-bottom: 7px; color: var(--muted); font-size: .8rem; font-weight: 700; }

select {
  width: 100%;
  border: 1px solid #c8ced8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

select:focus, button:focus-visible { outline: 3px solid rgba(42, 108, 184, .22); outline-offset: 2px; }
.level-row { display: grid; grid-template-columns: 72px minmax(90px, 140px) 1fr; align-items: center; gap: 10px; margin-top: 16px; }
.level-row label { margin: 0; }

.sub-section { background: #f8fafc; border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.sub-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sub-section-heading h2 { margin: 4px 0 0; font-size: 1.15rem; }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.card-actions { display: flex; align-items: center; gap: 10px; }
.add-button, .remove-button { border-radius: 9px; cursor: pointer; }
.add-button { border: 0; background: var(--sub); color: #fff; padding: 10px 15px; font-weight: 800; }
.add-button:disabled { cursor: not-allowed; opacity: .45; }
.remove-button { border: 1px solid #d8b998; background: #fff8ef; color: #7c4309; padding: 5px 9px; font-size: .76rem; }
.add-button:hover:not(:disabled) { background: #7f470b; }
.remove-button:hover { background: #ffedd8; }
.secondary-button:hover { background: #f6f9fd; }
.results { padding: 24px; }
.section-heading { margin-bottom: 18px; }
.section-heading h2 { margin: 4px 0 0; font-size: 1.35rem; }
.secondary-button { border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 8px 14px; cursor: pointer; }
.table-wrap { overflow-x: auto; }
table { width: auto; min-width: 0; table-layout: auto; border-collapse: separate; border-spacing: 0; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
th { background: #edf0f4; font-size: .82rem; }
th:first-child { border-radius: 10px 0 0 0; }
th:last-child { border-radius: 0 10px 0 0; }
td:first-child { font-weight: 700; text-align: center; }
td.main-value { color: var(--main); background: var(--main-soft); }
td.sub-value { color: var(--sub); background: var(--sub-soft); }
td.total-value { color: var(--total); font-weight: 800; }
tbody tr:last-child td { border-bottom: 0; }

footer { display: flex; justify-content: space-between; gap: 16px; padding: 20px 4px 0; color: var(--muted); font-size: .82rem; }
footer a { color: var(--main); font-weight: 700; }

@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1120px); padding-top: 26px; }
  .main-card { max-width: none; }
  .sub-section-heading { align-items: stretch; flex-direction: column; }
  .add-button { width: 100%; }
  .results { padding: 16px; }
  footer { flex-direction: column; }
}
