/* LIGHT MODE (padrÃƒÆ’Ã†â€™Ãƒâ€ Ã¢â‚¬â„¢ÃƒÆ’Ã¢â‚¬Å¡Ãƒâ€šÃ‚Â£o) */
:root {
  --bg: #f0f4f8;
  --bg2: #e8edf5;
  --bg3: #dce4ef;
  --card: #ffffff;
  --card2: #f8fafc;
  --border: #c8d5e8;
  --accent: #2E9E4F;
  --accent2: #27883f;
  --accent3: #d97706;
  --green: #2E9E4F;
  --red: #dc2626;
  --yellow: #d97706;
  --navy: #1B2D6B;
  --text: #0f172a;
  --text2: #1e3a5f;
  --text3: #4a6a99;
  --font: 'Sora', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 12px;
  --radius2: 20px;
  --shadow: 0 4px 24px rgba(46,158,79,0.1);
  --shadow2: 0 8px 40px rgba(0,0,0,0.1);
  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}
/* DARK MODE */
[data-theme="dark"] {
  --bg: #0a1229;
  --bg2: #0f1e3d;
  --bg3: #162550;
  --card: #111d3a;
  --card2: #1a2a4a;
  --border: #1e3060;
  --accent: #2E9E4F;
  --accent2: #3dbb66;
  --accent3: #F5A623;
  --green: #3dbb66;
  --red: #ef4444;
  --yellow: #F5A623;
  --navy: #1B2D6B;
  --text: #e8eef8;
  --text2: #8aaccf;
  --text3: #4a6a99;
  --shadow: 0 4px 24px rgba(46,158,79,0.15);
  --shadow2: 0 8px 40px rgba(0,0,0,0.5);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- SCREENS ---- */
.screen { display:none; min-height:100vh; }
.screen.active { display:flex; }

/* ======== SPLASH ======== */
#screen-splash {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: radial-gradient(ellipse at 30% 40%, #c8e6d4 0%, var(--bg) 70%);
}

.splash-logo {
  font-size: 56px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

.splash-title {
  font-size: 2.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #3dbb66, #F5A623);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}

.splash-sub {
  color: var(--text3);
  margin-top: 8px;
  font-size: 0.9rem;
}

.splash-loader {
  margin-top: 48px;
  width: 48px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.splash-loader::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: loading 1.2s ease-in-out infinite alternate;
}

@keyframes loading { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ======== AUTH ======== */
#screen-auth {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: radial-gradient(ellipse at 70% 60%, #c8e6d4 0%, var(--bg) 70%);
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow2);
}

.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo .emoji { font-size: 40px; }
.auth-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--accent2); margin-top: 8px; }
.auth-logo p { color: var(--text3); font-size: 0.85rem; margin-top: 4px; }

.auth-tabs {
  display: flex;
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text3);
  transition: var(--transition);
}

.auth-tab.active {
  background: var(--accent);
  color: white;
}

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text2);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 158, 79, 0.2);
}

.form-input::placeholder { color: var(--text3); }

select.form-input { cursor: pointer; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-google {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 100%;
  margin-top: 12px;
}
.btn-google:hover { border-color: var(--accent); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text3);
  font-size: 0.8rem;
  margin: 16px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ======== SETUP ORG ======== */
#screen-setup {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 20%, #c8e6d4 0%, var(--bg) 60%);
}

.setup-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow2);
}

.setup-card h2 { font-size: 1.4rem; margin-bottom: 6px; }
.setup-card p { color: var(--text3); font-size: 0.85rem; margin-bottom: 28px; }

.org-options { display: flex; gap: 12px; margin-bottom: 24px; }

.org-option {
  flex: 1;
  padding: 20px 16px;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.org-option:hover, .org-option.active {
  border-color: var(--accent);
  background: rgba(108,99,255,0.1);
}

.org-option .icon { font-size: 28px; margin-bottom: 8px; }
.org-option h3 { font-size: 0.9rem; font-weight: 600; }
.org-option p { font-size: 0.78rem; color: var(--text3); margin: 0; }

/* ======== MAIN APP ======== */
#screen-app {
  flex-direction: column;
}

/* TOP BAR */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: var(--card);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  z-index: 100;
}

