* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.light {
  --bg-btn-color:#1976d2;
  --bg-btn-color-hover:#0d5eaf;
  
  --bg-page: #f5f5f5;
  --bg-panel: #fff;
  --bg-header: #e3dede;
  --bg-side: #f8f9fa;
  --bg-topbar: #fff;
  --bg-editor: #fff;
  --bg-output: #fafafa;
  --bg-linenum: #f8f9fa;
  --bg-zoom: #1976d2;
  --border: #dee2e6;
  --border-subtle: #e0e0e0;
  --text: #333;
  --text-muted: #999;
  --text-label: #2c3e50;
  --scroll-track: #f1f1f1;
  --scroll-thumb: #c1c1c1;
  background: var(--bg-page);
  color: var(--text);
}

body.dark {
  --bg-btn-color:#5d5757;
  --bg-page: #1e1e1e;
  --bg-panel: #1e1e1e;
  --bg-header: #252525;
  --bg-side: #2d2d2d;
  --bg-topbar: #2d2d2d;
  --bg-editor: #1e1e1e;
  --bg-output: #0d0d0d;
  --bg-linenum: #252525;
  --bg-zoom: #5d5757;
  --border: #555;
  --border-subtle: #444;
  --text: #e0e0e0;
  --text-muted: #666;
  --text-label: #fff;
  --scroll-track: #2d2d2d;
  --scroll-thumb: #555;
  background: var(--bg-page);
  color: var(--text);
}

.top-bar-wrap {
  padding: 2px 6px 0;
  flex-shrink: 0;
}

.top-bar {
  width: 100%;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-header);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-bar-brand {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.top-bar-brand:hover {
  color: #1976d2;
}

.top-bar-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--text);
}

.top-bar-badge-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-bar-badge-icon .badge-visual-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.badge-visual-img {
  display: block;
  object-fit: contain;
  background: transparent;
}

.top-bar-badge-name {
  font-weight: bold;
}

.top-bar-user {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 500;
}

.top-bar-user::before {
  content: "– ";
  color: var(--text-muted);
  margin-right: 2px;
}

.top-bar-user:empty::before {
  content: "";
  margin: 0;
}

.top-bar-logout {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 8px;
}

.top-bar-logout:hover {
  color: #1976d2;
}

body.dark .top-bar-logout:hover {
  color: #64b5f6;
}

.top-bar-actions {
  display: flex;
  gap: 12px;
}

.main-container {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 6px;
  padding: 4px 6px;
}

/* SQL IDE: object explorer + editor on top + results below */
.sql-explorer-panel {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  align-self: stretch;
  overflow-x: hidden;
  overflow-y: auto;
}

.sql-explorer-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sql-explorer-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 400;
  color: #fff;
  background: linear-gradient(180deg, #1976d2 0%, #1565c0 100%);
  text-align: left;
  font-family: inherit;
}

.sql-explorer-head:hover {
  filter: brightness(1.05);
}

body.dark .sql-explorer-head {
  background: linear-gradient(180deg, #1e88e5 0%, #1565c0 100%);
}

.sql-explorer-chevron {
  font-size: 0.65rem;
  opacity: 0.95;
  transition: transform 0.2s ease;
}

.sql-explorer-section.collapsed .sql-explorer-chevron {
  transform: rotate(-90deg);
}

.sql-explorer-section.collapsed .sql-explorer-list {
  display: none;
}

.sql-explorer-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.88rem;
  background: var(--bg-editor);
}

/* Tables & Views lists: grow with expanded schema; push content below / scroll the explorer panel if needed. */
body.sql-ide-page #sqlExplorerTables.sql-explorer-list,
body.sql-ide-page #sqlExplorerViews.sql-explorer-list {
  max-height: none;
  overflow-y: visible;
}

.sql-explorer-item {
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text);
  border-bottom: 1px solid var(--border-subtle);
}

.sql-explorer-item:hover {
  background: var(--bg-linenum);
}

.sql-explorer-item:last-child {
  border-bottom: none;
}

