:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1d2733; --muted: #6b7785; --line: #e3e8ee;
  --brand: #1f3a5f; --brand-2: #2f6fb3; --ok: #1e8e5a; --ok-bg: #e5f5ed; --warn: #a66a00; --warn-bg: #fff4dc;
  --bad: #c0392b; --bad-bg: #fde9e7; --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; }

/* Layout com menu lateral */
body.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #dfe8f3; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 26px; }
.brand strong { display: block; color: #fff; }
.brand small { color: #9fb4cc; font-size: 12px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--brand); display: grid; place-items: center; font-weight: 800; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { color: #dfe8f3; padding: 9px 12px; border-radius: 8px; }
.side nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.side nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8ea6c2; margin: 18px 12px 6px; }
.me { border-top: 1px solid rgba(255,255,255,.12); padding-top: 12px; font-size: 13px; }
.me-name { color: #fff; word-break: break-all; margin-bottom: 4px; }
button.link { background: none; border: 0; color: #9fc3ff; padding: 0; cursor: pointer; font: inherit; }
.content { padding: 30px 36px; max-width: 1200px; }

/* Cartões e tabelas */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card .num { font-size: 30px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 13px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 28px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.muted { background: #eef1f4; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #b8c2cc; }
.dot.on { background: var(--ok); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.notice { background: #eef5ff; border: 1px solid #cfe0fb; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.notice.warn { background: var(--warn-bg); border-color: #f3d79b; }
.notice.ok { background: var(--ok-bg); border-color: #b9e3cc; }
.notice.bad { background: var(--bad-bg); border-color: #f5c2bc; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 26px; letter-spacing: .12em; font-weight: 700; padding: 12px 16px; background: #f7f9fb; border: 1px dashed #b8c4d1; border-radius: 8px; display: inline-block; }
.link-box { word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: 13px; background: #f7f9fb; border: 1px dashed #b8c4d1; border-radius: 8px; padding: 10px 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.placeholder { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); }

/* Formulários */
label { display: block; font-weight: 600; font-size: 13.5px; margin: 0 0 6px; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: 10px 12px; border: 1px solid #c9d3dd; border-radius: 8px; font: inherit; background: #fff;
}
input:focus, select:focus { outline: 2px solid #9cc3f5; border-color: var(--brand-2); }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.btn { display: inline-block; background: var(--brand-2); color: #fff; border: 0; border-radius: 8px; padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: #255d98; text-decoration: none; }
.btn.secondary { background: #e9eef4; color: var(--ink); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 6px 12px; font-size: 13.5px; }
.btn.block { width: 100%; }
.errors { color: var(--bad); font-size: 14px; margin-bottom: 12px; }
.errors ul { margin: 0; padding-left: 18px; }
form.inline { display: inline; }

/* Telas de login */
body.auth { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, #1f3a5f 0%, #2f6fb3 100%); }
.auth-box { background: #fff; width: 100%; max-width: 430px; border-radius: 14px; padding: 32px 34px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-box .brand.big { margin-bottom: 22px; }
.auth-box .brand strong { color: var(--ink); font-size: 18px; }
.auth-box .brand small { color: var(--muted); }
.auth-box .logo { background: var(--brand); color: #fff; }
.auth-box h1 { font-size: 20px; }
.foot { color: var(--muted); font-size: 12px; text-align: center; margin: 20px 0 0; }
.qr { display: flex; justify-content: center; margin: 14px 0; }
.qr svg { width: 190px; height: 190px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-family: ui-monospace, Consolas, monospace; font-size: 15px; background: #f7f9fb; border: 1px dashed #b8c4d1; border-radius: 8px; padding: 14px 18px; }

@media (max-width: 800px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .content { padding: 20px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* Utilitários (o CSP não permite style="" inline) */
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.m0 { margin: 0; }
.mt8 { margin-top: 8px; } .mt10 { margin-top: 10px; } .mt14 { margin-top: 14px; } .mt20 { margin-top: 20px; }
.small { font-size: 12.5px; }
.num-sub { font-size: 18px; }
.grow { flex: 1; width: auto; }
.steps { padding-left: 18px; margin: 0 0 8px; }

/* Atividade */
.daynav { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; }
.daynav input[type=date] { padding: 7px 10px; border: 1px solid #c9d3dd; border-radius: 8px; font: inherit; }
.apps td.bar { width: 45%; }
.apps svg { width: 100%; height: 12px; display: block; }
.hours svg { width: 100%; height: 120px; display: block; }
.hours .lbls { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.sessions td { padding: 7px 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.shot { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fafbfc; }
.shot img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; background: #e9eef4; }
.shot .cap { padding: 7px 9px; font-size: 12.5px; }
.shot .cap strong { display: block; }
.title-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

/* Modal do print */
dialog.modal { border: 0; padding: 0; background: #0f1720; color: #e8eef5; width: min(96vw, 1500px); max-height: 94vh; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
dialog.modal::backdrop { background: rgba(8, 14, 22, .78); }
.modal-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 14px; }
.modal-cap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 75%; }
.modal-count { color: #9fb0c2; }
.modal-close { background: none; border: 0; color: #e8eef5; font-size: 20px; cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.modal-close:hover, .modal-nav:hover { background: rgba(255,255,255,.12); }
.modal-body { position: relative; display: flex; align-items: center; justify-content: center; padding: 10px; }
.modal-body img { max-width: 100%; max-height: calc(94vh - 70px); object-fit: contain; display: block; border-radius: 4px; }
.modal-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.45); color: #fff; border: 0; font-size: 34px; line-height: 1; width: 46px; height: 64px; cursor: pointer; border-radius: 8px; }
.modal-prev { left: 14px; }
.modal-next { right: 14px; }
.gallery a.shot { cursor: zoom-in; }

/* Busca */
.busca-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.busca-form .field { margin: 0; }
.busca-form .field.grow { flex: 1; min-width: 240px; }
.busca-form select, .busca-form input[type=date] { padding: 10px 12px; border: 1px solid #c9d3dd; border-radius: 8px; font: inherit; }

/* Zoom/pan do print no modal */
.modal-body { overflow: hidden; touch-action: none; }
.modal-body.zoomed { cursor: grab; }
.modal-body.zoomed:active { cursor: grabbing; }
.modal-img { transform-origin: center center; transition: transform .08s ease-out; will-change: transform; user-select: none; -webkit-user-drag: none; }
.modal-zoom { display: inline-flex; gap: 6px; align-items: center; margin-right: 6px; }
.modal-zoom button { background: rgba(255,255,255,.1); border: 0; color: #e8eef5; cursor: pointer; border-radius: 6px; padding: 4px 10px; font: inherit; line-height: 1.2; }
.modal-zoom button:hover { background: rgba(255,255,255,.2); }
.modal-hint { padding: 6px 14px 10px; font-size: 12px; text-align: center; }

/* Texto digitado nos resultados */
.texto-cell { max-width: 520px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; color: #222; }

/* Tela ao vivo */
.live-wrap { position: relative; background: #0f1720; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 300px; display: flex; align-items: center; justify-content: center; }
.live-wrap img { max-width: 100%; max-height: 80vh; display: block; }
.live-empty { color: #9fb0c2; padding: 40px; text-align: center; }

/* Miniatura de print dentro de uma linha da busca de texto (abre o lightbox). */
.shot-inline { display: inline-block; line-height: 0; }
.shot-inline img { height: 44px; width: auto; border: 1px solid var(--border, #d0d5dd); border-radius: 4px; cursor: zoom-in; }
/* "ver o dia" leva ao print pelo #ancora: realça e dá folga de rolagem. */
.gallery a.shot { scroll-margin-top: 80px; }
.gallery a.shot:target { outline: 3px solid var(--accent, #2563eb); outline-offset: 2px; border-radius: 6px; }
