/* ============================================================
   Gestión — Design System & Styles
   The Candle Shop - Sistema de Gestion Interna

   Brand: Pardo/Ivory/Ocre palette, Montagu Slab + Red Hat Display
   ============================================================ */

/* ── 1. Design Tokens ── */
:root {
    /* Brand Colors */
    --tcs-pardo:        #382E2C;
    --tcs-pardo-claro:  #756662;
    --tcs-ocre:         #B1A77E;
    --tcs-ivory:        #E6E0D7;     /* page bg — warmer + more contrast vs white cards */
    --tcs-gris:         #A9A89E;
    --tcs-white:        #FFFFFF;

    /* Derived (opacity variants for UI states) */
    --tcs-ivory-warm:   #EFEBE3;     /* used inside cards / hover surfaces */
    --tcs-ocre-10:      rgba(177,167,126,0.1);
    --tcs-ocre-20:      rgba(177,167,126,0.2);
    --tcs-pardo-05:     rgba(56,46,44,0.09); /* borders/separators — bumped from 0.05 for visibility */
    --tcs-pardo-80:     rgba(56,46,44,0.8);

    /* Semantic (earthy, desaturated — harmonize with brand) */
    --tcs-success:      #5A7A5A;
    --tcs-success-bg:   rgba(90,122,90,0.1);
    --tcs-warning:      #B8943E;
    --tcs-warning-bg:   rgba(184,148,62,0.1);
    --tcs-danger:       #9E4B4B;
    --tcs-danger-bg:    rgba(158,75,75,0.1);
    --tcs-info:         #6B7FA3;
    --tcs-info-bg:      rgba(107,127,163,0.1);

    /* Typography */
    --font-display:     'Montagu Slab', Georgia, 'Times New Roman', serif;
    --font-body:        'Red Hat Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-condensed:   'Roboto Condensed', 'Arial Narrow', sans-serif;

    /* Spacing (8px grid) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-base: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* Shadows — bumped for better card definition on store PC display */
    --shadow-card:  0 1px 3px rgba(56,46,44,0.10), 0 1px 2px rgba(56,46,44,0.06);
    --shadow-hover: 0 8px 20px rgba(56,46,44,0.14), 0 2px 6px rgba(56,46,44,0.08);
    --shadow-modal: 0 16px 48px rgba(56,46,44,0.22);
    --shadow-topbar: 0 1px 4px rgba(56,46,44,0.10);

    /* Hover state colors */
    --tcs-ocre-dark:    #9E9A72;
    --tcs-danger-dark:  #8A3F3F;

    /* Z-index layers */
    --z-schedule-now:   2;
    --z-login-error:    10;
    --z-topbar:         100;
    --z-mobile-nav:     999;
    --z-modal:          1000;
    --z-toast:          2000;
    --z-skip-link:      9999;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease-out;
}


/* ── 2. Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
    /* En iOS PWA, el rubber-band overscroll arriba/abajo muestra el bg del <html>.
       Lo ponemos pardo para que matchee con topbar y bottom nav. */
    background: var(--tcs-pardo);
}
/* Mata zoom por doble-tap en iOS Safari sin perder pinch-zoom */
button, input, select, textarea, a, label, [role="button"] { touch-action: manipulation; }

body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 15px;
    line-height: 1.6;
    color: var(--tcs-pardo);
    background: var(--tcs-ivory);
    min-height: 100vh;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 300;
    line-height: 1.25;
    color: var(--tcs-pardo);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; font-weight: 400; }

a {
    color: var(--tcs-ocre);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--tcs-pardo); }

img { max-width: 100%; height: auto; }

/* ── 3. Layout ── */

/* Topbar (not sidebar — this is a kiosk/shared PC app) */
.topbar {
    background: var(--tcs-pardo);
    color: var(--tcs-ivory);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    height: 56px;
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    /* Pinta el área de overscroll/rubber-band arriba con el mismo pardo */
    box-shadow: 0 -50vh 0 50vh var(--tcs-pardo), var(--shadow-topbar);
}

.topbar-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--tcs-ivory);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.topbar-brand small {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--tcs-ocre);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9rem;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--tcs-ocre);
    color: var(--tcs-pardo);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.topbar-time {
    font-family: var(--font-condensed);
    font-size: 0.85rem;
    color: var(--tcs-gris);
}

/* ── Admin desktop nav: agrupada con dropdowns ── */
.adm-nav {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 0.85rem;
    font-family: var(--font-body);
}
.adm-link {
    color: var(--tcs-gris);
    text-decoration: none;
    padding: 4px 0;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    transition: color 0.12s;
    white-space: nowrap;
}
.adm-link:hover { color: var(--tcs-ivory); }
.adm-link.is-active { color: var(--tcs-ocre); }

.adm-dropdown { position: relative; }
.adm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.adm-toggle::after {
    content: "";
    display: inline-block;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    opacity: 0.55;
    margin-left: 2px;
    transition: transform 0.15s;
}
.adm-dropdown:hover .adm-toggle::after,
.adm-dropdown:focus-within .adm-toggle::after {
    transform: rotate(180deg);
    opacity: 0.9;
}

.adm-menu {
    position: absolute;
    top: 100%;
    left: -8px;
    margin-top: 6px;
    background: var(--tcs-pardo);
    border: 1px solid rgba(237,234,230,0.12);
    border-radius: var(--radius-sm);
    padding: 6px 0;
    min-width: 200px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 12px 28px rgba(0,0,0,0.35);
    z-index: var(--z-topbar);
}
.adm-dropdown:hover .adm-menu,
.adm-dropdown:focus-within .adm-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
/* Buffer invisible para que el menú no se cierre al cruzar el gap */
.adm-dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
}
.adm-menu a {
    display: block;
    padding: 9px 16px;
    color: var(--tcs-ivory);
    text-decoration: none;
    font-size: 0.86rem;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
}
.adm-menu a:hover {
    background: rgba(255,255,255,0.07);
    color: var(--tcs-ocre);
}
.adm-menu a.is-active {
    color: var(--tcs-ocre);
    background: rgba(177,167,126,0.14);
}

/* En pantallas más angostas el desktop nav se oculta (bottom nav móvil toma el control) */
@media (max-width: 900px) {
    .adm-nav { display: none; }
}

/* Main content area */
.main {
    margin: 0 auto;
    padding: var(--space-8) var(--space-6);
}

.main-wide {
    max-width: 1200px;
}

/* Page header */
.page-header {
    margin-bottom: var(--space-8);
}

.page-header h1 {
    margin-bottom: var(--space-1);
}

.page-header .page-subtitle {
    font-size: 0.9rem;
    color: var(--tcs-pardo-claro);
}


/* ── 4. Components ── */

/* 4.1 Cards */
.card {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.30);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-5);
}

/* Home action cards — larger, with icon */
.action-card {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
    color: inherit;
    display: block;
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    color: inherit;
}

.action-card-icon {
    font-size: 2rem;
    margin-bottom: var(--space-3);
    color: var(--tcs-ocre);
    line-height: 1;
}

.action-card h3 {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: var(--space-1);
}

.action-card p {
    font-size: 0.85rem;
    color: var(--tcs-pardo-claro);
}

/* ── Schedule card — shift bars ── */
.sched-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}
.sched-card-title {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}
.sched-card-date {
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.72rem;
    color: var(--tcs-gris);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sched-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}
.sched-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.sched-bar-name {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--tcs-pardo-claro);
    min-width: 42px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
}
.sched-bar-name.is-me {
    color: var(--tcs-ocre);
    font-weight: 500;
}
.sched-bar-track {
    flex: 1;
    height: 22px;
    background: rgba(169,168,158,0.1);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}
.sched-bar-fill {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    background: var(--tcs-gris);
    display: flex;
    align-items: center;
    padding: 0 6px;
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--tcs-white);
    white-space: nowrap;
    min-width: 28px;
}
.sched-bar-fill.is-me {
    background: var(--tcs-ocre);
}
.sched-time-axis {
    display: flex;
    justify-content: space-between;
    padding: 3px 0 0 0;
    margin-left: 54px;
}
.sched-time-axis span {
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.6rem;
    color: var(--tcs-gris);
    opacity: 0.7;
}
.sched-now-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--tcs-danger);
    z-index: var(--z-schedule-now);
    pointer-events: none;
}
.sched-now-dot {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tcs-danger);
}

/* Card with urgency indicator (left border) */
.card-urgency-high    { border-left: 4px solid var(--tcs-danger); }
.card-urgency-medium  { border-left: 4px solid var(--tcs-warning); }
.card-urgency-low     { border-left: 4px solid var(--tcs-success); }


/* 4.2 Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    min-height: 44px; /* Touch target */
}

.btn-primary {
    background: var(--tcs-ocre);
    color: var(--tcs-pardo);
}
.btn-primary:hover {
    background: var(--tcs-ocre-dark);
    color: var(--tcs-pardo);
}

.btn-secondary {
    background: transparent;
    color: var(--tcs-pardo);
    border: 1px solid var(--tcs-gris);
}
.btn-secondary:hover {
    background: var(--tcs-pardo-05);
}

.btn-danger {
    background: var(--tcs-danger);
    color: var(--tcs-ivory);
}
.btn-danger:hover {
    background: var(--tcs-danger-dark);
    color: var(--tcs-ivory);
}

.btn-ghost {
    background: transparent;
    color: var(--tcs-ocre);
    padding: var(--space-2) var(--space-3);
}
.btn-ghost:hover {
    background: var(--tcs-ocre-10);
    color: var(--tcs-pardo);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1rem;
    min-height: 52px;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.8rem;
    min-height: 40px;
}

.btn-block { width: 100%; }

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


/* 4.3 Forms */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--tcs-pardo);
    margin-bottom: var(--space-1);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--tcs-gris);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--tcs-pardo);
    background: var(--tcs-white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 44px;
}

.form-input:focus {
    outline: none;
    border-color: var(--tcs-ocre);
    box-shadow: 0 0 0 3px var(--tcs-ocre-20);
}

.form-input::placeholder {
    color: var(--tcs-gris);
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}



/* 4.4 Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid rgba(169,168,158,0.25);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background: var(--tcs-pardo);
    color: var(--tcs-ivory);
    font-weight: 500;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid rgba(169,168,158,0.15);
    background: var(--tcs-white);
}

tr:hover td {
    background: var(--tcs-ivory);
}


/* 4.5 Badges & Tags */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success { background: var(--tcs-success-bg); color: var(--tcs-success); }
.badge-warning { background: var(--tcs-warning-bg); color: var(--tcs-warning); }
.badge-danger  { background: var(--tcs-danger-bg);  color: var(--tcs-danger); }
.badge-info    { background: var(--tcs-info-bg);    color: var(--tcs-info); }
.badge-neutral { background: var(--tcs-pardo-05);   color: var(--tcs-pardo-claro); }

/* Notification badge (count) */
.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--tcs-danger);
    color: var(--tcs-white);
    font-size: 0.75rem;
    font-weight: 600;
}


/* 4.6 Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--tcs-pardo-80);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--tcs-white);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-modal);
    transform: translateY(20px);
    transition: transform var(--transition-slow);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}


/* 4.7 Toast Notifications */
.toast {
    position: fixed;
    top: 72px;
    right: var(--space-6);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--tcs-white);
    z-index: var(--z-toast);
    animation: toastIn 300ms ease-out, toastOut 200ms ease-in 2.8s forwards;
    max-width: 360px;
}

.toast-success { background: var(--tcs-success); }
.toast-warning { background: var(--tcs-warning); }
.toast-danger  { background: var(--tcs-danger); }
.toast-info    { background: var(--tcs-info); }


/* ── 5. Page-specific ── */

/* ── 5.1 Login: C1 Clean List ── */

.login-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

/* Top: dark brand zone */
.login-top {
    background: var(--tcs-pardo);
    flex: 0 0 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.login-top::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 10%, var(--tcs-ocre) 50%, transparent 90%);
    opacity: 0.3;
}
.login-logo {
    height: 28px;
    width: auto;
    display: block;
    filter: brightness(0) invert(0.92);
}

/* Bottom: action zone */
.login-bottom {
    background: var(--tcs-ivory);
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
    position: relative;
    min-height: 0;
}

/* Distribute vertical space: content centers, footer stays at bottom (mobile/portrait) */
.login-bottom-inner {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

/* Select label */
.login-select-label {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--tcs-pardo-claro);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

/* User list */
.login-list {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 22px;
    border-radius: 14px;
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    transition: all 200ms;
    text-align: left;
    text-decoration: none;
    color: inherit;
}
.login-row:hover {
    background: var(--tcs-white);
    box-shadow: 0 2px 10px rgba(56,46,44,0.05);
}
.login-row:active {
    background: rgba(177,167,126,0.08);
}

/* Avatar colors by position */
.login-row-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 1px;
    flex-shrink: 0;
    transition: transform 200ms;
}
.login-row:hover .login-row-avatar {
    transform: scale(1.06);
}
/* Avatar palette indexed by data-color-idx (1..6, robusto contra divisores y reorden) */
.login-row[data-color-idx="1"] .login-row-avatar { background: var(--tcs-pardo);       color: var(--tcs-ivory); }
.login-row[data-color-idx="2"] .login-row-avatar { background: var(--tcs-ocre);        color: var(--tcs-white); }
.login-row[data-color-idx="3"] .login-row-avatar { background: var(--tcs-pardo-claro); color: var(--tcs-ivory); }
.login-row[data-color-idx="4"] .login-row-avatar { background: var(--tcs-info);        color: var(--tcs-white); }
.login-row[data-color-idx="5"] .login-row-avatar { background: var(--tcs-success);     color: var(--tcs-white); }
.login-row[data-color-idx="6"] .login-row-avatar { background: var(--tcs-warning);     color: var(--tcs-white); }