.topbar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-org {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.org-badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  color: var(--text2);
  cursor: pointer;
  transition: var(--transition);
}
.org-badge:hover { border-color: var(--accent); }

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  cursor: pointer;
  border: 2px solid var(--border);
}

/* CONTENT AREA */
.app-content {
  margin-top: 60px;
  display: flex;
  flex: 1;
}

/* SIDEBAR */
.sidebar {
  width: 220px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 200;
  /* Desktop: sempre visível */
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 8px;
  margin-bottom: 6px;
  margin-top: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text2);
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,0.15); color: var(--accent2); }
.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* MAIN PANEL */
.main-panel {
  margin-left: 220px;
  flex: 1;
  padding: 28px;
  min-height: calc(100vh - 60px);
  transition: margin-left 0.25s ease;
}

/* PAGE */
.page { display:none; }
.page.active { display:block; }

/* Modo atalho: só uma função (link ?solo=1#/pagina ou “Adicionar à tela inicial”) */
body.cg-solo-mode #sidebar,
body.cg-solo-mode #sidebarOverlay,
body.cg-solo-mode .hamburger-btn {
  display: none !important;
}
body.cg-solo-mode .main-panel {
  margin-left: 0 !important;
  max-width: 100%;
}
body.cg-try-solo .try-tabs {
  display: none !important;
}
body.cg-try-solo .try-header h1 {
  font-size: 1rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header .btn { width: auto !important; white-space: nowrap; }

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.03em;
}
[data-theme="dark"] .page-title { color: var(--text); }
.page-sub { color: var(--text3); font-size: 0.88rem; margin-top: 4px; line-height: 1.35; }

/* ===== DASHBOARD (hero + widgets) ===== */
.dash-hero {
  background: linear-gradient(135deg, #152456 0%, var(--navy) 40%, #243a85 100%);
  color: #fff;
  border-radius: var(--radius2);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 40px rgba(27, 45, 107, 0.28);
  position: relative;
  overflow: hidden;
}
.dash-hero::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -15%;
  width: 55%;
  height: 140%;
  background: radial-gradient(circle, rgba(46, 158, 79, 0.22) 0%, transparent 65%);
  pointer-events: none;
}
.dash-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-hero-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.75;
  margin-bottom: 6px;
}
.dash-hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.2;
}
.dash-hero-date {
  font-size: 0.88rem;
  opacity: 0.88;
  margin: 10px 0 0;
  font-weight: 400;
  text-transform: capitalize;
  max-width: 100%;
}
.dash-hero-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  color: #fff !important;
  backdrop-filter: blur(8px);
}
.dash-hero-btn:hover {
  background: rgba(255, 255, 255, 0.24) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
  color: #fff !important;
}
.dash-widgets {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.dash-quick-btn {
  min-height: 44px;
  justify-content: center;
  text-align: center;
  border-radius: 12px !important;
  font-weight: 500;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.dash-quick-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(27, 45, 107, 0.12);
}
.dash-summary.cards-grid {
  margin-bottom: 20px;
}
[data-theme="dark"] .dash-hero {
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45);
}

