:root {
  --bg: #f0f4f8;
  --bg2: #ffffff;
  --bg3: #f8fafc;
  --surface: #f1f5f9;
  --surface2: #e2e8f0;
  --border: #e2e8f0;
  --border2: #cbd5e1;
  --text: #0f172a;
  --muted: #94a3b8;
  --muted2: #64748b;
  --accent: #1d6cf0;
  --accent2: #3b82f6;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --pink: #db2777;
  --cyan: #0891b2;

  /* shift colors */
  --s-t2: #1a3a2a;
  --s-t2c: #34d399;
  --s-t3: #1a2a4a;
  --s-t3c: #6c8eff;
  --s-t4: #0d2a35;
  --s-t4c: #22d3ee;
  --s-ta: #3a2a0d;
  --s-tac: #fbbf24;
  --s-ta1: #3a1f0d;
  --s-ta1c: #fb923c;
  --s-tb: #3a1515;
  --s-tbc: #f87171;
  --s-te: #2a1a3a;
  --s-tec: #a78bfa;
  --s-n: #1a1030;
  --s-nc: #818cf8;
  --s-v: #1a2030;
  --s-vc: #94a3b8;
  --s-p: #1e2030;
  --s-pc: #64748b;
  --s-f: #3a1010;
  --s-fc: #ef4444;
  --s-m: #1a3a2a;
  --s-mc: #4ade80;
  --s-t1: #3a2a0d;
  --s-t1c: #fcd34d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}

body {
  font-family: "Instrument Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── LOGIN ── */
#login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #f0f4f8 0%, #e8f0fe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-wrap {
  width: 420px;
  max-width: 92vw;
  padding: 48px 40px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}
.login-wrap::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -80px;
  width: 220px;
  height: 220px;
  background: radial-gradient(
    circle,
    rgba(29, 108, 240, 0.08) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.login-logo {
  font-family: "Syne", sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 6px;
}
.login-logo em,
.logo em {
  color: var(--accent);
  font-style: normal;
}
.login-sub {
  font-size: 13px;
  color: var(--muted2);
  margin-bottom: 32px;
}
.login-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted2);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.login-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 10px;
  color: var(--text);
  font-family: "Instrument Sans", sans-serif;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.15s;
}
.login-input:focus {
  border-color: var(--accent);
}
.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: "Syne", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s;
}
.login-btn:hover {
  background: #5a7de8;
  transform: translateY(-1px);
}
.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.login-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 14px;
  display: none;
}
.login-reg-link {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}
.login-reg-link a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.login-reg-link a:hover {
  text-decoration: underline;
}

/* ── APP SHELL ── */
#app {
  display: none;
}

/* ── HEADER ── */
.header {
  height: 56px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.logo {
  font-family: "Syne", sans-serif;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.company-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--muted2);
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.header-sep {
  flex: 1;
}
.tabs {
  display: flex;
  gap: 2px;
}
.tab {
  padding: 6px 14px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.tab:hover {
  background: var(--surface);
  color: var(--text);
}
.tab.active {
  background: var(--accent);
  color: #fff;
}
.tab.tab-admin {
  color: var(--accent);
}
.tab.tab-admin.active {
  background: var(--accent);
  color: #fff;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted2);
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.logout-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.12s;
}
.logout-btn:hover {
  color: var(--red);
}

/* ── TOOLBAR ── */
.toolbar {
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.toolbar-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.search-input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
  font-family: "Instrument Sans", sans-serif;
  font-size: 12px;
  width: 180px;
  outline: none;
  transition: border-color 0.12s;
}
.search-input:focus {
  border-color: var(--accent);
}
.filter-btn {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: "Instrument Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.filter-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}
.filter-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(108, 142, 255, 0.08);
}
.month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.month-nav button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted2);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.month-nav button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.month-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 500;
  min-width: 90px;
  text-align: center;
  color: var(--text);
}
.action-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--muted2);
  font-family: "Instrument Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── MAIN ── */
.main {
  padding: 16px 20px;
}

/* ── VIEWS ── */
.view {
  display: none;
}
.view.active {
  display: block;
}

/* ── TABLE ── */
.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  max-height: calc(100vh - 148px);
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 900px;
}
thead th {
  background: var(--bg3);
  padding: 8px 5px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted2);
  border-bottom: 1px solid var(--border2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  font-family: "IBM Plex Mono", monospace;
}
thead th.name-col {
  text-align: left;
  padding-left: 14px;
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--bg3);
  border-right: 1px solid var(--border2);
}
thead th.day-sun {
  background: #fff1f2 !important;
  color: #e11d48 !important;
}
thead th.day-sat {
  color: var(--amber) !important;
}
thead th.day-today {
  color: var(--accent) !important;
  font-weight: 700;
}
thead th.week-sep {
  border-left: 2px solid var(--border2) !important;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.08s;
}
tbody tr:last-child {
  border-bottom: none;
}
tbody tr:hover {
  background: #f8faff;
}

td {
  padding: 5px 3px;
  text-align: center;
  vertical-align: middle;
}
td.name-cell {
  text-align: left;
  padding: 6px 14px;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: var(--bg2);
  z-index: 5;
  border-right: 1px solid var(--border2);
}
tbody tr:hover td.name-cell {
  background: #f8faff;
}
td.col-sun {
  background: #fff5f5 !important;
}
td.week-sep {
  border-left: 2px solid var(--border2) !important;
}

.person-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: color 0.12s;
}
.gen-name-wrap:hover .person-name {
  color: var(--accent);
}
/* Avatar + nombre en la vista General (mismo patrón que Horario/Almuerzos) */
.gen-name-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}
.gen-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.02em;
}
.gen-name-text {
  min-width: 0;
}
.person-user {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}

/* section rows */
.section-row td {
  font-family: "Syne", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 7px 14px;
  text-align: left;
}
/* Subseparador de puesto dentro de una oficina — mismo color que la oficina
   pero un tono más pálido. El color/borde lo dan las variantes .sub-gN. */
