/* ============================================================
   SEFOMEC Operaciones PWA — CSS
   Light theme default, mobile-first, standalone (sin Tailwind)
   ============================================================ */

/* -- Fuentes locales (offline-first) ------------------------------ */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../../../assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../../../assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url('../../../assets/fonts/material-symbols-outlined.woff2') format('woff2');
}
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  user-select: none;
}

/* -- Variables de tema (Light default) ----------------------------- */
:root {
  /* Colors */
  --bg:           #f5f7f0;
  --surface:      #ffffff;
  --surface-2:    #e8ede4;
  --border:       #c5d4bc;
  --primary:      #4A8B4D;
  --primary-dark: #2D5F2E;
  --primary-dim:  rgba(74,139,77,.15);
  --primary-light:#76B947;
  --danger:       #dc2626;
  --danger-dim:   rgba(220,38,38,.1);
  --warning:      #d97706;
  --warning-dim:  rgba(217,119,6,.1);
  --success:      #16a34a;
  --success-dim:  rgba(22,163,74,.1);
  --text:         #1a2e1a;
  --text-2:       #4a6349;
  --text-3:       #5c7a5c;

  /* Layout */
  --radius:       0.75rem;
  --radius-sm:    0.5rem;
  --radius-lg:    1rem;
  --nav-h:        4rem;
  --header-h:     3.5rem;
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
  --safe-top:     env(safe-area-inset-top, 0px);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);

  /* Z-index scale */
  --z-base:    1;
  --z-nav:     30;
  --z-header:  40;
  --z-sidebar: 80;
  --z-overlay: 100;
  --z-modal:   200;
  --z-toast:   500;
  --z-skip:    9999;

  /* Typography scale */
  --text-xs:   .7rem;
  --text-sm:   .8rem;
  --text-base: .9rem;
  --text-lg:   1.1rem;

  /* Transitions */
  --ease-out: cubic-bezier(.4, 0, .2, 1);
  --transition-fast: .15s ease;
  --transition-base: .25s ease;
  --transition-slow: .3s var(--ease-out);
}

/* -- Tema oscuro --------------------------------------------------- */
[data-theme="dark"] {
  --bg:           #0d1a0d;
  --surface:      #1a2e1a;
  --surface-2:    #2d4a2d;
  --border:       #3d5a3d;
  --primary:      #76B947;
  --primary-dark: #4A8B4D;
  --primary-dim:  rgba(118,185,71,.15);
  --primary-light:#96d46a;
  --danger:       #ef4444;
  --danger-dim:   rgba(239,68,68,.15);
  --warning:      #f59e0b;
  --warning-dim:  rgba(245,158,11,.15);
  --success:      #22c55e;
  --success-dim:  rgba(34,197,94,.15);
  --text:         #e2ede2;
  --text-2:       #94b894;
  --text-3:       #7a9a7a;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.4);
  --shadow-md:    0 4px 12px rgba(0,0,0,.3);
}

/* -- Reset ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
input, textarea, select { font: inherit; }
img { max-width: 100%; display: block; }

/* -- Layout --------------------------------------------------------- */
.app-bg        { background: var(--bg); }
.flex-center   { display: flex; align-items: center; justify-content: center; }
.flex-col      { flex-direction: column; }
.gap-2         { gap: .5rem; }
.gap-3         { gap: .75rem; }
.gap-4         { gap: 1rem; }
.min-h-screen  { min-height: 100dvh; }
.p-4           { padding: 1rem; }
.p-6           { padding: 1.5rem; }
.text-center   { text-align: center; }
.max-w-xs      { max-width: 20rem; }

/* -- Page structure ------------------------------------------------- */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
  padding-top: calc(var(--header-h) + var(--safe-top));
}
.page--no-nav { padding-bottom: calc(3.5rem + var(--safe-bottom)); }
.page--no-header { padding-top: var(--safe-top); }

/* -- Page header ---------------------------------------------------- */
.page-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  padding-top: var(--safe-top);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-inline: 1rem;
  gap: .75rem;
  z-index: var(--z-header);
}
.page-header__back {
  display: flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 1.25rem;
  flex-shrink: 0;
}
.page-header__back:active { background: var(--surface-2); }
.page-header__title {
  flex: 1;
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}
.page-header__actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* -- Bottom navigation --------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: var(--z-header);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  color: var(--text-3);
  font-size: .7rem;
  font-weight: 500;
  padding: .65rem 0;
  transition: color .15s;
  border: none;
  background: none;
  text-decoration: none;
}
.nav-item .material-symbols-outlined { font-size: 1.4rem; }
.nav-item.active { color: var(--primary); }
.nav-item:active { color: var(--primary); background: var(--primary-dim); }

