@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root{
  --bg: #090A0F;
  --surface: #12151E;
  --surface-elevated: #1A1F2C;
  --surface-soft: #161A25;
  --ink: #F8FAFC;
  --ink-soft: #94A3B8;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-glow: rgba(99, 102, 241, 0.28);
  --primary-soft: rgba(99, 102, 241, 0.12);
  --stamp: #10B981;
  --stamp-soft: rgba(16, 185, 129, 0.14);
  --gold: #F59E0B;
  --gold-soft: rgba(245, 158, 11, 0.14);
  --green: #14B8A6;
  --green-soft: rgba(20, 184, 166, 0.14);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.15);
  --double: #A855F7;
  --double-soft: rgba(168, 85, 247, 0.15);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 25px 60px rgba(0, 0, 0, 0.7);
  --radius: 16px;
  --radius-sm: 10px;
}

*{ box-sizing: border-box; }

html{
  height: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body{
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(99, 102, 241, 0.16) 0%, transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(20, 184, 166, 0.08) 0%, transparent 45%);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: 0 clamp(16px, 4vw, 40px) calc(48px + env(safe-area-inset-bottom));
  padding-left: max(clamp(16px, 4vw, 40px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 40px), env(safe-area-inset-right));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.55;
}

.wrap{
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Header ---------- */
header{
  background: rgba(18, 21, 30, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  z-index: 20;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-top: clamp(14px, 3vw, 24px);
  margin-bottom: clamp(18px, 3.5vw, 28px);
  padding: clamp(14px, 3vw, 22px) clamp(16px, 3.5vw, 28px) 0;
  border: 1px solid var(--line);
}

.brand-row{
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  flex-wrap: wrap;
}

.logo-box{
  width: clamp(50px, 12vw, 58px);
  height: clamp(50px, 12vw, 58px);
  border-radius: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
}
.logo-box:hover{
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: none;
}
.logo-box img{ width: 100%; height: 100%; object-fit: contain; }
.logo-box .logo-placeholder{
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
  padding: 4px;
}
.logo-box input[type="file"]{ display: none; }

h1{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: clamp(19px, 3.2vw, 25px);
  margin: 0;
  letter-spacing: -0.03em;
}

.brand-text{
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 140px;
}

.company-name-input{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: clamp(17px, 3vw, 22px);
  color: var(--ink);
  border: none;
  background: transparent;
  padding: 2px 0;
  outline: none;
  width: 100%;
  border-bottom: 1.5px solid transparent;
  letter-spacing: -0.02em;
  transition: border-color .2s ease;
}
.company-name-input:hover{ border-bottom-color: var(--line-strong); }
.company-name-input:focus{ border-bottom-color: var(--primary); }
.company-name-input::placeholder{ color: #475569; font-weight: 600; }

.brand-text .hint{
  font-size: 11.5px;
  color: var(--ink-soft);
}

.tabs{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  overflow: visible;
}
.tabs{ position: relative; z-index: 21; }

.tabs-left{ display: flex; overflow: visible; }
.tabs-right{ display: flex; gap: 8px; flex-shrink: 0; transform: translateY(3px); }

.menu-toggle{
  display: none;
  width: 40px;
  height: 40px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.menu-toggle span{
  display: block;
  height: 2px;
  margin: 4px 0;
  border-radius: 2px;
  background: currentColor;
}

.logout-btn{
  border: 1px solid var(--line);
  background: var(--surface-elevated);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}
.logout-btn:hover{
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.tab-btn{
  border: none;
  background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(13px, 2.8vw, 14.5px);
  font-weight: 700;
  color: var(--ink-soft);
  padding: 14px 4px;
  margin-right: clamp(18px, 4vw, 28px);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .2s ease;
  white-space: nowrap;
}
.tab-btn:hover{ color: var(--ink); }
.tab-btn.active{
  color: var(--primary);
  border-bottom-color: var(--primary);
  text-shadow: 0 0 14px var(--primary-glow);
}

main{ padding-top: 6px; }

.preview-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.preview-head h1{ margin: 0; }
.preview-head p{
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}
.preview-live{
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid var(--green);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.preview-section{
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-sm);
}
.preview-section-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.preview-section-head h2{
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}
.preview-section-head span{
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}
.preview-section-head strong{
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}
.preview-trabajando{ border-top: 3px solid var(--green); }
.preview-trabajando .preview-section-head h2{ color: var(--green); }
.preview-no-trabajando{ border-top: 3px solid var(--danger); }
.preview-no-trabajando .preview-section-head h2{ color: var(--danger); }
.preview-dia-libre{ border-top: 3px solid var(--line-strong); }
.preview-dia-libre .preview-section-head h2{ color: var(--ink-soft); }
.preview-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.preview-card{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.preview-avatar{
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  background-color: var(--primary-soft);
  background-position: center;
  background-size: cover;
  color: var(--primary);
  font-weight: 800;
}
.preview-card strong,
.preview-card span{
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-card strong{ font-size: 13px; }
.preview-card span{ margin-top: 2px; color: var(--ink-soft); font-size: 11px; }
.preview-empty{ margin: 0; color: var(--ink-soft); font-size: 12px; }
.preview-carnet{
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  position: relative;
}
.carnet-header{
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
  padding: 12px;
  text-align: center;
}
.carnet-header-text{
  color: white;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.carnet-photo{
  width: 100%;
  height: 160px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.carnet-photo::before{
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.05) 100%);
  pointer-events: none;
}
.carnet-photo img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}
.carnet-placeholder{
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.carnet-info{
  padding: 16px 12px;
  text-align: center;
  background: white;
  border-top: 1px solid #eee;
}
.carnet-store{
  font-size: 9px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.carnet-name{
  font-size: 15px;
  font-weight: 800;
  color: #1a202c;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.carnet-status{
  font-size: 10px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.carnet-footer{
  background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
  padding: 8px;
  text-align: center;
}
.carnet-footer-text{
  color: white;
  font-size: 9px;
  font-weight: 600;
  opacity: 0.9;
}
.status-working{
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success);
}
.status-libre{
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary);
}
.status-not-working{
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.preview-store{
  margin-bottom: 26px;
}
.preview-store-head{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.preview-store-head h2{
  margin: 0;
  font-size: 19px;
  color: var(--primary);
}
.preview-store-head span{
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

/* ---------- Login ---------- */
.login-overlay{
  position: fixed;
  inset: 0;
  background: rgba(9, 10, 15, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.login-box{
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.12);
  padding: clamp(32px, 6vw, 44px) clamp(24px, 5vw, 36px) clamp(28px, 5vw, 36px);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.login-logo{
  width: 68px;
  height: 68px;
  border-radius: 0;
  object-fit: contain;
  margin: 0 auto 16px;
  display: block;
  background: transparent;
  box-shadow: none;
  border: none;
}

.login-logo-fallback{
  width: 68px;
  height: 68px;
  border-radius: 18px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 24px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.login-box .company{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--primary);
  margin: 0 0 4px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.login-box h2{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(22px, 5vw, 26px);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

.login-box p.sub{
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 0 0 24px;
  line-height: 1.5;
}

.pw-field{ position: relative; margin-bottom: 14px; }

.login-box input{
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 13px 44px 13px 15px;
  font-size: 16px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  outline: none;
  background: var(--surface-elevated);
  color: var(--ink);
  transition: all .2s ease;
}
.login-box input[type="email"],
.login-box input[type="text"]{
  padding: 13px 15px;
}
.login-box input:focus{
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.pw-toggle{
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
}
.pw-toggle:hover{ color: var(--primary); }

.login-box .btn{
  width: 100%;
  padding: 14px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.login-box .error{
  color: var(--danger);
  font-size: 12.5px;
  margin: -4px 0 16px;
  min-height: 16px;
  text-align: left;
  padding-left: 2px;
}

.login-box .reset-link{
  display: block;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .15s ease;
}
.login-box .reset-link:hover{
  color: var(--ink);
}

.pw-strength{
  display: flex;
  gap: 5px;
  margin: -4px 0 16px;
}
.pw-strength i{
  flex: 1;
  height: 3.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  transition: background .2s ease;
}
.pw-strength i.on{ background: var(--stamp); box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }

/* ---------- Breadcrumbs ---------- */
.crumbs{
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.crumbs .crumb{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 5px 8px;
  border-radius: 8px;
  transition: all .18s ease;
}
.crumbs .crumb svg{ width: 14px; height: 14px; flex-shrink: 0; opacity: 0.8; }
.crumbs .crumb:hover{ color: var(--ink); background: var(--primary-soft); }
.crumbs .crumb:hover svg{ opacity: 1; color: var(--primary); }
.crumbs .crumb.current{
  color: var(--ink);
  font-weight: 700;
  cursor: default;
}
.crumbs .crumb.current svg{ opacity: 1; color: var(--primary); }
.crumbs .crumb.current:hover{ background: transparent; }
.crumbs .sep{
  display: inline-flex;
  align-items: center;
  color: var(--ink-soft);
  opacity: 0.4;
  flex-shrink: 0;
}
.crumbs .sep svg{ width: 14px; height: 14px; }

/* ---------- Subtabs ---------- */
.subtabs{
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.subtab-btn{
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.subtab-btn:hover{
  border-color: var(--primary);
  color: var(--ink);
}
.subtab-btn.active{
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 16px var(--primary-glow);
}

/* ---------- Cards / Folders ---------- */
.card-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
  gap: 14px;
}

.folder-card{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: all .22s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.folder-card:hover{
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: var(--shadow-md), 0 0 25px rgba(99, 102, 241, 0.1);
  transform: translateY(-3px);
  background: var(--surface-elevated);
}
.folder-card:active{ transform: scale(0.97); }

.folder-card .icon{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-right: 12px;
}
.employee-avatar-wrapper{
  display: flex;
  align-items: center;
  margin-right: 12px;
}
.employee-avatar{
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  background-size: cover;
  background-position: center;
}
.folder-card .icon svg{ width: 18px; height: 18px; }

.folder-card .name{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.folder-card .meta{
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.folder-card .meta.libre-tag{
  color: var(--stamp);
  font-weight: 600;
}

.folder-card .del{
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--surface-elevated);
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all .18s ease;
}
.folder-card:hover .del{ opacity: 1; }
.folder-card .del:hover{
  background: var(--danger-soft);
  color: var(--danger);
}

.add-card{
  border: 1px dashed var(--line-strong);
  background: rgba(18, 21, 30, 0.4);
  border-radius: var(--radius);
  min-height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 600;
  flex-direction: column;
  gap: 8px;
  transition: all .2s ease;
}
.add-card:hover{
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 20px var(--primary-glow);
}
.add-card .plus{
  font-size: 24px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
}

.cancel-folder{
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all .2s ease;
}
.cancel-folder:hover{
  border-color: var(--line-strong);
  background: var(--surface-elevated);
}
.cancel-folder-icon{
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cancel-folder-icon svg{ width: 18px; height: 18px; }
.cancel-folder-text{ flex: 1; min-width: 0; }
.cancel-folder-title{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
}
.cancel-folder-meta{
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
}
.cancel-folder-arrow{
  color: var(--ink-soft);
  display: flex;
  align-items: center;
}
.cancel-folder-arrow svg{ width: 16px; height: 16px; }

.cancelled-card{ opacity: 0.75; }
.cancelled-card .icon{
  background: var(--surface-elevated);
  color: var(--ink-soft);
}
.general-status-actions{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  background: #263044;
  border-radius: var(--radius);
}
.general-status-actions .cancel-folder{
  width: 100%;
  min-width: 0;
  margin-top: 0;
}

/* ---------- Inline form ---------- */
.inline-form{
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px;
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow-md), 0 0 25px var(--primary-glow);
}
.inline-form .row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.inline-form input{
  flex: 1;
  min-width: 140px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  padding: 11px 14px;
  outline: none;
  transition: all .2s ease;
}
.inline-form input:focus{
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.inline-form .actions{
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn{
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}
.btn.primary{
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.btn.primary:hover{
  background: var(--primary-hover);
  transform: translateY(-1px);
}
.btn.ghost{
  background: transparent;
  color: var(--ink-soft);
}
.btn.ghost:hover{
  color: var(--ink);
  background: var(--surface-elevated);
}
.btn.danger{
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 14px var(--danger-soft);
}
.btn.danger:hover{
  filter: brightness(1.1);
}
.btn.ghost-outline{
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn.ghost-outline:hover{ background: var(--primary-soft); }

.empty{
  color: var(--ink-soft);
  font-size: 14px;
  padding: 40px 16px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  grid-column: 1 / -1;
  background: rgba(18, 21, 30, 0.4);
}

/* ---------- Ficha ---------- */
.ficha-section{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 3.5vw, 24px);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  max-width: 100%;
}
.ficha-section h3{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 16px;
  color: var(--primary);
}

.ficha-grid{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.ficha-field{ min-width: 0; }
.ficha-field label{
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.ficha-field input,
.ficha-field select,
.ficha-field textarea{
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  background: var(--surface-elevated);
  color: var(--ink);
  outline: none;
  transition: all .2s ease;
}
.ficha-field input[type="date"]{
  min-inline-size: 0;
  inline-size: 100%;
  max-inline-size: 100%;
  padding-left: 10px;
  padding-right: 6px;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}
.ficha-field input:focus,
.ficha-field select:focus,
.ficha-field textarea:focus{
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.ficha-field.full{ grid-column: 1 / -1; }

.photo-row{
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.photo-upload{
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.photo-upload .lbl{
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.photo-preview{
  width: 112px;
  height: 112px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--line-strong);
  background: var(--surface-elevated);
  cursor: zoom-in;
}
.photo-preview.placeholder{
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 11px;
  text-align: center;
  padding: 10px;
}
.photo-upload .file-btn{
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--radius-sm);
  padding: 8px 15px;
  font-size: 12.5px;
  cursor: pointer;
  font-weight: 700;
  transition: all .2s ease;
}
.photo-upload .file-btn:hover{
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}
.photo-upload input[type="file"]{ display: none; }
.photo-delete-btn{
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.photo-delete-btn:disabled{ opacity: .6; cursor: wait; }
.photo-download-btn{
  border: 1px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-right: 8px;
}
.photo-preview-overlay{
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: rgba(0, 0, 0, .82);
}
.photo-preview-overlay img{
  max-width: min(900px, 94vw);
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
}

.emp-title{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}
.emp-sub{
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

.ficha-title-row{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.ficha-title-action{
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-banner{
  background: var(--gold-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius);
  padding: 15px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.status-banner strong{
  color: var(--gold);
  font-size: 14.5px;
}
.status-banner-date{
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 3px;
}

/* ---------- Calendario / Asistencia ---------- */
.rate-field{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.month-nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.month-nav button{
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all .2s ease;
  flex-shrink: 0;
}
.month-nav button svg{ width: 16px; height: 16px; }
.month-nav button.prev svg{ transform: rotate(180deg); }
.month-nav button:hover{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow);
}
.month-label{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(17px, 4vw, 21px);
  font-weight: 800;
  text-transform: capitalize;
  text-align: center;
  flex: 1;
  letter-spacing: -0.02em;
}

.quincena{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.quincena-head{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px clamp(14px, 3vw, 20px);
  border-bottom: 1px solid var(--line);
  background: var(--surface-elevated);
  flex-wrap: wrap;
  gap: 8px;
}
.quincena-head h2{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  margin: 0;
}
.quincena-head .range{
  font-size: 12.5px;
  color: var(--ink-soft);
}

.days-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 8px;
  padding: clamp(14px, 3vw, 20px);
}

.day-btn{
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line-strong);
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .18s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 46px;
}
.day-btn:hover{
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 4px 14px var(--primary-glow);
  transform: translateY(-2px);
}
.day-btn .num{
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 600;
}
.day-btn .dow{
  font-size: 9px;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-top: 2px;
  letter-spacing: .04em;
}
.day-btn.worked{
  background: var(--stamp);
  border-color: var(--stamp);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.day-btn.worked .num,
.day-btn.worked .dow{ color: #042F2E; font-weight: 700; }
.day-btn.libre{
  background: var(--green-soft);
  border-color: var(--green);
}
.day-btn.libre .num,
.day-btn.libre .dow{ color: var(--green); }

.day-btn .badge{
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: var(--gold);
  color: #000;
  font-size: 8px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  line-height: 1.25;
  box-shadow: var(--shadow-sm);
}
.day-btn .badge.badge-late{ bottom: -6px; right: -6px; background: var(--gold); }
.day-btn .badge.badge-extra{ bottom: -6px; left: -6px; right: auto; background: var(--green); color: #000; }
.day-btn .badge.badge-double{ top: -6px; right: -6px; bottom: auto; background: var(--double); color: #fff; }
.day-btn:active{ transform: scale(0.94); }

.quincena-total{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
  background: var(--surface-elevated);
}
.quincena-total .lbl{
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}
.quincena-total .amt{
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: 700;
  color: var(--gold);
}

.summary{
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 28px) clamp(20px, 4vw, 30px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--shadow-md), 0 0 35px var(--primary-glow);
}
.summary .lbl{
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.summary .amt{
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 700;
  color: #818CF8;
}
.summary .days{
  font-size: 13px;
  opacity: 0.85;
}

.legend{
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 18px;
  font-weight: 500;
}
.legend span{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i{
  width: 12px;
  height: 12px;
  border-radius: 4px;
  display: inline-block;
  flex-shrink: 0;
}
.legend i.w{ background: var(--stamp); }
.legend i.l{ background: var(--green-soft); border: 1px solid var(--green); }
.legend i.b{ background: var(--gold); border-radius: 50%; }
.legend i.e{ background: var(--green); border-radius: 50%; }
.legend i.d{ background: var(--double); border-radius: 50%; }

/* ---------- Nómina ---------- */
.nomina-store{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: visible;
  box-shadow: var(--shadow-sm);
}
.nomina-store h3{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15.5px;
  font-weight: 700;
  margin: 0;
  padding: 14px 18px;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--line);
  color: var(--primary);
}
.nomina-controls{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.nomina-print-heading{ display: none; }
.general-payroll-sheet{
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 30px);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}
.general-payroll-heading{
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--primary);
}
.general-payroll-heading img{
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
}
.general-payroll-company{
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}
.general-payroll-heading h1{
  margin: 2px 0;
  font-size: 22px;
}
.general-payroll-heading p{
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}
.general-payroll-table{
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12.5px;
}
.general-payroll-table th,
.general-payroll-table td{
  border: 1px solid var(--line);
  padding: 10px 9px;
  text-align: right;
  overflow-wrap: anywhere;
}
.general-payroll-table th:first-child,
.general-payroll-table td:first-child,
.general-payroll-table th:nth-child(2),
.general-payroll-table td:nth-child(2){ text-align: left; }
.general-payroll-table thead th{
  background: var(--surface-elevated);
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
}
.general-payroll-table tbody td:nth-child(n+3),
.general-payroll-table tfoot th:nth-child(n+3){ font-family: 'JetBrains Mono', monospace; }
.general-payroll-table tbody tr:nth-child(even){ background: var(--surface-soft); }
.general-payroll-table tfoot th{
  background: var(--primary);
  color: var(--surface);
  font-weight: 800;
}

.nomina-row{
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  min-width: 0;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  align-items: center;
}
.nomina-row:last-child{ border-bottom: none; }
.nomina-row.head{
  color: var(--ink-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
}
.nomina-row .name{ font-weight: 600; }
.nomina-row .num{
  font-family: 'JetBrains Mono', monospace;
  font-size: 14.5px;
}
.nomina-row .num.total{
  color: var(--gold);
  font-weight: 700;
}

.grand-total{
  background: linear-gradient(135deg, #1E1B4B 0%, #312E81 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  box-shadow: var(--shadow-md), 0 0 35px var(--primary-glow);
  flex-wrap: wrap;
  gap: 10px;
}
.grand-total .lbl{
  font-size: 13px;
  opacity: .85;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.grand-total .amt{
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  color: #818CF8;
}
.grand-total-row{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.grand-total.small{
  background: var(--gold-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 15px 20px;
  margin-top: 0;
  box-shadow: var(--shadow-sm);
}
.grand-total.small .amt{ font-size: 18px; color: var(--gold); }
.grand-total.small .lbl{ opacity: 1; color: var(--gold); }

.status{
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 16px;
  min-height: 18px;
  font-weight: 600;
}

/* ---------- Reportes ---------- */
.report-print-row{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.report-filters{
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.report-mode-buttons{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.report-employee-buttons{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: -8px 0 20px;
}
.report-employee-search{
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-elevated);
  color: var(--ink);
  font: inherit;
}
.report-filters label{
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.report-filters select{
  min-width: 130px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface-elevated);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-transform: none;
}
.report-filters input[type="month"]{
  min-width: 170px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface-elevated);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.report-filters input[type="date"]{
  min-width: 170px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  background: var(--surface-elevated);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.report-filters label:first-child input{ min-width: 170px; }
.report-filters label:nth-child(2) select{ min-width: 220px; }
.report-filters label:nth-child(3) select{ min-width: 220px; }
.report-print-row .late-hint{ margin-top: 0; }

.report-header{
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
  flex-wrap: wrap;
}
.report-logo{
  width: 52px;
  height: 52px;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
  border: none;
  flex-shrink: 0;
}
.report-company{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.report-title{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: clamp(17px, 4vw, 21px);
  color: var(--ink);
  margin: 3px 0;
  letter-spacing: -0.02em;
}
.report-sub{
  font-size: 12px;
  color: var(--ink-soft);
}

.report-store-box{
  margin-bottom: 24px;
  overflow: visible;
}
.report-table-scroll{
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.report-store-box h3{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--primary);
}
.report-store-subtotal{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-top: none;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
.report-store-subtotal strong{
  color: var(--gold);
  font-family: 'JetBrains Mono', monospace;
}

.report-table{
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  table-layout: fixed;
  min-width: 660px;
}
.report-table th,
.report-table td{
  border: 1px solid var(--line);
  text-align: center;
  padding: 4px 2px;
}
.report-table thead th{
  background: var(--surface-elevated);
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 9.5px;
}
.report-table th.rep-name-col,
.report-table td.rep-name-col{
  text-align: left;
  padding: 6px 10px;
  width: 145px;
  font-weight: 600;
  font-size: 11.5px;
  background: var(--surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-table thead th.rep-name-col{
  background: var(--surface-elevated);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
}
.report-table th.rep-day-col,
.report-table td.rep-day-col{ width: 23px; }
.report-table th.rep-total-col,
.report-table td.rep-total-col{
  width: 72px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--gold);
  background: var(--surface);
  white-space: nowrap;
}

.rep-cell{
  width: 100%;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 8.5px;
  font-weight: 700;
}
.rep-cell.rep-work{ background: var(--stamp); color: #042F2E; }
.rep-cell.rep-libre{ background: var(--green-soft); color: var(--green); border: 1px solid var(--green); }
.rep-cell.rep-late{ background: var(--gold); color: #000; }
.rep-cell.rep-extra{ background: var(--green); color: #000; }
.rep-cell.rep-double{ background: var(--double); color: #fff; }

.report-legend{
  margin-top: 6px;
  margin-bottom: 20px;
}
.report-total-detail{
  margin-top: 4px;
  font-size: 12px;
  opacity: .78;
}

/* ---------- Modal ---------- */
.modal-overlay{
  position: fixed;
  inset: 0;
  background: rgba(9, 10, 15, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  z-index: 60;
}
.modal-box{
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
.modal-box h3{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 17.5px;
  font-weight: 800;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}

.status-options{
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.status-opt{
  flex: 1;
  min-width: 82px;
  border: 1px solid var(--line-strong);
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all .18s ease;
}
.status-opt:hover{ border-color: var(--stamp); color: var(--ink); }
.status-opt.active{
  border-color: var(--stamp);
  background: var(--stamp-soft);
  color: var(--stamp);
}
.status-opt.active.libre{
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

.late-field{ margin-bottom: 18px; }
.late-field label{
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 6px;
}
.late-field input{
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  background: var(--surface-elevated);
  color: var(--ink);
  outline: none;
}
.late-field input:focus{ border-color: var(--primary); }
.late-field input[readonly]{
  background: var(--surface-elevated);
  cursor: default;
  font-weight: 600;
}
.late-hint{
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 6px;
}

.checkbox-field{
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--double-soft);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: var(--radius-sm);
}
.checkbox-field label{
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.checkbox-field input[type="checkbox"]{
  width: 16px;
  height: 16px;
  accent-color: var(--double);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-field .late-hint{
  margin-top: 6px;
  margin-left: 26px;
}

.double-shift-type{
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: rgba(168, 85, 247, 0.08);
  border-radius: var(--radius-sm);
}
.double-shift-type .radio-opt{
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.double-shift-type input[type="radio"]{
  width: 16px;
  height: 16px;
  accent-color: var(--double);
  cursor: pointer;
  flex-shrink: 0;
}

.modal-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* =====================================================
   RESPONSIVE – Móvil, tablet y desktop
   ===================================================== */

@media (max-width: 768px){
  .wrap, main, .ficha-section, .nomina-store, .general-payroll-sheet,
  .report-print-area, .report-store-box{ max-width: 100%; min-width: 0; }
  .ficha-section, .general-payroll-sheet{ overflow-x: hidden; }
  .ficha-title-row, .ficha-title-action, .modal-actions{ max-width: 100%; }
  .ficha-title-action .btn, .nomina-controls .btn, .report-mode-buttons .btn{ max-width: 100%; }
  .ficha-grid{ grid-template-columns: 1fr; }
  .nomina-row{
    grid-template-columns: minmax(0, 1.45fr) repeat(3, minmax(0, 1fr));
    min-width: 0;
    gap: 4px;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 11px;
  }
  .nomina-row .num{ font-size: 11px; }
  .general-payroll-table{ font-size: 10px; }
  .general-payroll-table th,
  .general-payroll-table td{ padding: 6px 3px; }
  .grand-total-row{ grid-template-columns: 1fr; }
  .card-grid{ grid-template-columns: repeat(auto-fill, minmax(min(145px, 100%), 1fr)); }
}

@media (max-width: 640px){
  body{ padding-bottom: calc(36px + env(safe-area-inset-bottom)); }

  input, select, textarea{ font-size: 16px; }

  .modal-box{ max-width: 100%; }
  .login-box{ padding: 30px 20px 26px; }
  .report-filters{ display: grid; grid-template-columns: 1fr 1fr; }
  .report-filters label:first-child,
  .report-filters label:nth-child(2),
  .report-filters label:nth-child(3){ grid-column: 1 / -1; }
  .report-filters label:first-child input,
  .report-filters label:nth-child(2) select,
  .report-filters label:nth-child(3) select,
  .report-filters input[type="date"],
  .report-filters select{ min-width: 0; width: 100%; }
  .report-employee-buttons{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-employee-buttons .btn{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .report-mode-buttons{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-mode-buttons .btn{ width: 100%; min-width: 0; padding-left: 8px; padding-right: 8px; }
  .report-grand-total{ flex-wrap: nowrap; min-width: 0; padding: 14px 12px; gap: 8px; }
  .report-grand-total > div{ min-width: 0; }
  .report-grand-total .lbl,
  .report-grand-total .report-total-detail{ overflow-wrap: anywhere; }
  .report-grand-total .amt{ flex-shrink: 0; white-space: nowrap; font-size: 18px; }
  .employee-report-sheet{ max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .employee-report-table{ min-width: 620px; }
  .employee-report-table tfoot th{ white-space: nowrap; }
  .report-store-subtotal{
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
  }
  .report-store-subtotal span{ min-width: 0; }
  .report-store-subtotal strong{ flex-shrink: 0; white-space: nowrap; }

  .photo-preview{ width: 94px; height: 94px; }

  .tab-btn{ margin-right: 14px; padding: 12px 2px; }

  .preview-head{ align-items: flex-start; flex-direction: column; }
  .preview-section{ padding: 13px; }
  .preview-grid{ grid-template-columns: 1fr; }

  .tabs{
    position: relative;
    overflow: visible;
    flex-wrap: wrap;
    row-gap: 4px;
  }
  .menu-toggle{ display: block; }
  .menu-toggle{
    transform: scale(.82);
    transform-origin: left center;
  }
  .tabs-right{
    width: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
    transform: none;
  }
  .tabs-right .logout-btn{
    padding: 6px 7px;
    font-size: 10px;
  }
  .tabs-left{
    display: none;
    position: absolute;
    z-index: 30;
    top: calc(100% - 6px);
    left: 0;
    min-width: 190px;
    padding: 6px;
    flex-direction: column;
    overflow: visible;
    background: var(--surface-elevated);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
  }
  .tabs-left.open{ display: flex; }
  .tabs-left .tab-btn{
    width: 100%;
    margin: 0;
    padding: 11px 12px;
    text-align: left;
    border-bottom: 0;
    border-radius: 7px;
  }
  .tabs-left .tab-btn.active{ background: var(--primary-soft); }

  .days-grid{
    grid-template-columns: repeat(auto-fill, minmax(43px, 1fr));
    gap: 6px;
  }

  .folder-card .del{ opacity: 1; }
}

@media (min-width: 641px){
  .menu-toggle{ display: none !important; }
}

@media (max-width: 400px){
  .days-grid{
    grid-template-columns: repeat(auto-fill, minmax(39px, 1fr));
    gap: 5px;
  }
  .general-status-actions{ grid-template-columns: 1fr; }
  .day-btn .dow{ display: none; }
  .day-btn .num{ font-size: 13px; }

  .nomina-row{
    grid-template-columns: 1.3fr 1fr 1fr;
    font-size: 12.5px;
    padding: 11px 12px;
  }

  .summary .amt{ font-size: 24px; }
  .grand-total .amt{ font-size: 20px; }
}

@media (min-width: 900px){
  .card-grid{ grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); }
}

@media (min-width: 1100px){
  .card-grid{ grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}

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

/* =====================================================
   IMPRESIÓN
   ===================================================== */
@media print{
  *{
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body{
    background: #fff !important;
    color: #000 !important;
    padding: 0 !important;
  }
  .wrap{ max-width: 100% !important; }

  .login-overlay, .modal-overlay, .status,
  .add-card, .folder-card .del, .cancel-folder,
  .ficha-title-action, .status-banner button,
  .logo-box input[type="file"], .photo-upload .file-btn,
  .month-nav button, .tabs, .subtabs, .brand-text .hint,
  .report-print-row{
    display: none !important;
  }

  header{
    box-shadow: none !important;
    border: none !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    backdrop-filter: none !important;
  }
  .brand-row{
    padding-bottom: 8px;
    border-bottom: 2px solid #000;
    margin-bottom: 10px;
  }
  .logo-box{ border: none !important; cursor: default; }
  .company-name-input{ border: none !important; pointer-events: none; color: #000 !important; }

  .month-nav{ justify-content: center; margin-bottom: 8px; }
  .month-label{ font-size: 17px; color: #000 !important; }

  a[href]::after{ content: none !important; }

  .folder-card, .ficha-section, .quincena, .nomina-store,
  .summary, .grand-total, .grand-total.small, .day-btn,
  .report-store-box, .report-table tr{
    break-inside: avoid;
    box-shadow: none !important;
    background: #fff !important;
    color: #000 !important;
  }

  .folder-card, .ficha-section, .quincena, .nomina-store{
    border: 1px solid #ccc !important;
  }

  .card-grid{ grid-template-columns: repeat(3, 1fr) !important; }

  .crumbs .crumb{ cursor: default; }

  @page app-print{ size: portrait; margin: 10mm; }
  .report-print-area{ page: app-print; }
  .report-table{ font-size: 8px; min-width: 0; }

  body.printing-general-payroll .wrap > header,
  body.printing-general-payroll .status,
  body.printing-general-payroll .month-nav,
  body.printing-general-payroll .nomina-controls{ display: none !important; }
  body.printing-nomina .wrap > header,
  body.printing-nomina .status,
  body.printing-nomina .month-nav,
  body.printing-nomina .nomina-controls{ display: none !important; }
  body.printing-nomina .nomina-print-heading{
    display: flex !important;
    align-items: center;
    gap: 16px;
    padding-bottom: 18px;
    margin-bottom: 20px;
    border-bottom: 2px solid #1e3a8a;
  }
  body.printing-nomina .nomina-print-heading img{
    width: 58px;
    height: 58px;
    object-fit: contain;
  }
  body.printing-nomina .nomina-print-heading strong{ color: #333 !important; font-size: 13px; }
  body.printing-nomina .nomina-print-heading h1{ margin: 2px 0; color: #111 !important; font-size: 22px; }
  body.printing-nomina .nomina-print-heading p{ margin: 0; color: #555 !important; font-size: 12px; }
  body.printing-general-payroll .nomina-print-heading{ display: none !important; }
  body.printing-nomina #nomBody{ background: #fff !important; color: #111 !important; }
  body.printing-nomina .nomina-print-heading,
  body.printing-nomina #nomBody{ page: app-print; }
  body.printing-nomina .nomina-store{
    overflow: visible !important;
    border-color: #c9c9c9 !important;
    background: #fff !important;
    box-shadow: none !important;
  }
  body.printing-nomina .nomina-store h3{ background: #eef1f6 !important; color: #111 !important; }
  body.printing-nomina .nomina-row{ min-width: 0 !important; color: #111 !important; }
  body.printing-nomina .nomina-row.head{ color: #555 !important; }
  body.printing-report .wrap > header,
  body.printing-report .status,
  body.printing-report .month-nav,
  body.printing-report .subtabs,
  body.printing-report .report-mode-buttons,
  body.printing-report .report-employee-buttons,
  body.printing-report .report-filters,
  body.printing-report .report-print-row{ display: none !important; }
  body.printing-report .report-print-area{
    page: app-print;
    padding: 0 !important;
    zoom: .88;
    background: #fff !important;
  }
  body.printing-report .report-header{
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #1e3a8a !important;
    color: #000 !important;
    background: #fff !important;
  }
  body.printing-report .report-company,
  body.printing-report .report-title,
  body.printing-report .report-sub{
    color: #000 !important;
    background: #fff !important;
    opacity: 1 !important;
  }
  body.printing-report .report-company{ font-size: 12px; font-weight: 700; }
  body.printing-report .report-title{ font-size: 16px; font-weight: 800; }
  body.printing-report .report-sub{ font-size: 10px; }
  body.printing-report .report-logo{ width: 48px; height: 48px; }
  body.printing-report .report-title{ font-size: 17px; }
  body.printing-report .report-sub{ font-size: 10px; }
  body.printing-report .report-store-box{
    margin-bottom: 10px;
    overflow: visible !important;
    break-inside: avoid;
  }
  body.printing-report .report-store-subtotal{
    padding: 4px 6px;
    color: #111 !important;
    background: #eef1f6 !important;
    border-color: #c9c9c9 !important;
    font-size: 8px;
  }
  body.printing-report .report-store-subtotal strong{ color: #111 !important; }
  body.printing-report .report-table{ font-size: 10px; }
  body.printing-report .report-table th,
  body.printing-report .report-table td{
    padding: 3px 2px;
    color: #111 !important;
    background: #fff !important;
    border-color: #c9c9c9 !important;
  }
  body.printing-report .report-table thead th{
    color: #111 !important;
    background: #eef1f6 !important;
  }
  body.printing-report .report-store-box h3{ color: #111 !important; }
  body.printing-report .report-table th.rep-name-col,
  body.printing-report .report-table td.rep-name-col{
    width: 92px;
    padding: 2px 4px;
    font-size: 10px;
    color: #111 !important;
    background: #fff !important;
  }
  body.printing-report .report-table th.rep-day-col,
  body.printing-report .report-table td.rep-day-col{ width: 12px; }
  body.printing-report .report-table th.rep-total-col,
  body.printing-report .report-table td.rep-total-col{ width: 58px; }
  body.printing-report .report-legend{ margin: 6px 0; font-size: 9px; }
  body.printing-report .report-grand-total{ margin-top: 6px; padding: 12px 16px; }
  body.printing-report .report-grand-total,
  body.printing-report .report-grand-total .lbl,
  body.printing-report .report-grand-total .report-total-detail,
  body.printing-report .report-grand-total .amt{
    color: #000 !important;
    background: #fff !important;
    border-color: #c9c9c9 !important;
    box-shadow: none !important;
  }
  body.printing-report .employee-report-sheet{ page: app-print; }
  body.printing-report .employee-report-table{
    min-width: 0;
    border-collapse: collapse !important;
    font-weight: 600 !important;
  }
  body.printing-report .employee-report-table th,
  body.printing-report .employee-report-table td{
    border: 1px solid #000 !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
  }
  body.printing-general-payroll .general-payroll-sheet{
    page: app-print;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: #fff !important;
  }
  body.printing-general-payroll .general-payroll-table th,
  body.printing-general-payroll .general-payroll-table td{
    border-color: #c9c9c9 !important;
    color: #111 !important;
  }
  body.printing-general-payroll .general-payroll-table{
    min-width: 0 !important;
    font-size: 8px;
  }
  body.printing-general-payroll .general-payroll-table th,
  body.printing-general-payroll .general-payroll-table td{ padding: 4px 3px; }
  body.printing-general-payroll .general-payroll-table thead th{ background: #eef1f6 !important; }
  body.printing-general-payroll .general-payroll-table tbody tr:nth-child(even){ background: #f7f7f7 !important; }
  body.printing-general-payroll .general-payroll-table tfoot th{ background: #e5e7eb !important; }
  body.printing-general-payroll .general-payroll-heading{ border-bottom-color: #1e3a8a !important; }
}

@media print and (orientation: landscape){
  body.printing-report .report-print-area{ zoom: 1; }
  body.printing-report .report-table{ font-size: 11px; }
  body.printing-report .report-table th.rep-name-col,
  body.printing-report .report-table td.rep-name-col{ font-size: 11px; }
}

@media print{
  body,
  body *{
    color: #000 !important;
  }
}

/* Tema claro profesional para seguridad integral */
:root{
  --bg: #f8fcff;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #eef8fd;
  --ink: #000000;
  --ink-soft: #000000;
  --line: #d4e7f1;
  --line-strong: #afd0df;
  --primary: #3d8fb8;
  --primary-hover: #2e769b;
  --primary-glow: rgba(61, 143, 184, 0.22);
  --primary-soft: #e1f1f8;
  --stamp: #48a6b7;
  --stamp-soft: #e0f1ec;
  --gold: #a66a12;
  --gold-soft: #fbf0d9;
  --green: #3e9d7e;
  --green-soft: #e5f7ef;
  --danger: #c64b55;
  --danger-soft: #fbe4e4;
  --double: #5f4aa8;
  --double-soft: #eeeafb;
  --shadow-sm: 0 2px 8px rgba(40, 105, 135, 0.08);
  --shadow-md: 0 8px 24px rgba(40, 105, 135, 0.10);
  --shadow-lg: 0 18px 42px rgba(40, 105, 135, 0.16);
}

body{
  background: var(--bg);
  background-image: linear-gradient(135deg, #ffffff 0%, #eef8fd 100%);
}

header,
.login-box,
.ficha-section,
.nomina-store,
.general-payroll-sheet,
.report-store-subtotal{
  background: #ffffff;
}
.login-overlay{
  background: linear-gradient(160deg, #ffffff 0%, #e7f6fc 100%);
}
.summary,
.grand-total{
  background: #dff3fb;
  border-color: #a9d7e8;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.summary .lbl,
.summary .days,
.grand-total .lbl{ opacity: 1; color: var(--ink-soft); }
.summary .amt,
.grand-total .amt{ color: var(--primary-hover); }

@media screen{
  body,
  body *{
    color: #000 !important;
  }
}