/* SQL explorer: accordion table cards (periwinkle header, +/−, column rows with blue accent) */
.sql-explorer-tree {
  margin: 8px 10px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(21, 101, 192, 0.22);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  background: #eef2f7;
}
.sql-explorer-tree-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  min-height: 40px;
  background: #d6e6fc;
  border-bottom: 1px solid rgba(21, 101, 192, 0.12);
}
.sql-explorer-tree:not(.sql-explorer-tree-open) .sql-explorer-tree-head {
  border-bottom: none;
}
.sql-explorer-twisty {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
  color: #0d47a1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, "Segoe UI", sans-serif;
}
.sql-explorer-twisty:hover {
  background: rgba(255, 255, 255, 0.45);
  color: #01579b;
}
.sql-explorer-tree-label {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: #0d47a1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sql-explorer-tree-label:hover {
  background: rgba(255, 255, 255, 0.35);
}
.sql-explorer-schema {
  list-style: none;
  margin: 0;
  padding: 6px 6px 8px;
  font-size: 0.82rem;
  background: #e8ecf2;
}
.sql-explorer-col {
  display: block;
  padding: 8px 10px 8px 12px;
  margin: 0 0 4px;
  border-radius: 0 6px 6px 0;
  border-left: 4px solid #1976d2;
  background: #f3f5f8;
  cursor: pointer;
  color: #37474f;
  line-height: 1.35;
}
.sql-explorer-col:last-child {
  margin-bottom: 0;
}
.sql-explorer-col:hover {
  background: #e8eef5;
}
.sql-explorer-col-empty {
  cursor: default;
  color: var(--text-muted);
  font-style: italic;
  border-left-color: rgba(25, 118, 210, 0.35);
}
.sql-explorer-col-empty:hover {
  background: #f3f5f8;
}
.sql-explorer-col-strong {
  font-family: system-ui, "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  color: #263238;
}
.sql-explorer-col-meta {
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 400;
  color: #78909c;
}

body.dark .sql-explorer-tree {
  background: #1a2332;
  border-color: rgba(100, 181, 246, 0.25);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
body.dark .sql-explorer-tree-head {
  background: #1e3a5f;
  border-bottom-color: rgba(100, 181, 246, 0.2);
}
body.dark .sql-explorer-tree:not(.sql-explorer-tree-open) .sql-explorer-tree-head {
  border-bottom: none;
}
body.dark .sql-explorer-twisty {
  color: #bbdefb;
}
body.dark .sql-explorer-twisty:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e3f2fd;
}
body.dark .sql-explorer-tree-label {
  color: #bbdefb;
}
body.dark .sql-explorer-tree-label:hover {
  background: rgba(255, 255, 255, 0.06);
}
body.dark .sql-explorer-schema {
  background: #151d2a;
}
body.dark .sql-explorer-col {
  background: #1e2736;
  color: #eceff1;
  border-left-color: #42a5f5;
}
body.dark .sql-explorer-col:hover {
  background: #243044;
}
body.dark .sql-explorer-col-empty {
  border-left-color: rgba(66, 165, 245, 0.4);
}
body.dark .sql-explorer-col-empty:hover {
  background: #1e2736;
}
body.dark .sql-explorer-col-strong {
  color: #eceff1;
}
body.dark .sql-explorer-col-meta {
  color: #90a4ae;
}

.sql-explorer-empty {
  padding: 10px 14px;
  color: var(--text-muted);
  font-style: italic;
}

/* SQL IDE: slim editor title row (Clear + Execute only) */
body.sql-ide-page .editor-section .sql-editor-section-header.section-header {
  padding: 4px 8px;
  min-height: 0;
  font-size: 0.875rem;
}

body.sql-ide-page .sql-editor-section-header .sql-logo-badge {
  height: 24px;
  min-width: 30px;
  padding: 0 6px;
  font-size: 0.62rem;
}

body.sql-ide-page .sql-editor-section-header .editor-title strong {
  font-size: 1rem;
  line-height: 1.2;
}

body.sql-ide-page .sql-editor-section-header .header-buttons.sql-editor-actions {
  gap: 6px;
}

/* Python & SQL IDE: narrower action buttons (same height as default) */
body.python-ide-page .editor-section .section-header,
body.python-ide-page .output-section .section-header {
  padding: 6px 8px;
  min-height: 44px;
  box-sizing: border-box;
  gap: 8px;
}

body.python-ide-page .editor-section .section-header .editor-title,
body.python-ide-page .output-section .section-header .editor-title {
  min-height: 28px;
}

body.python-ide-page .editor-title-icon .python-logo {
  width: 28px;
  height: 28px;
}

body.python-ide-page .editor-section .section-header .editor-title strong,
body.python-ide-page .output-section .section-header .editor-title strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

body.python-ide-page .editor-title-python {
  font-weight: 600;
}

body.python-ide-page .top-bar,
body.sql-ide-page .top-bar {
  padding: 4px 8px;
}

body.python-ide-page .top-bar-actions,
body.python-ide-page .header-buttons,
body.sql-ide-page .top-bar-actions,
body.sql-ide-page .sql-editor-section-header .header-buttons.sql-editor-actions {
  gap: 6px;
}

