/* LLM Cost & Routing Workbook - styles. System fonts only, no external assets. */

:root {
  --text: #1b1b1b;
  --muted: #4d4d4d;
  --bg: #ffffff;
  --panel: #f4f6f8;
  --line: #c9d1d9;
  --field-border: #6b7480;
  --accent: #0b4f8a;
  --accent-dark: #083b68;
  --focus: #a14e00;
  --note-bg: #fff8e1;
  --note-line: #8a6100;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

.wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.section {
  padding-top: 1.5rem;
  padding-bottom: 1rem;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  font-size: 1.9rem;
  margin: 0.25rem 0 0.75rem;
}

h2 {
  font-size: 1.4rem;
  margin: 0 0 0.75rem;
}

h3 {
  font-size: 1.15rem;
  margin: 1.25rem 0 0.5rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-dark);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--bg);
  color: var(--accent);
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--accent);
  z-index: 10;
}

.skip-link:focus {
  top: 0.5rem;
}

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 1.5rem 0 1rem;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.lede {
  font-size: 1.1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
  margin: 0 0 1rem;
}

fieldset.card {
  min-width: 0;
}

legend {
  font-weight: 700;
  padding: 0 0.25rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

label {
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
}

input,
select {
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--field-border);
  border-radius: 4px;
  padding: 0.45rem 0.5rem;
  width: 100%;
  max-width: 100%;
}

select option:disabled {
  color: #595959;
}

.hint,
.model-info {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
}

.add-row {
  margin: 0 0 1rem;
}

button,
.btn {
  font: inherit;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.55rem 1rem;
  display: inline-block;
  text-decoration: none;
  line-height: 1.3;
}

.btn {
  background: var(--accent);
  color: #ffffff;
  border: 2px solid var(--accent);
  font-weight: 700;
}

.btn:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
}

.btn-secondary {
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--accent);
  font-weight: 600;
}

.btn-secondary:hover {
  background: #e8f0f8;
}

.btn-secondary:disabled {
  color: #595959;
  border-color: #8c8c8c;
  background: #ececec;
  cursor: not-allowed;
}

.btn-small {
  font-size: 0.95rem;
  padding: 0.35rem 0.75rem;
  margin-top: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  font-size: 0.95rem;
}

caption {
  text-align: left;
  font-weight: 600;
  padding: 0.25rem 0;
}

th,
td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  background: #e6ebf0;
}

tfoot th,
tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--text);
}

.num {
  text-align: right;
  white-space: nowrap;
}

.difference {
  font-weight: 700;
  font-size: 1.05rem;
}

.disclaimer,
.notice {
  background: var(--note-bg);
  border-left: 4px solid var(--note-line);
  padding: 0.6rem 0.75rem;
}

.note,
.footnote {
  font-size: 0.92rem;
  color: var(--muted);
}

.formula {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.75rem;
  overflow-x: auto;
}

.formula code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.provider {
  margin-bottom: 1.25rem;
}

.provider .source {
  font-size: 0.92rem;
  margin: 0 0 0.25rem;
  word-break: break-word;
}

.paid {
  border: 2px solid var(--accent);
  background: var(--bg);
}

blockquote {
  margin: 0.5rem 0 1rem;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 4px solid var(--line);
  color: var(--text);
}

.files li {
  margin-bottom: 0.5rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 1rem 0 2rem;
  background: var(--panel);
}

@media (max-width: 30rem) {
  h1 {
    font-size: 1.6rem;
  }

  .card {
    padding: 0.75rem;
  }

  th,
  td {
    padding: 0.4rem 0.35rem;
  }
}

/* Usage Diet additions */
.out-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.75rem; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem; }
.stat .label { display: block; color: var(--muted); font-size: 0.9rem; }
.stat .value { display: block; font-size: 1.35rem; font-weight: 700; }
.verdict { font-weight: 700; padding: 0.6rem 0.75rem; border-radius: 4px; border-left: 4px solid var(--accent); background: #e8f0f8; }
.verdict.warn { border-left-color: var(--note-line); background: var(--note-bg); }
.error { color: #8a1c1c; font-weight: 600; }
.price { font-size: 1.25rem; font-weight: 700; }
pre.tree { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 0.75rem; overflow-x: auto; font-size: 0.9rem; }
textarea { font: inherit; font-size: 1rem; color: var(--text); background: var(--bg); border: 1px solid var(--field-border); border-radius: 4px; padding: 0.45rem 0.5rem; width: 100%; min-height: 4.5rem; }
pre.preview { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0.75rem; white-space: pre-wrap; word-break: break-word; font-size: 0.9rem; max-height: 28rem; overflow: auto; }
.stack .field { margin-bottom: 0.75rem; }
.check { display: flex; gap: 0.5rem; align-items: flex-start; font-weight: 400; margin-bottom: 0.4rem; }
.check input, .checklist input { width: auto; margin-top: 0.3rem; }
.checklist { list-style: none; padding: 0; }
.checklist li { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.6rem; }
.checklist label { font-weight: 400; margin: 0; }
ol.steps li { margin-bottom: 0.4rem; }
