:root { color-scheme: dark; }
:root[data-theme="light"] {
	color-scheme: light;
	--c-bg: #f8fafc;
	--c-panel: #ffffff;
	--c-panel-light: #eef2f6;
	--c-border: #dbe3ee;
	--c-border-strong: #94a3b8;
	--c-text: #0f172a;
	--c-muted: #64748b;
	--c-accent: #1d4ed8;
	--c-success: #15803d;
	--c-error: #dc2626;
	--c-info-bg: #eff6ff;
	--c-header-bg: #ffffff;
	--c-header-text: #0f172a;
	--c-workspace: #ffffff;
	--c-tabs-bg: #e2e8f0;
	--c-tab-bg: #cbd5e1;
	--c-tab-hover: #f1f5f9;
	--term-bg: #ffffff;
	--shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
	--sql-keyword: #1d4ed8;
	--sql-ddl: #92400e;
	--sql-dml: #1d4ed8;
	--sql-dcl: #7e22ce;
	--sql-function: #a16207;
	--sql-string: #15803d;
	--sql-number: #be123c;
	--sql-comment: #64748b;
	--sql-identifier: #0e7490;
}

.theme-settings { position: relative; flex-shrink: 0; margin-left: 4px; }
body > .theme-settings { position: fixed; top: 10px; right: 16px; z-index: 1300; }
.theme-settings__toggle {
	display: inline-flex; align-items: center; justify-content: center;
	width: 34px; height: 34px; padding: 0; border: 1px solid var(--c-border);
	border-radius: 6px; background: var(--c-bg); color: var(--c-text); cursor: pointer;
}
.theme-settings__toggle:hover, .theme-settings__toggle[aria-expanded="true"] { background: var(--c-panel-light); }
.theme-settings__panel {
	position: absolute; top: calc(100% + 8px); right: 0; width: 220px; padding: 16px;
	background: var(--c-panel); color: var(--c-text); border: 1px solid var(--c-border);
	border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); z-index: 1300;
}
.theme-settings__panel[hidden] { display: none; }
.theme-settings__title { margin: 0 0 16px; font-size: 14px; font-weight: 700; }
.theme-settings__label { margin-bottom: 8px; font-size: 12px; color: var(--c-muted); }
.theme-settings__choices { display: flex; gap: 8px; }
.theme-settings__choices button {
	flex: 1; padding: 8px; border: 1px solid var(--c-border); border-radius: 6px;
	background: var(--c-bg); color: var(--c-text); font: inherit; cursor: pointer;
}
.theme-settings__choices button[aria-pressed="true"] { border-color: var(--c-primary); color: var(--c-accent, #60a5fa); background: var(--c-primary-weak, rgba(37, 99, 235, 0.2)); }
.theme-settings button:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

:root[data-theme="light"] .global-header,
:root[data-theme="light"] .global-nav { background: var(--c-header-bg); color: var(--c-text); border-color: var(--c-border); }
:root[data-theme="light"] .global-nav__item,
:root[data-theme="light"] .global-nav-toggle,
:root[data-theme="light"] .global-badge,
:root[data-theme="light"] .db-pill,
:root[data-theme="light"] .term-pill { color: var(--c-muted); border-color: var(--c-border); }
:root[data-theme="light"] .global-badge,
:root[data-theme="light"] .db-pill,
:root[data-theme="light"] .term-pill,
:root[data-theme="light"] .global-nav__item:hover,
:root[data-theme="light"] .global-nav-toggle:hover { background: var(--c-panel-light); }
:root[data-theme="light"] .global-nav__item.is-active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
:root[data-theme="light"] .login-brand,
:root[data-theme="light"] .form-label,
:root[data-theme="light"] .login-input,
:root[data-theme="light"] .pw-toggle-btn:hover,
:root[data-theme="light"] .terminal-tab.is-active,
:root[data-theme="light"] .btn-new-tab:hover { color: var(--c-text); }
:root[data-theme="light"] .login-input,
:root[data-theme="light"] .term-footer { background: var(--c-bg); }
:root[data-theme="light"] .login-input:focus,
:root[data-theme="light"] .pw-toggle-btn:hover,
:root[data-theme="light"] .term-quick-keys,
:root[data-theme="light"] .kbd-hint kbd,
:root[data-theme="light"] .quick-key { background: var(--c-panel-light); color: var(--c-text); border-color: var(--c-border); }
:root[data-theme="light"] .terminal-tabs-bar { background: var(--c-tabs-bg); }
:root[data-theme="light"] .terminal-tab { background: var(--c-tab-bg); }
:root[data-theme="light"] .terminal-tab:hover { background: var(--c-tab-hover); }
:root[data-theme="light"] .terminal-tab.is-active { background: var(--term-bg); }
:root[data-theme="light"] .quick-key:active { background: var(--c-primary); color: #fff; }

:root[data-theme] .bonfire-dlg-box { background: var(--c-panel); color: var(--c-text); }
:root[data-theme] .bonfire-dlg-title,
:root[data-theme] .bonfire-dlg-box .bonfire-dlg-message { color: var(--c-text); }
:root[data-theme] .bonfire-dlg-input { background: var(--c-bg); color: var(--c-text); border-color: var(--c-border); }
:root[data-theme] .bonfire-dlg-btn.btn-cancel { background: var(--c-panel-light); color: var(--c-text); }
