/* Page-specific styles: services, overview, insights, merged settings dialogs. */

/* Services Section */
.service-card {
    background: var(--card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.service-card h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

/* Service status indicator */
/* Status point style */
.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-tertiary);
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.running {
    background: var(--green-ink);
    animation: pulse 2s infinite;
}

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

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Stats Section */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.section-header h2 {
    margin: 0;
}

/* Clickable stat card */
/* Logs Section */
.logs-section {
    margin-bottom: 24px;
}

.logs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.logs-header h2 {
    color: var(--text-primary);
    margin: 0;
}

.logs-actions {
    display: flex;
    gap: 8px;
}

.logs-container {
    background: var(--card);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.logs-table {
    min-height: 200px;
}

.log-header {
    display: grid;
    grid-template-columns: 140px 120px minmax(200px, 1fr) 80px 80px 200px 80px;
    gap: 10px;
    padding: 12px 16px;
    background: var(--fill);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.log-entries {
    min-height: 100px;
}

.log-entry {
    display: grid;
    grid-template-columns: 140px 120px minmax(200px, 1fr) 80px 80px 200px 80px;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--fill);
    align-items: start;
}

/* Service column wrapping style */
.log-entry span:nth-child(2) {
    white-space: pre-line;
    line-height: 1.4;
}

/* URL column wrapping style */
.log-entry span:nth-child(3),
.all-log-entries .log-entry span:nth-child(3),
.url-column {
    word-break: break-all;
    overflow-wrap: break-word;
    line-height: 1.4;
    white-space: normal;
}

.usage-cell {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    color: var(--text-secondary);
    white-space: pre-line;
    word-break: break-word;
    line-height: 1.4;
}

/* Detail button column is centered */
.log-entry > span:last-child {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 2px;
}

.log-entry:hover {
    background: var(--fill);
}

.log-entry.loading {
    display: block;
    text-align: center;
    color: var(--text-tertiary);
    padding: 20px;
    grid-column: 1 / -1;
}

/* Configure drawer style */
.config-drawer .el-drawer__header {
    padding: 20px 24px 16px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}

.config-drawer .el-drawer__body {
    padding: 0;
    background: var(--secondary);
}

.config-drawer-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    padding: 24px;
    overflow-y: auto;
}

.config-content {
    padding: 20px;
}

.config-tabs-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.config-tabs-pane .el-tabs__header {
    margin-bottom: 0;
    background: var(--card);
    border-radius: var(--radius) 12px 0 0;
    padding: 8px 8px 0;
}

.config-tabs-pane .el-tabs__content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    background: var(--card);
    border-radius: 0 0 12px 12px;
}

.config-tabs-pane .el-tab-pane {
    height: 100%;
    padding: 24px 28px;
}

/* Simple config card - cleaner design */
.simple-config-card {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    width: 100%;
}

.simple-config-card h3 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.simple-config-card p {
    margin: 0 0 20px;
    color: var(--text-tertiary);
    line-height: 1.6;
    font-size: 14px;
}

/* Auth mode selector - improved design */
.auth-mode-selector {
    margin-bottom: 24px;
    background: var(--secondary);
    border-radius: var(--radius);
    padding: 6px;
}

.auth-mode-selector .el-radio-group {
    display: flex;
    width: 100%;
    gap: 6px;
}

.auth-mode-selector .el-radio-button {
    flex: 1;
}

.auth-mode-selector .el-radio-button__inner {
    width: 100%;
    border: none !important;
    background: transparent !important;
    border-radius: 8px !important;
    font-weight: 500;
    padding: 12px 20px;
    transition: all 0.2s ease;
}

.auth-mode-selector .el-radio-button__inner:hover {
    background: var(--fill) !important;
}

.auth-mode-selector .el-radio-button.is-active .el-radio-button__inner {
    background: var(--card) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.auth-mode-selector .el-radio-button:first-child .el-radio-button__inner,
.auth-mode-selector .el-radio-button:last-child .el-radio-button__inner {
    border-radius: 8px !important;
}

/* Mode description - info box */
.mode-description {
    margin: 0 0 24px !important;
    padding: 14px 18px;
    background: var(--secondary);
    border-radius: var(--radius);
    border-left: 4px solid var(--border);
    font-size: 13px;
    line-height: 1.6;
    color: var(--accent-blue) !important;
}

/* Form fields - improved spacing */
.simple-config-card .config-field {
    margin-bottom: 20px;
}

.simple-config-card .config-field .field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.simple-config-card .config-field .el-input,
.simple-config-card .config-field .el-textarea {
    width: 100%;
}

.simple-config-card .config-field .el-input__wrapper,
.simple-config-card .config-field .el-textarea__inner {
    border-radius: var(--radius);
    padding: 10px 14px;
}

.simple-config-card .config-field .el-textarea__inner {
    min-height: 140px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* Config actions - better button layout */
.simple-config-card .config-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.simple-config-card .config-actions .el-button {
    padding: 10px 20px;
    font-weight: 500;
}

.editor-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 600px) {
}

/* Log details sidebar style */
.log-detail-drawer .log-detail-content {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vw, 20px);
}

/* Log Detail - Flow Based Layout */
/* Flow Diagram */
/* Request Timeline */
.request-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.header-row {
    display: flex;
    gap: 12px;
    padding: 6px 10px;
    background: var(--card);
    border-radius: 6px;
    font-size: 12px;
}

.header-key {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 120px;
    flex-shrink: 0;
}

.header-value {
    color: var(--text-tertiary);
    word-break: break-all;
}

.metric-label {
    font-size: 11px;
    color: var(--text-tertiary);
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.muted {
    color: var(--text-tertiary);
    font-size: 13px;
}

.usage-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.usage-value {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.usage-summary-card {
    background: var(--card);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.usage-summary-card h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 18px;
}

.usage-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    justify-items: start;
}

.usage-summary-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.usage-service-section {
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--fill);
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.usage-service-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.usage-service-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
}

.usage-total {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--text-secondary);
}

.usage-summary-grid.service-overall {
    background: var(--fill);
    padding: 12px;
    border-radius: 6px;
}

.usage-channel-table {
    border: 1px solid var(--fill);
    border-radius: 6px;
    overflow: hidden;
    overflow-x: auto;
}

.usage-channel-header,
.usage-channel-row {
    display: grid;
    grid-template-columns: 140px repeat(6, minmax(100px, 1fr));
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    align-items: center;
    min-width: 760px;
}

.usage-channel-header {
    background: var(--fill);
    font-weight: 600;
    color: var(--text-primary);
}

.usage-channel-row {
    border-top: 1px solid var(--fill);
}

.usage-channel-row .channel-name {
    font-weight: 500;
    color: var(--text-secondary);
}

.usage-channel-row span {
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
}

.usage-channel-empty {
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: center;
}

/* Request header style - tiling mode (remove bounding box) */
.headers-content {
    background: var(--card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-key {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 4px;
}

.header-value {
    color: var(--text-secondary);
    font-size: 14px;
    word-break: break-all;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
}

/* Request body style - true full screen mode */

/* All blog sidebar styles */
.all-logs-drawer .el-drawer__body {
    gap: clamp(12px, 2vw, 20px);
}

.all-logs-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: clamp(12px, 1.6vw, 18px);
}

.history-requests-section {
    margin-bottom: 16px;
}

.history-requests-section h3 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.all-logs-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--card);
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.history-count-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-summary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 0 12px 0;
}

.history-filter-row .el-select {
    min-width: 150px;
}

.log-toggle-control {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
}

.log-toggle-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.log-toggle-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.stats-actions {
    display: flex;
    gap: 8px;
}

.all-logs-table {
    flex: 1;
    overflow: hidden;
    background: var(--card);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.all-log-entries {
    flex: 1;
    overflow-y: auto;
}

/* Log details dialog style - maintain backwards compatibility */
.headers-content {
    background: var(--fill);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.header-key {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 150px;
    margin-right: 8px;
    word-break: break-all;
}

.header-value {
    color: var(--text-secondary);
    word-break: break-all;
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* All log dialog styles */
.all-logs-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--fill);
    margin-bottom: 16px;
}

/* Log table container */
.all-logs-table-container {
    position: relative;
    flex: 1;
    height: calc(100vh - 300px);
    min-height: 400px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
}

/* fixed header */
.log-header-fixed {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--secondary);
    border-bottom: 2px solid var(--border);
}

/* scroll content area */
.all-log-entries-scrollable {
    overflow-y: auto;
    height: calc(100% - 42px);
}

