/* ────────────────────────────────────────────────────────────
   PDF OCR Tool — Modern Dark UI
──────────────────────────────────────────────────────────── */

:root {
    --bg:           #0d1117;
    --bg-2:         #161b22;
    --bg-3:         #21262d;
    --border:       #30363d;
    --border-soft:  rgba(255,255,255,0.06);
    --text:         #e6edf3;
    --text-muted:   #8b949e;
    --text-faint:   #484f58;

    --accent:       #7c5cfc;
    --accent-dim:   rgba(124,92,252,0.18);
    --accent-hover: #9f7ffe;
    --accent-2:     #3fb950;
    --warn:         #d29922;
    --danger:       #f85149;
    --info:         #58a6ff;

    --radius-sm:    6px;
    --radius:       10px;
    --radius-lg:    16px;

    --shadow-sm:    0 1px 3px rgba(0,0,0,.4);
    --shadow:       0 4px 16px rgba(0,0,0,.5);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.6);

    --sidebar-w:    220px;
    --topbar-h:     56px;
    --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono:    'Cascadia Code', 'Fira Code', Consolas, monospace;

    --transition:   0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
code { font-family: var(--font-mono); font-size: 0.9em; }

/* ── Layout ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 32px; height: 32px;
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}
.brand-icon svg { width: 18px; height: 18px; }

.brand-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.version-badge {
    font-size: 11px;
    color: var(--text-faint);
    font-family: var(--font-mono);
}
.nav-logout {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}
.nav-logout:hover { background: var(--bg-3); color: var(--danger); }

.nav-section-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 10px 10px 4px;
    margin-top: 4px;
}
.nav-item--locked {
    opacity: .55;
}
.nav-item--locked:hover { opacity: 1; }
.nav-lock {
    width: 11px;
    height: 11px;
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-faint);
}

/* ── Housekeeping tab ── */
.hk-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.hk-stat {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hk-stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.hk-stat-val {
    font-size: 13px;
    color: var(--text);
    font-family: var(--font-mono);
}

.hk-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.hk-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-soft);
}
.hk-row:last-of-type { border-bottom: none; }
.hk-row-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.hk-row-info strong { font-size: 13.5px; color: var(--text); }
.hk-row-info span   { font-size: 12px;   color: var(--text-muted); }
.hk-row-action {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.hk-inline {
    display: flex;
    align-items: center;
    gap: 6px;
}
.form-input-sm {
    padding: 5px 8px;
    font-size: 13px;
    height: 32px;
}
.hk-result {
    font-size: 12.5px;
    padding: 0 0 10px;
    color: var(--accent-2);
    display: none;
}
.hk-result.error { color: var(--danger); }
.hk-result:not(:empty) { display: block; }

/* ── Login page ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 24px;
}
.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    width: 56px;
    height: 56px;
    background: var(--accent-dim);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin: 0 auto 20px;
}
.login-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text);
}
.login-sub {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
}
.login-hint {
    font-size: 11.5px;
    color: var(--text-faint);
    text-align: center;
    margin-top: 20px;
}
.login-hint code {
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 5px;
    border-radius: 4px;
}

/* ── Main content ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
    position: sticky; top: 0; z-index: 50;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

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

.user-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 12px;
    color: var(--text-muted);
}

.page-body {
    flex: 1;
    padding: 28px;
    max-width: 1100px;
    width: 100%;
}

/* ── Cards ── */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 18px;
}
.card-desc {
    color: var(--text-muted);
    margin-bottom: 18px;
    font-size: 13px;
}
.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.card-actions { display: flex; align-items: center; gap: 10px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-success {
    background: var(--accent-2);
    color: #0d1117;
    border-color: var(--accent-2);
    font-weight: 600;
}
.btn-success:hover:not(:disabled) { filter: brightness(1.1); color: #0d1117; }

.btn-outline {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-large { padding: 12px 28px; font-size: 15px; }
.btn-sm    { padding: 5px 12px; font-size: 12px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-muted);
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-3); color: var(--text); }
.btn-icon svg { width: 15px; height: 15px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group-sm { flex: 0 0 120px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-input, .form-select {
    width: 100%;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text);
    font-size: 13.5px;
    transition: border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
}
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.settings-form { max-width: 540px; }

/* ── Drop Zone ── */
.dropzone-card { padding: 0; overflow: hidden; }

.drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    overflow: hidden;
}
.drop-zone:hover,
.drop-zone.hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.drop-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px;
    text-align: center;
    user-select: none;
}
.drop-icon {
    width: 56px; height: 56px;
    background: var(--bg-3);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
    border: 1px solid var(--border);
}
.drop-icon svg { width: 28px; height: 28px; }