.section-row-sub td {
  font-family: "IBM Plex Mono", monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 14px 4px 28px;
  text-align: left;
  color: var(--muted2);
  background: var(--bg2, #fafafa);
  border-top: 1px solid var(--border);
}
/* Variantes de color por oficina (fondo pálido = el de la oficina mezclado
   con blanco; texto y borde, el de la oficina). */
.section-row-sub.sub-g1 td { background: color-mix(in srgb, #eff6ff 55%, #fff); color: #1d4ed8; border-top: 1px solid #dbeafe; }
.section-row-sub.sub-g2 td { background: color-mix(in srgb, #f0fdf4 55%, #fff); color: #166534; border-top: 1px solid #d1fae5; }
.section-row-sub.sub-g3 td { background: color-mix(in srgb, #faf5ff 55%, #fff); color: #6b21a8; border-top: 1px solid #f3e8ff; }
.section-row-sub.sub-g4 td { background: color-mix(in srgb, #fffbeb 55%, #fff); color: #92400e; border-top: 1px solid #fef3c7; }
.section-row-sub.sub-g5 td { background: color-mix(in srgb, #fff1f2 55%, #fff); color: #9f1239; border-top: 1px solid #ffe4e6; }
.section-row-sub.sub-g6 td { background: color-mix(in srgb, #ecfeff 55%, #fff); color: #155e75; border-top: 1px solid #cffafe; }
.section-row-sub.sub-g7 td { background: color-mix(in srgb, #fdf2f8 55%, #fff); color: #9d174d; border-top: 1px solid #fce7f3; }
.section-row-sub.sub-g8 td { background: color-mix(in srgb, #f0fdf4 55%, #fff); color: #14532d; border-top: 1px solid #d1fae5; }
.section-row-sub.sub-g9 td { background: color-mix(in srgb, #fff7ed 55%, #fff); color: #9a3412; border-top: 1px solid #ffedd5; }
.section-row-sub.sub-g10 td { background: color-mix(in srgb, #f8fafc 55%, #fff); color: #334155; border-top: 1px solid #f1f5f9; }
.sec-g1 td {
  background: #eff6ff;
  color: #1d4ed8;
  border-top: 1px solid #bfdbfe;
}
.sec-g2 td {
  background: #f0fdf4;
  color: #166534;
  border-top: 1px solid #bbf7d0;
}
.sec-g3 td {
  background: #faf5ff;
  color: #6b21a8;
  border-top: 1px solid #e9d5ff;
}
.sec-g4 td {
  background: #fffbeb;
  color: #92400e;
  border-top: 1px solid #fde68a;
}
.sec-g5 td {
  background: #fff1f2;
  color: #9f1239;
  border-top: 1px solid #fecdd3;
}
.sec-g6 td {
  background: #ecfeff;
  color: #155e75;
  border-top: 1px solid #a5f3fc;
}
.sec-g7 td {
  background: #fdf2f8;
  color: #9d174d;
  border-top: 1px solid #f9a8d4;
}
.sec-g8 td {
  background: #f0fdf4;
  color: #14532d;
  border-top: 1px solid #86efac;
}
.sec-g9 td {
  background: #fff7ed;
  color: #9a3412;
  border-top: 1px solid #fed7aa;
}
.sec-g10 td {
  background: #f8fafc;
  color: #334155;
  border-top: 1px solid #e2e8f0;
}

/* ── SHIFT BADGES ── */
.shift {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 24px;
  padding: 0 5px;
  border-radius: 5px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 0.1s,
    box-shadow 0.1s;
  position: relative;
  white-space: nowrap;
}
.shift:hover {
  transform: scale(1.15);
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.shift.today-cell {
  box-shadow: 0 0 0 2px var(--accent) !important;
}
.shift-empty {
  background: transparent !important;
  border: none !important;
  cursor: default;
}
.shift-empty:hover {
  transform: none !important;
}

/* editable cell */
.shift-editable {
  cursor: cell;
}
.shift-editable:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 1px var(--accent);
}
.cell-editing select {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 5px;
  outline: none;
  padding: 2px 3px;
  width: 58px;
  cursor: pointer;
}

/* TOOLTIP */
.tip-wrap {
  position: relative;
  display: inline-block;
}
.tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 200px;
  max-width: 280px;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}
.tip-wrap:hover .tip {
  display: block;
}
.tip-title {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 5px;
  color: var(--text);
}
.tip-row {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--muted2);
  margin-top: 2px;
}
.tip-row span:first-child {
  font-weight: 600;
  color: var(--text);
  min-width: 28px;
}

/* ── LEGEND ── */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg2);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted2);
}

/* ── PERSONAL VIEW ── */
.personal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px 18px;
  background: var(--bg2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.personal-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Syne", sans-serif;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.personal-info h2 {
  font-family: "Syne", sans-serif;
  font-size: 16px;
  font-weight: 700;
}
.personal-info p {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--muted2);
  margin-top: 2px;
}
.person-select-wrap {
  margin-bottom: 14px;
}
.sel-input {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  outline: none;
  min-width: 240px;
  cursor: pointer;
}
.sel-input:focus {
  border-color: var(--accent);
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-top: 10px;
}
.cal-hdr {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 0;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
}
.cal-day {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 5px;
  text-align: center;
  min-height: 60px;
  transition: border-color 0.12s;
}
.cal-day.empty {
  background: transparent;
  border-color: transparent;
}
.cal-day.today {
  border-color: var(--accent);
}
.cal-day-num {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
  font-family: "IBM Plex Mono", monospace;
}
.cal-day.today .cal-day-num {
  color: var(--accent);
  font-weight: 600;
}
.cal-shift {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  width: 100%;
  margin-bottom: 2px;
}
.cal-hours {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.3;
}

/* ── TURNOS VIEW ── */
.turnos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.turno-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.12s;
}
.turno-card:hover {
  border-color: var(--border2);
}
.turno-code {
  margin-bottom: 10px;
}
.turno-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted2);
}
.turno-row:last-child {
  border-bottom: none;
}
.turno-row span:first-child {
  color: var(--text);
  font-weight: 500;
}

/* ── ADMIN VIEW ── */
.admin-layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 110px);
}
.admin-sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 14px 0;
}
.admin-sidebar-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 14px 10px;
  font-family: "Syne", sans-serif;
}
.admin-nav-btn {
  display: block;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  color: var(--muted2);
  cursor: pointer;
  transition: all 0.12s;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.admin-nav-btn:hover {
  background: var(--surface);
  color: var(--text);
}
.admin-nav-btn.active {
  color: var(--accent);
  background: rgba(29, 108, 240, 0.06);
  border-left-color: var(--accent);
}
.admin-content {
  flex: 1;
  padding: 20px;
  overflow: visible;
}
.admin-section {
  display: none;
}
.admin-section.active {
  display: block;
}

.a-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.a-card-title {
  font-family: "Syne", sans-serif;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.a-badge {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  background: #dbeafe;
  color: var(--accent);
}
.a-badge.amber {
  background: #fef3c7;
  color: var(--amber);
}

/* form elements */
.f-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.f-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.f-input,
.f-select {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--text);
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  outline: none;
  min-width: 150px;
  transition: border-color 0.12s;
}
.f-input:focus,
.f-select:focus {
  border-color: var(--accent);
}
.f-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: #5a7de8;
}
.btn-ghost {
  background: var(--bg3);
  color: var(--muted2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  border: 1px solid rgba(248, 113, 113, 0.2);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
}
.btn-amber {
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
  border: 1px solid rgba(251, 191, 36, 0.2);
}
.btn-amber:hover {
  background: var(--amber);
  color: var(--bg);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* shifts editor grid */
.se-wrap {
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.se-table {
  border-collapse: collapse;
  min-width: 600px;
  width: 100%;
}
.se-table th {
  background: var(--bg3);
  padding: 6px 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--muted2);
  border-bottom: 1px solid var(--border2);
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 5;
  font-family: "IBM Plex Mono", monospace;
}
.se-table th.se-name {
  text-align: left;
  padding-left: 12px;
  min-width: 120px;
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--bg3);
  border-right: 1px solid var(--border2);
}
.se-table td {
  padding: 3px 2px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.se-table td.se-name-cell {
  text-align: left;
  padding: 4px 12px;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: var(--bg3);
  z-index: 3;
  font-size: 12px;
  font-weight: 500;
  border-right: 1px solid var(--border);
}
.se-cell-select {
  width: 100%;
  padding: 3px 2px;
  font-size: 12px;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  outline: none;
  transition: border-color 0.1s;
  /* Desactiva el renderizado nativo de Safari/Chrome para que respete color y fuente */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.se-cell-select:hover,
.se-cell-select:focus {
  border-color: var(--accent);
  background: var(--bg3);
}
.se-cell-select.changed {
  border-color: var(--amber) !important;
  background: #fffbeb !important;
}
.se-week-sep {
  border-left: 2px solid var(--border2) !important;
}

/* ── Editor de horarios: fines de semana y separación de semanas ── */
/* Cabecera (fila 2): nombre del día coloreado */
.se-th-day.is-sat .se-th-day-name,
.se-th-day.is-sat .se-th-day-num {
  color: var(--amber) !important;
}
.se-th-day.is-sun .se-th-day-name,
.se-th-day.is-sun .se-th-day-num {
  color: #e11d48 !important;
}
.se-th-day.is-sat {
  background: rgba(245, 158, 11, 0.07) !important;
}
.se-th-day.is-sun {
  background: rgba(225, 29, 72, 0.06) !important;
}
/* Línea vertical de separación de semana (cabecera y cuerpo) */
.se-th-day.is-week-start,
.se-week-start-cell {
  border-left: 2px solid var(--border2) !important;
}

/* workers table */
.w-table {
  width: 100%;
  border-collapse: collapse;
}
.w-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.w-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.w-table tr:last-child td {
  border-bottom: none;
}
.w-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.g-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}
.g1 {
  background: #dbeafe;
  color: #1d4ed8;
}
.g2 {
  background: #d1fae5;
  color: #065f46;
}
.g3 {
  background: #ede9fe;
  color: #5b21b6;
}
.g4 {
  background: #fef3c7;
  color: #92400e;
}
.g5 {
  background: #fee2e2;
  color: #991b1b;
}
.g6 {
  background: #cffafe;
  color: #155e75;
}
.g7 {
  background: #fce7f3;
  color: #9d174d;
}
.g8 {
  background: #f0fdf4;
  color: #14532d;
}
.g9 {
  background: #fff7ed;
  color: #9a3412;
}
.g10 {
  background: #f1f5f9;
  color: #334155;
}

/* month cards */
.m-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.m-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.m-card-name {
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 3px;
}
.m-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.m-card-actions {
  display: flex;
  gap: 6px;
}

/* ── Listado de meses ── */
.m-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}
.m-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.12s;
}
.m-row:hover {
  border-color: var(--border2);
}
.m-row-name {
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 3px;
}
.m-row-meta {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.m-row-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
details summary::-webkit-details-marker {
  display: none;
}
details[open] #history-arrow {
  transform: rotate(90deg);
}

/* turnos editor */
.turno-def-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
}
.turno-def-code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  min-width: 50px;
  color: var(--text);
}

/* admins table */
.adm-table {
  width: 100%;
  border-collapse: collapse;
}
.adm-table th {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.adm-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.adm-table tr:last-child td {
  border-bottom: none;
}

/* toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  background: var(--text);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 100000;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
}
.toast.ok {
  background: #065f46;
  color: #fff;
}
.toast.err {
  background: #991b1b;
  color: #fff;
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-msg {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}

/* ── PERSONAL MONTH BADGE ── */
.personal-month-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.personal-month-name {
  display: none;
}
.personal-month-year {
  font-family: "Syne", sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.5px;
}

/* ── Drag & drop turnos ── */
.turno-tbody tr[draggable] {
  cursor: grab;
}
.turno-tbody tr[draggable]:active {
  cursor: grabbing;
}
.turno-drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 14px;
  padding: 0 6px;
  user-select: none;
}
.turno-tbody tr.drag-over td {
  background: rgba(29, 108, 240, 0.07) !important;
}
/* ── Drag & drop trabajadores ── */
#se-worker-tbody tr[draggable] {
  cursor: grab;
}
#se-worker-tbody tr[draggable]:active {
  cursor: grabbing;
}
#se-worker-tbody tr.worker-drag-over td {
  background: rgba(29, 108, 240, 0.1) !important;
  outline: 2px solid var(--accent);
}
.note-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  border: 1.5px solid #fff;
  pointer-events: none;
}
.shift-has-note {
  position: relative;
}
.tip-note {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--amber);
  line-height: 1.4;
}
.cal-note-text {
  font-size: 9px;
  color: var(--amber);
  line-height: 1.3;
  margin-top: 2px;
  word-break: break-word;
}
.se-note-btn {
  display: block;
  width: 100%;
  margin-top: 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  color: var(--muted);
  padding: 0;
  transition: color 0.12s;
}
.se-note-btn:hover {
  color: var(--amber);
}
.se-note-btn.has-note {
  color: var(--amber);
  font-weight: 600;
}

/* ── PRINT STYLES ── */
@media print {
  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  /* Ocultar todo excepto la vista activa */
  .header,
  .toolbar,
  nav,
  .toast,
  .modal-overlay {
    display: none !important;
  }
  body {
    background: #fff !important;
  }
  .main {
    padding: 0 !important;
  }

  /* Ocultar vistas inactivas */
  .view {
    display: none !important;
  }
  .view.active {
    display: block !important;
  }

  /* ── FICHA PERSONAL ── */
  #view-personal .personal-header {
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    margin-bottom: 12px !important;
    padding: 12px 16px !important;
    break-inside: avoid;
  }
  #view-personal .personal-avatar {
    background: linear-gradient(135deg, var(--accent), #60a5fa) !important;
  }

  #view-personal .month-grid {
    gap: 4px !important;
    margin-top: 8px !important;
  }
  #view-personal .cal-day {
    min-height: 64px !important;
    padding: 5px 4px !important;
    border: 1px solid #e2e8f0 !important;
  }
  #view-personal .cal-hdr {
    font-size: 10px !important;
  }
  #view-personal .cal-day-num {
    font-size: 11px !important;
  }
  #view-personal .cal-shift {
    font-size: 10px !important;
  }
  #view-personal .cal-hours {
    font-size: 9px !important;
  }

  /* Pie de página con empresa */
  #view-personal::after {
    content: attr(data-company) " · planifly";
    display: block;
    text-align: center;
    font-size: 9px;
    color: #94a3b8;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
  }

  /* ── TABLA GENERAL ── */
  @page {
    size: A4 landscape;
    margin: 6mm;
  }
  #view-general .table-wrap {
    overflow: visible !important;
    max-height: none !important;
    border: none !important;
    border-radius: 0 !important;
  }
  #view-general table {
    font-size: 6.5px !important;
    width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
  }
  #view-general thead th {
    font-size: 6.5px !important;
    padding: 2px 1px !important;
    position: static !important;
    background: #f0f4f8 !important;
  }
  #view-general td {
    padding: 2px 1px !important;
  }
  #view-general .shift {
    width: 18px !important;
    height: 14px !important;
    font-size: 6px !important;
    border-radius: 2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  #view-general .legend {
    display: none !important;
  }
  #view-general td.name-cell {
    position: static !important;
    background: #fff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 60px !important;
  }
  #view-general thead th.name-col {
    position: static !important;
    background: #f0f4f8 !important;
  }
  /* Totales — columnas de semana/acum */
  #view-general td.acum-cell,
  #view-general th.acum-col {
    font-size: 6px !important;
    padding: 2px 1px !important;
  }
  /* Forzar todo en una sola página */
  #view-general {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  #view-general table {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  /* Contenedor escalado por JS para encajar en 1 página */
  #print-scale-wrapper {
    transform-origin: top left;
    width: fit-content;
  }

  /* Encabezado de impresión */
  .print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent);
  }
  .print-header-logo {
    font-family: "Syne", sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
  }
  .print-header-info {
    font-size: 10px;
    color: #64748b;
    text-align: right;
  }
}