/* CARDS GRID */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border: 1px solid rgba(27, 45, 107, 0.1);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
  box-shadow: 0 2px 12px rgba(27, 45, 107, 0.05);
}
.stat-card:hover {
  border-color: rgba(46, 158, 79, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(27, 45, 107, 0.1);
}

.stat-label { font-size: 0.75rem; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.8rem; font-weight: 700; font-family: var(--mono); margin-top: 6px; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.accent { color: var(--accent2); }

/* TABLE */
.table-wrap {
  background: var(--card);
  border: 1px solid rgba(27, 45, 107, 0.1);
  border-radius: var(--radius2);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(27, 45, 107, 0.06);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.table-title { font-weight: 600; font-size: 0.95rem; }

.search-input {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  outline: none;
  width: 200px;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 14px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(46,46,80,0.5);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(27, 45, 107, 0.045); }

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-green { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-red { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-yellow { background: rgba(245,158,11,0.15); color: var(--yellow); }
.badge-accent { background: rgba(27, 45, 107, 0.12); color: var(--navy); }
.badge-gray { background: var(--bg3); color: var(--text3); }

/* BUTTONS */
.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
  border-radius: 8px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent2); }

.btn-danger {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success {
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--green);
}
.btn-success:hover { background: rgba(16,185,129,0.2); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  color: var(--text2);
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent2); }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow2);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp { from { transform: translateY(20px); opacity:0; } to { transform: translateY(0); opacity:1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.05rem; font-weight: 600; }
.modal-close {
  cursor: pointer;
  color: var(--text3);
  font-size: 1.2rem;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* FORM GRID */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* FOLHA */
.folha-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 24px;
  margin-bottom: 16px;
  transition: var(--transition);
}
.folha-card:hover { border-color: var(--accent); }

.folha-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.folha-employee-name { font-size: 1rem; font-weight: 600; }
.folha-employee-role { color: var(--text3); font-size: 0.8rem; }

.folha-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.folha-value-item { }
.folha-value-label { font-size: 0.72rem; color: var(--text3); }
.folha-value-num {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  margin-top: 2px;
}
.folha-value-num.pos { color: var(--green); }
.folha-value-num.neg { color: var(--red); }
.folha-value-num.total { color: var(--accent2); font-size: 1.1rem; }

/* ACERTO DE CONTAS PESSOAIS */
.acerto-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 24px;
}

.acerto-pair {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.acerto-pair:last-child { border-bottom: none; }

.acerto-person { text-align: center; }
.acerto-person-name { font-weight: 600; font-size: 0.9rem; }
.acerto-person-debt { font-size: 0.78rem; color: var(--text3); margin-top: 2px; }

.acerto-saldo {
  text-align: center;
  flex: 1;
}
.acerto-saldo-label { font-size: 0.7rem; color: var(--text3); }
.acerto-saldo-value {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  margin-top: 4px;
}

/* INVITE */
.invite-code {
  background: var(--bg2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent2);
  cursor: pointer;
  transition: var(--transition);
}
.invite-code:hover { border-color: var(--accent); }

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.85rem;
  box-shadow: var(--shadow2);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn { from { transform: translateX(20px); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 1rem; color: var(--text2); margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; }

/* DROPDOWN MENU */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow2);
  z-index: 300;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--text2);
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--bg2); color: var(--text); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); }

/* SECTION CARD */
.section-card {
  background: var(--card);
  border: 1px solid rgba(27, 45, 107, 0.1);
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: 0 2px 16px rgba(27, 45, 107, 0.06);
}
.section-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
[data-theme="dark"] .section-card-title {
  color: var(--text2);
}

/* Seções colapsáveis no cadastro de funcionário */
.func-details {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
  overflow: hidden;
}
.func-details > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.func-details > summary::-webkit-details-marker { display: none; }
.func-details > summary::after {
  content: "▸";
  margin-left: auto;
  transition: transform 0.18s ease;
  color: var(--text3);
  font-size: 0.85rem;
}
.func-details[open] > summary::after { transform: rotate(90deg); }
.func-details > summary:hover { background: var(--bg3); }
.func-details > .form-grid {
  padding: 0 14px 14px;
}
[data-theme="dark"] .func-details > summary {
  color: var(--text2);
}

/* PROGRESS BAR */
.progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.5s ease;
}

