:root {
    --bg: #12141c;
    --panel: #1b1e2b;
    --panel-header: #20233240;
    --border: #2a2e42;
    --text: #e4e6f0;
    --text-muted: #8a90ac;
    --accent: #e8a33d;
    --accent-dim: #4a3a1e;
    --ok: #4ade80;
    --error: #e5484d;
    --error-bg: rgba(229, 72, 77, 0.16);
    --font-ui: 'Inter', system-ui, sans-serif;
    --font-code: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    height: 100%;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
}

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

.topbar__lang label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.topbar__lang select {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: #232739;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
}

.topbar__lang select:hover {
    background: #2b3046;
}

.topbar__title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar__mark {
    font-family: var(--font-code);
    color: var(--accent);
    font-size: 22px;
    font-weight: 600;
}

.topbar h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.topbar p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.layout {
    display: grid;
    grid-template-columns: minmax(420px, 640px) 1fr;
    gap: 20px;
    padding: 20px 28px 28px;
    height: calc(100vh - 78px);
}

.col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel--grow {
    flex: 1;
    min-height: 0;
}

.panel__header {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel__body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
    min-height: 0;
}

.panel__body--code {
    flex: 1;
    padding: 0;
    min-height: 0;
}

.panel__body--table {
    flex: 1;
    min-height: 0;
    position: relative;
}

.panel__footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid var(--border);
    padding: 8px 14px;
    cursor: pointer;
    background: #232739;
    color: var(--text);
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.btn:hover { background: #2b3046; }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn--ghost {
    background: transparent;
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #1a1206;
}

.btn--primary:hover { background: #f0ae4d; }

.btn--run {
    padding: 12px 14px;
    font-size: 14px;
}

.btn--accent {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
    padding: 5px 10px;
    font-size: 12px;
}

.btn--accent:hover:not(:disabled) {
    background: var(--accent-dim);
}

.badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    padding: 3px 8px;
    border-radius: 20px;
}

.badge--ok {
    color: var(--ok);
    background: rgba(74, 222, 128, 0.12);
}

.badge--error {
    color: var(--error);
    background: var(--error-bg);
}

.CodeMirror {
    height: 100% !important;
    font-family: var(--font-code);
    font-size: 13px;
    line-height: 1.5;
}

.cm-line-error {
    background: var(--error-bg);
    border-left: 3px solid var(--error);
}

.placeholder {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
    padding: 6px 2px;
}

.placeholder.error {
    color: var(--error);
}

.table-scroll {
    overflow: auto;
    height: 100%;
}

.trace-table {
    border-collapse: collapse;
    width: 100%;
    font-family: var(--font-code);
    font-size: 12.5px;
}

.trace-table.hidden { display: none; }

.trace-table th, .trace-table td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
}

.trace-table thead th {
    position: sticky;
    top: 0;
    background: #20233b;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.trace-table tbody tr:nth-child(even) {
    background: #191c29;
}

.trace-table td.col-linha {
    color: var(--accent);
    font-weight: 600;
    text-align: center;
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .col--left, .col--right { min-height: 480px; }
}
