/* ==========================================================================
   NODO Vault — styles.css
   Tema dark, paleta Supabase green sobre slate, mobile-first responsive.
   ========================================================================== */

:root {
  /* Paleta DARK (default) */
  --bg-0: #0a0f1a;
  --bg-1: #0f172a;
  --bg-2: #18202f;
  --bg-3: #1e293b;
  --bg-4: #283449;
  --border: #2a3445;
  --border-strong: #3a4658;
  --text: #e6edf3;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --supa: #3ECF8E;
  --supa-dark: #249361;
  --supa-light: #6ee7b7;

  --danger: #ef4444;
  --danger-bg: #2a1414;
  --warning: #f59e0b;
  --info: #38bdf8;

  /* Tipografía */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.6);

  /* Radios */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
}

/* ==========================================================================
   TEMA CLARO (con acentos mint suaves para no ser tan blanco)
   ========================================================================== */
[data-theme="light"] {
  --bg-0: #ecfdf5;            /* fondo de página — mint claro */
  --bg-1: #ffffff;             /* tarjetas, sidebar, topbar */
  --bg-2: #f0fdf4;             /* inputs — leve tinte verde */
  --bg-3: #dcfce7;             /* superficie elevada / props rows hover */
  --bg-4: #bbf7d0;             /* hover fuerte */
  --border: #d1fae5;           /* bordes verdosos suaves */
  --border-strong: #86efac;    /* bordes fuertes (al focus) */
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #6b7280;

  --supa: #3ECF8E;             /* bg de botón primario */
  --supa-dark: #15803d;        /* hover de primario / títulos verdes */
  --supa-light: #15803d;       /* texto de acento (darker para legibilidad) */

  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #b45309;
  --info: #0369a1;

  --shadow-sm: 0 1px 2px rgba(20, 83, 45, 0.05);
  --shadow-md: 0 4px 12px rgba(20, 83, 45, 0.08);
  --shadow-lg: 0 20px 60px rgba(20, 83, 45, 0.12);
}

/* Página: degradado mint sutil + textura verde */
[data-theme="light"] body {
  background:
    radial-gradient(circle at 0% 0%, rgba(62, 207, 142, 0.10), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(62, 207, 142, 0.08), transparent 50%),
    var(--bg-0);
  background-attachment: fixed;
}

