:root{
  --radius-sm:8px;
  --radius-md:12px;
  --radius-lg:16px;
}

/* ===== Theme: light (default) ===== */
:root, [data-theme="light"]{
  --ink:#201B1A;
  --text:#201B1A;
  --text-soft:#6B6058;
  --bg:#F5F2EE;
  --surface:#FFFFFF;
  --surface-2:#EFE9E3;
  --border:#E2DAD1;
  --border-strong:#C9BDAF;
  --accent-2:#6E1620;
  --safety:#D99A00;
  --safety-soft:#FBF0D6;
  --success:#1E7A4C;
  --success-bg:#E3F3EA;
  --danger:#B23A2E;
  --danger-bg:#F8E7E4;
  --warn:#B5690A;
  --warn-bg:#FBEEDD;
  --info:#2B5C82;
  --info-bg:#E6EEF4;
  --shadow-sm: 0 1px 2px rgba(32,27,26,.06);
  --shadow-md: 0 8px 24px rgba(32,27,26,.10);
  --shadow-lg: 0 16px 48px rgba(32,27,26,.18);
}

/* ===== Theme: dark ===== */
[data-theme="dark"]{
  --ink:#F3EEE9;
  --text:#F3EEE9;
  --text-soft:#A79C90;
  --bg:#17130F;
  --surface:#221C18;
  --surface-2:#2C2521;
  --border:#3C332C;
  --border-strong:#4E4238;
  --accent-2:#8C2130;
  --safety:#E3B03A;
  --safety-soft:#3A2C10;
  --success:#39A578;
  --success-bg:#10281F;
  --danger:#DB6353;
  --danger-bg:#39190F;
  --warn:#D6963E;
  --warn-bg:#382A10;
  --info:#5C9BC7;
  --info-bg:#152530;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 8px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
}

