@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg:            #ffffff;
  --bg-rgb:        255,255,255;
  --surface:       #f8f9fc;
  --surface-alt:   #f1f3f9;
  --surface-hover: #eef0f8;

  --border:        #e4e6ef;
  --border-hover:  #c7cbe0;

  --text:          #1a1d2e;
  --text-secondary:#4b5068;
  --text-tertiary: #9398b0;

  --violet:        #7c3aed;
  --violet-rgb:    124,58,237;
  --violet-light:  #ede9fe;
  --violet-border: rgba(124,58,237,0.25);

  --pink:          #ec4899;
  --pink-rgb:      236,72,153;
  --pink-light:    #fce7f3;

  --cyan:          #06b6d4;
  --cyan-rgb:      6,182,212;
  --cyan-light:    #cffafe;

  --amber:         #f59e0b;
  --amber-rgb:     245,158,11;
  --amber-light:   #fef3c7;

  --emerald:       #10b981;
  --emerald-rgb:   16,185,129;
  --emerald-light: #d1fae5;

  --accent:        #7c3aed;
  --accent-rgb:    124,58,237;
  --accent-hover:  #6d28d9;

  --success:       #10b981;
  --success-rgb:   16,185,129;
  --success-light: #d1fae5;
  --danger:        #ef4444;
  --danger-rgb:    239,68,68;
  --danger-light:  #fee2e2;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm:    0 1px 3px rgba(26,29,46,.06), 0 1px 2px rgba(26,29,46,.04);
  --shadow-md:    0 4px 12px rgba(26,29,46,.08), 0 2px 4px rgba(26,29,46,.04);
  --shadow-color: 0 4px 16px rgba(124,58,237,.22);

  --font-sans: 'Plus Jakarta Sans',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --font-mono: 'JetBrains Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  display: flex;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1.5px solid var(--border);
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--violet) 0%, var(--pink) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(124,58,237,0.35);
}

.sidebar-logo-icon svg { color: #fff; }

.sidebar-logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  cursor: pointer;
  border-radius: var(--radius-md);
  border-left: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.nav-item-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-alt);
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item:hover .nav-item-icon { background: var(--surface-hover); }

.nav-item.active {
  background: var(--violet-light);
  color: var(--violet);
  font-weight: 600;
}
.nav-item.active .nav-item-icon {
  background: rgba(124,58,237,0.15);
}
.nav-item.active .nav-item-icon svg { color: var(--violet); }

/* ─── Main ───────────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: 54px;
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
}

.topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}

.topbar-divider {
  width: 1px;
  height: 14px;
  background: var(--border);
}

.topbar-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Panel ──────────────────────────────────────────────────── */
.panel { display: none; }
.panel.active { display: flex; flex-direction: column; gap: 16px; }

/* ─── Grid ───────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 7px;
}

.card-icon {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* per-feature accent colors */
.card-icon-violet { background: var(--violet-light); color: var(--violet); }
.card-icon-pink   { background: var(--pink-light);   color: var(--pink);   }
.card-icon-cyan   { background: var(--cyan-light);   color: var(--cyan);   }
.card-icon-amber  { background: var(--amber-light);  color: var(--amber);  }
.card-icon-emerald{ background: var(--emerald-light);color: var(--emerald);}

.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Form Elements ──────────────────────────────────────────── */
textarea {
  flex: 1;
  resize: none;
  background: var(--surface-alt);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  min-height: 100px;
}

textarea:focus {
  background: var(--bg);
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

textarea::placeholder { color: var(--text-tertiary); }

input, select {
  background: var(--surface-alt);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  height: 34px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus, select:focus {
  background: var(--bg);
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

input::placeholder { color: var(--text-tertiary); }

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239398b0' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  height: 34px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.12s ease,
              box-shadow 0.15s ease, border-color 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(124,58,237,0.4);
}
.btn-primary:active { transform: translateY(0) scale(0.97); box-shadow: none; }
.btn-primary:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-secondary {
  background: var(--bg);
  color: var(--text-secondary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-secondary:active { transform: scale(0.97); box-shadow: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-tertiary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-alt); color: var(--text-secondary); }
.btn-full { width: 100%; justify-content: center; }

/* 已连接状态：绿色按钮 */
.btn-connected {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(16,185,129,0.30) !important;
  border-color: transparent !important;
}
.btn-connected:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16,185,129,0.40) !important;
}

/* ─── Toolbar ────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spacer { flex: 1; }

/* ─── Result Area ────────────────────────────────────────────── */
.result-area {
  flex: 1;
  overflow: auto;
  min-height: 60px;
}
.result-area::-webkit-scrollbar { width: 4px; height: 4px; }
.result-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Table ──────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 12px; }

thead th {
  background: var(--surface);
  color: var(--text-tertiary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 11px;
  padding: 7px 10px;
  border-bottom: 1.5px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--surface-alt);
  color: var(--text);
  word-break: break-all;
  font-family: var(--font-mono);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface); }

/* ─── Pre / Code ─────────────────────────────────────────────── */
pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}

/* ─── Badge ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 600;
  background: var(--violet-light);
  color: var(--violet);
  border: 1px solid var(--violet-border);
}
.badge-success { background: var(--emerald-light); color: var(--emerald); border-color: rgba(16,185,129,.25); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  border-color: rgba(239,68,68,.25); }
.badge-pink    { background: var(--pink-light);    color: var(--pink);    border-color: rgba(236,72,153,.25); }
.badge-cyan    { background: var(--cyan-light);    color: var(--cyan);    border-color: rgba(6,182,212,.25); }
.badge-amber   { background: var(--amber-light);   color: var(--amber);   border-color: rgba(245,158,11,.25); }
.badge-neutral { background: var(--surface-alt);   color: var(--text-secondary); border-color: var(--border); }

/* ─── Hint ───────────────────────────────────────────────────── */
.hint {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  color: var(--text-tertiary);
  text-align: center;
  gap: 8px;
}
.empty-state svg { opacity: 0.4; }
.empty-state p { margin: 0; font-size: 12px; }

