/* =====================================================================
   Dominican Upholstery — Módulo Equipo (control de horario, nómina, usuarios)
   Lo usan admin.html (pestañas nuevas) y equipo.html (app del equipo).
   CSS plano (sin Tailwind) para no depender de recompilar style.css.
   ===================================================================== */

:root {
  --tm-bg: #07070A;
  --tm-surface: #0C0C10;
  --tm-surface-2: #17171F;
  --tm-surface-3: #1F1F2A;
  --tm-line: rgba(212, 175, 55, 0.16);
  --tm-line-strong: rgba(212, 175, 55, 0.35);
  --tm-line-soft: rgba(255, 255, 255, 0.06);
  --tm-gold: #D4AF37;
  --tm-gold-hi: #F9DC7A;
  --tm-gold-mid: #EABF43;
  --tm-gold-lo: #B89228;
  --tm-text: #F5F1E8;
  --tm-text-2: #A8A5B0;
  --tm-text-3: #8E8B96;
  --tm-work: #D4AF37;
  --tm-live: #34D399;
  --tm-break: #4A4A5C;
  --tm-ot: #60A5FA;
  --tm-ot-text: #93C5FD;
  --tm-danger: #FB7185;
  --tm-danger-text: #FDA4AF;
  --tm-warn-text: #FDE68A;
  --tm-radius: 18px;
  --tm-ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Animaciones ---------- */
@keyframes tmFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes tmGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes tmGrowY { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes tmShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes tmPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } }
@keyframes tmPulseGold { 0%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, .5); } 70% { box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); } }
@keyframes tmSlideIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes tmSlideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes tmCollapse { to { opacity: 0; transform: translateX(24px); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; } }
@keyframes tmSpin { to { transform: rotate(360deg); } }
@keyframes tmPop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }

.tm-anim { animation: tmFadeUp .5s var(--tm-ease) both; }

