/* ═══════════════════════════════════════════════════════════════════
   panel.css — Talaiot Digital · Sistema de Diseño Unificado
   Dark Luxury · Mobile-first · Responsive
   ═══════════════════════════════════════════════════════════════════ */

/* ── TOKENS ──────────────────────────────────────────────────────── */
:root {
  /* Paleta base */
  --bg:        #0B1623;
  --bg2:       #0F1E2E;
  --surface:   #152233;
  --surface2:  #1A2A3E;
  --surface3:  #1F3248;

  /* Bordes */
  --bdr:       rgba(255,255,255,.07);
  --bdr2:      rgba(255,255,255,.13);
  --bdr3:      rgba(255,255,255,.20);

  /* Acentos */
  --terra:     #C4622D;
  --terra2:    #E07A45;
  --gold:      #C9963A;
  --gold2:     #E5B55A;
  --teal:      #3ABBA0;
  --teal2:     #5ED4BC;
  --blue:      #4E9FE5;
  --blue2:     #7AB8EE;
  --violet:    #8B6FD4;
  --sage:      #6BAE8A;
  --coral:     #D95A38;
  --pink:      #D9609A;

  /* Texto */
  --text:      #EDF2F7;
  --text2:     #8FA8BE;
  --text3:     #5A7A96;
  --text4:     #3D5A72;

  /* Layout */
  --sidebar-w:     230px;
  --topbar-h:      44px;
  --bottomnav-h:   64px;
  --radius:        11px;
  --radius-lg:     16px;
  --radius-xl:     20px;

  /* Tipografía */
  --font-ui:    'Inter', 'Outfit', system-ui, sans-serif;
  --font-disp:  'Outfit', 'Inter', system-ui, sans-serif;

  /* Sombras */
  --shadow-sm:  0 2px 8px rgba(0,0,0,.3);
  --shadow-md:  0 4px 20px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.5);

  /* Transiciones */
  --t-fast:  .15s ease;
  --t-mid:   .25s cubic-bezier(.2,.8,.3,1);
}

/* ── TEMAS ───────────────────────────────────────────────────────── */
/* Light: misma estética que la landing pública */
[data-theme="light"] {
  --bg:        #FAFAF7;
  --bg2:       #F0EDE6;
  --surface:   #FFFFFF;
  --surface2:  #F5F2EC;
  --surface3:  #EDE8DF;
  --bdr:       rgba(28,28,28,.09);
  --bdr2:      rgba(28,28,28,.16);
  --bdr3:      rgba(28,28,28,.24);
  --terra:     #D4823A;
  --terra2:    #B86A28;
  --gold:      #C9963A;
  --gold2:     #A87830;
  --teal:      #3ABBA0;
  --teal2:     #2E9A83;
  --blue:      #2B6CB0;
  --blue2:     #2563A8;
  --violet:    #6B46C1;
  --sage:      #2D6A4F;
  --coral:     #C0392B;
  --pink:      #B83280;
  --text:      #1C1C1C;
  --text2:     #4A5568;
  --text3:     #6B7280;
  --text4:     #9CA3AF;
  --shadow-sm: 0 1px 3px rgba(20,30,40,.06), 0 4px 12px rgba(20,30,40,.06);
  --shadow-md: 0 4px 20px rgba(20,30,40,.10);
  --shadow-lg: 0 8px 40px rgba(20,30,40,.14);
}

/* Grey: tono medio entre light y dark */
[data-theme="grey"] {
  --bg:        #1A2030;
  --bg2:       #1E2638;
  --surface:   #232C3E;
  --surface2:  #293348;
  --surface3:  #2F3A52;
  --bdr:       rgba(255,255,255,.08);
  --bdr2:      rgba(255,255,255,.14);
  --bdr3:      rgba(255,255,255,.22);
  --terra:     #D4823A;
  --terra2:    #E09050;
  --gold:      #C9A96E;
  --gold2:     #E0C070;
  --teal:      #3ABBA0;
  --teal2:     #5ED4BC;
  --blue:      #5B9BD5;
  --violet:    #9B7FE0;
  --sage:      #7BC49A;
  --coral:     #E07060;
  --text:      #E8EDF5;
  --text2:     #9AAAC0;
  --text3:     #6B7F98;
  --text4:     #4A5E74;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
  --shadow-md: 0 4px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.45);
}
/* Dark: ya definido en :root (por defecto) */

