/* ══ VLK Design System — Rojo, Negro, Gris, Madera ══ */
:root {
  --red:     #c8283c;
  --red-d:   #a01e2e;
  --red-l:   #e63950;
  --wood:    #8B5A2B;
  --wood-l:  #b07840;
  --dark:    #3d3d3d;
  --card:    #141414;
  --surface: #1c1c1c;
  --border:  #2e2e2e;
  --border-l:#3e3e3e;
  --text:    #efefef;
  --muted:   #686868;
  --green:   #4a9e6a;
  --red-err: #e05a4a;
  --radius:  12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--dark);
  color: var(--text);
  overflow-x: hidden;
}

/* ══ LOGIN ══ */
#screen-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}
.login-bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(200,40,60,.18) 0%, transparent 60%),
    linear-gradient(180deg, #3d3d3d 0%, #424242 100%);
}
/* Textura madera sutil en el fondo */
.login-bg::after {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    92deg,
    transparent,
    transparent 40px,
    rgba(139,90,43,.04) 40px,
    rgba(139,90,43,.04) 41px
  );
}
.login-card {
  position: relative; z-index: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--red);
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 40px rgba(200,40,60,.06);
  text-align: center;
}
.login-logo  { font-size: 3em; margin-bottom: 8px; }
.login-title {
  font-size: 1.9em;
  letter-spacing: 8px;
  color: var(--text);
  font-weight: 800;
  text-transform: uppercase;
}
.login-sub {
  letter-spacing: 10px;
  color: var(--red);
  font-size: .7em;
  margin-bottom: 32px;
  text-transform: uppercase;
}

/* Inputs */
.input-group { text-align: left; margin-bottom: 16px; }
.input-group label {
  display: block;
  font-size: .7em;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.input-group input,
.input-group select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 1em;
  outline: none;
  transition: border .2s;
}
.input-group input:focus,
.input-group select:focus { border-color: var(--red); }
.input-group select { cursor: pointer; }

.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 44px; }
.pwd-wrap button {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; font-size: 1.1em; padding: 4px;
}

#login-error {
  color: var(--red-err);
  font-size: .85em;
  min-height: 20px;
  margin-bottom: 10px;
  text-align: left;
}

#login-btn {
  width: 100%; padding: 14px;
  background: var(--red);
  color: #fff;
  border: none; border-radius: 10px;
  font-size: 1em; font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
#login-btn:hover    { background: var(--red-l); }
#login-btn:disabled { opacity: .5; cursor: default; }

/* ══ SPINNER ══ */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ HEADER ══ */
.dash-header {
  background: var(--card);
  border-bottom: 2px solid var(--red);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.dash-logo { font-size: 1.6em; }
.dash-title { flex: 1; }
.dash-name {
  font-size: 1em;
  letter-spacing: 5px;
  color: var(--text);
  font-weight: 800;
  text-transform: uppercase;
  display: block;
}
.dash-user {
  display: flex; align-items: center; gap: 10px;
  font-size: .85em; color: var(--muted);
}
#logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px; border-radius: 6px;
  cursor: pointer; font-size: .9em;
  transition: all .2s;
}
#logout-btn:hover { border-color: var(--red); color: var(--red); }

/* Role badges */
.role-badge {
  display: inline-block;
  font-size: .65em;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 2px;
}
.role-dueno     { background: rgba(200,40,60,.15); color: #e86070; border: 1px solid rgba(200,40,60,.35); }
.role-encargado { background: rgba(139,90,43,.15); color: #c09060; border: 1px solid rgba(139,90,43,.35); }
.role-mozo      { background: rgba(80,80,80,.2);   color: #aaa;    border: 1px solid #444; }

/* ══ DASHBOARD ══ */
#screen-dashboard { display: flex; flex-direction: column; min-height: 100vh; }
.dash-main { flex: 1; padding: 20px; }

.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}

.module-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, transform .15s, background .2s;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  position: relative; overflow: hidden;
}
.module-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), transparent);
  opacity: 0; transition: opacity .2s;
}
.module-card:hover::before { opacity: 1; }
.module-card:hover {
  border-color: var(--border-l);
  background: var(--surface);
  transform: translateY(-2px);
}
.module-card:active { transform: scale(.97); }
.module-icon  { font-size: 2.2em; }
.module-label {
  font-size: .75em;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}
.module-disabled { opacity: .3; cursor: default; }
.module-disabled:hover { border-color: var(--border); background: var(--card); transform: none; }
.module-disabled::before { display: none; }