/* Separador entre empleados y admins */
.login-list-divider {
    height: 1px;
    background: var(--tcs-gris-claro);
    margin: 12px 22px;
    opacity: 0.6;
}

.login-row-info {
    flex: 1;
}
.login-row-name {
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--tcs-pardo);
}
.login-row-role {
    font-size: 0.9rem;
    color: var(--tcs-gris);
    margin-top: 3px;
}
.login-row-arrow {
    font-size: 0.8rem;
    color: var(--tcs-ocre);
    opacity: 0;
    transform: translateX(-4px);
    transition: all 200ms;
}
.login-row:hover .login-row-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* Last user on this device — subtle ocre accent + small "reciente" chip */
.login-row.is-last-user {
    background: rgba(177,167,126,0.07);
    box-shadow: inset 3px 0 0 var(--tcs-ocre);
}
.login-row.is-last-user .login-row-avatar {
    box-shadow: 0 0 0 3px rgba(177,167,126,0.25);
}
.login-row.is-last-user .login-row-info::after {
    content: 'Último ingreso';
    display: inline-block;
    margin-top: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--tcs-ocre);
    text-transform: uppercase;
}

/* Footer (bottom of viewport) — login-bottom-inner already pushes the footer
   down via flex:1, so the spacer is just legacy markup. Keep it but inert. */
.login-spacer { flex: 0; display: none; }
.login-divider {
    width: 100%;
    max-width: 420px;
    height: 1px;
    background: rgba(169,168,158,0.2);
    margin: 16px 0;
}
.login-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 440px;
}
.login-footer-date {
    font-size: 0.85rem;
    color: var(--tcs-gris);
}
.login-footer-admin {
    font-size: 0.82rem;
    color: var(--tcs-gris);
    text-decoration: none;
    transition: color 200ms;
    letter-spacing: 0.5px;
}
.login-footer-admin:hover { color: var(--tcs-pardo-claro); }

/* ── PIN screen (inline in flex flow) ── */
.login-pin-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.login-back {
    font-size: 0.92rem;
    color: var(--tcs-pardo-claro);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    margin-top: 22px;
    padding: 12px 18px;
    min-height: 44px;
    border-radius: 10px;
    transition: color 200ms, background 200ms;
    text-decoration: none;
    border: none;
    background: none;
    font-family: var(--font-body);
}
.login-back:active { background: rgba(56,46,44,0.04); }
.login-back:hover { color: var(--tcs-pardo); }

/* PIN header: name + label, centered (avatar removed for cleaner kiosk look) */
.login-pin-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 28px;
}
.login-pin-name {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.3rem;
    color: var(--tcs-pardo);
}
.login-pin-label {
    font-size: 0.85rem;
    color: var(--tcs-pardo-claro);
    margin-top: 2px;
}

/* PIN dots */
.pin-display {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    justify-content: center;
}
.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--tcs-pardo-claro);
    background: transparent;
    transition: all 200ms;
}
.pin-dot.filled {
    background: var(--tcs-pardo);
    border-color: var(--tcs-pardo);
    box-shadow: 0 0 8px rgba(56,46,44,0.35);
}
.pin-dot.wrong {
    border-color: var(--tcs-danger);
    background: var(--tcs-danger);
    animation: loginDotShake 400ms ease;
}
.pin-dot.success {
    background: var(--tcs-success);
    border-color: var(--tcs-success);
    transform: scale(1.25);
    box-shadow: 0 0 12px rgba(90,122,90,0.45);
    transition: background 200ms ease, border-color 200ms ease, transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 200ms ease;
}

/* While the PIN is being validated by the server, gently pulse the filled dots
   in a wave (left → right) so the user knows something's happening. */
.pin-display.is-checking .pin-dot {
    animation: pinChecking 900ms ease-in-out infinite;
}
.pin-display.is-checking .pin-dot:nth-child(1) { animation-delay: 0ms; }
.pin-display.is-checking .pin-dot:nth-child(2) { animation-delay: 110ms; }
.pin-display.is-checking .pin-dot:nth-child(3) { animation-delay: 220ms; }
.pin-display.is-checking .pin-dot:nth-child(4) { animation-delay: 330ms; }
@keyframes pinChecking {
    0%, 100% { transform: scale(1);    opacity: 1; }
    50%      { transform: scale(0.78); opacity: 0.55; }
}

/* When PIN is verified by server, fade dots out and draw a thin checkmark */
.pin-display { position: relative; min-height: 16px; }
.pin-display.to-success .pin-dot {
    opacity: 0;
    transition: opacity 200ms ease;
}
.pin-check-svg {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 40px;
    height: 40px;
    color: var(--tcs-success);
    transform-origin: center;
    animation: pinCheckIn 380ms cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}
.pin-check-svg circle {
    stroke-dasharray: 64;
    stroke-dashoffset: 64;
    animation: pinDraw 280ms ease-out forwards;
}
.pin-check-svg polyline {
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: pinDraw 220ms ease-out 220ms forwards;
}
@keyframes pinCheckIn {
    0%   { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes pinDraw {
    to { stroke-dashoffset: 0; }
}

/* Subtle "loading home" handoff after a successful PIN.
   The login content gently dims while a thin ocre progress bar
   slides across the top until the next page takes over. */
body.login-redirecting .login-top-inner,
body.login-redirecting .login-top-foot,
body.login-redirecting .login-bottom-inner {
    opacity: 0.45;
    transition: opacity 350ms ease;
}
body.login-redirecting::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0;
    background: var(--tcs-ocre);
    z-index: 99999;
    pointer-events: none;
    animation: loginHandoffBar 1400ms cubic-bezier(0.1, 0.7, 0.3, 0.95) forwards;
}
@keyframes loginHandoffBar {
    0%   { width: 0%;  opacity: 1; }
    70%  { width: 70%; opacity: 1; }
    100% { width: 92%; opacity: 1; }
}
@keyframes loginDotShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* PIN pad */
.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 280px;
    width: 100%;
    margin: 0 auto;
}
.pin-key {
    aspect-ratio: 1.25;
    border-radius: 12px;
    border: 1px solid rgba(56,46,44,0.06);
    background: var(--tcs-ivory);
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.5rem;
    color: var(--tcs-pardo);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 120ms;
    user-select: none;
}
.pin-key:hover { background: rgba(177,167,126,0.12); }
.pin-key:active { transform: scale(0.92); background: rgba(177,167,126,0.2); }
.pin-key-fn {
    font-family: var(--font-body);
    font-size: 0.62rem;
    font-weight: 500;
    color: var(--tcs-pardo-claro);
    background: transparent;
    border-color: transparent;
}
.pin-key-fn:hover { color: var(--tcs-pardo); background: rgba(56,46,44,0.03); }

/* Error toast */
.login-error {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(158,75,75,0.95);
    color: var(--tcs-white);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    text-align: center;
    z-index: var(--z-login-error);
    white-space: nowrap;
    animation: loginErrorIn 300ms ease, loginErrorOut 400ms ease 6s forwards;
}
@keyframes loginErrorIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes loginErrorOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(-8px); pointer-events: none; }
}
@keyframes loginSlideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Admin form */
.login-admin-form {
    max-width: 320px;
    width: 100%;
    animation: loginSlideUp 350ms ease forwards;
}
.login-admin-form .form-group { margin-bottom: 16px; }
.login-admin-form label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--tcs-pardo-claro);
    margin-bottom: 6px;
}
.login-admin-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid rgba(169,168,158,0.3);
    border-radius: var(--radius-sm);
    background: var(--tcs-white);
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--tcs-pardo);
    outline: none;
    transition: border-color 200ms, box-shadow 200ms;
}
.login-admin-form input:focus {
    border-color: var(--tcs-ocre);
    box-shadow: 0 0 0 3px var(--tcs-ocre-20);
}
.login-admin-form input::placeholder { color: var(--tcs-gris); }
.login-admin-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--tcs-pardo);
    color: var(--tcs-ivory);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 200ms;
    margin-top: 8px;
}
.login-admin-btn:hover { background: var(--tcs-ocre); color: var(--tcs-pardo); }
.login-admin-btn:active { transform: scale(0.98); }

/* ── Tablet/desktop: side by side ── */
@media (min-width: 768px) {
    .login-wrapper {
        flex-direction: row;
    }
    .login-top {
        flex: 0 0 40%;
        min-height: 100vh;
        min-height: 100dvh;
    }
    .login-top::after {
        top: 10%;
        bottom: 10%;
        left: auto;
        right: -1px;
        width: 2px;
        height: auto;
        background: linear-gradient(180deg, transparent 10%, var(--tcs-ocre) 50%, transparent 90%);
    }
    .login-logo {
        height: 34px;
    }
    .login-bottom {
        justify-content: center;
        padding: 40px 40px 64px;
    }
    .login-bottom::before { content: ''; flex: 1; }
    .login-divider { max-width: 400px; }
    .login-footer { max-width: 400px; }
}

/* New elements (desktop-only by default; revealed via media query) */
.login-top-inner { display: contents; }
.login-top-foot, .login-tagline, .login-heading { display: none; }

/* ── Smooth transition between user list view and PIN view ── */
.login-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease, transform 220ms ease;
}
.login-view[hidden] { display: none !important; }
.login-view.is-out {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}
.login-view.is-in {
    opacity: 0;
    transform: translateY(-8px);
}

/* ── Desktop ≥ 1024px (covers 1280, 1600, 1920) ── */
@media (min-width: 1024px) {
    .login-wrapper {
        flex-direction: row;
        min-height: 100vh;
        min-height: 100dvh;
    }

    /* Left dark panel: brand + tagline + footer */
    .login-top {
        flex: 0 0 50%;
        max-width: none;
        position: relative;
        background:
            radial-gradient(circle at 30% 25%, rgba(177,167,126,0.10) 0%, transparent 55%),
            radial-gradient(circle at 70% 80%, rgba(177,167,126,0.06) 0%, transparent 50%),
            var(--tcs-pardo);
        padding: 36px 40px 24px;
        flex-direction: column;
        align-items: stretch;
        justify-content: space-between;
    }
    .login-top-inner {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        width: fit-content;
        align-self: center;
        flex: 1;
        gap: 24px;
    }
    .login-top-foot { text-align: center; }
    .login-logo { height: 38px; }
    .login-tagline {
        display: block;
        font-family: var(--font-display);
        font-weight: 300;
        font-size: 1.05rem;
        color: rgba(237,234,230,0.7);
        letter-spacing: 0.5px;
        line-height: 1.3;
    }
    .login-top-foot {
        display: block;
        font-family: var(--font-body);
        font-size: 0.78rem;
        color: rgba(237,234,230,0.45);
        letter-spacing: 0.4px;
        text-transform: lowercase;
    }

    /* Right ivory panel: heading + list */
    .login-bottom {
        flex: 1;
        padding: 32px 48px;
        align-items: center;
        justify-content: center;
    }
    .login-bottom::before { display: none; }
    .login-bottom-inner {
        width: 100%;
        max-width: 420px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .login-heading {
        display: block;
        margin-bottom: 18px;
        text-align: left;
    }
    .login-heading h1 {
        font-family: var(--font-display);
        font-weight: 300;
        font-size: 1.7rem;
        line-height: 1.1;
        color: var(--tcs-pardo);
        margin: 0 0 4px;
    }
    .login-heading p {
        font-size: 0.85rem;
        color: var(--tcs-pardo-claro);
        margin: 0;
    }

    /* Hide the "Seleccioná tu perfil" mini label (heading replaces it) */
    .login-select-label { display: none; }

    /* Tighter list */
    .login-list { max-width: 420px; gap: 2px; }
    .login-row { padding: 10px 14px; gap: 14px; border-radius: 10px; }
    .login-row-avatar { width: 42px; height: 42px; font-size: 0.85rem; }
    .login-row-name { font-size: 0.95rem; }
    .login-row-role { font-size: 0.78rem; }

    /* Hide the mobile footer (date moved to dark panel) */
    .login-divider { display: none; }
    .login-footer { display: none; }
    .login-spacer { display: none; }

    /* PIN screen: compact polished spacing on desktop */
    .login-pin-screen { max-width: 300px; }
    .login-pin-header { margin-bottom: 22px; gap: 12px; }
    .login-pin-avatar { width: 54px; height: 54px; font-size: 0.95rem; }
    .login-pin-name { font-size: 1.15rem; }
    .login-pin-label { font-size: 0.78rem; }
    .pin-display { gap: 12px; margin-bottom: 22px; }
    .pin-dot { width: 13px; height: 13px; }
    .pin-pad { max-width: 260px; gap: 8px; }
    .pin-key { font-size: 1.25rem; border-radius: 11px; }
    .pin-key-fn { font-size: 0.6rem; }
}

/* Extra polish at 1440+ */
@media (min-width: 1440px) {
    .login-top { padding: 48px 56px 32px; flex-basis: 50%; max-width: none; }
    .login-logo { height: 46px; }
    .login-tagline { font-size: 1.2rem; }
    .login-bottom { padding: 48px 64px; }
    .login-heading h1 { font-size: 2rem; }
    .login-bottom-inner { max-width: 460px; }
}

/* 5.2 Home */
.home-greeting {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin-bottom: var(--space-1);
}

.home-date {
    color: var(--tcs-pardo-claro);
    font-size: 0.9rem;
    margin-bottom: var(--space-8);
}

.home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
}

.home-grid .action-card:first-child {
    grid-column: 1 / -1; /* Fichaje card spans full width */
}

/* 5.3 Fichaje Widget (compact, inline on Home) */
.fichaje-compact {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-base);
    padding: var(--space-3) var(--space-4);
}

