/* ============================================================
   Totem Digital — Admin Panel Styles
   Design System v2.0  |  Foundation + Shell
   ============================================================ */

/* ─── 1. CSS Tokens ─────────────────────────────────────────── */
:root {
  /* Tipografía */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Superficies */
  --canvas:    #F6F5F1;
  --surface:   #FFFFFF;
  --surface-2: #FAF9F6;

  /* Texto */
  --ink:       #131418;
  --ink-2:     #3B3D44;
  --muted:     #7A7B82;
  --muted-2:   #A8A8AE;

  /* Líneas */
  --line:      #E8E6E0;
  --line-2:    #EFEDE7;

  /* Sidebar dark */
  --sb-bg:     #0E1014;
  --sb-bg-2:   #15181E;
  --sb-text:   #9CA0AB;
  --sb-text-2: #6A6E78;
  --sb-line:   #1F232B;
  --sb-w:      232px;

  /* Acento */
  --accent:      #D43A2F;
  --accent-2:    #B2271E;
  --accent-soft: #FBE9E5;
  --accent-ink:  #FFFFFF;

  /* Semánticos */
  --ok:        #1F8A56;  --ok-soft:   #DEF1E5;
  --warn:      #B47A0A;  --warn-soft: #FBEFD0;
  --bad:       #B43248;  --bad-soft:  #FBE1E5;
  --info:      #2A6FDB;  --info-soft: #DEE9FA;

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

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(17,18,22,.04);
  --shadow-md: 0 6px 24px -8px rgba(17,18,22,.10), 0 2px 6px -2px rgba(17,18,22,.06);
}

/* ─── 2. Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code, kbd, samp, pre, .mono {
  font-family: var(--font-mono);
  font-size: .92em;
}

/* ─── 3. App Shell (grid layout) ────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  height: 100vh;
  overflow: hidden;
  background: var(--canvas);
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page {
  padding: 26px 28px 60px;
  max-width: 1480px;
  margin: 0 auto;
}

/* ─── 4. Page Head ───────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
}

.page-head__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
  line-height: 1.25;
}

.page-head__sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 4px;
  margin-bottom: 0;
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── 5. Sidebar ─────────────────────────────────────────────── */
.sb {
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-line);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

/* Brand area */
.sb-brand {
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--sb-line);
  flex-shrink: 0;
}

.sb-brand__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 17px;
  position: relative;
  flex-shrink: 0;
}

.sb-brand__led {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  border: 1.5px solid var(--sb-bg);
  animation: led-ping 2s ease-in-out infinite;
}

@keyframes led-ping {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  50%       { opacity: .85; box-shadow: 0 0 0 5px rgba(34,197,94,0); }
}

.sb-brand__name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sb-brand__sub {
  color: var(--sb-text-2);
  font-size: 11px;
}

/* Nav scroll area */
.sb-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--sb-line) transparent;
}

.sb-section {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sb-text-2);
  padding: 14px 8px 6px;
  margin-bottom: 2px;
}

/* Nav link */
.sb-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--sb-text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  position: relative;
  margin-bottom: 1px;
  white-space: nowrap;
  user-select: none;
}

.sb-link:hover {
  background: var(--sb-bg-2);
  color: #fff;
  text-decoration: none;
}

.sb-link.active {
  background: linear-gradient(90deg,
    rgba(212,58,47,.22),
    rgba(212,58,47,.06));
  color: #fff;
}

.sb-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sb-link__icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  opacity: .75;
}

.sb-link:hover .sb-link__icon,
.sb-link.active .sb-link__icon { opacity: 1; }

.sb-link__count {
  margin-left: auto;
  background: rgba(255,255,255,.07);
  color: var(--sb-text);
  font-family: var(--font-mono);
  font-size: 11px;
  min-width: 22px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
}

/* Sidebar footer */
.sb-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--sb-line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sb-footer__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sb-footer__info { min-width: 0; flex: 1; }

.sb-footer__name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-footer__role {
  color: var(--sb-text-2);
  font-size: 11px;
}

.sb-footer__logout {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--sb-text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
  text-decoration: none;
}

.sb-footer__logout:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

/* ─── 6. Topbar ──────────────────────────────────────────────── */
.tb {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}

.tb-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.tb-breadcrumb__icon { font-size: 12px; color: var(--muted-2); }
.tb-breadcrumb__sep  { font-size: 10px; color: var(--muted-2); }
.tb-breadcrumb__current { color: var(--ink); font-weight: 600; }

.tb-search {
  width: 320px;
  max-width: 35vw;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.tb-search:focus-within {
  border-color: var(--ink-2);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(19,20,24,.08);
}

.tb-search__icon { color: var(--muted); font-size: 13px; flex-shrink: 0; }

.tb-search__input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--ink);
  min-width: 0;
}