/* -- Cards ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.card--interactive { cursor: pointer; transition: background .15s; }
.card--interactive:active { background: var(--surface-2); }

/* -- Swipe container ------------------------------------------------ */
.swipe-container {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
}
.swipe-action {
  position: absolute;
  top: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1.25rem;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.swipe-action--start {
  left: 0;
  background: var(--primary);
}
.swipe-action--view {
  right: 0;
  background: var(--text-2);
}
.swipe-container .ticket-card {
  transition: transform .2s ease;
  will-change: transform;
}
.swipe-container .ticket-card.swiping {
  transition: none;
}

/* -- Ticket Card ---------------------------------------------------- */
.ticket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  cursor: pointer;
  transition: background .15s;
  position: relative;
  overflow: hidden;
}
.ticket-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--surface-2);
  border-radius: var(--radius) 0 0 var(--radius);
}
.ticket-card.estado-pendiente::before { background: var(--warning); }
.ticket-card.estado-ejecutado::before { background: var(--success); }
.ticket-card.estado-parcial::before   { background: var(--primary); }
.ticket-card:active { background: var(--surface-2); }
.ticket-card__header {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ticket-card__number { font-size: .75rem; color: var(--text-3); font-weight: 500; }
.ticket-card__title  { font-size: .9rem;  font-weight: 600; flex: 1; }
.ticket-card__meta   {
  display: flex; gap: .5rem; align-items: center;
  font-size: .75rem; color: var(--text-2);
  flex-wrap: wrap;
}
.ticket-card__meta span { display: flex; align-items: center; gap: .2rem; }
.ticket-card__meta .material-symbols-outlined { font-size: .85rem; }

/* -- Badges --------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 2rem;
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .01em;
}
.badge-pendiente  { background: var(--surface-2); color: var(--text-2); }
.badge-iniciado   { background: var(--warning-dim); color: var(--warning); }
.badge-ejecutado  { background: var(--success-dim); color: var(--success); }
.badge-sync       { background: var(--primary-dim); color: var(--primary); font-size: .6rem; }
.badge-parcial    { background: var(--primary-dim); color: var(--primary); }
.badge-sinenviar  { background: var(--surface-2); color: var(--text-2); }
.badge-danger     { background: #fef2f2; color: #ef4444; }
.badge-warning    { background: var(--warning-dim); color: var(--warning); }

/* -- Typography ---------------------------------------------------- */
.text-xl    { font-size: 1.25rem; }
.text-lg    { font-size: 1.1rem; }
.text-sm    { font-size: .85rem; }
.text-xs    { font-size: .75rem; }
.font-bold  { font-weight: 700; }
.font-semi  { font-weight: 600; }
.text-main  { color: var(--text); }
.text-secondary { color: var(--text-2); }
.text-muted { color: var(--text-3); }
.text-primary { color: var(--primary); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

/* -- Buttons ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  border: none;
  transition: opacity .15s, background .15s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { opacity: .8; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-ghost    { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-icon     {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .5rem; border-radius: 50%;
  background: transparent; border: none; color: var(--text-2);
  cursor: pointer;
  min-width: 2.75rem; min-height: 2.75rem;
}
.btn-icon:active { background: var(--surface-2); }
.btn-full     { width: 100%; }
.btn-lg       { padding: .85rem 1.5rem; font-size: 1rem; }
.btn .material-symbols-outlined { font-size: 1.1rem; }
.btn--loading { pointer-events: none; opacity: .7; }
.btn--loading::after {
  content: ''; display: inline-block;
  width: .85rem; height: .85rem;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .6s linear infinite;
  margin-left: .5rem; vertical-align: middle;
}

/* -- Forms --------------------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.form-input, .form-textarea, .form-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .65rem .9rem;
  font-size: .9rem;
  width: 100%;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
}
.form-input::placeholder { color: var(--text-3); }
.form-textarea { resize: vertical; min-height: 5rem; }
.form-input:read-only { background: var(--surface-2); cursor: default; }

/* -- Stats grid ---------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  padding: 1rem 1rem .5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.stat-card__value { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.stat-card__label { font-size: .7rem; color: var(--text-3); font-weight: 500; }
.stat-card.accent .stat-card__value { color: var(--primary); }

/* -- Photo grid ---------------------------------------------------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.photo-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
  cursor: pointer;
}
.photo-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb__del {
  position: absolute;
  top: .25rem; right: .25rem;
  width: 1.75rem; height: 1.75rem;
  border-radius: 50%;
  background: rgba(0,0,0,.7);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem;
  cursor: pointer;
}
.photo-add-btn {
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 2px dashed var(--border);
  color: var(--text-3);
  display: flex; flex-direction: row;
  align-items: center; justify-content: center;
  gap: .4rem;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  padding: .6rem .75rem;
}
.photo-add-btn:active { border-color: var(--primary); color: var(--primary); }
.photo-add-btn .material-symbols-outlined { font-size: 1.1rem; }
.photo-add-btn--required {
  border-color: var(--warning);
  color: var(--warning);
  background: var(--warning-dim);
  animation: pulseReq 2s ease-in-out infinite;
}
.photo-add-btn--required .photo-req-badge {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
@keyframes pulseReq {
  0%, 100% { border-color: var(--warning); }
  50%      { border-color: rgba(217,119,6,.4); }
}
.photo-add-btn--done {
  border-color: var(--success);
  color: var(--success);
  border-style: solid;
}

/* -- Modal ---------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: var(--z-overlay);
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 500px;
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-close {
  background: var(--surface-2);
  border: none;
  color: var(--text-2);
  width: 2.75rem; height: 2.75rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
  cursor: pointer;
}

/* -- Bottom Sheet items ---------------------------------------------- */
.sheet-items { display: flex; flex-direction: column; gap: .25rem; margin-top: .5rem; }
.sheet-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem .5rem; border: none; background: none;
  font-size: .95rem; color: var(--text); cursor: pointer;
  border-radius: var(--radius-sm); text-align: left; width: 100%;
}
.sheet-item:active { background: var(--surface-2); }
.sheet-item .material-symbols-outlined { font-size: 1.25rem; color: var(--text-2); }
.sheet-item--danger { color: var(--danger); }
.sheet-item--danger .material-symbols-outlined { color: var(--danger); }

/* -- Toast ---------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + .75rem);
  left: 50%;
  transform: translateX(-50%) translateY(0);
  padding: .65rem 1.1rem;
  border-radius: 2rem;
  font-size: .85rem;
  font-weight: 600;
  color: #fff;
  z-index: var(--z-toast);
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.hiding { opacity: 0; transform: translateX(-50%) translateY(8px); }
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); color: #1a2e1a; }
.toast-info    { background: var(--primary); color: #fff; }
.toast-offline { background: var(--surface-2); color: var(--text-2); }

/* -- Offline banner ------------------------------------------------ */
.offline-banner {
  display: none;
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top));
  left: 0; right: 0;
  background: var(--warning);
  color: #1a2e1a;
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  padding: .35rem;
  z-index: var(--z-nav);
}
.offline-banner.visible { display: block; }