/* ══ BACK BTN ══ */
.back-btn {
  background: none;
  border: none;
  color: var(--red);
  font-size: .9em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.back-btn:hover { background: rgba(200,40,60,.1); }

/* ══ SCREEN USUARIOS ══ */
#screen-users { display: flex; flex-direction: column; min-height: 100vh; }
.users-main {
  padding: 20px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.users-form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.users-form-card h3 {
  color: var(--red);
  font-size: .85em;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media(max-width:480px) { .form-row { grid-template-columns: 1fr; } }

.form-error { color: var(--red-err); font-size: .83em; min-height: 18px; margin-top: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.btn-primary {
  background: var(--red);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .9em;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover { background: var(--red-l); }

.btn-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 11px 20px;
  border-radius: 8px;
  font-size: .9em;
  cursor: pointer;
  transition: all .2s;
}
.btn-secondary:hover { border-color: var(--muted); color: var(--text); }

/* Lista usuarios */
.users-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.users-list-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.users-list-header h3 {
  color: var(--red);
  font-size: .85em;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.badge {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: .75em;
  padding: 2px 8px;
  border-radius: 12px;
}

.user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--surface); }

.user-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2em; flex-shrink: 0;
}
.avatar-dueno     { background: rgba(200,40,60,.2); }
.avatar-encargado { background: rgba(139,90,43,.2); }
.avatar-mozo      { background: rgba(80,80,80,.2); }

.user-info  { flex: 1; min-width: 0; }
.user-name  { font-size: .95em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-username { font-size: .78em; color: var(--muted); }
.user-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px; height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: .9em;
  transition: all .15s;
}
.btn-icon:hover        { border-color: var(--wood); color: var(--wood-l); }
.btn-icon.danger:hover { border-color: var(--red);  color: var(--red); }
.inactive-badge { font-size: .7em; color: var(--red-err); }

/* ══ DISPOSITIVOS (botones rápidos) ══ */
.devices-title {
  color: var(--muted);
  font-size: .7em;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 24px 0 10px;
  padding: 0 4px;
  max-width: 480px;
  margin-left: auto; margin-right: auto;
}
.devices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}
.device-btn {
  border: none;
  border-radius: var(--radius);
  padding: 18px 12px;
  font-size: 1em; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.6;
}
.device-btn span { font-size: .75em; font-weight: 400; opacity: .75; }
.btn-on  { background: rgba(200,40,60,.12); color: #e86070; border: 1px solid rgba(200,40,60,.3); }
.btn-on:hover  { background: rgba(200,40,60,.22); }
.btn-off { background: rgba(50,50,50,.4); color: var(--muted); border: 1px solid var(--border); }
.btn-off:hover { background: var(--surface); color: var(--text); }
.device-btn:active   { transform: scale(.96); }
.device-btn:disabled { opacity: .5; cursor: default; }
.device-msg {
  text-align: center; font-size: .8em;
  min-height: 20px; margin-top: 8px;
  max-width: 480px;
  margin-left: auto; margin-right: auto;
}

/* ══ SMART HOME ══ */
#screen-smarthome { display: flex; flex-direction: column; min-height: 100vh; }
.loc-section { margin-bottom: 28px; }
.loc-title {
  font-size: .75em;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
/* Bar en rojo, Casa en madera */
#loc-bar  .loc-title { color: var(--red); border-color: rgba(200,40,60,.3); }
#loc-casa .loc-title { color: var(--wood-l); border-color: rgba(139,90,43,.3); }

.devices-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media(min-width:560px) { .devices-cards { grid-template-columns: repeat(3,1fr); } }

.dev-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .2s;
  position: relative; overflow: hidden;
}
.dev-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
}
.dev-card.on::before  { background: var(--red); }
.dev-card.sensor::before { background: var(--wood); }

.dev-card.on     { border-color: rgba(200,40,60,.35); background: rgba(200,40,60,.05); }
.dev-card.off    { border-color: var(--border); }
.dev-card.sensor { border-color: rgba(139,90,43,.35); background: rgba(139,90,43,.05); }
.dev-card.dev-offline { opacity: .4; }

.dev-header { display: flex; align-items: center; justify-content: space-between; }
.dev-icon-name { display: flex; align-items: center; gap: 8px; }
.dev-icon { font-size: 1.3em; }
.dev-name { font-size: .78em; font-weight: 600; color: var(--text); line-height: 1.3; }

/* Toggle switch */
.toggle { position: relative; width: 40px; height: 22px; display: inline-block; cursor: pointer; }
.toggle input { display: none; }
.toggle-track {
  position: absolute; inset: 0;
  border-radius: 11px;
  background: #2e2e2e;
  border: 1px solid #3e3e3e;
  transition: background .2s;
}
.toggle input:checked + .toggle-track { background: var(--red); border-color: var(--red-d); }
.toggle-thumb {
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #888;
  top: 3px; left: 3px;
  transition: left .2s, background .2s;
  pointer-events: none;
}
.toggle input:checked ~ .toggle-thumb { left: 21px; background: #fff; }

/* Stats */
.dev-stats { display: flex; flex-wrap: wrap; gap: 5px; }
.dev-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 7px;
  font-size: .7em;
  color: var(--muted);
  display: flex; align-items: center; gap: 4px;
}
.dev-stat strong { color: var(--text); }

.dev-status-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.dev-status-dot.on  { background: var(--red); box-shadow: 0 0 5px var(--red); }
.dev-status-dot.off { background: #444; }

.dev-last-update {
  font-size: .62em; color: var(--muted);
  text-align: right; margin-top: 2px;
}

/* ══ MODAL GRÁFICO ══ */
#modal-chart {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.88);
  padding: 16px;
  align-items: center; justify-content: center;
}

/* ══ SELECTOR DE UNIDADES ══ */
.units-main {
  padding: 24px 20px;
  max-width: 500px;
  margin: 0 auto;
}
.units-subtitle {
  color: var(--muted);
  font-size: .75em;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  margin-bottom: 20px;
}
.units-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.unit-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.unit-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  transform: scaleY(0);
  transition: transform .2s;
  transform-origin: center;
}
.unit-card:hover { background: var(--surface); border-color: var(--border-l); transform: translateX(4px); }
.unit-card:hover::before { transform: scaleY(1); }
.unit-card:active { transform: scale(.98); }
.unit-icon { font-size: 2.2em; flex-shrink: 0; }
.unit-name { font-size: 1.05em; font-weight: 700; color: var(--text); letter-spacing: 1px; }
.unit-desc { font-size: .78em; color: var(--muted); margin-top: 3px; }
.unit-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 1.2em;
  transition: color .2s;
}
.unit-card:hover .unit-arrow { color: var(--red); }

