/* ============================================================
   DRIVER CONTROL PRO — style.css
   Design System: Dark dashboard profesional
   ============================================================ */

/* ── Variables ────────────────────────────────────────────── */
:root {
  --bg-base:      #0F0F13;
  --bg-card:      #1A1A24;
  --bg-card-alt:  #22222E;
  --bg-input:     #2A2A38;
  --border:       rgba(255,255,255,0.07);
  --border-focus: rgba(33,150,243,0.6);

  --green:  #00E676;
  --green-d:#00C853;
  --red:    #FF5252;
  --red-d:  #D32F2F;
  --blue:   #2196F3;
  --blue-d: #1565C0;
  --yellow: #FFC107;
  --purple: #CE93D8;

  --text-1: #F0F0F5;
  --text-2: #A0A0B8;
  --text-3: #606078;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 6px 24px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  --shadow-green: 0 0 20px rgba(0,230,118,.15);
  --shadow-blue:  0 0 20px rgba(33,150,243,.15);

  --transition: 0.2s ease;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Tema Claro */
.light-theme {
  --bg-base:     #F0F0F5;
  --bg-card:     #FFFFFF;
  --bg-card-alt: #F8F8FC;
  --bg-input:    #EBEBF2;
  --border:      rgba(0,0,0,0.08);
  --text-1: #16162A;
  --text-2: #505068;
  --text-3: #9090A8;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 20px 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--blue), #7B1FA2);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.logo-text { font-size: 14px; font-weight: 700; line-height: 1.2; }
.logo-text span { color: var(--blue); display: block; }

.sidebar-nav {
  flex: 1;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--bg-card-alt); color: var(--text-1); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(33,150,243,.18), rgba(33,150,243,.08));
  color: var(--blue);
  border: 1px solid rgba(33,150,243,.2);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Jornada status en sidebar */
.session-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card-alt);
}
.session-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.session-dot.active { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }

@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(12px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 20px;
  padding: 4px;
}

.topbar-title { font-size: 18px; font-weight: 700; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-datetime {
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}
.topbar-time { font-size: 16px; font-weight: 700; color: var(--text-1); }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-card-alt); color: var(--text-1); }

.content-area {
  flex: 1;
  padding: 24px;
}

/* ── Vistas / Tabs ─────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { font-size: 13px; }

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.stat-card.green::before { background: linear-gradient(90deg, var(--green), var(--green-d)); }
.stat-card.red::before   { background: linear-gradient(90deg, var(--red), var(--red-d)); }
.stat-card.blue::before  { background: linear-gradient(90deg, var(--blue), var(--blue-d)); }
.stat-card.yellow::before{ background: linear-gradient(90deg, var(--yellow), #FF8F00); }
.stat-card.purple::before{ background: linear-gradient(90deg, var(--purple), #9C27B0); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1;
}
.stat-value.green { color: var(--green); }
.stat-value.red   { color: var(--red); }
.stat-value.blue  { color: var(--blue); }
.stat-value.yellow{ color: var(--yellow); }

.stat-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}

.stat-icon {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 22px;
  opacity: .12;
}

/* ============================================================
   CRONÓMETRO HERO
   ============================================================ */
.chrono-hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(33,150,243,.06) 100%);
  border: 1px solid rgba(33,150,243,.2);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-blue);
  position: relative;
  overflow: hidden;
}
.chrono-hero::after {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(33,150,243,.08) 0%, transparent 70%);
  pointer-events: none;
}