/* -- Skeleton loader ----------------------------------------------- */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-card { min-height: 5rem; border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.skeleton-line { height: .85rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.skeleton-line--title { width: 45%; height: 1rem; }
.skeleton-line--meta { width: 70%; }
.skeleton-line--short { width: 35%; }
.skeleton-line.w-3\/4 { width: 75%; }
.skeleton-line.w-1\/2 { width: 50%; }

/* -- Empty state --------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty-state__icon { font-size: 3rem; color: var(--text-3); }
.empty-state__title { font-size: .95rem; font-weight: 600; }
.empty-state__desc  { font-size: .85rem; color: var(--text-2); }

/* -- Error state --------------------------------------------------- */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem 1.5rem;
  text-align: center;
}
.error-state__icon {
  width: 4rem; height: 4rem; border-radius: 50%;
  background: var(--danger-dim);
  display: flex; align-items: center; justify-content: center;
}
.error-state__icon .material-symbols-outlined { font-size: 2rem; color: var(--danger); }
.error-state__title { font-size: .95rem; font-weight: 600; }
.error-state__desc  { font-size: .85rem; color: var(--text-2); margin-bottom: .5rem; }

/* -- Sync indicator ------------------------------------------------ */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  color: var(--warning);
  background: var(--warning-dim);
  padding: .15rem .5rem;
  border-radius: 2rem;
  font-weight: 600;
}
.sync-badge .material-symbols-outlined { font-size: .85rem; animation: spin 1.5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -- Progress bar -------------------------------------------------- */
.progress-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width .3s ease;
}

/* -- Info rows ----------------------------------------------------- */
.info-list { display: flex; flex-direction: column; gap: 0; }
.info-row {
  display: flex;
  padding: .75rem 1rem;
  gap: .75rem;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row__icon { color: var(--text-3); font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.info-row__label { font-size: .75rem; color: var(--text-3); }
.info-row__value { font-size: .875rem; color: var(--text); }

/* -- Divider ------------------------------------------------------- */
.divider { height: 1px; background: var(--border); margin: .5rem 0; }

/* -- Toggle switch -------------------------------------------------- */
.toggle {
  position: relative;
  display: inline-block;
  width: 2.75rem;
  height: 1.75rem;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border-radius: .875rem;
  cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  left: .2rem;
  bottom: .325rem;
  background: var(--text-3);
  border-radius: 50%;
  transition: transform .2s, background .2s;
}
.toggle input:checked + .toggle-slider {
  background: var(--primary-dim);
}
.toggle input:checked + .toggle-slider::before {
  transform: translateX(1.25rem);
  background: var(--primary);
}

/* -- Login page ---------------------------------------------------- */
.login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Decorative background circles */
.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.login-bg__circle {
  position: absolute;
  border-radius: 50%;
  opacity: .12;
}
.login-bg__circle--1 {
  width: 320px; height: 320px;
  background: var(--primary);
  top: -80px; right: -60px;
}
.login-bg__circle--2 {
  width: 200px; height: 200px;
  background: var(--primary-light);
  bottom: -40px; left: -50px;
}
[data-theme="dark"] .login-bg__circle { opacity: .06; }

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  position: relative;
  z-index: var(--z-base);
  box-shadow: var(--shadow-md);
}

/* Brand section */
.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo {
  display: block;
  margin: 0 auto .75rem;
  max-width: 180px;
  height: auto;
}
[data-theme="dark"] .login-logo {
  filter: brightness(1.1) saturate(.9);
}
.login-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
  color: var(--primary);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.login-subtitle {
  font-size: .8rem;
  color: var(--text-3);
  margin-top: .25rem;
  margin-bottom: 0;
}

/* Input with icon */
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.login-input-icon {
  position: absolute;
  left: .75rem;
  font-size: 1.15rem;
  color: var(--text-3);
  pointer-events: none;
}
.login-input-padded {
  padding-left: 2.5rem !important;
}
.login-toggle-pwd {
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: .25rem;
  display: flex;
  align-items: center;
}

/* Login button */
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: .25rem;
}