/* Ocultar print-header en pantalla */
.print-header {
  display: none;
}
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 22px 24px;
  width: fit-content;
  min-width: 280px;
  max-width: min(1100px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.15s ease;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  resize: both;
  position: relative;
}
.modal-drag-bar {
  cursor: move;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -22px -24px 14px -24px;
  padding: 10px 18px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
}
.modal-drag-bar-title {
  font-size: 12px;
  color: var(--muted2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-drag-bar-handle {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 2px;
}
@keyframes slideUp {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
/* Selects en cuadrículas de modales */
.tpl-cell,
.mtpl-cell {
  width: 100%;
  padding: 2px 1px;
  font-size: 10px;
  font-family: "IBM Plex Mono", monospace;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
}
/* Tablas en modales sin scroll horizontal forzado */
.modal-box table {
  width: 100%;
}
.modal-box .se-cell-select {
  width: 100%;
}
.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #1d4ed8;
  margin-bottom: 14px;
}

/* ── ONBOARDING ── */
#onboarding-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #f0f4f8 0%, #e8f0fe 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.ob-wrap {
  width: 600px;
  max-width: 92vw;
  padding: 56px 52px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}
.ob-wrap.ob-wide {
  width: min(92vw, 980px);
}
.ob-step {
  display: none;
}
.ob-step.active {
  display: block;
}
.ob-title {
  font-family: "Syne", sans-serif;
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.15;
}
.ob-sub {
  font-size: 15px;
  color: var(--muted2);
  margin-bottom: 32px;
  line-height: 1.6;
}
.ob-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 36px;
}
.ob-dot {
  width: 28px;
  height: 5px;
  border-radius: 3px;
  background: var(--border2);
  transition: background 0.2s;
}
.ob-dot.done {
  background: var(--accent);
}
.ob-actions {
  display: flex;
  gap: 10px;
  margin-top: 32px;
  justify-content: flex-end;
}
.ob-sector-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border: 1.5px solid var(--border2);
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}
.ob-sector-btn:hover {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(29, 108, 240, 0.08);
}
.ob-sector-btn.selected {
  border-color: var(--accent);
  border-width: 2px;
  background: rgba(29, 108, 240, 0.05);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(29, 108, 240, 0.1);
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 768px (tablets y móvil en horizontal)
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── MODAL FULL-SCREEN en móvil modo trabajador ── */
  body.has-worker-bottom-nav .modal-overlay {
    align-items: flex-end !important;
    justify-content: flex-start !important;
  }
  body.has-worker-bottom-nav .modal-box {
    position: fixed !important;
    left: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: 92dvh !important;
    min-height: unset !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    padding: 0 18px 32px 18px !important;
    resize: none !important;
    margin: 0 !important;
    overflow-y: auto !important;
  }
  /* Barra de arrastrar: ocultar texto, mostrar solo título + X */
  body.has-worker-bottom-nav .modal-drag-bar {
    cursor: default !important;
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
    margin: 0 -18px 16px -18px !important;
    padding: 14px 18px 12px !important;
    border-radius: 20px 20px 0 0 !important;
  }
  body.has-worker-bottom-nav .modal-drag-bar-handle,
  body.has-worker-bottom-nav .modal-drag-bar-title span + * {
    display: none !important;
  }
  body.has-worker-bottom-nav .modal-drag-bar-title {
    font-size: 0 !important;
  }
  body.has-worker-bottom-nav .modal-drag-bar::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border2);
    border-radius: 2px;
    margin: 0 auto 12px;
  }

  /* ── HEADER ── */
  .header {
    padding: 0 10px;
    gap: 6px;
    height: auto;
    min-height: 50px;
    flex-wrap: wrap;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .logo {
    font-size: 16px;
  }
  .company-badge {
    display: none;
  }
  /* En modo trabajador (bottom nav visible) mostrar nombre empresa junto al logo */
  body.has-worker-bottom-nav .company-badge {
    display: flex;
    font-size: 10px;
    padding: 2px 8px;
    max-width: 140px;
  }
  /* Tabs: scroll horizontal para que quepan todas */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 1;
    min-width: 0;
    order: 10; /* mueve las tabs a la segunda fila */
    width: 100%;
    gap: 4px;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tabs .tab {
    padding: 5px 10px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  /* Chip de usuario: compacto */
  .user-chip {
    padding: 4px 8px;
    font-size: 11px;
  }
  #user-email-lbl {
    display: none;
  }
  .header-sep {
    display: none;
  }
  /* En modo trabajador: separador activo para empujar avatar a la derecha */
  body.has-worker-bottom-nav .header-sep {
    display: flex;
    flex: 1;
  }

  /* ── MAIN ── */
  .main {
    padding: 10px 10px;
  }

  /* ── TOOLBAR (común) ── */
  .toolbar {
    padding: 8px 10px;
    gap: 6px;
  }

  /* ── TOOLBAR GENERAL ── */
  #tb-general {
    flex-direction: column;
    align-items: stretch;
  }
  #tb-general .search-input {
    width: 100%;
    min-width: 0;
  }
  #tb-general #group-filter-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  #tb-general .month-nav {
    margin-left: 0 !important;
    justify-content: space-between;
    width: 100%;
  }
  #tb-general .month-title {
    flex: 1;
    text-align: center;
  }
  #tb-general .action-btn {
    display: none;
  }
  #tb-general #general-draft-badge {
    text-align: center;
    width: 100%;
  }

  /* ── TABLA GENERAL ── */
  .table-wrap {
    max-height: calc(100vh - 220px);
    border-radius: 8px;
  }

  /* ── TOOLBAR PERSONAL ── */
  #tb-personal {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 10px;
  }
  #tb-personal .sel-input {
    width: 100%;
    min-width: 0;
  }
  #tb-personal .month-nav {
    margin-left: 0 !important;
    justify-content: space-between;
    width: 100%;
  }
  #tb-personal .month-title {
    flex: 1;
    text-align: center;
  }
  #tb-personal .action-btn {
    display: none;
  }

  /* ── CABECERA PERSONAL ── */
  .personal-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    padding: 10px 12px !important;
  }
  .personal-header > div:nth-child(2) {
    display: none !important;
  }
  .personal-month-badge {
    margin-left: auto;
    flex-shrink: 0;
  }
  .personal-month-name {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 10px;
    color: var(--muted2);
    text-align: center;
  }
  .personal-month-year {
    font-size: 22px;
  }
  .personal-info h2 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }
  .personal-info p {
    font-size: 10px;
  }
  .personal-avatar {
    width: 38px;
    height: 38px;
    font-size: 15px;
    border-radius: 8px;
  }

  /* ── CALENDARIO MENSUAL ── */
  .month-grid {
    gap: 2px;
    margin-top: 6px;
  }
  .cal-hdr {
    font-size: 9px;
    padding: 2px 0;
  }
  .cal-day {
    min-height: 46px;
    padding: 4px 2px;
    border-radius: 6px;
  }
  .cal-day-num {
    font-size: 9px;
    margin-bottom: 2px;
  }
  .cal-shift {
    font-size: 9px;
    padding: 1px 3px;
    border-radius: 3px;
  }
  .cal-hours {
    font-size: 7px;
    line-height: 1.2;
  }
  .cal-note-text {
    font-size: 7px;
    line-height: 1.2;
  }

  /* ── VISTA TURNOS ── */
  .turnos-grid {
    grid-template-columns: 1fr;
  }

  /* ── ADMIN ── */
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    overflow-x: auto;
  }
  .admin-sidebar-title {
    display: none;
  }
  .admin-nav-btn {
    width: auto;
    padding: 6px 10px;
    border-left: none;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .admin-nav-btn.active {
    border-bottom: 2px solid var(--amber);
    background: rgba(251, 191, 36, 0.05);
  }
  .admin-content {
    padding: 12px 10px;
  }
  .a-card {
    padding: 14px 12px;
  }
  /* Formularios admin: campos en columna */
  .f-row {
    flex-direction: column;
    align-items: stretch;
  }
  .f-input,
  .f-select {
    min-width: 0 !important;
    width: 100%;
  }
  /* Meses: tarjetas en columna simple */
  .m-list {
    grid-template-columns: 1fr;
  }
  /* Editor de horarios: scroll horizontal permitido */
  .se-wrap {
    max-height: 55vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── MODAL ── */
  .modal-box {
    padding: 16px 14px;
    border-radius: 12px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 20px);
  }
  .modal-drag-bar {
    margin: -16px -14px 12px -14px;
    padding: 8px 14px;
    border-radius: 12px 12px 0 0;
  }

  /* ── LEGEND ── */
  .legend {
    gap: 4px;
    padding: 10px 12px;
    margin-top: 10px;
  }
  .legend-item {
    font-size: 10px;
  }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — 480px (móvil vertical)
   ══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* ── HEADER más compacto ── */
  .logo {
    font-size: 15px;
  }
  .tabs .tab {
    padding: 4px 8px;
    font-size: 11px;
  }
  .user-chip {
    padding: 3px 6px;
  }
  .user-avatar {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }
  .logout-btn {
    font-size: 10px;
  }

  /* ── MAIN ── */
  .main {
    padding: 8px 8px;
  }

  /* ── TOOLBAR compacto ── */
  .toolbar {
    padding: 6px 8px;
    gap: 5px;
  }

  /* ── CABECERA PERSONAL en móvil pequeño ── */
  .personal-info h2 {
    font-size: 13px;
    max-width: 120px;
  }
  .personal-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .personal-month-year {
    font-size: 18px;
  }

  /* ── CALENDARIO aún más compacto ── */
  .cal-day {
    min-height: 40px;
    padding: 3px 1px;
  }
  .cal-shift {
    font-size: 8px;
    padding: 1px 2px;
  }
  .cal-hours {
    font-size: 6px;
  }
  .cal-day-num {
    font-size: 8px;
  }

  /* ── FORMULARIOS admin en pantalla pequeña ── */
  .btn {
    padding: 7px 12px;
    font-size: 12px;
  }
  .a-card-title {
    font-size: 13px;
  }

  /* ── LOGIN ── */
  .login-wrap {
    padding: 32px 24px;
  }
  #reg-plan-cards {
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════
   FESTIVOS
   ═══════════════════════════════════════════════════ */

/* ── Header ── */
.fh-header {
  margin-bottom: 20px;
}
.fh-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.fh-ccaa-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
}
.fh-nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fh-year {
  font-size: 20px;
  font-weight: 700;
  min-width: 56px;
  text-align: center;
  color: var(--fg);
}
.fh-tabs {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.fh-tab {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.fh-tab:hover {
  background: var(--hover);
  color: var(--fg);
}
.fh-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Leyenda ── */
.fh-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.fh-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}
.fh-dot.nacional {
  background: #ef4444;
}
.fh-dot.autonomico {
  background: #f59e0b;
}
.fh-dot.local {
  background: #8b5cf6;
}
.fh-dot.modified {
  background: #3b82f6;
}

/* ── Tabla año (3 filas × 4 meses) ── */
.fh-year-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 8px;
  margin-bottom: 12px;
}
.fh-year-cell {
  width: 25%;
  vertical-align: top;
  padding: 0;
}

