
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root { color-scheme: dark; }
body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background: #0f1115;
	color: #e6e7eb;
	min-height: 100vh;
}
code, pre, textarea, .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }

/* ---- login ---- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.card { background: #161922; border: 1px solid #242938; border-radius: 10px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 18px 48px rgba(0,0,0,0.45); }
.brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; }
.brand img { width: 26px; height: 26px; }
.brand span { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.02em; }
.tagline { text-align: center; color: #8b91a3; font-size: 0.82rem; margin-bottom: 26px; }
label { display: block; font-size: 0.72rem; font-weight: 600; color: #8b91a3; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
input[type="text"], input[type="password"] { width: 100%; padding: 10px 12px; background: #0f1115; border: 1px solid #2a3142; border-radius: 6px; font-size: 0.95rem; color: #e6e7eb; margin-bottom: 16px; outline: none; transition: border-color 0.15s; }
input:focus { border-color: #3b82f6; }
button { width: 100%; padding: 11px; background: #2563eb; color: #fff; border: none; border-radius: 6px; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
button:hover { background: #1d4ed8; }
button:disabled { opacity: 0.7; cursor: default; }
.error { background: #2a1416; border: 1px solid #5b2026; color: #f1a5ab; border-radius: 6px; padding: 10px 12px; font-size: 0.85rem; margin-bottom: 16px; }

/* ---- console shell ---- */
.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #161922; border-bottom: 1px solid #242938; }
.topbar .brand { margin: 0; }
.topbar .brand span { font-size: 0.98rem; }
.spacer { flex: 1; }
.conn { font-size: 0.8rem; color: #8b91a3; }
.conn b { color: #cbd0dc; font-weight: 600; }
.logout-form { display: flex; }
.logout { font-size: 0.78rem; color: #8b91a3; background: transparent; border: 1px solid #2a3142; padding: 6px 12px; border-radius: 6px; text-decoration: none; width: auto; font-weight: 400; }
.logout:hover { color: #fff; border-color: #3b4763; background: #1b2030; }
.main { display: grid; grid-template-columns: 232px 1fr; min-height: 0; }
.sidebar { border-right: 1px solid #242938; padding: 14px; overflow: auto; background: #12151c; }
.sidebar h3 { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: #6b7180; margin: 14px 0 8px; }
.sidebar h3:first-child { margin-top: 0; }
.db-select { width: 100%; padding: 8px 10px; background: #0f1115; border: 1px solid #2a3142; border-radius: 6px; color: #e6e7eb; font-size: 0.78rem; }
.tree { list-style: none; }
.tree li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; font-size: 0.86rem; color: #c2c7d4; cursor: pointer; }
.tree li:hover { background: #1b2030; }
.tree li::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: #3b4763; }
.tree li.active { background: #1f2740; color: #fff; }
.tree li.active::before { background: #3b82f6; }

/* ---- editor pane + tabs ---- */
.editor-pane { display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; background: #12151c; border-bottom: 1px solid #242938; }
.tab { width: auto; background: transparent; color: #8b91a3; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 14px; font-size: 0.85rem; font-weight: 500; }
.tab:hover { background: transparent; color: #cbd0dc; }
.tab.active { color: #fff; border-bottom-color: #2563eb; }
.panels { display: flex; min-height: 0; }
.tab-panel { flex: 1; min-width: 0; min-height: 0; overflow: auto; }
.tab-panel[hidden] { display: none; }
.editor-grid { display: grid; grid-template-rows: auto 1fr auto; height: 100%; min-height: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #242938; }
.toolbar button { width: auto; padding: 8px 18px; font-size: 0.85rem; }
.toolbar .hint { font-size: 0.78rem; color: #6b7180; }
.btn-secondary { background: #2a3142; }
.btn-secondary:hover { background: #343c52; }
textarea#sql { width: 100%; height: 100%; resize: none; padding: 16px; background: #0f1115; border: none; color: #e6e7eb; font-size: 0.92rem; line-height: 1.5; outline: none; }
.results { border-top: 1px solid #242938; background: #0c0e12; max-height: 42vh; min-height: 120px; overflow: auto; padding: 14px 16px; }
.results .placeholder { color: #6b7180; font-size: 0.86rem; }
.results pre { font-size: 0.85rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.results .sql-error { color: #f1a5ab; }
.results .meta { color: #6b7180; }
.result-table { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
.result-table th, .result-table td { border: 1px solid #242938; padding: 6px 10px; text-align: left; white-space: nowrap; }
.result-table th { position: sticky; top: 0; background: #161922; color: #cbd0dc; font-weight: 600; }
.result-table td { color: #c2c7d4; }
.result-table tbody tr:nth-child(even) td { background: #0f1115; }
.result-table .null { color: #6b7180; font-style: italic; }
.result-meta { margin-top: 10px; color: #6b7180; font-size: 0.8rem; }

/* ---- history ---- */
.history { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
.history th, .history td { border-bottom: 1px solid #1b2030; padding: 8px 12px; text-align: left; vertical-align: top; }
.history th { position: sticky; top: 0; background: #12151c; color: #8b91a3; font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.history td.nowrap { white-space: nowrap; color: #9aa1b2; }
.history td.num { text-align: right; white-space: nowrap; color: #9aa1b2; }
.history code { background: transparent; color: #cbd0dc; padding: 0; font-size: 0.82rem; }