.login-error {
  background: var(--danger-dim);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: .8rem;
  padding: .6rem .85rem;
  margin-bottom: 1rem;
  display: none;
}
.login-error.visible { display: block; }

/* -- Step indicator ------------------------------------------------- */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.step-indicator__dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--surface-2);
  transition: background .2s, transform .2s;
}
.step-indicator__dot.active {
  background: var(--primary);
  transform: scale(1.3);
}
.step-indicator__dot.done {
  background: var(--primary);
}

/* -- Horometer section --------------------------------------------- */
.horometer-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* -- Activity card ------------------------------------------------- */
.activity-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* -- Hours bar ----------------------------------------------------- */
.hours-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
  margin-top: .25rem;
}
.hours-bar__fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .3s ease;
}

/* -- Floating action button ---------------------------------------- */
.fab {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  padding: 1rem;
  padding-bottom: calc(1rem + var(--safe-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
  z-index: var(--z-nav);
}

/* -- Section headers ----------------------------------------------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem .5rem;
}
.section-title { font-size: .875rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }

/* -- Scroll list --------------------------------------------------- */
.list-wrap { padding: 0 1rem 1rem; display: flex; flex-direction: column; gap: .5rem; }

/* -- Settings list ------------------------------------------------- */
.settings-list {
  display: flex;
  flex-direction: column;
}
.settings-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.settings-item:last-child { border-bottom: none; }
.settings-item__icon { color: var(--text-3); flex-shrink: 0; }
.settings-item__body { flex: 1; }
.settings-item__label { font-size: .875rem; font-weight: 600; }
.settings-item__desc  { font-size: .75rem; color: var(--text-3); }

/* -- Lightbox ------------------------------------------------------ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.95);
  z-index: var(--z-overlay);
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.lightbox__close {
  position: absolute;
  top: 1rem; right: 1rem;
  background: rgba(255,255,255,.1);
  border: none;
  color: #fff;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
}

/* -- Condiciones del predio ---------------------------------------- */
.cond-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
@media (max-width: 360px) {
  .cond-grid { grid-template-columns: 1fr; }
}
.cond-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  margin-bottom: .75rem;
}
.cond-banner--info {
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.3);
  color: #1d4ed8;
}
.cond-banner--warn {
  background: var(--warning-dim);
  border: 1px solid rgba(217,119,6,.3);
  color: #92400e;
}
[data-theme="dark"] .cond-banner--info { color: #93c5fd; }
[data-theme="dark"] .cond-banner--warn { color: #fbbf24; }
[data-theme="dark"] .sync-item--pending .sync-item__icon,
[data-theme="dark"] .sync-item--syncing .sync-item__icon { background: rgba(245,158,11,.12); }
[data-theme="dark"] .sync-item--error .sync-item__icon,
[data-theme="dark"] .sync-item--failed .sync-item__icon { background: rgba(239,68,68,.12); }
[data-theme="dark"] .badge-danger { background: rgba(239,68,68,.15); }
[data-theme="dark"] .hint-text { color: #60a5fa; }

/* -- Tiempos Improductivos ---------------------------------------- */
.ti-slots { display: flex; flex-direction: column; gap: .5rem; }
.ti-slot {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.ti-slot__num {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-3);
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}
.ti-slot .form-select { flex: 1; font-size: .8rem; padding: .5rem .6rem; }
.ti-slot .inp-cti { width: 4.5rem; text-align: center; font-size: .85rem; padding: .5rem .4rem; }

/* -- Hint and warning texts --------------------------------------- */
.hint-text {
  font-size: .8rem;
  color: #2563eb;
  padding: .4rem .6rem;
  margin-bottom: .5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.hint-text:active { opacity: .7; }
.warn-text {
  font-size: .8rem;
  padding: .4rem .6rem;
  margin-top: .4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.warn-text--danger {
  background: var(--danger-dim);
  color: var(--danger);
}
.warn-text--warning {
  background: var(--warning-dim);
  color: var(--warning);
}

/* -- Form select (native styled) ---------------------------------- */
.form-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .65rem .9rem;
  font-size: .9rem;
  width: 100%;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a9a79' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2rem;
}
.form-select:focus { border-color: var(--primary); }
.form-select:disabled {
  background: var(--surface-2);
  opacity: .7;
  cursor: default;
}

/* -- Confirm modal ------------------------------------------------- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: 1.5rem;
  opacity: 0;
  transition: opacity .2s;
}
.confirm-overlay.open { opacity: 1; }
.confirm-dialog {
  background: var(--surface);
  border-radius: 1rem;
  padding: 1.5rem;
  width: 100%;
  max-width: 20rem;
  text-align: center;
  transform: scale(.9);
  transition: transform .2s;
}
.confirm-overlay.open .confirm-dialog { transform: scale(1); }
.confirm-icon { margin-bottom: .75rem; }
.confirm-title { font-size: 1.05rem; font-weight: 700; color: var(--text-1); margin-bottom: .35rem; }
.confirm-text { font-size: .85rem; color: var(--text-2); line-height: 1.45; margin-bottom: 1.25rem; }
.confirm-actions { display: flex; gap: .5rem; }
.confirm-btn { flex: 1; padding: .7rem 1rem; font-size: .85rem; font-weight: 600; border-radius: .5rem; }

/* -- Stepper ------------------------------------------------------- */
.stepper-progress {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  padding: .4rem .25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-header);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: .15rem;
}
.stepper-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  padding: .25rem .35rem;
  border: none;
  background: none;
  border-radius: .5rem;
  cursor: pointer;
  position: relative;
  min-width: 3rem;
  transition: background .2s;
}
.stepper-dot.active {
  background: var(--primary-light, rgba(74,139,77,.12));
}
.stepper-dot__icon {
  font-size: 1.15rem !important;
  color: var(--text-3);
  transition: color .2s;
}
.stepper-dot.active .stepper-dot__icon {
  color: var(--primary);
}
.stepper-dot.completed .stepper-dot__icon {
  color: var(--primary);
}
.stepper-dot.completed::after {
  content: '';
  position: absolute;
  top: .15rem;
  right: .15rem;
  width: .55rem;
  height: .55rem;
  background: var(--primary);
  border-radius: 50%;
  border: 1.5px solid var(--surface);
}
.stepper-dot__label {
  font-size: .6rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .02em;
  white-space: nowrap;
}
.stepper-dot.active .stepper-dot__label {
  color: var(--primary);
}
.stepper-dot.completed .stepper-dot__label {
  color: var(--primary);
}

.stepper-container {
  flex: 1;
  overflow: hidden;
  margin-top: 3.2rem; /* height of stepper-progress */
  touch-action: pan-y;
}
.stepper-track {
  display: flex;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
  height: 100%;
}
.stepper-track.swiping {
  transition: none;
}
.step-panel {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.step-panel__content {
  padding: 1rem;
  padding-bottom: 5rem;
}

.stepper-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  display: flex;
  gap: .5rem;
  padding: .75rem 1rem;
  padding-bottom: calc(.75rem + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: var(--z-header);
}
.btn-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .75rem 1rem;
  font-size: .875rem;
  font-weight: 600;
}
.btn-nav .material-symbols-outlined {
  font-size: 1.1rem !important;
}
.btn-full { flex: 1; }

/* TI resumen bar */
.ti-resumen {
  font-size: .75rem;
  color: var(--text-3);
  padding: .4rem .6rem;
  background: var(--bg);
  border-radius: .375rem;
  margin-bottom: .75rem;
  text-align: center;
}

/* -- Utils --------------------------------------------------------- */
.hidden { display: none !important; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }
.flex   { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rounded-full { border-radius: 9999px; }

/* -- Dashboard: badge-count & activity-chip ----------------------------- */
.badge-count {
  background: var(--primary-light, rgba(74,139,77,.15));
  color: var(--primary);
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 1rem;
}
.ticket-card__activities {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}
.activity-chip {
  font-size: .7rem;
  background: var(--bg);
  padding: .2rem .5rem;
  border-radius: .375rem;
  color: var(--text-2);
  white-space: nowrap;
}

/* -- Jornada: Activities info list (Step 0) ----------------------------- */
.actividades-info-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.act-info-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .6rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: .8rem;
}
.act-info-item__num {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-3);
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}
.act-info-item__details {
  flex: 1;
  min-width: 0;
}
.act-info-item__lp {
  font-weight: 600;
  color: var(--text-1);
  font-size: .8rem;
}
.act-info-item__sub {
  color: var(--text-3);
  font-size: .7rem;
  margin-top: .1rem;
}
.act-info-item__prog {
  font-weight: 600;
  color: var(--primary);
  font-size: .8rem;
  white-space: nowrap;
}

/* -- Jornada: Per-activity card (Step 5) -------------------------------- */
.act-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
}
.act-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.act-card__title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-1);
}
.act-card__subtitle {
  font-size: .7rem;
  color: var(--text-3);
}
.act-card__prog {
  font-size: .8rem;
  font-weight: 600;
  color: var(--primary);
}
.act-card .form-group { margin-bottom: .5rem; }
.act-card .form-group:last-child { margin-bottom: 0; }
.act-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.act-fields--full {
  grid-template-columns: 1fr;
}
/* -- Pre-save checklist ------------------------------------------- */
.checklist-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: .75rem 0;
}
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .45rem .6rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
}
.checklist-item--ok {
  background: var(--success-dim);
}
.checklist-item--warn {
  background: var(--warning-dim);
}
.checklist-item__icon {
  font-size: 1rem !important;
  flex-shrink: 0;
  margin-top: .05rem;
}
.checklist-item--ok .checklist-item__icon { color: var(--success); }
.checklist-item--warn .checklist-item__icon { color: var(--warning); }
.checklist-item__body { flex: 1; min-width: 0; }
.checklist-item__label { font-weight: 600; font-size: .8rem; }
.checklist-item__detail { font-size: .7rem; color: var(--text-2); margin-top: .1rem; }

