/* AqlaanDB – Neon-inspired dark design system */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0a0a0a; --surface: #111111; --surface-2: #1a1a1a; --surface-3: #222222;
  --border: #2a2a2a; --border-light: #333333;
  --primary: #00e599; --primary-dim: rgba(0,229,153,.12); --primary-dark: #00b377;
  --text: #ededed; --text-muted: #888888; --text-subtle: #555555;
  --danger: #f94449; --danger-dim: rgba(249,68,73,.12);
  --warning: #f0c040; --info: #38bdf8;
  --radius: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 4px 16px rgba(0,0,0,.3);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  --transition: 150ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: .8; }

h1,h2,h3,h4,h5 { font-weight: 600; line-height: 1.3; letter-spacing: -.02em; color: var(--text); }
h1 { font-size: 2.4rem; } h2 { font-size: 1.8rem; } h3 { font-size: 1.3rem; } h4 { font-size: 1.1rem; }
p { color: var(--text-muted); line-height: 1.7; }
small { font-size: .8rem; color: var(--text-muted); }

code, pre, .mono { font-family: var(--mono); font-size: .85em; }
code { background: var(--surface-3); color: var(--primary); padding: .1em .4em; border-radius: 4px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border-radius: var(--radius); border: 1px solid transparent; font-family: var(--font); font-size: .875rem; font-weight: 500; cursor: pointer; transition: all var(--transition); white-space: nowrap; text-decoration: none; line-height: 1.4; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #000; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: #00f5a5; color: #000; opacity: 1; transform: translateY(-1px); box-shadow: 0 0 20px rgba(0,229,153,.3); }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border-light); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); color: var(--text); opacity: 1; border-color: #444; }
.btn-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(249,68,73,.3); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; opacity: 1; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); opacity: 1; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-lg { padding: .75rem 1.5rem; font-size: 1rem; }

/* FORMS */
.form-label { display: block; font-size: .8rem; font-weight: 500; color: var(--text-muted); margin-bottom: .4rem; text-transform: uppercase; letter-spacing: .05em; }
.form-control { width: 100%; background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius); color: var(--text); font-family: var(--font); font-size: .875rem; padding: .6rem .85rem; transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-control::placeholder { color: var(--text-subtle); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,229,153,.12); }
.form-control.is-invalid { border-color: var(--danger); }
.form-select { width: 100%; background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius); color: var(--text); font-family: var(--font); font-size: .875rem; padding: .6rem .85rem; cursor: pointer; outline: none; appearance: none; transition: border-color var(--transition); }
.form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,229,153,.12); }
.form-group { margin-bottom: 1.25rem; }
.form-text { font-size: .75rem; color: var(--text-muted); margin-top: .3rem; }
.field-validation-error { font-size: .75rem; color: var(--danger); margin-top: .3rem; display: block; }
.validation-summary-errors { color: var(--danger); font-size: .85rem; margin-bottom: 1rem; }
.validation-summary-errors ul { list-style: none; padding: 0; }

/* CARDS */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-body { padding: 1.25rem; }
.card-footer { padding: .875rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); }

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 99px; font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.badge-green { background: rgba(0,229,153,.15); color: var(--primary); }
.badge-red   { background: rgba(249,68,73,.15);  color: var(--danger); }
.badge-blue  { background: rgba(56,189,248,.15); color: var(--info); }
.badge-gray  { background: var(--surface-3); color: var(--text-muted); }
.badge-dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: inline-block; }

/* TABLE */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th { text-align: left; padding: .75rem 1rem; color: var(--text-muted); font-size: .75rem; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-2); }

