:root {
    /* Surfaces */
    --bg-base:    oklch(98% 0.004 265);
    --bg-surface: oklch(100% 0 0);
    --bg-overlay: oklch(100% 0 0);

    /* Text */
    --text-main:  oklch(22% 0.02 265);
    --text-body:  oklch(38% 0.02 265);
    --text-muted: oklch(60% 0.01 265);
    --text-label: oklch(45% 0.02 265);

    /* Borders */
    --border-default: oklch(92% 0.006 265);
    --border-light:   oklch(96% 0.004 265);

    /* Accents — base / muted / contrasted */
    --primary-base:       oklch(60% 0.18 265);
    --primary-muted:      oklch(96% 0.03 265);
    --primary-contrasted: oklch(30% 0.12 265);

    --secondary-base:       oklch(50% 0.02 265);
    --secondary-muted:      oklch(94% 0.008 265);
    --secondary-contrasted: oklch(25% 0.03 265);

    --danger-base:        oklch(60% 0.20 25);
    --danger-muted:       oklch(96% 0.03 25);
    --danger-contrasted:  oklch(30% 0.12 25);

    --success-base:       oklch(62% 0.15 150);
    --success-muted:      oklch(96% 0.03 150);
    --success-contrasted: oklch(30% 0.10 150);

    --info-base:          oklch(65% 0.12 225);
    --info-muted:         oklch(96% 0.02 225);
    --info-contrasted:    oklch(30% 0.08 225);

    --warning-base:       oklch(72% 0.15 70);
    --warning-muted:      oklch(96% 0.03 70);
    --warning-contrasted: oklch(35% 0.10 70);

    --color-primary: var(--primary-base);
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        system-ui,
        sans-serif;
    color: var(--text-main);
    background: var(--bg-base);
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3 {
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

a {
    color: var(--primary-base);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

.endpoint-row {
    display: block;
    padding: 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-main);
}
.endpoint-row:hover {
    background: var(--bg-overlay);
    text-decoration: none;
}
.endpoint-row p9r-tag {
    min-width: 5em;
    justify-content: center;
}

cms-json-editor {
    display: block;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: var(--bg-surface);
    overflow: hidden;
}
.json-editor__header {
    display: flex;
    justify-content: flex-end;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-base);
}
.json-editor__content { padding: 0.75rem; }
.json-editor__raw {
    width: 100%;
    min-height: 14rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
    border: 1px solid var(--border-default);
    border-radius: 4px;
    padding: 0.5rem;
    background: var(--bg-base);
    color: var(--text-main);
    box-sizing: border-box;
    resize: vertical;
}

/* Object row: label / input grid */
.json-row {
    display: grid;
    grid-template-columns: minmax(6rem, 10rem) 1fr;
    gap: 0.6rem;
    align-items: center;
    padding: 0.25rem 0;
}
.json-label {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8em;
    font-weight: 500;
    color: var(--text-label);
    overflow-wrap: anywhere;
}
.json-row__value { min-width: 0; }
.json-object { display: block; }

/* Array: stacked cards, each item collapsible via native <details> */
.json-array        { display: flex; flex-direction: column; gap: 0.4rem; }
.json-array__list  { display: flex; flex-direction: column; gap: 0.5rem; }
.json-array__row {
    border: 1px solid var(--border-default);
    border-radius: 6px;
    background: var(--bg-base);
    overflow: hidden;
}
.json-array__summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.4rem 0.4rem 0.6rem;
    user-select: none;
}
.json-array__summary::-webkit-details-marker { display: none; }
.json-array__summary::before {
    content: "▸";
    color: var(--text-muted);
    font-size: 0.65em;
    width: 0.85em;
    text-align: center;
    transition: transform 0.15s ease;
}
.json-array__row[open] > .json-array__summary::before { transform: rotate(90deg); }
.json-array__row[open] > .json-array__summary {
    border-bottom: 1px solid var(--border-light);
}
.json-array__index {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.7em;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border-light);
}
.json-array__summary > .json-btn--remove { margin-left: auto; }
.json-array__value   { display: block; padding: 0.65rem 0.8rem 0.75rem 1rem; }
.json-btn--add       { align-self: flex-start; }
.json-variant__slot { padding-top: 0.4rem; }

.json-input {
    font: inherit;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border-default);
    border-radius: 5px;
    background: var(--bg-surface);
    color: var(--text-main);
    box-sizing: border-box;
    width: 100%;
}
.json-input--bool { width: auto; }
.json-input--null { color: var(--text-muted); font-style: italic; }
.json-input:focus {
    outline: 2px solid var(--primary-base);
    outline-offset: -1px;
    border-color: var(--primary-base);
}

.json-btn {
    font: inherit;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border-default);
    border-radius: 5px;
    background: var(--bg-surface);
    color: var(--text-body);
    cursor: pointer;
}
.json-btn:hover:not(:disabled) { background: var(--bg-overlay); color: var(--text-main); }
.json-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.json-btn--remove {
    color: var(--danger-base);
    border-color: transparent;
    background: transparent;
}
.json-btn--remove:hover:not(:disabled) {
    background: var(--danger-muted);
    border-color: var(--danger-base);
    color: var(--danger-base);
}
.json-btn--mode {
    font-size: 0.85em;
    color: var(--primary-base);
    border-color: var(--primary-muted);
    background: var(--primary-muted);
}
.json-btn--mode:hover:not(:disabled) {
    background: var(--primary-base);
    color: var(--bg-surface);
    border-color: var(--primary-base);
}

.json-empty { color: var(--text-muted); font-style: italic; margin: 0.25rem 0; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
    padding: 0.1em 0.35em;
    background: var(--bg-base);
    border-radius: 4px;
}

/* Official-providers tab — responsive grid of collapsible cards. */
.official-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    align-content: start;
}
.official-card {
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: var(--bg-surface);
    overflow: hidden;
    align-self: start;
}
.official-card[open] { border-color: var(--primary-base); }
.official-card__summary {
    display: grid;
    grid-template-columns: 28px 1fr;
    column-gap: 12px;
    row-gap: 2px;
    padding: 14px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.1s;
}
.official-card__summary::-webkit-details-marker { display: none; }
.official-card__summary:hover { background: var(--secondary-muted); }
.official-card[open] > .official-card__summary { background: var(--primary-muted); }
.official-card__icon {
    grid-row: 1 / span 2;
    align-self: center;
    width: 28px; height: 28px;
    color: var(--primary-base);
}
.official-card__title  { font-weight: 600; color: var(--text-main); }
.official-card__tag    { font-size: 12px; color: var(--text-muted); }
.official-card__body   { padding: 12px 14px 14px; border-top: 1px solid var(--border-light); }