.horas-asig-summary {
  font-size: .75rem;
  color: var(--text-3);
  padding: .4rem .6rem;
  background: var(--bg);
  border-radius: .375rem;
  margin-bottom: .75rem;
  text-align: center;
}

/* -- Sidebar Navigation --------------------------------------------- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--surface);
  z-index: 950;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
}
.sidebar.open {
  transform: translateX(0);
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1rem;
  padding-top: calc(1.25rem + var(--safe-top));
  border-bottom: 1px solid var(--border);
  background: var(--primary);
  color: #fff;
}
.sidebar-avatar {
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-avatar .material-symbols-outlined { color: #fff; font-size: 1.3rem; }
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user__name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user__rut { font-size: .75rem; opacity: .8; }
.sidebar-close {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.sidebar-close .material-symbols-outlined { font-size: 1.1rem; }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
}
.sidebar-nav__item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sidebar-nav__item:active { background: var(--surface-2); }
.sidebar-nav__item.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}
.sidebar-nav__item .material-symbols-outlined { font-size: 1.3rem; color: var(--text-3); }
.sidebar-nav__item.active .material-symbols-outlined { color: var(--primary); }
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: .5rem 1rem;
}
.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  min-width: 1.3rem;
  height: 1.3rem;
  border-radius: .65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .35rem;
}
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
}
.sidebar-logout { color: var(--danger) !important; }
.sidebar-logout .material-symbols-outlined { color: var(--danger) !important; }

/* -- Kanban tabs ---------------------------------------------------- */
.kanban-tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.kanban-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .75rem .5rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-3);
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  transition: color .15s;
}
.kanban-tab.active {
  color: var(--primary);
}
.kanban-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 15%; right: 15%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}
.kanban-tab__count {
  font-size: .65rem;
  font-weight: 700;
  min-width: 1.2rem;
  height: 1.2rem;
  border-radius: .6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .3rem;
}
.kanban-tab.active .kanban-tab__count {
  background: var(--primary-dim);
  color: var(--primary);
}
.kanban-tab:not(.active) .kanban-tab__count {
  background: var(--surface-2);
  color: var(--text-3);
}
.kanban-panel { display: none; }
.kanban-panel.active { display: block; }