/* ALERTS */
.alert { padding: .875rem 1rem; border-radius: var(--radius); font-size: .875rem; border: 1px solid; margin-bottom: 1rem; }
.alert-danger  { background: var(--danger-dim); border-color: rgba(249,68,73,.3); color: #ff7a7d; }
.alert-success { background: var(--primary-dim); border-color: rgba(0,229,153,.3); color: var(--primary); }
.alert-info    { background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.3); color: var(--info); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* CONNECTION STRING */
.conn-box { display: flex; align-items: center; gap: .5rem; background: var(--surface-3); border: 1px solid var(--border-light); border-radius: var(--radius); padding: .75rem 1rem; }
.conn-box code { flex: 1; word-break: break-all; background: none; padding: 0; color: var(--text); font-size: .8rem; }
.copy-btn { flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border-light); color: var(--text-muted); border-radius: 6px; padding: .3rem .6rem; font-size: .75rem; cursor: pointer; font-family: var(--font); transition: all var(--transition); }
.copy-btn:hover, .copy-btn.copied { background: var(--primary); color: #000; border-color: var(--primary); }

/* EMPTY STATE */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4rem 2rem; gap: 1rem; }
.empty-state .empty-icon { width: 56px; height: 56px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: .5rem; }
.empty-state h3 { font-size: 1rem; color: var(--text); }
.empty-state p  { font-size: .875rem; max-width: 28rem; }

/* LANDING NAV */
.land-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; align-items: center; padding: 0 2rem; height: 60px; background: rgba(10,10,10,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.land-nav .brand { font-size: 1.1rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.land-nav .brand span { color: var(--primary); }
.land-nav-links { margin-left: auto; display: flex; align-items: center; gap: 1rem; }

/* HERO */
.hero { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6rem 1.5rem 4rem; position: relative; }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0,229,153,.18) 0%, transparent 70%); pointer-events: none; }
.hero-badge { display: inline-flex; align-items: center; gap: .5rem; background: var(--primary-dim); border: 1px solid rgba(0,229,153,.25); color: var(--primary); border-radius: 99px; padding: .3rem .9rem; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 2rem; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.1; margin-bottom: 1.5rem; }
.hero h1 .accent { color: var(--primary); }
.hero p { font-size: 1.1rem; max-width: 42rem; margin-bottom: 2.5rem; color: var(--text-muted); }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* FEATURES */
.features { padding: 6rem 1.5rem; max-width: 1100px; margin: 0 auto; text-align: center; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; margin-top: 3rem; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.75rem; transition: border-color var(--transition), transform var(--transition); text-align: left; }
.feature-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.feature-icon { width: 44px; height: 44px; background: var(--primary-dim); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 1.25rem; }
.feature-card h3 { font-size: 1rem; margin-bottom: .5rem; }
.feature-card p  { font-size: .875rem; }

/* SERVERS SECTION */
.servers-section { padding: 2rem 1.5rem 6rem; max-width: 1100px; margin: 0 auto; }
.servers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 2rem; }
.server-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; display: flex; align-items: center; gap: 1rem; }
.server-dot { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; box-shadow: 0 0 8px var(--primary); flex-shrink: 0; }

/* AUTH */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--bg); position: relative; }
.auth-page::before { content: ''; position: fixed; inset: 0; background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(0,229,153,.1) 0%, transparent 70%); pointer-events: none; }
.auth-card { width: 100%; max-width: 400px; position: relative; z-index: 1; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .logo-mark { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -.04em; }
.auth-logo .logo-mark span { color: var(--primary); }
.auth-logo p { font-size: .85rem; margin-top: .25rem; }
.auth-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 2rem; }
.auth-box h2 { font-size: 1.3rem; margin-bottom: .4rem; }
.auth-box .sub { font-size: .875rem; margin-bottom: 1.75rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: .85rem; color: var(--text-muted); }

/* DASHBOARD SHELL */
.app-shell { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: 60px 1fr; min-height: 100vh; }
.top-bar { grid-column: 1 / -1; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem; position: sticky; top: 0; z-index: 50; }
.top-bar .brand { font-size: 1.1rem; font-weight: 700; color: var(--text); letter-spacing: -.03em; width: 200px; }
.top-bar .brand span { color: var(--primary); }
.top-bar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.user-avatar { width: 32px; height: 32px; background: var(--primary-dim); border: 1px solid rgba(0,229,153,.3); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; color: var(--primary); }

