/* FLOWME - UI moderna, responsive, móvil-first */
:root {
  --bg: #0c1222;
  --bg-elevated: #131c2e;
  --bg-card: #162033;
  --bg-card-hover: #1a2742;
  --text: #e8edf5;
  --text-muted: #8b9bb5;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.15);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --border: rgba(255,255,255,.06);
  --border-hover: rgba(255,255,255,.1);
  --input-border: rgba(255,255,255,.12);
  --table-bg: rgba(255,255,255,.03);
  --table-hover: rgba(255,255,255,.04);
}

/* Panel interno: paleta azul (#032f51 + tonos claros) */
body.app-body {
  --bg: #ffffff;
  --bg-elevated: #e8eef4;
  --bg-card: #ffffff;
  --bg-card-hover: #f4f7fa;
  --text: #2d2a26;
  --text-muted: #5c5a55;
  --accent: #032f51;
  --accent-hover: #042a47;
  --accent-soft: rgba(3, 47, 81, 0.12);
  --sage: #7ba3c4;
  --sage-soft: rgba(3, 47, 81, 0.08);
  --beige: #e8eef4;
  --border: rgba(3, 47, 81, 0.15);
  --border-hover: rgba(3, 47, 81, 0.25);
  --shadow: 0 2px 12px rgba(3, 47, 81, 0.06);
  --shadow-sm: 0 1px 4px rgba(3, 47, 81, 0.04);
  --input-border: rgba(3, 47, 81, 0.2);
  --table-bg: rgba(3, 47, 81, 0.04);
  --table-hover: rgba(3, 47, 81, 0.08);
  --success: #032f51;
  --success-soft: rgba(3, 47, 81, 0.12);
  --shadow-btn: 0 2px 8px rgba(3, 47, 81, 0.25);
  background: #ffffff;
  color: var(--text);
  --radius: 8px;
  --radius-btn: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-form: 14px;
  --radius-input: 10px;
  --radius-input-lg: 12px;
  --gap: 0.75rem;
  --header-h: 56px;
  --transition: 0.2s ease;
  --text-base: 0.875rem;
  --text-sm: 0.8125rem;
  --text-xs: 0.75rem;
  --title-h1: 1.75rem;
  --title-h2: 1.5rem;
  --title-h3: 1.25rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.page-login {
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #032f51;
  min-height: 100vh;
  color: #2d2a26;
}

/* ========== Layout con sidebar ========== */
.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

body.app-body .sidebar {
  background: #ffffff;
  border-right-color: rgba(3, 47, 81, 0.15);
}

body.app-body .topbar {
  background: #ffffff;
  border-bottom-color: rgba(3, 47, 81, 0.15);
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-brand {
  font-weight: 600;
  font-size: var(--title-h3);
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
}

.sidebar-logo {
  max-height: 48px;
  max-width: 200px;
  width: auto;
  height: auto;
  object-fit: contain;
}

@media (min-width: 1024px) {
  .sidebar-logo {
    max-height: 56px;
    max-width: 240px;
  }
}

.sidebar-brand:hover {
  color: var(--accent-hover);
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 0.5rem;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.6rem 1rem 0.35rem;
  opacity: 0.9;
}

/* Desplegables del menú admin/superadmin */
.sidebar-dropdown {
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-dropdown:last-of-type {
  border-bottom: none;
}

.sidebar-dropdown-trigger {
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  user-select: none;
  transition: color var(--transition), background var(--transition);
}

.sidebar-dropdown-trigger svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-dropdown-trigger::-webkit-details-marker,
.sidebar-dropdown-trigger::marker {
  display: none;
}

.sidebar-dropdown-trigger::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.sidebar-dropdown[open] .sidebar-dropdown-trigger::after {
  transform: rotate(180deg);
}

.sidebar-dropdown-trigger:hover {
  color: var(--text);
  background: var(--table-hover);
}

.sidebar-dropdown .sidebar-menu {
  padding-left: 0.5rem;
  border-left: 2px solid var(--border-hover);
  margin-left: 0.75rem;
  margin-bottom: 0.5rem;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu li {
  margin: 0;
}

.sidebar-menu a {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 400;
  transition: color var(--transition), background var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-menu a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.sidebar-menu a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 500;
}

.sidebar-menu a.active:hover {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-left-color: var(--accent-hover);
}

.sidebar-item-highlight {
  color: var(--accent) !important;
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.sidebar-logout {
  margin: 0;
}

.sidebar-logout button {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-muted);
  border-radius: var(--radius-btn);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.sidebar-logout button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

.topbar {
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  height: 56px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2.5rem;
  gap: 1rem;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.35rem;
  line-height: 1;
}

.topbar-title {
  font-weight: 600;
  font-size: var(--title-h3);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-account {
  position: relative;
}

.topbar-account-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: none;
  border: none;
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-family: inherit;
  cursor: pointer;
  list-style: none;
  transition: color var(--transition), background var(--transition);
}

.topbar-account-btn::-webkit-details-marker,
.topbar-account-btn::marker {
  display: none;
}

.topbar-account-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.topbar-account-icon {
  flex-shrink: 0;
}

.topbar-account-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.25rem;
  min-width: 220px;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow);
  z-index: 100;
}

.topbar-account-dropdown a {
  display: block;
  padding: 0.6rem 0.75rem;
  color: var(--text);
  text-decoration: none;
  font-size: var(--text-sm);
  border-radius: 6px;
  transition: background var(--transition), color var(--transition);
}

.topbar-account-dropdown a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.topbar-user {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.main-wrap {
  flex: 1;
  margin-top: 56px;
  margin-left: calc(280px + 2rem);
  padding: 1.5rem 1.25rem 1.5rem 2.5rem;
  max-width: 1400px;
  min-height: calc(100vh - 56px);
}

body.app-body .main-wrap {
  background: #fff;
}

.app-footer {
  margin-left: calc(280px + 2rem);
  padding: 0.875rem 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  border-top: 1px solid var(--border);
}

.app-footer-install {
  margin-top: 0.5rem;
}

.app-footer-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.app-footer-install-btn:hover {
  background: rgba(3, 47, 81, 0.08);
  border-color: var(--accent);
}

.app-footer-install-btn svg {
  flex-shrink: 0;
}

.app-footer-install-hint {
  display: block;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  line-height: 1.5;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ========== RESPONSIVE ========== */
/* Pantallas grandes: más margen */
@media (min-width: 1400px) {
  .sidebar { width: 320px; }
  .topbar { left: 320px; }
  .main-wrap { margin-left: calc(320px + 2.5rem); }
  .app-footer { margin-left: calc(320px + 2.5rem); }
}

@media (min-width: 1200px) and (max-width: 1399px) {
  .sidebar { width: 300px; }
  .topbar { left: 300px; }
  .main-wrap { margin-left: calc(300px + 2rem); }
  .app-footer { margin-left: calc(300px + 2rem); }
}

/* Tablet */
@media (max-width: 1024px) {
  .sidebar {
    width: 260px;
  }
  .topbar {
    left: 260px;
  }
  .main-wrap {
    margin-left: calc(260px + 1.5rem);
    padding: 1.25rem 1rem 1.25rem 2rem;
  }
  .app-footer {
    margin-left: calc(260px + 1.5rem);
  }
  .table.calendar-table th,
  .table.calendar-table td,
  .calendar-table th,
  .calendar-table td {
    padding: 0.85rem 1rem;
  }
}

/* Móvil: sidebar oculto, menú hamburguesa */
@media (max-width: 900px) {
  .sidebar {
    width: min(320px, 85vw);
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }

  .sidebar-close {
    display: block;
  }

  .topbar {
    left: 0;
    padding: 0 1rem;
    height: 52px;
  }

  .topbar-account-label {
    display: none;
  }

  .topbar-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .main-wrap {
    margin-left: 0;
    margin-top: 52px;
    padding: 1rem 0.875rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  }

  .app-footer {
    margin-left: 0;
    padding: 0.875rem 1rem;
    padding-bottom: calc(0.875rem + env(safe-area-inset-bottom, 0));
  }

  .form-card,
  .form.form-card {
    padding: 1.5rem 1.25rem;
  }

  .table-wrap {
    margin-left: -0.875rem;
    margin-right: -0.875rem;
    border-radius: 0;
  }
  .table-wrap.calendar-wrap {
    border-radius: var(--radius-lg);
    margin-left: 0;
    margin-right: 0;
  }
  .table.calendar-table th,
  .table.calendar-table td,
  .calendar-table th,
  .calendar-table td {
    padding: 0.85rem 0.75rem;
    font-size: var(--text-sm);
  }
  /* Detalle de registros: tipografía más pequeña en móvil para evitar scroll horizontal */
  .historial-detalle .table th,
  .historial-detalle .table td {
    font-size: 0.7rem;
    padding: 0.4rem 0.5rem;
  }
  .historial-detalle .badge {
    font-size: 0.65rem;
  }
  .btn {
    min-height: 44px;
    padding: 0.6rem 1rem;
  }
  .btn-fichaje {
    min-width: 100%;
  }
  .fichaje-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions button,
  .form-actions .btn {
    width: 100%;
  }
  .dashboard-stats {
    gap: 0.75rem;
  }
  .stat-card {
    min-width: 100%;
  }
  .card-grid {
    grid-template-columns: 1fr;
  }
  .monitor-grid {
    grid-template-columns: 1fr;
  }
}

/* Móvil pequeño */
@media (max-width: 480px) {
  :root {
    --title-h1: 1.5rem;
    --title-h2: 1.35rem;
    --title-h3: 1.15rem;
  }
  .login-card {
    padding: 1.75rem 1.25rem;
  }
  .form-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .form-inline input,
  .form-inline select {
    min-width: 0;
  }
  .table th,
  .table td {
    padding: 0.5rem 0.6rem;
    font-size: var(--text-xs);
  }
}

/* Header solo (login) */
.header-solo {
  min-height: 56px;
  padding: 0 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

/* Header (legacy cuando no hay sidebar) */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--gap);
  min-height: var(--header-h);
  padding: 0 1.25rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.brand {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color var(--transition);
}

.brand:hover {
  color: var(--accent-hover);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}

.nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-user {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  margin-right: 0.25rem;
  padding: 0.4rem 0.6rem;
  background: rgba(255,255,255,.05);
  border-radius: var(--radius);
}

.nav-logout {
  margin: 0;
}

.nav-logout button {
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color var(--transition), color var(--transition);
}

.nav-logout button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Main */
.main {
  flex: 1;
  padding: 1.5rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Login */
.login-card {
  width: 100%;
  max-width: 440px;
  padding: 2.75rem 2.5rem;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(3, 47, 81, 0.35);
}

.login-card h1,
.login-card .login-title {
  margin: 0 0 0.25rem;
  font-size: var(--title-h1);
  font-weight: 700;
  color: #032f51;
  letter-spacing: -0.02em;
}

.login-logo {
  text-align: center;
  margin-bottom: 0.75rem;
}

.login-logo img {
  max-width: 220px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
}

@media (min-width: 769px) {
  .login-logo img {
    max-width: 300px;
    max-height: 110px;
  }
}

.login-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.login-card a {
  color: #032f51;
  text-decoration: none;
}

.login-card a:hover {
  text-decoration: underline;
  color: #042a47;
}

.form-login label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  color: #5c5a55;
  font-size: var(--text-sm);
  font-weight: 500;
}

.form-login input {
  width: 100%;
  padding: 0.75rem 1rem;
  min-height: 46px;
  border: 1px solid rgba(3, 47, 81, 0.2);
  border-radius: var(--radius-input-lg);
  background: #f8f9fa;
  color: #2d2a26;
  font-size: var(--text-base);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-login input:focus {
  outline: none;
  border-color: #032f51;
  box-shadow: 0 0 0 4px rgba(3, 47, 81, 0.12);
}

.form-login button {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.85rem 1.25rem;
  min-height: 48px;
  background: #032f51;
  color: #fff;
  border: none;
  border-radius: var(--radius-input-lg);
  font-weight: 600;
  font-size: var(--text-base);
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease, box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(3, 47, 81, 0.25);
}

.form-login button:hover {
  background: #042a47;
  box-shadow: 0 4px 12px rgba(3, 47, 81, 0.35);
}

.form-login button:active {
  transform: scale(0.99);
}

/* Buttons - más modernos */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  min-height: 40px;
  border-radius: var(--radius-btn);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.1s ease, box-shadow var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-btn);
}

.btn-outline {
  background: rgba(255,255,255,.04);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.btn-outline:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  min-height: 32px;
  font-size: var(--text-xs);
  margin-right: 0.35rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  margin-right: 0.75rem;
  min-height: auto;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-link.danger {
  color: var(--error);
}

/* Flash */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-btn);
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: var(--text-sm);
}

.flash-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(3, 47, 81, 0.25);
}

.flash-error {
  background: var(--error-soft);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: var(--title-h3);
  font-weight: 600;
}

.card .meta {
  margin: 0.25rem 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.card-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
  margin: 0.75rem 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.card-meta-grid strong {
  color: var(--text);
}

/* Icon buttons for actions */
.actions-icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.icon-btn:hover {
  background: var(--table-hover);
  border-color: var(--border-hover);
}

.icon-btn.icon-success {
  color: var(--success);
  border-color: var(--success);
}

.icon-btn.icon-success:hover {
  background: var(--success-soft);
}

.icon-btn.icon-muted {
  color: var(--text-muted);
  border-color: var(--border);
}

.icon-btn.icon-muted:hover {
  background: var(--table-hover);
}

.icon-btn.icon-accent {
  color: var(--accent);
  border-color: var(--accent);
}

.icon-btn.icon-accent:hover {
  background: var(--accent-soft);
}

.icon-btn.icon-danger {
  color: var(--error);
  border-color: var(--error);
}

.icon-btn.icon-danger:hover {
  background: var(--error-soft);
}

.company-link {
  color: var(--text);
  text-decoration: none;
}

.company-link:hover {
  color: var(--accent);
}

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

.card.ficha p {
  margin: 0.55rem 0;
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.card-list li {
  margin-bottom: 0.5rem;
}

.card-list a {
  display: block;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition);
}

.card-list a:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--table-bg);
}

.table tbody tr:hover td {
  background: var(--table-hover);
}

.table td a {
  color: var(--accent);
  text-decoration: none;
  margin-right: 0.75rem;
  font-weight: 500;
}

.table td a:hover {
  text-decoration: underline;
}

/* Calendarios / tablas tipo calendario - más grandes y modernas */
.table-wrap.calendar-wrap,
.calendar-wrap {
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.table.calendar-table,
.calendar-table {
  font-size: var(--text-base);
}

.table.calendar-table th,
.table.calendar-table td,
.calendar-table th,
.calendar-table td {
  padding: 1rem 1.25rem;
  min-height: 52px;
  vertical-align: middle;
}

.table.calendar-table th,
.calendar-table th {
  font-size: var(--text-sm);
  padding: 1rem 1.25rem;
  background: var(--table-bg);
}

.table.calendar-table tbody tr:nth-child(even) td,
.calendar-table tbody tr:nth-child(even) td {
  background: var(--table-bg);
}

.table.calendar-table tbody tr:hover td,
.calendar-table tbody tr:hover td {
  background: var(--table-hover);
}

/* Inputs dentro de tablas (ej. horarios) */
.table input[type="text"],
.table input[type="time"],
.table input[type="date"],
.table input[type="number"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
  min-width: 0;
}

.table input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.inline-form {
  display: inline;
  margin: 0;
}

.inline-form button {
  margin-right: 0.5rem;
}

/* ========== Forms: cuadros grandes y bonitos ========== */
.form-card,
.form.form-card {
  max-width: 620px;
  padding: 2.25rem 2.5rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-form);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  transition: box-shadow var(--transition);
}

.form-card:hover,
.form.form-card:hover {
  box-shadow: var(--shadow);
}

.form-card label {
  display: block;
  margin-top: 1.1rem;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
}

.form-card label:first-child {
  margin-top: 0;
}

.form-card label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

/* Inputs grandes con vértices redondeados */
.form-card input[type="text"],
.form-card input[type="email"],
.form-card input[type="password"],
.form-card input[type="date"],
.form-card input[type="time"],
.form-card input[type="month"],
.form-card input[type="datetime-local"],
.form-card input[type="number"],
.form-card textarea,
.form-card select {
  width: 100%;
  max-width: 100%;
  padding: 1rem 1.25rem;
  min-height: 52px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input-lg);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-card input::placeholder,
.form-card textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

.form-card input:focus,
.form-card textarea:focus,
.form-card select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--bg-card);
}