/* ── Checkboxes de unidades en formulario de usuario ── */
.units-checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.unit-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .88em;
  color: var(--muted);
  transition: border-color .2s, background .2s;
  user-select: none;
}
.unit-check:hover { border-color: #c8283c44; background: #1e1010; }
.unit-check input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--red);
  cursor: pointer; flex-shrink: 0;
}
.unit-check:has(input:checked) {
  border-color: #c8283c55;
  background: #1c0d0f;
  color: var(--text);
}

/* Badge de unidades en lista de usuarios */
.unit-badge {
  display: inline-block;
  font-size: .62em;
  padding: 2px 6px;
  border-radius: 8px;
  background: #c8283c18;
  color: #c8283c;
  border: 1px solid #c8283c33;
  margin: 1px 2px 0 0;
}

/* ── FUDO SCREEN ─────────────────────────────────────────── */
.fudo-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.fudo-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.fudo-section-title {
  font-size: .7em;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.fudo-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  divide-x: 1px solid var(--border);
}
.fudo-card {
  padding: 16px 12px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.fudo-card:last-child { border-right: none; }
.fudo-card-label {
  font-size: .65em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.fudo-card-value {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text);
}
.fudo-list { padding: 8px 0; }
.fudo-loading, .fudo-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: .85em;
}
.fudo-sale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.fudo-sale-row:last-child { border-bottom: none; }
.fudo-sale-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fudo-sale-tipo {
  font-size: .85em;
  color: var(--text);
  font-weight: 500;
}
.fudo-sale-hora {
  font-size: .7em;
  color: var(--muted);
}
.fudo-sale-total {
  font-weight: 700;
  color: var(--red);
  font-size: .95em;
}

/* ── FUDO date bar ── */
.fudo-date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.fudo-date-label {
  font-size: .85em;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .5px;
  text-align: center;
  flex: 1;
}
.fudo-nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 1.2em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s, border-color .2s;
  flex-shrink: 0;
}
.fudo-nav-btn:hover:not(:disabled) { color: var(--text); border-color: var(--red); }
.fudo-nav-btn:disabled { opacity: .3; cursor: default; }

/* ── FUDO landing menu ── */
.fudo-menu {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}
.fudo-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.fudo-menu-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
  color: var(--text);
}
.fudo-menu-btn::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  transform: scaleY(0);
  transition: transform .2s;
  transform-origin: center;
}
.fudo-menu-btn:hover:not(:disabled)::before { transform: scaleY(1); }
.fudo-menu-btn:hover:not(:disabled) { background: var(--surface); border-color: var(--border-l); }
.fudo-menu-btn:active:not(:disabled) { transform: scale(.97); }
.fudo-menu-icon { font-size: 2em; }
.fudo-menu-label { font-size: .85em; font-weight: 600; letter-spacing: .5px; }
.fudo-menu-soon { opacity: .45; cursor: default; }
.fudo-menu-soon-tag {
  font-size: .6em;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── FUDO productos vendidos ── */
.fudo-prod-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.fudo-prod-row:last-child { border-bottom: none; }
.fudo-prod-rank {
  font-size: .75em;
  color: var(--muted);
  font-weight: 700;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}
.fudo-prod-info {
  flex: 1;
  min-width: 0;
}
.fudo-prod-name {
  font-size: .88em;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}
.fudo-prod-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.fudo-prod-bar {
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  transition: width .4s ease;
}
.fudo-prod-qty {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text);
  min-width: 32px;
  text-align: right;
  flex-shrink: 0;
}