.fc-main {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.fc-info {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    min-width: 0;
}

.fc-status {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--tcs-pardo);
    white-space: nowrap;
}

.fc-entry {
    font-size: 0.8rem;
    color: var(--tcs-pardo-claro);
    white-space: nowrap;
}

.fc-timer {
    font-family: var(--font-body);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--tcs-pardo);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
    white-space: nowrap;
}

.fc-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.fc-done {
    font-size: 0.8rem;
    color: var(--tcs-success);
    font-weight: 500;
    white-space: nowrap;
}

.fc-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px solid rgba(169,168,158,0.15);
}

.fc-timeline:empty {
    display: none;
}

.fc-evt {
    font-size: 0.75rem;
    color: var(--tcs-pardo-claro);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

/* 5.4 Clock page (standalone) */
.clock-widget {
    background: var(--tcs-white);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    border: 1px solid rgba(169,168,158,0.25);
}

.clock-time {
    font-family: var(--font-body);
    font-size: 3rem;
    font-weight: 500;
    color: var(--tcs-pardo);
    margin-bottom: var(--space-2);
}

.clock-status {
    font-size: 0.9rem;
    color: var(--tcs-pardo-claro);
    margin-bottom: var(--space-6);
}

.clock-actions {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
    flex-wrap: wrap;
}

/* 5.4 Tasks */
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.task-card {
    background: var(--tcs-white);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(169,168,158,0.25);
    transition: all var(--transition-fast);
}

.task-card.completed {
    opacity: 0.5;
}

.task-info h4 {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: var(--space-1);
}

.task-meta {
    font-size: 0.875rem;
    color: var(--tcs-pardo-claro);
    display: flex;
    gap: var(--space-4);
}

.task-urgency {
    font-family: var(--font-condensed);
    font-size: 0.8rem;
    font-weight: 600;
}


/* ── 5.5 SVG Icons ── */
.tcs-icon {
    flex-shrink: 0;
    vertical-align: middle;
}

/* ── 6. Utilities ── */
.text-muted { color: var(--tcs-pardo-claro); }
.text-ocre  { color: var(--tcs-ocre); }
.text-sm    { font-size: 0.85rem; }
.text-xs    { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-display { font-family: var(--font-display); }
.font-condensed { font-family: var(--font-condensed); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }

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


/* ── 7. Animations ── */
@keyframes toastIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
    from { opacity: 1; }
    to   { opacity: 0; transform: translateY(-10px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes checkPop {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Staggered card entrance */
.card-grid > *,
.home-grid > *,
.task-list > * {
    animation: fadeIn var(--transition-slow) both;
}
.card-grid > *:nth-child(1), .home-grid > *:nth-child(1), .task-list > *:nth-child(1) { animation-delay: 0ms; }
.card-grid > *:nth-child(2), .home-grid > *:nth-child(2), .task-list > *:nth-child(2) { animation-delay: 50ms; }
.card-grid > *:nth-child(3), .home-grid > *:nth-child(3), .task-list > *:nth-child(3) { animation-delay: 100ms; }
.card-grid > *:nth-child(4), .home-grid > *:nth-child(4), .task-list > *:nth-child(4) { animation-delay: 150ms; }
.card-grid > *:nth-child(5), .home-grid > *:nth-child(5), .task-list > *:nth-child(5) { animation-delay: 200ms; }
.card-grid > *:nth-child(n+6), .task-list > *:nth-child(n+6) { animation-delay: 250ms; }


/* ── 7.5 Mobile Bottom Nav (admin, ≤640px only) ── */
.mobile-bottom-nav {
    display: none; /* Hidden on desktop */
}

/* ── 8. Media Queries ── */

/* --- Safe area insets for notched phones --- */
@supports (padding-top: env(safe-area-inset-top)) {
    .topbar {
        height: calc(56px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
        padding-left: max(var(--space-6), env(safe-area-inset-left));
        padding-right: max(var(--space-6), env(safe-area-inset-right));
    }
    .main {
        padding-left: max(var(--space-6), env(safe-area-inset-left));
        padding-right: max(var(--space-6), env(safe-area-inset-right));
    }
    @media (max-width: 1023px) {
        .login-top {
            flex-basis: calc(180px + env(safe-area-inset-top));
            padding-top: env(safe-area-inset-top);
            padding-left: env(safe-area-inset-left);
            padding-right: env(safe-area-inset-right);
        }
    }
}

/* --- Reduced motion: disable shake / pulse / handoff for users who opt out --- */
@media (prefers-reduced-motion: reduce) {
    .pin-dot,
    .pin-display.is-checking .pin-dot,
    .pin-display.to-success .pin-dot,
    .pin-check-svg,
    .pin-check-svg circle,
    .pin-check-svg polyline,
    body.login-redirecting::before,
    .login-error,
    .login-row,
    .login-row-arrow,
    .login-row:hover .login-row-avatar,
    .login-view {
        animation: none !important;
        transition: opacity 100ms ease, color 100ms ease !important;
    }
    .pin-dot.wrong { animation: none !important; }
}

/* --- Landscape on small phones: compress brand zone, tighten gaps --- */
@media (orientation: landscape) and (max-height: 500px) {
    .login-wrapper { flex-direction: row; }
    .login-top {
        flex: 0 0 35%;
        min-height: 100dvh;
        flex-basis: 35%;
    }
    .login-bottom { padding: 16px 18px; min-height: 100dvh; }
    .login-pin-header { margin-bottom: 14px; gap: 12px; }
    .login-pin-avatar { width: 48px; height: 48px; font-size: 0.95rem; }
    .login-pin-name { font-size: 1.1rem; }
    .pin-display { gap: 12px; margin-bottom: 14px; }
    .pin-pad { max-width: 280px; gap: 8px; }
    .pin-key { font-size: 1.4rem; min-height: 48px; }
    .login-back { margin-top: 10px; }
    .login-divider, .login-footer { display: none; }
}

/* --- Tablet (768px) --- */
@media (max-width: 768px) {
    .sched-bar-name { min-width: 34px; font-size: 0.72rem; }
    .sched-time-axis { margin-left: 46px; }
    .sched-card-date { display: none; }
    .home-grid {
        gap: var(--space-4);
    }

    .card {
        padding: var(--space-5);
    }

    .modal {
        max-width: 90%;
        padding: var(--space-6);
    }

    .fc-timer {
        font-size: 1.3rem;
    }

    .topbar-right nav {
        gap: var(--space-3) !important;
        font-size: 0.8rem !important;
    }
}

/* --- Mobile (640px and below) --- */
@media (max-width: 640px) {
    /* Topbar */
    .topbar {
        padding: 0 var(--space-3);
        height: 48px;
        flex-wrap: wrap;
    }

    .topbar-brand {
        font-size: 0.95rem;
    }

    .topbar-brand small {
        display: none;
    }

    .topbar-right {
        gap: var(--space-2);
    }

    .topbar-right nav {
        display: none !important;    /* Hide admin nav on mobile */
    }

    .topbar-time {
        display: none;
    }

    .topbar-user span {
        display: none;              /* Hide user name, keep avatar */
    }

    .topbar-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
    }

    /* Main */
    .main {
        padding: var(--space-4) var(--space-3);
    }

    /* Cards */
    .home-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: var(--space-4);
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    /* Fichaje compact widget */
    .fc-main {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .fc-info {
        flex: 1 1 auto;
        min-width: 0;
    }

    .fc-timer {
        font-size: 1.2rem;
        margin-left: 0;
    }

    .fc-actions {
        width: 100%;
        order: 3;
    }

    .fc-actions .btn {
        flex: 1;
    }

    /* Task cards */
    .task-card {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .task-card .btn,
    .task-card .btn-ghost {
        align-self: stretch;
        text-align: center;
    }

    /* Tables */
    .table-container {
        margin-left: calc(-1 * var(--space-3));
        margin-right: calc(-1 * var(--space-3));
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: var(--space-2) var(--space-3);
    }

    /* Clock page */
    .clock-time {
        font-size: 2.5rem;
    }

    .clock-widget {
        padding: var(--space-5);
    }

    /* Modals */
    .modal {
        width: 95%;
        max-width: 95%;
        padding: var(--space-5);
    }

    /* Forms — prevent iOS zoom on focus */
    /* iOS Safari hace zoom al focusear inputs <16px. Forzamos mínimo 16px en TODOS
       los inputs en mobile, incluso los con clases específicas (más especificidad). */
    .form-input,
    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="number"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea,
    .stk-add-input,
    .stk-spotbar-i,
    .stk-search input,
    .stk-reason-sel {
        font-size: 16px !important;
    }

    /* Login — C1 Clean List Mobile */
    .login-top { flex: 0 0 150px; }
    .login-logo { height: 24px; }
    .login-row { padding: 16px 18px; }
    .login-row-avatar { width: 54px; height: 54px; font-size: 0.95rem; }
    .pin-pad { max-width: 360px; gap: 12px; }
    .pin-key { font-size: 1.85rem; aspect-ratio: 1; border-radius: 14px; }
    .pin-key-fn { font-size: 0.78rem; }
    .login-pin-avatar { width: 64px; height: 64px; font-size: 1.1rem; }
    .login-pin-name { font-size: 1.5rem; }
    .login-pin-label { font-size: 0.95rem; }
    .pin-display { gap: 16px; margin-bottom: 28px; }
    .pin-dot { width: 16px; height: 16px; }

    /* Page header */
    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Toasts */
    .toast {
        left: var(--space-3);
        right: var(--space-3);
        max-width: none;
    }

    /* Ensure touch targets */
    .btn, .btn-ghost, .pin-key {
        min-height: 44px;
    }

    /* Mobile bottom nav — scrollable horizontal con items de tamaño fijo */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--tcs-pardo);
        border-top: 1px solid rgba(255,255,255,0.08);
        z-index: var(--z-mobile-nav);
        padding: 6px 14px;
        padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;  /* Firefox */
        justify-content: space-around;
        /* iOS Safari: forzar capa propia para que <video> autoplay no rompa el position:fixed */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: transform;
    }
    .mobile-bottom-nav::-webkit-scrollbar { display: none; }

    .mbn-item {
        flex: 1 1 0;             /* reparten el ancho del viewport */
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 6px 6px;
        text-decoration: none;
        color: rgba(237,234,230,0.65);
        font-size: 0.7rem;
        font-weight: 500;
        min-height: 52px;
        justify-content: center;
        transition: color var(--transition-fast), background var(--transition-fast);
        white-space: nowrap;
        border-radius: 8px;
        margin: 0 1px;
        /* Reset button (el botón "Más" usa la misma clase) */
        background: transparent;
        border: none;
        cursor: pointer;
        font-family: var(--font-body);
        -webkit-tap-highlight-color: transparent;
    }

    .mbn-item:active,
    .mbn-item:hover {
        color: var(--tcs-ocre);
    }

    .mbn-active {
        color: var(--tcs-ocre);
        background: rgba(177,167,126,0.12);
    }
    .mbn-active .mbn-icon {
        position: relative;
    }
    .mbn-active .mbn-icon::after {
        content: "";
        position: absolute;
        bottom: -5px;
        left: 50%;
        transform: translateX(-50%);
        width: 18px; height: 2px;
        border-radius: 2px;
        background: var(--tcs-ocre);
    }

    .mbn-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        width: 24px;
        height: 24px;
    }
    .mbn-icon svg { stroke-width: 2; }

    .mbn-label {
        font-family: var(--font-body);
        letter-spacing: 0.02em;
        font-size: 0.68rem;
    }

    /* Bottom nav fija ocupa ~64px (mbn-item min-height 52px + 6px padding top + 6px padding bottom).
       En iPhones con home indicator, el safe-area-inset-bottom (~34px) se suma al padding del nav.
       Damos ~76px + safe-area al .main + .container para que el último contenido no quede tapado. */
    .main, .container {
        padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    }
}

/* --- Very small screens (375px and below) --- */
@media (max-width: 375px) {
    .main {
        padding: var(--space-3) var(--space-2);
    }

    .topbar {
        padding: 0 var(--space-2);
    }

    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.15rem; }

    .fc-timer {
        font-size: 1.1rem;
    }

    .action-card {
        padding: var(--space-4);
    }

    .action-card-icon {
        font-size: 1.5rem;
    }
}

/* --- Desktop / Kiosk (1024px+) --- */
@media (min-width: 1024px) {
    .topbar {
        padding: 0 var(--space-8);
    }
    .main {
        padding: var(--space-10) var(--space-8);
    }
}

/* ============================================================ */
/* STOCK / CONTEO DE INVENTARIO                                  */
/* ============================================================ */

/* Product row */
.stk-row {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.2);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
    border-left: 3px solid transparent;
}
.stk-row.counted {
    border-left-color: var(--tcs-success);
    background: linear-gradient(90deg, var(--tcs-success-bg) 0%, var(--tcs-white) 35%);
}
.stk-row-info { flex: 1; min-width: 0; }
.stk-row-name { font-size: 0.88rem; font-weight: 500; word-break: break-word; line-height: 1.3; }
.stk-row-meta {
    font-size: 0.7rem; color: var(--tcs-pardo-claro); margin-top: 3px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.stk-row-code { font-family: monospace; font-size: 0.7rem; letter-spacing: 0.5px; }
.stk-row-suc {
    font-size: 0.65rem; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase;
    padding: 2px 8px; border-radius: 3px; white-space: nowrap;
}

/* Count controls (+/- buttons) */
.stk-controls { display: flex; align-items: center; flex-shrink: 0; }
.stk-btn {
    width: 40px; height: 40px;
    border: 1.5px solid rgba(169,168,158,0.3);
    border-radius: 50%;
    background: var(--tcs-ivory-warm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--tcs-pardo-claro);
    font-size: 18px; font-weight: 500;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.stk-btn:active {
    background: var(--tcs-ocre); color: var(--tcs-white);
    border-color: var(--tcs-ocre); transform: scale(0.88);
}
.stk-val { width: 48px; text-align: center; }
.stk-val input {
    width: 48px; text-align: center; border: none; background: none;
    font-family: var(--font-body); font-size: 1.15rem; font-weight: 600;
    color: var(--tcs-pardo); outline: none; -moz-appearance: textfield;
}
.stk-val input::-webkit-inner-spin-button,
.stk-val input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stk-val input.has { color: var(--tcs-ocre); }

/* Group header */
.stk-group {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; cursor: pointer;
    margin: 16px 0 0; background: var(--tcs-pardo);
    -webkit-tap-highlight-color: transparent;
}
.stk-group:first-of-type { margin-top: 6px; }
.stk-group-title {
    font-family: var(--font-body); font-size: 0.82rem; font-weight: 600;
    letter-spacing: 0.3px; text-transform: uppercase; color: var(--tcs-ivory); flex: 1;
}
.stk-group-badge {
    font-size: 0.72rem; font-weight: 600; color: var(--tcs-ocre);
    background: rgba(177,167,126,0.15); padding: 2px 10px; border-radius: 4px;
    letter-spacing: 0.3px;
}

/* Progress bar */
.stk-progress { height: 5px; background: rgba(169,168,158,0.2); border-radius: 3px; overflow: hidden; }
.stk-progress-fill {
    height: 100%; background: linear-gradient(90deg, var(--tcs-ocre), var(--tcs-success));
    border-radius: 3px; transition: width 0.5s ease; position: relative; overflow: hidden;
}
.stk-progress-fill::after {
    content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: stk-shimmer 3s ease-in-out infinite;
}
@keyframes stk-shimmer { 0% { left: -60%; } 100% { left: 160%; } }

/* Stats grid */
.stk-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 14px 0; }
.stk-stat {
    background: var(--tcs-white); padding: 16px 8px; text-align: center;
    border-radius: var(--radius-md); box-shadow: var(--shadow-card);
    border: 1px solid rgba(169,168,158,0.15);
}
.stk-stat-n {
    font-family: var(--font-body); font-size: 1.8rem; font-weight: 500;
    line-height: 1; margin-bottom: 4px;
}
.stk-stat-n.g { color: var(--tcs-success); }
.stk-stat-n.r { color: var(--tcs-danger); }
.stk-stat-n.y { color: var(--tcs-warning); }
.stk-stat-l {
    font-size: 0.68rem; color: var(--tcs-pardo-claro);
    text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500;
}

/* Filter pills */
.stk-pills { display: flex; gap: 5px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 1px 0; }
.stk-pills::-webkit-scrollbar { display: none; }
.stk-pill {
    padding: 5px 10px; font-family: var(--font-body); font-size: 0.68rem;
    font-weight: 500; letter-spacing: 0.2px; text-transform: uppercase;
    white-space: nowrap; border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-sm); background: var(--tcs-white);
    color: var(--tcs-pardo-claro); cursor: pointer;
    transition: all var(--transition-fast); -webkit-tap-highlight-color: transparent;
}
.stk-pill.on {
    background: var(--tcs-pardo); color: var(--tcs-ocre);
    border-color: var(--tcs-pardo); font-weight: 600;
}
.stk-pill-sep {
    width: 1px; align-self: stretch;
    background: rgba(169,168,158,0.3);
    margin: 4px 4px;
    flex-shrink: 0;
}

/* Progress card */
.stk-prog-card {
    position: relative;
    background: var(--tcs-white); border: 1px solid rgba(169,168,158,0.2);
    border-radius: var(--radius-md); padding: 8px 12px; box-shadow: var(--shadow-card);
    margin: 6px 0;
}
.stk-prog-row {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 0.74rem; color: var(--tcs-pardo-claro); margin-bottom: 5px; font-weight: 400;
}
.stk-prog-pct { font-family: var(--font-body); color: var(--tcs-pardo); font-weight: 600; font-size: 0.88rem; }
.stk-prog-sub { font-size: 0.72rem; color: var(--tcs-pardo-claro); }
.stk-prog-bottom {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 5px; gap: 10px;
}
.stk-prog-review-btn {
    background: var(--tcs-pardo); color: var(--tcs-ivory);
    border: none; border-radius: 5px;
    padding: 5px 11px;
    font-family: var(--font-body); font-size: 0.78rem; font-weight: 600;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background var(--transition-fast), transform var(--transition-fast);
    flex-shrink: 0;
}
.stk-prog-review-btn:active { transform: scale(0.97); background: var(--tcs-ocre); }
.stk-prog-review-btn:disabled { background: rgba(56,46,44,0.25); color: rgba(237,234,230,0.6); cursor: default; }

/* Save status — chip inline en bottom row del progress card.
   Espacio reservado constante (min-width) → aparición/desaparición sin layout shift. */
.stk-save-chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.66rem; font-weight: 500;
    color: var(--tcs-pardo-claro);
    min-width: 80px;
    height: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: center;
}
.stk-save-chip.saving,
.stk-save-chip.saved,
.stk-save-chip.offline { opacity: 1; }
.stk-save-chip.saving { color: var(--tcs-warning); }
.stk-save-chip.saved { color: var(--tcs-success); }
.stk-save-chip.offline { color: var(--tcs-danger); }
.stk-save-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.stk-save-chip.saving .stk-save-dot { animation: stk-pulse 1.5s ease infinite; }
.stk-save-chip .stk-save-txt { white-space: nowrap; }
@keyframes stk-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Banner de sesión expirada — sticky bajo topbar */
.stk-auth-banner {
    position: sticky;
    top: 56px;
    z-index: 95;
    background: var(--tcs-danger);
    color: var(--tcs-ivory);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 14px rgba(158,75,75,0.35);
    margin-bottom: 8px;
    line-height: 1.35;
}
.stk-auth-banner:active { background: rgba(158,75,75,0.85); }
.stk-auth-banner strong { font-weight: 700; }
.stk-auth-pending {
    display: block;
    font-size: 0.74rem;
    font-weight: 400;
    margin-top: 4px;
    opacity: 0.92;
}

/* Variety color dot */
.stk-vdot {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 5px; vertical-align: middle; flex-shrink: 0;
}

/* Search */
.stk-search {
    position: sticky;
    top: 56px;
    z-index: 90;
    margin: 8px -4px;
    padding: 6px 4px;
    display: flex; gap: 8px;
    background: var(--tcs-ivory-warm);
}
.stk-search input {
    flex: 1; min-width: 0;
    padding: 10px 14px; background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25); border-radius: var(--radius-sm);
    color: var(--tcs-pardo); font-size: 0.88rem; font-weight: 400;
    font-family: var(--font-body); outline: none; box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast);
}
.stk-search input:focus { border-color: var(--tcs-ocre); box-shadow: 0 0 0 3px var(--tcs-ocre-20); }
.stk-search input::placeholder { color: var(--tcs-gris); }
.stk-scan-btn {
    flex-shrink: 0;
    width: 44px; height: 44px;
    background: var(--tcs-pardo); color: var(--tcs-ivory);
    border: none; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    box-shadow: var(--shadow-card);
    transition: background var(--transition-fast), transform var(--transition-fast);
}
.stk-scan-btn:active { transform: scale(0.94); background: var(--tcs-ocre); }