.form-card input:hover:not(:focus):not(:disabled),
.form-card textarea:hover:not(:focus):not(:disabled),
.form-card select:hover:not(:focus):not(:disabled) {
  border-color: var(--border-hover);
}

.form-card textarea {
  min-height: 120px;
  height: auto;
  resize: vertical;
  line-height: 1.6;
  padding-top: 1rem;
}

.form-card select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%238b9bb5' d='M7 9L2 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.25rem center;
  padding-right: 2.75rem;
}

.form-actions {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.form-actions button {
  padding: 0.9rem 1.75rem;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-input-lg);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
}

.form-actions button:hover {
  background: var(--accent-hover);
}

.form-actions button:active {
  transform: scale(0.98);
}

.form-actions .btn,
.form-actions a {
  padding: 0.9rem 1.75rem;
  border-radius: var(--radius-input-lg);
  font-size: 1.05rem;
}

.profile-card {
  background: var(--table-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-form);
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

.profile-card h3 {
  margin: 0 0 0.75rem;
  font-size: var(--title-h3);
}

.profile-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.5rem 1.5rem;
}

.profile-card dt {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.profile-card dd {
  margin: 0;
}

.access-fieldset {
  margin-top: 1.5rem;
  padding: 1.5rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-form);
  max-width: 100%;
  background: var(--table-bg);
}

