/* ── Configurator shell ──────────────────────────────────────────────────── */
.configurator {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* ── Nav tabs ────────────────────────────────────────────────────────────── */
.cfg-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-2);
    flex-wrap: wrap;
}
.cfg-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    font-size: .9rem;
    padding: .4rem .85rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    transition: all .15s;
}
.cfg-tab:hover  { background: var(--color-surface); color: var(--color-text); }
.cfg-tab.active {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 600;
    border-bottom-color: var(--color-primary);
}
.cfg-tab.danger { color: #f87171; }
.cfg-tab.danger:hover { background: rgba(248,113,113,.1); color: #fca5a5; }
.cfg-tab:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
.cfg-plan-badge {
    margin-left: auto;
    font-size: .75rem;
    font-weight: 700;
    background: var(--color-primary);
    color: #060c40;   /* dark navy — 6.5:1 contrast on #52adfb */
    padding: .2rem .65rem;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Unreachable banner ──────────────────────────────────────────────────── */
.cfg-unreachable {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    padding: .75rem 1.25rem;
    background: rgba(251,191,36,.08);
    border-bottom: 1px solid rgba(251,191,36,.25);
    font-size: .875rem;
    flex-wrap: wrap;
}
.cfg-unreachable strong { color: #fbbf24; white-space: nowrap; }
.cfg-unreachable span   { color: var(--color-text-muted); }

/* ── Body ────────────────────────────────────────────────────────────────── */
.cfg-body { padding: 1.75rem; }
.cfg-body section { min-height: 200px; }

/* ── Section header ──────────────────────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.section-header h2 { font-size: 1.1rem; margin: 0; }

/* ── Table ───────────────────────────────────────────────────────────────── */
.cfg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.cfg-table th {
    text-align: left;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .5rem 0;
    border-bottom: 1px solid var(--color-border);
}
.cfg-table td {
    padding: .75rem 0;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.cfg-table tr:last-child td { border: none; }
.cfg-table .actions { display: flex; gap: .5rem; justify-content: flex-end; }
.cfg-table .muted   { color: var(--color-text-muted); font-size: .82rem; }

/* ── Modal form inputs ───────────────────────────────────────────────────── */
.modal input[type="text"],
.modal input[type="url"],
.modal input[type="date"],
.modal input[type="password"],
.modal textarea,
.modal select {
    width: 100%;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: .6rem .9rem;
    color: var(--color-text);
    font-size: .95rem;
    color-scheme: dark;
}
.modal input[type="text"]:focus,
.modal input[type="url"]:focus,
.modal input[type="date"]:focus,
.modal input[type="password"]:focus,
.modal textarea:focus,
.modal select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(82,173,251,.25);
}

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
}
.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow);
}
.modal h3     { font-size: 1.15rem; margin-bottom: 1.25rem; }
.modal-footer { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ── Drop zone ───────────────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    transition: all .15s;
}
.drop-zone.drag-over { border-color: var(--color-primary); background: rgba(124,106,247,.06); }
.drop-zone .link { color: var(--color-primary); cursor: pointer; }

/* ── Inline row ──────────────────────────────────────────────────────────── */
.inline-row { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.5rem; }
.field-input {
    flex: 1;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: .6rem .9rem;
    color: var(--color-text);
    font-size: .95rem;
}
.field-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(82,173,251,.25);
}

/* ── Usage cards ─────────────────────────────────────────────────────────── */
.usage-card {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.usage-row { display: flex; justify-content: space-between; margin-bottom: .75rem; }
.usage-bar { height: 6px; background: var(--color-border); border-radius: 3px; margin-bottom: .5rem; }
.usage-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.usage-meta { display: flex; justify-content: space-between; font-size: .85rem; color: var(--color-text-muted); }

/* ── API cards ───────────────────────────────────────────────────────────── */
.api-card {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.api-card label { display: block; font-size: .8rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.api-key-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.api-key { font-family: monospace; font-size: .9rem; flex: 1; word-break: break-all; }
.api-key.blurred { filter: blur(5px); user-select: none; }
.api-url { font-family: monospace; font-size: .875rem; color: var(--color-text); display: block; word-break: break-all; }
.code-block {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-family: monospace;
    font-size: .8rem;
    overflow-x: auto;
    margin-top: .75rem;
    white-space: pre;
}

/* ── Danger card ─────────────────────────────────────────────────────────── */
.danger-card {
    background: rgba(248,113,113,.06);
    border: 1px solid rgba(248,113,113,.3);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.btn-danger {
    background: var(--color-error);
    color: #fff;
    border-color: transparent;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
    cursor: pointer;
    border: none;
    font-weight: 500;
}
.btn-danger:hover { opacity: .85; }

/* ── Pre-mount loader ────────────────────────────────────────────────────── */
.cfg-loader {
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}
.cfg-loader__track {
    width: 100%;
    max-width: 360px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}
.cfg-loader__bar {
    height: 100%;
    width: 10%;
    background: linear-gradient(90deg, #52adfb, #7ec8ff);
    border-radius: 2px;
    transition: width .4s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 0 8px rgba(82,173,251,.5);
}
.cfg-loader__label {
    font-size: .9rem;
    color: var(--color-text-muted);
    margin: 0;
}
.cfg-load-error {
    color: var(--color-error);
    padding: 2rem;
    text-align: center;
}

/* ── Section skeleton ────────────────────────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}
.skeleton {
    background: linear-gradient(90deg,
        var(--color-surface-2) 25%,
        rgba(255,255,255,.05) 50%,
        var(--color-surface-2) 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--radius-sm);
}
.skeleton-row {
    height: 14px;
    margin-bottom: .75rem;
}
.skeleton-row:last-child { margin-bottom: 0; }
.skeleton-row--sm  { width: 40%; }
.skeleton-row--md  { width: 65%; }
.skeleton-row--lg  { width: 90%; }
.skeleton-row--xl  { width: 100%; }

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .cfg-loader__bar,
    .usage-fill,
    .skeleton { animation: none !important; transition: none !important; }
}

/* ── Misc ────────────────────────────────────────────────────────────────── */
.empty { color: var(--color-text-muted); padding: 2rem 0; text-align: center; }
.help-text { font-size: .875rem; color: var(--color-text-muted); margin-top: .25rem; }
.notice { padding: 1rem 1.25rem; border-radius: var(--radius-sm); margin-top: 1rem; }
.notice--info { background: rgba(82,173,251,.1); border: 1px solid rgba(82,173,251,.3); font-size: .9rem; color: var(--color-text); }
.notice--info a { color: var(--color-primary); }