/* NOTIFICATION DOT */
.notif-dot {
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  position: absolute;
  top: -2px; right: -2px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .main-panel { margin-left: 0; padding: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .topbar-org { display: none; }
}

/* TAG INPUT */
.tag-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.tag-remove {
  cursor: pointer;
  color: var(--text3);
  font-size: 12px;
  transition: var(--transition);
}
.tag-remove:hover { color: var(--red); }

/* LINE ITEMS */
.line-items { }
.line-item {
  display: grid;
  grid-template-columns: 1fr auto 120px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.line-item-num {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  text-align: right;
  outline: none;
  width: 100%;
  transition: var(--transition);
}
.line-item-num:focus { border-color: var(--accent); }

/* ROLE SELECTOR */
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.role-option {
  padding: 12px;
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.role-option:hover, .role-option.active {
  border-color: var(--accent);
  background: rgba(108,99,255,0.1);
}
.role-option .ri { font-size: 22px; margin-bottom: 6px; }
.role-option p { font-size: 0.75rem; color: var(--text2); }


.money-input-wrap {
  position: relative;
}
.money-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 0.85rem;
  font-family: var(--mono);
}
.money-input-wrap .form-input { padding-left: 36px; }

/* FLOATING FAB */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(108,99,255,0.4);
  transition: var(--transition);
  z-index: 90;
  border: none;
}
.fab:hover { background: #7c75ff; transform: scale(1.1); }

/* MOBILE NAV */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 8px 0;
  z-index: 100;
}
.mobile-nav-items {
  display: flex;
  justify-content: space-around;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 16px;
  cursor: pointer;
  color: var(--text3);
  font-size: 0.65rem;
  transition: var(--transition);
  gap: 4px;
}
.mobile-nav-item .icon { font-size: 20px; }
.mobile-nav-item.active { color: var(--accent2); }

@media (max-width: 768px) {
  .mobile-nav { display: none; } /* removido — usar hamburger */
  /* sidebar controlada pelo hamburger — não esconder aqui */
  .main-panel { margin-left: 0; padding-bottom: 16px; }
}

/* FOLHA PREVIEW (like the PDF) */
.folha-preview {
  background: white;
  color: #111;
  border-radius: var(--radius);
  padding: 32px;
  font-family: 'Times New Roman', serif;
  font-size: 13px;
  max-width: 640px;
  margin: 0 auto;
}
.folha-preview-title {
  text-align: center;
  font-size: 15px;
  font-weight: bold;
  border: 2px solid #111;
  padding: 8px;
  margin-bottom: 12px;
}
.folha-preview table { width: 100%; border-collapse: collapse; }
.folha-preview td { padding: 4px 8px; border: 1px solid #aaa; }
.folha-preview .total-row { background: #f0f0f0; font-weight: bold; }

/* ASSISTENTE DE ESCALA */
.escala-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.escala-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.escala-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.escala-summary-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.escala-summary-card .label {
  font-size: 0.76rem;
  color: var(--text3);
  margin-bottom: 6px;
}

.escala-summary-card .value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent2);
}

.escala-alert {
  border: 1px solid rgba(217, 119, 6, 0.18);
  background: rgba(217, 119, 6, 0.08);
  color: var(--text2);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.escala-alert strong {
  color: var(--accent3);
}

.escala-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 0.76rem;
  margin: 0 6px 6px 0;
}

.escala-preview-sheet {
  background: #fff;
  color: #111827;
  border-radius: 18px;
  padding: 24px;
  border: 1px solid #d1d5db;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.08);
}

.escala-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.escala-preview-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.escala-preview-sub {
  color: #475569;
  margin-top: 4px;
  font-size: 0.88rem;
}

.escala-preview-meta {
  text-align: right;
  font-size: 0.82rem;
  color: #475569;
}

.escala-preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.escala-preview-table th,
.escala-preview-table td {
  border: 1px solid #d1d5db;
  padding: 8px 9px;
  text-align: left;
  font-size: 0.78rem;
}

.escala-preview-table th {
  background: #f8fafc;
  color: #0f172a;
}

.escala-preview-sign {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.escala-preview-sign-line {
  flex: 1;
  min-width: 220px;
  padding-top: 14px;
  border-top: 1px solid #94a3b8;
  color: #475569;
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 768px) {
  .escala-preview-sheet {
    padding: 16px;
  }

  .escala-preview-meta {
    text-align: left;
  }
}

/* MONEY INPUT */
.money-wrap { position:relative; }
.money-wrap::before { content:'R$'; position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--text3); font-size:0.85rem; font-family:var(--mono); pointer-events:none; z-index:1; }
.money-wrap .form-input { padding-left:36px; }
input.money-fmt { text-align:right; font-family:var(--mono); }


/* BOTÕES FLUTUANTES FOLHA */
#floatFolhaButtons {
  position: fixed;
  bottom: 90px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 400;
}
#floatFolhaButtons button {
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 0.78rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  font-family: var(--font);
  white-space: nowrap;
}
#floatFolhaButtons button:hover { opacity: 0.9; }