.access-fieldset legend {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0 0.6rem;
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0.5rem 0 0;
  line-height: 1.45;
}

/* Logo settings (SuperAdmin) */
.logo-settings {
  max-width: 520px;
}

.logo-preview {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--table-bg);
  border-radius: var(--radius-lg);
}

.logo-preview-img {
  max-width: 280px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin-top: 0.5rem;
}

/* Formularios inline (filtros) */
.form-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-inline label {
  display: block;
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-inline input,
.form-inline select {
  padding: 0.7rem 1rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
  min-width: 140px;
}

.form-inline input:focus,
.form-inline select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.form-inline button {
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-input);
  font-weight: 600;
}

/* Errors */
.errors {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  color: var(--error);
  font-size: 0.95rem;
}

.errors li {
  padding: 0.25rem 0;
}

/* Company list */
.company-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.company-list li {
  margin: 0.5rem 0;
}

.company-list a {
  color: var(--accent);
  text-decoration: none;
}

.company-list a:hover {
  text-decoration: underline;
}

/* Admins section */
.admins-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.admins-section h3 {
  margin: 0;
  font-size: var(--title-h3);
}

.admins-section h4 {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--text);
}

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

.section-header h3 {
  margin: 0;
}

.admins-table {
  margin-bottom: 1rem;
}