/* ─── Mono ───────────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }

/* ─── Code chip ──────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  color: var(--violet);
}

/* ─── Spinner ────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.result-appear { animation: fadeInUp 0.22s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes flashSuccess {
  0%,100% { border-color: var(--border); box-shadow: none; }
  40%     { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-light); }
}
.flash-success { animation: flashSuccess 0.7s ease; }

/* ─── Tooltip ────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after { opacity: 1; }

/* ─── DB ─────────────────────────────────────────────────────── */
.db-connection-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-connection-row select { width: 120px; flex-shrink: 0; }
.db-connection-row input  { flex: 1; min-width: 200px; }

/* 历史连接行的删除按钮 */
.btn-ghost.btn-danger { color: var(--danger); }
.btn-ghost.btn-danger:hover { background: var(--danger-light); color: var(--danger); }

/* DB workspace: 三栏 全部表 | 历史表 | 详情 */
.db-workspace {
  display: grid;
  grid-template-columns: 200px 180px 1fr;
  gap: 16px;
  min-height: 0;
}

/* 左侧表列表 */
.db-table-list-card {
  min-height: 0;
  overflow: hidden;
}

.db-table-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
.db-table-list::-webkit-scrollbar { width: 4px; }
.db-table-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.db-table-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-mono);
  transition: background 0.12s ease, color 0.12s ease;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db-table-item svg { flex-shrink: 0; color: var(--text-tertiary); }
.db-table-item:hover { background: var(--surface-alt); color: var(--text); }
.db-table-item.active {
  background: var(--violet-light);
  color: var(--violet);
  border-color: var(--violet-border);
  font-weight: 500;
}
.db-table-item.active svg { color: var(--violet); }
.db-table-item.hidden { display: none; }

/* 右侧详情区 */
.db-detail-area {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

/* Tab 切换栏 */
.db-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 2px 10px;
}

.db-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.db-tab:hover { background: var(--surface-hover); color: var(--text); }
.db-tab.active {
  background: var(--violet-light);
  color: var(--violet);
  border-color: var(--violet-border);
  font-weight: 600;
}

.db-active-table-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  padding: 3px 8px;
  background: var(--surface-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: none;
}
.db-active-table-badge.visible { display: inline-block; }

/* Tab panels */
.db-tab-panel { display: none; flex: 1; }
.db-tab-panel.active { display: flex; }

/* 列类型高亮 */
.col-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--cyan-light);
  color: var(--cyan);
  border: 1px solid rgba(6,182,212,.2);
}
.col-key-pri {
  display: inline-block;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  background: var(--amber-light);
  color: var(--amber);
  border: 1px solid rgba(245,158,11,.25);
}
.col-nullable-no {
  color: var(--danger);
  font-size: 11px;
  font-weight: 600;
}
.col-nullable-yes {
  color: var(--text-tertiary);
  font-size: 11px;
}

/* SQL 历史命令下拉 */
.sql-history-wrap {
  position: relative;
}

.db-sql-history-btn {
  height: 30px;
  font-size: 12px;
  gap: 4px;
  padding: 0 8px;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}
.db-sql-history-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.sql-history-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 480px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(26,29,46,.12);
  z-index: 200;
  padding: 6px;
}
.sql-history-dropdown.open { display: block; }
.sql-history-dropdown::-webkit-scrollbar { width: 4px; }
.sql-history-dropdown::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.sql-history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s ease;
  border: 1px solid transparent;
}
.sql-history-item:hover {
  background: var(--surface-alt);
  border-color: var(--border);
}
.sql-history-item-sql {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.sql-history-item-del {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sql-history-item-del:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* 存为模板按钮（历史条目内） */
.sql-history-item-save {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.sql-history-item-save:hover {
  background: var(--violet-light);
  color: var(--violet);
}

/* ─── 命令模板面板 ────────────────────────────────────────────── */
.template-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}
.template-list::-webkit-scrollbar { width: 4px; }
.template-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.template-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.template-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.template-item-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.template-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.template-item-cmd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.template-item-kind {
  flex-shrink: 0;
  align-self: center;
}
.template-item-del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  align-self: center;
}
.template-item-del:hover { background: var(--danger-light); color: var(--danger); }

.sql-history-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
}

.sql-history-footer {
  display: flex;
  justify-content: flex-end;
  padding: 6px 4px 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

@media (max-width: 900px) {
  .db-workspace { grid-template-columns: 1fr; }
  .sql-history-dropdown { width: 90vw; right: auto; left: 0; }
}

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,29,46,.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .15s ease;
}
.modal-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(26,29,46,.18);
  padding: 20px 24px;
  min-width: 320px;
  max-width: 440px;
  width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── Reduced Motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

@media (max-width: 700px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; height: auto;
    border-right: none; border-bottom: 1.5px solid var(--border);
    overflow-x: auto; overflow-y: hidden;
  }
  .sidebar-logo { display: none; }
  .nav { flex-direction: row; padding: 6px 8px; overflow-x: auto; overflow-y: hidden; gap: 4px; }
  .nav-item { padding: 8px 12px; border-radius: var(--radius-lg); white-space: nowrap; font-size: 12px; }
  .nav-item-icon { width: 22px; height: 22px; }
  .main { overflow: auto; }
  .content { overflow: visible; }
}