body.python-ide-page .top-bar-actions .btn,
body.python-ide-page .header-buttons .btn,
body.sql-ide-page .top-bar-actions .btn,
body.sql-ide-page .sql-editor-actions .btn {
  min-width: 0;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 400;
  border-radius: 7px;
  letter-spacing: 0.4px;
}

body.python-ide-page .top-bar-actions .btn::before,
body.python-ide-page .header-buttons .btn::before,
body.sql-ide-page .top-bar-actions .btn::before,
body.sql-ide-page .sql-editor-actions .btn::before {
  border-radius: 7px 7px 0 0;
}

body.python-ide-page .top-bar-actions .btn-svg,
body.python-ide-page .header-buttons .btn-svg,
body.sql-ide-page .top-bar-actions .btn-svg,
body.sql-ide-page .sql-editor-actions .btn-svg {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

/* Python IDE: editor and output — matching pane style; output ~10% narrower */
body.python-ide-page .editor-section {
  flex: 1271;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

body.python-ide-page .output-section {
  flex: 729;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

body.python-ide-page .editor-section .section-header,
body.python-ide-page .output-section .section-header {
  min-height: 48px;
  height: 48px;
  box-sizing: border-box;
}

body.python-ide-page .editor-wrapper,
body.python-ide-page .output-section .sql-results-wrapper {
  margin: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-editor);
}

body.python-ide-page .sql-editor-wrapper #editor,
body.python-ide-page .sql-results-wrapper #output {
  font-family: Consolas, monospace;
  font-size: 14px;
  line-height: 22.4px;
  background: var(--bg-editor);
  color: var(--text);
}

body.python-ide-page .sql-results-wrapper #output {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* SQL & Python IDE: zoom +/- bottom-right in one row */
body.sql-ide-page .sql-editor-wrapper,
body.python-ide-page .sql-editor-wrapper {
  position: relative;
}

body.sql-ide-page .sql-editor-wrapper #editor,
body.python-ide-page .sql-editor-wrapper #editor {
  padding-bottom: 36px;
  padding-right: 76px;
}

body.sql-ide-page .sql-editor-zoom-overlay,
body.sql-ide-page .sql-results-zoom-overlay,
body.python-ide-page .sql-editor-zoom-overlay,
body.python-ide-page .sql-results-zoom-overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

body.sql-ide-page .sql-editor-zoom-overlay .sql-zoom-fab,
body.sql-ide-page .sql-results-zoom-overlay .sql-zoom-fab,
body.python-ide-page .sql-editor-zoom-overlay .sql-zoom-fab,
body.python-ide-page .sql-results-zoom-overlay .sql-zoom-fab {
  pointer-events: auto;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  font-size: 0;
  background: var(--bg-btn-color);
  color: #fff;
  border: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 3px 0 rgba(0, 0, 0, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.25);
}

body.dark.sql-ide-page .sql-editor-zoom-overlay .sql-zoom-fab,
body.dark.sql-ide-page .sql-results-zoom-overlay .sql-zoom-fab,
body.dark.python-ide-page .sql-editor-zoom-overlay .sql-zoom-fab,
body.dark.python-ide-page .sql-results-zoom-overlay .sql-zoom-fab {
  background: var(--bg-btn-color);
  color: #fff;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.15) inset,
    0 3px 0 rgba(0, 0, 0, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.35);
}

body.sql-ide-page .sql-editor-zoom-overlay .sql-zoom-fab:hover,
body.sql-ide-page .sql-results-zoom-overlay .sql-zoom-fab:hover,
body.python-ide-page .sql-editor-zoom-overlay .sql-zoom-fab:hover,
body.python-ide-page .sql-results-zoom-overlay .sql-zoom-fab:hover {
  background: var(--bg-btn-color-hover);
  transform: translateY(-1px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.25) inset,
    0 4px 0 rgba(0, 0, 0, 0.15),
    0 6px 14px rgba(0, 0, 0, 0.2);
}

body.sql-ide-page .sql-editor-zoom-overlay .zoom-btn-svg,
body.sql-ide-page .sql-results-zoom-overlay .zoom-btn-svg,
body.python-ide-page .sql-editor-zoom-overlay .zoom-btn-svg,
body.python-ide-page .sql-results-zoom-overlay .zoom-btn-svg {
  width: 14px;
  height: 14px;
}