/* ── Mes ── */
.fh-month {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 4px 4px;
  background: var(--card-bg, var(--bg));
}
.fh-month-title {
  font-weight: 700;
  font-size: 11px;
  text-align: center;
  margin-bottom: 4px;
  color: var(--fg);
  letter-spacing: 0.3px;
}

/* ── Tabla días ── */
.fh-cal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.fh-cal-table thead th,
.fh-cal-table tbody td {
  padding: 0;
  border: none;
}
.fh-cal-dh {
  text-align: center;
  font-size: 8px;
  font-weight: 600;
  color: var(--muted);
  padding: 1px 0 2px;
}
.fh-cal-day {
  text-align: center;
  font-size: 10px;
  padding: 2px 0;
  border-radius: 3px;
  cursor: pointer;
  color: var(--fg);
  line-height: 1.5;
  transition: background 0.1s;
}
.fh-cal-day:hover {
  background: var(--hover);
}
.fh-cal-day.fh-weekend {
  color: var(--muted);
}
.fh-cal-day.fh-hol-nacional {
  background: #fca5a5;
  color: #991b1b;
  font-weight: 800;
  border-radius: 3px;
}
.fh-cal-day.fh-hol-autonomico {
  background: #fcd34d;
  color: #92400e;
  font-weight: 800;
  border-radius: 3px;
}
.fh-cal-day.fh-hol-local {
  background: #c4b5fd;
  color: #4c1d95;
  font-weight: 800;
  border-radius: 3px;
}
.fh-cal-day.fh-hol-modified {
  background: #93c5fd;
  color: #1e3a8a;
  font-weight: 800;
  border-radius: 3px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .fh-cal-day.fh-hol-nacional {
    background: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
  }
  .fh-cal-day.fh-hol-autonomico {
    background: rgba(245, 158, 11, 0.35);
    color: #fcd34d;
  }
  .fh-cal-day.fh-hol-local {
    background: rgba(139, 92, 246, 0.35);
    color: #c4b5fd;
  }
  .fh-cal-day.fh-hol-modified {
    background: rgba(59, 130, 246, 0.35);
    color: #93c5fd;
  }
}

