:root {
  --green-950: #081f36;
  --green-900: #0f3b66;
  --green-800: #155e9b;
  --green-700: #1d77b8;
  --green-100: #e8f3fb;
  --yellow: #38bdf8;
  --yellow-soft: #e0f5ff;
  --ink: #102a43;
  --muted: #60758a;
  --line: #d8e3ec;
  --surface: #ffffff;
  --canvas: #f2f7fb;
  --danger: #a53c34;
  --danger-soft: #fff0ee;
  --warning: #c66a0a;
  --warning-soft: #fff5df;
  --success: #13795b;
  --success-soft: #e7f7f1;
  --shadow: 0 10px 30px rgba(15, 59, 102, .11);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.viewer-banner { display: flex; gap: 12px; align-items: center; margin: -4px 0 18px; padding: 12px 16px; color: #18436d; background: #eaf5ff; border: 1px solid #b9dcf8; border-radius: 10px; }
.viewer-banner strong { font-size: 13px; white-space: nowrap; }
.viewer-banner span { font-size: 13px; }
#camera-start, #camera-panel, .camera-actions { display: none !important; }

.access-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 46%) 1fr; background: var(--surface); }
.access-panel { padding: 44px clamp(36px, 6vw, 100px); display: flex; flex-direction: column; }
.brand-lockup { display: flex; gap: 14px; align-items: center; }
.brand-mark { width: 58px; height: 58px; background: var(--green-800); color: white; display: grid; place-items: center; font-weight: 900; letter-spacing: -2px; font-size: 24px; border-bottom: 5px solid var(--yellow); }
.brand-mark.small { width: 42px; height: 42px; font-size: 17px; border-bottom-width: 4px; }
.brand-lockup div, .topbar-brand div { display: flex; flex-direction: column; }
.brand-lockup strong, .topbar-brand strong { font-size: 14px; letter-spacing: .12em; }
.brand-lockup span:not(.brand-mark), .topbar-brand span { font-size: 13px; color: var(--muted); }
.access-form { width: min(100%, 470px); margin: auto 0; padding: 72px 0 30px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .16em; color: var(--green-700); margin-bottom: 8px; }
.access-form h1, .page-heading h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.05; letter-spacing: -.04em; margin: 0; }
.access-form > p, .page-heading p { color: var(--muted); line-height: 1.55; margin: 14px 0 30px; }
label { display: flex; flex-direction: column; gap: 7px; color: #314b63; font-weight: 700; font-size: 14px; }
input, select { width: 100%; height: 48px; border: 1px solid #c7d6e3; border-radius: 6px; background: white; padding: 0 13px; color: var(--ink); outline: none; }
input, select, textarea { color: #102a43 !important; -webkit-text-fill-color: #102a43; }
input::placeholder, textarea::placeholder { color: #8aa6bd !important; opacity: 1; }
select option { color: #102a43; background: #ffffff; }
input:focus, select:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(29, 119, 184, .14); }
.access-form label { margin-top: 18px; }
.button { border: 0; min-height: 46px; border-radius: 5px; padding: 0 20px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: transform .12s, background .12s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .6; cursor: wait; transform: none; }
.button.primary { background: var(--green-800); color: white; }
.button.primary:hover { background: var(--green-900); }
.button.accent { background: var(--yellow); color: #08233b; }
.button.subtle { border: 1px solid var(--line); background: white; color: var(--green-800); }
.button.full { width: 100%; margin-top: 24px; }
.form-error { min-height: 22px; color: var(--danger); margin-top: 12px; font-size: 14px; }
.access-aside { position: relative; overflow: hidden; padding: clamp(50px, 8vw, 120px); background: var(--green-900); color: white; display: flex; flex-direction: column; justify-content: center; }
.access-aside::after { content: ""; position: absolute; width: 550px; height: 550px; border: 100px solid rgba(255,255,255,.035); border-radius: 50%; right: -250px; bottom: -280px; }
.aside-number { color: var(--yellow); font-size: 13px; font-weight: 900; letter-spacing: .2em; }
.access-aside h2 { max-width: 600px; font-size: clamp(40px, 5vw, 70px); letter-spacing: -.055em; line-height: .98; margin: 20px 0; }
.access-aside p { max-width: 600px; font-size: 18px; line-height: 1.6; color: #d8ebfa; }
.flow-preview { margin-top: 54px; display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 900; letter-spacing: .12em; color: #d8ebfa; }
.flow-preview i { width: 32px; height: 2px; background: var(--yellow); }

.app { min-height: 100vh; display: grid; grid-template-columns: 242px 1fr; grid-template-rows: 68px 1fr; grid-template-areas: "top top" "side work"; }
.topbar { grid-area: top; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: white; border-bottom: 1px solid var(--line); }
.topbar-brand, .topbar-right { display: flex; align-items: center; gap: 11px; }
.topbar-right { font-size: 13px; color: var(--muted); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #21a8e8; box-shadow: 0 0 0 4px #dff4fd; }
.user-button { border: 0; border-left: 1px solid var(--line); background: transparent; padding: 0 8px 0 18px; color: var(--ink); font-weight: 700; cursor: default; }
.icon-button { width: 36px; height: 36px; border-radius: 5px; border: 1px solid var(--line); background: white; cursor: pointer; color: var(--green-800); font-size: 19px; }
.theme-toggle { font-size: 18px; line-height: 1; }
body.dark-mode {
  --ink: #e7f1fb; --muted: #a9bfd3; --line: #29445d; --surface: #102b45; --canvas: #081a2c;
  --danger-soft: #3b2225; --warning-soft: #3f321b; --success-soft: #173d35;
}
body.dark-mode .topbar, body.dark-mode .panel, body.dark-mode .card, body.dark-mode .button.subtle,
body.dark-mode input, body.dark-mode select, body.dark-mode textarea, body.dark-mode .icon-button { background: #102b45; color: var(--ink); }
body.dark-mode .workspace { background: var(--canvas); }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea { border-color: var(--line); color: var(--ink) !important; -webkit-text-fill-color: var(--ink); }
body.dark-mode select option { color: var(--ink); background: #102b45; }
body.dark-mode .table-wrap thead, body.dark-mode th { background: #0d243b; }
body.dark-mode .table-wrap td, body.dark-mode .table-wrap th { border-color: var(--line); }
body.dark-mode .user-button { color: var(--ink); }
.sidebar { grid-area: side; position: sticky; top: 68px; height: calc(100vh - 68px); background: var(--green-950); color: white; padding: 26px 18px; display: flex; flex-direction: column; justify-content: space-between; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { min-height: 48px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 5px; background: transparent; color: #bed5e8; font-weight: 700; padding: 0 14px; cursor: pointer; text-align: left; }
.nav-item span { width: 22px; color: #82b9df; font-size: 20px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: var(--green-700); color: white; box-shadow: inset 3px 0 var(--yellow); }
.nav-item.active span { color: var(--yellow); }
.sidebar-note { border-top: 1px solid rgba(255,255,255,.12); padding: 20px 10px 4px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-note span { color: var(--yellow); font-size: 12px; font-weight: 900; letter-spacing: .14em; }
.sidebar-note strong { font-size: 13px; line-height: 1.45; color: #c7ddeb; }
.workspace { grid-area: work; padding: 38px clamp(24px, 4vw, 58px) 70px; overflow: hidden; }
.view { display: none; max-width: 1440px; margin: 0 auto; }
.view.active { display: block; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; margin-bottom: 26px; }
.page-heading h1 { font-size: clamp(31px, 4vw, 46px); }
.page-heading p { margin-bottom: 0; }
.scan-bar { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; background: var(--green-800); padding: 12px 14px; border-radius: 8px; color: white; box-shadow: var(--shadow); margin-bottom: 26px; }
.scan-bar.compact { max-width: 860px; }
.scan-icon { font-size: 30px; color: var(--yellow); text-align: center; }
.scan-bar label { color: #d8ebfa; gap: 4px; }
.scan-bar label span { font-size: 12px; letter-spacing: .12em; }
.scan-bar input { height: 38px; padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none; color: white; font-size: 20px; font-weight: 800; }
.scan-bar input { color: #ffffff !important; -webkit-text-fill-color: #ffffff; }
.scan-bar input::placeholder { color: #9dc5e1; font-weight: 500; }
.scan-bar.compact input { color: #102a43 !important; -webkit-text-fill-color: #102a43 !important; background: #ffffff !important; }
.scan-bar.compact input::placeholder { color: #8aa6bd !important; -webkit-text-fill-color: #8aa6bd !important; }
input:not([type="checkbox"]):not([type="file"]), select, textarea { color: #102a43 !important; -webkit-text-fill-color: #102a43 !important; caret-color: #102a43 !important; }
input:not([type="checkbox"]):not([type="file"]):focus, select:focus, textarea:focus { color: #102a43 !important; -webkit-text-fill-color: #102a43 !important; }
.scan-bar .button { min-height: 45px; min-width: 120px; }
.status-cards { display: grid; grid-template-columns: repeat(6, minmax(145px, 1fr)); gap: 12px; margin-bottom: 26px; }
.status-card { min-height: 142px; padding: 18px; background: white; border: 1px solid var(--line); border-top: 4px solid var(--status-color, var(--green-700)); border-radius: 8px; box-shadow: 0 5px 18px rgba(15,59,102,.06); cursor: pointer; text-align: left; }
.status-card.color-0 { --status-color: #94a3b8; }
.status-card.color-1 { --status-color: #60a5fa; }
.status-card.color-2 { --status-color: #0ea5e9; }
.status-card.color-3 { --status-color: #2563eb; }
.status-card.color-4 { --status-color: #1d4ed8; }
.status-card.color-5 { --status-color: #0f3b8a; }
.status-card:hover { border-color: var(--status-color, var(--green-700)); }
.status-card strong { display: block; font-size: 31px; line-height: 1; margin-bottom: 7px; }
.status-card small { display: block; color: var(--green-700); font-size: 11px; font-weight: 900; letter-spacing: .09em; margin-bottom: 11px; }
.status-card span { display: block; color: var(--muted); font-size: 12px; line-height: 1.25; font-weight: 800; letter-spacing: .04em; }
.panel { background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(15,59,102,.055); }
.panel-heading { min-height: 84px; padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.panel h2, .panel-heading h2 { font-size: 19px; margin: 0 0 5px; letter-spacing: -.02em; }
.panel p, .panel-heading p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.meta-pill { padding: 7px 10px; background: var(--green-100); color: var(--green-800); font-size: 12px; font-weight: 800; border-radius: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 16px; color: #60758a; background: #f5f9fc; font-size: 12px; letter-spacing: .08em; text-align: left; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid #e7eef4; vertical-align: middle; }
tbody tr:hover { background: #f8fbfd; }
.link-button { padding: 5px 0; border: 0; border-bottom: 1px solid var(--green-700); background: transparent; color: var(--green-700); font-weight: 800; cursor: pointer; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; font-weight: 800; }
.subtext { color: var(--muted); font-size: 12px; margin-top: 3px; }
.status-pill { display: inline-flex; max-width: 230px; padding: 6px 9px; border-radius: 4px; background: #e8f0f7; color: #405a70; font-size: 12px; line-height: 1.25; font-weight: 900; letter-spacing: .035em; }
.status-pill.s0 { background: #eef2f6; color: #526579; }
.status-pill.s1 { background: #e5f1ff; color: #175b9c; }
.status-pill.s2 { background: #dff5ff; color: #05688f; }
.status-pill.s3 { background: #e5edff; color: #244da5; }
.status-pill.s4 { background: #e1e9ff; color: #1e4297; }
.status-pill.s5 { background: #dce8fa; color: #123d79; }
.empty { padding: 38px 24px; display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--muted); text-align: center; }
.empty.large { min-height: 320px; justify-content: center; background: white; border: 1px dashed #cbd3c7; border-radius: 7px; }
.empty-symbol { font-size: 46px; color: var(--green-700); }
.empty strong { color: var(--ink); }
.filter-bar { display: grid; grid-template-columns: 2fr 1.2fr 1.2fr auto auto; gap: 12px; align-items: end; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 16px; }
.filter-bar label span, .user-form label span { font-size: 12px; letter-spacing: .1em; }
.dashboard-filter { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 12px; align-items: end; padding: 20px; margin-bottom: 18px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(15,59,102,.045); }
.dashboard-filter label span { font-size: 12px; letter-spacing: .08em; }
.dashboard-filter-actions { display: flex; gap: 8px; align-items: center; }
.dashboard-filter-actions .button { flex: 1; }
.admin-summary-grid { display: grid; grid-template-columns: minmax(340px, .75fr) minmax(520px, 1.25fr); gap: 18px; margin-bottom: 18px; }
.total-bubble-panel { position: relative; overflow: hidden; min-height: 294px; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 30px; border-radius: 10px; color: white; background: linear-gradient(135deg, #081f36 0%, #155e9b 70%, #1d77b8 100%); box-shadow: 0 16px 38px rgba(15,59,102,.2); }
.total-bubble-panel::after { content: ""; position: absolute; width: 230px; height: 230px; border: 38px solid rgba(255,255,255,.055); border-radius: 50%; right: -110px; bottom: -120px; }
.total-bubble-ring { position: relative; z-index: 1; flex: 0 0 168px; width: 168px; height: 168px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 12px solid rgba(56,189,248,.92); border-radius: 50%; background: rgba(5,28,49,.33); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 12px 30px rgba(3,24,43,.25); }
.total-bubble-ring strong { max-width: 140px; font-size: 36px; line-height: 1; letter-spacing: -.04em; text-align: center; overflow-wrap: anywhere; }
.total-bubble-ring span { margin-top: 8px; color: #c6efff; font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.total-bubble-copy { position: relative; z-index: 1; max-width: 240px; }
.total-bubble-copy .eyebrow { color: #7dd3fc; }
.total-bubble-copy h2 { margin: 0 0 10px; font-size: 24px; }
.total-bubble-copy p { color: #d8ebfa; font-size: 14px; }
.total-bubble-copy p strong { color: white; font-size: 20px; }
.distribution-panel { min-height: 294px; }
.status-bars { display: grid; gap: 13px; padding: 20px 24px 24px; }
.status-bar-label { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 6px; font-size: 12px; }
.status-bar-label span { max-width: 60%; color: #425b70; font-weight: 800; }
.status-bar-label strong { color: var(--ink); white-space: nowrap; }
.status-bar-row progress { display: block; width: 100%; height: 9px; border: 0; border-radius: 20px; overflow: hidden; background: #e8f0f6; accent-color: var(--bar-color, var(--green-700)); }
.status-bar-row progress::-webkit-progress-bar { background: #e8f0f6; border-radius: 20px; }
.status-bar-row progress::-webkit-progress-value { background: var(--bar-color, var(--green-700)); border-radius: 20px; }
.status-bar-row progress::-moz-progress-bar { background: var(--bar-color, var(--green-700)); border-radius: 20px; }
.bar-color-0 { --bar-color: #94a3b8; }.bar-color-1 { --bar-color: #60a5fa; }.bar-color-2 { --bar-color: #0ea5e9; }.bar-color-3 { --bar-color: #2563eb; }.bar-color-4 { --bar-color: #1d4ed8; }.bar-color-5 { --bar-color: #0f3b8a; }
.admin-status-cards { margin-bottom: 18px; }
.admin-status-cards .status-card { min-height: 150px; }
.percentage-pill { display: inline-flex; min-width: 62px; justify-content: center; padding: 6px 9px; border-radius: 20px; background: var(--green-100); color: var(--green-800); font-weight: 900; }
.point-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, .8fr); gap: 18px; }
.item-card, .status-form-card, .history-card { padding: 25px; }
.item-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.item-head .registration { color: var(--green-700); font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.item-head h2 { margin: 6px 0 0; font-size: 30px; }
.details-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px 18px; padding-top: 22px; }
.detail dt { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.detail dd { margin: 6px 0 0; font-size: 15px; font-weight: 700; word-break: break-word; }
.status-form-card h2 { margin-bottom: 6px; }
.delivered-notice { padding: 25px; border: 1px solid #b8d7c2; border-left: 5px solid #2e7d4f; border-radius: 8px; background: #effaf2; color: #235c39; display: grid; gap: 8px; align-content: center; }
.delivered-notice strong { font-size: 16px; letter-spacing: .04em; }
.delivered-notice span { color: #47705a; font-size: 13px; line-height: 1.45; }
.status-form-card > p { margin-bottom: 20px; }
.status-options { display: grid; gap: 8px; margin: 18px 0; }
.status-option { flex-direction: row; align-items: center; min-height: 44px; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; font-size: 12px; }
.status-option:has(input:checked) { border-color: var(--green-700); background: var(--green-100); }
.status-option input { width: 17px; height: 17px; box-shadow: none; accent-color: var(--green-700); }
.status-form-card textarea { width: 100%; min-height: 88px; resize: vertical; border: 1px solid #c7d6e3; border-radius: 5px; padding: 12px; font: inherit; outline: none; }
.history-card { margin-top: 18px; }
.timeline { list-style: none; padding: 0; margin: 20px 0 0; }
.timeline li { position: relative; padding: 0 0 22px 24px; border-left: 2px solid var(--line); margin-left: 5px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 10px; height: 10px; background: var(--green-700); border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--green-700); }
.timeline strong { font-size: 13px; }
.timeline span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.timeline em { display: block; margin-top: 6px; color: #3e556a; font-size: 13px; font-style: normal; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.admin-card { padding: 26px; }
.section-index { color: var(--green-700); font-size: 12px; font-weight: 900; letter-spacing: .14em; margin-bottom: 10px; }
.file-drop { min-height: 135px; margin-top: 20px; border: 1px dashed #9ab4ca; background: #f4f9fd; align-items: center; justify-content: center; cursor: pointer; text-align: center; }
.file-drop:hover { border-color: var(--green-700); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop .file-icon { font-size: 28px; color: var(--green-700); }
.file-drop small { color: var(--muted); font-weight: 500; }
.result-message { min-height: 20px; margin-top: 12px; font-size: 13px; color: var(--green-700); }
.export-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }
.export-link { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; min-height: 65px; border: 1px solid var(--line); border-radius: 5px; padding: 10px; color: var(--ink); text-decoration: none; }
.export-link:hover { border-color: var(--green-700); background: #f4f9fd; }
.export-link > span { color: var(--green-700); font-size: 21px; text-align: center; }
.export-link div { display: flex; flex-direction: column; gap: 3px; }
.export-link small { color: var(--muted); }
.export-link b { color: var(--green-700); }
.users-panel { padding-bottom: 10px; }
.user-form { display: grid; grid-template-columns: 1.2fr 1fr .8fr 1.1fr auto; gap: 10px; align-items: end; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.small-button { min-height: 34px; border: 1px solid var(--line); background: white; border-radius: 4px; padding: 0 10px; color: var(--green-700); font-weight: 800; font-size: 13px; cursor: pointer; margin: 2px; }
.small-button.danger { color: var(--danger); }
.toast { position: fixed; z-index: 100; right: 24px; top: 22px; max-width: 420px; padding: 14px 18px; background: var(--green-950); color: white; border-left: 5px solid var(--yellow); border-radius: 5px; box-shadow: 0 12px 40px rgba(0,0,0,.22); font-size: 14px; opacity: 0; transform: translateY(-12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: #e25f51; }

/* Prazos e alertas */
.delay-banner { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 14px; margin: -8px 0 26px; padding: 15px 17px; color: #713025; background: var(--danger-soft); border: 1px solid #f2c6bf; border-left: 5px solid #d75d4d; border-radius: 8px; }
.delay-banner-icon { width: 38px; height: 38px; display: grid; place-items: center; color: white; background: #cf4e40; border-radius: 50%; font-size: 21px; font-weight: 900; }
.delay-banner strong, .delay-banner span { display: block; }
.delay-banner span { margin-top: 3px; color: #895248; font-size: 14px; }
.delay-banner .button { min-height: 40px; color: #9c3e33; border-color: #e6aaa1; }
.time-badge { display: inline-flex; flex-direction: column; align-items: flex-start; min-width: 112px; gap: 2px; padding: 6px 8px; border: 1px solid #cfe0ed; border-radius: 5px; color: #36546c; background: #f5f9fc; font-size: 12px; font-weight: 800; white-space: nowrap; }
.time-badge small { color: var(--muted); font-size: 12px; font-weight: 600; }
.time-badge.overdue { color: #a23e33; background: var(--danger-soft); border-color: #edb8b0; }
.time-badge.overdue small { color: #a9564c; }
.time-badge.attention { color: #8b5606; background: var(--warning-soft); border-color: #efd39c; }
.time-badge.ok { color: #12664d; background: var(--success-soft); border-color: #a8ddcb; }
.overdue-row { background: #fff9f7; }
.overdue-row:hover { background: #fff2ef; }
.item-health { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; margin: 18px 0 0; padding: 15px; border-radius: 7px; background: #f4f9fd; border: 1px solid #d5e4ef; }
.item-health.overdue { background: var(--danger-soft); border-color: #efbbb3; }
.item-health.attention { background: var(--warning-soft); border-color: #efd39c; }
.health-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--green-100); color: var(--green-800); font-weight: 900; }
.item-health.overdue .health-icon { color: white; background: #d15447; }
.item-health.attention .health-icon { color: white; background: var(--warning); }
.item-health strong, .item-health span { display: block; }
.item-health span { margin-top: 3px; color: var(--muted); font-size: 13px; }
.health-forecast { text-align: right; color: var(--muted); font-size: 12px; }
.health-forecast b { display: block; margin-top: 4px; color: var(--ink); font-size: 14px; }

/* Leitura por câmera */
.camera-actions { max-width: 860px; display: flex; align-items: center; gap: 12px; margin: -12px 0 22px; }
.camera-actions > span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.camera-button { color: var(--green-800); background: var(--green-100); border: 1px solid #bbd7ea; white-space: nowrap; }
.camera-button span { margin-right: 8px; font-size: 19px; }
.camera-panel { max-width: 860px; margin: 0 0 22px; overflow: hidden; color: white; background: #061a2c; border-radius: 10px; box-shadow: var(--shadow); }
.camera-head { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 16px; }
.camera-head strong, .camera-head span { display: block; }
.camera-head span { margin-top: 3px; color: #b9d2e5; font-size: 13px; }
.camera-head .icon-button { color: white; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); }
.camera-viewport { position: relative; min-height: 280px; display: grid; place-items: center; overflow: hidden; background: #020a12; }
.camera-viewport video { display: block; width: 100%; max-height: 520px; object-fit: cover; }
.camera-viewport img { display: block; width: 100%; max-height: 520px; object-fit: contain; }
.camera-frame { position: absolute; width: min(72%, 450px); height: 42%; min-height: 120px; border: 3px solid #38bdf8; border-radius: 12px; box-shadow: 0 0 0 999px rgba(2,10,18,.35); pointer-events: none; }
.camera-fallback { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.camera-fallback .button { min-height: 40px; color: white; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); cursor: pointer; }
.camera-fallback span { color: #b9d2e5; font-size: 13px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }
.filter-check { min-height: 48px; flex-direction: row; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid #c7d6e3; border-radius: 6px; background: white; cursor: pointer; white-space: nowrap; }
.filter-check input { width: 18px; height: 18px; padding: 0; box-shadow: none; accent-color: var(--green-700); }
.filter-check span { font-size: 12px; letter-spacing: .06em; }

/* Fila de cada setor */
.sector-toolbar { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(280px, 1.5fr) minmax(190px, .8fr); gap: 14px; align-items: end; padding: 18px; margin-bottom: 16px; }
.sector-toolbar label span { font-size: 12px; letter-spacing: .08em; }
.sector-summary { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.sector-stat { min-height: 105px; padding: 17px; border: 1px solid var(--line); border-left: 4px solid var(--green-700); border-radius: 7px; background: white; box-shadow: 0 5px 18px rgba(15,59,102,.05); }
.sector-stat.warning { border-left-color: var(--warning); }
.sector-stat.danger { border-left-color: #cf4e40; }
.sector-stat strong { display: block; font-size: 27px; line-height: 1; }
.sector-stat span { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .055em; }
.sector-queue-panel { overflow: hidden; }
.sector-queue { display: grid; gap: 0; }
.queue-item { display: grid; grid-template-columns: minmax(230px, 1.25fr) minmax(155px, .7fr) minmax(150px, .65fr) minmax(160px, .7fr) auto; gap: 16px; align-items: center; min-height: 104px; padding: 16px 20px; border-top: 1px solid #e7eef4; }
.queue-item:first-child { border-top: 0; }
.queue-item:hover { background: #f8fbfd; }
.queue-item.overdue { background: #fff9f7; box-shadow: inset 4px 0 #d15447; }
.queue-primary strong, .queue-primary span { display: block; }
.queue-primary strong { margin-top: 5px; font-size: 17px; }
.queue-primary span { margin-top: 4px; color: var(--muted); font-size: 13px; }
.queue-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .07em; }
.queue-actions { display: flex; flex-direction: column; align-items: stretch; gap: 7px; min-width: 158px; }
.queue-actions .button { min-height: 38px; padding: 0 13px; font-size: 13px; }

/* Indicadores gerenciais */
.management-kpis { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 12px; margin: 0 0 18px; }
.management-kpi { min-height: 126px; padding: 19px; color: white; background: linear-gradient(145deg, #0f3b66, #155e9b); border-radius: 9px; box-shadow: 0 10px 25px rgba(15,59,102,.14); }
.management-kpi.danger { background: linear-gradient(145deg, #7d3028, #cf4e40); }
.management-kpi.warning { background: linear-gradient(145deg, #805309, #d78617); }
.management-kpi.success { background: linear-gradient(145deg, #0d5943, #15926c); }
.management-kpi span, .management-kpi small { display: block; }
.management-kpi strong { display: block; margin: 7px 0 8px; font-size: 30px; line-height: 1; }
.management-kpi span { color: rgba(255,255,255,.82); font-size: 12px; font-weight: 900; letter-spacing: .09em; }
.management-kpi small { color: rgba(255,255,255,.82); font-size: 12px; }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.analytics-panel { min-height: 340px; }
.analytics-bars { display: grid; gap: 13px; padding: 20px 24px 24px; }
.analytics-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(120px, 2.4fr) auto; gap: 12px; align-items: center; }
.analytics-row > span { min-width: 0; overflow: hidden; color: #36546c; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.analytics-track { height: 10px; overflow: hidden; background: #e8f0f6; border-radius: 20px; }
.analytics-fill { height: 100%; min-width: 3px; background: linear-gradient(90deg, #1d77b8, #38bdf8); border-radius: 20px; }
.analytics-row strong { min-width: 48px; text-align: right; font-size: 13px; }
.analytics-empty { padding: 34px 24px; color: var(--muted); font-size: 14px; text-align: center; }
.stage-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.stage-average-list, .forecast-list { display: grid; padding: 8px 24px 18px; }
.stage-average-item { display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: center; padding: 14px 0; border-bottom: 1px solid #e7eef4; }
.stage-average-item:last-child { border-bottom: 0; }
.stage-average-item span { color: #36546c; font-size: 13px; font-weight: 800; }
.stage-average-item strong { color: var(--green-800); font-size: 18px; white-space: nowrap; }
.forecast-item { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 13px 0; border-bottom: 1px solid #e7eef4; }
.forecast-item:last-child { border-bottom: 0; }
.forecast-item strong, .forecast-item span, .forecast-item small { display: block; }
.forecast-item strong { font-size: 14px; }
.forecast-item span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.forecast-item time { color: var(--green-800); font-size: 13px; font-weight: 900; text-align: right; }
.confidence { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 600; }

/* Configurações do ADM */
.settings-panel { margin-bottom: 18px; overflow: hidden; }
.settings-form { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 0; }
.settings-group { min-width: 0; margin: 0; padding: 22px 24px 24px; border: 0; border-right: 1px solid var(--line); }
.settings-group:last-of-type { border-right: 0; }
.settings-group legend { float: left; width: 100%; margin: 0 0 17px; padding: 0; color: var(--ink); font-size: 15px; font-weight: 900; }
.settings-group legend + * { clear: both; }
.settings-group > label:not(.switch-row) { margin-top: 13px; }
.settings-group label span { font-size: 12px; letter-spacing: .07em; }
.sla-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.sla-grid label:last-child { grid-column: 1 / -1; }
.switch-row { flex-direction: row; align-items: flex-start; gap: 10px; padding: 12px; color: var(--ink); background: #f4f9fd; border: 1px solid #d5e4ef; border-radius: 7px; cursor: pointer; }
.switch-row input { flex: 0 0 auto; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--green-700); box-shadow: none; }
.switch-row span, .switch-row strong, .switch-row small { display: block; letter-spacing: 0; }
.switch-row small { margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.4; }
.setting-status { min-height: 18px; margin-top: 13px !important; color: var(--muted) !important; font-size: 12px !important; }
.settings-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 16px 24px; background: #f5f9fc; border-top: 1px solid var(--line); }
.settings-actions .result-message { margin: 0; }
.users-panel { margin-top: 0; }
.user-form { grid-template-columns: 1.2fr 1fr .75fr .8fr 1.05fr auto; }
.user-sector-select { min-width: 140px; height: 38px; font-size: 13px; }

@media (max-width: 1180px) {
  .status-cards { grid-template-columns: repeat(3, 1fr); }
  .user-form { grid-template-columns: 1fr 1fr; }
  .user-form .button { min-height: 48px; }
  .dashboard-filter { grid-template-columns: repeat(2, 1fr); }
  .dashboard-filter .wide { grid-column: 1 / -1; }
  .admin-summary-grid { grid-template-columns: 1fr; }
  .management-kpis { grid-template-columns: repeat(2, 1fr); }
  .settings-form { grid-template-columns: 1fr 1fr; }
  .settings-group:first-child { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-group:nth-child(2) { border-right: 1px solid var(--line); }
  .user-form { grid-template-columns: repeat(3, 1fr); }
  .queue-item { grid-template-columns: minmax(220px, 1.2fr) repeat(2, minmax(140px, .7fr)) auto; }
  .queue-item .queue-status { grid-column: 2 / 4; }
}
@media (max-width: 860px) {
  .access-screen { grid-template-columns: 1fr; }
  .access-aside { display: none; }
  .access-panel { min-height: 100vh; padding: 28px 24px; }
  .app { display: block; padding-top: 68px; }
  .topbar { position: fixed; inset: 0 0 auto 0; }
  .sidebar { position: fixed; z-index: 9; top: auto; bottom: 0; left: 0; right: 0; width: 100%; height: 66px; padding: 7px; }
  .sidebar nav { grid-template-columns: repeat(6, minmax(58px, 1fr)); gap: 3px; overflow-x: auto; }
  .nav-item { min-height: 52px; justify-content: center; flex-direction: column; gap: 2px; padding: 4px; font-size: 12px; }
  .nav-item span { width: auto; font-size: 18px; }
  .sidebar-note { display: none; }
  .workspace { padding: 26px 16px 95px; }
  .page-heading { align-items: flex-start; }
  .page-heading .button { display: none; }
  .status-cards { grid-template-columns: repeat(2, 1fr); }
  .scan-bar { grid-template-columns: 42px 1fr; }
  .scan-bar .button { grid-column: 1 / -1; margin-top: 9px; width: 100%; }
  .point-layout, .admin-grid { grid-template-columns: 1fr; }
  .details-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar, .dashboard-filter { grid-template-columns: 1fr 1fr; }
  .filter-bar .wide { grid-column: 1 / -1; }
  .export-list { grid-template-columns: 1fr; }
  .online-text { display: none; }
  .total-bubble-panel { min-height: 250px; }
  .delay-banner { grid-template-columns: 38px 1fr; }
  .delay-banner .button { grid-column: 1 / -1; }
  .camera-actions { align-items: flex-start; flex-direction: column; }
  .sector-toolbar { grid-template-columns: 1fr 1fr; }
  .sector-toolbar .sector-search { grid-column: 1 / -1; grid-row: 1; }
  .sector-summary { grid-template-columns: repeat(2, 1fr); }
  .queue-item { grid-template-columns: 1fr 1fr; }
  .queue-primary { grid-column: 1 / -1; }
  .queue-item .queue-status { grid-column: auto; }
  .queue-actions { grid-column: 1 / -1; flex-direction: row; }
  .queue-actions .button { flex: 1; }
  .analytics-grid, .stage-grid { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-group, .settings-group:first-child, .settings-group:nth-child(2) { grid-column: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .user-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
  .topbar { padding: 0 12px; }
  .topbar-brand div { display: none; }
  .user-button { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .status-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .status-card { min-height: 112px; padding: 14px; }
  .status-card strong { font-size: 27px; }
  .details-grid, .filter-bar, .dashboard-filter, .user-form { grid-template-columns: 1fr; }
  .filter-bar .wide, .dashboard-filter .wide { grid-column: auto; }
  .dashboard-filter-actions { flex-direction: column; align-items: stretch; }
  .total-bubble-panel { flex-direction: column; text-align: center; }
  .item-head { flex-direction: column; }
  .access-form h1 { font-size: 34px; }
  .sidebar { height: 72px; }
  .sidebar nav { grid-template-columns: repeat(6, 56px); }
  .nav-item { font-size: 10px; line-height: 1.05; }
  .workspace { padding-bottom: 100px; }
  .camera-viewport { min-height: 220px; }
  .camera-fallback { align-items: flex-start; flex-direction: column; }
  .sector-toolbar, .sector-summary { grid-template-columns: 1fr; }
  .sector-toolbar .sector-search { grid-column: auto; grid-row: auto; }
  .queue-item { grid-template-columns: 1fr; padding: 16px; }
  .queue-primary, .queue-actions { grid-column: auto; }
  .queue-actions { flex-direction: column; }
  .management-kpis { grid-template-columns: 1fr 1fr; }
  .management-kpi { min-height: 112px; padding: 15px; }
  .management-kpi strong { font-size: 25px; }
  .analytics-row { grid-template-columns: minmax(82px, 1fr) 1.7fr auto; gap: 8px; }
  .sla-grid, .user-form { grid-template-columns: 1fr; }
  .sla-grid label:last-child { grid-column: auto; }
  .settings-actions { align-items: stretch; flex-direction: column; }
  .item-health { grid-template-columns: auto 1fr; }
  .health-forecast { grid-column: 1 / -1; text-align: left; }
}
.column-chart{min-height:240px;display:flex;align-items:flex-end;gap:18px;padding:24px 18px 8px;overflow-x:auto;border-top:1px solid #e4ebf5}.column-chart-item{min-width:68px;height:210px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:7px;border:0;background:transparent;cursor:pointer;padding:0}.column-chart-item.selected .column-chart-bar{background:linear-gradient(180deg,#f59e0b,#e0522d);box-shadow:0 4px 12px #e0522d55}.column-chart-value{font-weight:800;color:#153c83;font-size:.82rem}.column-chart-bar{width:42px;min-height:6px;border-radius:8px 8px 2px 2px;background:linear-gradient(180deg,#27b8eb,#235bd6);box-shadow:0 4px 10px #235bd633;transition:height .25s ease,transform .2s ease}.column-chart-item:hover .column-chart-bar{transform:scaleX(1.12)}.column-chart-item span{font-size:.75rem;color:#526887;white-space:nowrap}.pending-date-panel{margin-top:0}.dashboard-distribution{margin-top:18px}

/* Contraste consistente no tema escuro, inclusive em componentes legados. */
body.dark-mode .access-screen, body.dark-mode .workspace { background: var(--canvas); color: var(--ink); }
body.dark-mode .access-form h1, body.dark-mode .page-heading h1, body.dark-mode .panel h1,
body.dark-mode .panel h2, body.dark-mode .panel h3, body.dark-mode .access-form label,
body.dark-mode label, body.dark-mode .status-card strong, body.dark-mode .sector-stat strong,
body.dark-mode .queue-item strong, body.dark-mode .empty strong { color: var(--ink); }
body.dark-mode input:not([type="checkbox"]):not([type="file"]), body.dark-mode select,
body.dark-mode textarea, body.dark-mode .scan-bar.compact input { background: #173a5b !important; color: #f1f7fd !important; -webkit-text-fill-color: #f1f7fd !important; caret-color: #f1f7fd !important; border-color: #3b6284 !important; }
body.dark-mode input::placeholder, body.dark-mode textarea::placeholder, body.dark-mode .scan-bar.compact input::placeholder { color: #a9c1d6 !important; -webkit-text-fill-color: #a9c1d6 !important; }
body.dark-mode .dashboard-filter, body.dark-mode .filter-bar, body.dark-mode .status-card,
body.dark-mode .sector-stat, body.dark-mode .empty.large, body.dark-mode .table-wrap,
body.dark-mode .filter-check { background: #102b45; color: var(--ink); }
body.dark-mode th, body.dark-mode .status-bar-label span, body.dark-mode .analytics-row > span,
body.dark-mode .stage-average-item span { color: #b9cde0; }
body.dark-mode .status-pill { filter: brightness(.82) saturate(1.15); }
body.dark-mode .topbar-brand strong { color: #f1f7fd; }