@media (prefers-reduced-motion: reduce) {
  .tm-root *, .ap-root * { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ---------- Base de los módulos ---------- */
.tm-root { color: var(--tm-text); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; display: flex; flex-direction: column; gap: 20px; }
.tm-root *, .ap-root * { box-sizing: border-box; }
.tm-root button, .ap-root button, .tm-root input, .tm-root select, .tm-root textarea { font-family: inherit; }
.tm-serif { font-family: 'Playfair Display', Georgia, serif; }
.tm-muted { color: var(--tm-text-2); }
.tm-num { font-variant-numeric: tabular-nums; }
.tm-hidden { display: none !important; }
.tm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tm-card {
  background: var(--tm-surface);
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  padding: 20px 22px;
}
.tm-card-title { margin: 0; font-size: 15px; font-weight: 700; color: var(--tm-text); }
.tm-card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

.tm-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.tm-toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Botones ---------- */
.tm-btn {
  height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .035); color: var(--tm-text); font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  transition: transform .15s var(--tm-ease), background .2s, border-color .2s, box-shadow .2s, opacity .2s;
  white-space: nowrap;
}
.tm-btn:hover { border-color: var(--tm-line-strong); background: rgba(212, 175, 55, .08); }
.tm-btn:active { transform: scale(.97); }
.tm-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.tm-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.tm-btn-gold { border: 0; background: linear-gradient(135deg, var(--tm-gold-hi), var(--tm-gold) 55%, var(--tm-gold-lo)); color: #07070A; font-weight: 800; box-shadow: 0 8px 24px rgba(212, 175, 55, .22); }
.tm-btn-gold:hover { background: linear-gradient(135deg, #FFE699, var(--tm-gold-mid) 55%, var(--tm-gold)); box-shadow: 0 10px 30px rgba(212, 175, 55, .35); }
.tm-btn-ok { border: 0; background: var(--tm-live); color: #07070A; font-weight: 800; }
.tm-btn-ok:hover { background: #6EE7B7; }
.tm-btn-danger { border-color: rgba(251, 113, 133, .4); color: var(--tm-danger-text); background: rgba(251, 113, 133, .06); }
.tm-btn-danger:hover { border-color: rgba(251, 113, 133, .7); background: rgba(251, 113, 133, .14); }
.tm-btn-sm { height: 34px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.tm-btn-icon { width: 42px; padding: 0; }
.tm-btn-sm.tm-btn-icon { width: 34px; }

/* ---------- Chips / filtros ---------- */
.tm-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tm-chip {
  height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .08);
  background: var(--tm-surface); color: var(--tm-text); font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; transition: all .2s var(--tm-ease);
}
.tm-chip:hover { border-color: var(--tm-line-strong); }
.tm-chip[aria-pressed="true"] { border-color: rgba(212, 175, 55, .6); background: rgba(212, 175, 55, .12); color: var(--tm-gold-hi); }
.tm-chip .tm-dot { width: 8px; height: 8px; }
.tm-chip-count { font-size: 12px; font-weight: 800; opacity: .75; }

.tm-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tm-dot-working { background: var(--tm-live); animation: tmPulse 2s infinite; }
.tm-dot-overtime { background: var(--tm-ot); }
.tm-dot-break { background: var(--tm-gold-hi); }
.tm-dot-out { background: var(--tm-text-2); }
.tm-dot-free { background: #5A5866; }

.tm-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.tm-badge-gold { color: var(--tm-gold-hi); background: rgba(212, 175, 55, .12); border: 1px solid rgba(212, 175, 55, .3); }
.tm-badge-ok { color: #07070A; background: var(--tm-live); }
.tm-badge-warn { color: var(--tm-warn-text); background: rgba(249, 220, 122, .1); border: 1px solid rgba(249, 220, 122, .3); }
.tm-badge-danger { color: var(--tm-danger-text); background: rgba(251, 113, 133, .1); border: 1px solid rgba(251, 113, 133, .3); }
.tm-badge-blue { color: var(--tm-ot-text); background: rgba(96, 165, 250, .12); border: 1px solid rgba(96, 165, 250, .3); }
.tm-badge-mute { color: var(--tm-text-2); background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); }

/* ---------- KPIs ---------- */
.tm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tm-kpi {
  position: relative; overflow: hidden; background: var(--tm-surface); border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
  transition: transform .25s var(--tm-ease), border-color .25s;
  animation: tmFadeUp .55s var(--tm-ease) both;
}
.tm-kpi:hover { transform: translateY(-2px); border-color: var(--tm-line-strong); }
.tm-kpi-label { font-size: 12px; color: var(--tm-text-2); font-weight: 600; }
.tm-kpi-value { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tm-kpi-hint { font-size: 12px; color: var(--tm-text-2); }
.tm-kpi-feature { border-color: rgba(212, 175, 55, .35); background: radial-gradient(120% 120% at 100% 0%, rgba(212, 175, 55, .16), var(--tm-surface) 60%); }
.tm-kpi-feature .tm-kpi-value { font-family: 'Playfair Display', Georgia, serif; color: var(--tm-gold-hi); }

/* ---------- Línea de tiempo del día ---------- */
.tm-tl { position: relative; overflow-x: auto; padding-bottom: 4px; }
.tm-tl-inner { min-width: 780px; position: relative; }
.tm-tl-axis { position: relative; height: 22px; margin-left: 230px; margin-right: 86px; }
.tm-tl-axis span { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; color: var(--tm-text-3); white-space: nowrap; }
.tm-tl-rows { display: flex; flex-direction: column; gap: 4px; }
.tm-tl-row {
  display: flex; align-items: center; min-height: 54px; border-radius: 14px; padding: 4px 0;
  cursor: pointer; transition: background .2s; animation: tmFadeUp .5s var(--tm-ease) both; border: 0; background: transparent;
  width: 100%; color: inherit; text-align: left;
}
.tm-tl-row:hover, .tm-tl-row:focus-visible { background: rgba(212, 175, 55, .05); outline: none; }
.tm-tl-row.is-selected { background: rgba(212, 175, 55, .09); }
.tm-tl-person { width: 230px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding-left: 8px; min-width: 0; }
.tm-avatar {
  width: 36px; height: 36px; border-radius: 11px; background: var(--tm-surface-2); color: var(--tm-gold-hi);
  font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tm-avatar-lg { width: 50px; height: 50px; border-radius: 15px; font-size: 16px; background: linear-gradient(135deg, var(--tm-gold-hi), var(--tm-gold-lo)); color: #07070A; }
.tm-person-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-person-sub { font-size: 11px; display: flex; align-items: center; gap: 5px; }
.tm-tl-track {
  flex: 1; position: relative; height: 24px; border-radius: 7px;
  background-color: rgba(255, 255, 255, .015);
}
.tm-tl-grid { position: absolute; inset: 0; pointer-events: none; }
.tm-tl-grid i { position: absolute; top: -6px; bottom: -6px; width: 1px; background: rgba(255, 255, 255, .05); }
.tm-tl-total { width: 86px; text-align: right; padding-right: 10px; font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }

.tm-seg {
  position: absolute; top: 0; bottom: 0; border-radius: 7px; transform-origin: left center;
  animation: tmGrow .9s var(--tm-ease) both; transition: opacity .25s, filter .25s, transform .2s;
}
.tm-seg:hover { filter: brightness(1.18); transform: scaleY(1.25); z-index: 2; }
.tm-seg-work { background: linear-gradient(90deg, var(--tm-gold-lo), var(--tm-gold) 40%, var(--tm-gold-hi)); }
.tm-seg-ot { background: linear-gradient(90deg, #3B82F6, var(--tm-ot)); }
.tm-seg-break { background: repeating-linear-gradient(135deg, var(--tm-break) 0 6px, #3A3A48 6px 12px); }
.tm-seg-live { background: linear-gradient(90deg, #10B981, var(--tm-live), #A7F3D0, var(--tm-live), #10B981); background-size: 200% 100%; animation: tmGrow .9s var(--tm-ease) both, tmShimmer 3s linear infinite; }
.tm-seg-live.tm-seg-ot { background: linear-gradient(90deg, #2563EB, var(--tm-ot), #BFDBFE, var(--tm-ot), #2563EB); background-size: 200% 100%; }
.tm-seg-live::after {
  content: ''; position: absolute; right: -5px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%;
  background: #fff; animation: tmPulse 1.6s infinite;
}
.tm-seg.is-dim { opacity: .14; }

/* Turno de noche: violeta en la gráfica, franjas nocturnas sombreadas y una insignia junto al nombre */
.tm-seg-night { background: linear-gradient(90deg, #6D28D9, #8B5CF6 45%, #C4B5FD); box-shadow: 0 0 12px rgba(139, 92, 246, .35); }
.tm-seg-live.tm-seg-night { background: linear-gradient(90deg, #6D28D9, #8B5CF6, #DDD6FE, #8B5CF6, #6D28D9); background-size: 200% 100%; }
.tm-seg-moon {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font-size: 13px; line-height: 1;
  filter: drop-shadow(0 0 4px rgba(237, 233, 254, .9)); pointer-events: none;
}
.tm-seg-night.tm-seg-ot { background: linear-gradient(90deg, #6D28D9, #3B82F6); }
.tm-seg-carry { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.tm-tl-nightband { position: absolute; top: -6px; bottom: -6px; background: rgba(99, 102, 241, .07); border-radius: 4px; }
.tm-shift {
  display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .02em; line-height: 16px; white-space: nowrap;
}
.tm-shift-night { color: #DDD6FE; background: rgba(139, 92, 246, .2); border: 1px solid rgba(167, 139, 250, .45); }
.tm-shift-day { color: #FDE68A; background: rgba(212, 175, 55, .12); border: 1px solid rgba(212, 175, 55, .35); }
.tm-shift-lg { font-size: 11px; padding: 2px 9px; margin-left: 6px; }
.tm-next-day { font-size: 10px; font-weight: 800; color: #C4B5FD; }

/* App del empleado en turno de noche: el reloj y la tarjeta pasan a tonos violeta */
.ap-shift { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.ap-shift-night { color: #EDE9FE; background: rgba(139, 92, 246, .22); border: 1px solid rgba(167, 139, 250, .5); }
.ap-shift-day { color: #FDE68A; background: rgba(212, 175, 55, .14); border: 1px solid rgba(212, 175, 55, .4); }
.ap-clock-card.is-night { border-color: rgba(139, 92, 246, .4); background: radial-gradient(120% 90% at 50% 0%, rgba(139, 92, 246, .2), var(--tm-surface) 60%); }

.tm-now { position: absolute; top: 22px; bottom: 0; width: 2px; margin-left: -1px; background: var(--tm-danger); z-index: 3; pointer-events: none; transition: left 1s linear; }
.tm-now::before { content: attr(data-label); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: #07070A; background: var(--tm-danger); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.tm-now-wrap { position: absolute; top: 0; bottom: 0; left: 230px; right: 86px; pointer-events: none; }

.tm-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-legend button {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--tm-text-2); background: transparent;
  border: 1px solid transparent; border-radius: 999px; padding: 4px 10px; cursor: pointer; transition: all .2s;
}
.tm-legend button:hover { border-color: rgba(255, 255, 255, .1); color: var(--tm-text); }
.tm-legend button[aria-pressed="true"] { border-color: var(--tm-line-strong); color: var(--tm-text); background: rgba(212, 175, 55, .08); }
.tm-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.tm-tip {
  position: fixed; z-index: 400; pointer-events: none; background: #111118; border: 1px solid var(--tm-line-strong);
  border-radius: 12px; padding: 10px 12px; font-size: 12px; color: var(--tm-text); box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; max-width: 240px;
}
.tm-tip.is-on { opacity: 1; transform: none; }
.tm-tip strong { display: block; font-size: 13px; margin-bottom: 2px; }

/* ---------- Correcciones y alertas ---------- */
.tm-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.tm-list { display: flex; flex-direction: column; gap: 10px; }
.tm-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--tm-line-soft);
  animation: tmFadeUp .45s var(--tm-ease) both;
}
.tm-item.is-leaving { animation: tmCollapse .45s var(--tm-ease) forwards; overflow: hidden; }
.tm-item-body { flex: 1 1 200px; display: flex; flex-direction: column; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.tm-item-title { font-size: 13px; font-weight: 700; }
.tm-item-text { font-size: 12px; color: var(--tm-text-2); }
.tm-item-actions { display: flex; gap: 8px; }
.tm-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; animation: tmFadeUp .45s var(--tm-ease) both; cursor: pointer; transition: transform .2s; border: 1px solid; }
.tm-alert:hover { transform: translateX(3px); }
.tm-alert-danger { background: rgba(251, 113, 133, .06); border-color: rgba(251, 113, 133, .25); }
.tm-alert-blue { background: rgba(96, 165, 250, .06); border-color: rgba(96, 165, 250, .25); }
.tm-alert-gold { background: rgba(212, 175, 55, .06); border-color: rgba(212, 175, 55, .25); }
.tm-empty { padding: 26px 10px; text-align: center; font-size: 13px; color: var(--tm-text-2); }

/* ---------- Panel lateral (detalle) ---------- */
.tm-drawer-backdrop { position: fixed; inset: 0; z-index: 300; background: rgba(4, 4, 8, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s; }
.tm-drawer-backdrop.is-on { opacity: 1; }
.tm-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 310; width: min(440px, 100vw); background: var(--tm-surface);
  border-left: 1px solid var(--tm-line-strong); box-shadow: -30px 0 80px rgba(0, 0, 0, .6); overflow-y: auto;
  padding: 22px 22px calc(28px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 18px;
  animation: tmSlideIn .4s var(--tm-ease) both; color: var(--tm-text); font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.tm-drawer.is-closing { animation: tmSlideIn .3s var(--tm-ease) reverse forwards; }
.tm-drawer-head { display: flex; align-items: center; gap: 12px; }
.tm-stat-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tm-stat { border-radius: 14px; background: var(--tm-bg); border: 1px solid var(--tm-line-soft); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tm-stat span:first-child { font-size: 11px; color: var(--tm-text-2); }
.tm-stat span:last-child { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tm-section-label { font-size: 11px; font-weight: 700; color: var(--tm-text-2); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px; }

.tm-weekbars { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; align-items: end; height: 130px; }
.tm-weekbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; height: 100%; cursor: default; }
.tm-weekbar-col { width: 100%; max-width: 30px; border-radius: 8px; background: var(--tm-surface-3); position: relative; overflow: hidden; height: 90px; display: flex; flex-direction: column; justify-content: flex-end; }
.tm-weekbar-fill { width: 100%; border-radius: 8px; background: linear-gradient(180deg, var(--tm-gold-hi), var(--tm-gold-lo)); transform-origin: bottom; animation: tmGrowY .8s var(--tm-ease) both; }
.tm-weekbar-fill.is-ot { background: linear-gradient(180deg, #BFDBFE, var(--tm-ot)); }
.tm-weekbar small { font-size: 10px; color: var(--tm-text-2); font-variant-numeric: tabular-nums; }
.tm-weekbar b { font-size: 11px; color: var(--tm-text-2); }
.tm-weekbar.is-today b { color: var(--tm-gold-mid); }

.tm-kpis.is-stale { opacity: .45; }
.tm-schedule { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.ap-break-left { text-align: center; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--tm-gold-hi); }
.ap-break-left.is-over { color: var(--tm-danger-text); }
.ap-gate { justify-content: center; text-align: center; align-items: center; }
.ap-gate h1 { margin: 0; font-size: 22px; font-weight: 800; }
.ap-gate p { margin: 0; color: var(--tm-text-2); font-size: 14px; line-height: 1.5; max-width: 340px; }
.ap-gate .ap-big { width: 100%; max-width: 340px; }
.ap-gate-icon { width: 72px; height: 72px; border-radius: 22px; display: flex; align-items: center; justify-content: center; background: rgba(212, 175, 55, .12); color: var(--tm-gold-hi); }
.ap-gate-icon svg { width: 34px; height: 34px; }
.tm-np-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.tm-np-chips { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin: 8px 0 14px; }
.tm-np-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.tm-hist-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.tm-hist-range .tm-btn { grid-column: 1 / -1; }
[data-hist-body] { margin-top: 8px; }
.tm-hist-day { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; padding-bottom: 6px; border-bottom: 1px solid var(--tm-line); font-size: 12px; font-weight: 700; color: var(--tm-gold-hi); text-transform: capitalize; }
.tm-hist-day b { font-variant-numeric: tabular-nums; }
.tm-act { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--tm-line-soft); font-size: 13px; }
.tm-act > .tm-dot { margin-top: 5px; flex: none; }
.tm-act-body { flex: 1; min-width: 0; }
.tm-act-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tm-act-time { color: var(--tm-text-2); font-variant-numeric: tabular-nums; }
.tm-act-geo { margin-top: 4px; font-size: 12px; color: var(--tm-text-2); overflow-wrap: anywhere; }
.tm-act-geo a { color: #EABF43; }
.tm-entry { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--tm-line-soft); font-size: 13px; }
.tm-entry-time { width: 150px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tm-entry-meta { flex: 1; font-size: 12px; color: var(--tm-text-2); }

/* ---------- Modales ---------- */
.tm-modal-wrap { position: fixed; inset: 0; z-index: 320; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4, 4, 8, .7); backdrop-filter: blur(6px); animation: tmFadeUp .25s ease both; }
.tm-modal {
  width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; background: var(--tm-surface); border: 1px solid var(--tm-line-strong);
  border-radius: 22px; padding: 22px; color: var(--tm-text); font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .7); animation: tmPop .35s var(--tm-ease) both; display: flex; flex-direction: column; gap: 14px;
}
.tm-modal h3 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 22px; }
.tm-field { display: flex; flex-direction: column; gap: 6px; font-size: 11px; font-weight: 700; color: var(--tm-text-2); text-transform: uppercase; letter-spacing: .05em; }
.tm-input {
  height: 44px; width: 100%; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(212, 175, 55, .22);
  background: var(--tm-bg); color: var(--tm-text); font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: 0;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea.tm-input { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.tm-input:focus { border-color: var(--tm-gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .15); }
.tm-input:disabled { opacity: .55; }
.tm-input::-webkit-calendar-picker-indicator { filter: invert(.8); }
.tm-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tm-form-error { font-size: 12px; color: var(--tm-danger-text); min-height: 16px; }
.tm-modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* ---------- Nómina ---------- */
.tm-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tm-step { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--tm-line-soft); background: var(--tm-surface); color: var(--tm-text-2); font-size: 13px; font-weight: 700; transition: all .3s var(--tm-ease); }
.tm-step i { width: 26px; height: 26px; border-radius: 50%; background: var(--tm-surface-3); color: var(--tm-text-2); font-style: normal; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; transition: all .3s; }
.tm-step.is-done { color: var(--tm-text); }
.tm-step.is-done i { background: var(--tm-live); color: #07070A; }
.tm-step.is-current { color: var(--tm-text); border-color: rgba(212, 175, 55, .5); background: rgba(212, 175, 55, .08); }
.tm-step.is-current i { background: var(--tm-gold); color: #07070A; animation: tmPulseGold 2s infinite; }

.tm-pay-layout { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.tm-pay-main { flex: 999 1 640px; min-width: 0; padding: 0; overflow: hidden; }
.tm-pay-side { flex: 1 1 300px; position: sticky; top: 96px; }
.tm-table-wrap { overflow-x: auto; }
.tm-table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 13px; }
.tm-table th { text-align: left; color: var(--tm-text-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 14px 8px; font-weight: 700; }
.tm-table th.r, .tm-table td.r { text-align: right; }
.tm-table td { padding: 12px 8px; border-top: 1px solid var(--tm-line-soft); font-variant-numeric: tabular-nums; }
.tm-table th:first-child, .tm-table td:first-child { padding-left: 18px; }
.tm-table th:last-child, .tm-table td:last-child { padding-right: 18px; }
.tm-table tbody tr { cursor: pointer; transition: background .2s; animation: tmFadeUp .45s var(--tm-ease) both; }
.tm-table tbody tr:hover { background: rgba(212, 175, 55, .04); }
.tm-table tbody tr.is-selected { background: rgba(212, 175, 55, .08); box-shadow: inset 3px 0 0 var(--tm-gold); }
.tm-table tbody tr.is-paid-flash { animation: tmFadeUp .45s both, tmPaidFlash 1.4s ease; }
@keyframes tmPaidFlash { 0%, 100% { background: transparent; } 30% { background: rgba(52, 211, 153, .18); } }
.tm-check { width: 18px; height: 18px; accent-color: var(--tm-gold); cursor: pointer; }
.tm-check:disabled { opacity: .3; cursor: not-allowed; }
.tm-pay-footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 20px; border-top: 1px solid var(--tm-line); background: rgba(212, 175, 55, .04); }
.tm-breakdown { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.tm-breakdown > div { display: flex; justify-content: space-between; gap: 10px; }
.tm-breakdown-total { font-size: 17px; font-weight: 800; padding-top: 10px; border-top: 1px solid var(--tm-line-strong); }
.tm-adj { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--tm-line-soft); }
.tm-adj span:first-child { flex: 1; }
.tm-notice { font-size: 12px; border-radius: 12px; padding: 10px 12px; }
.tm-notice-warn { color: var(--tm-warn-text); background: rgba(249, 220, 122, .07); border: 1px solid rgba(249, 220, 122, .28); }
.tm-notice-info { color: var(--tm-text-2); background: rgba(255, 255, 255, .03); border: 1px solid var(--tm-line-soft); }
.tm-history { display: flex; flex-direction: column; gap: 8px; }
.tm-history button { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--tm-line-soft); background: transparent; color: var(--tm-text); cursor: pointer; font-size: 13px; transition: border-color .2s; }
.tm-history button:hover { border-color: var(--tm-line-strong); }

/* ---------- Usuarios ---------- */
.tm-users-layout { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.tm-users-list { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-user-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid rgba(212, 175, 55, .12);
  background: var(--tm-surface); color: var(--tm-text); cursor: pointer; text-align: left; width: 100%;
  transition: all .2s var(--tm-ease); animation: tmFadeUp .45s var(--tm-ease) both;
}
.tm-user-row:hover { border-color: var(--tm-line-strong); transform: translateX(2px); }
.tm-user-row.is-selected { border-color: rgba(212, 175, 55, .55); background: rgba(212, 175, 55, .08); }
.tm-user-row.is-inactive { opacity: .5; }
.tm-user-editor { flex: 2 1 540px; min-width: 0; display: flex; flex-direction: column; gap: 18px; animation: tmFadeUp .4s var(--tm-ease) both; }
.tm-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tm-role {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .08); background: transparent; color: var(--tm-text); cursor: pointer; text-align: left; transition: all .2s var(--tm-ease);
}
.tm-role:hover:not(:disabled) { border-color: var(--tm-line-strong); }
.tm-role:disabled { opacity: .4; cursor: not-allowed; }
.tm-role strong { font-size: 13px; }
.tm-role small { font-size: 11px; color: var(--tm-text-2); }
.tm-role[aria-checked="true"] { border-color: currentColor; background: rgba(255, 255, 255, .04); }
.tm-role-super[aria-checked="true"] { color: var(--tm-gold-hi); }
.tm-role-admin[aria-checked="true"] { color: #C4B5FD; }
.tm-role-sales[aria-checked="true"] { color: var(--tm-ot-text); }
.tm-role-employee[aria-checked="true"] { color: #6EE7B7; }
.tm-perms { border-radius: 14px; border: 1px solid var(--tm-line-soft); overflow: hidden; }
.tm-perm { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, .04); font-size: 13px; transition: background .3s; }
.tm-perm:first-child { border-top: 0; }
.tm-perm:nth-child(even) { background: rgba(255, 255, 255, .015); }
.tm-perm.is-none { color: var(--tm-text-3); }
.tm-perm .tm-level { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; min-width: 64px; text-align: center; transition: all .3s; }
.tm-level-total { color: #07070A; background: var(--tm-gold); }
.tm-level-edit { color: var(--tm-gold-hi); background: rgba(212, 175, 55, .14); }
.tm-level-view { color: var(--tm-ot-text); background: rgba(96, 165, 250, .14); }
.tm-level-none { color: var(--tm-text-3); background: rgba(255, 255, 255, .04); }
.tm-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; cursor: pointer; }
.tm-switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--tm-surface-3); position: relative; cursor: pointer; transition: background .25s; border: 1px solid rgba(255, 255, 255, .1); margin: 0; }
.tm-switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s var(--tm-ease); }
.tm-switch input:checked { background: var(--tm-live); }
.tm-switch input:checked::after { transform: translateX(18px); }

.tm-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--tm-text-2); font-size: 13px; }
.tm-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(212, 175, 55, .25); border-top-color: var(--tm-gold); animation: tmSpin .8s linear infinite; }
.tm-refresh-note { font-size: 12px; color: var(--tm-text-3); display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Menú lateral del admin: riel de iconos que se expande ----------
   Con ratón se abre al pasar por encima. En pantallas táctiles (iPad) se abre y cierra con el botón
   «Menú» del riel (body.tm-touch / body.tm-rail-open), porque ahí el :hover se queda pegado.
   Cada disparador va en su propia regla: un Safari antiguo que no entiende :has() descarta la regla
   entera donde aparece, y si :hover compartiera regla con él el menú no se abriría nunca. */
.tm-rail-toggle, #tm-rail-backdrop { display: none; }
@media (min-width: 1024px) {
  #sidebar-menu {
    width: 76px !important; transform: none !important; overflow-x: hidden; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: width .32s var(--tm-ease), box-shadow .32s !important;
  }
  body:not(.tm-touch) #sidebar-menu:hover,
  body.tm-rail-open #sidebar-menu { width: 16rem !important; box-shadow: 30px 0 80px rgba(0, 0, 0, .6); }
  #sidebar-menu:has(:focus-visible) { width: 16rem !important; box-shadow: 30px 0 80px rgba(0, 0, 0, .6); }
  #admin-content-wrapper { padding-left: 76px !important; transition: none !important; }
  #sidebar-menu nav button { white-space: nowrap; }
  #sidebar-menu nav > div,
  #sidebar-menu nav button span,
  #sidebar-menu .tm-rail-text,
  #sidebar-user-card > div:not(#sidebar-user-avatar) {
    opacity: 0; transition: opacity .15s;
  }
  body:not(.tm-touch) #sidebar-menu:hover nav > div,
  body:not(.tm-touch) #sidebar-menu:hover nav button span,
  body:not(.tm-touch) #sidebar-menu:hover .tm-rail-text,
  body:not(.tm-touch) #sidebar-menu:hover #sidebar-user-card > div,
  body.tm-rail-open #sidebar-menu nav > div,
  body.tm-rail-open #sidebar-menu nav button span,
  body.tm-rail-open #sidebar-menu .tm-rail-text,
  body.tm-rail-open #sidebar-user-card > div {
    opacity: 1; transition: opacity .25s .1s;
  }
  #sidebar-menu:has(:focus-visible) nav > div,
  #sidebar-menu:has(:focus-visible) nav button span,
  #sidebar-menu:has(:focus-visible) .tm-rail-text,
  #sidebar-menu:has(:focus-visible) #sidebar-user-card > div {
    opacity: 1; transition: opacity .25s .1s;
  }
  #sidebar-expand-btn, .tm-desktop-collapse-btn { display: none !important; }
  body.tm-touch .tm-rail-toggle { display: flex; }
  body.tm-rail-open #tm-rail-backdrop { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 45; background: rgba(2, 6, 23, .55); }
}

/* =====================================================================
   App del equipo (equipo.html)
   ===================================================================== */
.ap-body { margin: 0; background: var(--tm-bg); color: var(--tm-text); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; min-height: 100vh; min-height: 100dvh; }
.ap-root { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
.ap-screen { flex: 1; padding: calc(16px + env(safe-area-inset-top, 0px)) 18px calc(110px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; animation: tmFadeUp .4s var(--tm-ease) both; }
.ap-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ap-hello { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ap-hello small { display: block; font-size: 12px; color: var(--tm-text-2); }
.ap-hello strong { display: block; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-title { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 27px; font-weight: 700; }

.ap-clock-card {
  border-radius: 26px; border: 1px solid rgba(212, 175, 55, .22); padding: 22px 20px 20px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(212, 175, 55, .14), var(--tm-surface) 60%);
  display: flex; flex-direction: column; align-items: center; gap: 12px; position: relative; overflow: hidden;
}
.ap-ring { position: relative; width: 220px; height: 220px; }
.ap-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ap-ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ap-ring .ap-ring-bg { stroke: var(--tm-surface-3); }
.ap-ring .ap-ring-fg { stroke: url(#apRingGrad); transition: stroke-dashoffset 1s var(--tm-ease); }
.ap-ring .ap-ring-ot { stroke: var(--tm-ot); transition: stroke-dashoffset 1s var(--tm-ease); }
.ap-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.ap-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.ap-timer { font-family: 'Playfair Display', Georgia, serif; font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.ap-sub { font-size: 12px; color: var(--tm-text-2); text-align: center; }
.ap-week { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.ap-week-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--tm-text-2); }
.ap-bar { height: 10px; border-radius: 999px; background: var(--tm-surface-3); overflow: hidden; display: flex; }
.ap-bar i { display: block; height: 100%; transition: width 1s var(--tm-ease); }

.ap-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ap-actions.is-single { grid-template-columns: 1fr; }
.ap-big {
  height: 66px; border-radius: 20px; font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; border: 1px solid transparent; transition: transform .15s var(--tm-ease), box-shadow .2s, opacity .2s; touch-action: manipulation;
}
.ap-big:active { transform: scale(.97); }
.ap-big:disabled { opacity: .5; cursor: wait; }
.ap-big svg { width: 22px; height: 22px; }
.ap-big-gold { border: 0; background: linear-gradient(135deg, var(--tm-gold-hi), var(--tm-gold) 55%, var(--tm-gold-lo)); color: #07070A; box-shadow: 0 12px 30px rgba(212, 175, 55, .28); }
.ap-big-soft { border-color: rgba(212, 175, 55, .35); background: rgba(212, 175, 55, .08); color: var(--tm-gold-hi); }
.ap-big-danger { border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .1); color: var(--tm-danger-text); }
.ap-geo { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--tm-text-2); text-align: center; }

.ap-card { border-radius: 20px; border: 1px solid var(--tm-line); background: var(--tm-surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.ap-card h2 { margin: 0; font-size: 14px; font-weight: 700; }
.ap-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ap-link { background: none; border: 0; color: var(--tm-gold-mid); font-weight: 700; font-size: 12px; cursor: pointer; padding: 6px 0; }
.ap-event { display: flex; align-items: center; gap: 12px; font-size: 13px; animation: tmFadeUp .4s var(--tm-ease) both; }
.ap-event span:nth-child(2) { flex: 1; }
.ap-event span:last-child { color: var(--tm-text-2); font-variant-numeric: tabular-nums; }
.ap-warn { border-radius: 16px; padding: 12px 14px; font-size: 13px; color: var(--tm-warn-text); background: rgba(249, 220, 122, .07); border: 1px solid rgba(249, 220, 122, .3); }

.ap-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; border-radius: 14px; background: var(--tm-surface); border: 1px solid rgba(212, 175, 55, .14); }
.ap-tabs button { height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--tm-text-2); font-size: 13px; font-weight: 700; cursor: pointer; transition: all .25s var(--tm-ease); }
.ap-tabs button[aria-selected="true"] { background: var(--tm-gold); color: #07070A; }
.ap-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ap-total { border-radius: 16px; background: var(--tm-surface); border: 1px solid var(--tm-line); padding: 12px; display: flex; flex-direction: column; gap: 4px; animation: tmFadeUp .45s var(--tm-ease) both; }
.ap-total span { font-size: 11px; color: var(--tm-text-2); }
.ap-total strong { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ap-chart { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; height: 160px; align-items: end; }
.ap-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.ap-day-col { width: 100%; max-width: 32px; height: 112px; border-radius: 9px; background: var(--tm-surface-2); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.ap-day-col i { display: block; width: 100%; transform-origin: bottom; animation: tmGrowY .9s var(--tm-ease) both; }
.ap-day small { font-size: 10px; color: var(--tm-text-2); font-variant-numeric: tabular-nums; }
.ap-day b { font-size: 11px; color: var(--tm-text-2); }
.ap-day.is-today b { color: var(--tm-gold-mid); }
.ap-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--tm-line-soft); animation: tmFadeUp .4s var(--tm-ease) both; }
.ap-row:last-child { border-bottom: 0; }
.ap-date { width: 42px; display: flex; flex-direction: column; align-items: center; }
.ap-date small { font-size: 10px; color: var(--tm-text-2); text-transform: uppercase; }
.ap-date strong { font-size: 16px; }
.ap-row-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-row-body span:first-child { font-size: 13px; font-weight: 600; }
.ap-row-body span:last-child { font-size: 11px; color: var(--tm-text-2); }
.ap-pay-hero { border-radius: 20px; border: 1px solid rgba(212, 175, 55, .3); background: radial-gradient(120% 100% at 100% 0%, rgba(212, 175, 55, .16), var(--tm-surface) 60%); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.ap-pay-hero strong { font-family: 'Playfair Display', Georgia, serif; font-size: 36px; }

.ap-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: 520px; margin: 0 auto;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); background: rgba(12, 12, 16, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--tm-line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
}
.ap-nav button { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: none; border: 0; color: var(--tm-text-2); font-size: 11px; font-weight: 600; cursor: pointer; transition: color .2s; }
.ap-nav button svg { width: 22px; height: 22px; transition: transform .25s var(--tm-ease); }
.ap-nav button[aria-current="page"] { color: var(--tm-gold-mid); font-weight: 800; }
.ap-nav button[aria-current="page"] svg { transform: translateY(-2px); }

/* Acceso */
.ap-login { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: calc(20px + env(safe-area-inset-top, 0px)) 22px calc(24px + env(safe-area-inset-bottom, 0px)); background: radial-gradient(90% 45% at 50% 0%, rgba(212, 175, 55, .16), var(--tm-bg) 70%); }
.ap-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ap-brand img { width: 84px; height: 84px; object-fit: contain; filter: drop-shadow(0 8px 30px rgba(212, 175, 55, .35)); }
.ap-brand h1 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 25px; }
.ap-brand span { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--tm-gold-mid); font-weight: 700; }
.ap-install { display: flex; align-items: center; gap: 12px; border-radius: 18px; border: 1px solid rgba(212, 175, 55, .28); background: rgba(12, 12, 16, .9); padding: 12px 12px 12px 14px; animation: tmFadeUp .5s var(--tm-ease) both; }
.ap-install div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ap-install strong { font-size: 13px; }
.ap-install small { font-size: 11px; color: var(--tm-text-2); }
.ap-dots { display: flex; justify-content: center; gap: 16px; }
.ap-dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(212, 175, 55, .45); transition: all .2s var(--tm-ease); }
.ap-dots i.is-on { background: var(--tm-gold); border-color: var(--tm-gold); transform: scale(1.12); }
.ap-dots.is-error { animation: apShake .4s; }
.ap-dots.is-error i { border-color: var(--tm-danger); }
@keyframes apShake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.ap-keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ap-key { height: 62px; border-radius: 18px; border: 1px solid rgba(212, 175, 55, .14); background: rgba(255, 255, 255, .035); color: var(--tm-text); font-size: 23px; font-weight: 600; cursor: pointer; transition: transform .1s, background .2s; touch-action: manipulation; display: flex; align-items: center; justify-content: center; }
.ap-key:active { transform: scale(.94); background: rgba(212, 175, 55, .14); }
.ap-key svg { width: 22px; height: 22px; }
.ap-foot { margin-top: auto; text-align: center; font-size: 11px; color: var(--tm-text-2); display: flex; flex-direction: column; gap: 6px; align-items: center; }

/* Hoja inferior (formularios en móvil) */
.ap-sheet-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(4, 4, 8, .65); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center; animation: tmFadeUp .2s ease both; }
.ap-sheet { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; background: var(--tm-surface); border-top: 1px solid var(--tm-line-strong); border-radius: 24px 24px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; animation: tmSlideUp .35s var(--tm-ease) both; }
.ap-sheet h3 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 22px; }
.ap-grip { width: 44px; height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .2); margin: -6px auto 4px; }

.ap-toast { position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); z-index: 200; max-width: calc(100vw - 32px); background: #15151C; border: 1px solid var(--tm-line-strong); color: var(--tm-text); border-radius: 14px; padding: 12px 16px; font-size: 13px; font-weight: 600; box-shadow: 0 20px 50px rgba(0, 0, 0, .6); animation: tmFadeUp .3s var(--tm-ease) both; }
.ap-toast.is-error { border-color: rgba(251, 113, 133, .5); color: var(--tm-danger-text); }

/* Refrescos en vivo: sin repetir la animación de entrada */
.tm-static .tm-seg, .tm-static .tm-tl-row { animation: none; }
.tm-static .tm-seg-live { animation: tmShimmer 3s linear infinite; }

/* App del super administrador */
.ap-nav button { position: relative; }
.ap-nav-count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--tm-danger); color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center; }
.ap-sup-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ap-sup-kpi { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 16px; background: var(--tm-surface); border: 1px solid var(--tm-line); }
.ap-sup-kpi strong { font-size: 22px; }
.ap-sup-kpi span { font-size: 11px; color: var(--tm-text-2); }
.ap-sup-link { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.ap-sup-person { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 0; background: none; border: 0; border-top: 1px solid var(--tm-line-soft); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ap-sup-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ap-sup-line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.ap-sup-status { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.ap-sup-bar { position: relative; display: block; height: 7px; border-radius: 4px; background: var(--tm-surface-3); overflow: hidden; }
.ap-sup-seg { position: absolute; top: 0; bottom: 0; background: var(--tm-work); }
.ap-sup-seg.is-live { background: var(--tm-live); }
.ap-sup-seg.is-break { background: var(--tm-break); }
.ap-sup-alert { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--tm-line-soft); }
.ap-sup-alert.is-column { flex-direction: column; align-items: stretch; }
.ap-sup-alert > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12px; color: var(--tm-text-2); }
.ap-sup-alert strong { font-size: 14px; color: var(--tm-text); }
.ap-sup-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ap-sup-event { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--tm-line-soft); font-size: 12px; color: var(--tm-text-2); }
.ap-sup-event > span:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-sup-event strong { font-size: 13px; color: var(--tm-text); }
.ap-sup-event small { font-size: 12px; }
.ap-sup-event.is-bad small { color: var(--tm-danger-text); }
.ap-sup-event > span:last-child, .ap-sup-event > strong:last-child { flex: none; }
.ap-sup-scroll { max-height: 50vh; overflow-y: auto; }

/* ---------- Reloj del equipo (admin.html) ---------- */
.tm-rl-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(212, 175, 55, .14), transparent 60%), var(--tm-surface); }
.tm-rl-clock { display: flex; flex-direction: column; gap: 4px; }
.tm-rl-time { font-family: 'Playfair Display', serif; font-size: clamp(36px, 5vw, 56px); line-height: 1; color: var(--tm-gold-hi); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.tm-rl-date { font-size: 13px; color: var(--tm-text-2); text-transform: capitalize; }
.tm-rl-kpis { display: grid; grid-template-columns: repeat(5, minmax(96px, 1fr)); gap: 10px; flex: 1; max-width: 720px; }
.tm-rl-kpi { background: var(--tm-surface-2); border: 1px solid var(--tm-line-soft); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.tm-rl-kpi span { font-size: 11px; color: var(--tm-text-3); line-height: 1.25; }
.tm-rl-kpi b { font-size: 24px; font-variant-numeric: tabular-nums; }
.tm-rl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.tm-rl-person { background: var(--tm-surface-2); border: 1px solid var(--tm-line-soft); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; animation: tmFadeUp .45s var(--tm-ease) both; }
.tm-rl-person.has-issues { border-color: rgba(251, 113, 133, .45); box-shadow: inset 3px 0 0 var(--tm-danger); }
.tm-rl-person.is-selected { border-color: var(--tm-line-strong); }
.tm-rl-person header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tm-rl-person header > div { flex: 1 1 140px; display: flex; flex-direction: column; min-width: 0; }
.tm-rl-person footer { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.tm-rl-pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.tm-rl-pill { border-radius: 10px; padding: 6px 8px; font-size: 12px; font-weight: 600; display: flex; flex-direction: column; gap: 2px; background: var(--tm-surface-3); color: var(--tm-text-2); }
.tm-rl-pill small { font-size: 10px; font-weight: 500; opacity: .75; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.tm-rl-pill.is-ok { background: rgba(52, 211, 153, .12); color: #6EE7B7; }
.tm-rl-pill.is-bad { background: rgba(251, 113, 133, .14); color: var(--tm-danger-text); }
.tm-rl-pill.is-warn { background: rgba(253, 230, 138, .1); color: var(--tm-warn-text); }
.tm-rl-line { margin: 0; font-size: 12px; color: var(--tm-text-2); line-height: 1.45; }
.tm-rl-issues { margin: 0; padding: 8px 10px 8px 26px; border-radius: 10px; background: rgba(251, 113, 133, .08); color: var(--tm-danger-text); font-size: 12px; line-height: 1.5; }
.tm-rl-feed { display: flex; flex-direction: column; max-height: 560px; overflow-y: auto; }
.tm-rl-ev { display: grid; grid-template-columns: 72px 10px 1fr; align-items: baseline; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--tm-line-soft); font-size: 13px; }
.tm-rl-ev:last-child { border-bottom: 0; }
.tm-rl-ev-time { color: var(--tm-text-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.tm-rl-ev small { display: block; color: var(--tm-text-3); font-size: 12px; margin-top: 2px; }
@media (max-width: 760px) {
  .tm-rl-kpis { grid-template-columns: repeat(2, 1fr); }
  .tm-rl-ev { grid-template-columns: 62px 10px 1fr; }
}

/* Intentos de fichaje rechazados, resumidos (correcciones del panel y de la app super) */
.tm-blocked { margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: rgba(251, 113, 133, .07); border: 1px solid rgba(251, 113, 133, .2); font-size: 12px; color: var(--tm-danger-text); min-width: 0; }
.tm-blocked ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tm-blocked li { line-height: 1.4; }
.tm-blocked li b { font-weight: 700; }
.tm-blocked li span { display: block; color: var(--tm-text-3); }
.tm-blocked details { margin-top: 6px; }
.tm-blocked summary { cursor: pointer; color: var(--tm-text-2); font-weight: 600; width: max-content; max-width: 100%; }
.tm-blocked details p { margin: 6px 0 0; color: var(--tm-text-3); line-height: 1.6; max-height: 120px; overflow-y: auto; }

/* Botón con texto largo: se parte en dos líneas en pantallas estrechas en lugar de salirse */
.tm-btn-wrap { height: auto; min-height: 42px; padding-top: 8px; padding-bottom: 8px; white-space: normal; text-align: center; line-height: 1.25; }

/* Correcciones y Reloj en móvil */
@media (max-width: 560px) {
  .tm-two { grid-template-columns: minmax(0, 1fr); }
  .tm-item { padding: 12px; }
  .tm-item-actions { width: 100%; }
  .tm-item-actions .tm-btn { flex: 1; }
  .tm-toolbar-group:has(.tm-btn-wrap) { width: 100%; }
  .tm-btn-wrap { width: 100%; }
  .tm-rl-hero { flex-direction: column; align-items: stretch; }
  .tm-rl-person footer .tm-btn { flex: 1; }
}
.tm-rl-person, .tm-rl-ev > div, .tm-rl-line { min-width: 0; overflow-wrap: break-word; }

/* ---------- Rendimiento en el perfil (equipo.html) ---------- */
.ap-perf { gap: 12px; }
.ap-perf-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--tm-surface-2); }
.ap-perf-tabs button { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--tm-text-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ap-perf-tabs button[aria-pressed="true"] { background: var(--tm-surface-3); color: var(--tm-gold-hi); }
.ap-perf-hero { border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--tm-text-2); }
.ap-perf-hero strong { font-size: 18px; color: var(--tm-text); }
.ap-perf-hero.is-bad { background: rgba(251, 113, 133, .08); border: 1px solid rgba(251, 113, 133, .25); }
.ap-perf-hero.is-bad strong { font-size: 30px; color: var(--tm-danger-text); line-height: 1.1; }
.ap-perf-hero.is-ok { background: rgba(52, 211, 153, .08); border: 1px solid rgba(52, 211, 153, .25); }
.ap-perf-hero.is-ok strong { color: #6EE7B7; }
.ap-perf-bar { height: 8px; border-radius: 999px; background: rgba(251, 113, 133, .18); overflow: hidden; }
.ap-perf-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #34D399, #6EE7B7); transform-origin: left; animation: tmGrow .8s var(--tm-ease) both; }
.ap-perf-small { font-size: 12px; color: var(--tm-text-3); }
.ap-perf-rows { display: flex; flex-direction: column; }
.ap-perf-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--tm-line-soft); font-size: 13px; }
.ap-perf-row:first-child { border-top: 0; }
.ap-perf-row span { display: flex; flex-direction: column; min-width: 0; }
.ap-perf-row small { font-size: 11px; color: var(--tm-text-3); }
.ap-perf-row b { white-space: nowrap; color: var(--tm-text-3); }
.ap-perf-row.is-minus b { color: var(--tm-danger-text); }
.ap-perf-row.is-plus b { color: #6EE7B7; }
.ap-perf-tip { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; background: rgba(212, 175, 55, .08); border: 1px solid rgba(212, 175, 55, .25); font-size: 12px; color: var(--tm-text-2); line-height: 1.45; }
.ap-perf-tip strong { color: var(--tm-gold-hi); font-size: 13px; }
.ap-perf-days summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--tm-gold-mid); padding: 4px 0; }
.ap-perf-day { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--tm-line-soft); font-size: 12px; }
.ap-perf-day b { color: var(--tm-text); }
.ap-perf-day > div { display: flex; flex-direction: column; gap: 3px; overflow-wrap: break-word; }
.ap-perf-day .is-minus { color: var(--tm-danger-text); }
.ap-perf-day .is-plus { color: #6EE7B7; }
.ap-perf-day .is-ok { color: var(--tm-text-2); }
.ap-perf-note { margin: 0; font-size: 11px; color: var(--tm-text-3); line-height: 1.45; }

/* ---------- Pantalla de sincronización al abrir o volver a la app (equipo.html) ---------- */
.ap-sync { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 24px; padding-top: calc(24px + env(safe-area-inset-top, 0px)); background: radial-gradient(120% 80% at 50% 0%, rgba(212, 175, 55, .10), transparent 60%), var(--tm-bg); color: var(--tm-text); font-family: 'Plus Jakarta Sans', system-ui, sans-serif; transition: opacity .35s var(--tm-ease), visibility .35s; }
.ap-sync.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.ap-sync-card { width: min(340px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; animation: tmFadeUp .4s var(--tm-ease) both; }
.ap-sync-logo { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.ap-sync-logo img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 12px 34px rgba(0, 0, 0, .55); }
.ap-sync-logo::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid rgba(212, 175, 55, .14); border-top-color: var(--tm-gold); animation: tmSpin 1s linear infinite; }
.ap-sync.is-ok .ap-sync-logo::before { animation: none; border-color: var(--tm-live); }
.ap-sync.is-error .ap-sync-logo::before { animation: none; border-color: rgba(251, 113, 133, .6); }
.ap-sync-title { margin: 6px 0 0; font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 700; }
.ap-sync-sub { margin: 0; color: var(--tm-text-2); font-size: 13px; line-height: 1.5; }
.ap-sync-list { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.ap-sync-list li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--tm-surface); border: 1px solid var(--tm-line-soft); font-size: 13px; font-weight: 600; color: var(--tm-text-2); transition: color .3s, border-color .3s; }
.ap-sync-list li::before { content: ''; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid rgba(212, 175, 55, .25); border-top-color: var(--tm-gold); animation: tmSpin .9s linear infinite; }
.ap-sync-list li.is-ok { color: var(--tm-text); border-color: rgba(52, 211, 153, .3); }
.ap-sync-list li.is-ok::before { animation: none; border: 0; background: var(--tm-live) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2307070A' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 10px no-repeat; }
.ap-sync.is-error .ap-sync-list li::before { animation: none; border-color: rgba(251, 113, 133, .5); }
.ap-sync-bar { width: 100%; height: 4px; border-radius: 4px; background: var(--tm-surface-3); overflow: hidden; }
.ap-sync-bar span { display: block; height: 100%; width: 40%; border-radius: 4px; background: linear-gradient(90deg, var(--tm-gold-lo), var(--tm-gold-hi)); animation: apSyncBar 1.2s ease-in-out infinite; }
.ap-sync.is-ok .ap-sync-bar span { width: 100%; animation: none; background: var(--tm-live); transition: width .3s; }
.ap-sync.is-error .ap-sync-bar span { width: 100%; animation: none; background: rgba(251, 113, 133, .6); }
.ap-sync-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px; }
.ap-sync-actions[hidden] { display: none; }
.ap-sync-skip { background: none; border: 0; color: var(--tm-text-2); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; padding: 8px; cursor: pointer; }
@keyframes apSyncBar { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .ap-sync-logo::before, .ap-sync-list li::before, .ap-sync-bar span { animation-duration: 3s; } }