.admins-table td {
  vertical-align: middle;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.form-group label small {
  font-weight: 400;
  opacity: 0.8;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
}

.form-card {
  margin-top: 1rem;
  padding: 1.25rem;
}

.form-card.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-sm svg {
  flex-shrink: 0;
}

.admins-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.admins-list li {
  padding: 0.25rem 0;
}

.radio-inline {
  display: inline-block;
  margin-right: 1.25rem;
  margin-bottom: 0.5rem;
}

.radio-inline input {
  margin-right: 0.4rem;
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--accent);
}

.filtro-grupo {
  margin-top: 0.6rem;
  margin-bottom: 0.85rem;
}

.filtro-grupo input {
  padding: 0.85rem 1.15rem;
  min-height: 48px;
  border-radius: var(--radius-input);
  border: 1px solid var(--input-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 1rem;
}

.filtro-grupo input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Checkbox list (ej. asignar plantilla) */
.checkbox-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.checkbox-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.checkbox-list li:last-child {
  border-bottom: none;
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 500;
}

.checkbox-list input[type="checkbox"] {
  width: 1.2em;
  height: 1.2em;
  accent-color: var(--accent);
  border-radius: 4px;
}

/* Footer */
.footer {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,.05);
}

/* Dashboard stats */
.dashboard-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  min-width: 140px;
}

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-muted { background: rgba(0,0,0,.08); color: var(--text-muted); }
.badge-entrada { background: var(--success-soft); color: var(--success); }
.badge-salida { background: var(--error-soft); color: var(--error); }
.badge-inicio_pausa, .badge-fin_pausa { background: var(--accent-soft); color: var(--accent); }