body.sql-ide-page .sql-editor-zoom-overlay .zoom-btn::before,
body.sql-ide-page .sql-results-zoom-overlay .zoom-btn::before,
body.python-ide-page .sql-editor-zoom-overlay .zoom-btn::before,
body.python-ide-page .sql-results-zoom-overlay .zoom-btn::before {
  left: 12%;
  right: 12%;
}

body.sql-ide-page .sql-results-wrapper,
body.python-ide-page .sql-results-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 8px;
}

body.sql-ide-page .sql-results-wrapper #sqlResults,
body.python-ide-page .sql-results-wrapper #output {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 16px;
  padding-bottom: 40px;
  padding-right: 76px;
}

body.sql-ide-page .sql-results-wrapper #sqlResults {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: normal;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-output);
  color: var(--text);
}

body.python-ide-page .sql-results-wrapper #output {
  overflow: auto;
  white-space: pre;
  flex: 1;
  min-height: 0;
}

.sql-btn-clear {
  background: #c62828 !important;
  color: #fff !important;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 3px 0 rgba(0, 0, 0, 0.15),
    0 4px 10px rgba(198, 40, 40, 0.35);
}

.sql-btn-clear:hover {
  background: #b71c1c !important;
}

.sql-btn-execute {
  background: #2e7d32 !important;
  color: #fff !important;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 3px 0 rgba(0, 0, 0, 0.15),
    0 4px 10px rgba(46, 125, 50, 0.35);
}

.sql-btn-execute:hover {
  background: #1b5e20 !important;
}

body.dark .sql-btn-clear {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.12) inset,
    0 3px 0 rgba(0, 0, 0, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.35);
}

body.dark .sql-btn-execute {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.12) inset,
    0 3px 0 rgba(0, 0, 0, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.35);
}


.sql-results-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 1rem;
  text-align: center;
}

.sql-results-msg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
}

.sql-results-msg.success {
  color: #2e7d32;
}

body.dark .sql-results-msg.success {
  color: #81c784;
}

.sql-init-wait {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: #1976d2;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}

body.dark .sql-init-wait {
  color: #64b5f6;
}

.sql-init-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(25, 118, 210, 0.25);
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: sqlInitSpin 0.7s linear infinite;
  flex-shrink: 0;
}

body.dark .sql-init-spinner {
  border-color: rgba(100, 181, 246, 0.25);
  border-top-color: #64b5f6;
}

@keyframes sqlInitSpin {
  to {
    transform: rotate(360deg);
  }
}

/* SQL IDE: editor on top, results panel below (same page only) */
.sql-ide-stack {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

/* SQL editor height is set by drag handle (default ~3 lines + header) */
.sql-ide-stack .editor-section {
  flex: 0 0 200px;
  height: 200px;
  min-height: 110px;
  overflow: hidden;
}

.sql-stack-resizer {
  flex: 0 0 5px;
  height: 5px;
  margin: 0;
  border: none;
  border-radius: 2px;
  background: var(--border-subtle);
  cursor: row-resize;
  touch-action: none;
  user-select: none;
  position: relative;
  z-index: 3;
}

.sql-stack-resizer:hover,
.sql-stack-resizer:focus-visible {
  background: #1976d2;
}

body.dark .sql-stack-resizer:hover,
body.dark .sql-stack-resizer:focus-visible {
  background: #42a5f5;
}

.sql-stack-resizer:focus-visible {
  outline: 2px solid #1976d2;
  outline-offset: 1px;
}

.sql-ide-stack .editor-section .editor-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sql-ide-stack .output-section {
  flex: 1 1 0;
  min-height: 120px;
  overflow: hidden;
}

.side-panel {
  width: 66px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 4px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-header);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.side-btn-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.side-btn,
.theme-toggle {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.side-btn::before,
.theme-toggle::before {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 45%;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
}

a.side-btn {
  text-decoration: none;
}

.side-btn {
  background: var(--bg-btn-color);
  color: #fff;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 6px 12px rgba(0, 0, 0, 0.25),
    0 8px 20px rgba(25, 118, 210, 0.4);
}

.side-btn:hover {
  background: var(--bg-btn-color-hover);
  transform: translateY(-3px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.25) inset,
    0 5px 0 rgba(0, 0, 0, 0.15),
    0 8px 16px rgba(0, 0, 0, 0.3),
    0 12px 28px rgba(25, 118, 210, 0.5);
}

.side-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.1) inset,
    0 1px 4px rgba(25, 118, 210, 0.4);
}

body.light .theme-toggle {
  background: #1976d2;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 6px 12px rgba(0, 0, 0, 0.25),
    0 8px 20px rgba(25, 118, 210, 0.4);
}