.stk-frag-filter {
    flex: 0 0 auto;
    max-width: 145px;
    padding: 10px 26px 10px 10px;
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-sm);
    color: var(--tcs-pardo);
    font-family: var(--font-body); font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23756662' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
    box-shadow: var(--shadow-card);
}
.stk-frag-filter:focus { outline: none; border-color: var(--tcs-ocre); }
@media (max-width: 480px) {
    .stk-frag-filter { max-width: 110px; }
}

/* ============================================================
   BARCODE SCAN OVERLAY
   ============================================================ */
.scan-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: #0a0807;
    display: flex; flex-direction: column;
}
.scan-overlay[hidden] { display: none; }
.scan-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; padding-top: max(14px, env(safe-area-inset-top));
    background: rgba(0,0,0,0.6);
    color: var(--tcs-ivory);
    z-index: 2;
}
.scan-close {
    background: none; border: none;
    width: 36px; height: 36px;
    color: var(--tcs-ivory); font-size: 1.6rem; cursor: pointer;
    border-radius: 50%;
    -webkit-tap-highlight-color: transparent;
}
.scan-close:active { background: rgba(255,255,255,0.1); }
.scan-title { font-family: var(--font-body); font-weight: 600; font-size: 0.95rem; }
.scan-toggle {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.82rem; color: rgba(237,234,230,0.85);
    cursor: pointer; user-select: none;
}
.scan-toggle input { width: 16px; height: 16px; accent-color: var(--tcs-ocre); }
.scan-reader {
    flex: 1; position: relative;
    background: #000;
    overflow: hidden;
}
.scan-reader video {
    width: 100% !important; height: 100% !important;
    object-fit: cover !important;
}
.scan-feedback {
    background: rgba(0,0,0,0.8);
    color: var(--tcs-ivory);
    padding: 16px 20px; padding-bottom: max(16px, env(safe-area-inset-bottom));
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    transition: background var(--transition-fast);
}
.scan-feedback.ok { background: rgba(90,122,90,0.85); }
.scan-feedback.unknown { background: rgba(184,148,62,0.85); }
.scan-feedback.err { background: rgba(158,75,75,0.85); }
.scan-feedback-title { font-family: var(--font-body); font-weight: 600; font-size: 1rem; margin-bottom: 4px; }
.scan-feedback-sub { font-size: 0.82rem; color: rgba(237,234,230,0.8); }
.scan-feedback strong { font-weight: 700; color: var(--tcs-ivory); }

/* ============================================================
   STOCK SPOT BAR — donde estoy contando ahora
   ============================================================ */
.stk-spotbar {
    display: flex; align-items: center; gap: 6px;
    background: var(--tcs-white);
    border: 1px solid rgba(177,167,126,0.3);
    border-left: 3px solid var(--tcs-ocre);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    margin: 6px 0;
    height: 36px;
    box-shadow: var(--shadow-card);
}
.stk-spotbar-l {
    font-size: 0.7rem; color: var(--tcs-pardo-claro);
    font-weight: 500; flex-shrink: 0;
}
.stk-spotbar-i {
    flex: 1; min-width: 0;
    border: none; outline: none;
    background: transparent;
    font-family: var(--font-body); font-size: 0.85rem; font-weight: 500;
    color: var(--tcs-pardo);
}
.stk-spotbar-i::placeholder { color: var(--tcs-gris); font-weight: 400; font-size: 0.82rem; }
.stk-spotbar-sel {
    flex: 1; min-width: 0;
    border: none; outline: none;
    background: transparent;
    font-family: var(--font-body); font-size: 0.85rem; font-weight: 500;
    color: var(--tcs-pardo);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23756662' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 22px;
    cursor: pointer;
}
.stk-spotbar-sel option:disabled { color: var(--tcs-gris); }
.stk-spotbar-clr {
    background: none; border: none;
    width: 24px; height: 24px;
    color: var(--tcs-pardo-claro); font-size: 1.2rem; cursor: pointer;
    border-radius: 50%; line-height: 1;
    -webkit-tap-highlight-color: transparent;
}
.stk-spotbar-clr:active { background: rgba(0,0,0,0.06); }

/* Review card */
.stk-review {
    margin-bottom: 6px; padding: 14px 16px;
    background: var(--tcs-white); border: 1px solid rgba(169,168,158,0.2);
    border-radius: var(--radius-md); box-shadow: var(--shadow-card);
    border-left: 3px solid transparent;
}
.stk-review.ok { border-left-color: var(--tcs-success); }
.stk-review.df { border-left-color: var(--tcs-danger); }
.stk-review-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.stk-review-name { font-size: 0.85rem; font-weight: 500; flex: 1; line-height: 1.4; }
.stk-review-badge {
    font-family: var(--font-body); font-size: 0.68rem; font-weight: 700;
    padding: 3px 10px; letter-spacing: 0.3px; text-transform: uppercase;
    flex-shrink: 0; margin-left: 8px; border-radius: 4px;
}
.stk-review-badge.b-ok { background: var(--tcs-success-bg); color: var(--tcs-success); border: 1px solid rgba(90,122,90,0.2); }
.stk-review-badge.b-neg { background: var(--tcs-danger-bg); color: var(--tcs-danger); border: 1px solid rgba(158,75,75,0.15); }
.stk-review-badge.b-pos { background: var(--tcs-warning-bg); color: var(--tcs-warning); border: 1px solid rgba(184,148,62,0.15); }
.stk-review-badge.b-pn { background: var(--tcs-warning-bg); color: var(--tcs-warning); border: 1px solid rgba(184,148,62,0.15); }
.stk-review-detail { font-size: 0.72rem; color: var(--tcs-pardo-claro); }
.stk-confirm-btn {
    margin-top: 8px; padding: 6px 14px;
    border: 1px solid rgba(169,168,158,0.3); border-radius: 4px;
    background: transparent; font-family: var(--font-body);
    font-size: 0.72rem; font-weight: 600; letter-spacing: 0.2px;
    text-transform: uppercase; color: var(--tcs-pardo-claro); cursor: pointer;
    transition: all var(--transition-fast);
}
.stk-confirm-btn.done { border-color: var(--tcs-success); color: var(--tcs-success); background: var(--tcs-success-bg); }