.drop-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.drop-subtitle { font-size: 13px; color: var(--text-muted); }

.drop-zone-active-overlay {
    position: absolute; inset: 0;
    background: var(--accent-dim);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700;
    color: var(--accent);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}
.drop-zone.dragging .drop-zone-active-overlay { opacity: 1; }
.drop-zone.dragging .drop-zone-inner { opacity: 0.3; }

/* File preview strip */
.file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-3);
}
.file-preview-icon {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
    color: var(--accent);
    flex-shrink: 0;
}
.file-preview-icon svg { width: 18px; height: 18px; }
.file-preview-info { flex: 1; min-width: 0; }
.file-name {
    display: block;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-size { font-size: 12px; color: var(--text-muted); }
.remove-file { margin-left: auto; }

/* ── Operation grid ── */
.operation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.operation-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px;
    background: var(--bg-3);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.operation-tile:hover { border-color: var(--accent); }
.operation-tile.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.op-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.op-icon svg { width: 20px; height: 20px; }

.op-ocr      { background: rgba(124,92,252,.2);  color: var(--accent); }
.op-docx     { background: rgba(63,185,80,.2);   color: var(--accent-2); }
.op-xlsx     { background: rgba(88,166,255,.2);  color: var(--info); }
.op-pdfa     { background: rgba(210,153,34,.2);  color: var(--warn); }
.op-docx-ocr { background: rgba(63,185,80,.15);  color: #5cb85c; }
.op-xlsx-ocr { background: rgba(88,166,255,.15); color: #79b8ff; }
.op-img-ocr  { background: rgba(248,81,73,.15);  color: var(--danger); }

.op-label { font-weight: 600; font-size: 13px; color: var(--text); }
.op-desc  { font-size: 11.5px; color: var(--text-muted); }

.language-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.language-row .form-label { margin-bottom: 0; white-space: nowrap; }
.language-row .form-select { max-width: 240px; }

/* ── Action row ── */
.action-row { display: flex; justify-content: flex-end; margin-bottom: 20px; }

/* ── Progress ── */
.progress-card { padding: 20px 24px; }
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.progress-bar-wrap {
    height: 6px;
    background: var(--bg-3);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 99px;
    width: 0%;
    transition: width 0.5s ease;
}
.progress-bar.animated {
    width: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover), var(--accent));
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:0 0} }
.progress-hint { font-size: 12px; color: var(--text-faint); }

/* ── Result / Error cards ── */
.result-card, .error-card {
    display: flex;
    align-items: center;
    gap: 16px;
}
.result-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.result-icon svg { width: 24px; height: 24px; }
.result-success { background: rgba(63,185,80,.15); color: var(--accent-2); }
.result-error   { background: rgba(248,81,73,.15);  color: var(--danger); }
.result-info { flex: 1; }
.result-info h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.result-info p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
    vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-3); }

.mono   { font-family: var(--font-mono); font-size: 12px; }
.nowrap { white-space: nowrap; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.status-badge, .op-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 500;
}

.status-success  { background: rgba(63,185,80,.15);  color: var(--accent-2); }
.status-error    { background: rgba(248,81,73,.15);   color: var(--danger); }
.status-pending,
.status-processing { background: rgba(210,153,34,.15); color: var(--warn); }

.op-ocr    { background: rgba(124,92,252,.15); color: var(--accent); }
.op-to-docx{ background: rgba(63,185,80,.15);  color: var(--accent-2); }
.op-to-xlsx{ background: rgba(88,166,255,.15); color: var(--info); }
.op-to-pdfa{ background: rgba(210,153,34,.15); color: var(--warn); }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 16px; justify-content: center; }
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    transition: all var(--transition);
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-faint);
}
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; display: block; opacity: .4; }
.empty-state-sm { padding: 16px; color: var(--text-faint); font-size: 13px; }

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
}
.alert-error   { background: rgba(248,81,73,.12);  border: 1px solid rgba(248,81,73,.3);  color: var(--danger); }
.alert-success { background: rgba(63,185,80,.12);  border: 1px solid rgba(63,185,80,.3);  color: var(--accent-2); }
.alert-warn    { background: rgba(210,153,34,.12); border: 1px solid rgba(210,153,34,.3); color: var(--warn); }