body.light .theme-toggle:hover {
  background: #052446;
}

body.dark .theme-toggle {
  background: #f57c00;
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 4px 0 rgba(0, 0, 0, 0.25),
    0 6px 12px rgba(0, 0, 0, 0.3),
    0 8px 20px rgba(245, 124, 0, 0.4);
}

body.dark .theme-toggle:hover {
  background: #ef6c00;
}

.theme-toggle:hover {
  transform: translateY(-3px);
}

body.light .theme-toggle:hover {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.25) inset,
    0 5px 0 rgba(0, 0, 0, 0.15),
    0 8px 16px rgba(0, 0, 0, 0.3),
    0 12px 28px rgba(25, 118, 210, 0.5);
}

body.dark .theme-toggle:hover {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.25) inset,
    0 5px 0 rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.35),
    0 12px 28px rgba(245, 124, 0, 0.5);
}

.theme-toggle:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.1) inset,
    0 1px 4px rgba(0, 0, 0, 0.3);
}

.side-btn-svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

body.dark .theme-toggle .icon-sun {
  display: block;
}

body.dark .theme-toggle .icon-moon {
  display: none;
}

.side-btn-label {
  font-size: 10px;
  font-weight: 400;
  text-align: center;
  text-transform: capitalize;
  letter-spacing: 0.2px;
  line-height: 1.15;
  max-width: 48px;
  color: var(--text-label);
}

.editor-section {
  flex: 2;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.output-section {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.section-header,
.zoom-controls {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-header);
  color: var(--text);
  flex-shrink: 0;
}

.editor-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.editor-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.editor-title-icon .python-logo {
  width: 40px;
  height: 40px;
  display: block;
  flex-shrink: 0;
}

.editor-title-python {
  font-weight: 700;
}

.zoom-controls {
  padding: 3px 10px;
  border-bottom: none;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  gap: 6px;
}

.header-buttons {
  display: flex;
  gap: 10px;
}

.header-buttons .btn {
  min-width: 120px;
}

.btn-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-right: 8px;
  vertical-align: middle;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 3px 0 rgba(0, 0, 0, 0.15),
    0 4px 8px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.1);
  text-transform: capitalize;
  letter-spacing: 0.4px;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  border-radius: 10px 10px 0 0;
  background: transparent;
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.3) inset,
    0 4px 0 rgba(0, 0, 0, 0.12),
    0 6px 12px rgba(0, 0, 0, 0.25),
    0 12px 24px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.15) inset,
    0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.btn-execute {
  background: #0cad14;
  color: #fff;
}

.btn-execute:hover:not(:disabled) {
  background: #3d8b40;
}

.btn-execute:disabled {
  background: #9e9e9e;
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-clear {
  background: #d0120f;
  color: #fff;
}

.btn-clear:hover {
  background: #c62828;
}

.btn-load,
.btn-save {
  background: #1976d2;
  color: #fff;
}

.btn-load:hover,
.btn-save:hover {
  background: #1976d2;
}

.editor-wrapper {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  margin: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}

.line-numbers {
  padding: 16px 6px 16px 4px;
  text-align: right;
  font-family: Consolas, monospace;
  font-size: 14px;
  line-height: 22.4px;
  user-select: none;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-linenum);
  color: var(--text-muted);
  overflow-y: auto;
  min-width: 40px;
  white-space: pre;
}

#editor {
  flex: 1;
  padding: 16px;
  border: none;
  font-family: Consolas, monospace;
  font-size: 14px;
  line-height: 22.4px;
  resize: none;
  outline: none;
  overflow: auto;
  overflow-wrap: normal;
  white-space: pre;
  background: var(--bg-editor);
  color: var(--text);
}

#output {
  flex: 1;
  min-height: 0;
  padding: 12px;
  margin: 4px;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-output);
  color: var(--text);
}

#sqlResults {
  flex: 1;
  min-height: 0;
  padding: 12px;
  margin: 4px;
  overflow: auto;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: normal;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-output);
  color: var(--text);
}

.sql-dialect-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 10px;
}

.sql-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, #0d47a1, #1976d2);
}

body.dark .sql-logo-badge {
  background: linear-gradient(135deg, #1565c0, #42a5f5);
}

.sql-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.sql-result-table th,
.sql-result-table td {
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  text-align: left;
}

.sql-result-table th {
  background: var(--bg-header);
  font-weight: 600;
}

.sql-result-table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.03);
}

body.dark .sql-result-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.04);
}

.console-input-wrap {
  display: inline-flex;
  align-items: center;
  min-width: 120px;
  margin-left: 2px;
}

