/* Painel do administrador – estilos adaptáveis, com tema claro/escuro automático. */
:root {
  --bg: #f3f5f8;
  --card: #fff;
  --ink: #17243b;
  --mut: #66738a;
  --line: #dce2ea;
  --acc: #f2a900;
  --ok: #1f7a54;
  --err: #c0392b;
  --hd: #14213d;
  --shadow: 0 12px 32px rgba(20, 33, 61, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1522;
    --card: #17213a;
    --ink: #e8edf5;
    --mut: #9aa7bd;
    --line: #2a3856;
    --hd: #0a101b;
    --ok: #4cc38a;
    --err: #ff7a6b;
    --shadow: 0 12px 32px rgba(0, 0, 0, .22);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
}
.hide { display: none !important; }
.muted { color: var(--mut); }
h1, h2 { margin: 0 0 10px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 22px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}
header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px max(24px, calc((100vw - 1320px) / 2));
  background: var(--hd);
  color: #fff;
  box-shadow: 0 4px 18px rgba(8, 16, 31, .18);
}
.brand { color: var(--acc); font-size: 24px; font-weight: 800; letter-spacing: 1.5px; }
#tenantInfo { max-width: 34vw; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.09); color: #dce5f3; font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
nav { display: flex; flex: 1; gap: 5px; }
nav button {
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #cfd8e8;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
nav button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
nav button.on { background: var(--acc); color: #14213d; }
.right { display: flex; gap: 8px; }
main { width: min(1320px, 100%); margin: 0 auto; padding: 28px 24px 48px; }
.btn {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--acc);
  color: #14213d;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(.96); transform: translateY(-1px); }
.btn.ghost { border: 1px solid var(--line); background: transparent; color: inherit; }
.btn.danger { border: 1px solid var(--err); background: transparent; color: var(--err); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}
input:not([type="checkbox"]):not([type="radio"]), select { height: 44px; }
input[type="date"], input[type="time"], input[type="datetime-local"] {
  min-width: 0;
  padding-right: 10px;
  accent-color: var(--acc);
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .75; }
select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%2366738a' d='m3.3 5.8 4.7 4.7 4.7-4.7-1.1-1.1L8 8.3 4.4 4.7z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
textarea { min-height: 88px; resize: vertical; }
td label { min-width: 180px; }
td label + label { margin-top: 8px; }
label { display: block; margin: 10px 0 4px; font-size: 13px; font-weight: 650; }
label.chk { display: flex; align-items: center; gap: 8px; }
label.chk input { width: auto; }
.employee-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 10px; }
.employee-options label.chk { margin: 0; }
#cMat[readonly] { color: var(--mut); cursor: default; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--acc) 70%, transparent); outline-offset: 2px; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at top left, rgba(242, 169, 0, .14), transparent 42%), var(--bg);
}
.login .card { width: min(410px, 100%); padding: 32px; }
.login h1 { color: var(--acc); font-size: 32px; letter-spacing: 3px; }
.login .btn { width: 100%; margin-top: 14px; }
.msg { margin-top: 10px; font-weight: 600; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.filters { display: grid; align-items: end; gap: 12px; margin-bottom: 16px; }
.filters-records { grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(190px, 1.4fr) minmax(150px, 1fr) auto; }
.filters-reports { grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(190px, 1.4fr) minmax(280px, auto); }
.filters-ranking { grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(250px, 1.5fr) auto; }
.filters label { min-width: 0; margin: 0; }
.filter-actions { display: flex; align-items: end; gap: 8px; }
.filter-actions .btn { min-height: 44px; white-space: nowrap; }
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--mut); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:hover { background: color-mix(in srgb, var(--bg) 70%, transparent); }
td.n { font-variant-numeric: tabular-nums; }
.rejection-log { display: inline-block; max-width: 190px; white-space: normal; font-size: 12px; line-height: 1.3; vertical-align: middle; }
.neg { color: var(--err); }
.pos { color: var(--ok); }
.report-employee-link { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 700; text-align: left; text-decoration: underline; text-decoration-color: var(--acc); text-underline-offset: 3px; cursor: pointer; }
.report-employee-link:hover { color: var(--ok); }
.th { width: 38px; height: 38px; margin-right: 8px; border-radius: 50%; background: var(--line); object-fit: cover; vertical-align: middle; }
.calendar-recess-heading { margin-top: 28px; }
.recess-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 1fr); align-items: end; gap: 8px 18px; }
.recess-form label { margin: 0; }
.recess-form label.chk { min-height: 42px; }
.recess-actions { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
.recess-form .msg { grid-column: 1 / -1; margin: 0; }
.recess-list { margin-top: 16px; }
#calendarEmployees table { width: 100%; min-width: 0; table-layout: fixed; }
.calendar-table th, .calendar-table td { padding: 8px 4px; font-size: 12px; }
.calendar-table th:first-child, .calendar-table td:first-child { width: 23%; }
.calendar-table th:nth-child(2), .calendar-table td:nth-child(2) { width: 14%; }
.calendar-table th:nth-child(n+3):nth-child(-n+9),
.calendar-table td:nth-child(n+3):nth-child(-n+9) { width: 7.5%; }
.calendar-table th:last-child, .calendar-table td:last-child { width: 10.5%; }
.calendar-table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
.calendar-employee { display: flex; align-items: center; gap: 9px; }
.calendar-employee .th { flex: 0 0 38px; margin: 0; }
.calendar-employee > div { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.calendar-employee .tag { display: inline-block; margin-top: 4px; }
.calendar-check-cell { text-align: center; }
.calendar-day { display: inline-flex; align-items: center; justify-content: center; gap: 4px; margin: 0; cursor: pointer; }
.calendar-table td label.calendar-day { width: 100%; min-width: 0; }
.calendar-day input { width: 18px; height: 18px; margin: 0; accent-color: var(--ok); cursor: pointer; }
.calendar-day span { display: none; }
.calendar-schedule-status { display: inline-block; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats .stat { min-height: 112px; text-align: left; color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.stats .stat:hover { border-color: var(--acc); transform: translateY(-2px); box-shadow: var(--shadow); }
.stats b { display: block; margin-bottom: 8px; font-size: 34px; line-height: 1.1; }
.tag { padding: 3px 9px; border-radius: 99px; background: var(--line); font-size: 12px; }
dialog { width: min(520px, 94vw); max-width: 520px; padding: 0; border: 0; border-radius: 14px; background: transparent; }
dialog.wide-dialog { width: min(700px, 94vw); max-width: 700px; }
dialog#dlgReportDetail { width: min(1000px, 96vw); max-width: 1000px; }
dialog.photo-dialog { width: min(760px, 94vw); max-width: 760px; }
dialog::backdrop { background: rgba(6, 12, 24, .62); backdrop-filter: blur(3px); }
dialog .card { max-height: 90vh; overflow-y: auto; }
.row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photoRow { display: flex; align-items: center; gap: 14px; }
.photoRow img { width: 84px; height: 84px; border-radius: 50%; background: var(--line); object-fit: cover; }
.photo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-upload { display: inline-flex; align-items: center; justify-content: center; margin: 0; cursor: pointer; }
.photo-file-input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.photo-upload:has(+ .photo-file-input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--acc) 70%, transparent); outline-offset: 2px; }
.photo-actions small { flex-basis: 100%; }
.previewable { cursor: zoom-in; }
.photo-dialog .card { display: flex; flex-direction: column; }
#photoLarge { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; border-radius: 10px; object-fit: contain; }
.employee-list { display: grid; gap: 8px; }
.arrival-status { margin-top: 3px; font-size: 13px; }
.arrival-status > span { color: var(--mut); }
.arrival-status strong { font-variant-numeric: tabular-nums; }
.report-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.report-metric { display: grid; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.report-metric span { color: var(--mut); font-size: 12px; font-weight: 650; }
.report-metric strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.report-punches { display: grid; grid-template-columns: repeat(2, minmax(100px, 1fr)); gap: 5px; min-width: 220px; }
.report-punch { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); }
.report-punch span { color: var(--mut); font-size: 11px; }
.report-punch strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.report-punch small { grid-column: 1 / -1; color: var(--mut); font-size: 10px; }
.report-weekday, .report-incomplete { display: block; color: var(--mut); font-size: 10px; text-transform: capitalize; }
.report-incomplete { color: #9a6700; font-weight: 650; }
.report-explanation { margin: -7px 0 12px; color: var(--mut); font-size: 12px; }
.report-print-header, .report-print-footer { display: none; }
.timesheet-table { min-width: 1050px; }
.timesheet-table tfoot th, .timesheet-table tfoot td { border-top: 2px solid var(--line); font-weight: 750; }
.report-balance { font-weight: 750; }
.ranking-table { min-width: 760px; }
.ranking-status { font-weight: 750; }
.punch-list { display: grid; gap: 5px; min-width: 190px; }
.punch-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 5px 8px; border-radius: 7px; background: var(--bg); }
.punch-item > span { color: var(--mut); font-size: 12px; }
.punch-item strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.punch-item small { grid-column: 1 / -1; font-size: 11px; }
.punch-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; color: var(--mut); font-size: 12px; }
.employee-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-bottom: 1px solid var(--line); }
.employee-item .th { flex: 0 0 38px; margin: 0; }
.photo-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--mut); font-size: 10px; }
.request-list { display: grid; gap: 16px; }
.request-card { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.3fr); gap: 18px 24px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: var(--shadow); }
.request-evidence { display: flex; align-items: center; gap: 14px; min-width: 0; }
.request-photo { width: 96px; height: 96px; flex: 0 0 96px; border-radius: 12px; background: var(--line); object-fit: cover; }
.request-fields { display: grid; gap: 8px 14px; grid-template-columns: 1fr 1fr; }
.request-fields label { min-width: 0; margin: 0; }
.request-fields .reason-field { grid-column: 1 / -1; }
.request-actions { display: flex; flex-wrap: wrap; gap: 10px; grid-column: 2; }
.request-actions .btn { min-width: 150px; }
.request-card .msg { grid-column: 1 / -1; margin: 0; }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
@media (max-width: 900px) {
  header { gap: 12px; padding: 10px 16px; }
  #tenantInfo { max-width: 38vw; }
  nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  nav button { flex: 1; white-space: nowrap; }
  .right { margin-left: auto; }
  main { padding: 20px 16px 36px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-records, .filters-reports, .filters-ranking { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  header { padding: 10px 12px; }
  .brand { font-size: 20px; }
  .right { gap: 5px; }
  .right .btn { padding: 7px 9px; font-size: 12px; }
  nav { gap: 2px; }
  nav button { padding: 8px 9px; font-size: 13px; }
  .bar { align-items: flex-start; flex-direction: column; }
  .bar .btn { width: 100%; }
  .filters-records, .filters-reports, .filters-ranking { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .filters label:nth-child(3), .filters-records label:nth-child(4), .filters .filter-actions { grid-column: 1 / -1; }
  .filters .filter-actions { flex-wrap: wrap; }
  .filters .filter-actions .btn { flex: 1 1 auto; }
  .two, .three { grid-template-columns: 1fr; gap: 0; }
  .recess-form { grid-template-columns: 1fr; }
  .recess-actions, .recess-form .msg { grid-column: 1; }
  .stats { gap: 9px; }
  .stats .card { min-width: 0; padding: 14px; }
  .stats .stat { padding: 14px; }
  .stats b { font-size: 28px; }
  .card { padding: 15px; }
  .photoRow { align-items: flex-start; flex-direction: column; }
  .request-card { grid-template-columns: 1fr; padding: 16px; }
  .request-actions { grid-column: 1; }
  .request-fields { grid-template-columns: 1fr; }
  .request-fields .reason-field { grid-column: 1; }
  .request-actions .btn { flex: 1; }
  .report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media print {
  @page { size: landscape; margin: 12mm; }
  body, #app { min-height: 0; margin: 0; background: #fff !important; color: #17243b !important; }
  #login, header, .filters, .btn, .report-screen-title, dialog { display: none !important; }
  #app { display: block !important; }
  main { width: 100%; max-width: none; margin: 0; padding: 0; }
  main > section:not(#v-rel) { display: none !important; }
  #v-rel, #v-rel.hide { display: block !important; }
  #v-rel > .card { padding: 0; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
  #reportPrintHeader { display: block; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid #14213d; }
  .report-print-brand { color: #14213d; font-size: 12px; font-weight: 800; letter-spacing: .16em; }
  .report-print-brand span { color: #66738a; font-weight: 600; }
  #reportPrintHeader h1 { margin: 8px 0 3px; font-size: 23px; }
  #reportPrintHeader p { display: inline-block; margin: 0 18px 0 0; color: #526078; font-size: 11px; }
  .report-explanation { margin: 0 0 8px; color: #526078 !important; font-size: 8px; }
  #reportSummary { grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 10px 0; }
  .report-metric { padding: 8px 10px; border-color: #dce2ea; border-radius: 7px; background: #f7f8fa !important; }
  .report-metric span { color: #526078; font-size: 9px; }
  .report-metric strong { color: #17243b; font-size: 15px; }
  .tw, #tabelaRel { overflow: visible !important; }
  .timesheet-table { width: 100%; min-width: 0; table-layout: auto; font-size: 9px; }
  .timesheet-table th, .timesheet-table td { padding: 5px 6px; border-color: #dce2ea; white-space: normal; vertical-align: top; }
  .timesheet-table th { background: #eef1f5 !important; color: #34425a !important; font-size: 8px; }
  .timesheet-table tbody tr { break-inside: avoid; page-break-inside: avoid; }
  .timesheet-table tfoot { display: table-row-group; }
  .timesheet-table tfoot tr { background: #eef1f5 !important; }
  .report-employee-link { color: #17243b !important; text-decoration: none; }
  .report-punches { grid-template-columns: repeat(2, minmax(75px, 1fr)); gap: 3px; min-width: 150px; }
  .report-punch { gap: 1px 5px; padding: 3px 5px; border-color: #e2e6ec; background: #f7f8fa !important; }
  .report-punch span, .report-punch small { color: #526078 !important; font-size: 8px; }
  .report-punch strong { color: #17243b !important; font-size: 9px; }
  .report-incomplete { color: #805500 !important; }
  .pos { color: #176444 !important; }
  .neg { color: #a12c22 !important; }
  #reportPrintFooter { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 7px; border-top: 1px solid #dce2ea; color: #66738a; font-size: 8px; }
  .card { border: 0; box-shadow: none; }
}