/* Bottom bar */
.stk-bottom {
    position: sticky; bottom: 0;
    padding: 10px 0 28px;
    background: linear-gradient(to top, var(--tcs-ivory) 60%, transparent);
}
.stk-bottom .btn { width: 100%; }

/* Report card */
.stk-report {
    border: 1px solid rgba(169,168,158,0.2); border-radius: var(--radius-md);
    background: var(--tcs-white); box-shadow: var(--shadow-card);
    padding: 20px; position: relative; overflow: hidden; margin-bottom: 14px;
}
.stk-report::before {
    content: ''; position: absolute; top: -30%; right: -15%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, var(--tcs-ocre-10) 0%, transparent 70%);
    pointer-events: none;
}
.stk-report h2 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 400; position: relative; margin-bottom: 2px; }
.stk-report-suc { font-size: 0.82rem; font-weight: 500; color: var(--tcs-ocre); margin-bottom: 14px; position: relative; }
.stk-report-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--tcs-pardo-claro); position: relative; }

/* Report table */
.stk-table {
    width: 100%; font-size: 0.8rem; border-collapse: collapse;
    background: var(--tcs-white); border: 1px solid rgba(169,168,158,0.2);
    border-radius: var(--radius-md); overflow: hidden;
}
.stk-table th {
    background: var(--tcs-pardo); padding: 10px; text-align: left;
    font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: rgba(237,234,230,0.5);
}
.stk-table td { padding: 10px; border-top: 1px solid rgba(169,168,158,0.15); }

/* ============================================================ */
/* INDEX V2 — DASHBOARD LAYOUT                                   */
/* ============================================================ */

/* ── Top Row: Fichaje + Schedule side by side ── */
.top-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}
.top-row .sched-card-wrap {
    display: flex;
}
.top-row .sched-card-wrap .action-card {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Fichaje Card (.fb) ── */
.fb {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.fb-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.fb-greeting {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.fb-greeting h1 {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.35rem;
    color: var(--tcs-pardo);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    margin: 0;
}
.fb-date {
    font-size: 0.85rem;
    color: var(--tcs-pardo-claro);
    white-space: nowrap;
}
.fb-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 0.82rem;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}
.fb-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    animation: fb-pulse 2s ease-in-out infinite;
}
@keyframes fb-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.fb-pill.working { background: var(--tcs-success-bg); color: var(--tcs-success); }
.fb-pill.working .dot { background: var(--tcs-success); }
.fb-pill.paused { background: var(--tcs-warning-bg); color: var(--tcs-warning); }
.fb-pill.paused .dot { background: var(--tcs-warning); }
.fb-pill.not-started { background: var(--tcs-pardo-05); color: var(--tcs-pardo-claro); }
.fb-pill.not-started .dot { background: var(--tcs-gris); animation: none; }
.fb-pill.finished { background: var(--tcs-pardo-05); color: var(--tcs-pardo-claro); }
.fb-pill.finished .dot { display: none; }

/* Body: timer + divider + actions */
.fb-body {
    display: flex;
    align-items: center;
    gap: 20px;
}
.fb-timer-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.fb-timer {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 2rem;
    color: var(--tcs-pardo);
    letter-spacing: 1px;
    line-height: 1;
}
.fb-timer.muted {
    color: var(--tcs-pardo-claro);
    opacity: 0.6;
}
.fb-timer-label {
    font-size: 0.72rem;
    color: var(--tcs-pardo-claro);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.fb-divider {
    width: 1px;
    height: 40px;
    background: rgba(169,168,158,0.25);
    flex-shrink: 0;
}
.fb-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.fb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-base);
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.fb-btn:hover { opacity: 0.85; }
.fb-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.fb-btn-primary { background: var(--tcs-ocre); color: white; }
.fb-btn-secondary { background: var(--tcs-pardo-05); color: var(--tcs-pardo); }
.fb-btn-danger { background: rgba(158,75,75,0.1); color: var(--tcs-danger); }
.fb-completed {
    font-size: 0.82rem;
    color: var(--tcs-pardo-claro);
    font-weight: 500;
}

/* Timeline: Entrada ──── Salida */
.fb-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(169,168,158,0.12);
}
.fb-evt {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.fb-evt-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--tcs-gris);
    background: transparent;
    flex-shrink: 0;
}
.fb-evt-dot.filled {
    background: var(--tcs-ocre);
    border-color: var(--tcs-ocre);
}
.fb-evt-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.fb-evt-label {
    font-size: 0.72rem;
    color: var(--tcs-pardo-claro);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.fb-evt-time {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--tcs-pardo);
}
.fb-evt-time.pending {
    color: var(--tcs-gris);
}

/* Connection line */
.fb-conn {
    flex: 1;
    height: 2px;
    background: rgba(169,168,158,0.25);
    margin: 0 8px;
    min-width: 20px;
    position: relative;
}
.fb-conn.done {
    background: var(--tcs-ocre);
}
.fb-conn.progress {
    background: rgba(169,168,158,0.2);
    overflow: hidden;
    border-radius: 1px;
}
.fb-conn.progress .fb-conn-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: var(--tcs-ocre);
    border-radius: 1px;
    transition: width 0.5s ease;
}

/* Break badge on timeline */
.fb-pause-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--tcs-warning-bg);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}
.fb-pause-badge-text {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--tcs-warning);
    white-space: nowrap;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}
.left-column { display: flex; flex-direction: column; gap: 20px; }

/* Cards sub-grid */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.section-label {
    font-family: var(--font-body);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 0.75rem;
    color: var(--tcs-pardo-claro);
    margin-bottom: 2px;
    grid-column: 1 / -1;
}

/* Product of the day */
.product-day-card {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.product-day-inner { padding: 20px; }
.product-day-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px;
    color: var(--tcs-ocre); font-weight: 500; margin-bottom: 14px;
}
.product-day-content { display: flex; gap: 16px; align-items: flex-start; }
.product-day-image {
    width: 72px; height: 72px; border-radius: var(--radius-base);
    background: linear-gradient(135deg, var(--tcs-ocre-10), var(--tcs-ocre-20));
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    color: var(--tcs-ocre); overflow: hidden;
}
.product-day-image img { width: 100%; height: 100%; object-fit: cover; }
.product-day-text h4 {
    font-family: var(--font-display); font-weight: 400; font-size: 1.02rem;
    color: var(--tcs-pardo); margin-bottom: 2px;
}
.product-day-text .product-category {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--tcs-ocre); font-weight: 500; margin-bottom: 6px; display: block;
}
.product-day-text p {
    font-size: 0.875rem; color: var(--tcs-pardo-claro); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.product-day-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px; background: var(--tcs-pardo-05);
    border-top: 1px solid rgba(169,168,158,0.15);
}
.product-day-tip {
    font-size: 0.875rem; color: var(--tcs-pardo-claro); font-style: italic;
    display: flex; align-items: center; gap: 6px;
}
.product-day-tip .tip-icon { color: var(--tcs-ocre); flex-shrink: 0; }

/* Feed column (right side) */
.feed-column { display: flex; flex-direction: column; gap: 20px; }
.feed-section {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.feed-header {
    padding: 14px 20px 12px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(169,168,158,0.15);
}
.feed-title {
    font-family: var(--font-display); font-weight: 400; font-size: 0.95rem;
    color: var(--tcs-pardo); display: flex; align-items: center; gap: 8px;
}
.feed-title .icon { color: var(--tcs-ocre); }
.feed-body { padding: 0; }

/* Task items in feed */
/* ── Home tasks table ── */
/* ── Tasks feed redesign ── */
.tf-header {
    padding: 14px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(169,168,158,0.15);
}
.tf-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tf-header-left .icon { color: var(--tcs-ocre); display: flex; }
.tf-header-left h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--tcs-pardo);
    margin: 0;
}
.tf-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.tf-progress-ring {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.tf-progress-ring svg { transform: rotate(-90deg); }
.tf-progress-ring .ring-bg {
    fill: none;
    stroke: rgba(169,168,158,0.15);
    stroke-width: 3;
}
.tf-progress-ring .ring-fill {
    fill: none;
    stroke: var(--tcs-ocre);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease;
}
.tf-progress-ring .ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--tcs-pardo);
}
.tf-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px 4px;
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tcs-gris);
}
.tf-group-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.tf-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 10px 20px;
    border-bottom: 1px solid rgba(169,168,158,0.08);
    transition: background 0.12s;
}
.tf-item:last-child { border-bottom: none; }
.tf-item:hover { background: rgba(237,234,230,0.4); }
.tf-bar {
    width: 3px;
    min-height: 30px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 2px;
}
.tf-content {
    flex: 1;
    min-width: 0;
}
.tf-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--tcs-pardo);
    line-height: 1.3;
}
.tf-desc {
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--tcs-pardo-claro);
    line-height: 1.4;
    margin-top: 1px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tf-check {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--tcs-gris);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tcs-gris);
    transition: all 0.15s;
    flex-shrink: 0;
    margin-top: 2px;
    -webkit-tap-highlight-color: transparent;
}
.tf-check:hover {
    border-color: var(--tcs-success);
    color: var(--tcs-success);
}
.tf-check.done {
    border-color: var(--tcs-success);
    background: var(--tcs-success);
    color: var(--tcs-white);
}
.tf-item.is-done { opacity: 0.4; }
.tf-item.is-done .tf-name {
    text-decoration: line-through;
    color: var(--tcs-pardo-claro);
}

