/* ── Variables de marca ─────────────────────────────────────────────────── */
:root {
  --ac-naranja:   #C8521A;
  --ac-dark:      #2C2422;
  --ac-crema:     #F6F3EE;
  --ac-crema-d:   #EDE8E1;
  --ac-text:      #3A2E2A;
  --ac-muted:     #7A6E6A;
  --sidebar-w:    240px;
  --topbar-h:     56px;
}

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

body {
  background-color: var(--ac-crema);
  color: var(--ac-text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  min-height: 100vh;
}

/* ── LAYOUT ──────────────────────────────────────────────────────────────── */
#wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR móvil ────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  background: var(--ac-dark);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.topbar-logo {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: var(--ac-naranja);
  color: white;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-hamburger {
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
}

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--ac-dark);
  display: flex;
  flex-direction: column;
  z-index: 1100;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}

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

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1050;
}
.sidebar-overlay.visible { display: block; }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--ac-naranja);
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-title    { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar-subtitle { font-size: 11px; color: rgba(255,255,255,0.45); }

.sidebar-nav { list-style: none; padding: 0.75rem 0; margin: 0; flex: 1; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 1rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
  margin: 1px 8px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-nav li a.active  { background: var(--ac-naranja); }
.sidebar-nav li a i       { font-size: 16px; width: 20px; text-align: center; }

.nav-section {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.3);
  padding: 0.75rem 1rem 0.25rem;
  display: block;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.875rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ac-naranja);
  color: white;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name { font-size: 12px; font-weight: 500; color: #fff; line-height: 1.2; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.45); }
.user-info { flex: 1; min-width: 0; }

.sidebar-user a { color: rgba(255,255,255,0.4); font-size: 16px; text-decoration: none; transition: color 0.15s; }
.sidebar-user a:hover { color: rgba(255,255,255,0.8); }

/* ── CONTENIDO PRINCIPAL ─────────────────────────────────────────────────── */
.main-content { flex: 1; padding: 1rem; min-width: 0; width: 100%; }

/* ── DESKTOP ─────────────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  #wrapper { flex-direction: row; }
  .topbar  { display: none; }
  .sidebar {
    position: sticky;
    top: 0;
    transform: translateX(0) !important;
    box-shadow: none;
    flex-shrink: 0;
  }
  .sidebar-overlay { display: none !important; }
  .main-content    { padding: 1.5rem; max-width: 1200px; }
}

/* ── TIPOGRAFÍA ──────────────────────────────────────────────────────────── */
.page-title    { font-size: 1.2rem; font-weight: 600; color: var(--ac-text); margin-bottom: 0.2rem; }
.page-subtitle { font-size: 0.8rem; color: var(--ac-muted); margin-bottom: 1.25rem; }

/* ── CARDS ───────────────────────────────────────────────────────────────── */
.card { border: 1px solid var(--ac-crema-d); border-radius: 10px; background: white; }
.card-header {
  background: white;
  border-bottom: 1px solid var(--ac-crema-d);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.875rem 1rem;
  border-radius: 10px 10px 0 0 !important;
}

/* ── MÉTRICAS ────────────────────────────────────────────────────────────── */
.metric-card { background: white; border: 1px solid var(--ac-crema-d); border-radius: 10px; padding: 0.875rem 1rem; }
.metric-card .metric-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ac-muted); margin-bottom: 0.4rem; }
.metric-card .metric-value { font-size: 1.6rem; font-weight: 700; color: var(--ac-text); line-height: 1; }
.metric-card .metric-sub   { font-size: 11px; color: var(--ac-muted); margin-top: 0.2rem; }
.metric-card.accent { background: var(--ac-naranja); border-color: var(--ac-naranja); }
.metric-card.accent .metric-label,
.metric-card.accent .metric-value,
.metric-card.accent .metric-sub { color: white; }

/* ── BOTÓN FICHAR ────────────────────────────────────────────────────────── */
.btn-fichar { width: 100%; padding: 1rem; font-size: 1rem; font-weight: 600; border-radius: 10px; border: none; cursor: pointer; transition: transform 0.1s; }
.btn-fichar:active       { transform: scale(0.98); }
.btn-fichar-entrada      { background: var(--ac-naranja); color: white; }
.btn-fichar-salida       { background: var(--ac-dark); color: white; }
.btn-fichar:disabled     { opacity: 0.5; cursor: not-allowed; }

/* ── ESTADOS ─────────────────────────────────────────────────────────────── */
.estado-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.estado-completado { background: #D1FAE5; color: #065F46; }
.estado-en_curso   { background: #FEF3C7; color: #92400E; }
.estado-pendiente  { background: #F3F4F6; color: #6B7280; }

/* ── TABLAS ──────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: 0.85rem; width: 100%; }
.table th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ac-muted); border-bottom: 1px solid var(--ac-crema-d); padding: 0.6rem 0.75rem; white-space: nowrap; }
.table td { padding: 0.6rem 0.75rem; vertical-align: middle; border-bottom: 1px solid #F9F7F4; }
.table tbody tr:hover td { background: #FAFAF8; }

/* ── BOTONES ─────────────────────────────────────────────────────────────── */
.btn { font-size: 0.875rem; }
.btn-primary { background: var(--ac-naranja); border-color: var(--ac-naranja); }
.btn-primary:hover { background: #B04515; border-color: #B04515; }
.btn-outline-secondary { border-color: var(--ac-crema-d); color: var(--ac-muted); }

/* Touch targets en móvil */
@media (max-width: 767px) {
  .btn    { min-height: 44px; }
  .btn-sm { min-height: 38px; font-size: 0.8rem; }
  .form-control, .form-select { min-height: 44px; font-size: 16px !important; }
  .table th, .table td { padding: 0.5rem; font-size: 0.8rem; }
  .page-title { font-size: 1.1rem; }
  .metric-card .metric-value { font-size: 1.4rem; }
}

/* ── FORMULARIOS ─────────────────────────────────────────────────────────── */
.form-control, .form-select { font-size: 0.875rem; border-color: var(--ac-crema-d); border-radius: 7px; }
.form-control:focus, .form-select:focus { border-color: var(--ac-naranja); box-shadow: 0 0 0 3px rgba(200,82,26,0.12); }
.form-label { font-size: 12px; font-weight: 600; color: var(--ac-muted); margin-bottom: 4px; }

/* ── ALERTAS ─────────────────────────────────────────────────────────────── */
.flash-messages { margin-bottom: 1rem; }
.alert { font-size: 0.875rem; border-radius: 8px; }

/* ── NOTA LEGAL ──────────────────────────────────────────────────────────── */
.nota-legal { background: #FEF9C3; border: 1px solid #FDE047; border-radius: 8px; padding: 0.625rem 0.875rem; font-size: 11px; color: #713F12; }

/* ── RELOJ ───────────────────────────────────────────────────────────────── */
#reloj-actual { font-size: 2.5rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ac-dark); line-height: 1; }
@media (max-width: 400px) { #reloj-actual { font-size: 2rem; } }