/* CALCULADORA */
.calc-btn {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
  aspect-ratio: 1; /* quadrados */
  width: 100%;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Sem transition — elimina lag no mobile */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.calc-btn:active { opacity: 0.7; }
.calc-btn.calc-op { background: rgba(27,45,107,0.12); color: var(--navy); }
.calc-btn.calc-minus { background: rgba(239,68,68,0.1); color: var(--red); }
.calc-btn.calc-plus { background: rgba(46,158,79,0.12); color: var(--green); }
.calc-btn.calc-eq { background: var(--accent2); color: white; border-color: var(--accent2); }
.calc-btn.calc-fn { background: var(--bg3); color: var(--text2); font-size: 0.78rem; }

/* Mobile — fonte maior */
@media (max-width: 768px) {
  .calc-btn { font-size: 1.5rem; border-radius: 12px; }
  .calc-btn.calc-fn { font-size: 0.9rem; }
}
.calc-fita-header-left { flex: 1; min-width: 0; }
.calc-unidade-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 8px;
}
.calc-unidade-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  margin: 0;
}
.calc-unidade-select {
  width: auto;
  min-width: 72px;
  max-width: 120px;
  padding: 4px 8px;
  font-size: 0.78rem;
  margin: 0;
}
.calc-unidade-custom {
  flex: 1;
  min-width: 100px;
  max-width: 160px;
  padding: 4px 8px;
  font-size: 0.78rem;
  margin: 0;
  display: none;
}
.calc-unidade-custom[style*="inline"] {
  display: inline-block !important;
}
.calc-linha {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.calc-linha .cl-stack {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.calc-linha .cl-val-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.calc-linha .cl-op {
  flex-shrink: 0;
  font-weight: 700;
  min-width: 1.1em;
  line-height: 1.35;
}
.calc-linha .cl-val-block {
  font-family: var(--mono);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.35;
  text-align: left;
}
.calc-linha .cl-desc-paren {
  font-size: 0.78rem;
  color: var(--text3);
  margin-top: 2px;
  padding-left: 1.6em;
  line-height: 1.35;
  word-wrap: break-word;
  white-space: normal;
  min-height: 0;
}
.calc-linha .cl-desc-paren:empty {
  display: none;
}
.calc-linha .calc-desc-input {
  width: 100%;
  max-width: 100%;
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 0.75rem;
  outline: none;
  padding: 4px 0 2px 1.6em;
  line-height: 1.35;
  text-align: left;
}
.calc-linha .calc-linha-del {
  flex-shrink: 0;
  font-size: 11px;
  opacity: 0.45;
  padding: 2px 4px;
  margin-top: 2px;
}
.calc-linha.cl-eq { background: rgba(46, 158, 79, 0.06); }
.calc-linha.cl-sub { background: rgba(27, 45, 107, 0.06); border-top: 2px solid var(--navy); }
@media print {
  .calc-cupom { font-family: 'Courier New', monospace; font-size: 10px; width: 72mm; }
  .calc-a4 { font-family: Arial, sans-serif; }
}


/* ── SPLASH TAGLINE ────────────────────────── */
.splash-tagline {
  font-size: 0.9rem;
  color: var(--text3, #8892a4);
  margin-top: 8px;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* ── HAMBURGER BUTTON ──────────────────────── */
.hamburger-btn {
  display: none; /* desktop: oculto */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  flex-shrink: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 101; /* acima da topbar */
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--accent2, #2e9e4f); /* cor verde visível em qualquer tema */
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.15s ease;
  pointer-events: none;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ── CALCULADORA LAYOUT ───────────────────────── */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  align-items: start;
}


/* ── SIDEBAR OVERLAY (mobile) ──────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 299;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  /* Hamburger aparece só no mobile */
  .hamburger-btn { display: flex !important; }

  /* Sidebar: oculta por padrão, abre com .open */
  .sidebar {
    transform: translateX(-220px);
    top: 0;
    height: 100dvh;
    width: 80vw;
    max-width: 260px;
    z-index: 400;
    box-shadow: 4px 0 32px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }

  /* Main panel sem margem no mobile */
  .main-panel { margin-left: 0 !important; padding: 16px; }

  /* Calculadora mobile: fita em cima, teclado embaixo */
  .calc-layout { grid-template-columns: 1fr !important; }
  .calc-layout > div:first-child { order: 1; }
  .calc-layout > div:last-child  { order: 2; }

  .page { padding: 12px !important; }
}

/* ── Acerto de contas — cartões estilo caderno / tabela lançamentos ── */
.par-stat-card {
  position: relative;
  border-radius: 12px;
  padding: 14px 16px 14px 18px;
  background: var(--bg2);
  border: 1px solid rgba(27, 45, 107, 0.12);
  box-shadow: 0 1px 3px rgba(27, 45, 107, 0.06);
  overflow: hidden;
}
.par-stat-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 12px 0 0 12px;
}
.par-stat-card--a::before { background: linear-gradient(180deg, #2e9e4f, #1e7a3a); }
.par-stat-card--b::before { background: linear-gradient(180deg, #2e9e4f, #247f41); }
.par-stat-card--diff::before { background: linear-gradient(180deg, #2e9e4f, #1e7a3a); }
.par-stat-card--count::before { background: linear-gradient(180deg, #2e9e4f, #2a8e49); }
.par-stat-card .stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text2);
}
.par-stat-card .stat-sub {
  font-size: 0.8rem;
  margin-top: 8px;
  line-height: 1.4;
  color: var(--text3);
}

.par-lanc-table-wrap {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(27, 45, 107, 0.14);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}
.par-lanc-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.par-lanc-table-wrap thead th {
  background: #2e9e4f;
  color: #fff;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.par-lanc-table-wrap tbody tr:nth-child(even) {
  background: rgba(46, 158, 79, 0.05);
}
.par-lanc-table-wrap tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(46, 158, 79, 0.14);
  vertical-align: middle;
}
.par-lanc-table-wrap tbody tr:last-child td {
  border-bottom: none;
}
.cat-badge-acerto {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Jornada e política + textos legais (Sprint 1) */
.jornada-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.jornada-tab {
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.jornada-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.legal-disclaimer-box {
  background: rgba(46, 158, 79, 0.08);
  border: 1px solid rgba(46, 158, 79, 0.25);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text2);
}
.legal-disclaimer-box a {
  color: var(--accent);
  font-weight: 600;
}
.legal-ref-date {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text3);
}
.legal-details-inline {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg2);
}
.legal-details-inline > summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy);
  list-style: none;
}
.legal-details-inline > summary::-webkit-details-marker { display: none; }
.legal-details-inline[open] > summary { border-bottom: 1px solid var(--border); }
.legal-details-body {
  padding: 10px 12px 12px;
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.45;
}
.legal-details-body a { color: var(--accent); font-weight: 600; }
[data-theme="dark"] .legal-details-inline > summary { color: var(--text2); }

/* Scanner de documentos → PDF */
.doc-scan-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 48px;
}
.doc-scan-thumb {
  position: relative;
  width: 88px;
  height: 118px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg3);
}
.doc-scan-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.doc-scan-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.doc-scan-thumb-num {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}
.doc-scan-thumb-ajustar {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.92);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
  padding: 0;
}
.doc-scan-thumb-edit {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(46, 158, 79, 0.9);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}

/* Câmera fullscreen documento (filho direto de body) */
#modalDocScanCamera.doc-scan-fs {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  margin: 0;
  z-index: 10050;
  background: #000;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}
#modalDocScanCamera.doc-scan-fs.active {
  display: grid;
  pointer-events: auto;
  visibility: visible;
}
.doc-scan-fs-viewport {
  grid-row: 2;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #000;
  z-index: 1;
  pointer-events: none;
}
#modalDocScanCamera.doc-scan-fs video {
  position: relative;
  inset: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  z-index: 0;
}
.doc-scan-fs-guide {
  position: absolute;
  inset: 6%;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  pointer-events: none;
}
.doc-scan-fs-top {
  grid-row: 1;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
  color: #fff;
  font-size: 0.85rem;
  z-index: 3;
  pointer-events: auto;
}
.doc-scan-fs-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
}
.doc-scan-fs-bottom {
  grid-row: 3;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 16px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), transparent);
  z-index: 3;
  pointer-events: auto;
}
.doc-scan-fs-contador {
  margin: 0;
  color: #fff;
  font-size: 0.85rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.doc-scan-fs-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 360px;
}
.doc-scan-fs-btn-concluir {
  min-height: 44px;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
  background: rgba(0, 0, 0, 0.35) !important;
}
.doc-scan-shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #2e9e4f;
  box-shadow: 0 0 0 4px rgba(46, 158, 79, 0.35);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