/* ── Settings tabs ── */
.settings-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.tab-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition), border-color var(--transition);
    cursor: pointer;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

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

/* DB radio tiles */
.radio-group { display: flex; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.radio-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 14px 18px;
    background: var(--bg-3);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    min-width: 180px;
    transition: all var(--transition);
}
.radio-tile svg { color: var(--text-muted); }
.radio-tile span { font-weight: 600; font-size: 13px; color: var(--text); }
.radio-tile small { font-size: 11.5px; color: var(--text-muted); }
.radio-tile:hover { border-color: var(--accent); }
.radio-tile.active { border-color: var(--accent); background: var(--accent-dim); }
.radio-tile.active svg { color: var(--accent); }

.mssql-section { margin-top: 4px; }

/* Migration */
.migration-layout { display: flex; flex-direction: column; gap: 20px; }
.migration-source { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.mig-box { flex: 0 0 auto; min-width: 160px; }
.mig-box h4 { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.mig-arrow { font-size: 20px; color: var(--text-faint); }
.db-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .04em;
}
.db-sqlite { background: rgba(88,166,255,.15); color: var(--info); }
.db-mssql  { background: rgba(248,81,73,.15);  color: var(--danger); }

.migration-actions { display: flex; gap: 10px; }
.migration-results { background: var(--bg-3); border-radius: var(--radius); padding: 16px; }
.mig-results-title { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .05em; }

.test-list { display: flex; flex-direction: column; gap: 8px; }
.test-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
}
.test-dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    margin-top: 1px;
}
.test-dot-ok    { background: rgba(63,185,80,.2); color: var(--accent-2); }
.test-dot-error { background: rgba(248,81,73,.2); color: var(--danger); }
.test-name { color: var(--text); flex: 1; }
.test-msg  { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }

.mig-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

/* Backup */
.backup-action-row { margin-bottom: 24px; }
.backup-list { margin-top: 12px; }

/* Health */
.health-overview { margin-bottom: 20px; }
.health-status-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.health-status-card.status-ok    { background: rgba(63,185,80,.08);  border-color: rgba(63,185,80,.3); }
.health-status-card.status-warn  { background: rgba(210,153,34,.08); border-color: rgba(210,153,34,.3); }
.health-status-card.status-error { background: rgba(248,81,73,.08);  border-color: rgba(248,81,73,.3); }

.status-card-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.05);
}
.status-card-icon svg { width: 24px; height: 24px; }
.status-ok    .status-card-icon { color: var(--accent-2); }
.status-warn  .status-card-icon { color: var(--warn); }
.status-error .status-card-icon { color: var(--danger); }

.health-status-card h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.health-status-card p  { font-size: 13px; color: var(--text-muted); }

.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.health-card { padding: 20px; margin-bottom: 0; }
.health-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.health-card-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }

.health-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
}
.dot-ok    { background: var(--accent-2); box-shadow: 0 0 6px rgba(63,185,80,.5); }
.dot-warn  { background: var(--warn);     box-shadow: 0 0 6px rgba(210,153,34,.5); }
.dot-error { background: var(--danger);   box-shadow: 0 0 6px rgba(248,81,73,.5); }

.info-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.info-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 500;
    padding: 5px 0;
    width: 40%;
    vertical-align: top;
}
.info-table td {
    color: var(--text);
    padding: 5px 0;
    word-break: break-all;
}

.health-refresh { text-align: right; margin-top: 16px; }

.text-success { color: var(--accent-2); }
.text-error   { color: var(--danger); }
.text-muted   { color: var(--text-muted); }

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

/* ── Toast notifications ── */
#toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 9999;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--bg-3);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 13.5px;
    color: var(--text);
    animation: toast-in .2s ease;
    max-width: 360px;
}
.toast-success { border-color: rgba(63,185,80,.4);  }
.toast-error   { border-color: rgba(248,81,73,.4);  }
.toast-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.toast-success .toast-dot { background: var(--accent-2); }
.toast-error   .toast-dot { background: var(--danger); }