/* ── Listado ── */
.fh-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.fh-list-section {
}
.fh-list-section-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--fg);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.fh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fh-table tr:hover td {
  background: var(--hover);
}
.fh-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.fh-td-date {
  white-space: nowrap;
  color: var(--muted);
  width: 110px;
  font-size: 12px;
}
.fh-td-name {
  font-weight: 500;
}
.fh-td-actions {
  text-align: right;
  white-space: nowrap;
  width: 140px;
}

/* ── Badges ── */
.fh-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  margin-right: 4px;
}
.fh-badge.nacional {
  background: #fef2f2;
  color: #ef4444;
}
.fh-badge.autonomico {
  background: #fffbeb;
  color: #d97706;
}
.fh-badge.local {
  background: #f5f3ff;
  color: #7c3aed;
}
.fh-badge.modified {
  background: #eff6ff;
  color: #2563eb;
}

/* ── Botón añadir local ── */
.fh-add-local-row {
  margin-top: 8px;
  padding-top: 12px;
}

/* ── Modal festivo ── */
.fh-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}
.fh-modal {
  background: var(--card-bg, var(--bg));
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 380px;
  max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.fh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
}
.fh-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
}
.fh-modal-close:hover {
  background: var(--hover);
}
.fh-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.fh-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .fh-year-table {
    border-spacing: 4px;
  }
  .fh-month-title {
    font-size: 10px;
  }
  .fh-cal-day {
    font-size: 9px;
  }
  .fh-ccaa-wrap {
    margin-left: 0;
  }
  .fh-title-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