/* Promo items */
.promo-item {
    display: flex; gap: 12px; padding: 12px 20px;
    border-bottom: 1px solid rgba(169,168,158,0.1);
    transition: background 150ms ease;
}
.promo-item:last-child { border-bottom: none; }
.promo-item:hover { background: var(--tcs-pardo-05); }
.promo-item-content { flex: 1; min-width: 0; }
.promo-item-title {
    font-weight: 400; font-size: 0.88rem; color: var(--tcs-pardo);
    display: flex; align-items: center; gap: 8px;
}
.promo-item-detail { font-size: 0.875rem; color: var(--tcs-pardo-claro); margin-top: 2px; line-height: 1.4; }
.promo-badge {
    font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 10px;
    background: var(--tcs-warning-bg); color: var(--tcs-warning);
    text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.promo-dates { font-size: 0.75rem; color: var(--tcs-gris); white-space: nowrap; margin-top: 2px; }

/* News items */
.news-item {
    display: flex; gap: 12px; padding: 12px 20px;
    border-bottom: 1px solid rgba(169,168,158,0.1);
    cursor: pointer; transition: background 150ms ease;
    text-decoration: none; color: inherit;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: var(--tcs-pardo-05); }
.news-item-content { flex: 1; min-width: 0; }
.news-item-title {
    font-weight: 400; font-size: 0.88rem; color: var(--tcs-pardo);
    display: flex; align-items: center; gap: 8px;
}
.news-item-title.unread { font-weight: 500; }
.news-item-excerpt {
    font-size: 0.875rem; color: var(--tcs-pardo-claro); margin-top: 2px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-item-time { font-size: 0.75rem; color: var(--tcs-gris); white-space: nowrap; margin-top: 2px; }
.badge-unread {
    background: var(--tcs-ocre); color: white;
    font-size: 0.75rem; font-weight: 600; padding: 2px 7px; border-radius: 10px;
    text-transform: uppercase; letter-spacing: 0.3px;
}

/* Dashboard animations */
.dashboard-grid .feed-section,
.dashboard-grid .action-card,
.dashboard-grid .product-day-card {
    animation: dash-fadeIn 300ms ease-out both;
}
@keyframes dash-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.cards-grid .action-card:nth-child(2) { animation-delay: 50ms; }
.cards-grid .action-card:nth-child(3) { animation-delay: 100ms; }
.cards-grid .action-card:nth-child(4) { animation-delay: 150ms; }
.cards-grid .action-card:nth-child(5) { animation-delay: 200ms; }
.feed-column .feed-section:nth-child(1) { animation-delay: 0ms; }
.feed-column .feed-section:nth-child(2) { animation-delay: 80ms; }
.feed-column .feed-section:nth-child(3) { animation-delay: 160ms; }

/* Dashboard responsive */
@media (max-width: 900px) {
    .dashboard-grid {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
    .left-column, .feed-column {
        display: contents;
    }
    .feed-column .feed-section:nth-child(1) { order: 2; width: 100%; } /* Tareas */
    .product-day-card { order: 3; width: 100%; }
    .cards-grid { order: 4; width: 100%; }
    .feed-column .feed-section:nth-child(2) { order: 5; width: 100%; } /* Promos */
    .feed-column .feed-section:nth-child(3) { order: 6; width: 100%; } /* News */
    /* Failsafe: cualquier feed-section dentro del dashboard responsive ocupa full width */
    .dashboard-grid .feed-section { width: 100%; }
    .top-row {
        display: flex;
        flex-direction: column;
        gap: 0;
        background: var(--tcs-white);
        border: 1px solid rgba(169,168,158,0.25);
        border-radius: var(--radius-lg);
        overflow: hidden;
    }
    /* Admin: las dos cards (Ventas hoy + Schedule) NO son del mismo tipo de info,
       no deben verse mergeadas. Mantenerlas como cards independientes con gap. */
    .top-row.admin-mode {
        background: transparent;
        border: none;
        border-radius: 0;
        overflow: visible;
        gap: var(--space-4);
    }
    .top-row.admin-mode .vd-home-card,
    .top-row.admin-mode .sched-card-wrap .action-card {
        border: 1px solid rgba(169,168,158,0.25);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-card);
    }
    .top-row.admin-mode .vd-home-card { border-left: 3px solid var(--tcs-ocre); }
    .top-row .fb {
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    .top-row .sched-card-wrap .action-card {
        border: none;
        border-radius: 0;
        border-top: 1px solid rgba(169,168,158,0.15);
        box-shadow: none;
    }
    .fb { padding: 16px; }
    .fb-greeting h1 { font-size: 1.2rem; }
    .fb-body { gap: 12px; }
    .fb-actions { flex: 1; flex-direction: column; justify-content: center; }
    .fb-btn { justify-content: center; }
    .fb-timeline { flex-wrap: wrap; gap: 6px; }
    .fb-conn { min-width: 12px; }
}


/* ── Loading States ── */

.is-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}
.is-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin: -9px 0 0 -9px;
    border: 2px solid var(--tcs-gris);
    border-top-color: var(--tcs-ocre);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Accessibility ── */

/* Focus-visible outlines for interactive elements */
.btn:focus-visible,
button:focus-visible,
.login-row:focus-visible,
.action-card:focus-visible,
.pin-key:focus-visible,
a:focus-visible {
    outline: 2px solid var(--tcs-ocre);
    outline-offset: 2px;
}

/* Skip-to-content link (visually hidden until focused) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: var(--z-skip-link);
    font-family: var(--font-body);
    font-size: 0.9rem;
}
.skip-link:focus {
    position: fixed;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    overflow: visible;
    background: var(--tcs-pardo);
    color: var(--tcs-ivory);
    padding: 8px 16px;
    z-index: var(--z-skip-link);
    text-decoration: none;
}


/* ════════════════════════════════════════════════════════
   Fenicio Sync — stock sync between Zureo and Fenicio
   ════════════════════════════════════════════════════════ */

.fenicio-layout { max-width: 960px; margin: 0 auto; }

.step-rail {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
    font-size: 0.78rem;
    color: var(--tcs-gris);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-wrap: wrap;
}
.step-rail-item { display: flex; align-items: center; gap: var(--space-2); }
.step-rail-dot {
    width: 22px; height: 22px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--tcs-gris);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.7rem; font-weight: 500;
    color: var(--tcs-gris);
    background: var(--tcs-white);
}
.step-rail-item.active .step-rail-dot {
    background: var(--tcs-ocre);
    border-color: var(--tcs-ocre);
    color: var(--tcs-pardo);
}
.step-rail-item.active { color: var(--tcs-pardo); font-weight: 500; }
.step-rail-item.done .step-rail-dot {
    background: var(--tcs-pardo);
    border-color: var(--tcs-pardo);
    color: var(--tcs-ivory);
}
.step-rail-line {
    flex: 0 0 auto; width: 32px; height: 1px;
    background: var(--tcs-gris); opacity: 0.4;
}

.fenicio-drops {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
@media (max-width: 640px) { .fenicio-drops { grid-template-columns: 1fr; } }

.dropzone {
    position: relative;
    border: 1.5px dashed rgba(169,168,158,0.5);
    border-radius: var(--radius-md);
    background: var(--tcs-ivory-warm, var(--tcs-ivory));
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: 72px;
}
.dropzone:hover {
    border-color: var(--tcs-ocre);
    background: var(--tcs-white);
}
.dropzone.drag-active {
    border-color: var(--tcs-ocre);
    background: var(--tcs-ocre-10);
    border-style: solid;
}
.dropzone input[type="file"] {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
.dropzone-icon {
    flex: 0 0 auto;
    color: var(--tcs-pardo-claro);
    transition: color var(--transition-fast);
    display: flex;
}
.dropzone:hover .dropzone-icon { color: var(--tcs-ocre); }
.dropzone-body {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
}
.dropzone-title {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.92rem;
    color: var(--tcs-pardo);
    margin: 0; line-height: 1.3;
}
.dropzone-hint {
    font-size: 0.78rem;
    color: var(--tcs-pardo-claro);
    margin: 0; line-height: 1.4;
}
.dropzone-source-tag {
    flex: 0 0 auto;
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tcs-gris);
    padding: 2px 6px;
    border: 1px solid rgba(169,168,158,0.4);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.dropzone.loaded {
    border-style: solid;
    border-color: var(--tcs-success);
    background: var(--tcs-success-bg);
    cursor: default;
}
.dropzone.loaded:hover {
    border-color: var(--tcs-success);
    background: var(--tcs-success-bg);
}
.dropzone.loaded .dropzone-icon,
.dropzone.loaded .dropzone-body,
.dropzone.loaded .dropzone-source-tag { display: none; }
.dropzone.loaded .loaded-check { display: flex; }
.dropzone.loaded .loaded-body { display: flex; flex-direction: column; }
.dropzone.loaded .loaded-change-link { display: inline; }

.loaded-check {
    display: none;
    flex: 0 0 auto;
    width: 26px; height: 26px;
    border-radius: var(--radius-full);
    background: var(--tcs-success);
    color: var(--tcs-ivory);
    align-items: center; justify-content: center;
}
.loaded-body { display: none; flex: 1; min-width: 0; gap: 1px; }
.loaded-title {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--tcs-pardo);
    margin: 0; line-height: 1.3;
}
.loaded-filename {
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.76rem;
    color: var(--tcs-pardo-claro);
    word-break: break-all;
    line-height: 1.4;
}
.loaded-change-link {
    display: none;
    background: none; border: none;
    font-family: var(--font-body);
    font-size: 0.76rem;
    color: var(--tcs-ocre);
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    align-self: flex-start;
    margin-top: 2px;
}
.loaded-change-link:hover { color: var(--tcs-pardo); }

.process-cta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid rgba(169,168,158,0.2);
    flex-wrap: wrap;
}
.process-cta-hint { font-size: 0.82rem; color: var(--tcs-pardo-claro); }
.process-cta-row .btn { flex: 0 0 auto; min-width: 220px; }
@media (max-width: 640px) {
    .process-cta-row { flex-direction: column-reverse; align-items: stretch; }
    .process-cta-row .btn { width: 100%; min-width: 0; }
    .process-cta-hint { text-align: center; }
}

.results-block { display: none; }
.results-block.show { display: block; }
.results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}
.results-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.6rem;
    color: var(--tcs-pardo);
    margin: 0 0 var(--space-1);
}
.results-subtitle { font-size: 0.9rem; color: var(--tcs-pardo-claro); }

.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}
@media (max-width: 640px) {
    .stats-strip { grid-template-columns: repeat(2, 1fr); padding: var(--space-4); }
}
.stat-item {
    display: flex; flex-direction: column; gap: 2px;
    border-right: 1px solid rgba(169,168,158,0.2);
    padding-right: var(--space-4);
}
.stat-item:last-child { border-right: none; padding-right: 0; }
@media (max-width: 640px) {
    .stat-item:nth-child(2n) { border-right: none; padding-right: 0; }
    .stat-item { padding-bottom: var(--space-3); }
}
.stat-item .stat-value {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 2rem;
    line-height: 1.1;
    color: var(--tcs-pardo);
    font-variant-numeric: tabular-nums;
}
.stat-item .stat-value.accent { color: var(--tcs-ocre); }
.stat-item .stat-value.warn   { color: var(--tcs-warning); }
.stat-item .stat-value.muted  { color: var(--tcs-pardo-claro); }
.stat-item .stat-label {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tcs-pardo-claro);
    font-weight: 500;
    margin-top: 4px;
}

.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(169,168,158,0.3);
    margin-bottom: var(--space-5);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-btn {
    background: none; border: none;
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--tcs-pardo-claro);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
    transition: color var(--transition-fast);
    min-height: 44px;
}
.tab-btn:hover { color: var(--tcs-pardo); }
.tab-btn.active {
    color: var(--tcs-pardo);
    border-bottom-color: var(--tcs-ocre);
}
.tab-btn .tab-count {
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.72rem;
    font-weight: 500;
    background: var(--tcs-pardo-05);
    color: var(--tcs-pardo-claro);
    padding: 1px 8px;
    border-radius: var(--radius-full);
}
.tab-btn.active .tab-count {
    background: var(--tcs-ocre-20);
    color: var(--tcs-pardo);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fenicioFade 0.25s ease; }
@keyframes fenicioFade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table td { font-variant-numeric: tabular-nums; }
.data-table .col-num { text-align: right; font-family: var(--font-condensed, var(--font-body)); }
.data-table .gtin-mono {
    font-family: var(--font-condensed, var(--font-body));
    font-size: 0.78rem;
    color: var(--tcs-pardo-claro);
}
.data-table .product-name { font-weight: 500; color: var(--tcs-pardo); }
.data-table .product-variant {
    font-size: 0.78rem;
    color: var(--tcs-pardo-claro);
    display: block;
    margin-top: 2px;
}
.data-table .delta {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-weight: 500;
}
.data-table .delta.up   { color: var(--tcs-success); }
.data-table .delta.down { color: var(--tcs-danger); }
.data-table .delta-arrow { display: inline-block; line-height: 1; font-size: 0.85em; }

.alert-bar {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border-left: 3px solid;
    margin-bottom: var(--space-4);
    font-size: 0.88rem;
    line-height: 1.5;
}
.alert-bar.is-warning {
    background: var(--tcs-warning-bg);
    border-color: var(--tcs-warning);
    color: #6d5624;
}
.alert-bar.is-danger {
    background: var(--tcs-danger-bg);
    border-color: var(--tcs-danger);
    color: #6d2f2f;
}
.alert-bar.is-success {
    background: var(--tcs-success-bg);
    border-color: var(--tcs-success);
    color: #3c5540;
}
.alert-bar .alert-icon { flex: 0 0 auto; padding-top: 2px; }

.loading-block {
    display: none;
    text-align: center;
    padding: var(--space-10) var(--space-5);
    color: var(--tcs-pardo-claro);
}
.loading-block.show { display: block; }
.spinner-ring {
    width: 36px; height: 36px;
    border: 2px solid var(--tcs-pardo-05);
    border-top-color: var(--tcs-ocre);
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-3);
    animation: fenicioSpin 0.8s linear infinite;
}
@keyframes fenicioSpin { to { transform: rotate(360deg); } }

.empty-row td {
    text-align: center;
    padding: var(--space-10) var(--space-5);
    color: var(--tcs-pardo-claro);
    background: var(--tcs-white);
}
.empty-row .empty-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.1rem;
    color: var(--tcs-pardo);
    margin-top: var(--space-3);
    display: block;
}

.help-accordion { margin-bottom: var(--space-6); }
.help-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    background: none; border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--tcs-ocre);
    padding: var(--space-2) 0;
}
.help-toggle:hover { color: var(--tcs-pardo); }
.help-toggle .chev { transition: transform var(--transition-fast); }
.help-toggle.open .chev { transform: rotate(180deg); }
.help-body {
    display: none;
    padding: var(--space-4) var(--space-5);
    margin-top: var(--space-3);
    background: var(--tcs-ivory-warm, var(--tcs-ivory));
    border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    color: var(--tcs-pardo-claro);
    line-height: 1.7;
}
.help-body.open { display: block; }
.help-body ol { margin: 0; padding-left: var(--space-5); }
.help-body li { margin-bottom: var(--space-1); }
.help-body strong { color: var(--tcs-pardo); }

.reset-row {
    text-align: center;
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid rgba(169,168,158,0.2);
}

