:root {
  --sidebar-width: 248px;
  --primary: #6c5ce7;
  --primary-dark: #5546cf;
  --primary-soft: #efedff;
  --primary-border: #dcd7ff;
  --surface: #ffffff;
  --background: #f6f7fb;
  --border: #e9ebf2;
  --heading: #20263a;
  --text: #454b60;
  --muted: #8a90a3;
  --success: #23b26d;
  --warning: #f5a524;
  --danger: #ee5a67;
  --info: #35a9e8;
  --shadow: 0 8px 26px rgba(31, 38, 70, .05);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .84rem;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  overflow-y: auto;
  color: var(--text);
  background: var(--surface);
  border-right: 1px solid var(--border);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 0 10px 22px;
  color: var(--heading);
  text-decoration: none;
}

.brand:hover { color: var(--heading); }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #7768f2, #5a49dd);
  box-shadow: 0 8px 18px rgba(108, 92, 231, .22);
  font-size: 1.08rem;
}

.brand-title {
  max-width: 160px;
  overflow: hidden;
  font-weight: 750;
  font-size: .88rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.menu-label {
  padding: 21px 12px 8px;
  color: #a0a5b5;
  font-size: .65rem;
  font-weight: 750;
  letter-spacing: .1em;
}

.side-nav { display: grid; gap: 5px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 10px 12px;
  color: #656b7e;
  border-radius: 9px;
  text-decoration: none;
  font-size: .79rem;
  font-weight: 520;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.side-nav a i { width: 20px; text-align: center; font-size: 1.05rem; }
.side-nav a:hover { color: var(--primary); background: #f7f6ff; transform: translateX(2px); }
.side-nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 650; }

.sidebar-user {
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid var(--border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #7a6cf0, #5a49dd);
  border-radius: 50%;
  font-weight: 750;
  box-shadow: 0 5px 14px rgba(108, 92, 231, .2);
}

.sidebar-user small { color: var(--muted); }
.logout-btn { padding: 6px; color: var(--muted); border: 0; background: none; }
.logout-btn:hover { color: var(--danger); }

.app-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar strong { color: var(--heading); font-size: .84rem; }
.topbar-date { margin-top: 2px; color: var(--muted); font-size: .69rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #73798b;
  background: #f8f9fc;
  border: 1px solid var(--border);
  border-radius: 50%;
  padding: 0;
  text-decoration: none;
}
.topbar-icon:hover { color: var(--primary); background: var(--primary-soft); border-color: var(--primary-border); }
.topbar-profile { display: flex; align-items: center; gap: 9px; margin-left: 3px; color: var(--heading); }
.mobile-menu { display: none; width: 40px; height: 40px; place-items: center; color: var(--heading); background: #f8f9fc; border: 1px solid var(--border); border-radius: 10px; }

.page-content { width: 100%; margin: 0 auto; padding: 28px 32px 48px; }
.page-content > h3,
.page-content > .d-flex h3 {
  color: var(--heading);
  font-size: 1.25rem;
  font-weight: 740;
  letter-spacing: -.025em;
}

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-header-copy h1 { margin: 0 0 4px; color: var(--heading); font-size: 1.3rem; font-weight: 760; letter-spacing: -.03em; }
.page-header-copy p { margin: 0; color: var(--muted); font-size: .8rem; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-card { padding: 14px; margin-bottom: 16px; }
.stat-compact { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 13px; min-height: 86px; padding: 16px 18px; text-align: left; }
.stat-compact .valor { margin-bottom: 1px; }
.empty-state { min-height: 230px; display: grid; place-items: center; padding: 36px 20px; text-align: center; }
.empty-state-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 14px; color: var(--primary); background: var(--primary-soft); border-radius: 18px; font-size: 1.6rem; }
.empty-state h5 { margin-bottom: 6px; }
.empty-state p { max-width: 440px; margin: 0 auto 16px; color: var(--muted); }
.import-sheet-icon { width: 46px; height: 46px; flex: 0 0 46px; display: grid; place-items: center; color: #198754; background: #e4f8ee; border-radius: 13px; font-size: 1.25rem; }
.import-step { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.import-step span { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 50%; font-size: .7rem; font-weight: 750; }
.import-step p { margin: 2px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.import-warning { max-width: 250px; line-height: 1.35; }
.import-results-table th, .import-results-table td { white-space: nowrap; }
.import-results-table td:nth-child(2), .import-results-table td:nth-child(3), .import-results-table td:nth-child(4) { white-space: normal; }
.table-actions { text-align: right; }
.table-subline { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.section-heading h6 { margin: 0; }

.card,
.card-indicador {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.card-indicador { overflow-x: auto; }
.card-indicador .valor { color: var(--heading); font-size: 1.55rem; font-weight: 760; letter-spacing: -.04em; }
.card h5, .card h6 { color: var(--heading); font-weight: 680; }

.btn { min-height: 36px; padding: .46rem .78rem; border-radius: 8px; font-size: .78rem; font-weight: 620; }
.btn-sm { min-height: 32px; padding: .35rem .65rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); box-shadow: 0 5px 13px rgba(108, 92, 231, .16); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: #bfb7fa; }
.btn-outline-primary:hover { color: #fff; background: var(--primary); border-color: var(--primary); }
.btn-outline-secondary { color: #687084; border-color: #d5d9e3; }
.btn-light { background: #fff; border-color: var(--border); }

.form-label { margin-bottom: .38rem; color: #52586b; font-size: .73rem; font-weight: 630; }
.form-control, .form-select {
  min-height: 42px;
  padding: .62rem .78rem;
  color: var(--heading);
  background-color: #fff;
  border-color: #dfe2eb;
  border-radius: 8px;
  font-size: .8rem;
}
.form-control::placeholder { color: #a5a9b6; }
.form-control:focus, .form-select:focus { border-color: #9e91f2; box-shadow: 0 0 0 .2rem rgba(108, 92, 231, .1); }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-text { color: var(--muted); font-size: .74rem; }

.form-card { width: 100%; max-width: none; overflow: visible; }
.form-card-sm { max-width: none; }
.form-section { margin-bottom: 1.45rem; padding-bottom: 1.45rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { padding-bottom: 0; border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: .55rem; margin-bottom: 1rem; color: var(--heading); font-size: .82rem; font-weight: 720; }
.form-section-title i { width: 28px; height: 28px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 8px; }
.form-actions { display: flex; gap: .55rem; margin: 1.5rem -1.5rem -1.5rem; padding: 1rem 1.5rem; background: #fafbfc; border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; }

.table { --bs-table-bg: transparent; margin: 0; color: var(--text); white-space: nowrap; }
.table thead th {
  padding: 13px 16px;
  color: #8a90a2;
  background: #fafbfc;
  border-bottom-color: var(--border);
  font-size: .64rem;
  font-weight: 720;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.table tbody td { padding: 14px 16px; border-bottom-color: #eff0f5; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #fbfbfe; }
.table a { color: var(--heading); font-weight: 620; text-decoration: none; }
.table a:hover { color: var(--primary); }

.list-group-item { color: var(--text); background: transparent; border-color: #eff0f5; }
.badge { padding: .48em .75em; border-radius: 999px; font-size: .69rem; font-weight: 650; }
.bg-primary { background-color: var(--primary) !important; }
.text-primary { color: var(--primary) !important; }
.badge-classificacao-novo { background: #e8f2ff; color: #307bc2; }
.badge-classificacao-frequente { background: #e4f8ee; color: #198755; }
.badge-classificacao-regular { background: #eef0f4; color: #62697a; }
.badge-classificacao-irregular { background: #fff0e2; color: #b26723; }
.badge-classificacao-em_atencao { background: #fff6d9; color: #9a7010; }
.badge-classificacao-afastado { background: #ffe9ec; color: #bd3d4b; }
.badge-classificacao-retornou { background: #e5f7f5; color: #167d72; }

.alert { border: 0; border-radius: 10px; box-shadow: var(--shadow); }
.admin-notice-stack { position:fixed; top:18px; left:50%; z-index:2100; width:min(520px,calc(100vw - 28px)); display:grid; gap:10px; transform:translateX(-50%); pointer-events:none; }
.admin-notice { --notice-color:var(--info); --notice-soft:#eaf7fe; display:flex; align-items:center; gap:12px; min-height:66px; padding:11px 12px; color:var(--heading); background:rgba(255,255,255,.97); border:1px solid color-mix(in srgb,var(--notice-color) 22%,white); border-radius:15px; box-shadow:0 18px 48px rgba(31,38,70,.18); backdrop-filter:blur(14px); pointer-events:auto; animation:notice-in .32s cubic-bezier(.2,.8,.2,1) both; }
.admin-notice-success { --notice-color:var(--success); --notice-soft:#e4f8ee; }
.admin-notice-error,.admin-notice-danger { --notice-color:var(--danger); --notice-soft:#ffe9ec; }
.admin-notice-warning { --notice-color:var(--warning); --notice-soft:#fff4d9; }
.admin-notice-info { --notice-color:var(--info); --notice-soft:#eaf7fe; }
.admin-notice-icon { width:40px; height:40px; flex:0 0 40px; display:grid; place-items:center; color:var(--notice-color); background:var(--notice-soft); border-radius:12px; font-size:1.05rem; font-weight:800; }
.admin-notice-copy { min-width:0; flex:1; }
.admin-notice-copy strong,.admin-notice-copy span { display:block; }
.admin-notice-copy strong { margin-bottom:2px; color:var(--heading); font-size:.77rem; }
.admin-notice-copy span { color:#6f7588; font-size:.74rem; line-height:1.35; }
.admin-notice-close { width:30px; height:30px; flex:0 0 30px; display:grid; place-items:center; padding:0; color:#979cac; background:transparent; border:0; border-radius:8px; font-size:1.15rem; }
.admin-notice-close:hover { color:var(--heading); background:#f2f3f7; }
.admin-notice.is-leaving { animation:notice-out .26s ease both; }
@keyframes notice-in { from { opacity:0; transform:translateY(-18px) scale(.97); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes notice-out { to { opacity:0; transform:translateY(-12px) scale(.98); } }
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 24px 65px rgba(32, 38, 58, .17); }
.modal-header { border-bottom-color: var(--border); }
.rounded-3 { border-radius: 10px !important; }
.bg-light { background-color: #f8f9fc !important; }
.text-muted, .text-secondary { color: var(--muted) !important; }
.sidebar-overlay { display: none; }

.report-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 1.05rem;
}
.report-icon-primary { color: var(--primary); background: var(--primary-soft); }
.report-icon-warning { color: #b97809; background: #fff4d9; }
.report-icon-danger { color: #c6404d; background: #ffe9ec; }
.report-icon-success { color: #198755; background: #e4f8ee; }
.report-panel { min-height: 245px; }
.report-panel-header { display: flex; align-items: center; gap: 12px; padding: 18px 18px 15px; border-bottom: 1px solid var(--border); }
.report-panel-warning { background: linear-gradient(135deg, #fffdf7, #fff); }
.report-panel-danger { background: linear-gradient(135deg, #fff9fa, #fff); }
.report-person { min-height: 72px; padding: 12px 2px; }
.report-avatar { width: 42px; height: 42px; flex: 0 0 42px; object-fit: cover; border-radius: 50%; }
.report-avatar-fallback { display: grid; place-items: center; color: var(--muted); background: #f0f1f5; font-size: 1.1rem; }
.report-empty { min-height: 115px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); border-bottom: 0; }
.report-empty i { color: var(--success); font-size: 1.2rem; }
.empty-success { min-height: 92px; display: flex; flex-direction: row; align-items: center; gap: 15px; padding: 18px 20px; border-color: #d8f0e4; background: linear-gradient(110deg, #f4fcf8, #fff 58%); }
.empty-success-icon { width: 50px; height: 50px; flex: 0 0 50px; display: grid; place-items: center; color: var(--success); background: #dff6ea; border-radius: 14px; font-size: 1.35rem; }
.min-w-0 { min-width: 0; }
.facial-step { position: relative; display: flex; align-items: flex-start; gap: 14px; min-height: 145px; padding: 22px; }
.facial-step > span { position: absolute; top: 14px; right: 16px; color: #b0abc9; font-size: .72rem; font-weight: 750; }
.facial-step > i { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 12px; font-size: 1.12rem; }
.facial-step h6 { margin: 2px 0 7px; }
.facial-step p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.55; }
.camera-stage { display: block; width: 100%; min-height: 360px; max-height: 520px; aspect-ratio: 4 / 3; object-fit: cover; }
.checkin-side { min-height: 510px; }
.recent-card { min-height: 230px; }
.checkin-method-toggle { display:flex; align-items:center; gap:12px; min-height:92px; padding:14px; cursor:pointer; background:#fafbfc; border:1px solid var(--border); border-radius:12px; transition:.15s ease; }
.checkin-method-toggle:hover { border-color:var(--primary-border); background:#faf9ff; }
.checkin-method-toggle.is-enabled { border-color:var(--primary-border); background:var(--primary-soft); }
.checkin-method-toggle strong, .checkin-method-toggle small { display:block; }
.checkin-method-toggle strong { color:var(--heading); font-size:.78rem; }
.checkin-method-toggle small { margin-top:3px; color:var(--muted); font-size:.68rem; line-height:1.3; }
.checkin-method-toggle .form-check-input { width:2.35em; height:1.2em; cursor:pointer; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: 18px 0 45px rgba(30, 35, 55, .12); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { position: fixed; inset: 0; z-index: 1035; display: block; background: rgba(25, 29, 45, .38); backdrop-filter: blur(2px); }
  .app-main { margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { height: 66px; padding: 0 18px; }
  .topbar-profile .profile-copy { display: none; }
  .page-content { padding: 22px 16px 40px; }
}

@media (max-width: 575.98px) {
  .topbar-date { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-icon { width: 36px; height: 36px; }
  .page-content > .d-flex.justify-content-between { align-items: flex-start !important; }
  .page-content > .d-flex.justify-content-between > .d-flex { width: 100%; flex-wrap: wrap; }
  .card-indicador.p-4, .form-card.p-4 { padding: 1.15rem !important; }
  .form-actions { margin: 1.25rem -1.15rem -1.15rem; padding: .9rem 1.15rem; }
  .empty-success { align-items: flex-start; flex-wrap: wrap; }
  .empty-success .btn { width: 100%; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-header-actions, .page-header-actions .btn { width: 100%; }
  .table-actions { text-align: left; }
  .participant-table th:nth-child(3), .participant-table td:nth-child(3),
  .participant-table th:nth-child(4), .participant-table td:nth-child(4),
  .participant-table th:nth-child(5), .participant-table td:nth-child(5),
  .participant-table th:nth-child(7), .participant-table td:nth-child(7) { display:none; }
  .frequency-table th:nth-child(2), .frequency-table td:nth-child(2),
  .frequency-table th:nth-child(3), .frequency-table td:nth-child(3) { display:none; }
  .frequency-table { white-space: normal; }
  .frequency-table th, .frequency-table td { padding-left: 10px; padding-right: 10px; }
  .encounter-table th:nth-child(2), .encounter-table td:nth-child(2),
  .encounter-table th:nth-child(4), .encounter-table td:nth-child(4),
  .encounter-table th:nth-child(6), .encounter-table td:nth-child(6),
  .encounter-table th:nth-child(7), .encounter-table td:nth-child(7) { display:none; }
}