.history-pagination-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* Compatible with old styles - reserved for use elsewhere */
.all-logs-table {
    flex: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.all-log-entries {
    max-height: 50vh;
    overflow-y: auto;
}

/* Element Plus custom styles */
.el-select {
    max-width: 150px;
}

/* Drop-down box style in model selection pop-up window */
.model-selector-content .el-select {
    max-width: none;
    width: 100%;
}

.el-input__inner {
    font-family: inherit;
}

.el-textarea__inner {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    line-height: 1.4;
}

.el-button {
    border-radius: 4px;
}

.el-tag {
    border-radius: 3px;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    .log-header,
    .log-entry {
        grid-template-columns: 100px 100px 1fr 70px;
        font-size: 12px;
        gap: 8px;
    }

    /* Hide the time-consuming, Usage, and operation columns on small screens */
    .log-header span:nth-child(5),
    .log-header span:nth-child(6),
    .log-header span:nth-child(7),
    .log-entry span:nth-child(5),
    .log-entry span:nth-child(6),
    .log-entry span:nth-child(7) {
        display: none;
    }
    
}

@media (max-width: 480px) {
    .log-header,
    .log-entry {
        grid-template-columns: 1fr 1fr 2fr;
        gap: 8px;
    }

    /* Only display time, service, and URL columns on an ultra-small screen */
    .log-header span:nth-child(n+4),
    .log-entry span:nth-child(n+4) {
        display: none;
    }
}

/* Configuration editor new style */

/* Mode switch label */
/* Interactive mode container */
/* JSON Schema Container */
/* Configure form header */
.config-actions {
    display: flex;
    gap: 12px;
}

/* Configure site container */
/* Configure site card */
/* New site editor */
/* Active site card */
.hint-text {
    display: block;
    margin-top: 4px;
    color: var(--text-tertiary);
    font-size: 12px;
}

/* Configure field layout */
.config-field {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.field-label {
    min-width: 100px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    flex-shrink: 0;
}

/* Inline action button */
/* Configuration help information */
/* Responsive layout */
@media (max-width: 1200px) {
    .config-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .field-label {
        min-width: auto;
        text-align: left;
    }

}

@media (max-width: 768px) {
    .config-field {
        gap: 12px;
    }

}

/* Test result display area */
/* Real-time request area styles */
.realtime-section {
    margin-bottom: 24px;
}

.realtime-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.realtime-header h2 {
    color: var(--text-primary);
    margin: 0;
}

.realtime-status-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.realtime-container {
    background: var(--card);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.realtime-table-header {
    display: grid;
    grid-template-columns: 100px 180px 100px 80px 80px;
    gap: 12px;
    padding: 12px 16px;
    background: var(--fill);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.realtime-entries {
    max-height: 180px; /* About 4 rows high */
    overflow-y: auto;
}

.realtime-entry {
    display: grid;
    grid-template-columns: 100px 180px 100px 80px 80px;
    gap: 12px;
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--fill);
    align-items: center;
    cursor: pointer;
}

/* Real-time request path column wrapping style */
.realtime-entry span:nth-child(2) {
    word-break: break-all;
    overflow-wrap: break-word;
    line-height: 1.4;
    white-space: normal;
}

.realtime-entry:hover {
    background: var(--fill);
}

.no-realtime-requests {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px;
    font-style: italic;
}

/* Details Drawer Style */
.realtime-detail-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%;
}

.detail-basic-info {
    flex-shrink: 0;
}

.detail-response-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.detail-response-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.response-stream-container {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    min-height: 300px;
}

.response-stream-content {
    height: 100%;
    overflow-y: auto;
    background: var(--page);
    color: var(--text-secondary);
    padding: 16px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.response-stream-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.no-response {
    color: var(--text-tertiary);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.detail-headers-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.headers-content {
    background: var(--fill);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px;
}

.headers-content pre {
    margin: 0;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-primary);
}

/* Scroll bar style */
.realtime-entries::-webkit-scrollbar,
.response-stream-content::-webkit-scrollbar {
    width: 6px;
}

.realtime-entries::-webkit-scrollbar-track,
.response-stream-content::-webkit-scrollbar-track {
    background: var(--fill);
}

.realtime-entries::-webkit-scrollbar-thumb,
.response-stream-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.realtime-entries::-webkit-scrollbar-thumb:hover,
.response-stream-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive design - real-time request area */
@media (max-width: 768px) {
    .realtime-table-header,
    .realtime-entry {
        grid-template-columns: 80px 150px 80px 60px 60px;
        font-size: 12px;
    }

    .realtime-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .connection-status {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .realtime-table-header,
    .realtime-entry {
        grid-template-columns: 70px 120px 70px 50px;
        gap: 8px;
    }

    /* Hide action bar on extra small screens */
    .realtime-table-header span:nth-child(5),
    .realtime-entry span:nth-child(5) {
        display: none;
    }
}

/* Model routing management style */
.api-key-section {
    margin: 0 0 24px;
}

.codex-api-key-inline {
    margin: 0 0 24px 0;
}

.api-key-card {
    background: linear-gradient(135deg, var(--card) 0%, var(--fill) 100%);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.api-key-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.api-key-header h2 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.api-key-subtitle {
    color: var(--text-tertiary);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.api-key-input {
    margin-top: 0;
}

.api-key-input .el-input__wrapper {
    border-radius: var(--radius);
    padding: 8px 12px;
}

.api-key-visibility {
    margin-top: 12px;
}

.api-key-visibility .el-checkbox__label {
    font-size: 13px;
    color: var(--text-tertiary);
}

.api-key-actions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.api-key-actions .el-button {
    border-radius: 8px;
}

/* Version gate editor: one rule per row, wraps on narrow drawers. */
.version-rule-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}
.version-rule-row:last-of-type {
    border-bottom: none;
}
.prompts-toggle {
    margin-right: 4px;
}

.api-key-hint {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--secondary);
    border-radius: 8px;
    color: var(--text-tertiary);
    font-size: 12px;
    line-height: 1.5;
}

.api-key-hint code {
    background: var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Model route mapping styles */
.mapping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.mapping-header h4 {
    margin: 0;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
}

.mapping-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mapping-item {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.mapping-form {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 16px;
    align-items: end;
}

.mapping-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mapping-field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.mapping-arrow {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.mapping-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.empty-mapping {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-mapping p {
    margin: 0;
    font-size: 14px;
}

.mapping-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--input);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Responsive Design - Map Drawer */
@media (max-width: 768px) {
    .mapping-form {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .mapping-arrow {
        display: none;
    }

    .mapping-footer {
        padding: 16px;
    }
}

/* tight horizontal layout style */
.mapping-form-horizontal {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--secondary);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.mapping-field-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mapping-field-compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mapping-field-compact label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.mapping-arrow-compact {
    font-size: 18px;
    color: var(--text-secondary);
    font-weight: bold;
    margin: 0 8px;
    align-self: flex-end;
    margin-bottom: 24px;
}

.mapping-actions-compact {
    align-self: flex-end;
    margin-bottom: 24px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mapping-field-group {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .mapping-field-compact {
        width: 100%;
    }

    .mapping-field-compact .el-input,
    .mapping-field-compact .el-select {
        width: 100% !important;
    }

    .mapping-arrow-compact {
        align-self: center;
        margin: 0;
        transform: rotate(90deg);
    }

    .mapping-actions-compact {
        align-self: stretch;
        margin-bottom: 0;
    }
}

/* Model routing: route list on the left, one route open on the right */
.routing-page { background: var(--background); }
.routing-page-shell { width: 100%; display: flex; flex-direction: column; min-height: calc(100vh - 120px); }
.routing-filter { flex: none; }
.routing-list-tag { flex: none; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; padding: 1px 5px; border-radius: 5px; background: var(--fill); color: var(--text-tertiary); }
.routing-list-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.routing-list-chain { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; font-size: 11.5px; color: var(--text-secondary); line-height: 1.3; }
.routing-list-hop { display: inline-flex; align-items: center; gap: 4px; }
.routing-list-hop::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--green-ink); flex: none; }
.routing-list-hop.tone-warning::before { background: var(--amber); }
.routing-list-hop.tone-danger::before, .routing-list-hop.tone-error::before { background: var(--red); }
.routing-list-hop.tone-empty::before { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.routing-list-hop.is-paused { text-decoration: line-through; color: var(--text-tertiary); }
.routing-list-hop.is-paused::before { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
/* The gateway is currently trying this channel last for the route's model. */
.routing-list-hop.is-degraded::before { background: var(--amber); }
.routing-list-hop-note { font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; padding: 0 4px; border-radius: 4px; background: var(--amber-fill); color: var(--amber); }
.routing-degraded-badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 1px 6px; border-radius: 5px; font-size: 10.5px; white-space: nowrap; font-variant-numeric: tabular-nums; background: var(--amber-fill); color: var(--amber); cursor: help; }
/* Rail rows: number · model + chain · live. Same rhythm as the Channels rail. */
/* Only the dot carries a hop's state; the label stays neutral so a bad day is not a wall of red. */
.routing-page .routing-list-hop.tone-warning, .routing-page .routing-list-hop.tone-danger, .routing-page .routing-list-hop.tone-error { color: inherit; }
.routing-empty-actions { display: flex; justify-content: center; margin: 12px 0; }
/* Header: the client model is the card's title, editable in place. */
.routing-card-header { padding-bottom: 6px; }
.routing-model-field { flex: 0 1 auto; min-width: 160px; width: 300px; max-width: 100%; }
.routing-card-header .cfg-conn { margin-left: -4px; }
.routing-field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.routing-model-input .el-input__wrapper { padding: 0 8px; margin-left: -8px; background: transparent; box-shadow: none; }
.routing-model-input:hover .el-input__wrapper, .routing-model-input .el-input__wrapper.is-focus { box-shadow: 0 0 0 1px var(--border) inset; }
.routing-model-input .el-input__inner { font-size: 16px; font-weight: 600; color: var(--ink); }
.routing-cell-label { display: none; }
/* Accounts: one bar per enabled account, wrapping; the sentence under it says what they add up to. */
.routing-hop-brief { font-size: 11px; color: var(--text-tertiary); }
.routing-hop-brief.tone-warning { color: var(--amber); }
.routing-hop-brief.tone-danger, .routing-hop-brief.tone-error { color: var(--red); }
.ui-channel-accounts-none.is-pending { color: var(--text-tertiary); }
/* Reorder: drag the grip (it takes the number's place while the row is hovered); ↑ ↓ stay for the keyboard. */
.routing-grip { grid-area: num; z-index: 1; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--card); color: var(--text-tertiary); font-size: 14px; line-height: 1; cursor: grab; opacity: 0; user-select: none; }
.routing-channel-row:hover .routing-grip, .routing-channel-row:focus-within .routing-grip { opacity: 1; }
.routing-channel-row.is-dragging { opacity: .4; }
.routing-channel-row.is-drop-target { box-shadow: inset 0 2px 0 var(--accent-blue); }
.routing-channel-row:hover .routing-move, .routing-channel-row:focus-within .routing-move { opacity: 1; }
@media (hover: none) { .routing-grip, .routing-channel-actions .routing-move { opacity: 1; } }
/* The editor lays its rows out against its own width (container query), so
   the same markup works beside the route list, alone on a narrow screen, and
   inside a half-width browser window without ever clipping the row actions. */
.routing-detail { min-width: 0; container-type: inline-size; }
.routing-editor { border: 0; padding: 0; margin: 0; min-width: 0; }
.routing-card.is-disabled { border-style: dashed; }
.routing-card.is-disabled .routing-channel-list, .routing-card.is-disabled .models-summary { opacity: .55; }
/* Header: the client model is the route's name, so it gets the space; on/off and delete sit at the right. */
.routing-enable { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); cursor: pointer; user-select: none; min-width: 56px; }
.routing-enable-toggle { margin: 0; flex: none; }
/* Protocol hint: guidance for the client, not a control. */
/* Channel row: the same anatomy as a Channels ledger row (models.css). */
.routing-channel-columns { display: none; }
.routing-channel-list { list-style: none; margin: 0; padding: 0; }
/* A paused channel keeps its row but reads as inactive; the toggle stays crisp. */
.routing-channel-row.is-paused > :not(.routing-channel-actions):not(.routing-grip) { opacity: .45; }
.routing-priority-number { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--text-primary); font-weight: 600; font-size: 12px; box-sizing: border-box; }
.routing-hop-field, .routing-hop-model { min-width: 0; }
.routing-channel-row .el-select { width: 100%; max-width: none; }
.routing-health-placeholder { font-size: 12px; color: var(--text-tertiary); padding-left: 4px; }
/* One save bar for the whole routing table: always in the same place, sticky
   at the bottom so Save is reachable from any row. */
.routing-save-bar.admin-save-bar { position: sticky; bottom: 0; z-index: 3; margin-top: 12px; padding: 10px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.routing-save-bar.is-dirty { border-color: var(--amber); box-shadow: 0 -6px 18px rgba(0, 0, 0, .18); }
.routing-save-bar .admin-save-note { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.routing-unsaved { color: var(--amber); }
.routing-saved { color: var(--text-tertiary); }
.routing-kbd { font: inherit; font-size: 10.5px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-tertiary); }
.routing-list-edit { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; padding: 1px 5px; border-radius: 5px; background: var(--amber-fill); color: var(--amber); }
.sidebar-unsaved-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); margin-left: auto; flex: none; }

/* Channel accounts: one usage bar per enabled account, numbers only in the tooltip. */
.ui-channel-accounts { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; width: 100%; min-height: 40px; padding: 6px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.ui-channel-accounts:hover { background: var(--fill); border-color: var(--border); }
.ui-channel-accounts:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ui-channel-accounts-none { font-size: 11px; color: var(--red); }
.ui-channel-accounts-row { display: grid; grid-template-columns: minmax(0, 1fr) 3.5ch; align-items: center; gap: 8px; }
.ui-channel-accounts-row.has-pool { grid-template-columns: 42px minmax(0, 1fr) 3.5ch; }
.ui-channel-accounts-pool { font-size: 10.5px; color: var(--text-tertiary); line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.state-warning .ui-channel-accounts-pool { color: var(--amber); }
.state-danger .ui-channel-accounts-pool { color: var(--red); }
.ui-channel-accounts-row.is-excluded { opacity: .35; }
.ui-channel-accounts-bar { display: block; height: 6px; border-radius: 3px; background: var(--secondary); overflow: hidden; }
.ui-channel-accounts-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent-blue); transition: width .3s; }
.state-warning .ui-channel-accounts-bar > span { background: var(--amber); }
.state-danger .ui-channel-accounts-bar > span { background: var(--red); }
.state-error .ui-channel-accounts-bar { background: repeating-linear-gradient(135deg, var(--red) 0 3px, transparent 3px 6px); opacity: .6; }
.state-loading .ui-channel-accounts-bar { background: repeating-linear-gradient(90deg, var(--secondary) 0 6px, var(--fill) 6px 12px); }
.state-unsupported .ui-channel-accounts-bar, .state-empty .ui-channel-accounts-bar { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.ui-channel-accounts-pct { font-size: 10.5px; font-variant-numeric: tabular-nums; text-align: right; color: var(--text-tertiary); line-height: 1; }
.state-warning .ui-channel-accounts-pct { color: var(--amber); }
.state-danger .ui-channel-accounts-pct, .state-error .ui-channel-accounts-pct { color: var(--red); }
.ui-channel-accounts-tip { font-size: 11.5px; line-height: 1.5; max-width: 320px; }
.ui-channel-accounts-tip-head { display: flex; flex-direction: column; margin-bottom: 4px; }
.ui-channel-accounts-tip-head span { opacity: .7; font-size: 10.5px; }
.ui-channel-accounts-tip-meta { display: flex; gap: 10px; margin-bottom: 4px; opacity: .85; }
.ui-channel-accounts-tip-window { display: grid; grid-template-columns: 5.5em minmax(70px, 1fr) 3.5em auto; align-items: center; gap: 8px; margin-top: 2px; }
.ui-channel-accounts-tip-window strong { font-variant-numeric: tabular-nums; text-align: right; }
.ui-channel-accounts-tip-window small { opacity: .7; }
.ui-channel-accounts-tip-meter { height: 4px; border-radius: 2px; background: rgba(255,255,255,.18); overflow: hidden; }
.ui-channel-accounts-tip-meter > span { display: block; height: 100%; background: var(--green-ink); }
.ui-channel-accounts-tip-meter > .tone-warning { background: var(--amber); }
.ui-channel-accounts-tip-meter > .tone-danger { background: var(--red); }
/* Live 5m: this route model's requests on this channel, same chart as Models. */
.routing-live-label { display: flex; align-items: center; gap: 6px; }
.routing-live-empty { font-size: 11px; color: var(--text-tertiary); }
/* Time to first content, same 5m x axis as the request chart above it. Blue
   is the bucket median, dashed amber its p95; every chart in the same list
   shares one scale so height means the same thing across sites. */
.latency-spark { position: relative; min-height: 20px; width: 100%; cursor: help; }
.latency-spark svg { display: block; }
.latency-spark-summary { position: absolute; right: 0; top: -1px; font-size: 10px; line-height: 1; padding: 1px 4px; border-radius: 4px; background: var(--card); color: var(--accent-blue); font-variant-numeric: tabular-nums; pointer-events: none; }
.latency-spark.empty { display: flex; align-items: center; }
.latency-spark-empty { font-size: 10px; color: var(--text-tertiary); }
.settings-activity-cell .latency-spark { margin-top: 4px; }
/* The same "1.5s" wherever a Live 5m request count is shown: median time to
   first content over the window. Blue, like the spark's median line. */
.live-latency { color: var(--accent-blue); font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.routing-page .tone-warning { color: var(--amber); }
.routing-page .tone-danger { color: var(--red); }
.routing-page .tone-muted, .routing-muted { color: var(--text-tertiary); }
.routing-page .tone-ok { color: var(--text-secondary); }

/* ==================== Merge Mode Style ==================== */

.merged-config-dialog.el-dialog:not(.is-fullscreen) {
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 920px);
}

.merged-config-dialog .el-dialog__body {
    padding: 8px 20px 16px;
    overflow-y: auto;
}

.merged-dialog-form {
    padding-top: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.merged-section {
    padding: 14px 16px 6px;
    border: 1px solid var(--border);
    background: var(--fill);
}

.merged-section-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.merged-section-head strong {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.merged-section-head span {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.45;
}

.merged-channel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px 92px;
    gap: 12px;
    align-items: start;
}

.merged-enabled-group .el-form-item__content {
    min-height: 32px;
    align-items: center;
}

.merged-token-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.6;
}

.merged-weight-group .el-input-number {
    width: 100%;
}

.merged-dialog-form .el-form-item {
    margin-bottom: 14px;
}

.merged-dialog-form .el-form-item__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.3;
    padding-bottom: 6px;
}

.merged-mode-group .el-form-item__content {
    display: block;
}

.merged-mode-radio-group {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
}

.merged-mode-radio-group .el-radio-button {
    flex: 1 1 0;
    min-width: 0;
}

.merged-mode-radio-group .el-radio-button__inner {
    width: 100%;
    text-align: center;
    /* Four modes share this row; trim padding instead of clipping the label,
       which turned "Token/API Key" into "Token/AP...". */
    padding-left: 8px;
    padding-right: 8px;
    font-size: 13px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

@media (max-width: 900px) {
    .merged-mode-radio-group { flex-wrap: wrap; }
    .merged-mode-radio-group .el-radio-button { flex: 1 1 46%; }
}

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

.merged-dialog-footer {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .merged-channel-grid,
    .cursor-identity-grid {
        grid-template-columns: 1fr;
    }

    .merged-dialog-footer {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .merged-dialog-footer .el-button {
        flex: 1 1 calc(50% - 6px);
    }

    .merged-mode-radio-group {
        flex-wrap: wrap;
    }

    .merged-mode-radio-group .el-radio-button {
        flex: 1 1 calc(50% - 4px);
    }

}

@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .all-logs-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stats-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

}

@media (max-width: 600px) {
    .config-tabs {
        flex-wrap: wrap;
    }

    .config-tabs .el-button {
        flex: 1 1 45%;
    }

    .usage-summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
}

/* ==================== Interactive Flow Diagram ==================== */

/* Flow Stage - Clickable Wrapper */
/* Stage Node */
/* Status-based styling */
/* Stage Status Badge */
/* Flow Connection - Arrows */
/* Flow Stage Hint */
/* Stage Detail Panel */
.detail-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.detail-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Responsive Design - Interactive Flow */
@media (max-width: 768px) {
}

@media (max-width: 480px) {
}

/* ==================== Log Detail Comprehensive Sections ==================== */

/* =============================================
   Edge-based Log Detail Tabs
   ============================================= */

/* Compact Header */
.log-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--secondary);
    border-bottom: 1px solid var(--border);
    margin: -20px -20px 0;
}

.header-status {
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 18px;
}

.header-status.success { background: var(--green-fill); color: var(--green-ink); }
.header-status.danger { background: var(--red-fill); color: var(--red); }
.header-status.warning { background: var(--amber-fill); color: var(--amber); }
.header-status.info { background: var(--secondary); color: var(--text-secondary); }

.header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-size: 13px;
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.share-url-display {
    max-width: 360px;
}

.share-url-display .el-input {
    font-size: 12px;
}

.route-reason-alert {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 0 0 14px;
    padding: 9px 12px;
    border: 1px solid var(--accent-blue);
    border-radius: 8px;
    background: var(--accent-blue-fill);
    color: var(--accent-blue);
    font-size: 12px;
    line-height: 1.5;
}
.route-reason-alert strong { flex: 0 0 auto; }
.route-reason-alert span { overflow-wrap: anywhere; }

.user-message-section {
    margin: 0 -20px;
    padding: 10px 16px;
    background: var(--amber-fill);
    border-bottom: 1px solid var(--amber-fill);
}
.user-message-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--amber);
    margin-bottom: 4px;
}
.user-message-content {
    font-size: 13px;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
}

.header-info .info-sep { opacity: 0.4; }
.header-info .info-service { font-weight: 600; color: var(--text-secondary); }

/* Edge Flow Tabs - Two Edges Design */
.edge-flow-tabs {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.edge-flow-tabs.two-edges .edge-tab {
    flex: 1;
}

.edge-tab {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background: var(--secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.edge-tab:hover {
    background: var(--secondary);
    border-color: var(--border);
}

.edge-tab.active {
    background: var(--card);
    border-color: var(--text-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.edge-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.edge-tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.edge-tab-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

.edge-tab-urls {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.edge-url-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.edge-url-row .url-label {
    color: var(--text-muted);
    min-width: 36px;
}

.edge-url-row code {
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edge-tab-urls .empty-text {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

/* Edge Tab Panels */
.edge-tab-panels {
    padding: 16px 0;
}

.edge-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.empty-panel {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Edge Sections (Request/Response) */
.edge-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.edge-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--fill) 0%, var(--fill) 100%);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

.edge-section-title.request {
    color: var(--text-secondary);
}

.edge-section-title.request svg {
    color: var(--text-secondary);
}

.edge-section-title.response {
    color: var(--green-ink);
}

.edge-section-title.response svg {
    color: var(--green-ink);
}

.edge-section-title .el-tag {
    margin-left: auto;
}

.edge-section-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* URL Display */
.url-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--secondary);
    border-radius: 8px;
}

.url-display code {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
}

/* Meta Line */
.meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.meta-line strong {
    color: var(--text-secondary);
}

.meta-line code {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Collapsible Sections */
.collapsible-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--secondary);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    transition: background 0.15s ease;
}

.collapsible-header:hover {
    background: var(--secondary);
}

.collapsible-header .count {
    color: var(--text-muted);
    font-weight: 400;
}

.collapsible-header .truncation-tag {
    margin-left: 4px;
}

.collapsible-header .el-button {
    margin-left: auto;
}

.collapsible-header .el-button + .el-button {
    margin-left: 0;
}

.collapsible-body {
    border-top: 1px solid var(--border);
}

.collapsible-body .headers-table {
    padding: 8px 14px;
}

.collapsible-body .code-textarea {
    border: none;
    border-radius: 0;
}

.code-block {
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 14px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
    max-height: 500px;
    overflow-y: auto;
}

.code-block.empty {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.json-key { color: var(--text-secondary); }
.json-string { color: var(--text-muted); }
.json-number { color: var(--text-tertiary); }
.json-boolean { color: var(--text-muted); }
.json-null { color: var(--text-muted); }

.collapsible-body .empty-hint {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.truncation-hint {
    margin: 10px 14px 0;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--amber-fill);
    background: var(--amber-fill);
    color: var(--amber);
    font-size: 12px;
}

.request-body-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px 0;
}

.request-body-analysis {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px 0;
}

.request-body-analysis-summary {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.request-body-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
}

.request-body-analysis-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
}

.request-body-analysis-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.request-body-analysis-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.request-body-analysis-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.request-body-tab {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.request-body-tab:hover {
    border-color: var(--border);
    background: var(--fill);
}

.request-body-tab.active {
    border-color: var(--text-tertiary);
    background: var(--fill);
    color: var(--text-secondary);
}

.request-body-tab-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
}

.request-body-tab-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 11px;
    color: var(--text-muted);
}

.request-body-tab-panel {
    margin: 12px 14px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card);
}

.request-body-tab-panel-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    background: var(--fill);
    border-bottom: 1px solid var(--border);
}

.request-body-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.request-body-section-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.request-body-section-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.request-body-tab-panel .code-block {
    border-radius: 0;
    max-height: 420px;
}

.request-body-tabs + .code-block {
    margin: 12px 14px 0;
    max-height: 420px;
}

/* Usage Row */
.usage-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    background: var(--secondary);
    border-radius: 8px;
}

