/* Help Desk La Guaca — Estilos completos */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --guaca: #1F478D;
  --guaca-dark: #153260;
  --guaca-darker: #0f2447;
  --guaca-light: #e8eef8;
  --guaca-hover: #2a5aa8;

  --bg: #f5f6f8;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --text-3: #6b7280;
  --text-4: #9ca3af;

  --hover: #f3f4f6;
  --selected: #eef4ff;

  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --purple: #a855f7;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

  --radius: 6px;
  --radius-sm: 4px;

  --sidebar-w: 224px;
  --topbar-h: 56px;
}

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

html, body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  height: 100%;
}

#root { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--guaca); box-shadow: 0 0 0 3px rgba(31,71,141,0.12); }
a { color: var(--guaca); text-decoration: none; }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

.sidebar {
  grid-row: 1 / 3;
  background: var(--guaca-darker);
  color: #cfd8ea;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sidebar-brand img {
  width: 40px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
}
.sidebar-brand-text { color: #fff; font-weight: 600; font-size: 14px; letter-spacing: 0.2px; }
.sidebar-brand-sub { font-size: 10px; color: #8ba3c9; letter-spacing: 0.6px; text-transform: uppercase; margin-top: 1px; }

.sidebar-section-label {
  padding: 14px 20px 6px;
  font-size: 10px;
  letter-spacing: 0.8px;
  color: #6b83aa;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: #b6c3dc;
  font-size: 13px;
  cursor: pointer;
  border-left: 3px solid transparent;
  position: relative;
  transition: all 0.1s;
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: #fff; }
.nav-item.active { background: rgba(255,255,255,0.08); color: #fff; border-left-color: #6a9dff; }
.nav-item .nav-icon { width: 16px; height: 16px; opacity: 0.85; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 500;
}
.nav-item.alert .nav-badge { background: var(--red); }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 11px;
  color: #6b83aa;
  flex-shrink: 0;
}

/* ============ TOPBAR ============ */
.topbar {
  grid-column: 2;
  grid-row: 1;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 5;
  position: sticky;
  top: 0;
}
.topbar-title { font-weight: 600; font-size: 15px; color: var(--text); white-space: nowrap; }
.topbar-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}
.topbar-search input {
  flex: 1;
  border: none; background: none; outline: none;
  font-size: 13px;
}
.topbar-search input::placeholder { color: var(--text-4); }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--text-3);
  position: relative;
  cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--red);
}

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 11px;
  flex-shrink: 0;
}
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius);
  cursor: pointer;
}
.topbar-user:hover { background: var(--hover); }
.topbar-user-name { font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.3; }
.topbar-user-role { font-size: 10px; color: var(--text-3); white-space: nowrap; line-height: 1.3; }

