:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8f0;
  --border-2: #cfd7e3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --ok: #059669; --ok-50: #ecfdf5; --ok-100: #d1fae5;
  --warn: #b45309; --warn-50: #fffbeb; --warn-100: #fef3c7;
  --danger: #dc2626; --danger-50: #fef2f2; --danger-100: #fee2e2;
  --violet: #7c3aed; --violet-50: #f5f3ff;
  --sidebar: #0b1220; --sidebar-2: #141d31; --sidebar-text: #94a3b8;
  --radius: 16px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 24px -12px rgba(15, 23, 42, .14);
  --shadow-lg: 0 30px 80px -20px rgba(15, 23, 42, .4);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, select, textarea { font: inherit; color: inherit; }
.ic { width: 18px; height: 18px; flex: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; }

/* ---------- botões & campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 14px; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s, box-shadow .15s, opacity .15s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-100); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--primary-600); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-danger-ghost { color: var(--danger); background: var(--surface); border-color: var(--border); }
.btn-danger-ghost:hover { background: var(--danger-50); border-color: var(--danger-100); }
.btn-lg { height: 48px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--muted); border: 1px solid transparent; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.ok:hover { color: var(--ok); background: var(--ok-50); border-color: var(--ok-100); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-50); border-color: var(--danger-100); }

.field { display: grid; gap: 6px; align-content: start; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field > span em { color: var(--danger); font-style: normal; }
.field small { color: var(--muted); font-size: 12px; }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check strong { display: block; font-size: 13px; }
.check small { color: var(--muted); font-size: 12px; }

.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: #e9edf4; gap: 2px; flex-wrap: wrap; }
.segmented button { height: 32px; padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .count { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(100, 116, 139, .14); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .ic { width: 13px; height: 13px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.b-ok { background: var(--ok-50); color: var(--ok); }
.b-warn { background: var(--warn-50); color: var(--warn); }
.b-danger { background: var(--danger-50); color: var(--danger); }
.b-blue { background: var(--primary-50); color: var(--primary); }
.b-violet { background: var(--violet-50); color: var(--violet); }
.b-gray { background: #f1f5f9; color: var(--muted); }

/* ---------- avatar ---------- */
.avatar { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: none; background: #e2e8f0; }
.avatar-fallback { display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #475569; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); }
.avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }
.avatar.md { width: 46px; height: 46px; border-radius: 12px; }
.avatar.lg { width: 72px; height: 72px; border-radius: 18px; font-size: 22px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 600px at 20% 0%, #1e3a8a 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, #0f766e 0%, transparent 55%), var(--sidebar); }
.login-card { width: min(400px, 100%); background: var(--surface); border-radius: 22px; padding: 36px 32px 30px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; text-align: center; }
.login-logo { width: 60px; height: 60px; margin: 0 auto 4px; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; box-shadow: 0 12px 30px -10px rgba(37, 99, 235, .6); }
.login-logo .ic { width: 30px; height: 30px; }
.login-card h1 { font-size: 22px; }
.login-card p { margin: -10px 0 6px; color: var(--muted); }
.login-card .field { text-align: left; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: -6px 0 -4px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 20px 14px; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; flex: none; box-shadow: 0 8px 20px -8px rgba(59, 130, 246, .7); }
.brand-logo .ic { width: 22px; height: 22px; }
.brand-text { min-width: 0; }
.brand-text strong { display: block; color: #fff; font-size: 15px; }
.brand-text span { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: grid; gap: 4px; }
.nav a, .nav-link { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px; font-weight: 500; color: var(--sidebar-text); transition: background .15s, color .15s; width: 100%; text-align: left; }
.nav a:hover, .nav-link:hover { background: rgba(255, 255, 255, .05); color: #e2e8f0; }
.nav a.active { background: var(--sidebar-2); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
.nav a.active .ic { color: #60a5fa; }
.nav-badge { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; background: #f59e0b; color: #1c1917; }
.sidebar-foot { margin-top: auto; display: grid; gap: 4px; }
.side-clock { margin-top: 10px; padding: 14px 12px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-clock strong { display: block; color: #fff; font-size: 22px; font-variant-numeric: tabular-nums; }
.side-clock span { font-size: 12px; text-transform: capitalize; }

.main { min-width: 0; padding: 26px 32px 40px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page { display: grid; gap: 20px; animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.link { color: var(--primary); font-weight: 600; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; gap: 14px; align-items: center; padding: 18px; }
.kpi-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.kpi-icon .ic { width: 22px; height: 22px; }
.kpi-icon.blue { background: var(--primary-50); color: var(--primary); }
.kpi-icon.amber { background: var(--warn-50); color: #d97706; }
.kpi-icon.green { background: var(--ok-50); color: var(--ok); }
.kpi-icon.red { background: var(--danger-50); color: var(--danger); }
.kpi-label { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-sub { display: block; font-size: 12px; color: var(--muted); }

.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* feed */
.live-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ok); background: var(--ok-50); padding: 5px 10px; border-radius: 999px; }
.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.feed { max-height: 620px; overflow: auto; }
.feed-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: var(--surface-2); }
.feed-item.is-alert { background: linear-gradient(90deg, var(--danger-50), transparent 70%); box-shadow: inset 3px 0 0 var(--danger); }
.feed-item.is-new { animation: flash 2.2s ease; }
@keyframes flash { 0%, 30% { background: var(--primary-50); } }
.fi-main { flex: 1; min-width: 0; }
.fi-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fi-title strong { font-size: 14px; }
.fi-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.fi-side { text-align: right; flex: none; }
.fi-value { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.fi-time { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

.pend-list { max-height: 620px; overflow: auto; }
.pend-item { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.pend-item:last-child { border-bottom: 0; }
.pend-unit { width: 52px; height: 46px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.05; flex: none; padding: 2px; overflow: hidden; }
.pend-unit small { display: block; font-size: 9px; color: var(--faint); font-weight: 600; letter-spacing: .06em; }
.pend-main { flex: 1; min-width: 0; }
.pend-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pend-main span { color: var(--muted); font-size: 12px; }
.pend-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.pend-actions { display: flex; gap: 2px; }

.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; color: var(--faint); margin-bottom: 10px; }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* toolbar */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 38px; }
.toolbar .input[type=date] { width: auto; }
.toolbar .select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; }

/* tabela */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.clickable { cursor: pointer; }
.cell-person { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cell-person strong { display: block; }
.cell-person span { color: var(--muted); font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.table-foot strong { color: var(--text); }

/* pessoas */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.person-card { text-align: left; display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.person-card:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: 0 14px 34px -16px rgba(15, 23, 42, .25); }
.pc-photo { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); overflow: hidden; }
.pc-photo img { width: 100%; height: 100%; object-fit: cover; }
.pc-photo .pc-initials { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; font-weight: 700; color: #64748b; }
.pc-photo .badge { position: absolute; top: 10px; right: 10px; box-shadow: var(--shadow-sm); }
.pc-body { padding: 14px 16px 16px; display: grid; gap: 6px; }
.pc-body strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-company { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.pc-foot { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--border); }

/* modal / drawer */
.backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); z-index: 40; display: grid; place-items: center; padding: 20px; animation: fadein .2s ease both; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 40px); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .22s cubic-bezier(.2, 1.1, .4, 1) both; }
.modal.lg { width: min(1040px, 100%); }
.modal.sm { width: min(440px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 18px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 22px 24px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 20px 20px; }
.modal-foot .left { margin-right: auto; }
.modal-text { margin: 0; color: var(--text-2); line-height: 1.55; }

.backdrop.drawer-bd { place-items: stretch end; padding: 0; }
.drawer { width: min(560px, 100vw); height: 100dvh; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .26s cubic-bezier(.2, 1, .3, 1) both; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; gap: 16px; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 19px; }
.drawer-head .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.drawer-body { flex: 1; overflow: auto; padding: 22px 24px; display: grid; gap: 24px; align-content: start; }
.drawer-foot { display: flex; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer-foot .grow { flex: 1; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat strong { font-size: 15px; }

.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.alert .ic { margin-top: 1px; }
.alert strong { display: block; }
.alert.danger { background: var(--danger-50); color: #991b1b; border: 1px solid var(--danger-100); }
.alert.warn { background: var(--warn-50); color: #92400e; border: 1px solid var(--warn-100); }
.alert.info { background: var(--primary-50); color: #1e40af; border: 1px solid var(--primary-100); }

.photo-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.photo-tile { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: #e2e8f0; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .rm { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(15, 23, 42, .65); color: #fff; opacity: 0; transition: opacity .15s; }
.photo-tile:hover .rm, .photo-tile .rm:focus { opacity: 1; }
.photo-tile .rm .ic { width: 14px; height: 14px; }
.photo-tile .tag { position: absolute; left: 6px; bottom: 6px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: rgba(15, 23, 42, .65); color: #fff; }
.photo-add { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--border-2); display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.photo-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }

.mini-list { display: grid; }
.mini-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-item:last-child { border-bottom: 0; }
.mini-item .grow { flex: 1; min-width: 0; }
.mini-item span { color: var(--muted); }

/* captura */
.capture-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; }
.capture { display: grid; gap: 12px; align-content: start; }
.capture-stage { position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: #0b1220; }
.capture-stage video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.capture-guide { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.capture-guide::after { content: ""; height: 76%; aspect-ratio: 3 / 4; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .55); box-shadow: 0 0 0 9999px rgba(11, 18, 32, .3); }
.capture-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.capture-flash.go { animation: flashw .35s ease; }
@keyframes flashw { 0% { opacity: .85; } 100% { opacity: 0; } }
.capture-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #cbd5e1; padding: 24px; font-size: 13px; }
.capture-actions { display: flex; gap: 10px; }
.capture-actions .btn-primary { flex: 1; }
.capture-hint { font-size: 12px; color: var(--muted); }
.thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1.5px dashed var(--border-2); display: grid; place-items: center; color: var(--faint); font-size: 12px; font-weight: 600; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.filled { border: 0; }
.thumb.warn { box-shadow: inset 0 0 0 2px #f59e0b; }
.thumb .rm { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: rgba(15, 23, 42, .7); color: #fff; }
.thumb .rm .ic { width: 12px; height: 12px; }

.lightbox { max-width: min(560px, 92vw); max-height: 86vh; border-radius: 16px; box-shadow: var(--shadow-lg); }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 60; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 13px 16px; border-radius: 12px; background: #0f172a; color: #e2e8f0; font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: .25s; }
.toast.show { opacity: 1; transform: none; }
.toast-ok .ic { color: #34d399; } .toast-warn .ic { color: #fbbf24; } .toast-danger .ic { color: #f87171; } .toast-info .ic { color: #60a5fa; }

.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef2f7, #f8fafc, #eef2f7); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- responsivo ---------- */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .app { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar { padding: 18px 12px; align-items: center; }
  .brand-text, .nav .lbl, .sidebar-foot .lbl, .side-clock span { display: none; }
  .brand { padding: 0; }
  .nav a, .nav-link { justify-content: center; padding: 0; width: 46px; }
  .nav-badge { position: absolute; margin: -22px -26px 0 0; min-width: 18px; height: 18px; padding: 0 5px; }
  .nav a { position: relative; }
  .side-clock { padding: 12px 0 0; text-align: center; }
  .side-clock strong { font-size: 15px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) { .capture-layout { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); z-index: 30; justify-content: space-around; }
  .brand, .side-clock, .sidebar-foot a { display: none; }
  .nav { display: flex; gap: 6px; }
  .sidebar-foot { margin: 0; }
  .main { padding: 18px 16px 96px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; gap: 10px; }
  .kpi-icon { width: 38px; height: 38px; }
  .kpi-value { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .toasts { left: 16px; right: 16px; bottom: 96px; }

  /* barra de navegação inferior com rótulos */
  .sidebar { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 0; }
  .nav { flex: 4; justify-content: space-around; gap: 0; }
  .sidebar-foot { flex: 1; display: flex; justify-content: center; }
  .nav a, .nav-link { flex-direction: column; justify-content: center; gap: 3px; width: auto; min-width: 58px; height: 54px; padding: 0 6px; }
  .nav .lbl, .sidebar-foot .lbl { display: block; font-size: 10.5px; font-weight: 600; line-height: 1; }
  .sidebar-foot a .lbl { display: none; }
  .nav a.active { box-shadow: inset 0 3px 0 var(--primary); background: var(--sidebar-2); }
  .nav-badge { margin: -30px -30px 0 0; }

  /* cabeçalho e ações */
  .topbar { margin-bottom: 16px; }
  .topbar h1 { font-size: 21px; }
  .top-actions { width: 100%; }
  .top-actions .btn { flex: 1; justify-content: center; }

  /* monitor */
  .card-head { padding: 14px 16px; }
  .live-pill { white-space: nowrap; flex: none; }
  .feed-item { padding: 12px 16px; gap: 12px; align-items: flex-start; }
  .fi-sub { white-space: normal; }
  .pend-item { padding: 12px 14px; flex-wrap: wrap; }

  /* cobranças: 3 indicadores compactos lado a lado */
  .kpis.kpis-3 { gap: 8px; }
  .kpis-3 .kpi { padding: 10px 12px; }
  .kpis-3 .kpi-icon { display: none; }
  .kpis-3 .kpi-label { font-size: 11px; line-height: 1.25; }
  .kpis-3 .kpi-value { font-size: 15px; }

  /* filtros */
  .toolbar { gap: 8px; }
  .page > * { min-width: 0; }
  .toolbar .segmented { flex-wrap: nowrap; overflow-x: auto; flex: 1 1 100%; min-width: 0; scrollbar-width: none; }
  .toolbar .segmented button { flex: none; height: 36px; }
  .toolbar .input[type=date], .toolbar .select { flex: 1 1 140px; width: auto; min-width: 0; }

  /* formulários: tipo em 3 colunas iguais */
  .modal .segmented, .drawer .segmented { display: grid; grid-template-columns: repeat(3, 1fr); }
  .modal .segmented button, .drawer .segmented button { justify-content: center; padding: 0 6px; height: 40px; }

  /* tabelas viram cartões */
  .table-wrap { overflow: visible; }
  .table, .table tbody { display: block; }
  .table thead { display: none; }
  .table tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: block; padding: 0; border: 0; min-width: 0; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
  .table td.td-head, .table td[colspan] { grid-column: 1 / -1; }
  .table td.num { text-align: left; }
  .table td.td-valor strong { font-size: 17px; }
  .table td.td-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; border-top: 1px dashed var(--border); padding-top: 8px; }
  .table td.td-actions:empty { display: none; }
  .cell-person { min-width: 0; }
  .table td .badge { white-space: normal; line-height: 1.3; }
  .table td.td-actions .icon-btn { width: 40px; height: 40px; }
}