.usage-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.usage-chip .usage-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-chip .usage-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.panel-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.panel-meta .meta-item strong {
    color: var(--text-tertiary);
}

.usage-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.usage-value {
    font-weight: 600;
    color: var(--text-secondary);
}

.failover-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--amber-fill);
    border-radius: 8px;
    font-size: 13px;
    color: var(--amber);
}

.headers-table.compact {
    padding: 8px 14px;
}

/* Request URL Block */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--fill) 0%, var(--fill) 100%);
    border-bottom: 1px solid var(--border);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Meta Row */
/* Subsection */
/* Headers Table */
.headers-table {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.headers-table .header-row {
    display: flex;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.headers-table .header-row:last-child {
    border-bottom: none;
}

.headers-table .header-row:nth-child(odd) {
    background: var(--card);
}

.headers-table .header-key {
    flex: 0 0 180px;
    font-weight: 600;
    color: var(--text-tertiary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    word-break: break-all;
}

.headers-table .header-value {
    flex: 1;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    word-break: break-all;
}

.empty-hint {
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    padding: 12px;
    text-align: center;
    background: var(--secondary);
    border-radius: 8px;
}

/* Code Textarea */
/* Info Grid Compact */
/* Failover Info */
/* Timing Breakdown */
/* Metrics Grid */
.metrics-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-meta {
        flex-wrap: wrap;
    }

    .headers-table .header-key {
        flex: 0 0 120px;
    }

}

/* Failover Tag */
.failover-tag {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.failover-tag svg {
    vertical-align: middle;
}

/* ============== Keys Page ============== */
.keys-page {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.keys-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.keys-hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-filter {
    display: flex;
    align-items: center;
}

.keys-date-filter .el-input__wrapper {
    box-shadow: none;
    border: 1px solid var(--border);
    background: var(--card);
}

.quick-days-bar {
    display: flex;
    gap: 4px;
}
.quick-days-bar .el-button {
    min-width: 36px;
    padding: 4px 8px;
}

.ui-date-range-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ui-date-range-bar .el-input__wrapper {
    box-shadow: none;
    border: 1px solid var(--border);
    background: var(--card);
}

/* Keys Table */
.keys-table-wrap {
    overflow-x: auto;
}

.keys-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: transparent;
}

.keys-table colgroup col,
.keys-table-header tr,
.keys-table-row {
    width: 100%;
}

.keys-table-header th {
    font-size: 11px;
    color: var(--text-secondary);
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    padding: 0 6px 12px;
}

.keys-table-header th:last-child {
    text-align: right;
}

.keys-table-row {
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.keys-table-row td {
    padding: 16px 6px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.keys-table tbody tr:last-child td {
    border-bottom: none;
}

.keys-table-row:hover {
    background: rgba(248, 250, 252, 0.78);
}

.keys-table-row.inactive {
    opacity: 0.56;
}

.keys-col-primary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.keys-col-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.keys-col-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
}

.keys-col-traffic {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.keys-col-traffic strong {
    color: var(--text-primary);
    font-weight: 600;
}

.keys-col-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.keys-col-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    white-space: nowrap;
}

.keys-col-actions .el-button {
    min-height: 30px;
    padding: 0 10px;
    color: var(--text-secondary);
}

.keys-col-actions .el-button:hover {
    color: var(--text-primary);
}

.key-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 999px;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-secondary);
}

.key-status-badge.active {
    background: var(--border);
    color: var(--text-primary);
}

/* Empty State */
.keys-empty-state {
    text-align: center;
    padding: 72px 24px;
}

/* Key Dialogs */
.key-form-dialog .el-dialog {
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.16);
}

.key-form-dialog .el-dialog__header {
    margin-right: 0;
    padding: 20px 22px 0;
}

.key-form-dialog .el-dialog__body {
    padding: 0 22px 22px;
}

.key-form-dialog .el-dialog__footer {
    padding: 0 22px 22px;
}

.key-form-dialog .el-input__wrapper,
.key-form-dialog .el-select__wrapper,
.key-form-dialog .el-textarea__inner,
.key-form-dialog .el-date-editor.el-input__wrapper,
.key-form-dialog .el-date-editor .el-input__wrapper {
    box-shadow: none;
    border: 1px solid var(--border);
    background: var(--card);
}

.key-form-dialog .el-input__wrapper.is-focus,
.key-form-dialog .el-select__wrapper.is-focused,
.key-form-dialog .el-date-editor.el-input__wrapper.is-focus,
.key-form-dialog .el-date-editor .el-input__wrapper.is-focus {
    box-shadow: inset 0 0 0 1px var(--text-primary);
    border-color: var(--text-primary);
}

.key-form-dialog .el-input-number {
    width: 100%;
}

.key-form-dialog .el-input-number .el-input__wrapper {
    width: 100%;
}

.key-edit-dialog .el-dialog__body {
    padding-top: 0;
}

.ked-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ked-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.ked-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ked-section-label {
    margin-top: 2px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ked-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.ked-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ked-field > label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.ked-field-switch {
    justify-content: center;
    align-items: flex-start;
    padding-top: 24px;
}

.ked-sites {
    margin-top: 12px;
}

.ked-sites,
.site-selection-container {
    padding: 14px 16px;
    background: var(--fill);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.ked-site-group,
.service-group {
    margin-bottom: 14px;
}

.ked-site-group:last-child,
.service-group:last-child {
    margin-bottom: 0;
}

.ked-site-group-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: capitalize;
}

.ked-site-group .el-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 4px;
}

.service-group-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: capitalize;
}