@media (max-width: 600px) {
  .fh-tabs {
    margin-left: 0;
  }
  .fh-nav-row {
    gap: 8px;
  }
}

/* ── Tooltips ── */
[data-tip] {
  position: relative;
}
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg2);
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 999;
}
[data-tip]:hover::after {
  opacity: 1;
}

/* ── Sidebar drag & drop ── */
.admin-nav-btn[draggable="true"] {
  cursor: grab;
}
.admin-nav-btn[draggable="true"]:active {
  cursor: grabbing;
}
.admin-nav-btn.drag-over {
  border: 2px dashed var(--accent);
  opacity: 0.65;
  background: var(--surface);
}
.admin-sidebar-customize-btn {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: transparent;
  text-align: left;
  font-family: "Instrument Sans", sans-serif;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s;
  font-weight: 500;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.admin-sidebar-customize-btn:hover {
  color: var(--text);
}

/* ── CHANGELOG ─────────────────────────────────── */
.logo {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.logo:hover {
  opacity: 0.8;
}
.changelog-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--bg);
  display: none;
}
.changelog-badge.visible {
  display: block;
}
.changelog-badge.novedad {
  background: #22c55e;
}
.changelog-badge.mensaje {
  background: #ef4444;
}

.cl-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: flex-start;
}
.cl-overlay.open {
  display: flex;
}
.cl-panel {
  width: 460px;
  max-width: 95vw;
  height: 100vh;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: clSlideIn 0.2s ease;
}
@keyframes clSlideIn {
  from {
    transform: translateX(-30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.cl-header {
  padding: 24px 24px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cl-title {
  font-family: "Syne", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}
.cl-title em {
  color: var(--accent);
  font-style: italic;
}
.cl-tabs {
  display: flex;
  gap: 0;
}
.cl-tab {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-family: "Instrument Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.12s;
  margin-bottom: -1px;
}
.cl-tab:hover {
  color: var(--text);
}
.cl-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.cl-close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg2);
  border-radius: 50%;
  font-size: 16px;
  color: var(--muted2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition:
    background 0.12s,
    color 0.12s;
}
.cl-close-btn:hover {
  background: var(--border);
  color: var(--text);
}
@media (max-width: 600px) {
  .cl-close-btn {
    display: flex;
  }
  .cl-header {
    position: relative;
  }
}
.cl-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.cl-month-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cl-month-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.cl-entry {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.cl-entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.cl-version {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.cl-tag-current {
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}
.cl-changes {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cl-change {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  display: flex;
  gap: 8px;
}
.cl-type {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
}
.cl-type-nuevo {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}
.cl-type-corregido {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.cl-type-mejorado {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent, #6366f1);
}
.cl-type-eliminado {
  background: rgba(107, 114, 128, 0.12);
  color: #6b7280;
}

/* ═══════════════════════════════════════════════════
   MÓDULO DE FICHAJE DIGITAL
   ═══════════════════════════════════════════════════ */

/* Layout principal */
.fichaje-layout {
  padding: 20px 24px 40px;
  height: 100%;
  width: 100%;
}

#fichaje-admin-view,
#fichaje-worker-view,
#fichaje-admin-content {
  width: 100%;
  display: block;
}

.fichaje-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.fichaje-header-title {
  font-size: 18px;
  font-weight: 800;
  font-family: "Syne", sans-serif;
  color: var(--text);
}

.fichaje-clock {
  font-size: 22px;
  font-weight: 700;
  font-family: "Syne", sans-serif;
  color: var(--accent);
  letter-spacing: 1px;
}

.fichaje-clock-tabs {
  font-size: 22px;
  font-weight: 800;
  font-family: "Syne", sans-serif;
  color: var(--accent);
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  padding: 0;
  margin-bottom: 1px;
  border: none;
}

/* Card principal del trabajador */
.fichaje-worker-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 24px;
}

/* Columnas dentro del worker card */
.fichaje-col-left,
.fichaje-col-right {
  min-width: 0;
}

/* En móvil / card sin split: col-left centrada */
@media (max-width: 899px) {
  .fichaje-worker-card:not(.fichaje-worker-card--split) .fichaje-col-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
}

/* Desktop: dos columnas cuando hay historial */
@media (min-width: 900px) {
  /* Layout principal sin padding extra que achique */
  .fichaje-layout {
    padding: 20px 24px 40px;
  }

  /* Worker card con historial: side-by-side */
  .fichaje-worker-card--split {
    display: flex;
    gap: 0;
    text-align: left;
    padding: 0;
    overflow: hidden;
  }

  .fichaje-worker-card--split .fichaje-col-left {
    flex: 0 0 360px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .fichaje-worker-card--split .fichaje-col-left .fichaje-btns {
    justify-content: flex-start;
  }

  .fichaje-worker-card--split .fichaje-col-right {
    flex: 1;
    border-left: 1px solid var(--border);
    padding: 28px 28px;
    overflow-x: auto;
  }

  .fichaje-worker-card--split .fichaje-col-right .fichaje-resumen-hoy {
    margin-top: 0;
    overflow-x: visible;
    width: 100%;
  }

  /* En col-left el resumen de hoy tiene el espacio que le corresponde */
  .fichaje-worker-card--split .fichaje-col-left .fichaje-resumen-hoy {
    width: 100%;
    overflow-x: auto;
  }

  /* Worker card sin historial: full width en desktop */
  .fichaje-worker-card:not(.fichaje-worker-card--split) {
    text-align: left;
    display: flex;
    align-items: flex-start;
  }

  .fichaje-worker-card:not(.fichaje-worker-card--split) .fichaje-col-left {
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .fichaje-worker-card:not(.fichaje-worker-card--split)
    .fichaje-col-left
    .fichaje-btns {
    justify-content: flex-start;
  }

  /* Icono algo más pequeño en desktop */
  .fichaje-estado-icono {
    font-size: 40px;
  }

  /* Admin: tabla ocupa todo el ancho */
  #fichaje-admin-view {
    width: 100%;
  }
  #fichaje-admin-content {
    width: 100%;
  }
  .fichaje-export-card {
    max-width: none;
  }
}

.fichaje-estado-icono {
  font-size: 48px;
  margin-bottom: 12px;
  line-height: 1;
}

.fichaje-estado-texto {
  font-size: 22px;
  font-weight: 800;
  font-family: "Syne", sans-serif;
  color: var(--text);
  margin-bottom: 6px;
}

.fichaje-estado-sub {
  font-size: 13px;
  color: var(--muted2);
  margin-bottom: 28px;
}

/* Contador en tiempo real — mismo estilo que el reloj */
.fichaje-timer-live {
  font-size: 22px;
  font-weight: 700;
  font-family: "Syne", sans-serif;
  color: var(--accent);
  letter-spacing: 1px;
  margin-bottom: 24px;
}

/* Botones de fichaje */
.fichaje-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.fichaje-btn {
  padding: 12px 28px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: "Syne", sans-serif;
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.1s;
  background: var(--bg3);
  color: var(--text);
}

.fichaje-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}
.fichaje-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.fichaje-btn.fichaje-btn-disabled {
  background: #6b7280 !important;
  color: #fff !important;
  cursor: not-allowed;
  opacity: 0.85;
}
.fichaje-btn.fichaje-btn-disabled:hover {
  opacity: 0.85;
  transform: none;
}

.btn-entrada {
  background: #16a34a;
  color: #fff;
}
.btn-salida {
  background: #dc2626;
  color: #fff;
}
.btn-pausa {
  background: #f59e0b;
  color: #fff;
}
.btn-pausa-fin {
  background: #2563eb;
  color: #fff;
}

/* Resumen del día */
.fichaje-resumen-hoy {
  margin-top: 24px;
  text-align: left;
  width: 100%;
  overflow-x: hidden;
}

.fichaje-resumen-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Tabla de fichajes */
.fichaje-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.fichaje-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.fichaje-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.fichaje-table td:last-child,
.fichaje-table th:last-child {
  width: auto;
}

.fichaje-table tr:last-child td {
  border-bottom: none;
}
.fichaje-table-admin {
  margin-top: 16px;
}
.row-corregida {
  background: rgba(239, 68, 68, 0.04);
}
.row-corregida td {
  color: var(--muted2);
}

/* Badges de estado */
.badge-entrada {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-salida {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pausa {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pausa-fin {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-sin-fichar {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-corregido {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  padding: 2px 6px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}
.badge-correccion {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  padding: 2px 6px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}

/* Wrapper config — full width */
.fichaje-config-layout {
  width: 100%;
}

.fichaje-config-layout .fichaje-export-card {
  width: 100%;
}

/* En desktop, la config usa dos columnas internas */
@media (min-width: 900px) {
  .fichaje-config-layout .fichaje-export-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 48px;
    align-items: start;
  }

  /* El título ocupa las dos columnas */
  .fichaje-config-layout .fichaje-export-card .fichaje-export-title {
    grid-column: 1 / -1;
  }

  /* El botón guardar y el mensaje ocupan las dos columnas */
  .fichaje-config-layout .fichaje-export-card > div:last-child,
  .fichaje-config-layout .fichaje-export-card > div:nth-last-child(2) {
    grid-column: 1 / -1;
  }
}

/* Vista admin */
.fichaje-admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.fichaje-admin-tab--right {
  margin-left: 0;
}

.fichaje-admin-tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: "Syne", sans-serif;
  transition: color 0.15s;
  margin-bottom: -1px;
}

.fichaje-admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Stats de hoy — encima de las tabs */
.fichaje-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.fichaje-stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.fichaje-stat-num {
  display: block;
  font-size: 28px;
  font-weight: 800;
  font-family: "Syne", sans-serif;
  color: var(--accent);
}

.fichaje-stat-label {
  display: block;
  font-size: 11px;
  color: var(--muted2);
  margin-top: 2px;
}

/* Botón pequeño de acción en tabla admin */
.fichaje-btn-sm {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 4px;
  transition: background 0.1s;
}

.fichaje-btn-sm:hover {
  background: var(--bg2);
}
.btn-sm-warn {
  border-color: rgba(245, 158, 11, 0.3);
  color: #b45309;
}
.btn-sm-warn:hover {
  background: rgba(245, 158, 11, 0.08);
}

/* Filtros historial */
.fichaje-filtros {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.fichaje-filtros select,
.fichaje-filtros input[type="month"] {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
  font-family: "Syne", sans-serif;
}

/* Exportar */
.fichaje-export-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
}

.fichaje-export-title {
  font-size: 16px;
  font-weight: 800;
  font-family: "Syne", sans-serif;
  margin-bottom: 10px;
}

.fichaje-export-desc {
  font-size: 13px;
  color: var(--muted2);
  margin-bottom: 18px;
  line-height: 1.5;
}

.fichaje-export-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.fichaje-export-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted2);
}

.fichaje-export-form input[type="date"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  color: var(--text);
  font-size: 13px;
}

.fichaje-export-legal {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted2);
  background: var(--bg3);
  border-radius: 8px;
  padding: 10px 14px;
  line-height: 1.5;
}

/* Modal */
.fichaje-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
}

.fichaje-modal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 480px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.fichaje-modal-title {
  font-size: 17px;
  font-weight: 800;
  font-family: "Syne", sans-serif;
  margin-bottom: 4px;
}

/* Formulario corrección */
.fichaje-form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.fichaje-form-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted2);
  flex: 1;
  min-width: 120px;
}

.fichaje-form-row select,
.fichaje-form-row input[type="time"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  font-size: 13px;
}

/* Toast */
.fichaje-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: "Syne", sans-serif;
  z-index: 9999;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.fichaje-toast-ok {
  background: #16a34a;
  color: #fff;
}
.fichaje-toast-warn {
  background: #f59e0b;
  color: #fff;
}
.fichaje-toast-error {
  background: #dc2626;
  color: #fff;
}

/* Loading / error */
.fichaje-loading {
  text-align: center;
  padding: 40px;
  color: var(--muted2);
  font-size: 14px;
}

.fichaje-error {
  text-align: center;
  padding: 24px;
  color: #dc2626;
  font-size: 13px;
}

/* Responsive */
@media (max-width: 600px) {
  .fichaje-stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .fichaje-clock {
    font-size: 17px;
  }
  .fichaje-export-form {
    flex-direction: column;
  }
}

/* ═══════════════════════════════════════════════════
   WORKER BOTTOM NAV — navegación inferior móvil
   Solo visible en pantallas pequeñas y solo para trabajadores
═══════════════════════════════════════════════════ */
.worker-bottom-nav {
  display: none; /* js lo activa con flex */
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  max-width: 100vw;
  z-index: 1000;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  box-sizing: border-box;
}

.wbn-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 6px;
  border: none;
  background: transparent;
  color: var(--muted2);
  cursor: pointer;
  transition:
    color 0.15s,
    background 0.15s;
  font-family: "Instrument Sans", sans-serif;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}