/* Monitor */
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.monitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.monitor-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.monitor-card .meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.monitor-pausa {
  border-color: var(--accent);
  background: rgba(56, 189, 248, .08);
}

.monitor-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.monitor-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.monitor-list li:last-child {
  border-bottom: none;
}

/* Fichaje empleado */
.fichaje-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
}

.fichaje-form {
  margin: 0;
}

.btn-fichaje {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.25rem;
  font-size: var(--text-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-family: inherit;
  min-width: 160px;
  transition: transform 0.1s ease, box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.btn-fichaje:active {
  transform: scale(0.98);
}

.btn-fichaje-entrada {
  background: #588157;
  color: #fff;
}

.btn-fichaje-entrada:hover {
  filter: brightness(1.1);
}

.btn-fichaje-pausa {
  background: #a3b18a;
  color: #2d2a26;
}

.btn-fichaje-pausa:hover {
  filter: brightness(1.1);
}

.btn-fichaje-salida {
  background: var(--error);
  color: #fff;
}

.btn-fichaje-salida:hover {
  filter: brightness(1.1);
}

.btn-fichaje-finpausa {
  background: #7ba3c4;
  color: #fff;
}

.btn-fichaje-finpausa:hover {
  filter: brightness(1.1);
}

.fichaje-historial {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.fichaje-historial h3 {
  margin: 0 0 0.75rem;
  font-size: var(--title-h3);
}

.historial-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.historial-list li {
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Auditoría */
.audit-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.audit-section h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.audit-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.audit-list li:last-child {
  border-bottom: none;
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 420px;
  pointer-events: none;
}

.toast {
  background: #ffffff;
  color: var(--text);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease;
  border-left: 4px solid var(--accent);
  max-width: 100%;
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast.toast-error {
  border-left-color: var(--error);
}

.toast.toast-info {
  border-left-color: var(--accent);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  font-size: 14px;
}

.toast-success .toast-icon {
  background: var(--success-soft);
  color: var(--success);
}

.toast-error .toast-icon {
  background: var(--error-soft);
  color: var(--error);
}

.toast-info .toast-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.toast-content {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.5;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background var(--transition);
  font-size: 18px;
  line-height: 1;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.toast-hiding {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@media (max-width: 768px) {
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
  
  .toast {
    padding: 14px 16px;
  }
}

/* ========== BREADCRUMBS ========== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumbs a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.breadcrumbs-separator {
  color: var(--text-muted);
  opacity: 0.5;
}

.breadcrumbs-current {
  color: var(--text);
  font-weight: 500;
}

/* ========== SEARCH BAR ========== */
.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
  max-width: 400px;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ========== CHARTS ========== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.chart-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.chart-card canvas {
  max-height: 300px;
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .chart-card canvas {
    max-height: 250px;
  }
}

/* ========== FILTROS Y EXPORTACIÓN ========== */
.export-section {
  margin-bottom: 2rem;
}

.export-quick-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.export-card h3 {
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.export-card h3 svg {
  color: var(--accent);
}

/* Filtros modernos en grid */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%235c5a55'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.filter-separator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.filter-separator::before,
.filter-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Botones de exportación */
.export-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-export svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-export-pdf {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

.btn-export-pdf:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  transform: translateY(-1px);
}

.btn-export-excel {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}

.btn-export-excel:hover {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
  transform: translateY(-1px);
}

.btn-export-outline {
  background: var(--bg-card);
  color: var(--accent);
  border: 2px solid var(--accent);
}

.btn-export-outline:hover {
  background: var(--accent-soft);
}

/* Quick action cards */
.quick-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  min-width: 160px;
}

.quick-action-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.quick-action-card .icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--accent-soft);
}

.quick-action-card .icon svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.quick-action-card .icon.excel {
  background: rgba(22, 163, 74, 0.15);
}

.quick-action-card .icon.excel svg {
  color: #16a34a;
}

.quick-action-card span {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

/* Reportes filtro inline mejorado */
.report-filter {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.report-filter .filter-group {
  flex: 1;
  min-width: 150px;
  max-width: 250px;
}

.report-filter .btn {
  height: 44px;
  padding: 0 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
  
  .export-buttons {
    flex-direction: column;
  }
  
  .btn-export {
    width: 100%;
    padding: 1rem 1.5rem;
  }
  
  .export-quick-actions {
    flex-direction: column;
  }
  
  .quick-action-card {
    flex-direction: row;
    justify-content: flex-start;
    padding: 1rem 1.25rem;
    min-width: auto;
    width: 100%;
  }
  
  .quick-action-card .icon {
    width: 40px;
    height: 40px;
  }
  
  .quick-action-card .icon svg {
    width: 20px;
    height: 20px;
  }
  
  .report-filter {
    flex-direction: column;
    align-items: stretch;
  }
  
  .report-filter .filter-group {
    max-width: none;
  }
  
  .report-filter .btn {
    width: 100%;
  }
}

/* ========== FAB (Floating Action Button) ========== */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 1000;
  animation: fabPulse 2s ease-in-out infinite;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.2);
}

.fab:active {
  transform: scale(0.95);
}

.fab.fab-entrada {
  background: var(--success);
}

.fab.fab-salida {
  background: var(--error);
}

.fab.fab-pausa {
  background: var(--sage);
  color: #2d2a26;
}

@keyframes fabPulse {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.15);
  }
  50% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.15), 0 0 0 8px rgba(3, 47, 81, 0.2);
  }
}

@media (max-width: 768px) {
  .fab {
    bottom: 80px;
    right: 20px;
    width: 72px;
    height: 72px;
    font-size: 1.75rem;
  }
}

/* Headings - títulos más grandes */
h1, .h1 {
  margin: 0 0 0.75rem;
  font-size: var(--title-h1);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
h2, .h2 {
  margin: 0 0 0.75rem;
  font-size: var(--title-h2);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
h3, .h3 {
  margin: 0 0 0.5rem;
  font-size: var(--title-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
}
@media (min-width: 768px) {
  :root {
    --title-h1: 2rem;
    --title-h2: 1.625rem;
    --title-h3: 1.3125rem;
  }
}

/* Safe area para móvil (notch, home indicator) */
@supports (padding: env(safe-area-inset-bottom)) {
  .main { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .header { padding-left: calc(1rem + env(safe-area-inset-left)); padding-right: calc(1rem + env(safe-area-inset-right)); }
  .sidebar { padding-left: env(safe-area-inset-left); }
  .topbar { padding-left: calc(1rem + env(safe-area-inset-left)); }
  .main-wrap { padding-left: calc(0.875rem + env(safe-area-inset-left)); }
}