.console-input {
  flex: 1;
  min-width: 80px;
  padding: 2px 6px;
  font-family: Consolas, monospace;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--text);
  outline: none;
}

.console-input::placeholder {
  color: var(--text-muted);
}

.zoom-btn-svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: var(--bg-btn-color);
  color: #fff;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.35) inset,
    0 3px 0 rgba(0, 0, 0, 0.12),
    0 4px 10px rgba(0, 0, 0, 0.15);
}

.zoom-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 45%;
  border-radius: 50%;
  background: transparent;
  pointer-events: none;
}

body.dark .zoom-btn {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.15) inset,
    0 3px 0 rgba(0, 0, 0, 0.25),
    0 4px 10px rgba(0, 0, 0, 0.35);
}

.zoom-btn:hover {
  background:var(--bg-btn-color-hover);
  transform: translateY(-3px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.4) inset,
    0 4px 0 rgba(0, 0, 0, 0.1),
    0 6px 14px rgba(0, 0, 0, 0.2);
}

body.dark .zoom-btn:hover {
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.2) inset,
    0 4px 0 rgba(0, 0, 0, 0.2),
    0 6px 14px rgba(0, 0, 0, 0.4);
}

.zoom-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 1px 4px rgba(0, 0, 0, 0.2);
}

.error {
  color: #f44336;
  font-weight: 500;
}

.success {
  color: #4caf50;
  font-weight: 500;
}

.loading {
  color: #2196f3;
  font-weight: 500;
}

.program-status {
  color: var(--text);
  font-weight: 600;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--scroll-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 5px;
}

/* Responsive: tablet */
@media (max-width: 900px) {
  body.sql-ide-page .main-container {
    flex-direction: column;
  }

  body.sql-ide-page .sql-explorer-panel {
    width: 100%;
    flex-direction: row;
    max-height: 200px;
  }

  body.sql-ide-page .sql-explorer-section {
    flex: 1;
    min-width: 0;
  }

  body.sql-ide-page .sql-ide-stack {
    flex: 1;
    width: 100%;
    min-height: 320px;
  }

  body.sql-ide-page .sql-ide-stack .output-section {
    min-height: 120px;
  }

  .main-container {
    flex-direction: column;
    padding: 4px;
    gap: 4px;
  }

  .side-panel {
    width: 100%;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 12px;
  }

  .side-btn-container {
    flex-direction: row;
    gap: 6px;
  }

  .editor-section,
  .output-section {
    min-height: 220px;
  }

  .top-bar-wrap {
    padding: 2px 4px 0;
  }

  .top-bar {
    padding: 7px 12px;
    gap: 8px;
  }

  .top-bar-actions {
    gap: 8px;
  }

  .btn {
    padding: 10px 18px;
    font-size: 13px;
  }

  .btn-svg {
    width: 16px;
    height: 16px;
    margin-right: 6px;
  }
}

/* Responsive: mobile */
@media (max-width: 600px) {
  .top-bar-wrap {
    padding: 5px 4px 0;
  }

  .top-bar {
    padding: 7px 10px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .top-bar-left {
    width: 100%;
    order: 1;
  }

  .top-bar-actions {
    width: 100%;
    order: 2;
    justify-content: flex-end;
  }

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

  .main-container {
    padding: 6px;
  }

  .side-panel {
    padding: 10px 12px;
    gap: 8px;
  }

  .side-btn,
  .theme-toggle {
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .side-btn-svg {
    width: 20px;
    height: 20px;
  }

  .side-btn-label {
    font-size: 10px;
  }

  .section-header,
  .zoom-controls {
    padding: 6px 10px;
    font-size: 14px;
  }

  body.sql-ide-page .editor-section .sql-editor-section-header.section-header {
    padding: 4px 6px;
    font-size: 0.8rem;
  }

  .header-buttons {
    gap: 8px;
  }

  .editor-section,
  .output-section {
    min-height: 180px;
  }

  body.sql-ide-page .sql-ide-stack .output-section {
    min-height: 100px;
  }

  .editor-wrapper {
    margin: 6px;
  }

  .line-numbers {
    padding: 12px 4px 12px 4px;
    font-size: 12px;
    line-height: 1.5;
    min-width: 32px;
  }

  #editor {
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
  }

  body.sql-ide-page .sql-editor-wrapper #editor,
  body.python-ide-page .sql-editor-wrapper #editor {
    padding-right: 68px;
    padding-bottom: 34px;
  }

  body.python-ide-page .sql-editor-wrapper #editor,
  body.python-ide-page .sql-results-wrapper #output {
    font-size: 13px;
    line-height: 1.5;
  }

  body.sql-ide-page .sql-results-wrapper,
  body.python-ide-page .sql-results-wrapper {
    margin: 6px;
  }

  body.sql-ide-page .sql-results-wrapper #sqlResults,
  body.python-ide-page .sql-results-wrapper #output {
    padding: 12px;
    padding-right: 68px;
    padding-bottom: 34px;
    margin: 0;
    font-size: 12px;
  }

  #sqlResults {
    padding: 12px;
    margin: 6px;
    font-size: 12px;
  }

  .zoom-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .zoom-btn-svg {
    width: 14px;
    height: 14px;
  }
}

