:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --ink: #171816;
  --muted: #5c625a;
  --line: #cfc7b8;
  --panel: #fffaf0;
  --green: #245b43;
  --red: #8f3e31;
  --gold: #b6782d;
  --blue: #2f5f86;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

.shell,
.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 750;
}

.mark {
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  position: relative;
  background:
    linear-gradient(90deg, transparent 46%, var(--ink) 46%, var(--ink) 54%, transparent 54%),
    linear-gradient(0deg, transparent 46%, var(--ink) 46%, var(--ink) 54%, transparent 54%);
}

.mark::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  right: 3px;
  top: 3px;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--muted);
}

.nav a {
  text-decoration: none;
}

.session-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--green);
  background: rgba(255, 250, 240, 0.7);
  font-size: 13px;
}

.page {
  padding: 54px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 42px;
  align-items: center;
  padding: 64px 0 48px;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.lede {
  max-width: 660px;
  font-size: 20px;
}

.actions,
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button,
button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0 15px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button.secondary,
button.secondary {
  background: transparent;
  color: var(--ink);
}

.panel {
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

.shadow {
  box-shadow: 8px 8px 0 #d9c9a8;
}

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

.grid.two {
  grid-template-columns: minmax(0, 0.85fr) minmax(360px, 1.15fr);
}

.catalog-header {
  max-width: 820px;
  margin-bottom: 24px;
}

.catalogue-panel {
  margin-top: 16px;
}

.panel-heading,
.selection-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading p,
.selection-heading p {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .field {
  margin-bottom: 0;
}

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

.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.metric strong {
  font-size: 22px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label {
  font-size: 13px;
  font-weight: 750;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  padding: 0 11px;
  font: inherit;
}

input[type="checkbox"] {
  width: auto;
  min-height: 0;
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form .field {
  flex: 1 1 180px;
  margin-bottom: 0;
}

.provider-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.provider-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.74);
}

.provider-entry summary {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
}

.provider-entry summary::-webkit-details-marker {
  display: none;
}

.provider-entry summary > span:first-child {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.provider-entry summary strong {
  overflow-wrap: anywhere;
}

.provider-entry summary small {
  color: var(--muted);
}

.provider-body {
  border-top: 1px solid var(--line);
  padding: 16px 14px;
}

.provider-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.refresh-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.provider-badges,
.model-chips {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.badge,
.model-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fffdf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  border-color: rgba(36, 91, 67, 0.32);
  color: var(--green);
}

.badge.warn {
  border-color: rgba(182, 120, 45, 0.42);
  color: var(--gold);
}

.badge.error {
  border-color: rgba(143, 62, 49, 0.36);
  color: var(--red);
}

.summary-action {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.add-provider-entry[open] .summary-action {
  color: var(--green);
}

.selection-stage {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.provider-models {
  max-height: 420px;
}

.manual-model-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.manual-model-line .field {
  margin-bottom: 0;
}

.chip-remove {
  width: 18px;
  min-height: 18px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 13px;
  line-height: 1;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
  display: inline-block;
}

.status-dot.ok {
  background: var(--green);
}

.status-dot.error {
  background: var(--red);
}

.empty {
  margin: 18px 0 0;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.table-wrap {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: rgba(255, 250, 240, 0.66);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #e2dacd;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.muted {
  color: var(--muted);
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--gold);
}

.error {
  color: var(--red);
}

.notice {
  margin-top: 16px;
  border-left: 4px solid var(--gold);
  padding-left: 14px;
}

footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 32px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  .hero,
  .grid,
  .grid.two,
  .form-grid,
  .manual-model-line {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .selection-heading,
  .provider-entry summary {
    align-items: stretch;
    flex-direction: column;
  }

  .provider-badges {
    justify-content: flex-start;
  }

  .page {
    padding-top: 34px;
  }
}