@media (min-width: 600px) {
  .kanban-tabs { display: none; }
  .kanban-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    padding: 0 1rem;
  }
  .kanban-panel { display: block !important; }
  .kanban-column-header {
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .5rem 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .35rem;
  }
}
@media (max-width: 599px) {
  .kanban-column-header { display: none; }
  .kanban-columns { display: block; }
}

/* -- Tablet responsive (600px+) ------------------------------------- */
@media (min-width: 600px) {
  .step-panel__content { max-width: 640px; margin-left: auto; margin-right: auto; }
  .login-page > div { max-width: 380px; }
}

/* -- Historial page ------------------------------------------------- */
.historial-filters {
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.historial-filters__row {
  display: flex;
  gap: .5rem;
}
.historial-filters__row .form-input {
  font-size: .8rem;
  padding: .5rem .7rem;
}
.historial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  cursor: pointer;
  transition: background .15s;
}
.historial-card:active { background: var(--surface-2); }
.historial-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.historial-card__date { font-size: .75rem; color: var(--text-3); }
.historial-card__equipo { font-weight: 600; font-size: .9rem; }
.historial-card__meta { font-size: .75rem; color: var(--text-2); display: flex; gap: .5rem; flex-wrap: wrap; }
.historial-card__photos {
  display: flex; align-items: center; gap: .25rem;
  font-size: .7rem; color: var(--primary); font-weight: 600;
}
.historial-card__photos .material-symbols-outlined { font-size: .85rem; }

/* -- Historial: tablet (600px+) ------------------------------------- */
@media (min-width: 600px) {
  .historial-filters {
    flex-direction: row;
    align-items: center;
    gap: .75rem;
  }
  .historial-filters__row:first-child { flex: 1; }
  .historial-filters__row:last-child { flex-shrink: 0; }
  .historial-filters__row .form-input { font-size: .85rem; }
}

/* -- Historial: hover on non-touch ---------------------------------- */
@media (hover: hover) {
  .historial-card:hover {
    background: var(--surface-2);
  }
}