.service-group .el-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 4px;
}

.service-group .el-checkbox,
.ked-site-group .el-checkbox {
    margin-right: 0;
}

.ked-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.ked-footer-right {
    display: flex;
    gap: 8px;
}

.keys-empty-state .empty-icon {
    color: var(--text-tertiary);
    margin-bottom: 18px;
}

.keys-empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.keys-empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0 auto 24px;
    max-width: 440px;
}

.key-created-success {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.success-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-header .success-icon {
    font-size: 30px;
    color: var(--text-primary);
}

.success-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.created-key-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--fill);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.created-key-box label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.key-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.key-display code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--card);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    word-break: break-all;
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

@media (max-width: 900px) {
    .keys-table {
        min-width: 840px;
    }

    .keys-table-header {
        display: none;
    }
}

@media (max-width: 640px) {
    .keys-hero-actions {
        align-items: stretch;
    }

    .keys-date-filter,
    .keys-date-filter .el-date-editor {
        width: 100%;
    }

    .ked-field-row {
        grid-template-columns: 1fr;
    }

    .key-display,
    .ked-footer,
    .ked-footer-right {
        flex-direction: column;
        align-items: stretch;
    }

    .ked-field-switch {
        padding-top: 0;
    }

    .ked-footer-right .el-button,
    .ked-footer > .el-button,
    .key-display .el-button {
        width: 100%;
    }
}