.tb-search__input::placeholder { color: var(--muted-2); }

.tb-search__kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
  background: var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.tb-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  position: relative;
  text-decoration: none;
  flex-shrink: 0;
}

.tb-btn:hover { background: var(--surface-2); color: var(--ink); }

.tb-btn__dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  border: 1.5px solid var(--surface);
}

.tb-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  text-decoration: none;
  flex-shrink: 0;
  position: relative;
}

.tb-avatar:hover {
  background: var(--surface-2);
  border-color: var(--muted-2);
  text-decoration: none;
}

.tb-avatar__pic {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.tb-avatar__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-avatar__chevron { color: var(--muted); font-size: 10px; }

/* Avatar dropdown */
.tb-avatar-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: none;
  z-index: 50;
}

.tb-avatar-menu.open { display: block; }

.tb-avatar-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--ink);
  font-size: 13.5px;
  text-decoration: none;
  transition: background 0.1s;
}

.tb-avatar-menu a:hover { background: var(--surface-2); }

.tb-avatar-menu a.danger { color: var(--bad); }

.tb-avatar-menu__sep {
  height: 1px;
  background: var(--line-2);
  margin: 4px 0;
}

/* ─── 7. Botones (.btn-tk) ───────────────────────────────────── */
.btn-tk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
  -webkit-appearance: none;
}

.btn-tk:hover {
  background: var(--surface-2);
  border-color: var(--muted-2);
  color: var(--ink);
  text-decoration: none;
}

.btn-tk:active { opacity: .85; }

.btn-tk:disabled,
.btn-tk[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Tamaños */
.btn-tk--sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-tk--xs { height: 26px; padding: 0 9px;  font-size: 12px;   border-radius: var(--r-sm); }
.btn-tk--icon { width: 36px; padding: 0; }
.btn-tk--sm.btn-tk--icon { width: 30px; }
.btn-tk--xs.btn-tk--icon { width: 26px; }

/* Variantes */
.btn-tk--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn-tk--primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: #fff;
}

.btn-tk--accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px -2px rgba(212,58,47,.45);
}
.btn-tk--accent:hover {
  background: linear-gradient(135deg, var(--accent-2) 0%, #8a1810 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px -2px rgba(212,58,47,.55);
}

.btn-tk--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-tk--ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--ink);
}

.btn-tk--danger {
  background: transparent;
  border-color: var(--line);
  color: var(--bad);
}
.btn-tk--danger:hover {
  background: var(--bad-soft);
  border-color: var(--bad);
  color: var(--bad);
}

/* ─── 8. Badges (.badge-tk) ─────────────────────────────────── */
.badge-tk {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-tk--ok     { background: var(--ok-soft);   color: var(--ok); }
.badge-tk--warn   { background: var(--warn-soft);  color: var(--warn); }
.badge-tk--bad    { background: var(--bad-soft);   color: var(--bad); }
.badge-tk--info   { background: var(--info-soft);  color: var(--info); }
.badge-tk--accent { background: var(--accent-soft); color: var(--accent); }
.badge-tk--muted  { background: var(--surface-2);  color: var(--muted); border: 1px solid var(--line); }

/* Online pulse */
.badge-tk--pulse::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: badge-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .55; transform: scale(.8); }
}

/* ─── 9. Chips (.chip-tk) ────────────────────────────────────── */
.chip-tk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.chip-tk:hover { background: var(--surface-2); border-color: var(--muted-2); color: var(--ink); text-decoration: none; }

.chip-tk--active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip-tk--active:hover { background: var(--ink-2); border-color: var(--ink-2); color: #fff; }

.chip-tk__count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  border-radius: 999px;
  padding: 0 5px;
  min-width: 18px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.15);
}

.chip-tk:not(.chip-tk--active) .chip-tk__count {
  background: var(--surface-2);
  color: var(--muted);
}

/* Group chip (colored pill) */
.chip-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

/* ─── 10. Cards (.card-tk) ───────────────────────────────────── */
.card-tk {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-tk__head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-tk__head-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0;
}

.card-tk__head-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.card-tk__body   { padding: 16px 18px; }
.card-tk__foot   { padding: 12px 18px; border-top: 1px solid var(--line-2); background: var(--surface-2); }