/* ===== Accent color variants ===== */
[data-accent="red"]{ --accent:#A32638; --accent-dark:#7A1B29; --accent-soft:#F7E3E5; }
[data-theme="dark"][data-accent="red"]{ --accent:#D6495B; --accent-dark:#F0768B; --accent-soft:#3A1B1E; }

[data-accent="blue"]{ --accent:#1D5C8A; --accent-dark:#154566; --accent-soft:#E4EEF5; }
[data-theme="dark"][data-accent="blue"]{ --accent:#5AA3D6; --accent-dark:#84C0EA; --accent-soft:#132531; }

[data-accent="green"]{ --accent:#1F6B4A; --accent-dark:#164E37; --accent-soft:#E4F0EA; }
[data-theme="dark"][data-accent="green"]{ --accent:#46B080; --accent-dark:#71CBA0; --accent-soft:#12271E; }

[data-accent="graphite"]{ --accent:#3D3630; --accent-dark:#252019; --accent-soft:#EAE6E1; }
[data-theme="dark"][data-accent="graphite"]{ --accent:#8A8074; --accent-dark:#6E655A; --accent-soft:#2A2621; }

body{ transition:background-color .2s ease, color .2s ease; }
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--bg);
  color:var(--text);
  font-family:'Inter', sans-serif;
  font-size:14.5px;
  line-height:1.55;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,.serif{ font-family:'Barlow Condensed', sans-serif; letter-spacing:-0.01em; }
#app{ min-height:100vh; display:flex; flex-direction:column; }

/* ===== Topbar ===== */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 28px; border-bottom:1px solid var(--border);
  background:var(--surface);
  position:sticky; top:0; z-index:20;
}
.brand{ display:flex; align-items:center; gap:11px; cursor:pointer; }
.brand-mark{
  width:32px;height:32px;border-radius:9px;
  background:linear-gradient(135deg, var(--accent), var(--accent-2));
  position:relative; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
}
.brand-mark::after{
  content:""; width:15px; height:15px; background:#fff;
  clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0% 50%);
}
.brand-mark::before{
  content:""; position:absolute; width:6px; height:6px; border-radius:50%;
  background:var(--accent-dark); z-index:1;
}
.brand-name{ font-family:'Barlow Condensed', sans-serif; font-size:17px; font-weight:800; letter-spacing:-0.02em; color:var(--ink); line-height:1.1; }
.brand-sub{ font-size:11.5px; color:var(--text-soft); margin-top:1px; }
.topbar-right{ display:flex; align-items:center; gap:16px; font-size:13px; color:var(--text-soft); position:relative; }
.link-btn{ background:none; border:none; color:var(--accent); cursor:pointer; font-size:13px; font-weight:600; padding:0; font-family:inherit; transition:color .15s ease; }
.link-btn:hover{ color:var(--accent-dark); }
.role-tag{ font-size:12.5px; padding:5px 6px 5px 12px; border-radius:20px; background:var(--surface-2); color:var(--text); font-weight:500; display:inline-flex; align-items:center; gap:8px; white-space:nowrap; }

main{ flex:1; width:100%; min-width:0; }
.wrap{ max-width:1120px; margin:0 auto; padding:40px 28px 84px; }
.wrap-narrow{ max-width:600px; margin:0 auto; padding:56px 24px 84px; }

/* ===== Buttons ===== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  padding:10px 18px; border-radius:var(--radius-sm); border:1px solid transparent;
  font-size:13.5px; font-weight:600; cursor:pointer; font-family:'Inter',sans-serif;
  transition:background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
  white-space:nowrap;
}
.btn:active{ transform: translateY(1px); }
.btn-primary{ background:var(--accent); color:#fff; }
.btn-primary:hover{ background:var(--accent-dark); }
.btn-outline{ background:var(--surface); border-color:var(--border-strong); color:var(--text); }
.btn-outline:hover{ border-color:var(--accent); color:var(--accent); }
.btn-danger{ background:transparent; border-color:transparent; color:var(--danger); }
.btn-danger:hover{ background:var(--danger-bg); }
.btn-success{ background:transparent; border-color:transparent; color:var(--success); }
.btn-success:hover{ background:var(--success-bg); }
.btn-sm{ padding:7px 13px; font-size:12.5px; border-radius:7px; }
.btn-block{ width:100%; }
.btn:disabled{ opacity:.45; cursor:not-allowed; }

/* ===== Role select / home ===== */
.role-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:32px; }
@media (max-width:640px){ .role-grid{ grid-template-columns:1fr; } }
.role-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:26px; cursor:pointer; text-align:left; font:inherit;
  transition:border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.role-card:hover{ border-color:var(--accent); box-shadow:var(--shadow-md); transform:translateY(-2px); }
.role-card h3{ margin:14px 0 5px; font-size:19px; font-weight:700; color:var(--ink); }
.role-card p{ margin:0; color:var(--text-soft); font-size:13.5px; }
.role-icon{ width:40px;height:40px;border-radius:10px; display:flex; align-items:center; justify-content:center; background:var(--accent-soft); color:var(--accent); }

h1.hero{ font-size:34px; font-weight:800; margin:0 0 10px; color:var(--ink); max-width:640px; line-height:1.15; }
p.hero{ color:var(--text-soft); font-size:15px; max-width:580px; }

/* ===== Forms ===== */
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:12.5px; font-weight:600; color:var(--ink); margin-bottom:6px; }
.field .hint{ font-size:12px; color:var(--text-soft); margin-top:5px; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=number], input[type=password], textarea, select{
  width:100%; padding:10px 12px; border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  font-size:14px; font-family:inherit; background:var(--surface); color:var(--text);
  transition:border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus, button:focus-visible{
  outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft);
}
.field-row{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width:560px){ .field-row{ grid-template-columns:1fr; } }
.form-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:32px; box-shadow:var(--shadow-sm); }
.form-title{ font-family:'Barlow Condensed',sans-serif; font-size:21px; font-weight:800; margin:0 0 4px; color:var(--ink); }
.form-desc{ color:var(--text-soft); font-size:13.5px; margin:0 0 24px; }
.error-msg{ background:var(--danger-bg); color:var(--danger); padding:10px 13px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:16px; font-weight:500; }
.success-msg{ background:var(--success-bg); color:var(--success); padding:10px 13px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:16px; font-weight:500; }

/* ===== Steps ===== */
.steps{ display:flex; gap:0; margin-bottom:28px; }
.step{ flex:1; text-align:center; padding-bottom:10px; border-bottom:2px solid var(--border); color:var(--text-soft); font-size:12.5px; font-weight:600; }
.step.active{ border-color:var(--accent); color:var(--accent); }
.step.done{ border-color:var(--success); color:var(--success); }

/* ===== Document category sections ===== */
.folder-section{ margin-bottom:16px; border:1px solid var(--border); border-radius:var(--radius-md); overflow:hidden; background:var(--surface); }
.folder-tab{
  display:flex; align-items:center; gap:8px;
  background:var(--surface); color:var(--ink); padding:13px 18px;
  font-size:14px; font-weight:700; border-left:4px solid var(--accent);
}
.folder-tab .req-star{ color:var(--safety); font-size:12px; }
.folder-body{ padding:16px 18px; border-top:1px solid var(--border); }
.upload-row{ display:flex; gap:9px; flex-wrap:wrap; margin-bottom:14px; }
.doc-list{ display:flex; flex-direction:column; gap:8px; }
.doc-item{ display:flex; align-items:center; gap:12px; padding:10px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--bg); flex-wrap:wrap; }
.doc-thumb{ width:40px; height:40px; border-radius:8px; object-fit:cover; flex-shrink:0; border:1px solid var(--border); background:var(--surface); }
.doc-thumb-pdf{ width:40px; height:40px; border-radius:8px; flex-shrink:0; border:1px solid var(--border); background:var(--danger-bg); display:flex; align-items:center; justify-content:center; font-family:'Barlow Condensed',sans-serif; font-size:9px; color:var(--danger); font-weight:800; }
.doc-meta{ flex:1; min-width:120px; }
.doc-name{ font-size:13px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.doc-sub{ font-size:11.5px; color:var(--text-soft); }
.badge{ display:inline-flex; align-items:center; padding:4px 10px; border-radius:20px; font-size:11px; font-weight:700; white-space:nowrap; }
.badge-pendente,.badge-uploaded{ background:var(--warn-bg); color:var(--warn); }
.badge-aprovado,.badge-approved{ background:var(--success-bg); color:var(--success); }
.badge-recusado,.badge-rejected{ background:var(--danger-bg); color:var(--danger); }
.badge-correcao,.badge-correction_required{ background:var(--warn-bg); color:var(--warn); }
.badge-under_review{ background:var(--info-bg); color:var(--info); }
.badge-open,.badge-waiting_client{ background:var(--warn-bg); color:var(--warn); }
.badge-submitted,.badge-under_review2{ background:var(--info-bg); color:var(--info); }
.badge-completed{ background:var(--success-bg); color:var(--success); }
.badge-cancelled{ background:var(--surface-2); color:var(--text-soft); }
.badge-overdue{ background:var(--danger-bg); color:var(--danger); }
.badge-low{ background:var(--surface-2); color:var(--text-soft); }
.badge-medium{ background:var(--info-bg); color:var(--info); }
.badge-high{ background:var(--warn-bg); color:var(--warn); }
.badge-urgent{ background:var(--danger-bg); color:var(--danger); }
.doc-note{ font-size:12px; color:var(--danger); margin-top:3px; }

/* ===== Admin layout ===== */
.admin-shell{ display:flex; min-height:calc(100vh - 61px); }
.admin-side{ width:230px; flex-shrink:0; border-right:1px solid var(--border); background:var(--surface); padding:20px 14px; display:flex; flex-direction:column; gap:4px; }
.admin-main{ flex:1; padding:30px 34px; min-width:0; }
.nav-item{ display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:var(--radius-sm); cursor:pointer; font-size:13.5px; font-weight:500; color:var(--text); transition:background .15s ease, color .15s ease; }
.nav-item:hover{ background:var(--surface-2); }
.nav-item.active{ background:var(--accent-soft); color:var(--accent-dark); font-weight:700; }
.nav-section-label{ font-size:11px; color:var(--text-soft); font-weight:600; margin:16px 0 4px 12px; }
.nav-disabled{ opacity:.4; cursor:not-allowed; }

.search-box{ position:relative; margin-bottom:6px; }
.search-box input{ padding-left:34px; }
.search-icon{ position:absolute; left:11px; top:50%; transform:translateY(-50%); color:var(--text-soft); }
.client-list{ display:flex; flex-direction:column; gap:2px; overflow-y:auto; }
.client-row{ display:flex; flex-direction:column; padding:10px 12px; border-radius:var(--radius-sm); cursor:pointer; border:1px solid transparent; }
.client-row:hover{ background:var(--surface-2); }
.client-row.active{ background:var(--accent-soft); border-color:var(--accent); }
.client-row-name{ font-size:13px; font-weight:600; color:var(--ink); }
.client-row-cpf{ font-size:11.5px; color:var(--text-soft); font-variant-numeric:tabular-nums; }
.empty-state{ text-align:center; padding:56px 20px; color:var(--text-soft); }

table.info-table{ width:100%; border-collapse:collapse; margin-bottom:8px; }
table.info-table td{ padding:9px 0; font-size:13.5px; border-bottom:1px solid var(--border); vertical-align:top; }
table.info-table td.k{ color:var(--text-soft); width:180px; font-size:12px; font-weight:500; }
.panel{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:22px; margin-bottom:18px; }
.panel-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:10px; flex-wrap:wrap; }
.panel-head h3{ margin:0; font-size:16px; font-weight:700; color:var(--ink); }

.kpi-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; margin-bottom:24px; }
.kpi-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:18px 20px; }
.kpi-value{ font-family:'Barlow Condensed',sans-serif; font-size:30px; font-weight:800; color:var(--ink); line-height:1; letter-spacing:-0.02em; }
.kpi-label{ font-size:12px; color:var(--text-soft); margin-top:7px; font-weight:500; }