/* Setup Guide in Keys Page */
/* Key Created Success Dialog */
.key-created-success {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.success-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.success-header .success-icon {
    font-size: 30px;
    color: var(--text-primary);
}

.success-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.created-key-box {
    padding: 16px;
    background: var(--fill);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.created-key-box label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.key-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.key-display code {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--card);
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    word-break: break-all;
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* Key count badge in nav */
/* Responsive */
@media (max-width: 768px) {
    .ui-page-hero,
    .keys-hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .keys-table {
        font-size: 13px;
    }

    .key-display,
    .ked-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .ked-footer-right {
        display: flex;
        flex-direction: column;
    }
}

/* ============== Costs Page ============== */
.costs-page {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.costs-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.costs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.costs-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.costs-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.costs-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.summary-card {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}

.summary-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.summary-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.costs-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.costs-section h3 {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 12px;
    color: var(--text-tertiary);
}

.text-danger {
    color: var(--red);
}

.costs-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.snapshot-detail h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.snapshot-detail h4 {
    font-size: 14px;
    font-weight: 500;
    margin: 16px 0 8px;
    color: var(--text-secondary);
}

/* ============== Key Detail Page ============== */
.key-detail-page { padding: 24px; max-width: 1200px; margin: 0 auto; }
.key-detail-container { min-height: 400px; }
.key-detail-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.key-detail-id-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(248, 250, 252, 0.92);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}
.key-detail-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.key-detail-hero-actions .el-input__wrapper {
    box-shadow: none;
    border: 1px solid var(--border);
    background: var(--card);
}

.key-detail-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
}
.key-detail-metrics-grid .ui-metric-card:last-child .ui-metric-hint {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.01em;
    word-break: break-all;
}

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

/* Trend chart */
.kd-trend-chart { width: 100%; height: auto; }
.kd-trend-legend {
    display: flex; gap: 16px; justify-content: center;
    margin-top: 8px; font-size: 11px; color: var(--text-muted);
}
.kd-trend-legend span { display: flex; align-items: center; gap: 5px; }
.kd-trend-legend-bar { width: 12px; height: 8px; border-radius: 2px; background: rgba(17,24,39,0.18); }
.kd-trend-legend-line { width: 14px; height: 2px; border-radius: 1px; background: var(--text-primary); }

/* Donut */
.kd-donut-wrap { display: flex; flex-direction: column; align-items: center; }
.kd-donut-legend { width: 100%; margin-top: 12px; }
.kd-donut-legend-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: default;
    border-top: 1px solid var(--border);
}
.kd-donut-legend-item:first-child { border-top: none; padding-top: 0; }
.kd-donut-legend-item.clickable,
.kd-client-row.clickable {
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
}
.kd-donut-legend-item.clickable:hover,
.kd-client-row.clickable:hover,
.kd-donut-legend-item.active,
.kd-client-row.active {
    background: rgba(37, 99, 235, 0.06);
}
.kd-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-secondary);
    font-size: 12px;
}
.kd-filter-chip strong {
    color: var(--text-primary);
    font-weight: 600;
}
.kd-donut-legend-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.kd-donut-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kd-donut-legend-model {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-weight: 600;
}
.kd-donut-legend-share {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}
.kd-donut-legend-bar {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
}
.kd-donut-legend-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--text-primary) 0%, var(--text-secondary) 100%);
}
.kd-donut-legend-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--text-secondary);
    font-size: 11px;
}
.kd-donut-legend-cost {
    margin-left: auto;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 700;
}