/* SIDEBAR */
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1.25rem .75rem; overflow-y: auto; }
.sidebar-section { margin-bottom: 1.75rem; }
.sidebar-label { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-subtle); padding: 0 .6rem; margin-bottom: .5rem; display: block; }
.sidebar-link { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: var(--radius); color: var(--text-muted); font-size: .875rem; transition: all var(--transition); text-decoration: none; }
.sidebar-link:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.sidebar-link.active { background: var(--primary-dim); color: var(--primary); }
.sidebar-link .icon { width: 18px; text-align: center; flex-shrink: 0; }

/* MAIN */
.main-content { padding: 2rem; overflow-y: auto; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.5rem; }
.page-header p  { font-size: .875rem; margin-top: .25rem; }

/* BREADCRUMB */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-muted); margin-bottom: .75rem; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); opacity: 1; }
.breadcrumb .sep { color: var(--text-subtle); }
.breadcrumb .current { color: var(--text); }

/* PROJECT CARDS */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; text-decoration: none; display: flex; flex-direction: column; gap: .75rem; transition: all var(--transition); }
.project-card:hover { border-color: var(--primary); opacity: 1; transform: translateY(-2px); box-shadow: 0 8px 30px rgba(0,229,153,.08); }
.project-card-header { display: flex; align-items: center; gap: .75rem; }
.project-icon { width: 38px; height: 38px; background: var(--primary-dim); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.project-card h3 { font-size: .95rem; margin: 0; }
.project-card .meta { display: flex; align-items: center; gap: .75rem; }
.project-card .meta span { font-size: .75rem; color: var(--text-muted); }
.new-project-card { border: 1px dashed var(--border-light); background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 148px; gap: .5rem; cursor: pointer; text-decoration: none; }
.new-project-card:hover { border-color: var(--primary); background: var(--primary-dim); opacity: 1; }
.new-project-card .plus { font-size: 1.5rem; color: var(--text-subtle); }
.new-project-card:hover .plus { color: var(--primary); }
.new-project-card span { font-size: .875rem; color: var(--text-muted); }

/* STATS */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.stat-card .label { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

/* TABS */
.tabs { display: flex; border-bottom: 1px solid var(--border); gap: .25rem; margin-bottom: 1.5rem; overflow-x: auto; }
.tab-link { padding: .6rem 1rem; font-size: .875rem; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all var(--transition); white-space: nowrap; text-decoration: none; }
.tab-link:hover { color: var(--text); opacity: 1; }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

/* DANGER ZONE */
.danger-zone { border: 1px solid rgba(249,68,73,.25); border-radius: var(--radius-lg); padding: 1.5rem; margin-top: 2rem; }
.danger-zone h4 { color: var(--danger); margin-bottom: .5rem; }
.danger-zone p  { font-size: .875rem; margin-bottom: 1rem; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none; align-items: center; justify-content: center; z-index: 200; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius-xl); padding: 2rem; max-width: 440px; width: 100%; box-shadow: var(--shadow); }
.modal-box h3 { margin-bottom: .5rem; }
.modal-box p  { font-size: .875rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; }

/* UTILITIES */
.text-green { color: var(--primary); } .text-red { color: var(--danger); }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.w-full { width: 100%; }

@media (max-width: 768px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { padding: 1rem; }
  .hero h1 { font-size: 2.2rem; }
}

/* ══════════════════════════════════════════════════════════════
   DATABASE MANAGEMENT – SHARED HEADER & TABS
   ══════════════════════════════════════════════════════════════ */
.db-page-header {
  margin-bottom: .75rem;
}
.db-page-header h1 { font-size: 1.4rem; }
.db-page-header p  { font-size: .8rem; margin-top: .2rem; }

.db-tabs-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: .25rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
}
.db-tabs-bar .tab-link {
  padding: .55rem 1rem;
  font-size: .875rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.db-tabs-bar .tab-link:hover { color: var(--text); opacity: 1; }
.db-tabs-bar .tab-link.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ══════════════════════════════════════════════════════════════
   TABLE BROWSER
   ══════════════════════════════════════════════════════════════ */
.db-browser {
  display: flex;
  gap: 1rem;
  height: calc(100vh - 238px);
  min-height: 400px;
  overflow: hidden;
}

/* Left panel – table list */
.table-list-panel {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.table-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tl-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-subtle);
  font-size: .8rem;
  line-height: 1.6;
}
.schema-group-label {
  padding: .5rem 1rem .2rem;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.table-list-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem 1rem;
  color: var(--text-muted);
  font-size: .85rem;
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.table-list-item:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.table-list-item.active {
  background: var(--primary-dim);
  color: var(--primary);
  border-left-color: var(--primary);
  opacity: 1;
}
.tli-icon { font-size: .8rem; flex-shrink: 0; }
.tli-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tli-count {
  font-size: .7rem;
  color: var(--text-subtle);
  font-family: var(--mono);
  flex-shrink: 0;
}
.table-list-item.active .tli-count { color: var(--primary); opacity: .7; }

/* Right panel – data area */
.table-data-panel {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Toolbar */
.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-shrink: 0;
  background: var(--surface-2);
}
.grid-title-area {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: .875rem;
  min-width: 0;
}
.grid-schema-name { color: var(--text-muted); font-family: var(--mono); font-size: .8rem; }
.grid-dot { color: var(--text-subtle); margin: 0 1px; }
.grid-table-name { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: .85rem; }
.grid-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }

/* Data grid */
.data-grid-wrap {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.mgmt-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  font-family: var(--mono);
}
.mgmt-grid thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
}
.mgmt-grid th {
  text-align: left;
  padding: .55rem .75rem;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-family: var(--font);
}
.mgmt-grid th.action-col { width: 56px; padding: .55rem .5rem; }
.mgmt-grid td {
  padding: .45rem .75rem;
  border-bottom: 1px solid rgba(42,42,42,.6);
  color: var(--text);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mgmt-grid td.action-col { padding: .3rem .5rem; white-space: nowrap; }
.mgmt-grid td.null-cell { color: var(--text-subtle); font-style: italic; }
.mgmt-grid tbody tr:hover { background: var(--surface-2); }
.mgmt-grid tbody tr:hover td { border-bottom-color: var(--border); }
.mgmt-grid tbody tr:last-child td { border-bottom: none; }

.col-type-tag {
  display: inline-block;
  margin-left: .3rem;
  font-size: .65rem;
  color: var(--text-subtle);
  font-weight: 400;
  font-family: var(--mono);
  text-transform: none;
  letter-spacing: 0;
}
.pk-icon { margin-right: .2rem; font-size: .75rem; }

/* Row action buttons */
.row-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-subtle);
  border-radius: 5px;
  padding: .2rem .4rem;
  font-size: .75rem;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1;
}
.row-btn:hover { background: var(--surface-3); border-color: var(--border-light); }
.edit-row-btn:hover { color: var(--info); border-color: rgba(56,189,248,.3); background: rgba(56,189,248,.08); }
.del-row-btn:hover  { color: var(--danger); border-color: rgba(249,68,73,.3); background: var(--danger-dim); }

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .6rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.page-info-text { font-size: .8rem; color: var(--text-muted); }