/* ── FUDO live card + 2x2 cards ── */
.fudo-live-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid #2ecc71;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.fudo-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  flex-shrink: 0;
  box-shadow: 0 0 6px #2ecc71;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}
.fudo-live-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fudo-live-label {
  font-size: .65em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.fudo-live-value {
  font-size: .9em;
  font-weight: 600;
  color: var(--text);
}
.fudo-live-refresh {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s;
  flex-shrink: 0;
}
.fudo-live-refresh:hover { color: var(--text); }
.fudo-cards-2x2 {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* ── Medios de pago (ventas) ──────────────────────────────────── */
.fudo-pay-split {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.fudo-pay-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.fudo-pay-icon {
  font-size: 1.3em;
  flex-shrink: 0;
}
.fudo-pay-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.fudo-pay-label {
  font-size: 0.72em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fudo-pay-value {
  font-size: 1em;
  font-weight: 700;
  color: var(--text);
}
.fudo-pay-pct {
  font-size: 0.85em;
  color: var(--muted);
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

/* ── Calendario de selección de fechas ────────────────────── */
#fudo-cal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#fudo-cal-modal {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 20px;
  width: min(340px, 92vw);
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
}
.fudo-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.fudo-cal-header button {
  background: none;
  border: 1px solid #333;
  border-radius: 8px;
  color: #aaa;
  font-size: 1.4em;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.fudo-cal-header button:hover:not(:disabled) { border-color: #c8283c; color: #fff; }
.fudo-cal-header button:disabled { opacity: 0.25; cursor: not-allowed; }
#fudo-cal-month-lbl {
  font-weight: 700; font-size: 1em; color: #fff; text-transform: capitalize;
}
.fudo-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.7em;
  color: #555;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fudo-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.fudo-cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.88em;
  cursor: pointer;
  color: #bbb;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
}
.fudo-cal-day:hover:not(.empty):not(.future) { background: #2a2a2a; border-color: #444; }
.fudo-cal-day.empty { cursor: default; pointer-events: none; }
.fudo-cal-day.future { opacity: 0.22; cursor: not-allowed; pointer-events: none; }
.fudo-cal-day.current-shift { border-color: #555; color: #fff; font-weight: 700; }
.fudo-cal-day.selected {
  background: #c8283c22;
  border-color: #c8283c88;
  color: #fff;
  font-weight: 700;
}
.fudo-cal-day.selected.current-shift { border-color: #c8283c; }
.fudo-cal-footer {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}
.fudo-cal-btn-sec, .fudo-cal-btn-pri {
  padding: 9px 0;
  border-radius: 8px;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
  border: none;
  flex: 1;
}
.fudo-cal-btn-sec { background: #2a2a2a; color: #888; border: 1px solid #333; }
.fudo-cal-btn-pri { background: #c8283c; color: #fff; }
.fudo-cal-btn-pri:hover { background: #e0303f; }
.fudo-cal-count {
  font-size: 0.75em;
  color: #888;
  white-space: nowrap;
  text-align: center;
  min-width: 60px;
}

/* Etiqueta de fecha clickeable */
#fudo-date-label,
#fudo-prod-date-label {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 8px;
  transition: background 0.15s;
  text-decoration: underline dotted #555;
  text-underline-offset: 3px;
}
#fudo-date-label:hover,
#fudo-prod-date-label:hover { background: rgba(255,255,255,0.06); }

/* ══ Fichar card en units ═══════════════════════════════════════════════════ */
.unit-card-fichar {
  border-color: #2e4a2e;
  background: linear-gradient(135deg, #111 60%, #0d1f0d);
}
.unit-card-fichar:hover { border-color: #4caf50; }
.unit-card-fichar .unit-icon { filter: none; }

/* ══ Pantalla fichar ════════════════════════════════════════════════════════ */
.fichar-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 24px 16px;
  overflow-y: auto;
}

.fichar-qr-icon-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid #333;
  border-radius: 8px;
  color: #aaa;
  font-size: 0.8em;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
  letter-spacing: 1px;
}
.fichar-qr-icon-btn:hover { border-color: #aaa; color: #fff; }

/* Status card */
.fichar-status-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.fichar-status-card.clocked-in {
  border-color: #4caf5066;
  background: #0d1f0d;
}
.fichar-status-icon { font-size: 2.4em; }
.fichar-status-title { font-size: 1.05em; font-weight: 700; color: var(--text); }
.fichar-status-sub   { font-size: 0.8em; color: var(--muted); margin-top: 3px; }

/* Botón principal */
.fichar-btn {
  width: 100%;
  max-width: 420px;
  padding: 18px;
  background: #c8283c;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.5px;
}
.fichar-btn:hover  { background: #e0303f; }
.fichar-btn:active { transform: scale(0.98); }

/* Scanner */
.fichar-scanner-wrap {
  width: 100%;
  max-width: 420px;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
}
.fichar-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.fichar-scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.fichar-scan-frame {
  width: 60%;
  aspect-ratio: 1;
  border: 3px solid #fff;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
}
.fichar-scan-hint {
  color: #fff;
  font-size: 0.85em;
  background: rgba(0,0,0,0.5);
  padding: 4px 12px;
  border-radius: 20px;
}
.fichar-cancel-scan {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  border: 1px solid #555;
  border-radius: 20px;
  color: #fff;
  padding: 7px 20px;
  font-size: 0.88em;
  cursor: pointer;
}

/* Confirmación */
.fichar-confirm {
  width: 100%;
  max-width: 420px;
  background: #0d1f0d;
  border: 1px solid #4caf5066;
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
  font-size: 0.95em;
  color: #eee;
  line-height: 1.6;
}
.fichar-confirm.out { background: #1a0a0c; border-color: #c8283c55; }

/* ══ Modal QR para imprimir ══════════════════════════════════════════════════ */
#fichar-qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
}
.fichar-qr-modal-inner {
  background: #f5f5f5;
  border-radius: 14px;
  padding: 24px;
  width: min(500px, 95vw);
  color: #111;
}
.fichar-qr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.1em;
  margin-bottom: 8px;
}
.fichar-qr-modal-header button {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: #555;
}
.fichar-qr-hint { font-size: 0.82em; color: #555; margin-bottom: 20px; }
.fichar-qr-grid {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.fichar-qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.fichar-qr-label {
  font-size: 0.85em;
  font-weight: 600;
  color: #333;
}
.fichar-qr-item canvas { border-radius: 6px; }

/* ══ Campos laborales en form usuario ════════════════════════════════════════ */
.form-section-title {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.pay-type-row {
  display: flex;
  gap: 12px;
}
.pay-type-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  flex: 1;
  justify-content: center;
  font-size: 0.88em;
  transition: border-color 0.15s;
}
.pay-type-opt:has(input:checked) { border-color: #c8283c66; color: #fff; }
.pay-type-opt input { accent-color: #c8283c; }

/* Fichar — file input / processing */
.fichar-processing {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9em;
  padding: 16px;
}
.fichar-spinner {
  width: 22px; height: 22px;
  border: 3px solid #333;
  border-top-color: #c8283c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Fichar — botones de local */
.fichar-locales {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fichar-locales-hint {
  font-size: 0.8em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 4px;
}
.fichar-local-btn {
  width: 100%;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-size: 1.05em;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: left;
}
.fichar-local-btn span:first-child { font-size: 1.6em; }
.fichar-local-btn:hover  { border-color: #c8283c66; background: #1a0a0c; }
.fichar-local-btn:active { transform: scale(0.98); }
.fichar-local-btn.clocked-here {
  border-color: #4caf5088;
  background: #0d1f0d;
}

/* ── Historial mensual de fichajes ─────────────────────────────────────── */
.fichar-hist-wrap {
  width: 100%;
  max-width: 420px;
  margin-top: 8px;
}
.fichar-hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.fichar-hist-nav {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #aaa;
  font-size: 1.4em;
  width: 36px; height: 36px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s;
}
.fichar-hist-nav:hover  { border-color: #555; color: #fff; }
.fichar-hist-nav:disabled { opacity: 0.25; cursor: not-allowed; }
.fichar-hist-month {
  font-weight: 700;
  font-size: 0.95em;
  color: #fff;
  text-transform: capitalize;
}
.fichar-hist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fichar-hist-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
}
.fichar-hist-row.incomplete { border-color: #c8283c33; }
.fichar-hist-date {
  font-size: 0.82em;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}
.fichar-hist-local {
  font-size: 0.7em;
  color: var(--muted);
}
.fichar-hist-times {
  font-size: 0.8em;
  color: #aaa;
  line-height: 1.7;
  text-align: right;
}
.fichar-hist-dur {
  font-size: 0.78em;
  font-weight: 700;
  color: #4caf50;
  text-align: right;
  grid-column: 2;
}
.fichar-hist-pending {
  font-size: 0.75em;
  color: #c8283c;
  grid-column: 2;
  text-align: right;
}
.fichar-hist-total {
  margin-top: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.85em;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fichar-hist-total strong { color: #fff; font-size: 1.05em; }
.fichar-empty {
  color: var(--muted);
  font-size: 0.85em;
  text-align: center;
  padding: 20px 0;
}

/* ── Fudo: mesas abiertas en verde ── */
.fudo-sale-open {
  background: rgba(40, 160, 80, 0.08);
  border-left: 3px solid #28a050;
}
.fudo-sale-open .fudo-sale-tipo {
  color: #4cca70;
  font-weight: 700;
}
.fudo-sale-open .fudo-sale-hora {
  color: #4cca7099;
}
.fudo-sale-open .fudo-sale-total {
  color: #4cca70;
}
.fudo-sale-sep {
  text-align: center;
  font-size: 0.7em;
  color: #444;
  letter-spacing: 1px;
  padding: 6px 0 4px;
  text-transform: uppercase;
}


/* ── Pantalla Sueldos ─────────────────────────────────────── */
.sueldos-mes-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #181818;
  border-bottom: 1px solid #2a2a2a;
}
.sueldos-mes-nav button {
  background: #222;
  border: 1px solid #333;
  color: #ccc;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 1em;
  cursor: pointer;
}
.sueldos-mes-nav button:disabled { opacity: 0.3; }
.sueldos-mes-title {
  font-size: 1em;
  font-weight: 700;
  color: #fff;
  text-transform: capitalize;
}
.sueldos-resumen {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  background: #141414;
  border-bottom: 1px solid #222;
  flex-wrap: wrap;
}

/* Card de empleado */
.sueldo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sueldo-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
}
.sueldo-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #222;
  border: 2px solid #333;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1em;
  flex-shrink: 0;
}
.sueldo-info { flex: 1; min-width: 0; }
.sueldo-nombre {
  font-size: 0.92em;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sueldo-rol {
  font-size: 0.7em;
  color: #666;
  margin-top: 1px;
}
.sueldo-monto {
  text-align: right;
  flex-shrink: 0;
}
.sueldo-monto-num {
  font-size: 1em;
  font-weight: 800;
  color: #4cca70;
}
.sueldo-monto-sin {
  font-size: 0.75em;
  color: #555;
}
.sueldo-monto-detalle {
  font-size: 0.68em;
  color: #666;
  margin-top: 2px;
}

/* Detalle expandible */
.sueldo-detalle {
  display: none;
  border-top: 1px solid #222;
  padding: 10px 14px 14px;
}
.sueldo-detalle.open { display: block; }
.sueldo-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.sueldo-stat {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.75em;
  color: #aaa;
}
.sueldo-stat span { color: #fff; font-weight: 700; margin-left: 4px; }
.sueldo-edit-btn {
  width: 100%;
  padding: 9px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  color: #aaa;
  font-size: 0.82em;
  cursor: pointer;
  text-align: center;
  margin-top: 8px;
}
.sueldo-edit-btn:active { background: #2a2a2a; }

/* Turnos mini lista */
.sueldo-turnos { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.sueldo-turno-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75em;
  color: #888;
  padding: 3px 0;
  border-bottom: 1px solid #1e1e1e;
}
.sueldo-turno-row:last-child { border-bottom: none; }
.sueldo-turno-dur { color: #ccc; font-weight: 600; }

/* Modal tarifa */
.sueldos-modal-box {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 16px 16px 0 0;
  padding: 24px 20px 32px;
  width: 100%;
  max-width: 480px;
}

.unit-card-sueldos {
  border-color: #4cca7044;
  background: linear-gradient(135deg, #0d1a0f 0%, #111 100%);
}
.unit-card-sueldos .unit-icon { color: #4cca70; }
.unit-card-sueldos .unit-name { color: #4cca70; }

/* ── Agregaciones Fudo ── */
.fudo-agreg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fudo-agreg-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}
.agreg-hora {
  font-size: 0.78em;
  color: #888;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.agreg-info {
  flex: 1;
  min-width: 0;
}
.agreg-producto {
  font-size: 0.95em;
  color: #eee;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agreg-qty {
  font-size: 0.78em;
  padding: 2px 7px;
  border-radius: 8px;
  background: #c8283c22;
  color: #c8283c;
  border: 1px solid #c8283c44;
}
.agreg-mozo {
  font-size: 0.78em;
  color: #666;
  margin-top: 2px;
}

/* ── Agregaciones Fudo ── */
.fudo-agreg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fudo-agreg-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}
.agreg-hora {
  font-size: 0.78em;
  color: #888;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.agreg-info {
  flex: 1;
  min-width: 0;
}
.agreg-producto {
  font-size: 0.95em;
  color: #eee;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agreg-qty {
  font-size: 0.78em;
  padding: 2px 7px;
  border-radius: 8px;
  background: #c8283c22;
  color: #c8283c;
  border: 1px solid #c8283c44;
}
.agreg-mozo {
  font-size: 0.78em;
  color: #666;
  margin-top: 2px;
}

/* ── Agregaciones Fudo ── */
.fudo-agreg-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fudo-agreg-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
}
.agreg-hora {
  font-size: 0.78em;
  color: #888;
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.agreg-info {
  flex: 1;
  min-width: 0;
}
.agreg-producto {
  font-size: 0.95em;
  color: #eee;
  display: flex;
  align-items: center;
  gap: 8px;
}
.agreg-qty {
  font-size: 0.78em;
  padding: 2px 7px;
  border-radius: 8px;
  background: #c8283c22;
  color: #c8283c;
  border: 1px solid #c8283c44;
}
.agreg-mozo {
  font-size: 0.78em;
  color: #666;
  margin-top: 2px;
}

/* ── Card Usuarios en pantalla inicio ── */
.unit-card-usuarios {
  border-color: #4a7cc844;
  background: linear-gradient(135deg, #0a0f1a 0%, #111 100%);
}
.unit-card-usuarios .unit-icon { color: #4a7cc8; }
.unit-card-usuarios .unit-name { color: #4a7cc8; }

/* ── Card Presencia en pantalla inicio ── */
.unit-card-presencia {
  border-color: #9b59b644;
  background: linear-gradient(135deg, #12091a 0%, #111 100%);
}
.unit-card-presencia .unit-icon { color: #9b59b6; }
.unit-card-presencia .unit-name { color: #9b59b6; }

/* ── Pantalla presencia ── */
.presencia-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.presencia-local {
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  overflow: hidden;
}
.presencia-local-out {
  border-color: #222;
  opacity: .85;
}
.presencia-local-title {
  padding: 12px 16px 10px;
  font-size: .85em;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #222;
}
.presencia-count {
  background: #c8283c22;
  color: #c8283c;
  border: 1px solid #c8283c44;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: .8em;
  font-weight: 700;
}
.presencia-count-out {
  background: #2a2a2a;
  color: #666;
  border-color: #333;
}
.presencia-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #1e1e1e;
}
.presencia-row:last-child { border-bottom: none; }
.presencia-row-in { background: #0d1a0d; }
.presencia-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  flex-shrink: 0;
  background: #1e1e1e;
}
.presencia-info { flex: 1; min-width: 0; }
.presencia-name { font-size: .9em; color: #eee; font-weight: 600; }
.presencia-role { font-size: .72em; color: #666; margin-top: 1px; }
.presencia-times { text-align: right; flex-shrink: 0; }
.presencia-elapsed {
  font-size: .88em;
  font-weight: 700;
  color: #4cca70;
  font-variant-numeric: tabular-nums;
}
.presencia-hoy  { font-size: .72em; color: #888; margin-top: 2px; }
.presencia-mes  { font-size: .72em; color: #666; }

/* ── Card Presencia en pantalla inicio ── */
.unit-card-presencia {
  border-color: #9b59b644;
  background: linear-gradient(135deg, #12091a 0%, #111 100%);
}
.unit-card-presencia .unit-icon { color: #9b59b6; }
.unit-card-presencia .unit-name { color: #9b59b6; }

/* ── Pantalla presencia ── */
.presencia-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.presencia-local {
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  overflow: hidden;
}
.presencia-local-out {
  border-color: #222;
  opacity: .85;
}
.presencia-local-title {
  padding: 12px 16px 10px;
  font-size: .85em;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #222;
}
.presencia-count {
  background: #c8283c22;
  color: #c8283c;
  border: 1px solid #c8283c44;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: .8em;
  font-weight: 700;
}
.presencia-count-out {
  background: #2a2a2a;
  color: #666;
  border-color: #333;
}
.presencia-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #1e1e1e;
}
.presencia-row:last-child { border-bottom: none; }
.presencia-row-in { background: #0d1a0d; }
.presencia-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  flex-shrink: 0;
  background: #1e1e1e;
}
.presencia-info { flex: 1; min-width: 0; }
.presencia-name { font-size: .9em; color: #eee; font-weight: 600; }
.presencia-role { font-size: .72em; color: #666; margin-top: 1px; }
.presencia-times { text-align: right; flex-shrink: 0; }
.presencia-elapsed {
  font-size: .88em;
  font-weight: 700;
  color: #4cca70;
  font-variant-numeric: tabular-nums;
}
.presencia-hoy  { font-size: .72em; color: #888; margin-top: 2px; }
.presencia-mes  { font-size: .72em; color: #666; }

/* live badge */
.presencia-live {
  font-size: .65em;
  color: #4cca70;
  font-weight: 700;
  letter-spacing: .03em;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.presencia-sessions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.presencia-sess {
  font-size: .7em;
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 2px 7px;
  color: #888;
  white-space: nowrap;
}
.presencia-sess-active {
  background: #0d1a0d;
  border-color: #4cca7044;
  color: #4cca70;
}
.presencia-elapsed-done { color: #aaa; }

/* Agregaciones — meta row (mesa + precio) */
.agreg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.agreg-price {
  font-size: 0.82em;
  font-weight: 600;
  color: #6dbf6d;
  letter-spacing: 0.02em;
}

/* Agregaciones — precio con descuento */
.agreg-desc {
  font-size: 0.85em;
  font-weight: 600;
  color: #f0c040;
  margin-left: 6px;
}

/* Ventas — descuento por mesa */
.fudo-sale-amounts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.fudo-sale-desc {
  font-size: 0.75em;
  font-weight: 600;
  color: #f0c040;
  line-height: 1;
}

/* ── Popup detalle de venta ── */
.fudo-sale-clickable { cursor: pointer; }
.fudo-sale-clickable:active { background: #2a2a2a; }

.sale-popup-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9999;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s ease;
}
.sale-popup {
  background: #1c1c1c;
  border-radius: 16px 16px 0 0;
  width: 100%; max-width: 480px;
  max-height: 80vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.sp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #2a2a2a;
}
.sp-titulo {
  font-weight: 700; font-size: 1em; color: #fff;
}
.sp-hora {
  font-size: 0.82em; color: var(--muted);
}
.sp-items {
  overflow-y: auto; flex: 1;
  padding: 8px 0;
}
.sp-item {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid #252525;
  gap: 12px;
}
.sp-item:last-child { border-bottom: none; }
.sp-item-left { flex: 1; min-width: 0; }
.sp-item-name { font-size: 0.9em; color: #ddd; }
.sp-item-qty  { color: var(--muted); font-size: 0.85em; }
.sp-item-comment { font-size: 0.75em; color: var(--muted); margin-top: 2px; font-style: italic; }
.sp-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.sp-item-price { font-size: 0.88em; font-weight: 600; color: #6dbf6d; }
.sp-item-desc  { font-size: 0.75em; color: #f0c040; }
.sp-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 0.85em; }
.sp-footer {
  border-top: 1px solid #2a2a2a;
  padding: 12px 20px 24px;
}
.sp-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0;
  font-size: 0.9em; color: #ccc;
}
.sp-desc-row { color: #f0c040; }
.sp-desc-amt { font-weight: 600; color: #f0c040; }
.sp-total-amt { font-weight: 700; font-size: 1.05em; color: #fff; }

/* Facturación — ícono en fila */
.fudo-sale-amounts {
  display: flex; align-items: center; gap: 6px;
}
.fudo-inv-icon { font-size: 1em; opacity: 0.85; }

/* Popup — badge facturación */
.sp-header { flex-direction: column; gap: 6px; align-items: flex-start; }
.sp-header-left { display: flex; flex-direction: column; gap: 2px; }
.sp-header-right { display: flex; align-items: center; gap: 8px; width: 100%; justify-content: space-between; }
.sp-pay-method { font-size: 0.75em; color: var(--muted); }
.sp-inv-badge {
  font-size: 0.75em; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
}
.sp-inv-yes { background: #1a3a1a; color: #6dbf6d; border: 1px solid #2a5a2a; }
.sp-inv-no  { background: #3a3010; color: #f0c040; border: 1px solid #5a4a10; }

/* Item precio cero */
.sp-zero-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: #e05555;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
.sp-item-price--zero { color: #e05555; }

/* Dot items precio cero en lista de mesas */
.fudo-zero-dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: #e05555;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}

/* ══ MÓDULOS PRÓXIMAMENTE ══ */
.module-soon-badge {
  font-size: .55em;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

/* ══ COLLAGE SLIDESHOW ══ */
.collage-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .2s, transform .15s;
}
.collage-thumb img { width:100%;height:100%;object-fit:cover;display:block; }
.collage-thumb:hover { transform: scale(1.03); }
.collage-thumb-active { border-color: var(--red); }

/* ══ CÁMARAS ══ */
.camera-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.camera-name { font-size: .8em; font-weight: 600; color: var(--text); }
.cam-offline {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: .8em;
}