/* ============ MAIN ============ */
.main {
  grid-column: 2;
  grid-row: 2;
  overflow: auto;
  padding: 20px 24px;
}
.main.no-pad { padding: 0; overflow: hidden; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.page-subtitle { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.12s;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn-primary {
  background: var(--guaca); color: #fff; border-color: var(--guaca);
}
.btn-primary:hover { background: var(--guaca-hover); border-color: var(--guaca-hover); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-icon-only { padding: 6px; }

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.card-body { padding: 16px; }

/* ============ DASHBOARD ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent, var(--guaca));
}
.kpi-label { font-size: 11px; color: var(--text-3); font-weight: 500; letter-spacing: 0.3px; text-transform: uppercase; }
.kpi-value { font-size: 26px; font-weight: 600; color: var(--text); margin-top: 4px; letter-spacing: -0.5px; }
.kpi-delta { font-size: 11px; margin-top: 4px; color: var(--text-3); }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }

.stats-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-mini { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.stat-mini-label { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.3px; font-weight: 500; }
.stat-mini-value { font-size: 17px; font-weight: 600; margin-top: 2px; }

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 12px; }
.dashboard-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.mini-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.mini-list-row:last-child { border-bottom: none; }
.mini-list-bar { flex: 1; height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.mini-list-bar-fill { height: 100%; background: var(--guaca); border-radius: 3px; }
.mini-list-value { font-weight: 600; min-width: 30px; text-align: right; color: var(--text-2); font-size: 12px; }

/* ============ TABLE ============ */
.table-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}
.table-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.table-filter:hover { background: var(--hover); }
.table-filter.active { background: var(--guaca-light); border-color: var(--guaca); color: var(--guaca); }
.table-filter-count {
  background: var(--bg); color: var(--text-3);
  border-radius: 8px; padding: 0 5px; font-size: 10px; font-weight: 600;
}
.table-filter.active .table-filter-count { background: var(--guaca); color: #fff; }

.table-wrapper {
  background: #fff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow-x: auto;
}
table.cases-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 900px;
}
table.cases-table thead th {
  background: #fafbfc;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.cases-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f3f5;
  vertical-align: middle;
  color: var(--text-2);
}
table.cases-table tbody tr {
  cursor: pointer;
  transition: background 0.08s;
}
table.cases-table tbody tr:hover { background: var(--hover); }
table.cases-table tbody tr td:first-child {
  padding-left: 12px;
  border-left: 3px solid var(--row-color, var(--guaca));
}
.case-id { font-weight: 600; color: var(--guaca); font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; white-space: nowrap; }
.case-subject { color: var(--text); font-weight: 500; }

/* ============ CHIPS / BADGES ============ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: #f1f3f5;
  color: var(--text-2);
  white-space: nowrap;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip.priority-baja { color: #64748b; background: #f1f5f9; }
.chip.priority-media { color: #0e7490; background: #ecfeff; }
.chip.priority-alta { color: #c2410c; background: #fff7ed; }
.chip.priority-critica { color: #b91c1c; background: #fef2f2; }

.sla-indicator {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.sla-indicator .sla-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sla-indicator.verde .sla-dot { background: var(--green); box-shadow: 0 0 0 2px rgba(22,163,74,0.15); }
.sla-indicator.amarillo .sla-dot { background: var(--yellow); box-shadow: 0 0 0 2px rgba(217,119,6,0.15); }
.sla-indicator.rojo .sla-dot { background: var(--red); box-shadow: 0 0 0 2px rgba(220,38,38,0.15); }
.sla-indicator.gris .sla-dot { background: var(--text-4); }
.sla-indicator.pausado .sla-dot { background: #d97706; box-shadow: 0 0 0 2px rgba(217,119,6,0.18); }
.sla-indicator.verde { color: var(--green); }
.sla-indicator.amarillo { color: var(--yellow); }
.sla-indicator.rojo { color: var(--red); }
.sla-indicator.gris { color: var(--text-4); }
.sla-indicator.pausado { color: #d97706; }

/* ============ FORM ============ */
.form-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.form-section-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-header-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--guaca-light); color: var(--guaca);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.form-body { padding: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.2px;
}
.field label .req { color: var(--red); }
.field input, .field select, .field textarea {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  background: #fff;
}
.field textarea { resize: vertical; min-height: 72px; }
.field-hint { font-size: 11px; color: var(--text-3); }

/* ============ CASE DETAIL ============ */
.case-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: calc(100vh - var(--topbar-h));
  background: #fff;
  overflow: hidden;
}
.case-main { display: flex; flex-direction: column; border-right: 1px solid var(--border); overflow: hidden; min-height: 0; }
.case-side { background: #fafbfc; overflow-y: auto; padding: 16px; }

.case-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}
.case-header-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.case-header-id { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.case-header-title { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.case-header-meta { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; margin-top: 6px; }
.case-header-meta > div { display: flex; align-items: center; gap: 5px; }

.case-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 0 24px;
  flex-shrink: 0;
  overflow-x: auto;
}
.case-tab {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}
.case-tab:hover { color: var(--text); }
.case-tab.active { color: var(--guaca); border-bottom-color: var(--guaca); }
.case-tab-count {
  background: var(--bg);
  color: var(--text-3);
  border-radius: 8px;
  padding: 1px 6px;
  font-size: 10px;
  margin-left: 5px;
  font-weight: 500;
}
.case-tab.active .case-tab-count { background: var(--guaca-light); color: var(--guaca); }

.case-body { flex: 1; overflow-y: auto; padding: 20px 24px; min-height: 0; }

/* Timeline */
.timeline { position: relative; }
.timeline::before {
  content: ''; position: absolute; left: 15px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.tl-item { display: flex; gap: 12px; margin-bottom: 16px; position: relative; }
.tl-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: #fff; border: 2px solid var(--border);
  display: grid; place-items: center;
  color: var(--text-3);
  flex-shrink: 0;
  z-index: 1;
}
.tl-icon.email_in { background: #eef4ff; border-color: #c7d7f8; color: var(--guaca); }
.tl-icon.email_out { background: #ecfdf5; border-color: #bfe6d1; color: var(--green); }
.tl-icon.comentario { background: #fef3c7; border-color: #fde68a; color: #b45309; }
.tl-icon.estado { background: #f1f5f9; border-color: #cbd5e1; color: var(--text-3); }
.tl-icon.asignacion { background: #f3e8ff; border-color: #d8b4fe; color: #7c3aed; }
.tl-icon.llamada { background: #fef2f2; border-color: #fecaca; color: var(--red); }

.tl-content { flex: 1; padding-bottom: 4px; min-width: 0; }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.tl-head strong { color: var(--text); font-weight: 600; }
.tl-head .tl-tag { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.3px; font-weight: 500; white-space: nowrap; }
.tl-head .tl-tag.interno { background: #fef3c7; color: #92400e; }
.tl-head .tl-date { color: var(--text-3); margin-left: auto; font-size: 11px; white-space: nowrap; }
.tl-body {
  font-size: 12.5px; color: var(--text-2); line-height: 1.55;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px;
}
.tl-body.interno { background: #fffbeb; border-color: #fde68a; }
.tl-attachments { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tl-attach { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--text-2); background: #fff; }

.composer {
  border-top: 1px solid var(--border);
  background: #fff;
  padding: 12px 24px 16px;
  flex-shrink: 0;
}
.composer-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.composer-tab {
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  cursor: pointer;
}
.composer-tab.active { background: var(--guaca-light); color: var(--guaca); }
.composer-tab:hover:not(.active) { background: var(--hover); }

/* ── Fila de destinatarios (Para / Cc) ── */
.composer-to-row {
  padding: 6px 12px 5px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 36px;
  cursor: text;
  background: #fff;
  transition: background 0.12s;
}
.composer-to-row:focus-within { background: #f8faff; }
.composer-to-label {
  font-size: 11.5px;
  color: var(--text-3);
  font-weight: 600;
  padding-top: 3px;
  white-space: nowrap;
  min-width: 32px;
}
.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 12px;
  padding: 2px 6px 2px 9px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 220px;
  overflow: visible;
  line-height: 20px;
  transition: opacity 0.1s;
}
/* el span de texto dentro del chip se trunca, pero el botón × queda siempre visible */
.email-chip > span.chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  white-space: nowrap;
  display: inline-block;
}
.email-chip.chip-to    { background: #e8eefa; color: #1F478D; border: 1px solid #c7d6f5; }
.email-chip.chip-extra { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.email-chip.chip-cc    { background: #f3e8ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.email-chip .chip-remove {
  background: none; border: none; cursor: pointer;
  color: currentColor; opacity: 0.55;
  padding: 0 0 0 3px; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center;
  flex-shrink: 0;
}
.email-chip .chip-remove:hover { opacity: 1; }
.composer-to-input {
  flex: 1 1 110px; min-width: 80px;
  font-size: 11.5px; border: none; background: transparent;
  outline: none; padding: 2px 4px;
  color: var(--text-2); line-height: 22px;
}
.composer-to-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
  white-space: nowrap;
}

.composer-body textarea {
  width: 100%; min-height: 80px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px;
  resize: vertical;
  font-size: 12.5px;
}
.composer-body.interno textarea { background: #fffbeb; border-color: #fde68a; }
.composer-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.composer-actions .spacer { flex: 1; }

/* Side panel */
.side-block { margin-bottom: 18px; }
.side-block-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.6px; color: var(--text-3);
  text-transform: uppercase; margin-bottom: 8px;
}
.side-prop {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #eef0f2;
  font-size: 12px;
  gap: 8px;
}
.side-prop:last-child { border-bottom: none; }
.side-prop-label { color: var(--text-3); white-space: nowrap; }
.side-prop-value { color: var(--text); font-weight: 500; text-align: right; max-width: 65%; word-break: break-word; }

.state-picker {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.state-picker:hover { background: var(--hover); }
.state-picker-chevron { margin-left: auto; color: var(--text-4); }
.state-picker-wrapper { position: relative; }
.state-picker-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}
.state-picker-menu-item {
  padding: 6px 8px;
  border-radius: 4px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  cursor: pointer;
}
.state-picker-menu-item:hover { background: var(--hover); }
.state-picker-menu-item.active { background: var(--guaca-light); color: var(--guaca); font-weight: 600; }

/* ============ CATALOGOS ============ */
.tabs-inline {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab-inline {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tab-inline.active { color: var(--guaca); border-bottom-color: var(--guaca); font-weight: 600; }
.tab-inline:hover { color: var(--text); }

.catalog-table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; }
.catalog-table th {
  background: #fafbfc; padding: 8px 12px; text-align: left; font-weight: 600;
  color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
}
.catalog-table td {
  padding: 9px 12px; border-bottom: 1px solid #f1f3f5;
}
.catalog-table tr:hover td { background: var(--hover); }
.toggle-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.toggle-pill.active { background: #dcfce7; color: #166534; }
.toggle-pill.inactive { background: #fee2e2; color: #991b1b; }

/* ============ MISC ============ */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty-state-icon { font-size: 32px; margin-bottom: 8px; }

/* Scrollbar polish */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; background-clip: content-box; }

/* Search in toolbar */
.toolbar-search {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
  width: 280px;
}
.toolbar-search input {
  flex: 1; border: none; background: none; outline: none; font-size: 12.5px;
}

/* Badge for section header */
.section-badge {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 500;
  margin-left: auto;
}

/* Color state dot */
.state-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}

/* ── Modales ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-box {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  padding: 24px;
  width: 100%;
  animation: modalIn 0.15s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--bg-2); color: var(--text-1); }

/* ============================================================
   LOGIN SCREEN
   ============================================================ */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--guaca-darker) 0%, var(--guaca) 60%, #2a6dd9 100%);
  z-index: 9999;
  overflow: hidden;
}

/* Fondo decorativo - círculos */
.login-bg-deco {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-bg-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.login-bg-circle-1 { width: 420px; height: 420px; top: -100px; right: -100px; }
.login-bg-circle-2 { width: 260px; height: 260px; bottom: -60px; left: 10%; background: rgba(255,255,255,0.06); }
.login-bg-circle-3 { width: 160px; height: 160px; top: 40%; left: -50px; }

/* Card */
.login-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 16px;
  padding: 40px 44px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28), 0 4px 16px rgba(0,0,0,0.12);
  animation: loginCardIn 0.35s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Logo */
.login-logo-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.login-logo {
  width: 56px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.10));
}
.login-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--guaca);
  line-height: 1.1;
}
.login-brand-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  letter-spacing: 0.3px;
}

/* Títulos */
.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.login-subtitle {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 26px;
  line-height: 1.5;
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.login-input:focus {
  border-color: var(--guaca);
  box-shadow: 0 0 0 3px rgba(31,71,141,0.1);
}
.login-input-error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.08) !important;
}

/* Password toggle */
.login-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-pass {
  padding-right: 42px;
}
.login-pass-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}
.login-pass-toggle:hover { color: var(--guaca); }

/* Error */
.login-error {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 10px 14px;
  color: var(--red);
  font-size: 12.5px;
  font-weight: 500;
}

/* Botón */
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--guaca);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(31,71,141,0.25);
  margin-top: 4px;
}
.login-btn:hover:not(:disabled) {
  background: var(--guaca-hover);
  box-shadow: 0 4px 14px rgba(31,71,141,0.35);
  transform: translateY(-1px);
}
.login-btn:active:not(:disabled) { transform: translateY(0); }
.login-btn:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

/* Spinner */
.login-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: loginSpin 0.7s linear infinite;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }

/* Footer */
.login-footer {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-4);
}

/* Logout button in topbar */
.logout-btn {
  transition: color 0.15s, background 0.15s !important;
}
.logout-btn:hover {
  color: var(--red) !important;
  background: #fef2f2 !important;
}
