* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Montserrat', sans-serif;
    background: #0f1117;
    color: #e1e4e8;
    min-height: 100vh;
}

.overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
}

.auth-box {
    background: #1c1f26; padding: 2rem; border-radius: 12px;
    text-align: center; width: 360px;
}
.auth-box h2 { margin-bottom: 0.5rem; color: #58a6ff; }
.auth-box p { margin-bottom: 1rem; color: #8b949e; font-size: 0.9rem; }
.auth-box input {
    width: 100%; padding: 0.6rem; border: 1px solid #30363d;
    border-radius: 6px; background: #0d1117; color: #e1e4e8;
    margin-bottom: 1rem; font-size: 1rem;
}
.auth-box button {
    width: 100%; padding: 0.6rem; background: #238636; color: #fff;
    border: none; border-radius: 6px; cursor: pointer; font-size: 1rem;
}
.auth-box button:hover { background: #2ea043; }
.error { color: #f85149; margin-top: 0.5rem; font-size: 0.85rem; }

header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 2rem; border-bottom: 1px solid #21262d; position: relative;
}
header h1 { font-size: 1.3rem; color: #ffffff; }
.logout-btn {
    padding: 0.4rem 1rem; background: #21262d; color: #e1e4e8;
    border: 1px solid #30363d; border-radius: 6px; cursor: pointer;
}
.lang-btn {
    padding: 0.3rem 0.7rem; background: #0d1117; color: #58a6ff;
    border: 1px solid #58a6ff; border-radius: 4px; cursor: pointer;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.5px;
}
.lang-btn:hover { background: #161b22; }

nav {
    display: flex; gap: 0; padding: 0 2rem;
    border-bottom: 1px solid #21262d;
}
.tab {
    padding: 0.7rem 1.2rem; background: none; border: none;
    color: #8b949e; cursor: pointer; border-bottom: 2px solid transparent;
    font-size: 0.9rem;
}
.tab:hover { color: #e1e4e8; }
.tab.active { color: #58a6ff; border-bottom-color: #58a6ff; }

main { padding: 1.5rem 2rem; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.card {
    background: #161b22; border: 1px solid #21262d;
    border-radius: 8px; padding: 1rem;
}
.card h3 { font-size: 0.8rem; color: #8b949e; margin-bottom: 0.3rem; text-transform: uppercase; }
.card p { font-size: 1.6rem; font-weight: 600; }

table {
    width: 100%; border-collapse: collapse; margin-top: 1rem;
}
th, td {
    padding: 0.6rem 1rem; text-align: left;
    border-bottom: 1px solid #21262d;
}
th { color: #8b949e; font-size: 0.8rem; text-transform: uppercase; }

.toolbar {
    display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem;
}
.toolbar input, .toolbar select {
    padding: 0.4rem 0.6rem; background: #0d1117; color: #e1e4e8;
    border: 1px solid #30363d; border-radius: 6px;
}
.toolbar button {
    padding: 0.4rem 1rem; background: #238636; color: #fff;
    border: none; border-radius: 6px; cursor: pointer;
}

.log-viewer {
    background: #0d1117; border: 1px solid #21262d;
    border-radius: 8px; padding: 1rem; max-height: 500px;
    overflow-y: auto; font-family: 'Fira Code', monospace; font-size: 0.8rem;
    line-height: 1.5;
}
.log-entry { padding: 2px 0; }
.log-entry.error { color: #f85149; }
.log-entry.warning { color: #d29922; }
.log-entry.info { color: #58a6ff; }
.log-entry.debug { color: #8b949e; }

.chart-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.chart-box {
    background: #161b22; border: 1px solid #21262d;
    border-radius: 8px; padding: 1rem;
}

.new-key {
    background: #0d2818; border: 1px solid #238636;
    border-radius: 8px; padding: 1rem; margin-bottom: 1rem;
}
.new-key code {
    display: block; margin-top: 0.5rem; padding: 0.5rem;
    background: #0d1117; border-radius: 4px; word-break: break-all;
    font-size: 0.9rem; color: #7ee787;
}

.action-btn {
    padding: 0.3rem 0.6rem; margin: 0 0.2rem;
    background: #21262d; color: #e1e4e8;
    border: 1px solid #30363d; border-radius: 4px;
    cursor: pointer; font-size: 0.75rem;
}
.action-btn:hover { background: #30363d; }
.action-btn.danger { color: #f85149; border-color: #f85149; }
.action-btn.danger:hover { background: #f851491a; }

/* ── Providers ── */

.provider-profile {
    background: #1c1f26;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
}

.provider-profile h3 {
    color: #58a6ff;
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #30363d;
}

.profile-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 1rem;
}

.profile-card {
    flex: 1;
    background: #161b22;
    border: 2px solid #30363d;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.profile-card:hover {
    border-color: #58a6ff;
}

.profile-card.active {
    border-color: #238636;
    background: #0d1117;
}

.profile-card h4 {
    color: #e1e4e8;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.profile-card p {
    color: #8b949e;
    font-size: 0.85rem;
    line-height: 1.4;
    margin: 0.2rem 0;
}

.profile-card .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
}

.badge-active { background: #238636; color: #fff; }
.badge-configured { background: #1f6feb; color: #fff; }
.badge-missing { background: #da3633; color: #fff; }

.provider-creds {
    background: #1c1f26;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
}

.provider-creds h3 {
    color: #58a6ff;
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.provider-creds .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.green { background: #238636; }
.status-dot.red { background: #da3633; }
.status-dot.gray { background: #484f58; }

.creds-form {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px 12px;
    align-items: center;
    margin-bottom: 1rem;
}

.creds-form label {
    color: #c9d1d9;
    font-size: 0.9rem;
}

.creds-form input,
.creds-form select {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e1e4e8;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.creds-form input:focus,
.creds-form select:focus {
    border-color: #58a6ff;
    outline: none;
}

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

.creds-actions button {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-test { background: #1f6feb; color: #fff; border-radius: 20px; padding: 6px 18px; }
.btn-test:hover { background: #388bfd; }

.btn-reindex {
    background: #238636;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 10px 28px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
}
.btn-reindex:hover { background: #2ea043; }

.eye-btn {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 1rem;
    border-radius: 4px;
}
.eye-btn:hover { color: #e1e4e8; }

.creds-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.creds-input-wrap input { flex: 1; }

.model-recommendations {
    margin-top: 1rem;
    padding: 0.8rem 1rem;
    background: #161b22;
    border-radius: 6px;
    border-left: 3px solid #d29922;
}

.model-recommendations h4 {
    color: #d29922;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.model-rec {
    color: #8b949e;
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 0.3rem 0;
}

.model-rec strong {
    color: #c9d1d9;
}

.reindex-progress {
    background: #1c1f26;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
}

.reindex-progress h3 {
    color: #58a6ff;
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.progress-bar {
    height: 8px;
    background: #21262d;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.8rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: #238636;
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-info {
    color: #8b949e;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ── Settings ── */

.settings-container {
    max-width: 1200px;
}

.settings-row {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 1rem;
    align-items: flex-start;
}

.settings-section {
    background: #1c1f26;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    flex: 1;
    min-width: 0;
}

.settings-help {
    width: 400px;
    min-width: 320px;
    flex-shrink: 0;
    padding-top: 0.5rem;
}

.settings-help-title {
    color: #58a6ff;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.settings-help-text {
    color: #8b949e;
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.settings-help-field {
    display: none;
    color: #c9d1d9;
    font-size: 0.92rem;
    line-height: 1.6;
    padding: 0.8rem 1rem;
    background: #161b22;
    border-radius: 8px;
    border-left: 3px solid #58a6ff;
    margin-top: 0.6rem;
}

.settings-help-field.active {
    display: block;
}

.settings-help-field strong {
    color: #58a6ff;
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.settings-section h3 {
    color: #58a6ff;
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #30363d;
}

@media (max-width: 900px) {
    .settings-row {
        flex-direction: column;
    }
    .settings-help {
        width: 100%;
        min-width: 0;
    }
}

.settings-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #21262d;
}

.settings-field:last-child {
    border-bottom: none;
}

.settings-field label {
    color: #c9d1d9;
    font-size: 0.9rem;
    flex: 1;
}

.settings-field input[type="number"],
.settings-field input[type="text"],
.settings-field select {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e1e4e8;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 180px;
    text-align: right;
}

.settings-field input:focus,
.settings-field select:focus {
    border-color: #58a6ff;
    outline: none;
}

.settings-field .toggle {
    position: relative;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.settings-field .toggle input {
    display: none;
}

.settings-field .toggle .slider {
    position: absolute;
    inset: 0;
    background: #30363d;
    border-radius: 12px;
    transition: background 0.2s;
}

.settings-field .toggle .slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #8b949e;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}

.settings-field .toggle input:checked + .slider {
    background: #238636;
}

.settings-field .toggle input:checked + .slider::after {
    transform: translateX(20px);
    background: #fff;
}

.settings-save {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1rem;
}

.settings-save button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.settings-save .btn-save {
    background: #238636;
    color: #fff;
}

.settings-save .btn-save:hover {
    background: #2ea043;
}

.settings-save .btn-reset {
    background: #30363d;
    color: #c9d1d9;
}

.settings-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #238636;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 999;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Documentation (Markdown) ── */

.docs-md {
    max-width: 900px;
    line-height: 1.7;
}

.docs-md h1 { color: #58a6ff; font-size: 1.8rem; margin: 2rem 0 1rem; border-bottom: 1px solid #30363d; padding-bottom: 0.5rem; }
.docs-md h2 { color: #58a6ff; font-size: 1.4rem; margin: 2rem 0 0.8rem; border-bottom: 1px solid #21262d; padding-bottom: 0.4rem; }
.docs-md h3 { color: #c9d1d9; font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }
.docs-md h4 { color: #8b949e; font-size: 1rem; margin: 1rem 0 0.5rem; }

.docs-md p { color: #c9d1d9; margin: 0.6rem 0; }

.docs-md table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.docs-md th { background: #161b22; color: #58a6ff; padding: 8px 12px; text-align: left; border: 1px solid #30363d; font-weight: 600; }
.docs-md td { padding: 8px 12px; border: 1px solid #21262d; color: #c9d1d9; }
.docs-md tr:hover td { background: #161b22; }

.docs-md code { background: #161b22; color: #e1e4e8; padding: 2px 6px; border-radius: 4px; font-size: 0.88em; }
.docs-md pre { background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 1rem; overflow-x: auto; margin: 1rem 0; }
.docs-md pre code { background: none; padding: 0; font-size: 0.85rem; line-height: 1.5; }

.docs-md blockquote { border-left: 3px solid #58a6ff; padding: 0.5rem 1rem; margin: 1rem 0; color: #8b949e; background: #161b22; border-radius: 0 6px 6px 0; }

.docs-md ul, .docs-md ol { padding-left: 1.5rem; margin: 0.5rem 0; }
.docs-md li { margin: 0.3rem 0; color: #c9d1d9; }

.docs-md hr { border: none; border-top: 1px solid #30363d; margin: 2rem 0; }

.docs-md a { color: #58a6ff; text-decoration: none; }
.docs-md a:hover { text-decoration: underline; }

.docs-md strong { color: #e1e4e8; }

.docs {
    max-width: 900px;
    margin: 0 auto;
}

.docs h2 {
    font-size: 1.6rem;
    color: #58a6ff;
    margin-bottom: 0.3rem;
}

.docs-subtitle {
    color: #8b949e;
    font-size: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #21262d;
    padding-bottom: 1.5rem;
}

.docs-section {
    margin-bottom: 2.5rem;
}

.docs-section h3 {
    font-size: 1.15rem;
    color: #e1e4e8;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #21262d;
}

.docs-section > p {
    color: #8b949e;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.diagram-container {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.2rem;
    overflow-x: auto;
}

.diagram {
    width: 100%;
    height: auto;
    min-width: 600px;
}

.docs-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.feature-item {
    display: flex;
    gap: 0.7rem;
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 1rem;
}

.feature-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-item strong {
    display: block;
    color: #e1e4e8;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.feature-item p {
    color: #8b949e;
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
}

.docs-section code {
    background: #161b22;
    color: #f0883e;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.docs-table th {
    background: #161b22;
    color: #8b949e;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 0.5rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #21262d;
}

.docs-table td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid #21262d;
    font-size: 0.85rem;
    color: #e1e4e8;
}

.docs-table td code {
    color: #7ee787;
    font-size: 0.8rem;
}

.docs-table tr:hover td {
    background: #161b22;
}

/* ── S3 File Browser ── */
.files-breadcrumb {
    display: flex; gap: 0.3rem; align-items: center;
    margin-bottom: 1rem; font-size: 0.9rem; color: #8b949e;
}
.files-breadcrumb a { color: #58a6ff; cursor: pointer; text-decoration: none; }
.files-breadcrumb a:hover { text-decoration: underline; }
.files-breadcrumb .sep { color: #484f58; margin: 0 0.2rem; }

.files-table { width: 100%; border-collapse: collapse; }
.files-table th {
    text-align: left; padding: 8px 12px; border-bottom: 1px solid #30363d;
    color: #8b949e; font-size: 0.85rem;
}
.files-table td { padding: 6px 12px; border-bottom: 1px solid #21262d; }
.files-table tr:hover td { background: #161b22; }
.files-table .folder-link { color: #58a6ff; cursor: pointer; }
.files-table .folder-link:hover { text-decoration: underline; }

.file-preview-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center; z-index: 50;
}
.file-preview-content {
    background: #1c1f26; border: 1px solid #30363d; border-radius: 10px;
    width: 85%; max-width: 1000px; max-height: 85vh; display: flex; flex-direction: column;
}
.file-preview-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.8rem 1rem; border-bottom: 1px solid #30363d; color: #58a6ff;
}
.file-preview-header button {
    background: none; border: none; color: #e1e4e8; font-size: 1.5rem; cursor: pointer;
}
.file-preview-body {
    padding: 1rem; overflow: auto; flex: 1;
    font-family: 'Fira Code', monospace; font-size: 0.8rem;
    color: #e1e4e8; white-space: pre-wrap; word-break: break-all;
}

/* ── Data Sources (Ingest) tab ── */

.section-title {
    color: #c9d1d9;
    font-size: 1rem;
    margin: 1.5rem 0 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #21262d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.provider-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
}

.provider-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #21262d;
    margin-bottom: 1rem;
}

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

.provider-title h3 {
    margin: 0;
    color: #e1e4e8;
    font-size: 1.05rem;
    font-weight: 600;
}

.provider-meta {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.meta-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 0.85rem;
}

.meta-label {
    color: #8b949e;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 110px;
    padding-top: 2px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #21262d;
    border: 1px solid #30363d;
    color: #e1e4e8;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
}

.req {
    color: #f85149;
    margin-left: 2px;
}

.provider-settings {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 1rem 1.2rem;
}

.provider-settings-title {
    color: #8b949e;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.8rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem 1.2rem;
    max-width: 700px;
}

.settings-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-grid label > span {
    color: #8b949e;
    font-size: 0.78rem;
}

.settings-grid input[type="number"] {
    background: #0d1117;
    border: 1px solid #30363d;
    color: #e1e4e8;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 100%;
    font-family: 'Fira Code', monospace;
}

.settings-grid input[type="number"]:focus {
    outline: none;
    border-color: #58a6ff;
}

.provider-settings-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.muted {
    color: #8b949e;
}

.empty-row {
    text-align: center;
    color: #8b949e;
    font-style: italic;
    padding: 1.2rem;
}

.error-msg {
    color: #f85149;
    background: #1c1012;
    border: 1px solid #5a1e1e;
    border-radius: 6px;
    padding: 0.8rem 1rem;
}

/* badge variants for ingest job status */
.badge-pending    { background: #21262d; color: #c9d1d9; }
.badge-running    { background: #1f4f8b; color: #fff; }
.badge-completed  { background: #0e4429; color: #3fb950; }
.badge-failed     { background: #5a1e1e; color: #f85149; }
.badge-cancelled  { background: #21262d; color: #8b949e; }
.badge-info       { background: #1f4f8b; color: #fff; }

/* ── Priority Engine section (in Settings tab) ── */

.settings-field-block {
    display: block;
    padding: 0.9rem 0;
}

.settings-field-block > label {
    display: block;
    color: #c9d1d9;
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.settings-slider {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 260px;
    justify-content: flex-end;
}

.settings-slider input[type="range"] {
    flex: 1;
    max-width: 180px;
    accent-color: #58a6ff;
}

.settings-slider-val {
    font-family: 'Fira Code', monospace;
    color: #e1e4e8;
    font-size: 0.85rem;
    min-width: 38px;
    text-align: right;
}

.priority-tiers-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.8rem;
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 6px;
    overflow: hidden;
}

.priority-tiers-table th,
.priority-tiers-table td {
    padding: 6px 12px;
    font-size: 0.85rem;
    text-align: left;
}

.priority-tiers-table thead th {
    color: #8b949e;
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #161b22;
    border-bottom: 1px solid #21262d;
}

.priority-tiers-table tbody tr {
    border-bottom: 1px solid #21262d;
}

.priority-tiers-table tbody tr:last-child {
    border-bottom: none;
}

.priority-tiers-table input[type="text"],
.priority-tiers-table input[type="number"] {
    background: transparent;
    border: 1px solid transparent;
    color: #e1e4e8;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

.priority-tiers-table input[type="text"]:focus,
.priority-tiers-table input[type="number"]:focus {
    outline: none;
    border-color: #58a6ff;
    background: #0d1117;
}

.priority-tiers-table input[type="text"] {
    width: 100%;
    font-family: 'Fira Code', monospace;
}

.priority-tiers-table input[type="number"] {
    width: 60px;
    text-align: right;
}

.priority-tiers-table button {
    background: none;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    transition: color 0.15s;
}

.priority-tiers-table button:hover {
    color: #f85149;
}

.priority-tiers-actions {
    display: flex;
    gap: 8px;
    margin-top: 0.6rem;
}

.priority-save {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid #21262d;
    justify-content: flex-end;
}

/* ── Modal (generic, used by MCP tools) ── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 10px;
    width: min(680px, 92vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.3rem;
    border-bottom: 1px solid #21262d;
}

.modal-header h3 {
    margin: 0;
    color: #58a6ff;
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.2rem;
}

.modal-close:hover {
    color: #e1e4e8;
}

.modal-body {
    padding: 1.2rem 1.3rem;
    overflow-y: auto;
    flex: 1;
}

/* ── MCP tools list inside modal ── */

.mcp-tool {
    background: #0d1117;
    border: 1px solid #21262d;
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.8rem;
}

.mcp-tool:last-child {
    margin-bottom: 0;
}

.mcp-tool-header {
    margin-bottom: 0.5rem;
}

.mcp-tool-name {
    color: #58a6ff;
    font-size: 0.9rem;
    font-family: 'Fira Code', monospace;
    font-weight: 600;
}

.mcp-tool-desc {
    color: #c9d1d9;
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.mcp-tool-params {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    color: #c9d1d9;
}

.mcp-tool-params li {
    padding: 3px 0;
    line-height: 1.5;
}

.mcp-tool-params code {
    color: #e1e4e8;
    background: #161b22;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.78rem;
}

/* ── Outline button (for secondary actions like "MCP tools") ── */

.btn-outline {
    background: transparent;
    color: #58a6ff;
    border: 1px solid #30363d;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-outline:hover {
    background: #1f4f8b;
    color: #fff;
    border-color: #1f4f8b;
}

/* ── Provider card as settings-row variant ── */

/* h3 inside provider settings-section: align title with MCP button */
.settings-section h3 .provider-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.settings-section h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