/* KPI card */
.kpi-tk {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.kpi-tk__lbl   { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.kpi-tk__val   { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); line-height: 1; }
.kpi-tk__unit  { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi-tk__delta { font-size: 12px; font-weight: 500; margin-top: 6px; }
.kpi-tk__delta--up   { color: var(--ok); }
.kpi-tk__delta--down { color: var(--bad); }
.kpi-tk__delta--neutral { color: var(--muted); }
.kpi-tk__spark { position: absolute; right: 16px; top: 16px; opacity: .6; }

/* ─── 11. Tablas (.tbl-tk) ───────────────────────────────────── */
.tbl-tk-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tbl-tk {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.tbl-tk thead th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.tbl-tk tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
  color: var(--ink);
}

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

.tbl-tk__check  { width: 40px; padding: 13px 8px 13px 14px !important; }

.tbl-tk__mono   { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.tbl-tk__actions { opacity: 0; transition: opacity 0.12s; }
.tbl-tk tbody tr:hover .tbl-tk__actions { opacity: 1; }

/* Tbl tools (chips/filtros encima de tabla) */
.tbl-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  flex-wrap: wrap;
}

/* ─── 12. Inputs (.input-tk, .select-tk) ────────────────────── */
.input-tk,
.select-tk {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
}

.input-tk::placeholder { color: var(--muted-2); }

.input-tk:focus,
.select-tk:focus {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3px rgba(19,20,24,.08);
}

.input-tk--sm,
.select-tk--sm { height: 30px; font-size: 12.5px; padding: 0 10px; }

.select-tk {
  cursor: pointer;
  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='%237A7B82' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  appearance: none;
}

.label-tk {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 5px;
  display: block;
}

/* Filter row grid */
.filter-row { display: grid; gap: 10px; margin-bottom: 14px; align-items: end; }
.filter-row--5 { grid-template-columns: 1fr 1fr 1fr 1fr auto; }
.filter-row--4 { grid-template-columns: 1fr 1fr 1fr auto; }
.filter-row--3 { grid-template-columns: 1fr 1fr auto; }

/* ─── 13. Modal (.modal-tk) ──────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,17,22,.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: overlay-in 0.18s ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-tk {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px -12px rgba(0,0,0,.4);
  animation: modal-in 0.22s cubic-bezier(.22,.68,0,1.1);
  overflow: hidden;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-tk--lg { max-width: 860px; }
.modal-tk--xl { max-width: 1100px; }

.modal-tk__head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}

.modal-tk__title  { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; margin: 0; line-height: 1.3; }
.modal-tk__sub    { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-tk__close  { margin-left: auto; flex-shrink: 0; }
.modal-tk__body   { flex: 1; overflow-y: auto; padding: 20px 24px; }
.modal-tk__foot   {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Modal tabs */
.modal-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.modal-tabs::-webkit-scrollbar { display: none; }

.modal-tab {
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
  font-family: var(--font-sans);
}

.modal-tab:hover { color: var(--ink); }

.modal-tab.active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ─── 14. Drawer lateral ─────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,17,22,.35);
  backdrop-filter: blur(2px);
  z-index: 200;
  animation: overlay-in 0.18s ease;
}

.drawer-tk {
  position: fixed;
  top: 0;
  right: 0;
  width: min(1000px, 92vw);
  height: 100vh;
  background: var(--surface);
  box-shadow: -24px 0 60px -12px rgba(0,0,0,.35);
  z-index: 201;
  display: flex;
  flex-direction: column;
  animation: drawer-in 0.24s cubic-bezier(.22,.68,0,1.05);
  overflow: hidden;
}

@keyframes drawer-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.drawer-tk__head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.drawer-tk__body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-tk__foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-shrink: 0; }

/* ─── 15. Bulk Action Bar ────────────────────────────────────── */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 18px 40px -10px rgba(0,0,0,.35), 0 4px 12px rgba(0,0,0,.18);
  animation: bulk-in 0.2s cubic-bezier(.22,.68,0,1.15);
  white-space: nowrap;
  font-size: 13.5px;
}

@keyframes bulk-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.bulk-bar__count {
  font-weight: 700;
  padding-right: 12px;
  border-right: 1px solid rgba(255,255,255,.15);
  font-size: 13px;
}

.bulk-bar__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.75);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: var(--font-sans);
}

.bulk-bar__btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.bulk-bar__btn--danger:hover { background: rgba(180,50,72,.3); color: #ffa7b5; }

.bulk-bar__sep { width: 1px; height: 20px; background: rgba(255,255,255,.12); flex-shrink: 0; }

.bulk-bar__clear {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.55);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.12s;
  margin-left: 4px;
}

.bulk-bar__clear:hover { background: rgba(255,255,255,.14); color: #fff; }

/* ─── 16. Toggle switch ──────────────────────────────────────── */
.toggle-tk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-tk input[type="checkbox"] { display: none; }

.toggle-tk__track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  border: 1px solid var(--muted-2);
  position: relative;
  transition: background 0.18s, border-color 0.18s;
  flex-shrink: 0;
}