/* --- AI learner IDE -------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.ai-ide-page .top-bar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ai-ide-chip {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-editor);
}

body.dark .ai-ide-chip {
  color: #aaa;
}

.ai-ide-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 12px;
  padding: 12px;
}

body.ai-ide-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ai-ide-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
  padding: 12px;
  gap: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.dark .ai-ide-sidebar {
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.ai-ide-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-ide-help {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.ai-ide-project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  font-size: 0.9rem;
}

.ai-ide-project-li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}

.ai-ide-project-li:hover {
  background: var(--bg-linenum);
}

.ai-ide-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding-bottom: 28px;
}

.ai-ide-banner {
  background: rgba(25, 118, 210, 0.08);
  border: 1px solid rgba(25, 118, 210, 0.25);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

body.dark .ai-ide-banner {
  background: rgba(66, 165, 245, 0.1);
  border-color: rgba(100, 181, 246, 0.3);
}

.card-like {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-panel);
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-ide-h2 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}

.ai-ide-h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
  color: var(--text-muted);
}

.ai-ide-muted {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.ai-ide-key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ai-ide-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg-editor);
  color: var(--text);
  font-family: Consolas, "Monaco", monospace;
}

.ai-ide-title-input {
  font-family: inherit;
}

.ai-ide-textarea,
.ai-ide-editor {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: Consolas, "Monaco", monospace;
  font-size: 0.875rem;
  line-height: 1.55;
  background: var(--bg-editor);
  color: var(--text);
  resize: vertical;
}

.ai-ide-editor {
  flex: 1;
  min-height: 340px;
  resize: vertical;
}

.ai-ide-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-editor);
  color: var(--text);
}

.ai-ide-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 12px;
  justify-content: space-between;
}

.ai-ide-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ai-ide-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ai-ide-status {
  margin-top: 10px;
  font-size: 0.87rem;
  min-height: 1.35em;
  color: var(--text-muted);
}

.ai-ide-status-panel {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-linenum);
  font-weight: 500;
}

.ai-ide-status-panel:empty {
  display: none;
}

.ai-ide-status--success {
  color: #1b5e20;
  background: #e8f5e9;
  border-color: #a5d6a7;
}

body.dark .ai-ide-status--success {
  color: #c8e6c9;
  background: rgba(46, 125, 50, 0.25);
  border-color: rgba(129, 199, 132, 0.45);
}

.ai-ide-status--err {
  color: #b71c1c;
  background: #ffebee;
  border-color: #ef9a9a;
}

body.dark .ai-ide-status--err {
  color: #ffcdd2;
  background: rgba(183, 28, 28, 0.2);
  border-color: rgba(239, 154, 154, 0.45);
}

.ai-ide-status--info {
  color: #0d47a1;
  background: #e3f2fd;
  border-color: #90caf9;
}

body.dark .ai-ide-status--info {
  color: #e3f2fd;
  background: rgba(13, 71, 161, 0.35);
  border-color: rgba(144, 202, 249, 0.45);
}

.ai-ide-btn-soft {
  background: var(--bg-linenum);
  color: var(--text);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
}

.ai-ide-btn-accent {
  background: #3949ab;
  color: #fff;
  border: none;
}

.ai-ide-btn-accent:hover {
  filter: brightness(1.06);
}

.ai-ide-btn-download {
  background: #00838f !important;
  color: #fff !important;
  border: none;
}

.ai-ide-btn-download:hover {
  filter: brightness(1.05);
}

.ai-ide-workspace .ai-ide-work-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
}

.ai-ide-title-row {
  flex: 1;
  min-width: 200px;
}

.ai-ide-title-label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ai-ide-work-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-ide-subtitle {
  margin-bottom: 0;
}

.ai-ide-split {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  min-height: 420px;
  flex-wrap: wrap;
}

.ai-ide-tree-wrap {
  width: 220px;
  flex-shrink: 0;
  min-height: 200px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
  background: var(--bg-editor);
  overflow-y: auto;
}

.ai-ide-file-tree {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.82rem;
  font-family: Consolas, "Monaco", monospace;
}

.ai-ide-file-item {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-ide-file-item:hover {
  background: var(--bg-linenum);
}

.ai-ide-file-item.is-active {
  background: rgba(25, 118, 210, 0.14);
  font-weight: 600;
}

body.dark .ai-ide-file-item.is-active {
  background: rgba(100, 181, 246, 0.12);
}

.ai-ide-editor-wrap {
  flex: 1;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 360px;
}

.ai-ide-file-path {
  font-family: Consolas, "Monaco", monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 900px) {
  body.ai-ide-page .ai-ide-layout {
    flex-direction: column;
    overflow: visible;
  }

  .ai-ide-sidebar {
    width: 100%;
    max-height: 220px;
  }
}

@media (max-width: 520px) {
  .ai-ide-key-row .ai-ide-input {
    min-width: 100%;
  }

  .ai-ide-split {
    flex-direction: column;
  }

  .ai-ide-tree-wrap {
    width: 100%;
  }
}

/* Responsive: small mobile */
@media (max-width: 400px) {
  .top-bar-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .section-header span {
    width: 100%;
    order: -1;
  }

  .header-buttons {
    width: 100%;
    justify-content: flex-end;
  }
}