/* Light mode: ajustes de componentes */
[data-theme="light"] .td-sidebar {
  background: var(--surface);
  border-right-color: var(--bdr2);
}
[data-theme="light"] .sb-logo { border-bottom-color: var(--bdr2); }
[data-theme="light"] .sb-item { color: var(--text3); }
[data-theme="light"] .sb-item:hover { background: var(--surface2); color: var(--text); }
[data-theme="light"] .sb-item.active { background: rgba(58,187,160,.10); color: var(--teal2); }
[data-theme="light"] .sb-foot { border-top-color: var(--bdr); color: var(--text3); }
[data-theme="light"] .card { background: var(--surface); }
[data-theme="light"] .td-table th { color: var(--text3); background: var(--surface2); }
[data-theme="light"] .td-table tbody tr:hover td { background: rgba(0,0,0,.025); }
[data-theme="light"] .td-input,
[data-theme="light"] .td-select,
[data-theme="light"] .td-textarea {
  background: var(--surface);
  color: var(--text);
  border-color: var(--bdr2);
}
[data-theme="light"] .td-input:focus,
[data-theme="light"] .td-select:focus { box-shadow: 0 0 0 3px rgba(58,187,160,.15); }
[data-theme="light"] .btn-ghost {
  background: var(--surface);
  border-color: var(--bdr2);
  color: var(--text2);
}
[data-theme="light"] .btn-ghost:hover { background: var(--surface2); color: var(--text); }
[data-theme="light"] .td-modal { background: var(--surface); }
[data-theme="light"] .td-modal-hdr { background: var(--surface); border-bottom-color: var(--bdr); }
[data-theme="light"] .td-tabs { background: var(--surface2); border-color: var(--bdr); }
[data-theme="light"] .td-tab.active { background: var(--surface); }
[data-theme="light"] .tag-muted { color: var(--text3); background: var(--surface2); border-color: var(--bdr2); }
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--surface2); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--surface3); }

/* ── RESET ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  /* padding-top viene de auth-guard */
}

/* Reservar espacio para la nav inferior en mobile */
@media (max-width: 1023px) {
  body { padding-bottom: var(--bottomnav-h) !important; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--bdr3); }

/* ── LAYOUT SIDEBAR ──────────────────────────────────────────────── */
.td-app {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

/* Sidebar */
.td-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform var(--t-mid), width var(--t-mid);
  z-index: 200;
}

/* Sidebar mobile — oculto por defecto */
@media (max-width: 1023px) {
  .td-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    height: calc(100vh - var(--topbar-h) - var(--bottomnav-h));
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 500;
  }
  .td-sidebar.open { transform: translateX(0); }
  .td-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 499;
    backdrop-filter: blur(2px);
  }
  .td-sidebar.open ~ .td-sidebar-overlay { display: block; }
}

/* Main content */
.td-main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

/* ── SIDEBAR COMPONENTES ─────────────────────────────────────────── */
.sb-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--bdr);
  flex-shrink: 0;
}
.sb-logo-name {
  font-family: var(--font-disp);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.sb-logo-name em { color: var(--gold); font-style: normal; }
.sb-logo-tag {
  font-size: 9px;
  color: var(--text3);
  letter-spacing: .2em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sb-nav { padding: 10px 8px; flex: 1; overflow-y: auto; }

.sb-section {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 12px 10px 5px;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text2);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all var(--t-fast);
  font-family: inherit;
  margin-bottom: 1px;
  text-decoration: none;
  position: relative;
}
.sb-item:hover { background: var(--surface); color: var(--text); }
.sb-item.active {
  background: rgba(58,187,160,.12);
  color: var(--teal);
}
.sb-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2.5px;
  background: var(--teal);
  border-radius: 0 2px 2px 0;
}
.sb-icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .8;
}
.sb-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-badge {
  background: var(--coral);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 100px;
  flex-shrink: 0;
}

.sb-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--bdr);
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
}

/* ── MOBILE BOTTOM NAV ───────────────────────────────────────────── */
#td-bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 600;
  height: var(--bottomnav-h);
  background: rgba(9,16,26,.97);
  border-top: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 0;
  /* Safe area iOS */
  padding-bottom: env(safe-area-inset-bottom);
}