.chrono-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.session-status {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-pill {
  padding: 4px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.status-pill.inactive { background: rgba(255,255,255,.08); color: var(--text-3); }
.status-pill.active   { background: rgba(0,230,118,.15); color: var(--green); border: 1px solid rgba(0,230,118,.3); }

.chrono-display {
  text-align: center;
  margin: 16px 0 24px;
}
.chrono-time {
  font-size: clamp(44px, 10vw, 72px);
  font-weight: 900;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--text-1), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.chrono-start-info {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 8px;
}

.chrono-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  border: none;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
  border-radius: var(--radius-lg);
  min-width: 160px;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-green {
  background: linear-gradient(135deg, var(--green), var(--green-d));
  color: #000;
  box-shadow: 0 4px 16px rgba(0,230,118,.3);
}
.btn-green:hover { box-shadow: 0 6px 24px rgba(0,230,118,.4); filter: brightness(1.05); }

.btn-red {
  background: linear-gradient(135deg, var(--red), var(--red-d));
  color: #fff;
  box-shadow: 0 4px 16px rgba(255,82,82,.3);
}
.btn-red:hover { box-shadow: 0 6px 24px rgba(255,82,82,.4); filter: brightness(1.05); }

.btn-blue {
  background: linear-gradient(135deg, var(--blue), var(--blue-d));
  color: #fff;
  box-shadow: 0 4px 16px rgba(33,150,243,.3);
}
.btn-blue:hover { box-shadow: 0 6px 24px rgba(33,150,243,.4); filter: brightness(1.05); }

.btn-yellow {
  background: linear-gradient(135deg, var(--yellow), #FF8F00);
  color: #000;
  box-shadow: 0 4px 16px rgba(255,193,7,.3);
}
.btn-yellow:hover { box-shadow: 0 6px 24px rgba(255,193,7,.4); filter: brightness(1.05); }

.btn-ghost {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text-1); }

.btn-danger-ghost {
  background: rgba(255,82,82,.08);
  border: 1px solid rgba(255,82,82,.2);
  color: var(--red);
}
.btn-danger-ghost:hover { background: rgba(255,82,82,.15); }

/* ============================================================
   GRID LAYOUT HELPERS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-1);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(33,150,243,.1);
}
.form-select option { background: var(--bg-card); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Inputs con prefix */
.input-with-prefix {
  position: relative;
}
.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  font-size: 14px;
  pointer-events: none;
}
.input-with-prefix .form-input { padding-left: 28px; }

/* Toggle de tipo de combustible */
.fuel-toggle { display: flex; gap: 8px; }
.fuel-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
}
.fuel-btn.selected {
  background: linear-gradient(135deg, rgba(33,150,243,.2), rgba(33,150,243,.1));
  border-color: rgba(33,150,243,.4);
  color: var(--blue);
}

/* Radio-like payment method */
.payment-methods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.payment-btn {
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.payment-btn i { font-size: 16px; }
.payment-btn.selected {
  background: rgba(0,230,118,.1);
  border-color: rgba(0,230,118,.4);
  color: var(--green);
}

/* ============================================================
   TABLA DE VIAJES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead tr {
  background: var(--bg-card-alt);
}
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
tr:hover td { background: rgba(255,255,255,.02); }

.badge {
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.badge-green { background: rgba(0,230,118,.15); color: var(--green); }
.badge-blue  { background: rgba(33,150,243,.15); color: var(--blue); }
.badge-yellow{ background: rgba(255,193,7,.15);  color: var(--yellow); }
.badge-purple{ background: rgba(206,147,216,.15);color: var(--purple); }

/* ============================================================
   BARRAS DE PROGRESO
   ============================================================ */
.progress-bar-wrap {
  height: 8px;
  background: var(--bg-input);
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
  position: relative;
}
.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}
@keyframes shimmer {
  from { transform: translateX(0); }
  to   { transform: translateX(200%); }
}

.progress-green  { background: linear-gradient(90deg, var(--green), var(--green-d)); }
.progress-blue   { background: linear-gradient(90deg, var(--blue), var(--blue-d)); }
.progress-yellow { background: linear-gradient(90deg, var(--yellow), #FF8F00); }

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
}
.progress-pct { font-weight: 700; }

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform .2s ease;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-card-alt); color: var(--text-1); }
.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.modal-footer .btn { flex: 1; }

/* ============================================================
   GRÁFICOS
   ============================================================ */
.chart-container {
  position: relative;
  height: 240px;
}
.chart-container-tall { height: 320px; }

/* ============================================================
   HISTORIAL
   ============================================================ */
.history-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: flex-end;
}
.history-filters .form-input,
.history-filters .form-select {
  width: auto;
  flex: 1;
  min-width: 140px;
}

.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow var(--transition);
  cursor: pointer;
}
.history-item:hover { box-shadow: var(--shadow-md); }
.history-item-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(33,150,243,.15), rgba(33,150,243,.05));
  border: 1px solid rgba(33,150,243,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: var(--blue);
  flex-shrink: 0;
}
.history-item-info { flex: 1; min-width: 0; }
.history-item-date { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.history-item-meta { font-size: 12px; color: var(--text-3); }
.history-item-amounts { text-align: right; flex-shrink: 0; }
.history-amount-net { font-size: 18px; font-weight: 800; color: var(--green); }
.history-amount-gross { font-size: 12px; color: var(--text-3); }

/* ============================================================
   METAS
   ============================================================ */
.goal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 14px;
}
.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.goal-title { font-size: 15px; font-weight: 700; }
.goal-amounts { font-size: 13px; color: var(--text-2); }
.goal-pct-badge {
  font-size: 20px;
  font-weight: 900;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .4;
  display: block;
}
.empty-state p { font-size: 14px; }

/* ============================================================
   NOTIFICACIÓN TOAST INTERNA
   ============================================================ */
