:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #647083;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #a15c00;
  --danger: #b42318;
  --chip: #eef5f3;
  --shadow: 0 1px 2px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 720;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

.subline {
  margin-top: 2px;
  color: var(--muted);
}

.layout {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 18px 24px 32px;
}

.toolbar,
.workbench,
.quote-panel,
.models-panel {
  min-width: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
}

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

.models-panel {
  overflow: hidden;
}

.quote-panel {
  align-self: start;
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.quote-panel .section-head {
  padding: 0 0 10px;
  min-height: 0;
}

.section-gap {
  margin-top: 18px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

input,
select,
button {
  width: 100%;
  min-height: 40px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

button {
  border: 0;
  background: var(--accent);
  color: #ffffff;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  background: #9aa5b1;
}

.status {
  min-width: 156px;
  border-radius: 999px;
  padding: 7px 12px;
  text-align: center;
  font-weight: 700;
  white-space: nowrap;
}

.status-ok {
  background: #e7f7ef;
  color: #05603a;
}

.status-blocked {
  background: #fff4df;
  color: var(--warn);
}

.status-error {
  background: #fee4e2;
  color: var(--danger);
}

.status-muted {
  background: #edf1f6;
  color: var(--muted);
}

.count {
  color: var(--muted);
  font-weight: 700;
}

.model-list {
  display: grid;
}

.model-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(160px, 0.9fr) minmax(120px, 0.6fr) minmax(180px, 0.8fr) 112px;
  gap: 12px;
  align-items: center;
  min-height: 74px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.model-row:last-child {
  border-bottom: 0;
}

.model-id {
  overflow-wrap: anywhere;
  font-weight: 730;
}

.model-desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  min-height: 24px;
  border-radius: 999px;
  background: var(--chip);
  color: #235c55;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.metric {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.price {
  color: var(--muted);
  font-size: 13px;
}

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

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.quote-panel label,
.quote-panel button,
.result {
  margin-top: 12px;
}

.result {
  display: block;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  padding: 10px;
  color: var(--ink);
  white-space: pre-wrap;
}

.empty {
  padding: 24px 16px;
  color: var(--muted);
}

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

  .quote-panel {
    order: -1;
  }

  .model-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .layout {
    padding: 14px 12px 24px;
  }

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