.toggle-tk__thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform 0.18s cubic-bezier(.34,1.56,.64,1);
}

.toggle-tk input:checked ~ .toggle-tk__track { background: var(--info); border-color: var(--info); }
.toggle-tk input:checked ~ .toggle-tk__track .toggle-tk__thumb { transform: translateX(16px); }

/* ─── 17. Progress bar ───────────────────────────────────────── */
.progress-tk { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-tk__bar { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.4s ease; }
.progress-tk__bar--ok   { background: var(--ok); }
.progress-tk__bar--info { background: var(--info); }

/* ─── 18. Pagination ─────────────────────────────────────────── */
.pagination-tk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  gap: 12px;
}

.pagination-tk__info { font-size: 13px; color: var(--muted); }

.pagination-tk__pages { display: flex; gap: 4px; }

.pagination-tk__btn {
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}

.pagination-tk__btn:hover     { background: var(--surface-2); }
.pagination-tk__btn.active    { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination-tk__btn:disabled  { opacity: .4; cursor: not-allowed; }

/* ─── 19. Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar          { width: 5px; height: 5px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--line); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ─── 20. Utilities ──────────────────────────────────────────── */
.font-mono { font-family: var(--font-mono); }
.text-ok   { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad  { color: var(--bad); }
.text-info { color: var(--info); }
.text-muted-tk { color: var(--muted); }
.text-accent   { color: var(--accent); }

@media print {
  .no-print { display: none !important; }
}

/* ─── 21. Backward compatibility (páginas no migradas aún) ───── */

/* Old Bootstrap layout wrapper */
.main-content { min-height: calc(100vh - 60px); overflow-x: hidden; }

.stat-card { border-radius: var(--r-lg) !important; transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md) !important; }
.stat-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }

.activity-feed { max-height: 420px; overflow-y: auto; }
.activity-item:last-child { border-bottom: none !important; }

.upload-zone { background: var(--surface-2); cursor: pointer; transition: background .2s, border-color .2s; }
.upload-zone.drag-over { background: var(--accent-soft); border-color: var(--accent) !important; }

.content-card { border-radius: var(--r-md); overflow: hidden; border: 2px solid transparent; transition: border-color .15s, box-shadow .15s, transform .15s; cursor: pointer; }
.content-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212,58,47,.15); }
.content-card .thumb { height: 140px; object-fit: cover; width: 100%; background: var(--sb-bg); display: flex; align-items: center; justify-content: center; }
.content-card .thumb img,
.content-card .thumb video { width: 100%; height: 140px; object-fit: cover; }

.playlist-item { border-radius: var(--r-sm) !important; cursor: grab; transition: box-shadow .12s; }
.playlist-item:active { cursor: grabbing; }
.playlist-item.sortable-ghost { opacity: .4; }
.playlist-item.sortable-chosen { box-shadow: var(--shadow-md); }

/* Módulo 06 — Playlists */
.pl-item { transition: background .12s; }
.pl-item:hover { background: var(--canvas); }
.pl-item-ghost { opacity: .35; background: var(--canvas) !important; border-radius: 6px; }
.pl-list-item:hover { background: rgba(0,0,0,.04) !important; }
.drag-handle { cursor: grab; }
.drag-handle:active { cursor: grabbing; }

.device-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }

/* Login */
.login-page {
  background: linear-gradient(135deg,
    rgba(212,58,47,.06) 0%,
    rgba(42,111,219,.06) 100%);
  min-height: 100vh;
}
.login-card { border-radius: var(--r-xl); animation: fadeInUp .4s ease; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Bootstrap Badge override */
.badge { font-size: .72rem; }

/* ─── 22. Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sb {
    display: none;
    position: fixed;
    left: 0; top: 0;
    z-index: 1000;
    height: 100vh;
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .sb.open { display: flex; }
  .filter-row--5 { grid-template-columns: 1fr 1fr; }
  .filter-row--5 > :last-child { grid-column: span 2; }
  .filter-row--4 { grid-template-columns: 1fr 1fr; }
  .page { padding: 16px 16px 40px; }
}

/* ─── Impersonation banner ────────────────────────────────── */
.alert-imp {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: color-mix(in oklab, var(--warn) 12%, var(--canvas));
  border-bottom: 1px solid color-mix(in oklab, var(--warn) 30%, transparent);
  font-size: 13px;
  color: var(--ink);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.alert-imp__icon { color: var(--warn); font-size: 14px; }
.alert-imp__stop {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--warn);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
}
.alert-imp__stop:hover { opacity: .85; color: #fff; }