@keyframes toast-in  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes toast-out { from { opacity:1; transform:none; } to { opacity:0; transform:translateY(8px); } }

/* ── Upload page layout ── */
.upload-page {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ════════════════════════════════════════════════════════════
   API-Docs page
════════════════════════════════════════════════════════════ */

.api-docs { display: flex; flex-direction: column; gap: 1.25rem; }

.api-hero {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}
.api-hero-icon {
    flex-shrink: 0;
    width: 56px; height: 56px;
    background: var(--accent-dim);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
}
.api-hero-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 .25rem; }
.api-hero-sub   { color: var(--text-muted); margin: 0; line-height: 1.6; font-size: .9rem; }

.api-url-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .6rem 1rem;
    font-size: .88rem;
    overflow-x: auto;
}

.api-endpoint-url {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: .6rem 1rem;
    font-size: .85rem;
    margin: .75rem 0 1rem;
    overflow-x: auto;
}

.api-subheading {
    font-size: .88rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin: 1.25rem 0 .5rem;
}

.api-table-wrap { overflow-x: auto; }
.api-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.api-table th {
    text-align: left;
    padding: .5rem .75rem;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.api-table td {
    padding: .55rem .75rem;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: top;
}
.api-table tr:last-child td { border-bottom: none; }

.api-code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    font-size: .82rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    color: var(--text);
    margin: 0;
}

.method-badge {
    display: inline-block;
    padding: .15em .5em;
    border-radius: 4px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    margin-right: .4em;
    vertical-align: .05em;
}
.method-post { background: rgba(63,185,80,.2); color: #3fb950; }
.method-get  { background: rgba(88,166,255,.2); color: #58a6ff; }

.badge-yes  { color: var(--accent-2); font-weight: 700; }
.badge-warn {
    background: rgba(210,153,34,.2); color: var(--warn);
    padding: .1em .45em; border-radius: 4px; font-size: .78rem; font-weight: 600;
}

.api-langs {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
    margin-top: .5rem;
}
.api-lang-chip {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .15em .5em;
    font-size: .82rem;
}

/* n8n flow */
.n8n-flow   { display: flex; flex-direction: column; gap: 0; }
.n8n-arrow  { text-align: center; font-size: 1.25rem; color: var(--text-faint); line-height: 1.8; }
.n8n-step {
    display: flex;
    gap: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}
.n8n-step-num {
    flex-shrink: 0;
    width: 26px; height: 26px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700;
}
.n8n-step-body { flex: 1; font-size: .875rem; line-height: 1.6; }
.n8n-list { margin: .4rem 0 0; padding-left: 1.2rem; }
.n8n-list li { margin-bottom: .2rem; }

.api-note {
    display: flex;
    gap: .6rem;
    background: rgba(88,166,255,.08);
    border: 1px solid rgba(88,166,255,.2);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    font-size: .875rem;
    color: var(--info);
    margin-top: 1rem;
}

/* ════════════════════════════════════════════════════════════
   API-Keys management (Settings tab)
════════════════════════════════════════════════════════════ */

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.api-key-create-wrap {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.api-key-reveal {
    background: rgba(124,92,252,.08);
    border: 1px solid rgba(124,92,252,.3);
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    margin-bottom: 1rem;
}
.api-key-reveal-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
    margin-bottom: .25rem;
}
.api-key-copy-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}
.api-key-value {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .4rem .7rem;
    font-size: .82rem;
    word-break: break-all;
    color: var(--accent-hover);
    min-width: 0;
}

.api-keys-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.api-keys-table th {
    text-align: left;
    padding: .5rem .75rem;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.api-keys-table td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.api-keys-table tr:last-child td { border-bottom: none; }
.api-keys-empty {
    text-align: center;
    color: var(--text-faint);
    padding: 2rem !important;
}
.api-key-delete {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    padding: .25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color .15s;
}
.api-key-delete:hover { color: var(--danger); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .health-grid { grid-template-columns: 1fr; }
    .operation-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .radio-group { flex-direction: column; }
    .result-card, .error-card { flex-direction: column; align-items: flex-start; }
}

/* hidden utility */
.hidden { display: none !important; }