/* Modal wide variant */
.modal-wide { max-width: 560px; padding: 0; overflow: hidden; }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-fields {
  padding: 1.25rem 1.5rem;
  max-height: 420px;
  overflow-y: auto;
}
.modal-wide .modal-actions {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.pk-badge {
  display: inline-flex;
  align-items: center;
  padding: .05rem .35rem;
  background: rgba(0,229,153,.12);
  color: var(--primary);
  border-radius: 4px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  margin-right: .25rem;
  text-transform: uppercase;
}
.col-type-label { color: var(--text-subtle); font-weight: 400; margin-left: .35rem; font-size: .78rem; }
.nullable-label { color: var(--text-subtle); font-weight: 400; margin-left: .2rem; font-size: .75rem; }

/* ══════════════════════════════════════════════════════════════
   TABLE MANAGEMENT – CREATE TABLE MODAL STYLES
   ══════════════════════════════════════════════════════════════ */

/* "+ " button in the table list header */
.tl-create-btn {
  background: var(--primary-dim);
  border: 1px solid rgba(0,229,153,.25);
  color: var(--primary);
  border-radius: 5px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition);
  flex-shrink: 0;
}
.tl-create-btn:hover {
  background: var(--primary);
  color: #000;
}

/* Column row inside Create Table modal */
.ct-col-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto auto;
  gap: .4rem;
  align-items: center;
  margin-bottom: .5rem;
}
.ct-col-row .form-control,
.ct-col-row .form-select {
  font-size: .8rem;
  padding: .45rem .65rem;
}
.ct-col-check {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.ct-col-check input[type=checkbox] {
  accent-color: var(--primary);
  width: 13px;
  height: 13px;
  cursor: pointer;
}
.ct-col-remove {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-subtle);
  border-radius: 5px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.ct-col-remove:hover {
  background: var(--danger-dim);
  border-color: rgba(249,68,73,.3);
  color: var(--danger);
}

/* ══════════════════════════════════════════════════════════════
   CONTEXTUAL PROJECT SIDEBAR (_DbLayout)
   ══════════════════════════════════════════════════════════════ */

/* The sidebar already has the base .sidebar styles; these extend it */
.proj-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow-y: auto;
}

/* "← All Projects" back link */
.proj-back-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem .85rem;
  font-size: .78rem;
  color: var(--text-subtle);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color var(--transition);
  flex-shrink: 0;
  letter-spacing: .02em;
}
.proj-back-link:hover { color: var(--text); opacity: 1; }
.proj-back-arrow { font-size: .85rem; }

/* Section container */
.proj-sidebar-block {
  padding: .85rem 0 .5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.proj-sidebar-block:last-child { border-bottom: none; }

/* Project name row */
.proj-name-row {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .4rem .85rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius);
  margin: 0 .4rem .25rem;
  transition: all var(--transition);
}
.proj-name-row:hover { background: var(--surface-2); opacity: 1; color: var(--text); }
.proj-name-row.active { background: var(--primary-dim); color: var(--primary); }
.proj-icon { font-size: .9rem; flex-shrink: 0; }
.proj-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Database entries */
.proj-db-row {
  position: relative;
  padding-left: 1.5rem !important;
  font-size: .83rem;
}
.proj-db-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex-shrink: 0;
  transition: background var(--transition);
}
.proj-db-dot-active { background: var(--primary); box-shadow: 0 0 6px rgba(0,229,153,.5); }
.proj-db-row-active {
  background: var(--primary-dim) !important;
  color: var(--primary) !important;
  border-left: 2px solid var(--primary);
  margin-left: 0 !important;
  padding-left: calc(1.5rem - 2px) !important;
}
.proj-db-row-active:hover { opacity: 1 !important; }
.proj-db-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* New database link */
.proj-new-db {
  font-size: .78rem;
  color: var(--text-subtle) !important;
  padding-left: 1.5rem !important;
  margin-top: .1rem;
}
.proj-new-db:hover { color: var(--primary) !important; opacity: 1; }
.proj-new-db-plus {
  color: var(--primary);
  font-weight: 700;
  font-size: .9rem;
  line-height: 1;
}