.wbn-btn:active {
  background: var(--hover);
}

.wbn-btn.active {
  color: var(--accent);
}

.wbn-icon {
  font-size: 20px;
  line-height: 1;
}

.wbn-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
}

/* Ocultar bottom nav solo en pantallas de escritorio (>1200px) */
@media (min-width: 1201px) {
  .worker-bottom-nav {
    display: none !important;
  }
}

/* En móvil con bottom nav activa, añadir espacio al contenido */
body.has-worker-bottom-nav .main {
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
}

/* Con bottom nav activo, ocultar las tabs del header solo en móvil/tablet */
@media (max-width: 1200px) {
  body.has-worker-bottom-nav .tabs {
    display: none !important;
  }
}
/* Toggle Solo el mío / Mi grupo / Todos — solo visible en móvil/tablet */
@media (min-width: 1201px) {
  .personal-view-toggle {
    display: none !important;
  }
}
body.has-worker-bottom-nav .header {
  flex-wrap: nowrap;
}

/* Vacaciones en modo trabajador desktop — solo lectura, ocultar controles de edición */
body.worker-vac-readonly #vac-personal-toolbar,
body.worker-vac-readonly #vac-btn-general,
body.worker-vac-readonly #vac-btn-personal,
body.worker-vac-readonly .admin-nav,
body.worker-vac-readonly .fh-header .btn-ghost[onclick*="vacPrint"] {
  display: none !important;
}
body.worker-vac-readonly canvas {
  pointer-events: none !important;
}