.download-wrap { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.download-wrap .btn { white-space: nowrap; }
@media (max-width: 640px) {
    .download-wrap { width: 100%; }
    .download-wrap .btn { flex: 1 1 100%; justify-content: center; }
}

/* ============================================================
   MOBILE LEGIBILITY OVERRIDES (≤375px iPhone)
   Sube tipografías chicas que quedan ilegibles en pantallas
   pequeñas. No afecta desktop ni tablet.
   ============================================================ */
@media (max-width: 480px) {
    /* Tablas: subir font-size mínimo a 0.85rem (≈13.6px) */
    table { font-size: 0.85rem !important; }
    table th { font-size: 0.7rem !important; }

    /* Badges/pills: mínimo 0.72rem (≈11.5px) */
    .badge, .badge-sm { font-size: 0.72rem !important; }

    /* Labels muy chicos comunes — uppercase con letter-spacing necesitan al menos 0.7rem */
    [style*="font-size:.6rem"],
    [style*="font-size: .6rem"],
    [style*="font-size:0.6rem"],
    [style*="font-size: 0.6rem"],
    .stk-count-label { font-size: 0.7rem !important; }

    /* Subtítulos y captions inline */
    .text-xs { font-size: 0.78rem; }
}

/* ============================================================
   MODAL ADAPTATIONS — pantallas chicas
   Override max-width fijo a 95vw cuando no hay espacio.
   ============================================================ */
@media (max-width: 480px) {
    /* Overlay-style modals (stock detail, clock geo-help, traslado confirm, etc.) */
    .tcs-modal-card,
    .modal-content,
    .modal-card,
    [class*="modal"] [style*="max-width"],
    .stk-detail-card { max-width: 95vw !important; padding: var(--space-4) !important; }
}

/* ============================================================
   TOUCH TARGETS — controles +/- en stock
   Sube de 40×40 a 44×44 en mobile (estándar Apple HIG).
   ============================================================ */
@media (max-width: 640px) {
    .stk-btn { width: 44px; height: 44px; font-size: 20px; }
    .stk-val, .stk-val input { width: 56px; }
    .stk-controls { gap: 4px; }
}

/* ============================================================
   HORIZONTAL OVERFLOW CONTAINMENT — mobile
   Tablas anchas (.vi-table, etc.) hacían scroll horizontal de
   toda la página, incluido el topbar. Contenemos a viewport
   y dejamos que cada tabla scrollee dentro de su contenedor.
   ============================================================ */
@media (max-width: 768px) {
    /* NO ponemos overflow-x en html/body — incluso con `clip` (que debería ser safe),
       iOS Safari sigue rompiendo position:fixed del bottom nav en algunos casos.
       En su lugar, prevenimos overflow horizontal en elementos individuales (tablas,
       cards) que es donde realmente puede aparecer scroll lateral. */
    html, body { max-width: 100vw; }
    .main { max-width: 100%; }

    /* Tablas dentro de cards: scroll interno propio */
    .vi-card, .insight-card { max-width: 100%; }
    .vi-card table, .insight-card table,
    .main table.vi-table, .main table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    /* Heatmap ya tiene wrapper propio, no forzar display:block */
    .vi-heatmap { display: table !important; white-space: normal !important; }
}

/* ============================================================
   LOGIN — portrait pequeño / pantalla con muchos usuarios
   El layout original tenía overflow:hidden y banner top fijo
   de 150px que en portrait <600px alto deja muy poco espacio
   para la lista. Permitimos scroll y achicamos el banner.
   ============================================================ */
@media (max-width: 480px) {
    .login-wrapper { overflow: auto; min-height: 100dvh; }
    .login-top { flex: 0 0 110px; }
    .login-bottom { padding: 20px 18px 24px; }
    .login-select-label { margin-bottom: 18px; font-size: 0.78rem; letter-spacing: 1.2px; }
    .login-row { padding: 12px 14px; gap: 14px; }
    .login-row-avatar { width: 46px; height: 46px; font-size: 0.85rem; }
    .login-list { gap: 4px; }
    .login-list-divider { margin: 10px 0; }
}
@media (max-height: 600px) and (orientation: portrait) {
    .login-top { flex: 0 0 80px; }
    .login-logo { height: 20px; }
}

/* ============================================================
   BOTTOM NAV "MÁS" SHEET — drawer de páginas secundarias
   ============================================================ */
.mbn-sheet-backdrop {
    position: fixed; inset: 0;
    background: rgba(56,46,44,0.45);
    z-index: calc(var(--z-mobile-nav) + 1);
    opacity: 0;
    transition: opacity 0.22s ease;
}
.mbn-sheet-backdrop.is-open { opacity: 1; }

.mbn-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--tcs-pardo);
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    z-index: calc(var(--z-mobile-nav) + 2);
    padding: 10px 16px max(20px, env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 28px rgba(0,0,0,0.25);
    transform: translateY(100%);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.mbn-sheet.is-open { transform: translateY(0); }

.mbn-sheet-handle {
    width: 42px; height: 4px;
    background: rgba(237,234,230,0.25);
    border-radius: 2px;
    margin: 0 auto 10px;
}
.mbn-sheet-title {
    color: rgba(237,234,230,0.6);
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 14px;
}
.mbn-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}
.mbn-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border-radius: 10px;
    text-decoration: none;
    color: rgba(237,234,230,0.85);
    font-size: 0.7rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.15;
    transition: background var(--transition-fast), color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.mbn-sheet-item:active { background: rgba(255,255,255,0.06); }
.mbn-sheet-item.mbn-active {
    color: var(--tcs-ocre);
    background: rgba(177,167,126,0.14);
}
.mbn-sheet-item .mbn-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.mbn-sheet-item .mbn-icon svg { stroke-width: 2; }
.mbn-sheet-item .mbn-label { font-family: var(--font-body); }

@media (min-width: 641px) {
    .mbn-sheet, .mbn-sheet-backdrop { display: none !important; }
}
@media (max-width: 360px) {
    .mbn-sheet-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   STOCK COUNTING — Event-sourcing UI
   Cada producto es una "card" con: header (info + total), add-row
   (controles), history (aportes anteriores).
   ============================================================ */
.stk-card {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.2);
    border-left: 3px solid transparent;
    border-radius: var(--radius-md);
    margin: 6px 0;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.stk-card.counted {
    border-left-color: var(--tcs-success);
}
.stk-card.just-changed {
    background: linear-gradient(90deg, rgba(177,167,126,0.18) 0%, var(--tcs-white) 60%);
    box-shadow: 0 0 0 2px rgba(177,167,126,0.4), var(--shadow-card);
    transition: background 1.4s ease, box-shadow 1.4s ease;
}

.stk-card-head {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px 8px;
}
.stk-card .stk-row-info { flex: 1; min-width: 0; }
.stk-card .stk-row-name { font-size: 0.92rem; font-weight: 500; line-height: 1.3; word-break: break-word; }
.stk-card .stk-row-meta { font-size: 0.7rem; color: var(--tcs-pardo-claro); margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stk-row-sis { font-family: var(--font-body); font-size: 0.7rem; color: var(--tcs-pardo-claro); }

.stk-total-block { text-align: center; flex-shrink: 0; min-width: 56px; }
.stk-total-num {
    font-family: var(--font-body); font-weight: 600; font-size: 1.6rem;
    line-height: 1; color: var(--tcs-pardo-claro);
}
.stk-total-num.has { color: var(--tcs-pardo); }
.stk-total-lbl {
    font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--tcs-pardo-claro); margin-top: 2px;
}

.stk-add-row {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px 12px;
}
.stk-add-input {
    flex: 1; min-width: 0;
    border: 1px solid rgba(169,168,158,0.35);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-family: var(--font-body); font-size: 1rem; font-weight: 500;
    color: var(--tcs-pardo);
    text-align: center;
    background: var(--tcs-ivory-warm);
    -moz-appearance: textfield;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.stk-add-input:focus { outline: none; border-color: var(--tcs-ocre); background: var(--tcs-white); }
.stk-add-input::-webkit-inner-spin-button,
.stk-add-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stk-add-btn {
    min-width: 64px;
    background: rgba(177,167,126,0.25); color: var(--tcs-pardo-claro);
    border: none; border-radius: var(--radius-sm);
    padding: 8px 12px; height: 40px;
    font-family: var(--font-body); font-size: 0.95rem; font-weight: 700;
    letter-spacing: 0.02em; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}
.stk-add-btn.on {
    background: var(--tcs-ocre); color: var(--tcs-white);
    box-shadow: 0 2px 6px rgba(177,167,126,0.35);
}
.stk-add-btn:disabled, .stk-add-btn:not(.on) { cursor: default; }
.stk-add-btn.on:active { transform: scale(0.96); background: var(--tcs-pardo); }

/* History */
.stk-history {
    border-top: 1px solid rgba(169,168,158,0.18);
    background: rgba(237,234,230,0.4);
}
.stk-history-toggle {
    width: 100%;
    background: none; border: none;
    padding: 8px 14px;
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; text-align: left;
    font-family: var(--font-body); font-size: 0.78rem;
    color: var(--tcs-pardo-claro);
    -webkit-tap-highlight-color: transparent;
}
.stk-history-summary { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--tcs-pardo); }
.stk-history-count { color: var(--tcs-pardo-claro); font-size: 0.7rem; }
.stk-history-caret { font-size: 0.85rem; color: var(--tcs-pardo-claro); }

.stk-history-list {
    padding: 4px 14px 12px;
    display: flex; flex-direction: column; gap: 4px;
    border-top: 1px dashed rgba(169,168,158,0.25);
}
.stk-history-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--tcs-white);
    font-size: 0.78rem;
}
.stk-history-item.optimistic { opacity: 0.6; }
.stk-history-item.correct { border-left: 2px solid var(--tcs-warning); }
.stk-history-spot {
    color: var(--tcs-pardo-claro);
    font-size: 0.72rem;
    font-weight: 400;
}
.stk-history-init {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--tcs-pardo);
    color: var(--tcs-ivory);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.62rem; font-weight: 600;
    flex-shrink: 0;
}
.stk-history-who { flex: 1; min-width: 0; color: var(--tcs-pardo); font-weight: 500; }
.stk-history-who em { color: var(--tcs-warning); font-style: normal; font-weight: 400; }
.stk-history-delta { font-weight: 700; font-size: 0.85rem; min-width: 30px; text-align: right; }
.stk-history-delta.pos { color: var(--tcs-success); }
.stk-history-delta.neg { color: var(--tcs-danger); }
.stk-history-time { font-size: 0.7rem; color: var(--tcs-pardo-claro); min-width: 38px; text-align: right; }
.stk-history-void {
    background: none; border: none;
    width: 26px; height: 26px;
    border-radius: 50%;
    color: var(--tcs-pardo-claro);
    cursor: pointer;
    font-size: 1.1rem; line-height: 1;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.stk-history-void:active { background: var(--tcs-danger); color: var(--tcs-white); }

.stk-history-actions {
    display: flex; justify-content: center;
    margin-top: 6px;
}
.stk-history-clear {
    background: none; border: 1px solid rgba(158,75,75,0.3);
    color: var(--tcs-danger);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 0.78rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--transition-fast);
}
.stk-history-clear:active { background: rgba(158,75,75,0.12); }

/* Mobile tweaks */
@media (max-width: 480px) {
    .stk-card-head { padding: 10px 12px 6px; }
    .stk-add-row { padding: 4px 12px 10px; gap: 6px; }
    .stk-total-num { font-size: 1.4rem; }
    .stk-add-btn { padding: 8px 10px; font-size: 0.78rem; }
}

/* ============================================================
   STOCK REVIEW SCREEN — Smart Count: contexto + decisiones
   ============================================================ */
.stk-decision-badge {
    display: inline-block; padding: 3px 8px;
    border-radius: 4px; font-size: 0.72rem; font-weight: 600;
    margin-top: 6px; letter-spacing: 0.02em;
}
.stk-decision-badge.auto { background: rgba(90,122,90,0.15); color: var(--tcs-success); }
.stk-decision-badge.ok { background: var(--tcs-success); color: var(--tcs-white); }
.stk-decision-badge.bad { background: rgba(158,75,75,0.15); color: var(--tcs-danger); border: 1px solid rgba(158,75,75,0.35); }

.stk-review-expand {
    display: block; width: 100%;
    background: rgba(177,167,126,0.1);
    border: none; border-top: 1px solid rgba(169,168,158,0.2);
    margin-top: 10px; padding: 8px 12px;
    font-family: var(--font-body); font-size: 0.82rem; font-weight: 500;
    color: var(--tcs-pardo); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
    border-radius: 0 0 6px 6px;
}
.stk-review-expand:active { background: rgba(177,167,126,0.22); }

.stk-review-detail-panel {
    border-top: 1px solid rgba(169,168,158,0.2);
    padding: 10px 12px;
    background: rgba(237,234,230,0.3);
}
.stk-ctx-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
    margin-bottom: 10px;
}
.stk-ctx-grid > div {
    background: var(--tcs-white);
    padding: 8px 10px; border-radius: 6px;
    display: flex; flex-direction: column;
}
.stk-ctx-l { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tcs-pardo-claro); }
.stk-ctx-v { font-size: 1.05rem; font-weight: 700; color: var(--tcs-pardo); margin-top: 2px; }
.stk-ctx-v.pos { color: var(--tcs-success); }
.stk-ctx-v.neg { color: var(--tcs-danger); }

.stk-ctx-mov-title {
    font-size: 0.72rem; font-weight: 600; color: var(--tcs-pardo-claro);
    text-transform: uppercase; letter-spacing: 0.05em; margin: 8px 0 6px;
}
.stk-ctx-mov { display: flex; flex-direction: column; gap: 4px; }
.stk-ctx-mov-row {
    display: grid; grid-template-columns: 1.2fr 1.4fr 1.2fr auto;
    gap: 8px; font-size: 0.78rem;
    padding: 6px 8px; background: var(--tcs-white);
    border-radius: 4px; border-left: 3px solid var(--tcs-gris);
    align-items: center;
}
.stk-ctx-mov-row.neg { border-left-color: var(--tcs-danger); }
.stk-ctx-mov-row.pos { border-left-color: var(--tcs-success); }
.stk-ctx-mov-row > span:last-child { font-weight: 700; text-align: right; }
.stk-ctx-mov-empty {
    padding: 10px; text-align: center; font-size: 0.78rem;
    color: var(--tcs-pardo-claro); font-style: italic;
}

