:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #68717d;
  --line: #dce3ea;
  --panel: #ffffff;
  --soft: #f4f7f9;
  --accent: #146c63;
  --accent-2: #315f9a;
  --good: #0b7a4b;
  --warn: #9a5a14;
  --shadow: 0 16px 42px rgba(30, 44, 56, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef3f5 0%, #f8fafb 46%, #edf4f1 100%);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.tool-panel,
.results-panel {
  background: var(--panel);
  border: 1px solid rgba(23, 32, 42, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-panel {
  padding: 24px;
}

.brand-row,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
}

h2 {
  font-size: 20px;
}

.today-box {
  min-width: 184px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.today-box span,
.summary-strip span,
.field span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.today-box strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  color: var(--accent);
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

input,
select {
  width: 100%;
  height: 46px;
  border: 1px solid #cfd8df;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 108, 99, 0.14);
}

.money-input {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid #cfd8df;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.money-input input {
  border: 0;
  box-shadow: none;
}

.money-input small {
  padding-right: 12px;
  color: var(--muted);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 46px;
  border: 1px solid #cfd8df;
  border-radius: 7px;
  overflow: hidden;
}

.segmented button {
  border: 0;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

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

.summary-strip div {
  min-height: 72px;
  padding: 13px 14px;
  border-radius: 8px;
  background: #eef5f2;
}

.summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  color: var(--accent);
  overflow-wrap: anywhere;
}

.results-panel {
  margin-top: 18px;
  padding: 18px;
}

.upsell-panel {
  margin-top: 18px;
  padding: 18px;
  background: #fffaf0;
  border: 1px solid #f0d69c;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-count {
  min-width: 96px;
  text-align: right;
  color: var(--warn);
}

.ghost-button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-2);
  padding: 0 14px;
  cursor: pointer;
}

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

.compact-table {
  border-color: #edd39a;
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fafb;
  color: #384653;
  font-size: 13px;
}

td {
  font-size: 14px;
}

tbody tr:hover {
  background: #f6fbf9;
}

.model-name {
  white-space: normal;
  min-width: 240px;
  font-weight: 700;
}

.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.plus {
  color: var(--good);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  min-width: 82px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge.best {
  background: #ddf5e9;
  color: var(--good);
}

.badge.value {
  background: #e8f0fb;
  color: var(--accent-2);
}

.badge.margin {
  background: #fff1d6;
  color: var(--warn);
}

.empty-state {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 18px;
  border: 1px dashed #b6c3ce;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.empty-state[hidden] {
  display: none;
}

.empty-state strong {
  color: var(--ink);
}

@media (max-width: 900px) {
  .controls-grid,
  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 14px;
  }

  .brand-row,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .today-box {
    width: 100%;
  }

  .controls-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

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

  .tool-panel,
  .results-panel {
    padding: 16px;
  }
}