/* Log card */
.key-detail-log-card { grid-column: 1 / -1; }
.kd-log-filter-bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* Client agents card */
.kd-client-list { display: flex; flex-direction: column; gap: 10px; }
.kd-client-row { padding: 6px 0; border-bottom: 1px solid var(--fill); }
.kd-client-row:last-child { border-bottom: none; }
.kd-client-topline { display: flex; justify-content: space-between; align-items: center; font-size: 13px; margin-bottom: 4px; }
.kd-client-topline strong { font-weight: 600; color: var(--text-primary); }
.kd-client-topline span { color: var(--text-secondary); font-size: 12px; }
.kd-client-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Activity timeline */
.kd-activity-timeline { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.kd-activity-row { display: flex; align-items: center; gap: 10px; }
.kd-activity-label { width: 100px; font-size: 11px; color: var(--text-secondary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.kd-activity-bars { display: flex; gap: 1px; flex: 1; align-items: center; }
.kd-activity-bar { flex: 1; height: 22px; background: var(--text-primary); border-radius: 1px; min-width: 2px; }
.kd-activity-axis { display: flex; justify-content: space-between; margin-left: 110px; font-size: 10px; color: var(--text-tertiary); margin-top: 4px; }

.kd-log-table { width: 100%; }
.kd-log-header-row {
    display: grid;
    grid-template-columns: 30px 160px 1fr 130px 150px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.kd-log-row {
    display: grid;
    grid-template-columns: 30px 160px 1fr 130px 150px;
    padding: 12px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    align-items: center;
}
.kd-log-row:hover { background: rgba(248, 250, 252, 0.96); }
.kd-log-row .kd-log-model {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 600;
}
.kd-log-chevron {
    font-size: 10px; color: var(--text-tertiary);
    transition: transform 0.2s; display: inline-block;
}
.kd-log-chevron.expanded { transform: rotate(90deg); }
.kd-log-time,
.kd-log-io {
    color: var(--text-secondary);
}
.kd-log-total {
    color: var(--text-primary);
    font-weight: 600;
}
.kd-log-expand {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 14px 42px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(248, 250, 252, 0.72);
    border-bottom: 1px solid var(--border);
}
.kd-log-expand-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}
.kd-log-expand-item strong {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.1;
}
.kd-tag-agent {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    margin-right: 4px;
    background: rgba(29,78,216,0.08);
    color: var(--accent-blue);
    font-weight: 600;
    vertical-align: middle;
}
.kd-tag-service {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    margin-right: 8px;
    background: rgba(15,23,42,0.06);
    color: var(--text-primary);
    font-weight: 700;
    vertical-align: middle;
}
/* Pagination */
.key-detail-log-card .el-pagination {
    margin-top: 12px; justify-content: center; display: flex;
    --el-pagination-bg-color: transparent;
    --el-pagination-text-color: var(--text-secondary);
    --el-pagination-button-disabled-color: var(--text-tertiary);
    --el-pagination-hover-color: var(--text-primary);
}
.key-detail-log-card .el-pagination button,
.key-detail-log-card .el-pagination .el-pager li {
    background: transparent !important; color: var(--text-secondary) !important;
}
.key-detail-log-card .el-pagination .el-pager li.is-active {
    color: var(--text-primary) !important;
}

/* Responsive */
@media (max-width: 900px) {
    .key-detail-grid { grid-template-columns: 1fr; }
    .kd-log-header-row, .kd-log-row {
        grid-template-columns: 24px 120px 1fr 100px 120px;
        font-size: 12px;
    }
    .kd-log-expand {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-left: 32px;
        padding-right: 12px;
    }
}

@media (max-width: 640px) {
    .key-detail-hero-actions {
        width: 100%;
        justify-content: space-between;
    }
    .kd-donut-legend-meta {
        gap: 8px;
    }
    .kd-donut-legend-cost {
        margin-left: 0;
    }
    .kd-log-header-row {
        display: none;
    }
    .kd-log-row {
        grid-template-columns: 20px minmax(0, 1fr);
        gap: 6px 10px;
    }
    .kd-log-row > :nth-child(2),
    .kd-log-row > :nth-child(3),
    .kd-log-row > :nth-child(4),
    .kd-log-row > :nth-child(5) {
        grid-column: 2;
    }
    .kd-log-expand {
        grid-template-columns: 1fr;
        padding: 12px 12px 14px 32px;
    }
}

/* Playground Page */
.playground-container {
    max-width: 900px;
}

.playground-config {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.playground-field {
    flex: 1;
    min-width: 160px;
}

.playground-field label,
.playground-input label,
.playground-response label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.playground-input {
    margin-top: 16px;
}

.playground-response {
    margin-top: 20px;
}

.playground-response-box {
    background: var(--page);
    color: var(--text-secondary);
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px;
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.typing-cursor {
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}



/* ===== Session Timeline (traces, evot-eval-aligned) ===== */
.session-page { padding: 16px 20px 28px; }
.session-shell { display: flex; flex-direction: column; gap: 12px; min-height: 72vh; }
.session-header {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  padding-bottom: 10px; border-bottom: 1px solid var(--border, var(--border));
}
.session-header-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.session-header-text { min-width: 0; }
.session-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-tertiary, var(--text-secondary)); font-weight: 600; }
.session-title { margin: 2px 0 6px; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.session-id-full {
  font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(64,158,255,.08); border: 1px solid rgba(64,158,255,.25);
  padding: 2px 8px; border-radius: 6px; color: var(--accent-blue); word-break: break-all;
}
.session-copy-btn {
  border: 1px solid var(--border, var(--border)); background: var(--card); border-radius: 6px;
  font-size: 11px; padding: 2px 8px; cursor: pointer; color: var(--text-secondary, var(--text-secondary));
}
.session-copy-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.session-subtitle { font-size: 12px; color: var(--text-secondary, var(--text-secondary)); margin-bottom: 6px; line-height: 1.45; }
.session-cwd {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  margin: 0 0 8px; padding: 5px 10px;
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 8px; background: rgba(16, 185, 129, 0.06);
  max-width: 100%;
}
.session-cwd-label {
  flex-shrink: 0; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--green-ink);
  background: rgba(16, 185, 129, 0.14); border-radius: 999px; padding: 1px 7px;
}
.session-cwd-path {
  min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: var(--green-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.session-agg {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  font-size: 12px; color: var(--text-primary, var(--text-primary));
  padding: 6px 10px; border-radius: 8px; background: var(--fill);
  border: 1px solid var(--border, var(--border)); max-width: 100%;
}
.session-agg-pill {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(64,158,255,.12); color: var(--accent-blue); border-radius: 999px; padding: 1px 7px;
}
.session-agg-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--accent-blue); }
.session-agg-sep { color: var(--text-muted, var(--text-tertiary)); }
.session-header-actions { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.session-body, .traces-body {
  display: grid; grid-template-columns: 280px 1fr; gap: 0; min-height: 62vh;
  border: 1px solid var(--border, var(--border)); border-radius: 10px; overflow: hidden; background: var(--card);
}
.session-span-list, .traces-list-col {
  border-right: 1px solid var(--border, var(--border)); overflow-y: auto;
  max-height: calc(100vh - 230px); background: var(--fill);
}
.session-span-list-title {
  padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-tertiary, var(--text-secondary)); border-bottom: 1px solid var(--border, var(--border));
  position: sticky; top: 0; background: var(--fill); z-index: 1;
  display: flex; justify-content: space-between; align-items: center;
}
.session-span-count {
  font-size: 10px; background: var(--border); border-radius: 999px; padding: 0 6px; color: var(--text-secondary);
}
.session-span-item, .trace-item {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid rgba(0,0,0,.05);
  background: transparent; padding: 12px 14px; cursor: pointer; font-size: 12px;
}
.session-span-item:hover, .trace-item:hover { background: rgba(64,158,255,.05); }
.session-span-item.active, .trace-item.active {
  background: rgba(64,158,255,.12); box-shadow: inset 3px 0 0 var(--accent-blue);
}
.session-span-item.fail .session-span-seq { color: var(--red); }
.session-span-topline { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; }
.session-span-seq, .trace-item-id { color: var(--accent-blue); font-weight: 700; }
.session-span-model, .trace-item-model { color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-span-meta, .trace-item-meta { color: var(--text-secondary); font-size: 11px; margin-top: 2px; }
.session-span-tokens, .trace-item-tokens {
  color: var(--text-secondary); font-size: 10px; margin-top: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums;
}
.session-span-pager {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border, var(--border));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.session-span-pager-meta {
  color: var(--text-secondary);
  font-size: 11px;
}
.session-span-load-more {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
}
.session-span-load-more:hover:not(:disabled) { background: var(--fill); }
.session-span-load-more:disabled { opacity: 0.6; cursor: default; }
.session-span-item.continued { opacity: 0.95; }
.session-span-continued {
  display: inline-block;
  margin-right: 4px;
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 10px;
}
.session-span-msg {
  font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px;
}
.session-span-detail, .traces-detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--card); }
.session-detail-tabs, .traces-detail-tabs {
  display: flex; gap: 0; padding: 0 10px; border-bottom: 1px solid var(--border, var(--border));
  background: var(--fill); flex-shrink: 0;
}
.session-detail-tab, .traces-detail-tab {
  border: 0; background: transparent; padding: 10px 14px; cursor: pointer;
  font-size: 12px; color: var(--text-secondary); border-bottom: 2px solid transparent;
}
.session-detail-tab.active, .traces-detail-tab.active { color: var(--foreground); border-bottom-color: var(--accent-blue); font-weight: 600; }
.session-detail-content, .traces-detail-content {
  padding: 16px; overflow-y: auto; flex: 1; min-height: 0; max-height: calc(100vh - 260px); font-size: 12px;
}
.session-empty { padding: 28px 16px; text-align: center; color: var(--text-secondary); }
.session-chip {
  border: 1px solid rgba(64,158,255,.35); background: rgba(64,158,255,.08); color: var(--accent-blue);
  border-radius: 999px; padding: 1px 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; cursor: pointer;
}
.session-chip:hover { background: rgba(64,158,255,.16); }
.session-chip.muted { border-color: transparent; background: transparent; color: var(--text-tertiary); cursor: default; }

/* SpanTrace renderer */
.st-root { color: var(--text-primary); }
.st-empty { color: var(--text-secondary); text-align: center; padding: 32px; }
.st-time-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-secondary);
  margin-bottom: 12px; font-variant-numeric: tabular-nums;
}
.st-dur-bar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-bottom: 12px; background: var(--fill); }
.st-dur-seg { height: 100%; min-width: 2px; opacity: .75; cursor: default; }
.st-dur-seg.active { opacity: 1; outline: 1px solid #e9eeed26; }
.st-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.st-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--fill);
}
.st-card span { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; text-transform: lowercase; }
.st-card strong { font-size: 14px; word-break: break-word; }
.st-io { padding: 14px 0; border-top: 1px solid var(--border); }
.st-io:first-of-type { border-top: none; padding-top: 4px; }
.st-io-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.st-io-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.st-io-input .st-io-title { color: var(--accent-blue); }
.st-io-output .st-io-title { color: var(--green-ink); }
.st-io-meta { margin-left: auto; font-size: 11px; color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.st-io-params {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-secondary);
  margin: 0 0 10px; padding: 8px 12px; background: var(--fill); border-radius: 8px; border: 1px solid var(--border);
}
.st-req-fold, .st-carried, .st-fold { margin: 6px 0; }
.st-req-fold > summary, .st-carried > summary, .st-fold > summary {
  cursor: pointer; color: var(--accent-blue); font-size: 12px; list-style: none;
}
.st-req-fold > summary::-webkit-details-marker,
.st-carried > summary::-webkit-details-marker,
.st-fold > summary::-webkit-details-marker { display: none; }
.st-req-fold pre, .st-fold pre, .st-cb-body pre, .st-msg-card pre, .st-raw {
  margin: 6px 0 0; white-space: pre-wrap; word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.5;
  background: var(--fill); border-left: 2px solid var(--border); border-radius: 0 6px 6px 0; padding: 8px 10px;
  max-height: 360px; overflow: auto;
}
.st-tools { display: grid; gap: 6px; margin-top: 6px; }
.st-tool { font-size: 12px; display: flex; gap: 8px; }
.st-tool span { color: var(--text-secondary); }
.st-new-boundary {
  display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; color: var(--text-secondary); font-size: 11px;
}
.st-new-boundary::before { content: ""; height: 1px; width: 14px; background: var(--border); }
.st-new-boundary::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.st-new-boundary span { letter-spacing: .05em; text-transform: uppercase; font-weight: 600; }