.toast-container {
  position: fixed;
  top: 70px; right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
@media (max-width: 768px) {
  .toast-container {
    top: 60px;
    right: 10px;
    left: 10px;
  }
  .toast {
    max-width: 100% !important;
  }
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: all;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease forwards;
  max-width: 320px;
}
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.info    .toast-icon { color: var(--blue); }
.toast.warning .toast-icon { color: var(--yellow); }
.toast-left { border-left: 3px solid; }
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.info    { border-left-color: var(--blue); }
.toast.warning { border-left-color: var(--yellow); }

/* ============================================================
   RESUMEN FINAL DE JORNADA
   ============================================================ */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}
.summary-item {
  background: var(--bg-card-alt);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.summary-item-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.summary-item-value { font-size: 20px; font-weight: 800; margin-top: 4px; }

/* ============================================================
   INDICATOR CARDS ADICIONALES
   ============================================================ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.kpi-icon { font-size: 22px; margin-bottom: 8px; }
.kpi-value { font-size: 18px; font-weight: 800; }
.kpi-label { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* ============================================================
   PWA INSTALL BANNER
   ============================================================ */
.install-banner {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 150;
  max-width: 380px;
  width: calc(100% - 32px);
  animation: slideUp .4s ease;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}
.install-banner-text { flex: 1; font-size: 13px; }
.install-banner-title { font-weight: 700; margin-bottom: 2px; }
.install-banner-sub { color: var(--text-3); font-size: 12px; }

/* ============================================================
   GASTO / EXPENSE ITEMS
   ============================================================ */
.expense-list { display: flex; flex-direction: column; gap: 8px; }
.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card-alt);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.expense-cat {
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.expense-info { flex: 1; min-width: 0; }
.expense-desc { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-time { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.expense-amount { font-weight: 700; flex-shrink: 0; }

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .main-content {
    margin-left: 0;
  }
  .menu-toggle { display: flex; }
  .content-area { padding: 16px; }
  .topbar { padding: 0 16px; }
  .chrono-time { font-size: 44px; }
  .modal { padding: 20px; max-height: 90vh; overflow-y: auto; }
  .form-row { grid-template-columns: 1fr; }
  .payment-methods { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .history-filters { flex-direction: column; gap: 10px; }
  .history-filters .form-input,
  .history-filters .form-select { min-width: 100%; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .table-wrapper { font-size: 13px; }
  .card { padding: 16px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kpi-row { grid-template-columns: 1fr; }
  .chrono-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .chrono-actions .btn { justify-content: center; font-size: 14px; padding: 12px 16px; }
  .btn-lg { width: 100%; }
  .history-item { flex-wrap: wrap; }
  .history-item-amounts { width: 100%; text-align: left; }
  .topbar { padding: 12px 16px; }
  .topbar-title { font-size: 18px; }
  .modal { width: 95vw; max-height: 90vh; padding: 16px; }
  .modal-header { margin-bottom: 16px; }
  .modal-title { font-size: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .form-group { margin-bottom: 12px; }
  .form-label { font-size: 12px; }
  .form-input, .form-select, .form-textarea { font-size: 16px; padding: 10px; }
  .input-prefix { font-size: 13px; }
  .btn { font-size: 13px; padding: 10px 14px; }
  .btn-sm { padding: 8px 12px; font-size: 12px; }
  .sidebar { width: 85vw; }
  .content-area { padding: 12px; }
  .card { margin-bottom: 16px; padding: 16px; }
  .table-wrapper { overflow-x: auto; }
  table { font-size: 12px; }
  th, td { padding: 8px 6px; }
  .chrono-time { font-size: 36px; }
  .chrono-display { margin: 20px 0; }
  .summary-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 20px; }
  .kpi-card { padding: 12px; }
  .kpi-icon { font-size: 24px; }
  .kpi-value { font-size: 16px; }
  .kpi-label { font-size: 11px; }
  .payment-methods { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .payment-btn { padding: 8px 10px; font-size: 12px; }
  .goal-card { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .history-filters { flex-direction: column; gap: 10px; }
  .install-banner { padding: 12px; gap: 10px; }
}

/* Extra small devices */
@media (max-width: 380px) {
  .chrono-time { font-size: 32px; }
  .stat-value { font-size: 18px; }
  .topbar-title { font-size: 16px; }
  html { font-size: 14px; }
  .btn { padding: 8px 12px; font-size: 12px; }
  .modal { width: 90vw; padding: 12px; }
  .form-input, .form-select { font-size: 14px; padding: 8px; }
  .payment-methods { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   OVERLAY SIDEBAR para móvil
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}
@media (max-width: 768px) {
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-overlay.open { opacity: 1; pointer-events: all; }
}

/* ============================================================
   LOADER
   ============================================================ */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card-alt);
  color: var(--text-1);
  border: 1px solid var(--border);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 50;
}
[data-tip]:hover::after { opacity: 1; }

/* section dividers */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title i { color: var(--blue); }