.stk-decide {
    margin-top: 12px; padding-top: 10px;
    border-top: 1px dashed rgba(169,168,158,0.3);
}
.stk-reason-sel {
    width: 100%; padding: 8px 10px;
    border: 1px solid rgba(169,168,158,0.4); border-radius: 6px;
    font-family: var(--font-body); font-size: 0.88rem;
    background: var(--tcs-white); color: var(--tcs-pardo);
    margin-bottom: 8px;
}
.stk-decide-btns { display: flex; gap: 8px; }
.stk-decide-btn {
    flex: 1; padding: 10px 12px;
    border: none; border-radius: 6px;
    font-family: var(--font-body); font-size: 0.85rem; font-weight: 600;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.stk-decide-btn.approve { background: var(--tcs-success); color: var(--tcs-white); }
.stk-decide-btn.reject { background: rgba(158,75,75,0.15); color: var(--tcs-danger); border: 1px solid rgba(158,75,75,0.35); }
.stk-decide-btn:active { transform: scale(0.97); }

@media (max-width: 480px) {
    .stk-ctx-grid { grid-template-columns: 1fr 1fr; }
    .stk-ctx-mov-row { grid-template-columns: 1fr 1fr auto; }
    .stk-ctx-mov-row > span:nth-child(3) { display: none; }
}

/* ============================================================
   VENTAS DEL DÍA — diario operativo
   ============================================================ */
.vd-toolbar {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: 10px;
}
.vd-toolbar-row1 {
    display: flex; align-items: center; gap: 8px;
    /* min-width:0 + overflow controlled to prevent wrapping with state changes */
    flex-wrap: nowrap;
}
.vd-toolbar-row2 {
    display: flex; align-items: center;
    min-height: 18px;  /* reserva el espacio aunque "Última sync" esté vacía */
}
.vd-date {
    flex: 1; min-width: 0;
    padding: 8px 12px; font-size: 16px;
    border: 1px solid rgba(169,168,158,0.3); border-radius: var(--radius-sm);
    background: var(--tcs-white); color: var(--tcs-pardo);
    font-family: var(--font-body);
}
.vd-sync-btn {
    flex-shrink: 0;
    min-width: 130px;  /* fijo: cubre tanto "Actualizar" como "Sincronizando…" sin reflow */
    background: var(--tcs-ocre); color: var(--tcs-white);
    border: none; border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-family: var(--font-body); font-weight: 600; font-size: 0.85rem;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background var(--transition-fast), transform var(--transition-fast);
    text-align: center;
}
.vd-sync-btn:active { transform: scale(0.97); background: var(--tcs-pardo); }
.vd-sync-btn:disabled { background: rgba(177,167,126,0.4); cursor: default; }
.vd-sync-btn.spinning::before {
    content: '⟳ '; display: inline-block;
    animation: vd-spin 1s linear infinite;
}
@keyframes vd-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.vd-last-sync { font-size: 0.78rem; color: var(--tcs-pardo-claro); }

.vd-kpis {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
    margin-bottom: 12px;
}
@media (max-width: 640px) { .vd-kpis { grid-template-columns: repeat(2, 1fr); } }
.vd-kpi {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.2);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-card);
}
.vd-kpi-l {
    font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--tcs-pardo-claro); font-weight: 500;
}
.vd-kpi-v {
    font-family: var(--font-body); font-weight: 600;
    font-size: 1.25rem; color: var(--tcs-pardo); margin-top: 4px;
}
.vd-kpi.has-dev { border-left: 3px solid var(--tcs-danger); }
.vd-kpi.has-dev .vd-kpi-v { color: var(--tcs-danger); }
.vd-iva {
    font-size: 0.58rem; font-weight: 500;
    color: var(--tcs-pardo-claro);
    background: rgba(177,167,126,0.18);
    padding: 1px 5px; border-radius: 3px;
    margin-left: 4px;
    text-transform: none; letter-spacing: 0;
    vertical-align: middle;
}

.vd-pills {
    display: flex; gap: 5px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
}
.vd-pills::-webkit-scrollbar { display: none; }
.vd-pill {
    padding: 6px 12px; font-family: var(--font-body); font-size: 0.7rem;
    font-weight: 500; letter-spacing: 0.2px; text-transform: uppercase;
    white-space: nowrap; border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-sm); background: var(--tcs-white);
    color: var(--tcs-pardo-claro); cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.vd-pill.on {
    background: var(--tcs-pardo); color: var(--tcs-ocre);
    border-color: var(--tcs-pardo); font-weight: 600;
}

.vd-vendedor-row {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
    background: var(--tcs-white); border: 1px solid rgba(169,168,158,0.25);
    border-radius: var(--radius-sm); padding: 6px 10px;
}
.vd-vendedor-l {
    font-size: 0.72rem; color: var(--tcs-pardo-claro);
    text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500;
}
.vd-vendedor-sel {
    flex: 1; min-width: 0;
    border: none; outline: none; background: transparent;
    font-family: var(--font-body); font-size: 16px;
    color: var(--tcs-pardo);
    appearance: none; -webkit-appearance: none;
}

.vd-empty {
    background: var(--tcs-white); border: 1px dashed rgba(169,168,158,0.4);
    border-radius: var(--radius-md);
    padding: 24px; text-align: center;
    color: var(--tcs-pardo-claro); font-size: 0.88rem;
}

/* ── Tabla de comprobantes ── */
.vd-table-wrap {
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.2);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}
.vd-table { width: 100%; border-collapse: collapse; font-family: var(--font-body); }
.vd-table thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tcs-pardo-claro);
    background: var(--tcs-ivory-warm);
    border-bottom: 1px solid rgba(169,168,158,0.25);
    white-space: nowrap;
}
.vd-th-items, .vd-th-total { text-align: right; }
.vd-th-num { width: 90px; }
.vd-th-time { width: 80px; }
.vd-th-tipo { width: 100px; }
.vd-th-items { width: 70px; }
.vd-th-total { width: 110px; }

.vd-tr { cursor: pointer; transition: background 120ms; }
.vd-tr:hover { background: rgba(177,167,126,0.06); }
.vd-tr.is-open { background: rgba(177,167,126,0.04); }
.vd-tr.tienda > td:first-child { box-shadow: inset 3px 0 0 var(--tcs-success); }
.vd-tr.web    > td:first-child { box-shadow: inset 3px 0 0 var(--tcs-info); }
.vd-tr.dev    > td:first-child { box-shadow: inset 3px 0 0 var(--tcs-danger); }

.vd-tr td {
    padding: 11px 14px;
    font-size: 0.88rem;
    color: var(--tcs-pardo);
    border-bottom: 1px solid rgba(169,168,158,0.15);
    vertical-align: middle;
}
.vd-td-num { font-weight: 700; white-space: nowrap; }
.vd-td-time { font-weight: 600; color: var(--tcs-pardo-claro); white-space: nowrap; }
.vd-td-vend {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 320px;
}
.vd-td-items { text-align: right; color: var(--tcs-pardo-claro); }
.vd-td-total { text-align: right; font-weight: 700; white-space: nowrap; }
.vd-tr.dev .vd-td-total { color: var(--tcs-danger); }

.vd-tipo-badge {
    display: inline-block;
    background: rgba(177,167,126,0.18); color: var(--tcs-pardo);
    padding: 2px 8px; border-radius: 3px; font-size: 0.66rem;
    text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}
.vd-tr.web .vd-tipo-badge { background: rgba(107,127,163,0.2); color: var(--tcs-info); }
.vd-tr.dev .vd-tipo-badge { background: rgba(158,75,75,0.18); color: var(--tcs-danger); }

/* Detalle expandido (líneas del ticket) */
.vd-tr-detail > td {
    padding: 0 0 6px 0;
    background: var(--tcs-ivory-warm);
    border-bottom: 1px solid rgba(169,168,158,0.18);
    cursor: default;
}
.vd-lines-table { width: 100%; border-collapse: collapse; }
.vd-lines-table td {
    padding: 6px 14px;
    font-size: 0.82rem;
    color: var(--tcs-pardo);
    border-top: 1px dashed rgba(169,168,158,0.25);
}
.vd-lines-table tr:first-child td { border-top: none; }
.vd-lines-table .vd-line-label {
    width: 100%;
    min-width: 0;
}
.vd-lines-table .vd-line-name {
    display: block;
    font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vd-lines-table .vd-line-code {
    display: block;
    font-family: monospace; color: var(--tcs-pardo-claro); font-size: 0.7rem;
    white-space: nowrap;
}
.vd-lines-table .vd-line-qty {
    color: var(--tcs-pardo-claro); font-weight: 500;
    white-space: nowrap; text-align: right;
}
.vd-lines-table .vd-line-total {
    font-weight: 700; min-width: 90px;
    white-space: nowrap; text-align: right;
}

/* Mobile: tabla → cards apiladas */
@media (max-width: 640px) {
    .vd-table-wrap { background: transparent; border: none; box-shadow: none; }
    .vd-table, .vd-table thead, .vd-table tbody { display: block; }
    .vd-table thead { display: none; }
    .vd-tr { display: grid;
        grid-template-columns: auto 1fr auto;
        column-gap: 10px; row-gap: 2px;
        background: var(--tcs-white);
        border: 1px solid rgba(169,168,158,0.2);
        border-radius: var(--radius-md);
        padding: 10px 12px;
        margin-bottom: 6px;
        box-shadow: var(--shadow-card);
    }
    .vd-tr.tienda { border-left: 3px solid var(--tcs-success); }
    .vd-tr.web    { border-left: 3px solid var(--tcs-info); }
    .vd-tr.dev    { border-left: 3px solid var(--tcs-danger); }
    .vd-tr > td {
        padding: 0; border: none; box-shadow: none !important;
    }
    .vd-td-num   { grid-column: 1; grid-row: 1; }
    .vd-td-time  { grid-column: 2; grid-row: 1; align-self: center; }
    .vd-td-tipo  { grid-column: 3; grid-row: 1; align-self: center; }
    .vd-td-vend  { grid-column: 1 / -1; grid-row: 2; font-size: 0.78rem; color: var(--tcs-pardo-claro); }
    .vd-td-items { grid-column: 1 / 3; grid-row: 3; text-align: left; font-size: 0.72rem; }
    .vd-td-items::before { content: "Ítems: "; }
    .vd-td-total { grid-column: 3; grid-row: 3; font-size: 1rem; }

    /* Detalle expandido: extensión visual del ticket card, no un bloque aparte */
    .vd-tr-detail {
        display: block;
        background: var(--tcs-white);
        border: 1px solid rgba(169,168,158,0.2);
        border-top: none;
        border-radius: 0 0 var(--radius-md) var(--radius-md);
        margin: -7px 0 6px;
        padding: 0 12px 8px;
        box-shadow: var(--shadow-card);
    }
    .vd-tr-detail > td { display: block; padding: 0; background: transparent; border: none; }
    .vd-lines-table, .vd-lines-table tbody, .vd-lines-table tr { display: block; }
    .vd-lines-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        column-gap: 12px;
        padding: 8px 0;
        border-top: 1px dashed rgba(169,168,158,0.3);
        align-items: center;
        background: transparent;
    }
    .vd-lines-table tr:first-child { border-top: 1px solid rgba(169,168,158,0.18); }
    .vd-lines-table td {
        display: block; padding: 0; border: none; min-width: 0;
        background: transparent;
    }
    .vd-lines-table .vd-line-label { grid-column: 1; }
    .vd-lines-table .vd-line-qty   { grid-column: 2; font-size: 0.78rem; }
    .vd-lines-table .vd-line-total { grid-column: 3; font-size: 0.92rem; min-width: 0; }
    .vd-lines-table .vd-line-name  { font-size: 0.85rem; }
    .vd-lines-table .vd-line-code  { font-size: 0.7rem; margin-top: 1px; }
}

.vd-vendedores-section {
    margin-top: 16px;
    background: var(--tcs-white);
    border: 1px solid rgba(169,168,158,0.2);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: var(--shadow-card);
}
.vd-section-title {
    font-family: var(--font-display); font-weight: 300;
    font-size: 0.95rem; color: var(--tcs-pardo);
    margin-bottom: 8px;
}
.vd-vend-row {
    display: grid; grid-template-columns: 1.4fr 1fr auto;
    gap: 10px; padding: 6px 0;
    border-bottom: 1px dashed rgba(169,168,158,0.18);
    font-size: 0.84rem;
}
.vd-vend-row:last-child { border-bottom: none; }
.vd-vend-name { font-weight: 500; color: var(--tcs-pardo); }
.vd-vend-tickets { color: var(--tcs-pardo-claro); font-size: 0.78rem; }
.vd-vend-fact { font-weight: 700; color: var(--tcs-pardo); text-align: right; }

/* ============================================================
   HOME — Admin "Ventas hoy" card (estilo claro, armoniza con resto)
   ============================================================ */
.vd-home-card {
    display: block;
    background: var(--tcs-white);
    color: var(--tcs-pardo);
    border: 1px solid rgba(169,168,158,0.25);
    border-left: 3px solid var(--tcs-ocre);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-decoration: none;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.vd-home-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(56,46,44,0.10); }
.vd-home-card:active { transform: scale(0.99); }
.vd-home-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px;
}
.vd-home-title {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--tcs-ocre);
}
.vd-home-arrow {
    color: var(--tcs-ocre);
    font-size: 1.1rem;
    line-height: 1;
}
.vd-home-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: end;
}
.vd-home-metric { display: flex; flex-direction: column; gap: 2px; }
.vd-home-num {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1.7rem;
    color: var(--tcs-pardo);
    line-height: 1.05;
}
.vd-home-lbl {
    font-size: 0.7rem;
    color: var(--tcs-pardo-claro);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
.vd-home-iva {
    background: rgba(177,167,126,0.18);
    color: var(--tcs-pardo-claro);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.6rem;
    margin-left: 4px;
    text-transform: none;
    letter-spacing: 0;
}

@media (max-width: 480px) {
    .vd-home-body { grid-template-columns: 1fr 1fr; gap: 12px; }
    .vd-home-num { font-size: 1.45rem; }
}

/* ============================================================
   VENTAS DEL DÍA — push notifications button
   ============================================================ */
.vd-push-btn {
    flex-shrink: 0;
    width: 38px; height: 38px;
    background: var(--tcs-white);
    color: var(--tcs-pardo-claro);
    border: 1px solid rgba(169,168,158,0.3);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.vd-push-btn:active { transform: scale(0.94); }
.vd-push-btn.on {
    background: var(--tcs-ocre);
    color: var(--tcs-white);
    border-color: var(--tcs-ocre);
}

/* ============================================================
   PAGE LOADING BAR — feedback al navegar
   Aparece al tocar cualquier link interno, queda hasta que la
   página nueva carga. Pageshow event la limpia.
   ============================================================ */
#page-loading-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--tcs-ocre);
    transform: scaleX(0);
    transform-origin: left center;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
#page-loading-bar.loading {
    opacity: 1;
    transform: scaleX(0.7);
    transition: transform 8s cubic-bezier(0.1, 0.7, 0.3, 0.95), opacity 0.1s ease;
}

/* Bottom nav item tapeado: feedback inmediato (background + scale down) */
.mbn-item.mbn-loading {
    background: rgba(177,167,126,0.22);
    transform: scale(0.95);
}
.mbn-item.mbn-loading .mbn-icon {
    animation: mbn-pulse 0.8s ease-in-out infinite;
}
@keyframes mbn-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.92); }
}
.mbn-sheet-item.mbn-loading {
    background: rgba(177,167,126,0.22);
}