.st-history-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0 10px;
    padding: 8px 10px;
    border: 1px dashed rgba(148, 163, 184, 0.55);
    border-radius: 10px;
    background: var(--fill);
}
.st-history-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}
.st-history-toggle {
    border: 1px solid rgba(37, 99, 235, 0.25);
    background: var(--card);
    color: var(--accent-blue);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.st-history-toggle:hover {
    background: var(--accent-blue-fill);
}
.st-history-panel {
    margin-bottom: 10px;
    padding: 4px 0 8px;
    border-left: 2px solid var(--border);
    padding-left: 10px;
}
.st-history-panel[hidden] {
    display: none !important;
}
.st-ctx-new > .st-msg {
    border-color: rgba(37, 99, 235, 0.18);
}
.st-msg { margin: 0 0 12px; }
.st-msg-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.st-msg-role { font-size: 12px; font-weight: 600; text-transform: lowercase; }
.st-msg-user .st-msg-role { color: var(--accent-violet); }
.st-msg-assistant .st-msg-role { color: var(--accent-blue); }
.st-msg-system .st-msg-role { color: var(--text-secondary); }
.st-msg-n, .st-msg-idx { font-size: 10px; color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.st-msg-new-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; padding: 2px 7px; border-radius: 8px;
  background: rgba(16,185,129,.12); color: var(--green-ink); border: 1px solid rgba(16,185,129,.3);
}
.st-msg-body { padding-left: 12px; border-left: 2px solid var(--border); }
.st-msg-new > .st-msg-body { border-left-color: var(--green-ink); }
.st-cb { margin: 6px 0; }
.st-cb-h { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.st-cb-label { color: var(--text-primary); font-weight: 600; }
.st-cb-thinking .st-cb-label { color: var(--text-secondary); }
.st-cb-tool .st-cb-label { color: var(--green-ink); }
.st-cb-result .st-cb-label { color: var(--accent-blue); }
.st-cb-err .st-cb-label, .st-err { color: var(--red); }
.st-code { font-size: 11px; color: var(--text-secondary); background: var(--fill); padding: 1px 5px; border-radius: 4px; }
.st-id { font-size: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; padding: 2px 6px; border-radius: 8px; background: var(--fill); color: var(--text-secondary); border: 1px solid var(--border); }
.st-muted { color: var(--text-secondary); }
.st-msg-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--card);
}
.st-msg-card.assistant { background: var(--fill); }
.st-msg-card .st-msg-role { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--accent-blue); margin-bottom: 6px; display: block; }
.st-raw { max-height: none; }

@media (max-width: 960px) {
  .session-body, .traces-body { grid-template-columns: 1fr; }
  .session-span-list, .traces-list-col { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--border, var(--border)); }
}


/* ===== Models page: Channel Guide + identity-first configs ===== */
.channel-guide {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card) 0%, var(--fill) 100%);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.channel-guide-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.channel-guide-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.channel-guide-desc {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  max-width: 720px;
}
.channel-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text-secondary);
}
.channel-pill.protocol {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-blue);
}
.channel-guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.channel-guide-item {
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.channel-guide-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.channel-guide-item code {
  display: block;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-primary);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.channel-guide-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.channel-guide-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.channel-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-secondary);
}
.channel-guide-note {
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-fill);
  border: 1px solid var(--amber-fill);
  border-radius: 10px;
  padding: 8px 12px;
}

.channel-model-map {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.channel-model-map-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.channel-model-map-header h4 {
  margin: 0 0 2px;
  font-size: 14px;
  color: var(--text-primary);
}
.channel-model-map-header p {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.channel-model-map-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.channel-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.channel-model-chip {
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.06);
  color: var(--accent-blue);
  border-radius: 10px;
  padding: 6px 10px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  text-align: left;
}
.channel-model-chip strong {
  font-size: 12px;
}
.channel-model-chip span {
  font-size: 11px;
  color: var(--text-secondary);
}
.channel-model-empty {
  font-size: 12px;
  color: var(--text-secondary);
}
.channel-general-line {
  font-size: 12px;
  color: var(--text-secondary);
}

.settings-sort-th {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  user-select: none;
  min-width: 0;
}
.settings-sort-th:hover {
  color: var(--text-primary);
}
.settings-sort-th.is-active {
  color: var(--text-primary);
}
.settings-sort-indicator {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  line-height: 1;
}
.settings-sort-th.is-active .settings-sort-indicator {
  color: var(--accent-blue);
}
.settings-sort-th:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}
.settings-protocol-cell,
.settings-models-cell,
.settings-plan-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.settings-details-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.settings-protocol-detail,
.settings-health-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-protocol-line,
.settings-upstream-line {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.settings-kv-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.settings-protocol-line strong {
  font-size: 12.5px;
  color: var(--text-primary);
  font-weight: 650;
}
.settings-upstream-line code {
  font-size: 11.5px;
  color: var(--accent-blue);
  word-break: break-all;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.settings-upstream-line code:hover {
  text-decoration: underline;
}
.settings-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.settings-model-chip {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  background: rgba(16, 185, 129, 0.1);
  color: var(--green-ink);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.settings-model-chip.general {
  background: var(--fill);
  color: var(--text-secondary);
  border-color: var(--border);
}
.settings-config-identity {
  font-size: 12px;
  color: var(--text-secondary);
}
.settings-plan-strip {
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}
.settings-config-details-summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  list-style: none;
}
.settings-config-details-summary::-webkit-details-marker { display: none; }
.settings-config-details[open] .settings-config-details-summary {
  color: var(--text-primary);
  margin-bottom: 10px;
}

@media (max-width: 1100px) {
  .channel-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 720px) {
  .channel-guide-grid {
    grid-template-columns: 1fr;
  }
  .channel-guide-header,
  .channel-model-map-header {
    flex-direction: column;
  }
}


/* ===== Tailwind-ish design tokens / utilities (site-wide, reusable) ===== */
:root {
  --tw-slate-50: var(--fill);
  --tw-slate-100: var(--fill);
  --tw-slate-200: var(--border);
  --tw-slate-300: var(--border);
  --tw-slate-400: var(--text-tertiary);
  --tw-slate-500: var(--text-secondary);
  --tw-slate-600: var(--text-secondary);
  --tw-slate-700: var(--text-secondary);
  --tw-slate-800: var(--text-primary);
  --tw-slate-900: var(--text-primary);
  --tw-blue-50: var(--accent-blue-fill);
  --tw-blue-100: var(--accent-blue-fill);
  --tw-blue-600: var(--accent-blue);
  --tw-blue-700: var(--accent-blue);
  --tw-emerald-50: var(--green-fill);
  --tw-emerald-100: var(--green-fill);
  --tw-emerald-700: var(--green);
  --tw-amber-50: var(--amber-fill);
  --tw-amber-100: var(--amber-fill);
  --tw-amber-800: var(--amber);
  --tw-rose-50: var(--red-fill);
  --tw-radius-lg: 12px;
  --tw-radius-xl: 16px;
  --tw-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --tw-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --tw-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.tw-stack { display: flex; flex-direction: column; gap: 1rem; }
.tw-min-w-0 { min-width: 0; }
.tw-card {
  border: 1px solid var(--tw-slate-200);
  border-radius: var(--tw-radius-xl);
  background: var(--card);
  box-shadow: var(--tw-shadow-sm);
}
.tw-panel {
  border: 1px solid var(--tw-slate-200);
  border-radius: var(--tw-radius-lg);
  background: var(--tw-slate-50);
  padding: 0.75rem;
}
.tw-kicker {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tw-slate-500);
}
.tw-section-title {
  margin: 0 0 0.125rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--tw-slate-900);
}
.tw-muted { margin: 0; font-size: 0.75rem; color: var(--tw-slate-500); line-height: 1.45; }
.tw-muted-strong { font-size: 0.75rem; font-weight: 600; color: var(--tw-slate-600); white-space: nowrap; }
.tw-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tw-slate-500);
}
.tw-code {
  display: block;
  font-size: 0.71875rem;
  line-height: 1.45;
  color: var(--tw-slate-900);
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tw-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: var(--tw-slate-100);
  color: var(--tw-slate-700);
  border: 1px solid var(--tw-slate-200);
}
.tw-badge-blue {
  background: var(--tw-blue-50);
  color: var(--tw-blue-700);
  border-color: var(--tw-blue-100);
}
.tw-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--tw-slate-100);
  color: var(--tw-slate-700);
}