/* IDE custom confirm (SQL / Python) */
.ide-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ide-confirm-overlay.show {
  display: flex !important;
}
body.ide-confirm-open {
  overflow: hidden;
}
.ide-confirm-dialog {
  background: #fff;
  border-radius: 18px;
  padding: 28px 26px 22px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.22);
  animation: ideConfirmPop 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}
body.dark .ide-confirm-dialog {
  background: #2d2d2d;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
@keyframes ideConfirmPop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.ide-confirm-icon-wrap {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #e3f2fd 0%, #bbdefb 100%);
}
body.dark .ide-confirm-icon-wrap {
  background: linear-gradient(145deg, #1e3a5f 0%, #1565c0 100%);
}
.ide-confirm-icon-wrap svg {
  width: 28px;
  height: 28px;
  color: #1565c0;
}
body.dark .ide-confirm-icon-wrap svg {
  color: #90caf9;
}
.ide-confirm-dialog.ide-confirm-danger .ide-confirm-icon-wrap {
  background: linear-gradient(145deg, #fff3e0 0%, #ffe0b2 100%);
}
body.dark .ide-confirm-dialog.ide-confirm-danger .ide-confirm-icon-wrap {
  background: linear-gradient(145deg, #5d4037 0%, #e65100 100%);
}
.ide-confirm-dialog.ide-confirm-danger .ide-confirm-icon-wrap svg {
  color: #e65100;
}
body.dark .ide-confirm-dialog.ide-confirm-danger .ide-confirm-icon-wrap svg {
  color: #ffcc80;
}
.ide-confirm-ok.ide-confirm-ok-danger {
  background: #e65100;
  box-shadow: 0 2px 8px rgba(230, 81, 0, 0.35);
}
.ide-confirm-ok.ide-confirm-ok-danger:hover {
  background: #d84315;
}
body.dark .ide-confirm-ok.ide-confirm-ok-danger {
  background: #f4511e;
}
body.dark .ide-confirm-ok.ide-confirm-ok-danger:hover {
  background: #e65100;
}
.ide-confirm-title {
  margin: 0 0 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}
body.dark .ide-confirm-title {
  color: #f3f4f6;
}
.ide-confirm-msg {
  margin: 0 0 22px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #4b5563;
}
body.dark .ide-confirm-msg {
  color: #d1d5db;
}
.ide-confirm-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.ide-confirm-btns button {
  flex: 1;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.ide-confirm-btns button:hover {
  transform: translateY(-1px);
}
.ide-confirm-cancel {
  background: #e5e7eb;
  color: #374151;
}
body.dark .ide-confirm-cancel {
  background: #4b5563;
  color: #f3f4f6;
}
.ide-confirm-cancel:hover {
  background: #d1d5db;
}
body.dark .ide-confirm-cancel:hover {
  background: #6b7280;
}
.ide-confirm-ok {
  background: #1976d2;
  color: #fff;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.35);
}
.ide-confirm-ok:hover {
  background: #1565c0;
}
body.dark .ide-confirm-ok {
  background: #1e88e5;
}
body.dark .ide-confirm-ok:hover {
  background: #1976d2;
}
