:root {
  color-scheme: light;
  --page: #f5f7fa;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --text: #182033;
  --muted: #64748b;
  --line: #d8dee8;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --blue: #1d4ed8;
  --amber: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 24px;
  position: sticky;
  top: 24px;
}

.output-panel {
  padding: 24px;
  min-width: 0;
}

.panel-heading {
  margin-bottom: 22px;
}

.result-heading {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.wide-field {
  grid-column: 1 / -1;
}

.mode-panel-hidden {
  display: none;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--text);
  background: var(--surface-strong);
  outline: none;
}

.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.strategy-field {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.strategy-field legend {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--surface-strong);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.segmented-control input:checked + span {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.error-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.actions button {
  min-height: 44px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 10px 16px;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
  font-weight: 800;
}

.actions button:hover {
  background: var(--primary-dark);
}

.actions .secondary-button {
  color: var(--primary);
  background: #ffffff;
}

.actions .secondary-button:hover {
  background: #ecfdf5;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-strong);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.metric.primary strong {
  color: var(--primary);
}

.metric.blue strong {
  color: var(--blue);
}

.metric.amber strong {
  color: var(--amber);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

caption {
  padding: 13px 14px;
  color: var(--muted);
  background: var(--surface-strong);
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

th,
td {
  padding: 13px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 12px;
  font-weight: 800;
}

td {
  color: var(--text);
  font-weight: 650;
}

tr.selected td {
  background: #ecfdf5;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--primary-dark);
  background: #ccfbf1;
  font-size: 12px;
  font-weight: 800;
}

.schedule-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.schedule-panel h3 {
  margin: 0;
  padding: 13px 14px;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 13px;
  letter-spacing: 0;
}

.timeline {
  display: grid;
  margin: 0;
}

.timeline-row {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-top: 1px solid var(--line);
}

.timeline-row dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.timeline-row dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.timeline-row strong {
  color: var(--primary);
  font-size: 14px;
}

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

  .input-panel {
    position: static;
  }

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

@media (max-width: 620px) {
  .shell {
    width: min(100vw - 20px, 560px);
    padding: 10px 0;
    gap: 10px;
  }

  .input-panel,
  .output-panel {
    padding: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .field-grid,
  .segmented-control,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .timeline-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}