.doc-scan-fs-close {
  pointer-events: auto;
  touch-action: manipulation;
}
#modalDocScanPreview.modal-overlay:not(.active) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}
body.doc-scan-camera-open {
  overflow: hidden;
}

.doc-scan-preview-modal {
  max-width: 520px;
  width: 96vw;
}
.doc-scan-preview-frame {
  max-height: min(55vh, 420px);
  overflow: auto;
  background: var(--bg3);
  border-radius: 10px;
  text-align: center;
}
.doc-scan-preview-frame img {
  max-width: 100%;
  max-height: min(55vh, 420px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.doc-scan-ampliar-modal {
  max-width: min(520px, 96vw);
  width: 96vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.doc-scan-ampliar-modal .modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 16px;
}
.doc-scan-ampliar-frame {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(50vh, 360px);
  height: min(50vh, 360px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg3);
  border-radius: 10px;
}
.doc-scan-ampliar-frame img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block;
}
.doc-scan-ampliar-acoes {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.doc-scan-ampliar-acoes .btn-primary {
  flex: 1 1 100%;
  min-height: 44px;
  font-weight: 600;
}

.doc-scan-ajuste-modal {
  max-width: min(520px, 96vw);
  width: 96vw;
  max-height: 92vh;
}
.doc-scan-ajuste-modal .modal-body {
  overflow: hidden;
}
.doc-scan-ajuste-wrap {
  position: relative;
  width: 100%;
  height: min(52vh, 380px);
  min-height: 200px;
  overflow: hidden;
  border-radius: 10px;
  background: #1a1a1a;
  touch-action: none;
  user-select: none;
}
.doc-scan-ajuste-wrap img {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
  z-index: 1;
}
.doc-scan-ajuste-overlay {
  position: absolute;
  z-index: 2;
  display: none;
  pointer-events: none;
  touch-action: none;
  box-sizing: border-box;
}
.doc-scan-ajuste-overlay .doc-scan-ajuste-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.doc-scan-ajuste-overlay .doc-scan-ajuste-handle {
  position: absolute;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 50%;
  background: #3b82f6;
  border: 3px solid #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  z-index: 3;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  display: block;
}
.doc-scan-ajuste-overlay .doc-scan-ajuste-handle::after {
  content: '';
  position: absolute;
  inset: -10px;
}
.doc-scan-ajuste-overlay .doc-scan-ajuste-handle:active {
  cursor: grabbing;
  transform: scale(1.12);
  background: #2563eb;
}

/* Sidebar recolher (desktop) */
.sidebar-toolbar { margin-bottom: 8px; padding: 0 4px; }
.sidebar-collapse-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font);
}
.sidebar-collapse-btn:hover { background: var(--bg3); color: var(--text); }
.sidebar-expand-fab {
  display: none;
  position: fixed;
  left: 12px;
  top: 72px;
  z-index: 250;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
@media (min-width: 769px) {
  body.sidebar-collapsed .sidebar { transform: translateX(-100%); pointer-events: none; }
  body.sidebar-collapsed .main-panel { margin-left: 0; }
  body.sidebar-collapsed .sidebar-expand-fab { display: inline-flex; }
}

.calc-fita-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
}
.calc-total-top {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent2);
}
.calc-fita-scroll {
  font-family: var(--mono);
  font-size: 0.85rem;
  min-height: 200px;
  max-height: 42vh;
  overflow-y: auto;
}
.calc-display-wrap {
  background: var(--bg3);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  text-align: right;
}
.calc-display-main {
  font-family: var(--mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
.calc-display-op { font-size: 0.75rem; color: var(--text3); min-height: 16px; }
.calc-keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.calc-linha {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.calc-linha .cl-stack {
  flex: 1;
  min-width: 0;
}
.calc-linha .cl-val-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.calc-linha .cl-op {
  flex-shrink: 0;
  font-weight: 700;
  min-width: 1.1em;
  line-height: 1.35;
  text-align: left;
}
.calc-linha .cl-val-block {
  flex-shrink: 0;
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.35;
  text-align: right;
}
.calc-linha .cl-desc-paren {
  font-size: 0.78rem;
  color: var(--text3);
  margin-top: 2px;
  line-height: 1.35;
  word-wrap: break-word;
  white-space: normal;
  text-align: right;
  min-height: 0;
}
.calc-linha .cl-desc-paren:empty {
  display: none;
}
.calc-linha .calc-desc-input {
  width: 100%;
  max-width: 100%;
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 0.75rem;
  outline: none;
  padding: 4px 0 2px;
  line-height: 1.35;
  text-align: right;
}
.calc-linha .calc-linha-del {
  flex-shrink: 0;
  margin-top: 2px;
}

@media (min-width: 900px) {
  #page-calculadora .calc-layout-page,
  #page-calculadora .calc-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 24vw);
    gap: 24px;
    align-items: stretch;
    min-height: calc(100vh - 168px);
    height: calc(100vh - 168px);
    max-height: calc(100vh - 100px);
  }
  #page-calculadora .calc-fita-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
  }
  #page-calculadora .calc-fita-scroll {
    flex: 1;
    min-height: 0;
    max-height: none;
    font-size: 1.05rem;
    line-height: 1.5;
  }
  #page-calculadora .calc-fita-scroll .calc-linha { padding: 7px 0; font-size: 1.05rem; }
  #page-calculadora .calc-fita-scroll .cl-val-block { font-size: 1.08rem; }
  #page-calculadora .calc-total-top { font-size: 1.6rem; }
  #page-calculadora .calc-display-wrap { padding: 12px 14px; }
  #page-calculadora .calc-display-main {
    font-size: 1.65rem;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
  }
  #page-calculadora .calc-teclado-card {
    max-width: none;
    width: 100%;
    align-self: start;
  }
  #page-calculadora .calc-keypad { gap: 8px; }
  #page-calculadora .calc-keypad .calc-btn {
    font-size: 1.05rem;
    border-radius: 10px;
    max-height: 52px;
    aspect-ratio: 1;
  }
  #page-calculadora .calc-keypad .calc-btn.calc-fn { font-size: 0.72rem; }
  body.cg-try-solo .try-body { max-width: none; width: 100%; }
  #tryPanelCalc .calc-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 24vw);
    gap: 24px;
    align-items: stretch;
    min-height: calc(100vh - 108px);
    height: calc(100vh - 108px);
    max-height: calc(100vh - 80px);
  }
  #tryPanelCalc .calc-fita-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
  }
  #tryPanelCalc .calc-fita-scroll,
  #tryPanelCalc #tbc-calcFita {
    flex: 1;
    min-height: 0;
    max-height: none;
    font-size: 1.05rem;
    line-height: 1.5;
  }
  #tryPanelCalc .calc-fita-scroll .cl-val-block { white-space: nowrap; }
  #tryPanelCalc .calc-teclado-card { max-width: none; width: 100%; align-self: start; }
  #tryPanelCalc .calc-keypad { gap: 8px; }
  #tryPanelCalc .calc-keypad .calc-btn { font-size: 1.05rem; max-height: 52px; aspect-ratio: 1; }
  #tryPanelCalc .calc-display-main,
  #tryPanelCalc #tbc-calcDisplay {
    font-size: 1.65rem;
    white-space: nowrap;
    overflow: hidden;
    max-width: 100%;
  }
}