#td-bottomnav .bnav-inner {
  display: flex;
  height: 64px;
}

#td-bottomnav .bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text3);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  transition: color var(--t-fast);
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
  position: relative;
}
#td-bottomnav .bnav-item.active { color: var(--teal); }
#td-bottomnav .bnav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--teal);
  border-radius: 0 0 3px 3px;
}
#td-bottomnav .bnav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#td-bottomnav .bnav-badge {
  position: absolute;
  top: 8px;
  right: calc(50% - 18px);
  background: var(--coral);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg);
}

@media (max-width: 1023px) {
  #td-bottomnav { display: block; }
}

/* ── PAGE HEADER ─────────────────────────────────────────────────── */
.td-page-hdr {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--bdr);
  background: linear-gradient(180deg, rgba(15,30,46,.6) 0%, transparent 100%);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: var(--topbar-h);
  z-index: 50;
  backdrop-filter: blur(10px);
}
.td-page-hdr h2 {
  font-family: var(--font-disp);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text);
}
.td-page-hdr .sub {
  font-size: 12px;
  color: var(--text3);
  margin-top: 3px;
}
.td-page-hdr-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .td-page-hdr { padding: 16px 16px 14px; }
  .td-page-hdr h2 { font-size: 18px; }
  .td-page-hdr-actions { width: 100%; }
}

/* ── CONTENT PADDING ─────────────────────────────────────────────── */
.td-body {
  padding: 24px 28px;
}
@media (max-width: 600px) {
  .td-body { padding: 16px 16px; }
}

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
.btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.btn svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* Variantes */
.btn-primary { background: var(--gold); color: #0B1623; }
.btn-primary:hover { background: var(--gold2); }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--bdr);
  color: var(--text2);
}
.btn-ghost:hover { border-color: var(--bdr2); color: var(--text); background: var(--surface2); }

.btn-teal {
  background: rgba(58,187,160,.12);
  border: 1px solid rgba(58,187,160,.22);
  color: var(--teal);
}
.btn-teal:hover { background: rgba(58,187,160,.22); }

.btn-danger {
  background: rgba(217,90,56,.12);
  border: 1px solid rgba(217,90,56,.22);
  color: var(--coral);
}
.btn-danger:hover { background: rgba(217,90,56,.22); }

.btn-terra {
  background: rgba(196,98,45,.12);
  border: 1px solid rgba(196,98,45,.22);
  color: var(--terra2);
}
.btn-terra:hover { background: rgba(196,98,45,.22); }

.btn-sm {
  padding: 5px 11px;
  font-size: 11.5px;
  min-height: 30px;
  border-radius: 6px;
}

/* Mobile: botones full-width opcionales */
@media (max-width: 480px) {
  .btn-block-mobile { width: 100%; justify-content: center; }
}

/* ── CARDS ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-body { padding: 16px 18px; }
.card-hdr {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.card-hdr h3 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.card-ftr {
  padding: 12px 18px;
  border-top: 1px solid var(--bdr);
  background: rgba(0,0,0,.12);
}

/* ── STATS GRID ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--bdr);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-card .sv {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  display: block;
}
.stat-card .sl {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stat-card.accent-teal  .sv { color: var(--teal); }
.stat-card.accent-blue  .sv { color: var(--blue); }
.stat-card.accent-coral .sv { color: var(--coral); }
.stat-card.accent-terra .sv { color: var(--terra2); }

/* ── TABLAS ──────────────────────────────────────────────────────── */
.td-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.td-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.td-table th {
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--bdr);
  white-space: nowrap;
  text-align: left;
}
.td-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--bdr);
  vertical-align: middle;
}
.td-table tbody tr:last-child td { border-bottom: none; }
.td-table tbody tr:hover td { background: rgba(255,255,255,.02); }

