:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #68635c;
  --paper: #f8f6f0;
  --panel: #ffffff;
  --line: #d9d2c6;
  --green: #1f8a70;
  --yellow: #f4a261;
  --red: #d1495b;
  --blue: #2f6f9f;
  --shadow: 0 22px 60px rgba(31, 42, 38, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 8%, rgba(244, 162, 97, 0.16), transparent 30%),
    linear-gradient(135deg, #f8f6f0 0%, #eef4f1 45%, #f8f6f0 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.9rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 5px rgba(244, 162, 97, 0.18);
}

.status-strip.confirmed .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(31, 138, 112, 0.16);
}

.status-strip.frozen .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(209, 73, 91, 0.16);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(380px, 1.35fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.setup-panel,
.safety-panel {
  padding: 16px;
}

.outcome-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.icon-button,
.primary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 850;
}

.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
}

.primary-button,
.danger-button {
  gap: 8px;
  padding: 0 13px;
}

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

.danger-button {
  background: #fff1f2;
  color: var(--red);
  border-color: rgba(209, 73, 91, 0.28);
}

button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.person-tabs,
.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.person-tab,
.mode-option {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.person-tab.active,
.mode-option.active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 8px rgba(21, 21, 21, 0.08);
}

.person-form {
  margin-top: 16px;
}

.field-label {
  display: block;
  margin: 14px 0 7px;
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 850;
}

.field-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

input[type="text"],
input[type="number"],
#personName {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 750;
}

.money-input {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding-left: 12px;
}

.money-input span {
  color: var(--muted);
  font-weight: 900;
}

.money-input input {
  border: 0;
  min-height: 40px;
  padding-left: 6px;
}

.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

output {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--red);
}

.level-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.boundary-group {
  display: grid;
  gap: 9px;
  margin: 16px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
}

.boundary-group legend {
  padding: 0 6px;
  font-weight: 850;
}

.boundary-group label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.boundary-group input {
  accent-color: var(--green);
}

.visual-map {
  display: grid;
  place-items: center;
  min-height: 296px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(31, 138, 112, 0.08), transparent 62%),
    #fbfaf6;
}

.pod-map {
  width: min(100%, 460px);
  height: auto;
  max-height: 330px;
}

.map-ring {
  fill: none;
  stroke: rgba(47, 111, 159, 0.16);
  stroke-width: 28;
}

.map-link {
  fill: none;
  stroke: url("#signalGradient");
  stroke-linejoin: round;
  stroke-width: 8;
}

.map-node {
  fill: white;
  stroke: var(--ink);
  stroke-width: 5;
}

.node-a {
  stroke: var(--green);
}

.node-b {
  stroke: var(--yellow);
}

.node-c {
  stroke: var(--red);
}

.map-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.map-center {
  fill: var(--ink);
  font-size: 28px;
  font-weight: 950;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.metrics div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.metrics span,
.date-card-head span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
}

.metrics strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1rem, 2vw, 1.3rem);
  overflow-wrap: anywhere;
}

.date-card {
  border-radius: 8px;
  padding: 16px;
  color: white;
  background: linear-gradient(135deg, #151515, #243a34 62%, #56323a);
}

.date-card .eyebrow,
.date-card-head span {
  color: rgba(255, 255, 255, 0.74);
}

.date-card h3 {
  margin-top: 4px;
  font-size: 1.45rem;
}

.date-card p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.45;
}

.date-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rule-list {
  display: grid;
  gap: 7px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.rule-list li,
.safety-item {
  display: flex;
  gap: 9px;
  align-items: start;
}

.rule-list li::before,
.safety-item::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 0.48em;
  border-radius: 50%;
  background: var(--yellow);
  flex: 0 0 auto;
}

.safety-list {
  display: grid;
  gap: 9px;
}

.safety-item {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
}

.safety-item::before {
  background: var(--green);
}

.checkin-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.checkin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.checkin-head span {
  color: var(--blue);
  font-weight: 900;
}

.checkin-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.checkin-list button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 0 10px;
  color: var(--ink);
  font-weight: 850;
}

.checkin-list button.checked {
  border-color: rgba(31, 138, 112, 0.36);
  background: rgba(31, 138, 112, 0.11);
  color: var(--green);
}

.payout-text {
  min-height: 44px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.mode-switch {
  margin-top: 14px;
}

@media (max-width: 1080px) {
  .app-grid {
    grid-template-columns: 1fr 1fr;
  }

  .outcome-panel {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .status-strip {
    width: 100%;
    justify-content: center;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .outcome-panel {
    grid-row: auto;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .danger-button {
    width: 100%;
  }

  .metrics {
    grid-template-columns: 1fr;
  }

  .visual-map {
    min-height: 230px;
  }
}
