/* Retaill · Gestión — tema corporativo minimalista */

:root {
  --ink: #141414;
  --ink-soft: #3d3d40;
  --muted: #6f6f75;
  --line: #e6e6e9;
  --line-strong: #d4d4d8;
  --bg: #f3f3f5;
  --bg-soft: #fafafa;
  --card: #ffffff;
  --accent: #141414;
  --accent-hover: #2c2c2e;
  --success: #1b7a45;
  --warning: #c05621;
  --error: #c53030;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 24px rgba(20, 20, 20, 0.04);
  --shadow-lg: 0 16px 48px rgba(20, 20, 20, 0.12);
  --sidebar-w: 248px;
  --ease: 160ms ease;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink-soft);
  min-height: 100vh;
  line-height: 1.5;
}

button,
input,
select {
  font-family: inherit;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* Lucide */
[data-lucide],
svg.lucide {
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 1.75;
  flex-shrink: 0;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 20;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.menu-toggle,
.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.menu-toggle:hover,
.sidebar-close:hover {
  background: var(--bg);
}

.sidebar-backdrop {
  display: none;
}

.sidebar-header .logo-img {
  height: 78px;
  width: auto;
  object-fit: contain;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.logo-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 0.15rem;
}

.sidebar-nav {
  flex: 1;
  padding: 0.25rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-item[hidden] {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background var(--ease), color var(--ease);
}

.nav-item:hover {
  color: var(--ink);
  background: var(--bg);
}

.nav-item.active {
  color: #fff;
  background: var(--ink);
}

.nav-icon {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--ink);
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-icon svg {
  width: 1rem;
  height: 1rem;
}

/* Main */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2rem 2.25rem 3rem;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.page-header h1 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.95rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.stat-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.stat-value {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-in {
  background: linear-gradient(180deg, #eef8f2, #ffffff);
  border-color: #d4ebdc;
}
.stat-in::before { background: #3d9a68; }
.stat-in .stat-icon { background: #d8f0e3; color: #2a7a4d; }
.stat-in .stat-value { color: #1f6b42; }

.stat-out {
  background: linear-gradient(180deg, #fff4ec, #ffffff);
  border-color: #f0d8c6;
}
.stat-out::before { background: #e07a3d; }
.stat-out .stat-icon { background: #fde4d2; color: #c25a20; }
.stat-out .stat-value { color: #b44e18; }

.stat-store {
  background: linear-gradient(180deg, #f4f0fb, #ffffff);
  border-color: #ddd4ef;
}
.stat-store::before { background: #7a5cb8; }
.stat-store .stat-icon { background: #e8e0f7; color: #5e4494; }
.stat-store .stat-value { color: #53408a; }

.stat-people {
  background: linear-gradient(180deg, #eef6fb, #ffffff);
  border-color: #cfe0ee;
}
.stat-people::before { background: #3d86b3; }
.stat-people .stat-icon { background: #d7ebf6; color: #2b6f96; }
.stat-people .stat-value { color: #245e80; }

.stat-holiday {
  background: linear-gradient(180deg, #fff8ec, #ffffff);
  border-color: #f0e2c2;
}
.stat-holiday::before { background: #c4922a; }
.stat-holiday .stat-icon { background: #f8edd4; color: #8d6816; }
.stat-holiday .stat-value { color: #7a5a12; }

.config-nota {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 1rem;
}

.config-estado {
  min-height: 1.2rem;
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.cal-leyenda {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.cal-leyenda span,
.cal-muestra {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.cal-muestra {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 4px;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.month-cal h3 {
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
}

.cal-dow {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.cal-day {
  aspect-ratio: 1;
  border: none;
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.cal-day:hover {
  background: var(--line);
}

.cal-day.is-empty {
  visibility: hidden;
  pointer-events: none;
}

.cal-day.is-feriado,
.cal-muestra.is-feriado {
  background: #fde8e6;
  color: #9b2c2c;
}

.cal-day.is-nolaboral,
.cal-muestra.is-nolaboral {
  background: #e8e0f7;
  color: #5e4494;
}

.metric-pill {
  display: inline-flex;
  min-width: 1.75rem;
  justify-content: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.metric-ok {
  background: #e5f6ec;
  color: #1f6b42;
}

.metric-late {
  background: #fde8e6;
  color: #b42318;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.card h2,
.card h3,
.card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.card h2 {
  margin-bottom: 1rem;
}

.card-header p {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.35rem 0 1.15rem;
}

.card-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-header-actions h2,
.card-header-actions h3 {
  margin: 0;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.data-table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-soft);
}

.data-table th.th-group {
  text-align: center;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  vertical-align: middle;
}

.data-table th[rowspan="2"] {
  vertical-align: bottom;
}

.ajuste-marca {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: #f3e6c8;
  color: #7a5b16;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.ranking-grupos {
  display: grid;
  gap: 1rem;
}

.ranking-grupos h4 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ranking-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 0.7rem;
}

.ranking-nota {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.45;
}

#ranking-restaurar {
  margin-right: auto;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 1rem;
}

.th-tip {
  cursor: help;
  position: relative;
}

.th-tip span {
  border-bottom: 1px dotted currentColor;
}

.th-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
  background: var(--ink);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  white-space: nowrap;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 8;
}

.th-tip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 8;
}

.th-tip:hover::after,
.th-tip:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background var(--ease), color var(--ease);
}

.data-table th.sortable:hover {
  background: var(--bg);
  color: var(--ink);
}

.data-table th.sortable.active-sort {
  color: var(--ink);
  background: var(--bg);
}

.sort-icon {
  display: inline-flex;
  margin-left: 4px;
  opacity: 0.35;
  vertical-align: middle;
}

.sort-icon svg,
th .sort-icon,
th svg.lucide {
  width: 0.85rem;
  height: 0.85rem;
}

.active-sort .sort-icon {
  opacity: 1;
}

.active-sort[data-order="desc"] .sort-icon {
  transform: rotate(180deg);
}

.data-table tbody tr:hover {
  background: rgba(20, 20, 20, 0.025);
}

.data-table .empty {
  color: var(--muted);
  text-align: center;
  padding: 2.5rem 1rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  padding: 2rem 0;
  max-width: 420px;
  margin: 0 auto;
}

.empty-state strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.empty-state span {
  font-size: 0.82rem;
  line-height: 1.45;
}

.empty-state .btn {
  margin-top: 0.35rem;
}

.empty-state svg {
  width: 1.5rem;
  height: 1.5rem;
  opacity: 0.55;
}

.table-footer {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 1rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-success {
  background: rgba(27, 122, 69, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(192, 86, 33, 0.1);
  color: var(--warning);
}

.badge-secondary {
  background: rgba(111, 111, 117, 0.12);
  color: var(--muted);
}

.badge-danger {
  background: rgba(197, 48, 48, 0.1);
  color: var(--error);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.52rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
  text-decoration: none;
  color: inherit;
  line-height: 1.2;
}

.btn svg {
  width: 1rem;
  height: 1rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  background: var(--card);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}

.btn-outline:hover {
  background: var(--bg);
  border-color: var(--ink);
  color: var(--ink);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.data-table td.col-acciones {
  white-space: nowrap;
  width: 1%;
}

.registro-resumen {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.45;
  margin: 0 0 0.25rem;
}

.modal-body {
  padding: 1.4rem;
}

.cambio-lista {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.cambio-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.cambio-item span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cambio-item strong {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
}

.modal.modal-front {
  z-index: 1100;
}

.log-table td:nth-child(-n + 3),
.log-table .badge {
  white-space: nowrap;
}

.log-mensaje {
  max-width: 28rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  line-height: 1.45;
}

.log-modal-mensaje {
  margin: 0.85rem 0 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.log-kv {
  margin-top: 1rem;
  padding: 0.7rem 0.85rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 0.4rem;
}

.log-kv div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 9rem) 1fr;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.log-kv div span:first-child {
  color: var(--muted);
  font-weight: 600;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.62rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color var(--ease), box-shadow var(--ease);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.08);
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-left: 2.4rem;
}

.input-with-icon .field-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: flex;
  pointer-events: none;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.checkbox-label input {
  width: auto;
}

/* Filters */
.filters-form {
  margin-bottom: 0;
  container-type: inline-size;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 0.9rem;
  align-items: end;
}

.filters-grid > * {
  min-width: 0;
}

.form-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filters-grid > .form-group-actions {
  grid-column: span 2;
}

.form-group-actions .btn {
  white-space: nowrap;
}

@container (max-width: 340px) {
  .filters-grid > .form-group-actions {
    grid-column: 1 / -1;
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.42);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-content.modal-wide {
  max-width: 680px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.modal-close {
  background: var(--bg);
  border: none;
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--ink);
  background: var(--line);
}

.modal form {
  padding: 1.4rem;
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.loading {
  padding: 4rem;
  text-align: center;
  color: var(--muted);
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: var(--radius);
  animation: fadeIn 0.3s ease;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Login */
#app.not-logged {
  display: block;
}

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(20, 20, 20, 0.06), transparent),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  padding: 2.25rem 2rem;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-header .logo-img {
  height: 96px;
  margin-bottom: 1.1rem;
}

.login-header h1 {
  font-size: 1.35rem;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.login-header p {
  font-size: 0.88rem;
  color: var(--muted);
}

.btn-block {
  width: 100%;
  padding: 0.75rem;
  margin-top: 0.35rem;
}

.error-message {
  background: rgba(197, 48, 48, 0.08);
  color: var(--error);
  padding: 0.7rem;
  border-radius: 9px;
  font-size: 0.82rem;
  margin-top: 0.85rem;
  text-align: center;
  border: 1px solid rgba(197, 48, 48, 0.16);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Sidebar user */
.sidebar-footer {
  padding: 0.9rem 0.85rem 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  min-width: 0;
}

.user-icon {
  width: 2rem;
  height: 2rem;
  background: var(--bg);
  color: var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-icon svg {
  width: 1rem;
  height: 1rem;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.72rem;
  color: var(--muted);
}

.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--ease);
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  color: var(--error);
  background: rgba(197, 48, 48, 0.08);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.25rem;
}

.pagination-btn {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: all var(--ease);
  min-width: 36px;
  text-align: center;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--ink);
  color: var(--ink);
}

.pagination-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.pagination-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0.4rem;
}

/* Password */
.password-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pwd-text {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

.btn-toggle-pwd {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pwd:hover {
  background: var(--bg);
  color: var(--ink);
}

/* Asistencia */
.upload-area {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 2.4rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--ease);
  background: var(--bg-soft);
  margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragging {
  border-color: var(--ink);
  background: var(--bg);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  cursor: pointer;
}

.upload-icon {
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 14px;
  background: var(--ink);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.upload-icon svg {
  width: 1.45rem;
  height: 1.45rem;
}

.upload-label .icon {
  font-size: 3rem;
}

.upload-label strong {
  color: var(--ink);
  font-weight: 600;
}

.upload-label .hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.status-msg {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
}

.import-espera {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #1d4e89;
  font-weight: 600;
}

.import-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #c5d7ee;
  border-top-color: #1d4e89;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.status-msg .loading { color: var(--muted); }
.status-msg .success { color: var(--success); font-weight: 600; }
.status-msg .error { color: var(--error); font-weight: 600; }
.status-msg .info { color: var(--ink); }

.results-container {
  margin-top: 1.5rem;
}

.detail-card {
  margin-top: 1.25rem;
}

.detail-card h4 {
  margin-bottom: 0.85rem;
}

.table-sm th,
.table-sm td {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
}

.text-danger {
  color: var(--error);
  font-weight: 600;
}

.badge-tip {
  cursor: help;
}

.text-success {
  color: var(--success);
  font-weight: 600;
}

.row-error {
  background: rgba(197, 48, 48, 0.08);
}

.carga-local {
  max-width: 320px;
  margin-bottom: 1rem;
}

.match-select {
  width: 100%;
  min-width: 220px;
}

.row-warning {
  background: rgba(192, 86, 33, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
  }

  .sidebar-close {
    display: inline-flex;
  }

  .page-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 25;
    background: var(--bg);
    margin: -1.25rem -1rem 1.25rem;
    padding: 0.85rem 1rem 0.75rem;
  }

  .sidebar {
    width: min(18.5rem, 86vw);
    height: 100vh;
    height: 100dvh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 180ms ease, visibility 0s linear 180ms;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 180ms ease, visibility 0s;
  }

  .sidebar-header {
    justify-content: space-between;
  }

  .sidebar-nav {
    overflow-y: auto;
  }

  .sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 20, 0.42);
    z-index: 30;
  }

  body.nav-open {
    overflow: hidden;
  }

  .main-content {
    margin-left: 0;
    padding: 1.25rem 1rem 2rem;
  }

  #app {
    flex-direction: column;
  }

  .filters-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters-grid > .form-group-actions {
    grid-column: 1 / -1;
  }

  .page-header h1 {
    font-size: 1.4rem;
  }
}

@media print {
  .sidebar,
  .page-header,
  .upload-area,
  .status-msg,
  .btn-outline {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #eee;
  }
}
