:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --blue: #1e3a8a;
  --blue-mid: #1d4ed8;
  --accent: #f97316;
  --emerald: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --sidebar-w: 250px;
  --radius: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); overflow-x: hidden; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,0.1); margin-bottom: 14px; }
.sidebar-brand img { width: 34px; height: 34px; border-radius: 8px; }
.sidebar-brand h1 { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: -0.02em; }
.sidebar-brand span { display: block; font-size: 0.7rem; color: #94a3b8; }

.nav-list { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 9px; border: 0; background: transparent;
  color: #cbd5e1; font-size: 0.86rem; font-weight: 600; text-align: left; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-btn.active { background: var(--blue); color: #fff; }

.main-area { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-left h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.menu-toggle { display: none; }

.content { padding: 20px 22px 48px; max-width: 1280px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 68%, #1d4ed8 100%);
  color: #fff; border-radius: 16px; padding: 24px; margin-bottom: 20px;
  display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 20px; align-items: center;
}
.hero-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: rgba(249,115,22,0.22); border: 1px solid rgba(249,115,22,0.6); color: #ffedd5;
  padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
}
.hero-banner h2 { margin: 0 0 8px; font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.hero-banner p { margin: 0; font-size: 0.88rem; line-height: 1.6; color: #e2e8f0; text-align: justify; text-justify: inter-word; }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-card {
  display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.18);
  color: #fff; text-decoration: none; text-align: left; cursor: pointer; transition: background 0.15s, transform 0.15s;
}
.quick-card:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.quick-card strong { display: block; font-size: 0.84rem; }
.quick-card span { display: block; font-size: 0.72rem; color: #cbd5e1; margin-top: 2px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi-label { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-val { font-size: 1.55rem; font-weight: 800; margin-top: 6px; color: var(--ink); }
.kpi-sub { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px;
  border-radius: 999px; font-size: 0.75rem; font-weight: 700; border: 1px solid transparent; cursor: pointer;
}
.sync-pill.online { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.sync-pill.offline { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.sync-pill.pending { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.sig-canvas { width: 100%; height: 140px; border: 1px dashed #94a3b8; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
.photo-thumb-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.photo-thumb-grid img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.qr-card { text-align: center; padding: 16px; border: 1px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; }

/* Home Page & Auth Multi-Empresa */
.screen-hidden { display: none !important; }
.home-page { min-height: 100vh; background: #f8fafc; color: var(--ink); display: flex; flex-direction: column; }
.home-nav {
  background: rgba(15, 23, 42, 0.96); color: #fff; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 50; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.home-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.home-brand img { width: 34px; height: 34px; border-radius: 8px; }
.home-nav-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-hero {
  position: relative; overflow: hidden;
  background: radial-gradient(circle at 80% 20%, rgba(29,78,216,0.45), transparent 55%),
              linear-gradient(135deg, #070f24 0%, #0f172a 48%, #1e3a8a 100%);
  color: #fff; padding: 72px 24px 64px;
}
.home-blueprint-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.28;
  background-image:
    linear-gradient(to right, rgba(147,197,253,0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(147,197,253,0.16) 1px, transparent 1px),
    linear-gradient(to right, rgba(147,197,253,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(147,197,253,0.06) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
  animation: blueprintPan 40s linear infinite;
}
.home-blueprint-svg {
  position: absolute; right: -4%; top: -8%; width: min(760px, 85vw); height: auto;
  pointer-events: none; opacity: 0.22; animation: floatSlow 12s ease-in-out infinite;
}
.home-hero-inner { position: relative; z-index: 2; max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 32px; align-items: center; }
.home-hero h1 { font-size: clamp(1.95rem, 3.8vw, 3rem); font-weight: 800; line-height: 1.12; margin: 0 0 14px; animation: fadeUp 0.65s ease-out both; }
.home-hero p { font-size: 1rem; line-height: 1.65; color: #dbeafe; margin: 0 0 24px; text-align: justify; text-justify: inter-word; animation: fadeUp 0.8s ease-out both; }
.home-cta-row { display: flex; gap: 12px; flex-wrap: wrap; animation: fadeUp 0.95s ease-out both; }
.home-stats-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 24px;
  animation: fadeUp 1.1s ease-out both;
}
.home-stat-pill {
  background: rgba(15,23,42,0.55); border: 1px solid rgba(147,197,253,0.22);
  border-radius: 12px; padding: 10px 12px; backdrop-filter: blur(6px);
}
.home-stat-pill strong { display: block; font-size: 1.15rem; color: #fb923c; }
.home-stat-pill span { font-size: 0.74rem; color: #cbd5e1; }
.home-preview-card {
  background: rgba(255,255,255,0.09); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 18px; padding: 24px; backdrop-filter: blur(10px);
  box-shadow: 0 24px 50px rgba(2,6,23,0.45);
  animation: fadeUp 0.85s ease-out both;
}
.home-section { max-width: 1180px; margin: 0 auto; padding: 52px 24px; width: 100%; }
.home-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.feature-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px;
  box-shadow: 0 4px 14px rgba(15,23,42,0.04); transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(30,58,138,0.1); border-color: #93c5fd; }
.home-plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-top: 28px; }
.home-plan-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.home-plan-card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(15,23,42,0.08); }
.home-plan-card.featured { border: 2px solid var(--blue); background: linear-gradient(180deg, #eff6ff 0%, #ffffff 45%); }
.home-plan-card ul { padding-left: 18px; margin: 12px 0 0; font-size: 0.84rem; color: var(--ink-2); line-height: 1.65; }

@keyframes blueprintPan {
  0% { background-position: 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: 80px 80px, 80px 80px, 20px 20px, 20px 20px; }
}
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.feature-card h3 { margin: 8px 0 6px; font-size: 1rem; }
.feature-card p { margin: 0; font-size: 0.86rem; color: var(--muted); line-height: 1.55; text-align: justify; text-justify: inter-word; }

.about-box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px; margin-top: 24px; box-shadow: 0 4px 16px rgba(15,23,42,0.04); scroll-margin-top: 84px; }
.about-box h2 { margin: 0 0 10px; font-size: 1.3rem; color: var(--blue); }
.about-box p { margin: 0 0 12px; font-size: 0.92rem; color: var(--ink-2); line-height: 1.65; text-align: justify; text-justify: inter-word; }

.site-footer {
  margin-top: auto; background: #0f172a; color: #cbd5e1; padding: 32px 24px;
  border-top: 1px solid rgba(255,255,255,0.08); font-size: 0.84rem;
}
.site-footer-inner { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.site-footer h4 { margin: 0 0 8px; color: #fff; font-size: 0.92rem; }
.site-footer a { color: #93c5fd; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer-bottom { max-width: 1180px; margin: 20px auto 0; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 0.78rem; color: #94a3b8; }

.whatsapp-float {
  position: fixed; left: 18px; bottom: 18px; z-index: 950;
  display: inline-flex; align-items: center; gap: 8px;
  background: #16a34a; color: #fff; text-decoration: none;
  padding: 11px 16px; border-radius: 999px; font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 12px 28px rgba(22, 163, 74, 0.38);
  transition: transform 0.2s ease, background 0.2s ease;
}
.whatsapp-float:hover { background: #15803d; transform: translateY(-2px); }

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.auth-card {
  background: #fff; border-radius: 16px; width: min(460px, 100%); padding: 28px;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: #f1f5f9; padding: 4px; border-radius: 10px; margin: 16px 0; }
.auth-tab { border: 0; background: transparent; padding: 8px; border-radius: 8px; font-weight: 700; font-size: 0.84rem; color: var(--muted); cursor: pointer; }
.auth-tab.active { background: #fff; color: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.demo-box { margin-top: 16px; padding: 12px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--line); font-size: 0.78rem; }
.company-pill {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 0.76rem;
}

@media (max-width: 900px) {
  .home-hero-inner { grid-template-columns: 1fr; }
}

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-bar .form-control { width: auto; min-width: 150px; flex: 1 1 160px; max-width: 260px; padding: 7px 10px; font-size: 0.82rem; }

.clock-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: 8px; background: #f1f5f9; border: 1px solid var(--line);
  font-size: 0.76rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums;
}

.alert-bell-btn { position: relative; }
.alert-badge {
  background: var(--red); color: #fff; border-radius: 999px;
  padding: 1px 6px; font-size: 0.68rem; font-weight: 800; margin-left: 2px;
}

.dual-logo-bar { display: flex; align-items: center; gap: 8px; }
.dual-logo-img { height: 28px; max-width: 84px; object-fit: contain; border-radius: 6px; background: #fff; padding: 2px; border: 1px solid var(--line); }

.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-day-header { text-align: center; font-size: 0.74rem; font-weight: 700; color: var(--muted); padding: 6px 0; text-transform: uppercase; }
.cal-cell {
  min-height: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 6px;
  background: #fff; display: flex; flex-direction: column; gap: 4px; cursor: pointer;
}
.cal-cell.other-month { background: #f8fafc; opacity: 0.55; }
.cal-cell.today { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(30,58,138,0.14); }
.cal-date-num { font-size: 0.76rem; font-weight: 700; color: var(--ink-2); }
.cal-event { font-size: 0.68rem; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-event.ot { background: #dbeafe; color: #1e40af; }
.cal-event.pm { background: #fef3c7; color: #92400e; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-title { margin: 0; font-size: 1rem; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  gap: 6px; padding: 9px 14px; border-radius: var(--radius-sm);
  font-size: 0.84rem; font-weight: 600; line-height: 1.25; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: all 0.15s; white-space: nowrap;
}
.btn-sm { padding: 6px 11px; font-size: 0.78rem; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-mid); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-success { background: var(--emerald); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.data-table th { text-align: left; padding: 10px; background: #f8fafc; color: var(--ink-2); font-size: 0.73rem; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table td > .btn { margin: 2px 4px 2px 0; }

.badge { display: inline-flex; align-items: center; justify-content: center; text-align: center; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.form-control { width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: var(--radius-sm); font-size: 0.86rem; font-family: inherit; background: #fff; }
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,58,138,0.12); }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,0.58); z-index: 80; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal-box { background: #fff; border-radius: 14px; width: min(680px, 100%); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(2,6,23,0.4); }
.modal-header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body p { text-align: justify; text-justify: inter-word; line-height: 1.55; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; background: #f8fafc; }

.chk-item-row { display: grid; grid-template-columns: 1.5fr 1fr 0.7fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 0.84rem; font-weight: 600; z-index: 120; box-shadow: 0 10px 25px rgba(0,0,0,0.25); }

@media (max-width: 1080px) {
  .hero-banner { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .sidebar.open { display: flex; box-shadow: 0 10px 35px rgba(0,0,0,0.4); }
  .main-area { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
}

@media (max-width: 640px) {
  .content { padding: 14px 12px 40px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .home-nav { padding: 12px 14px; }
  .home-hero { padding: 36px 16px; }
  .home-section { padding: 28px 16px; }
  .auth-card { padding: 20px; }
  .quick-grid, .form-grid, .kpi-grid { grid-template-columns: 1fr; }
  .filter-bar .form-control { max-width: 100%; width: 100%; flex: 1 1 100%; }
  .calendar-grid { gap: 3px; }
  .cal-cell { min-height: 58px; padding: 3px; }
  .cal-event { font-size: 0.6rem; padding: 1px 3px; }
  .clock-pill, .sync-pill { font-size: 0.71rem; padding: 4px 8px; }
  .chk-item-row { grid-template-columns: 1fr; border: 1px solid var(--line); padding: 10px; border-radius: 8px; }
  .btn { min-height: 38px; }
  .btn-sm { min-height: 32px; padding: 5px 9px; font-size: 0.75rem; }
  .modal-footer .btn { flex: 1 1 auto; }
}