.tabs{ display:flex; gap:4px; border-bottom:1px solid var(--border); margin-bottom:22px; flex-wrap:wrap; }
.tab-btn{ background:none; border:none; padding:10px 15px; font-size:13px; font-weight:600; font-family:inherit; color:var(--text-soft); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; transition:color .15s ease; }
.tab-btn:hover{ color:var(--ink); }
.tab-btn.active{ color:var(--accent); border-color:var(--accent); }

.request-card{ border:1px solid var(--border); border-radius:var(--radius-md); padding:15px 17px; background:var(--surface); margin-bottom:10px; }
.request-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:10px; margin-bottom:6px; }
.request-title{ font-size:14px; font-weight:700; color:var(--ink); }
.request-desc{ font-size:13px; color:var(--text-soft); margin-bottom:8px; }
.request-meta{ display:flex; gap:14px; font-size:11.5px; color:var(--text-soft); flex-wrap:wrap; }
.request-actions{ margin-top:10px; display:flex; gap:8px; flex-wrap:wrap; }

.comment-thread{ display:flex; flex-direction:column; gap:10px; max-height:360px; overflow-y:auto; padding:4px 2px 12px; margin-bottom:12px; }
.comment-bubble{ max-width:78%; padding:9px 13px; border-radius:14px; font-size:13.5px; line-height:1.45; }
.comment-bubble .comment-meta{ font-size:10.5px; opacity:.7; margin-bottom:3px; font-weight:600; }
.comment-client{ align-self:flex-start; background:var(--surface-2); color:var(--text); border-bottom-left-radius:4px; }
.comment-admin{ align-self:flex-end; background:var(--accent); color:#fff; border-bottom-right-radius:4px; }
.comment-admin .comment-meta{ opacity:.85; }
.comment-composer{ display:flex; gap:8px; align-items:flex-end; }
.comment-composer textarea{ flex:1; resize:none; }

.bar-chart{ display:flex; flex-direction:column; gap:10px; }
.bar-row{ display:grid; grid-template-columns:150px 1fr 46px; align-items:center; gap:10px; font-size:12.5px; }
.bar-track{ background:var(--surface-2); border-radius:20px; height:14px; overflow:hidden; }
.bar-fill{ height:100%; border-radius:20px; transition:width .3s ease; }
.report-filters{ display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; margin-bottom:20px; }
.report-filters .field{ margin-bottom:0; min-width:150px; }

.activity-item{ display:flex; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); font-size:12.5px; }
.activity-item:last-child{ border-bottom:none; }
.activity-dot{ width:6px; height:6px; border-radius:50%; background:var(--accent); margin-top:6px; flex-shrink:0; }
.activity-text{ flex:1; color:var(--text); }
.activity-time{ color:var(--text-soft); font-size:11px; margin-top:2px; }