/* iPad — calendario anual en 4 columnas para que quepa sin scroll */
@media (min-width: 768px) and (max-width: 1200px) {
  #vw-anual-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }
}

/* iPad — bottom nav más grande y contenido a pantalla completa */
@media (min-width: 768px) and (max-width: 1200px) {
  body.has-worker-bottom-nav .worker-bottom-nav {
    height: 70px !important;
  }
  body.has-worker-bottom-nav .worker-bottom-nav .wbn-btn {
    font-size: 13px !important;
    gap: 5px !important;
    padding: 8px 0 !important;
  }
  body.has-worker-bottom-nav .worker-bottom-nav .wbn-icon {
    font-size: 26px !important;
  }
  body.has-worker-bottom-nav .worker-bottom-nav .wbn-label {
    font-size: 11px !important;
  }
  body.has-worker-bottom-nav .main {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
}

/* Landscape móvil — clase añadida por JS cuando innerHeight < 500 */
body.worker-landscape .header {
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 8px !important;
}
body.worker-landscape .logo {
  font-size: 13px !important;
}
body.worker-landscape .company-badge {
  font-size: 10px !important;
  padding: 2px 6px !important;
}
body.worker-landscape .main {
  padding: 4px 8px 4px 8px !important;
  zoom: 0.72;
}
body.worker-landscape.has-worker-bottom-nav .main {
  padding: 4px 8px calc(44px + env(safe-area-inset-bottom, 0px)) 8px !important;
  zoom: 0.72;
}
body.worker-landscape .tabs {
  display: none !important;
}
/* Bottom nav compacto en fila */
body.worker-landscape .worker-bottom-nav {
  height: 44px !important;
  padding: 0 4px !important;
}
body.worker-landscape .worker-bottom-nav .wbn-btn {
  flex-direction: row !important;
  gap: 4px !important;
  padding: 0 8px !important;
}
body.worker-landscape .worker-bottom-nav .wbn-icon {
  font-size: 15px !important;
}
body.worker-landscape .worker-bottom-nav .wbn-label {
  font-size: 9px !important;
}
/* Personal header compacto */
body.worker-landscape .personal-header {
  padding: 8px 10px !important;
  margin-bottom: 6px !important;
}
body.worker-landscape .personal-avatar {
  width: 32px !important;
  height: 32px !important;
  font-size: 14px !important;
}
body.worker-landscape .personal-info h2 {
  font-size: 14px !important;
}
body.worker-landscape .month-grid {
  gap: 2px !important;
}
body.worker-landscape .day-cell {
  min-height: 28px !important;
  padding: 2px !important;
}
/* Mi horario en landscape — un poco más pequeño para que quepa sin scroll */
body.worker-landscape #view-personal {
  zoom: 0.82;
}
