.pill {
    background: var(--container);
    color: var(--primary);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
}

.status {
    color: var(--green);
    background: var(--green-bg);
    font-size: 11px;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 700;
}

.status.offline {
    color: var(--red);
    background: var(--red-bg);
}

.provider-card {
    padding: 26px;
    background: var(--surface);
    border-radius: var(--radius);
}

.provider-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.provider-icon {
    padding: 12px;
    background: #f0f2f7;
    border-radius: 16px;
    color: var(--ink);
}

.provider-card[data-provider="gemini"] .provider-icon {
    background: #e8edff;
    color: #526bd0;
}

h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.provider-subtitle {
    color: var(--muted);
    font-size: 11px;
}

.key-status {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
}

.key-status.configured {
    color: var(--green);
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink);
    display: block;
}

.field-row {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.field-row input {
    flex: 1;
    margin-bottom: 0;
}

input[type="text"], input[type="password"] {
    width: 100%;
    border: 0;
    background: var(--surface-alt);
    color: var(--ink);
    border-radius: 14px;
    padding: 13px 16px;
    font-size: 12px;
    transition: background .2s;
}

input:focus {
    background: #e9edfb;
}

.key-hint {
    color: var(--muted);
    font-size: 10px;
    margin: 6px 0 18px;
}

.provider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 11px;
    cursor: pointer;
}

input[role="switch"] {
    appearance: none;
    width: 38px;
    height: 24px;
    border: 0;
    border-radius: 16px;
    background: #dce0ed;
    margin: 0;
    padding: 3px;
    transition: background .2s;
    cursor: pointer;
}

input[role="switch"]::before {
    content: "";
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    transition: transform .2s var(--ease);
}

input[role="switch"]:checked {
    background: var(--primary);
}

input[role="switch"]:checked::before {
    transform: translateX(14px);
}

.filled-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 24px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 11px 18px;
    height: 42px;
    transition: all .2s;
}

.filled-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.outlined-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 14px;
    border: 1px solid #d2d7e8;
    background: white;
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    padding: 0 16px;
    height: 42px;
}

.outlined-button:hover {
    background: #f4f6fc;
}

.text-button {
    color: var(--muted);
    background: transparent;
    font-size: 11px;
    padding: 0;
}

.text-button:hover {
    color: var(--red);
}

.icon-button.square {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    padding: 0;
    background: transparent;
    color: var(--muted);
    flex-shrink: 0;
}

.icon-button.square:hover {
    background: var(--surface-alt);
    color: var(--ink);
}

.icon-button.square .material-symbols-rounded {
    font-size: 20px;
    line-height: 1;
}

.keys-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.keys-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border-radius: 14px;
    padding: 4px 12px;
    border: 1px solid #eef1f8;
    flex: 1;
    min-width: 260px;
    height: 45px;
}

.keys-search-wrap input {
    border: 0;
    background: transparent;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    outline: none;
}

.keys-search-wrap .search-icon {
    color: var(--muted);
    font-size: 20px;
}

#keys-sort-dropdown {
    height: 45px;

    button {
        height: 45px;
        border: 1px solid #eef1f8;
    }
}

.keys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.client-key-card {
    position: relative;
    padding: 22px;
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid #eef1f8;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.key-load-bar-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    overflow: hidden;
}

.key-load-svg {
    width: 100%;
    height: 5px;
    display: block;
}

.key-load-bg {
    fill: #f0f2f7;
}

.key-load-fill {
    fill: var(--primary);
    transition: width .3s var(--ease);
}

.key-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.load-badge {
    background: #eef2ff;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    border-radius: 8px;
    padding: 2px 8px;
}

.key-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 4px;
}

.key-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-code {
    font-family: monospace;
    font-size: 12px;
    background: var(--surface-alt);
    padding: 8px 12px;
    border-radius: 8px;
    word-break: break-all;
}

.badge {
    font-size: 9px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 10px;
    background: #eef2ff;
    color: var(--primary);
}

.key-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.leaderboard-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.lb-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 10px 14px;
    background: var(--surface-alt);
    border-radius: 10px;
    font-weight: 600;
}

.options-container.single {
    max-width: 820px;
}

.options-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.domain-card {
    margin-bottom: 20px;
}

.domain-status-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--green);
    background: var(--green-bg);
    padding: 5px 12px;
    border-radius: 8px;
    width: fit-content;
}

.fallback-divider {
    margin: 10px 0 4px;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.card-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.card-head .material-symbols-rounded {
    font-size: 28px;
    color: var(--primary);
}

.monaco-container {
    width: 100%;
    height: 350px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #dce0ed;
    background: white;
    margin-bottom: 16px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 24, 40, .6);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    z-index: 50;
    padding: 20px;
}

.modal-card {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 580px;
    padding: 32px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-card.large {
    max-width: 820px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-pill {
    padding: 16px;
    border-radius: 14px;
    background: var(--surface-alt);
    text-align: center;
}

.stat-pill.primary {
    background: var(--container);
    color: var(--primary);
}

.stat-pill .label {
    font-size: 11px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
}

.stat-pill strong {
    font-size: 24px;
}

.chart-wrapper {
    background: #fafbff;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 20px;
    border: 1px solid #e2e7f8;
}

.svg-chart {
    height: 160px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-wrapper-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.chart-svg {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.chart-axis {
    stroke: #e2e7f8;
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-cursor {
    stroke: #8b98e5;
    stroke-width: 1.5;
    stroke-dasharray: 3 3;
}

.chart-point {
    fill: #ffffff;
    stroke: var(--primary);
    stroke-width: 3;
}

.chart-tooltip {
    position: absolute;
    top: 10px;
    background: var(--ink);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: opacity .15s;
}

.chart-tooltip[data-pos="right"] {
    right: 20px;
    left: auto;
}

.chart-tooltip[data-pos="left"] {
    left: 20px;
    right: auto;
}

.stats-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.list-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 48px;
    justify-content: center;
}

.bar-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    padding: 8px 12px;
    background: var(--surface-alt);
    border-radius: 8px;
}

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 22px;
    border-radius: 18px;
    background: var(--ink);
    color: white;
    font-size: 12px;
    z-index: 100;
}

.endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0;
}

.endpoint-item {
    background: var(--surface-alt);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border: 1px solid #e2e7f8;
}

.endpoint-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
}

.endpoint-val-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.endpoint-val-row code {
    font-family: monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    word-break: break-all;
}

.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 24, 40, .4);
    backdrop-filter: blur(2px);
    display: grid;
    place-items: center;
    z-index: 120;
}

.md-spinner-wrap.small {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    padding: 0;
    display: grid;
    place-items: center;
}

.md-spinner {
    animation: md-rot 1.4s linear infinite;
}

.md-spinner-circle {
    stroke: var(--primary);
    stroke-linecap: round;
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
    animation: md-arc 1.4s ease-in-out infinite;
}

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@keyframes md-rot {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes md-arc {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35px;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124px;
    }
}