/* Auth con más verde de fondo */
[data-theme="light"] .view--auth {
  background:
    radial-gradient(circle at 20% 10%, rgba(62,207,142,0.18), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(62,207,142,0.14), transparent 45%),
    linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

/* Auth card: borde más verde y sombra teñida */
[data-theme="light"] .auth-card {
  border-color: var(--border-strong);
  box-shadow: 0 20px 60px rgba(20, 83, 45, 0.15);
}

/* Topbar con borde verde + ligera sombra */
[data-theme="light"] .topbar {
  background: linear-gradient(180deg, #ffffff 0%, #f7fdfa 100%);
  border-bottom-color: var(--border-strong);
  box-shadow: 0 1px 0 rgba(62, 207, 142, 0.1);
}

/* Sidebar con tinte verde muy suave */
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f7fdfa 100%);
  border-right-color: var(--border-strong);
}
[data-theme="light"] .sidebar__header {
  background: #ecfdf5;
  border-bottom-color: var(--border);
}
[data-theme="light"] .sidebar__title { color: #15803d; }

/* Detail header con borde verde */
[data-theme="light"] .detail__header {
  background: linear-gradient(180deg, #ffffff 0%, #f7fdfa 100%);
  border-bottom-color: var(--border-strong);
}

/* Brand: el "Vault" más oscuro para legibilidad */
[data-theme="light"] .brand__name span { color: #15803d; font-weight: 600; }

/* Tree hover y selected más prominentes */
[data-theme="light"] .tnode__row:hover { background: #ecfdf5; }
[data-theme="light"] .tnode__row--selected {
  background: linear-gradient(90deg, rgba(62,207,142,0.25), rgba(62,207,142,0.10)) !important;
  border-left-color: #15803d;
}
[data-theme="light"] .tnode__row--selected .tnode__label {
  color: #166534;
  font-weight: 600;
}

/* Props row hover con verde */
[data-theme="light"] .props__row:hover { background: #f0fdf4; }
[data-theme="light"] .props { border-color: var(--border-strong); }

/* Section header en light: verde tenue */
[data-theme="light"] .section__header {
  background: #ecfdf5;
  border-color: var(--border);
  color: #166534;
}
[data-theme="light"] .section__header:hover { background: #d1fae5; }

/* Inputs con borde verde y focus mint */
[data-theme="light"] .field input,
[data-theme="light"] .field select,
[data-theme="light"] .field textarea,
[data-theme="light"] .search-input {
  border-color: var(--border-strong);
  background: #ffffff;
}
[data-theme="light"] .field input:focus,
[data-theme="light"] .field select:focus,
[data-theme="light"] .field textarea:focus,
[data-theme="light"] .search-input:focus {
  background: #f0fdf4;
  border-color: var(--supa-dark);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.15);
}

/* Botones ghost en light: borde verde */
[data-theme="light"] .btn--ghost {
  background: #ffffff;
  border-color: var(--border-strong);
}
[data-theme="light"] .btn--ghost:hover {
  background: #ecfdf5;
  border-color: #15803d;
}
[data-theme="light"] .btn--icon {
  background: #ffffff;
  border-color: var(--border-strong);
}
[data-theme="light"] .btn--icon:hover {
  background: #ecfdf5;
  color: #15803d;
}

/* Pills en modo claro */
[data-theme="light"] .pill--production { background: rgba(21, 128, 61, 0.15);  color: #15803d; }
[data-theme="light"] .pill--dev        { background: rgba(3, 105, 161, 0.12);  color: #0369a1; }
[data-theme="light"] .pill--paused     { background: rgba(180, 83, 9, 0.12);   color: #b45309; }
[data-theme="light"] .pill--archived   { background: rgba(100, 116, 139, 0.15); color: #64748b; }

/* Statusbar verde con texto oscuro legible */
[data-theme="light"] .statusbar {
  background: linear-gradient(180deg, #3ECF8E, #15803d);
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.1);
}

/* Modales con borde y sombra verdosa */
[data-theme="light"] .modal__panel {
  border-color: var(--border-strong);
  box-shadow: 0 20px 60px rgba(20, 83, 45, 0.20);
}
[data-theme="light"] .modal__header { background: linear-gradient(180deg, #ffffff 0%, #f7fdfa 100%); }
[data-theme="light"] .modal__footer { background: #f7fdfa; }
[data-theme="light"] .modal__backdrop { background: rgba(20, 83, 45, 0.35); }

/* Cuentas list */
[data-theme="light"] .account-row { background: #ffffff; border-color: var(--border-strong); }
[data-theme="light"] .account-row:hover { background: #f0fdf4; }

/* dlist en account detail */
[data-theme="light"] .dlist { border-color: var(--border-strong); }
[data-theme="light"] .dlist__head { background: #ecfdf5; color: #166534; }
[data-theme="light"] .dlist__row:hover { background: #f0fdf4; }
[data-theme="light"] .dlist__row--selected { background: #dcfce7; }

/* Color de íconos de DB para los proyectos en light (los SVG usan stroke fijo) */
[data-theme="light"] .tnode__icon svg[stroke="#3ECF8E"] { stroke: #15803d; }
[data-theme="light"] .tnode__icon svg[stroke="#94a3b8"] { stroke: #6b7280; }
[data-theme="light"] .tnode__icon svg[stroke="#38bdf8"] { stroke: #0369a1; }
[data-theme="light"] .tnode__icon svg[stroke="#f59e0b"] { stroke: #b45309; }
[data-theme="light"] .tnode__icon svg[stroke="#64748b"] { stroke: #6b7280; }

/* Detail header icon */
[data-theme="light"] .detail__header-icon svg[stroke="#3ECF8E"] { stroke: #15803d; }
[data-theme="light"] .detail__header-icon svg[stroke="#94a3b8"] { stroke: #6b7280; }
[data-theme="light"] .detail__header-icon svg[stroke="#38bdf8"] { stroke: #0369a1; }
[data-theme="light"] .detail__header-icon svg[stroke="#f59e0b"] { stroke: #b45309; }
[data-theme="light"] .detail__header-icon svg[stroke="#64748b"] { stroke: #6b7280; }

/* Chevron color en tree */
[data-theme="light"] .tnode__chevron { color: #15803d; }

/* Scrollbar en light */
[data-theme="light"] *::-webkit-scrollbar-track { background: var(--bg-0); }
[data-theme="light"] *::-webkit-scrollbar-thumb { background: #bbf7d0; border: 2px solid var(--bg-0); }
[data-theme="light"] *::-webkit-scrollbar-thumb:hover { background: #86efac; }


* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* ==========================================================================
   Brand
   ========================================================================== */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.brand__icon { width: 44px; height: 44px; flex-shrink: 0; }
.brand__icon--sm { width: 24px; height: 24px; }
.brand__name {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}
.brand__name span { color: var(--supa); font-weight: 500; }

/* ==========================================================================
   Auth views (setup / unlock)
   ========================================================================== */
.view--auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 10%, rgba(62,207,142,0.08), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(62,207,142,0.05), transparent 40%),
    var(--bg-0);
}
.auth-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-card__hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 24px;
}
.auth-card__hint strong { color: var(--text); }
.auth-card__alt {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }

/* ==========================================================================
   Topbar (main view)
   ========================================================================== */
.view--main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-0);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar__title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.topbar__center { flex: 1; max-width: 480px; }
.topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.search-input {
  width: 100%;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { border-color: var(--supa); background: var(--bg-3); }

/* ==========================================================================
   Filterbar
   ========================================================================== */
.filterbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filterbar__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.filterbar__stats {
  color: var(--text-muted);
  font-size: 12px;
  font-family: var(--font-mono);
}
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip--active {
  background: rgba(62, 207, 142, 0.15);
  border-color: var(--supa);
  color: var(--supa-light);
}

/* ==========================================================================
   Project grid
   ========================================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px;
  flex: 1;
  align-content: start;
}

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.card__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.card__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  word-break: break-word;
}
.card__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0;
  word-break: break-all;
}
.card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ==========================================================================
   Badge (Supabase logo + initial)
   ========================================================================== */
.badge {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.badge--lg { width: 56px; height: 56px; border-radius: var(--r-md); }
.badge__supabase {
  width: 60%;
  height: 60%;
  opacity: 0.95;
}
.badge__initial {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  color: #0a0f1a;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-1);
}
.badge--lg .badge__initial {
  width: 22px;
  height: 22px;
  font-size: 12px;
  bottom: -3px;
  right: -3px;
}

/* ==========================================================================
   Status pill
   ========================================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill--production { background: rgba(62, 207, 142, 0.15); color: var(--supa-light); }
.pill--dev        { background: rgba(56, 189, 248, 0.15); color: var(--info); }
.pill--paused     { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.pill--archived   { background: rgba(100, 116, 139, 0.2);  color: var(--text-dim); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  background: transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--block { width: 100%; }

.btn--primary {
  background: var(--supa);
  color: #0a0f1a;
  font-weight: 600;
}
.btn--primary:hover { background: var(--supa-light); }
.btn--primary:active { background: var(--supa-dark); }

.btn--ghost {
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover { background: var(--bg-3); border-color: var(--border-strong); }

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--text-muted);
}
.btn--icon:hover { background: var(--bg-3); color: var(--text); }

.btn--danger {
  background: var(--danger);
  color: #fff;
}
.btn--danger:hover { background: #dc2626; }
.btn--danger-ghost {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn--danger-ghost:hover { background: rgba(239, 68, 68, 0.2); }

.link {
  background: none;
  border: none;
  color: var(--supa);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: none;
}
.link:hover { text-decoration: underline; }
.link--danger { color: var(--danger); }

/* ==========================================================================
   Inputs & fields
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field--narrow { max-width: 220px; }
.field__label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.field textarea {
  height: auto;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--supa);
  background: var(--bg-3);
}
.field select { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row .field--narrow { max-width: none; }
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.error {
  color: var(--danger);
  font-size: 12px;
  padding: 8px 12px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--r-md);
}

.color-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  height: 36px;
}
.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch--active {
  border-color: var(--text);
  transform: scale(1.15);
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.modal__panel {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal__panel--lg { max-width: 760px; }
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.modal__title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.modal__title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  word-break: break-word;
}
.modal__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 0;
  font-family: var(--font-mono);
}
.modal__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal__body--form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  gap: 8px;
  background: var(--bg-1);
}
.modal__footer-right { display: flex; gap: 8px; }

/* ==========================================================================
   Info blocks (detail view)
   ========================================================================== */
.info-block {
  margin-bottom: 20px;
}
.info-block:last-child { margin-bottom: 0; }
.info-block__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.info-block__title--danger { color: var(--danger); border-bottom-color: rgba(239, 68, 68, 0.3); }
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 640px) { .info-grid { grid-template-columns: 1fr; } }

.info-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.info-item--full { grid-column: 1 / -1; }
.info-item__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 500;
}
.info-item__value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
  min-width: 0;
}
.info-item__value-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.info-item__value-text--block {
  white-space: normal;
}
.info-item__btn {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: none;
  background: var(--bg-3);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.info-item__btn:hover { background: var(--bg-4); color: var(--text); }
.info-item__btn svg { width: 12px; height: 12px; }

.info-notes {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.info-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0 0 12px;
}

/* ==========================================================================
   Accounts list
   ========================================================================== */
.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.account-row__info { flex: 1; min-width: 0; }
.account-row__email {
  font-size: 13px;
  font-weight: 500;
  word-break: break-all;
}
.account-row__meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.account-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.account-form { border-top: 1px solid var(--border); padding-top: 16px; }

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 12px;
}
.empty__title { font-size: 16px; font-weight: 600; margin: 0; }
.empty__hint { color: var(--text-muted); font-size: 13px; margin: 0 0 12px; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 90vw;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast--success { border-color: var(--supa); }
.toast--error { border-color: var(--danger); }

/* ==========================================================================
   Responsive — small screens
   ========================================================================== */
@media (max-width: 640px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }
  .topbar__center {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
  .topbar__right { gap: 6px; }
  .btn { font-size: 12px; padding: 0 10px; height: 32px; }
  .btn--icon { width: 32px; height: 32px; }
  .grid { padding: 12px; gap: 12px; }
  .modal { padding: 8px; }
  .modal__body { padding: 16px; }
  .modal__header, .modal__footer { padding: 12px 16px; }
}

/* ==========================================================================
   OBJECT EXPLORER LAYOUT (master-detail tipo SSMS)
   ========================================================================== */
.layout {
  display: flex;
  flex: 1;
  min-height: 0; /* importante para que flex-children scroll */
  background: var(--bg-0);
}

/* ----- Sidebar (tree) ----- */
.sidebar {
  width: 320px;
  min-width: 240px;
  max-width: 480px;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  resize: horizontal;
  overflow: hidden;
}
.sidebar__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.sidebar__title {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.btn--icon-sm {
  width: 24px; height: 24px; padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn--icon-sm:hover {
  background: var(--bg-3);
  color: var(--text);
}

.tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
  font-size: 13px;
}

/* ----- Tree nodes ----- */
.tnode { display: flex; flex-direction: column; }
.tnode__row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 4px;
  min-height: 26px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-left: 2px solid transparent;
  transition: background 0.1s;
}
.tnode__row:hover { background: var(--bg-2); }
.tnode__row--selected {
  background: rgba(62, 207, 142, 0.12) !important;
  border-left-color: var(--supa);
}
.tnode__row--selected .tnode__label { color: var(--supa-light); font-weight: 500; }

.tnode__chevron {
  width: 14px; height: 14px; flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.tnode__chevron--leaf { visibility: hidden; }
.tnode__chevron--open { transform: rotate(90deg); }

.tnode__icon {
  width: 16px; height: 16px; flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tnode__icon svg { width: 16px; height: 16px; }

.tnode__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text);
}
.tnode__count {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  padding-left: 4px;
}
.tnode__status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tnode__status-dot--production { background: var(--supa); }
.tnode__status-dot--dev        { background: var(--info); }
.tnode__status-dot--paused     { background: var(--warning); }
.tnode__status-dot--archived   { background: var(--text-dim); }

.tnode__children { display: none; }
.tnode--open > .tnode__children { display: block; }

/* Indentación por nivel */
.tnode[data-level="0"] .tnode__row { padding-left: 6px; }
.tnode[data-level="1"] .tnode__row { padding-left: 22px; }
.tnode[data-level="2"] .tnode__row { padding-left: 42px; }
.tnode[data-level="3"] .tnode__row { padding-left: 62px; }

/* ----- Detail pane ----- */
.detail {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-0);
  padding: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.detail__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 5;
}
.detail__header-icon {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.detail__header-info { flex: 1; min-width: 0; }
.detail__breadcrumb {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 2px;
}
.detail__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
  word-break: break-word;
}
.detail__header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.detail__body {
  flex: 1;
  padding: 20px 24px;
  overflow-x: hidden;
}

/* Tabla de propiedades estilo SSMS */
.props {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-1);
  margin-bottom: 20px;
}
.props__row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 13px;
}
.props__row:last-child { border-bottom: none; }
.props__row:hover { background: var(--bg-2); }
.props__label {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.props__value {
  font-family: var(--font-mono);
  font-size: 12px;
  word-break: break-all;
  min-width: 0;
}
.props__value--text {
  font-family: var(--font-sans);
  font-size: 13px;
  word-break: normal;
}
.props__value--secret {
  color: var(--text-dim);
  letter-spacing: 2px;
}
.props__actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .props__row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .props__actions { justify-content: flex-start; }
}

/* Sección colapsable estilo "+/-" */
.section {
  margin-bottom: 20px;
}
.section__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  user-select: none;
}
.section__header svg { width: 14px; height: 14px; }
.section__header:hover { background: var(--bg-3); }
.section__body {
  padding-top: 8px;
  display: block;
}
.section--collapsed .section__body { display: none; }
.section--collapsed .section__chevron { transform: rotate(-90deg); }
.section__chevron { transition: transform 0.15s; }

.section__count {
  margin-left: auto;
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 11px;
}

/* Statusbar */
.statusbar {
  height: 24px;
  background: var(--supa-dark);
  color: #0a0f1a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Estado vacío en sidebar / detail */
.detail__empty,
.tree__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  gap: 8px;
}
.detail__empty svg, .tree__empty svg { opacity: 0.4; }

/* Tabla compacta de proyectos (cuando seleccionás una cuenta) */
.dlist {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-1);
}
.dlist__head, .dlist__row {
  display: grid;
  grid-template-columns: 28px 1fr 110px 110px 100px 60px;
  gap: 12px;
  padding: 8px 14px;
  align-items: center;
  font-size: 12px;
}
.dlist__head {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.dlist__row { border-bottom: 1px solid var(--border); cursor: pointer; }
.dlist__row:last-child { border-bottom: none; }
.dlist__row:hover { background: var(--bg-2); }
.dlist__row--selected { background: rgba(62, 207, 142, 0.1); }

/* Mobile: tree colapsable */
@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; max-width: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
    resize: vertical;
  }
}

/* Scrollbar (webkit) */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg-0); }
*::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 2px solid var(--bg-0); }
*::-webkit-scrollbar-thumb:hover { background: var(--bg-4); }