/* ── TAGS / BADGES ───────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 100px;
  border: 1px solid;
  white-space: nowrap;
}
.tag-gold    { color: var(--gold);  border-color: rgba(201,150,58,.3);  background: rgba(201,150,58,.08); }
.tag-teal    { color: var(--teal);  border-color: rgba(58,187,160,.3);  background: rgba(58,187,160,.08); }
.tag-blue    { color: var(--blue);  border-color: rgba(78,159,229,.3);  background: rgba(78,159,229,.08); }
.tag-coral   { color: var(--coral); border-color: rgba(217,90,56,.3);   background: rgba(217,90,56,.08); }
.tag-terra   { color: var(--terra2);border-color: rgba(196,98,45,.3);   background: rgba(196,98,45,.08); }
.tag-violet  { color: var(--violet);border-color: rgba(139,111,212,.3); background: rgba(139,111,212,.08); }
.tag-sage    { color: var(--sage);  border-color: rgba(107,174,138,.3); background: rgba(107,174,138,.08); }
.tag-muted   { color: var(--text3); border-color: var(--bdr2);          background: rgba(255,255,255,.04); }

/* ── TABS ────────────────────────────────────────────────────────── */
.td-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--bdr);
  border-radius: 10px;
  padding: 3px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.td-tabs::-webkit-scrollbar { display: none; }
.td-tab {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  cursor: pointer;
  transition: all var(--t-fast);
  border: none;
  background: none;
  font-family: inherit;
  white-space: nowrap;
}
.td-tab:hover { color: var(--text2); background: rgba(255,255,255,.04); }
.td-tab.active {
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* ── INPUTS ──────────────────────────────────────────────────────── */
.td-input,
.td-select,
.td-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--bdr2);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
  min-height: 44px;
}
.td-input:focus,
.td-select:focus,
.td-textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(58,187,160,.12);
}
.td-input::placeholder { color: var(--text4); }
.td-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A7A96' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.td-textarea { min-height: 80px; resize: vertical; }

/* Label */
.td-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text3);
  text-transform: uppercase;
  margin-bottom: 5px;
}

/* Input group */
.td-field { display: flex; flex-direction: column; gap: 5px; }
.td-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .td-field-row { grid-template-columns: 1fr; }
}

/* ── MODAL ───────────────────────────────────────────────────────── */
.td-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 900;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.td-overlay.open { display: flex; }

.td-modal {
  background: var(--surface);
  border: 1px solid var(--bdr2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.td-modal-hdr {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.td-modal-hdr h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.td-modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--bdr);
  color: var(--text3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all var(--t-fast);
  flex-shrink: 0;
  font-family: inherit;
}
.td-modal-close:hover { background: var(--surface3); color: var(--text); }
.td-modal-body { padding: 20px 22px; }
.td-modal-ftr {
  padding: 16px 22px;
  border-top: 1px solid var(--bdr);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 540px) {
  .td-modal { max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
  .td-overlay { align-items: flex-end; padding: 0; }
  .td-modal-ftr { flex-direction: column-reverse; }
  .td-modal-ftr .btn { width: 100%; justify-content: center; }
}

/* ── SEARCH BAR ──────────────────────────────────────────────────── */
.td-search {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--bdr2);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.td-search:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(58,187,160,.10);
}
.td-search-icon {
  padding: 0 10px;
  color: var(--text3);
  display: flex;
  align-items: center;
}
.td-search-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.td-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 9px 12px 9px 0;
  min-height: 44px;
}
.td-search input::placeholder { color: var(--text4); }

/* ── EMPTY STATE ─────────────────────────────────────────────────── */
.td-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text3);
}
.td-empty-icon { font-size: 2.5rem; margin-bottom: .8rem; opacity: .5; }
.td-empty h3 { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: .4rem; }
.td-empty p { font-size: 13px; }

/* ── PROGRESS BAR ────────────────────────────────────────────────── */
.td-progress { height: 5px; background: var(--surface3); border-radius: 100px; overflow: hidden; }
.td-progress-bar { height: 100%; background: var(--teal); border-radius: 100px; transition: width .4s ease; }

/* ── TOOLTIP ─────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--bdr2);
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

/* ── DIVIDER ─────────────────────────────────────────────────────── */
.td-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--terra) 0%, rgba(201,150,58,.3) 40%, transparent 100%);
}

/* ── UTILITIES ───────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.text-muted { color: var(--text3); }
.text-muted2 { color: var(--text2); }
.font-bold { font-weight: 700; }
.font-600 { font-weight: 600; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12.5px; }
.w-full { width: 100%; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }

/* Visibilidad responsive */
.hide-mobile { }
.show-mobile { display: none; }
@media (max-width: 1023px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
}

/* ── REDUCIR MOVIMIENTO ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
