/* Skip link: visible on keyboard focus */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0.75rem;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: #1e293b;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.skip-link:focus {
    left: 0.75rem;
    outline: 2px solid #818cf8;
    outline-offset: 2px;
}

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background-color: #f8fafc;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.table-container { overflow: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.875rem; }
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #e2e8f0;
}
tr:hover td { background-color: #f1f5f9; }
td { color: #334155; }

.tab-active {
    background-color: white !important;
    color: #0f172a !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 600;
}

.CodeMirror {
    flex: 1;
    height: auto !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    background: transparent;
    padding: 0.5rem 0;
    line-height: 1.6;
}
.CodeMirror-gutters {
    background-color: transparent;
    border-right: none;
    padding-right: 10px;
}
.CodeMirror-linenumber {
    color: #cbd5e1;
}

/* SQL autocomplete (CodeMirror show-hint) */
.CodeMirror-hints {
    z-index: 100;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    max-height: 14rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 10px -4px rgba(15, 23, 42, 0.08);
    background: #fff;
}
.CodeMirror-hint {
    padding: 0.35rem 0.65rem;
}
.CodeMirror-hint-active {
    background: #e0e7ff;
    color: #1e1b4b;
}
.CodeMirror-hint-keyword {
    color: #7c3aed;
    font-weight: 600;
}
.CodeMirror-hint-table {
    color: #0d9488;
}
.CodeMirror-hint-default-table {
    font-weight: 600;
}

.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 200ms; }

@keyframes scorePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
.score-updated { animation: scorePulse 0.5s ease; }

/* Schema ER diagram (Mermaid) */
.schema-subtab.schema-subtab-active {
    background-color: white;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    font-weight: 600;
}
.schema-diagram-viewport {
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.schema-diagram-viewport.schema-diagram-dragging {
    cursor: grabbing;
}
/* No will-change here — it promotes the layer to a raster that blurs when scaled. */
.schema-diagram-pan-layer {
    transform-origin: 0 0;
    backface-visibility: hidden;
}
.schema-diagram-viewport .mermaid {
    margin: 0 auto;
}
.schema-diagram-viewport svg {
    max-width: none;
    height: auto;
    /* Keep vector edges and text sharp under CSS transform scale */
    shape-rendering: geometricPrecision;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}
.diagram-zoom-btn:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: 0;
    z-index: 1;
}