/* Menu lateral — recolher seções (Funcionários, Financeiro, …) */
.nav-section { margin-bottom: 4px; }
.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  margin: 14px 0 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  border-radius: 8px;
  text-align: left;
}
.nav-section-toggle:hover { background: var(--bg3); color: var(--text2); }
.nav-section-toggle .nav-section-chevron {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 6px;
}
.nav-section.collapsed .nav-section-toggle .nav-section-chevron { transform: rotate(-90deg); }
.nav-section-body {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 800px;
}
.nav-section.collapsed .nav-section-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.sidebar > .nav-section-title:first-of-type {
  margin-top: 0;
}

.try-menu-panel { max-width: 520px; margin: 0 auto; }
.try-menu-sub {
  font-size: 0.88rem;
  color: var(--text3);
  text-align: center;
  margin: 0 0 20px;
  line-height: 1.5;
}
.try-menu-grid { display: flex; flex-direction: column; gap: 12px; }
.try-menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
  font-family: var(--font);
}
.try-menu-card:hover { background: var(--bg2); border-color: var(--accent2); }
.try-menu-icon { font-size: 1.6rem; line-height: 1; }
.try-menu-label { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.try-menu-hint { font-size: 0.78rem; color: var(--text3); }
body.cg-try-solo .try-cta-auth { display: none !important; }