/* Current database nav section */
.proj-db-nav-block {
  background: rgba(0,229,153,.03);
}
.proj-db-nav-label {
  display: block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  opacity: .7;
  margin-bottom: .35rem;
}

/* ══════════════════════════════════════════════════════════════
   SQL EDITOR
   ══════════════════════════════════════════════════════════════ */
.sql-editor-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 238px);
  min-height: 400px;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

/* Editor pane */
.sql-editor-pane {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  border-bottom: 2px solid var(--border);
  min-height: 120px;
  resize: vertical;
  overflow: auto;
}
.sql-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .55rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 1rem;
}
.sql-db-badge {
  display: inline-flex;
  align-items: center;
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid rgba(0,229,153,.2);
  border-radius: 5px;
  padding: .15rem .55rem;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--mono);
}
.kbd-hint {
  font-size: .75rem;
  color: var(--text-subtle);
}
kbd {
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .7rem;
  font-family: var(--mono);
  color: var(--text-muted);
}
.sql-editor-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.6;
}
.sql-line-numbers {
  flex-shrink: 0;
  width: 42px;
  padding: .75rem 0;
  text-align: right;
  padding-right: .75rem;
  color: var(--text-subtle);
  font-size: .78rem;
  line-height: 1.6;
  user-select: none;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
  white-space: pre;
}
.sql-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--primary);
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.6;
  padding: .75rem 1rem;
  resize: none;
  caret-color: var(--primary);
}
.sql-textarea::placeholder { color: var(--text-subtle); }

/* Results pane */
.sql-results-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 80px;
}
.sql-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 1rem;
}
.results-info { font-size: .8rem; color: var(--text-muted); }
.results-time {
  font-size: .75rem;
  color: var(--primary);
  font-family: var(--mono);
  background: var(--primary-dim);
  border: 1px solid rgba(0,229,153,.2);
  border-radius: 5px;
  padding: .1rem .45rem;
}
.sql-results-body {
  flex: 1;
  overflow: auto;
}
.sql-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 120px;
  text-align: center;
  gap: .5rem;
  color: var(--text-muted);
  padding: 2rem;
}
.sql-placeholder.sql-ok { color: var(--primary); }
.sql-placeholder-icon { font-size: 2rem; line-height: 1; }
.sql-placeholder p { font-size: .875rem; color: var(--text-muted); }
.sql-placeholder.sql-ok p { color: var(--primary); font-weight: 600; }
.sql-error-box {
  margin: 1rem;
  padding: .875rem 1rem;
  background: var(--danger-dim);
  border: 1px solid rgba(249,68,73,.3);
  border-radius: var(--radius);
  color: #ff7a7d;
  font-size: .85rem;
  font-family: var(--mono);
  line-height: 1.6;
}
.sql-err-detail {
  font-size: .8rem;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* ══════════════════════════════════════════════════════════════
   SQL HISTORY DROPDOWN
   ══════════════════════════════════════════════════════════════ */
.hist-wrap {
  position: relative;
}
.history-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
  z-index: 200;
  flex-direction: column;
  max-height: 360px;
  overflow: hidden;
}
.history-dropdown.open { display: flex; }
.history-dropdown-header {
  padding: .55rem 1rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-2);
}
.history-list {
  overflow-y: auto;
  flex: 1;
}
.history-item {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .55rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--surface-2); }
.history-preview {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-ts {
  font-size: .68rem;
  color: var(--text-subtle);
}
.history-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-subtle);
  font-size: .8rem;
}
.hist-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-dim);
  color: var(--primary);
  border-radius: 99px;
  font-size: .65rem;
  font-weight: 700;
  padding: .05rem .35rem;
  margin-left: .25rem;
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════════
   DDL DISPLAY (pre block in DDL modal)
   ══════════════════════════════════════════════════════════════ */
.ddl-display {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.75;
  color: var(--primary);
  white-space: pre;
  overflow-x: auto;
  max-height: 380px;
  overflow-y: auto;
  margin: 0;
}
