/* ===== Filtros, indicadores, gráficos, linha do tempo e impressão ===== */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 18px; box-shadow: var(--shadow); }
.filters .presets { display: flex; gap: 4px; flex-wrap: wrap; }
.filters .presets button { border: 1px solid transparent; background: none; color: var(--muted); padding: 5px 10px; border-radius: 7px;
  font: inherit; font-weight: 500; cursor: pointer; }
.filters .presets button:hover { background: var(--surface-2); }
.filters .presets button.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.filters .sep { width: 1px; align-self: stretch; background: var(--border); }
.filters .period-label { color: var(--muted); font-size: 13px; margin-left: auto; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .spacer { flex: 1; }
.subtabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.subtabs a { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; border: 1px solid var(--border); background: var(--surface); }
.subtabs a.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.subtabs a:hover { text-decoration: none; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 11px;
  font-weight: 700; background: var(--unproductive); color: #fff; margin-left: 4px; }

.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.delta { font-size: 12px; font-weight: 600; margin-left: 6px; white-space: nowrap; }
.delta.up { color: var(--productive); }
.delta.down { color: var(--unproductive); }
.delta.flat { color: var(--muted); }
.level { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.level.high { background: color-mix(in srgb, var(--productive) 18%, transparent); color: var(--productive); }
.level.medium { background: color-mix(in srgb, var(--idle) 24%, transparent); color: color-mix(in srgb, var(--idle) 65%, var(--text)); }
.level.low { background: color-mix(in srgb, var(--unproductive) 16%, transparent); color: var(--unproductive); }
.level.none { background: var(--surface-2); color: var(--muted); }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .spacer { flex: 1; }
.card-head select { padding: 4px 8px; font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-legend { display: grid; gap: 6px; font-size: 13px; flex: 1; min-width: 160px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.donut-legend b { margin-left: auto; padding-left: 12px; font-variant-numeric: tabular-nums; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart text { fill: var(--muted); font-size: 11px; }
svg.chart .grid line { stroke: var(--border); }
.bg-ocio { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 3px, var(--border) 3px, var(--border) 6px); }
.bg-extra { background: #3b82f6; }

.hbar { display: grid; grid-template-columns: minmax(120px, 36%) 1fr 70px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.hbar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 4px 12px; font: inherit;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.chip b { font-variant-numeric: tabular-nums; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--text); }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
.journey { min-width: 150px; }
.journey .bar { height: 7px; margin-top: 4px; }

/* linha do tempo em blocos de 5 min */
.tl5-wrap { position: relative; }
.tl5 { position: relative; display: grid; grid-template-columns: repeat(288, 1fr); height: 46px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.tl5 .b { height: 100%; }
.tl5 .b.dim { opacity: .15; }
.tl5 .b.l3 { background: var(--productive); }
.tl5 .b.l2 { background: color-mix(in srgb, var(--productive) 62%, var(--surface-2)); }
.tl5 .b.l1 { background: color-mix(in srgb, var(--productive) 32%, var(--surface-2)); }
.tl5 .b.idle { background: var(--idle); }
.tl5 .b.locked { background: var(--locked); }
.tl5 .b.extra { background: #3b82f6; }
.tl5 .b.c-productive { background: var(--productive); }
.tl5 .b.c-neutral { background: var(--neutral); }
.tl5 .b.c-unproductive { background: var(--unproductive); }
.tl5 .mark { position: absolute; top: 0; bottom: 0; width: 2px; background: #f59e0b; pointer-events: none; }
.tl-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.seg-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-toggle button { border: 0; background: var(--surface); color: var(--muted); padding: 5px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.seg-toggle button.active { background: var(--surface-2); color: var(--text); font-weight: 600; }

.classify { display: inline-flex; gap: 3px; }
.classify button { border: 1px solid var(--border); background: var(--surface); width: 30px; height: 26px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--muted); }
.classify button:hover { background: var(--surface-2); }
.classify button.on.productive { background: var(--productive); color: #fff; border-color: var(--productive); }
.classify button.on.neutral { background: var(--neutral); color: #fff; border-color: var(--neutral); }
.classify button.on.unproductive { background: var(--unproductive); color: #fff; border-color: var(--unproductive); }

.ponto-emp { margin-bottom: 12px; padding: 12px 16px; }
.ponto-emp summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(7, minmax(78px, 1fr));
  gap: 8px; align-items: center; }
.ponto-emp summary::-webkit-details-marker { display: none; }
.ponto-emp summary .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ponto-emp summary .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.ponto-emp table { margin-top: 12px; font-size: 13px; }
.neg { color: var(--unproductive); }
.pos { color: var(--productive); }
.sched td, .sched th { padding: 5px 8px; }
.sched input { width: 100%; min-width: 80px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.inline-form label { min-width: 140px; }
.list-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

@media (max-width: 700px) {
  .ponto-emp summary { grid-template-columns: 1fr 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .filters, .no-print, .tabs, .subtabs, button, .btn, .chips { display: none !important; }
  body, main { background: #fff !important; color: #000 !important; }
  main { padding: 0; max-width: none; }
  .card, .kpi { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  details.ponto-emp > table { display: table !important; }
}

/* almoço */
.bg-lunch, .tl5 .b.lunch { background: #a78bfa; }
.bg-lunch-exp { background: repeating-linear-gradient(45deg, #a78bfa 0 3px, transparent 3px 6px); border: 1px solid #a78bfa; }
.tl5 .lunch-band { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, color-mix(in srgb, #a78bfa 30%, transparent) 0 4px, transparent 4px 8px); border-left: 1px dashed #a78bfa; border-right: 1px dashed #a78bfa; pointer-events: none; }
.sched-edit .hint { font-size: 11px; margin-top: 2px; }

/* gravação contínua (player DVR) */
.dvr { padding: 14px; }
.dvr-screen { position: relative; background: #05070d; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 260px; }
.dvr-screen video { width: 100%; max-height: 68vh; display: block; background: #000; cursor: pointer; }
.dvr-screen:fullscreen video { max-height: 100vh; height: 100%; }
.dvr-osd { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.dvr-osd span { background: rgba(0, 0, 0, .68); color: #fff; font: 600 13px/1.3 ui-monospace, Consolas, monospace; padding: 4px 8px; border-radius: 4px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dvr-osd .clock::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; margin-right: 7px; vertical-align: 1px; }
.dvr-msg { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .78); color: #fff; padding: 7px 14px; border-radius: 6px; font-size: 13px; pointer-events: none; }
.dvr-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 12px 0 10px; }
.dvr-bar .btn { min-width: 42px; text-align: center; }
.dvr-time { font: 600 15px ui-monospace, Consolas, monospace; margin-left: 8px; }
.dvr-tl { position: relative; height: 44px; background: var(--surface-2); border-radius: 6px; cursor: pointer; overflow: hidden; user-select: none; }
.dvr-tl i { position: absolute; display: block; }
.dvr-tl .act { top: 4px; height: 14px; }
.dvr-tl .rs { top: 22px; height: 18px; background: color-mix(in srgb, var(--accent) 75%, transparent); border-radius: 2px; }
.dvr-tl .lunch { top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(167, 139, 250, .18) 0 6px, transparent 6px 12px); pointer-events: none; }
.dvr-tl .head { top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ef4444; pointer-events: none; }
.dvr-tl .hov { top: 0; bottom: 0; width: 1px; background: var(--text); opacity: .35; pointer-events: none; }
.dvr-axis { position: relative; height: 18px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.dvr-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.legend i.dvr-rs { background: color-mix(in srgb, var(--accent) 75%, transparent); }
.tl5 .b { cursor: pointer; }
.shot .to-rec { float: right; font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; }
.shot .to-rec:hover { text-decoration: underline; }