/* -- Historial detalle ----------------------------------------------- */
.detalle-section {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.detalle-section__title {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.detalle-section__title .material-symbols-outlined { font-size: 1rem; }
.detalle-row {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  padding: .25rem 0;
}
.detalle-row__label { color: var(--text-2); }
.detalle-row__value { font-weight: 600; }
.photo-grid--detalle {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: .5rem;
}
.photo-grid--detalle .photo-placeholder {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  font-size: .7rem;
  color: var(--text-3);
}
.photo-grid--detalle .photo-placeholder .material-symbols-outlined { font-size: 1.5rem; opacity: .5; }
.photo-grid--detalle .photo-thumb {
  display: flex;
  flex-direction: column;
  aspect-ratio: auto;
  overflow: visible;
}
.photo-grid--detalle .photo-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.photo-thumb__label {
  display: block;
  text-align: center;
  font-size: .7rem;
  color: var(--text-2);
  margin-top: .2rem;
  font-weight: 600;
}

/* -- Notificaciones page -------------------------------------------- */
.notif-list { display: flex; flex-direction: column; gap: .5rem; padding: 1rem; }
.notif-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background .15s;
}
.notif-item:active { background: var(--surface-2); }
.notif-item--unread {
  background: var(--primary-dim);
  border-left-color: var(--primary);
}
.notif-item__title { font-weight: 600; font-size: .875rem; margin-bottom: .15rem; }
.notif-item__body { font-size: .8rem; color: var(--text-2); line-height: 1.4; }
.notif-item__time { font-size: .7rem; color: var(--text-3); margin-top: .35rem; }

/* -- Map page ------------------------------------------------------- */
.map-container {
  position: fixed;
  top: calc(var(--header-h) + var(--safe-top));
  left: 0; right: 0; bottom: 0;
  z-index: 1;
}
.map-legend {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .75rem;
  font-size: .75rem;
  z-index: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* -- Load more button ---------------------------------------------- */
.btn-load-more {
  display: block;
  width: 100%;
  padding: .75rem;
  text-align: center;
  font-size: .85rem;
  font-weight: 600;
  color: var(--primary);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-load-more:active { background: var(--primary-dim); }

/* -- Sync History --------------------------------------------------- */
.sync-log { display: flex; flex-direction: column; gap: .5rem; }
.sync-item {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .6rem; border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: .75rem;
}
.sync-item__icon {
  flex-shrink: 0; width: 1.75rem; height: 1.75rem;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.sync-item__icon .material-symbols-outlined { font-size: 1rem; }
.sync-item--completed .sync-item__icon { background: var(--primary-dim); color: var(--primary); }
.sync-item--pending .sync-item__icon,
.sync-item--syncing .sync-item__icon { background: #fef3c7; color: #d97706; }
.sync-item--error .sync-item__icon,
.sync-item--failed .sync-item__icon { background: #fee2e2; color: #ef4444; }
.sync-item__body { flex: 1; min-width: 0; }
.sync-item__title { font-weight: 600; font-size: .8rem; margin-bottom: .1rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.sync-item__fecha { font-weight: 400; font-size: .7rem; color: var(--text-3); }
.sync-item__ticket { font-size: .7rem; color: var(--text-2); line-height: 1.4; padding-left: .1rem; }
.sync-item__meta { color: var(--text-3); font-size: .65rem; line-height: 1.4; margin-top: .2rem; }
.sync-item__error { color: #ef4444; font-size: .7rem; margin-top: .2rem; }
.sync-item__badge {
  display: inline-flex; align-items: center; gap: .2rem;
  padding: .1rem .35rem; border-radius: .25rem;
  font-size: .65rem; font-weight: 600;
}
.sync-item__badge--ok { background: var(--primary-dim); color: var(--primary); }
.sync-item__badge--warn { background: #fef3c7; color: #d97706; }
.sync-item__badge--fail { background: #fee2e2; color: #ef4444; }
.sync-empty {
  text-align: center; padding: 1.5rem; color: var(--text-3); font-size: .8rem;
}
.sync-empty .material-symbols-outlined { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .5; }

/* ── Accessibility: focus-visible ─────────────────────────────── */
.btn:focus-visible,
.btn-icon:focus-visible,
.page-header__back:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.nav-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.sidebar-nav__item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.form-input:focus-visible,
.form-textarea:focus-visible,
.form-select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.toggle:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2rem;
}
.stepper-dot:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.modal-close:focus-visible,
.lightbox__close:focus-visible,
.photo-thumb__del:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Accessibility: skip-to-content ───────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: var(--z-skip);
}
.skip-link:focus {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  padding: .75rem 1.5rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  z-index: var(--z-skip);
}

/* ── Accessibility: screen-reader only ───────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── Semantic: fieldset reset ────────────────────────────────── */
fieldset { border: none; margin: 0; padding: 0; }
fieldset > legend { font-size: .8rem; font-weight: 600; color: var(--text-2); margin-bottom: .4rem; }

/* ── Performance: prefers-reduced-motion ─────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Dashboard: pull-to-refresh ──────────────────────────────── */
.pull-indicator {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -3rem);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease;
  z-index: 10;
  pointer-events: none;
}
.pull-indicator.visible {
  transform: translate(-50%, .75rem);
}
.pull-indicator .material-symbols-outlined {
  font-size: 1.25rem;
  color: var(--primary);
}
.pull-indicator.refreshing .material-symbols-outlined {
  animation: spin .8s linear infinite;
}

/* ── View Transitions API ─────────────────────────────────────── */
::view-transition-old(root) { animation: vt-fade-out .15s ease; }
::view-transition-new(root) { animation: vt-fade-in .15s ease; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

/* ── Dashboard: View Toggle ──────────────────────────────────── */
.view-toggle {
  display: flex;
  justify-content: center;
  gap: .25rem;
  padding: .5rem 1rem 0;
}
.view-toggle__btn {
  padding: .4rem .75rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .25rem;
  font-size: var(--text-xs);
  font-family: inherit;
}
.view-toggle__btn .material-symbols-outlined { font-size: 1.1rem; }
.view-toggle__btn.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 600;
}
.view-toggle__btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Dashboard: Month Calendar Grid ──────────────────────────── */
.calendar-view { padding: .5rem; }
.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-3);
  padding: .25rem 0;
  font-weight: 600;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.calendar-cell {
  aspect-ratio: 1;
  padding: .25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  position: relative;
  min-height: 2.5rem;
  transition: background var(--transition-fast);
}
.calendar-cell:hover { background: var(--surface-2); }
.calendar-cell--today {
  background: var(--primary-dim);
  font-weight: 700;
}
.calendar-cell--today:hover { background: var(--primary-dim); }
.calendar-cell--other { opacity: .3; pointer-events: none; }
.calendar-cell--has-tickets { font-weight: 600; }
.calendar-dots {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.calendar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.calendar-dot--pending { background: var(--text-3); }
.calendar-dot--progress { background: var(--warning); }
.calendar-dot--complete { background: var(--success); }
.calendar-count {
  font-size: .55rem;
  color: var(--text-3);
  margin-top: 1px;
  line-height: 1;
}

/* ── Dashboard: Week View (vertical on mobile) ──────────────── */
.week-view {
  padding: .5rem;
}
.week-columns {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.week-row {
  display: flex;
  gap: .5rem;
  align-items: flex-start;
  padding: .5rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.week-row:hover { background: var(--surface-2); }
.week-row--today {
  background: var(--primary-dim);
  border-left: 3px solid var(--primary);
}
.week-row--today:hover { background: var(--primary-dim); }
.week-row__date {
  min-width: 3rem;
  text-align: center;
  flex-shrink: 0;
  padding-top: .1rem;
}
.week-row__day-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-2);
}
.week-row__day-num {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
}
.week-row__cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-height: 1.5rem;
}
.week-row__empty {
  font-size: var(--text-xs);
  color: var(--text-3);
  padding: .2rem 0;
}
.week-card {
  display: block;
  padding: .4rem .5rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border-left: 3px solid var(--text-3);
  font-size: var(--text-xs);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition-fast);
}
.week-card:hover { transform: translateX(2px); }
.week-card--pendiente { border-left-color: var(--text-3); }
.week-card--iniciado { border-left-color: var(--warning); }
.week-card--ejecutado { border-left-color: var(--success); }
.week-card__title { font-weight: 600; }
.week-card__meta { color: var(--text-3); margin-top: 2px; }

/* Tablet: week as horizontal 7-column grid */
@media (min-width: 768px) {
  .week-columns {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .5rem;
  }
  .week-row {
    flex-direction: column;
    align-items: stretch;
    min-height: 150px;
    padding: .4rem;
  }
  .week-row__date {
    min-width: auto;
    margin-bottom: .35rem;
    padding-bottom: .35rem;
    border-bottom: 1px solid var(--border);
  }
  .week-row__day-num { font-size: var(--text-sm); }
}

/* ── Toggle group (registro diario: colacion, rol camioneta) ───────────── */
.toggle-group {
  display: flex;
  gap: .5rem;
}
.toggle-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .75rem .5rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: var(--text-xs);
  font-family: inherit;
  color: var(--text-2);
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.toggle-option .material-symbols-outlined { font-size: 1.5rem; }
.toggle-option.active {
  border-color: var(--primary);
  background: var(--primary-dim);
  color: var(--primary);
}
.toggle-option:active {
  transform: scale(.97);
}
[data-theme="dark"] .toggle-option {
  border-color: var(--border);
  background: var(--surface);
}
[data-theme="dark"] .toggle-option.active {
  border-color: var(--primary);
  background: rgba(74, 139, 77, .15);
  color: var(--primary);
}

/* Hint text (patente autocomplete, km last value) */
.hint-text {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: .25rem;
  line-height: 1.3;
}
.hint-text--link {
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
}
.hint-text--error {
  color: #ef4444;
}

/* Photo preview for km foto */
.photo-preview {
  margin-top: .5rem;
}
.photo-preview img {
  max-width: 100%;
  border-radius: var(--radius-md);
  max-height: 200px;
  object-fit: contain;
}