.notif-panel{ position:absolute; top:40px; right:0; width:340px; max-height:420px; overflow-y:auto; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); z-index:90; }
.notif-item{ padding:13px 15px; border-bottom:1px solid var(--border); font-size:12.5px; cursor:pointer; transition:background .1s ease; }
.notif-item:hover{ background:var(--surface-2); }
.notif-item.unread{ background:var(--accent-soft); }
.notif-title{ font-weight:700; margin-bottom:2px; color:var(--ink); }
.notif-meta{ color:var(--text-soft); font-size:11px; margin-top:3px; }
.bell-btn{ position:relative; background:none; border:none; cursor:pointer; color:var(--text); padding:6px; border-radius:8px; transition:background .15s ease; }
.bell-btn:hover{ background:var(--surface-2); }
.bell-dot{ position:absolute; top:3px; right:3px; width:8px; height:8px; border-radius:50%; background:var(--danger); border:1.5px solid var(--surface); }

.gear-btn{ background:none; border:none; cursor:pointer; color:var(--text); padding:6px; border-radius:8px; transition:background .15s ease, transform .2s ease; display:flex; }
.gear-btn:hover{ background:var(--surface-2); transform:rotate(25deg); }

.settings-section{ margin-bottom:22px; }
.settings-section:last-child{ margin-bottom:0; }
.settings-section-title{ font-size:12.5px; font-weight:700; color:var(--ink); margin-bottom:10px; }
.theme-options{ display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.theme-option{
  border:1.5px solid var(--border); border-radius:var(--radius-md); background:var(--surface);
  padding:12px 8px; text-align:center; cursor:pointer; font-size:12px; font-weight:600; color:var(--text-soft);
  transition:border-color .15s ease, color .15s ease;
}
.theme-option:hover{ border-color:var(--border-strong); }
.theme-option.active{ border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
.theme-option svg{ display:block; margin:0 auto 6px; }
.accent-swatches{ display:flex; gap:10px; }
.accent-swatch{
  width:36px; height:36px; border-radius:50%; cursor:pointer; border:2px solid transparent;
  display:flex; align-items:center; justify-content:center; transition:transform .1s ease, border-color .15s ease;
  padding:0;
}
.accent-swatch:hover{ transform:scale(1.08); }
.accent-swatch.active{ border-color:var(--ink); }
.accent-swatch-dot{ width:22px; height:22px; border-radius:50%; }
.settings-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.settings-row-label{ font-size:13.5px; font-weight:500; color:var(--text); }
.settings-row-hint{ font-size:12px; color:var(--text-soft); margin-top:2px; }

.progress-bar{ height:8px; background:var(--surface-2); border-radius:20px; overflow:hidden; }
.progress-fill{ height:100%; background:var(--accent); border-radius:20px; transition:width .3s ease; }
.checklist-item{ display:flex; align-items:center; gap:8px; padding:6px 0; font-size:13px; color:var(--text); }
.check-yes{ color:var(--success); font-weight:700; } .check-no{ color:var(--border-strong); }

.cat-row, .field-row-admin{ display:flex; align-items:center; gap:10px; padding:12px 14px; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--surface); margin-bottom:8px; flex-wrap:wrap; }
.cat-row .grow, .field-row-admin .grow{ flex:1; min-width:140px; }
.toggle{ position:relative; display:inline-block; width:36px; height:20px; flex-shrink:0; }
.toggle input{ opacity:0; width:0; height:0; }
.toggle-slider{ position:absolute; cursor:pointer; inset:0; background:var(--border-strong); border-radius:20px; transition:.15s; }
.toggle-slider::before{ content:""; position:absolute; height:14px; width:14px; left:3px; top:3px; background:var(--surface); border-radius:50%; transition:.15s; box-shadow:0 1px 2px rgba(0,0,0,.15); }
.toggle input:checked + .toggle-slider{ background:var(--accent); }
.toggle input:checked + .toggle-slider::before{ transform:translateX(16px); }

.role-badge{ font-size:10.5px; padding:3px 9px; border-radius:20px; font-weight:700; white-space:nowrap; display:inline-block; flex-shrink:0; }
.role-SUPER_ADMIN{ background:var(--ink); color:#fff; }
.role-ADMIN{ background:var(--info-bg); color:var(--info); }
.role-VIEWER{ background:var(--surface-2); color:var(--text-soft); }
.status-dot{ width:8px;height:8px;border-radius:50%; display:inline-block; margin-right:6px; }
.status-active{ background:var(--success); } .status-inactive{ background:var(--text-soft); }

.modal-overlay{ position:fixed; inset:0; background:rgba(32,27,26,.55); backdrop-filter:blur(2px); display:flex; align-items:center; justify-content:center; z-index:100; padding:20px; }
.modal-box{ background:var(--surface); border-radius:var(--radius-lg); max-width:560px; width:100%; max-height:88vh; overflow-y:auto; padding:26px; box-shadow:var(--shadow-lg); }
.modal-box.wide{ max-width:760px; }
.modal-title{ font-family:'Barlow Condensed',sans-serif; font-size:18px; font-weight:800; margin:0 0 16px; color:var(--ink); }
.modal-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:20px; }
.doc-preview img{ width:100%; border-radius:var(--radius-md); border:1px solid var(--border); transition:transform .15s ease; }
.doc-preview embed{ width:100%; height:60vh; border-radius:var(--radius-md); border:1px solid var(--border); }
.preview-controls{ display:flex; gap:8px; margin-bottom:10px; }
.preview-wrap{ overflow:auto; max-height:60vh; text-align:center; background:var(--surface-2); border-radius:var(--radius-md); }

video#camera-video{ width:100%; border-radius:var(--radius-md); background:#000; }
canvas#camera-canvas{ display:none; }

.toast{ position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--ink); color:#fff; padding:11px 20px; border-radius:10px; font-size:13px; font-weight:500; z-index:200; box-shadow:var(--shadow-lg); }
.divider-label{ font-size:11.5px; color:var(--text-soft); font-weight:600; margin:20px 0 8px; }
.disclaimer{ background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-md); padding:13px 15px; font-size:12.5px; color:var(--text-soft); margin-top:24px; }
::placeholder{ color:#A69A8E; }
.spinner{ width:15px; height:15px; border:2px solid var(--border); border-top-color:var(--accent); border-radius:50%; animation:spin .7s linear infinite; display:inline-block; }
@keyframes spin{ to{ transform:rotate(360deg); } }
code{ background:var(--surface-2); padding:2px 6px; border-radius:5px; font-family:'Barlow Condensed',sans-serif; font-size:12px; font-weight:600; }

/* =========================================================================
   RESPONSIVIDADE — ajustes para telas de celular/tablet
   Adicionado para eliminar rolagem horizontal e conteúdo cortado no celular.
========================================================================= */

/* Proteção global: nada deve empurrar a página para os lados */
html, body { max-width:100%; overflow-x:hidden; }
*, *::before, *::after { box-sizing:border-box; }
img, svg, video, canvas, embed, iframe { max-width:100%; height:auto; }

/* Tablets e celulares maiores */
@media (max-width:900px){
  /* A barra lateral do admin deixa de ficar "ao lado" e vira uma faixa em cima,
     com os itens de menu em rolagem horizontal apenas dentro dela. */
  .admin-shell{ flex-direction:column; }
  .admin-side{
    width:100%; flex-shrink:0; border-right:none; border-bottom:1px solid var(--border);
    flex-direction:row; overflow-x:auto; gap:6px; padding:10px 12px; -webkit-overflow-scrolling:touch;
  }
  .admin-side a, .admin-side button, .admin-side .nav-item{ white-space:nowrap; flex-shrink:0; }
  .admin-side .nav-section-label{ display:none; }
  .admin-main{ padding:20px 16px; }
}

/* Celulares */
@media (max-width:600px){
  /* Menos padding lateral para aproveitar a largura */
  .wrap{ padding:24px 16px 72px; }
  .wrap-narrow{ padding:32px 16px 72px; }

  /* Topbar mais compacto e que pode quebrar em duas linhas sem cortar nada */
  .topbar{ padding:10px 14px; flex-wrap:wrap; gap:8px; }
  .topbar-right{ gap:10px; flex-wrap:wrap; }
  .brand-sub{ display:none; } /* esconde o subtítulo longo, mantém só "SGCD" */

  /* Painel de notificações nunca mais largo que a tela */
  .notif-panel{ width:calc(100vw - 24px); right:-8px; max-width:340px; }

  /* Tabelas ganham rolagem própria em vez de estourar a página inteira */
  table.info-table{ display:block; overflow-x:auto; -webkit-overflow-scrolling:touch; white-space:nowrap; }
  table.info-table td.k{ width:auto; min-width:110px; }

  /* Cabeçalhos de painel (título + botão) empilham em vez de espremer */
  .panel-head{ flex-wrap:wrap; gap:10px; }

  /* Reduz um pouco o tamanho do título grande da home no celular */
  h1.hero{ font-size:27px; }

  /* Modais ocupam quase toda a largura, com margem de respiro */
  .modal-box, .modal-box.wide{ max-width:100%; padding:20px 16px; }

  /* Filtros de relatório empilham */
  .report-filters{ flex-direction:column; align-items:stretch; }
  .report-filters .field{ min-width:0; width:100%; }

  /* Gráfico de barras: rótulo menor pra caber */
  .bar-row{ grid-template-columns:96px 1fr 38px; gap:8px; font-size:11.5px; }
}

/* =========================================================================
   IMPRESSÃO — ao imprimir/salvar como PDF, mostra só o conteúdo principal
   (esconde a barra lateral, o topo e os botões, deixando o relatório limpo).
========================================================================= */
@media print {
  .topbar, .admin-side, .report-filters, .panel-head button,
  .panel-head > div, button, .btn { display:none !important; }
  .admin-shell{ display:block !important; }
  .admin-main{ padding:0 !important; }
  body, html{ background:#fff !important; }
  .panel{ box-shadow:none !important; border:1px solid #ddd !important; break-inside:avoid; }
  .kpi-card{ break-inside:avoid; }
}