/* Align channel guide with token system */
.channel-guide {
  padding: 0.875rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  background: linear-gradient(180deg, var(--card) 0%, var(--tw-slate-50) 100%);
}
.channel-guide-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}
.channel-guide-summary::-webkit-details-marker { display: none; }
.channel-guide-summary::marker { display: none; content: ''; }
.channel-guide-summary-main {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex-wrap: wrap;
}
.channel-guide-summary-main::before {
  content: '+';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--tw-slate-200);
  background: var(--tw-slate-50);
  color: var(--tw-slate-600);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.channel-guide[open] .channel-guide-summary-main::before { content: '−'; }
.channel-guide-body {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding-top: 0.25rem;
}
.channel-guide-desc { margin: 0; color: var(--tw-slate-600); font-size: 0.8125rem; line-height: 1.5; max-width: 45rem; }
.channel-guide-header { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.channel-guide-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.channel-guide-item { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.channel-guide-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.channel-guide-text { margin: 0; font-size: 0.78125rem; color: var(--tw-slate-700); line-height: 1.5; }
.channel-guide-note {
  font-size: 0.75rem;
  color: var(--tw-amber-800);
  background: var(--tw-amber-50);
  border: 1px solid var(--tw-amber-100);
  border-radius: 0.625rem;
  padding: 0.5rem 0.75rem;
}

.channel-model-map { padding: 1rem 1.125rem; display: flex; flex-direction: column; gap: 0.75rem; }
.channel-model-map-header { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.channel-model-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.channel-model-chip {
  border: 1px solid var(--tw-blue-100);
  background: var(--tw-blue-50);
  color: var(--accent-blue);
  border-radius: 0.625rem;
  padding: 0.375rem 0.625rem;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.125rem;
  cursor: pointer;
  text-align: left;
}
.channel-model-chip strong { font-size: 0.75rem; }
.channel-model-chip span { font-size: 0.6875rem; color: var(--tw-slate-500); }
.channel-model-empty { font-size: 0.75rem; color: var(--tw-slate-500); }
.channel-general-line { font-size: 0.75rem; color: var(--tw-slate-600); }

.settings-config-row-v2 {
  border-color: var(--tw-slate-200);
  box-shadow: var(--tw-shadow-sm);
}
.settings-config-row-v2:hover {
  box-shadow: var(--tw-shadow-md);
  border-color: var(--tw-slate-300);
}
.settings-model-chip {
  background: var(--tw-emerald-50);
  color: var(--tw-emerald-700);
  border: 1px solid var(--tw-emerald-100);
}
.settings-model-chip.general {
  background: var(--tw-slate-100);
  color: var(--tw-slate-600);
  border-color: var(--tw-slate-200);
}
.settings-upstream-line code { color: var(--tw-blue-700); }
.settings-kv-label { color: var(--tw-slate-400); }

@media (max-width: 1200px) {
  .settings-details-meta-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .channel-guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .channel-guide-grid { grid-template-columns: 1fr; }
  .channel-guide-header,
  .channel-model-map-header { flex-direction: column; }
  .settings-details-meta-grid { grid-template-columns: 1fr; }
}

.tw-code-copy { cursor: pointer; }
.tw-code-copy:hover { color: var(--tw-blue-700); text-decoration: underline; }

/* ---- Custom upstream request headers editor (config dialog) ------------- */
.merged-headers-block {
    margin: 2px 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--fill);
    overflow: hidden;
}

.merged-headers-block > summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    user-select: none;
}

.merged-headers-block > summary::-webkit-details-marker { display: none; }

.merged-headers-block > summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid var(--text-tertiary);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.15s ease;
    flex: none;
}

.merged-headers-block[open] > summary::before { transform: rotate(90deg); }
.merged-headers-block > summary:hover { background: var(--fill); }
.merged-headers-title { margin-right: auto; }

.merged-headers-body {
    padding: 4px 14px 14px;
    border-top: 1px solid var(--border);
}

.merged-headers-note code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--accent-blue-fill);
    color: var(--accent-blue);
    font-size: 11px;
}

.merged-headers-rows { display: flex; flex-direction: column; gap: 8px; }

.merged-headers-row-head,
.merged-headers-row {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) 78px;
    gap: 10px;
    align-items: start;
}

.merged-headers-row-head {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

.merged-headers-name { display: flex; flex-direction: column; gap: 4px; }
.merged-headers-name .is-invalid .el-input__wrapper { box-shadow: 0 0 0 1px var(--red) inset; }
.merged-headers-error { font-size: 11px; color: var(--red); }
.merged-headers-remove { justify-self: start; }

.merged-headers-empty {
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text-tertiary);
    font-size: 13px;
    text-align: center;
}

.merged-headers-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.merged-headers-note { margin: 10px 0 0; font-size: 11px; }

@media (max-width: 640px) {
    .merged-headers-row-head { display: none; }
    .merged-headers-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
    }
}


/* ---- Failover rows: the columns and states of a Channels ledger row ---- */
.routing-channel-list { list-style: none; margin: 0; padding: 0; }
.routing-channel-columns { display: grid; padding: 8px 16px; background: var(--background); border-bottom: 1px solid var(--border); color: var(--text-tertiary); font-size: 10px; letter-spacing: .03em; text-transform: uppercase; }
.routing-channel-columns, .routing-channel-main {
    grid-template-columns: 56px minmax(200px, 1.3fr) minmax(170px, 1fr) 100px 40px;
    align-items: center; gap: 10px;
}
.routing-channel-row { position: relative; border-top: 1px solid var(--border); background: transparent; }
.routing-channel-list > .routing-channel-row:first-child { border-top: 0; }
.routing-channel-row.is-open { background: var(--surface); }
.routing-channel-main { display: grid; padding: 10px 16px; }
.routing-channel-row .settings-config-cell { min-width: 0; }
.routing-hop-primary { display: flex; flex-direction: column; gap: 6px; }
.routing-hop-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.routing-hop-line .el-select { flex: 1 1 auto; min-width: 0; width: 100%; }
.routing-hop-model-line { padding-left: 48px; }
.routing-hop-model-line .routing-arrow { flex: none; }
.routing-tier-option { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; }
.routing-tier-note { font-size: 11px; color: var(--text-tertiary); }
.routing-tier-note.is-warning { color: var(--amber); }
.routing-hop-open { flex: none; display: inline-flex; flex-direction: row; align-items: center; gap: 4px; width: auto; min-width: 0; height: auto; padding: 0; margin: 0; background: transparent; border: 0; box-shadow: none; }
.routing-priority-number { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--text-primary); font-weight: 600; font-size: 12px; box-sizing: border-box; }
.routing-arrow { color: var(--text-tertiary); font-size: 12px; text-align: center; }
.routing-channel-toggle { transform: scale(.85); transform-origin: left center; margin: 0; }
.routing-channel-row .settings-plan-brief { align-items: stretch; }
.routing-hop-accounts .ui-channel-accounts { min-height: 0; padding: 2px 0; border: 0; background: transparent; width: 100%; }
.routing-hop-accounts .ui-channel-accounts:hover { background: transparent; border-color: transparent; }
.routing-hop-notes { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.routing-hop-brief { min-width: 0; font-size: 10.5px; }
.routing-channel-row .settings-live-brief { min-height: 0; }
.routing-channel-row .settings-actions-cell { display: flex; justify-content: flex-end; }
.routing-channel-body { padding: 4px 16px 14px 40px; }
.routing-channel-row .settings-config-panels { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(200px, 1fr); gap: 16px 28px; align-items: start; }
.routing-account-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.routing-account-list > li { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr); align-items: center; gap: 10px; }
.routing-account-name { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routing-open-channel { align-self: flex-start; padding: 0; border: 0; background: transparent; color: var(--text-tertiary); font: inherit; font-size: 11px; cursor: pointer; }
.routing-open-channel:hover { color: var(--ink); }
.routing-live-empty { margin: 0; font-size: 11px; color: var(--text-tertiary); }
/* The reorder grip sits in the gutter, so the row keeps the ledger's columns. */
.routing-grip { position: absolute; left: 2px; top: 14px; width: 14px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--text-tertiary); font-size: 14px; line-height: 1; cursor: grab; opacity: 0; user-select: none; }
.routing-channel-row:hover .routing-grip, .routing-channel-row:focus-within .routing-grip { opacity: 1; }
/* Same breakpoint as the Channels ledger (models.css): the card answers to its own width. */
@container (max-width: 640px) {
    .routing-channel-columns { display: none; }
    .routing-channel-main { grid-template-columns: 56px minmax(0, 1fr) 40px; grid-template-areas: "toggle primary actions" ". plan plan" ". live live"; row-gap: 8px; }
    .routing-channel-main > .settings-toggle-cell { grid-area: toggle; }
    .routing-channel-main > .settings-config-cell-primary { grid-area: primary; }
    .routing-channel-main > .routing-hop-accounts { grid-area: plan; }
    .routing-channel-main > .settings-live-brief { grid-area: live; }
    .routing-channel-main > .settings-actions-cell { grid-area: actions; }
    .routing-channel-row .settings-config-panels { grid-template-columns: minmax(0, 1fr); }
    .routing-channel-body { padding-left: 16px; }
}


/* Route chips: the chain reads as small dots + names after the model. */
.routing-list-chain { display: inline-flex; align-items: center; flex-wrap: nowrap; gap: 8px; font-size: 11px; color: var(--text-tertiary); }
.routing-list-item.is-attention { border-color: var(--amber); }
.routing-list-item.is-attention.active { border-color: var(--ink); }
