:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1d2428;
  --muted: #65737c;
  --line: #dfe6ea;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --shadow: 0 14px 45px rgba(20, 33, 39, 0.09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #e7eeee;
  color: var(--ink);
}

button.ghost {
  background: transparent;
  color: var(--muted);
}

button.danger {
  color: var(--danger);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  width: max(100%, var(--view-perimeter-width, 100%));
  box-sizing: border-box;
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: #13282c;
  color: white;
  padding: 7px 16px;
}

.brand {
  flex: 0 0 auto;
  margin: 0 8px 0 0;
  color: white;
  font-size: 18px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.nav-item {
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  color: #d7e3e5;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.11);
  color: white;
}

.main {
  min-width: 0;
  padding: 16px;
}

.app-bar-context { display: flex; align-items: center; gap: 6px; margin-left: 0; min-width: 0; }
.alignment-slot { display: inline-flex; flex: 0 0 28px; width: 28px; justify-content: center; }
.alignment-slot .alignment-action { min-width: 26px; width: 26px; padding-inline: 4px; }
.app-bar .title-filters { color: white; flex-wrap: nowrap; }
.app-bar .title-filter .filter-label { color: #b8c9cc; }
.app-bar .title-filter select { min-height: 32px; border-color: rgba(255,255,255,.2); background-color: #fff; }
.alignment-action { min-width: 36px; min-height: 32px; padding: 0 9px; background: rgba(255,255,255,.12); font-size: 18px; }
.alignment-action:hover { background: rgba(255,255,255,.2); }

.topbar,
.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 8px;
}

.filters {
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  justify-content: flex-start;
  margin: 22px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.filters label { flex: 0 0 auto; min-width: 0; }
.filters select { width: auto; min-width: 6.5rem; max-width: 16rem; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.checkbox-label {
  align-content: end;
  grid-template-columns: auto 1fr;
  gap: 9px;
  min-height: 64px;
  color: var(--ink);
  text-transform: none;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
}

.time-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.optional-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
}

.readonly-field {
  background: #f3f6f6;
  color: #48565d;
  cursor: default;
}

.admin-tools button {
  margin-top: 14px;
  border: 1px solid #efc4c0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 13px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.table-wrap {
  width: fit-content;
  max-width: none;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #edf2f4;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #eef4f4;
  color: #405056;
  font-size: 12px;
}

.matrix th:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #f8fbfb;
}

.matrix thead th:first-child {
  z-index: 7;
}

.matrix td {
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  padding: 0;
  text-align: center;
  font-weight: 800;
  cursor: pointer;
}

.matrix th.weekend-day,
.matrix td.weekend-day {
  background-color: #f6f8f9;
  color: #65737c;
}

.matrix th.holiday-day,
.matrix td.holiday-day {
  background-color: #fff8e8;
  color: #725a20;
  box-shadow: inset 0 0 0 1px #ead08a;
}

.matrix td.weekend-day[style],
.matrix td.holiday-day[style] {
  box-shadow: inset 0 -2px 0 rgba(20, 33, 39, 0.18);
}

.matrix td.holiday-day[style] {
  box-shadow: inset 0 -2px 0 #d3a72b;
}

.matrix td:hover {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.annual-matrix td {
  min-width: 34px;
  max-width: 34px;
}

.annual-matrix .disabled-day {
  background: #f1f4f5;
  cursor: default;
}

.annual-matrix .disabled-day:hover {
  outline: 0;
}

.matrix td.selected-day {
  outline: 1px solid #78999a;
  outline-offset: -2px;
  background-color: #f2f8f7;
  box-shadow: 0 2px 5px rgba(28, 55, 60, 0.16), inset 0 0 0 1px rgba(84, 124, 125, 0.14);
}

.annual-matrix td[data-date] { user-select: none; }
.annual-matrix td[data-date] { border-radius: 4px; }
.annual-matrix td.selection-start,
.annual-matrix td.selection-end { outline-width: 2px; }
.annual-matrix td.active-day { outline: 2px solid #496f72; outline-offset: -2px; z-index: 2; }
.annual-matrix td.today-day { box-shadow: inset 0 0 0 1px #789397; }
.annual-matrix td.today-day.selected-day { box-shadow: 0 2px 5px rgba(28, 55, 60, 0.16), inset 0 0 0 1px #789397; }
.annual-matrix td.pending-day:not(.selected-day) { box-shadow: inset 0 -2px 0 #b2a678; }
.annual-matrix td { position: relative; }
.monthly-matrix td[data-date] { position: relative; user-select: none; border-radius: 4px; }
.monthly-matrix td.selection-start, .monthly-matrix td.selection-end { outline-width: 2px; }
.monthly-matrix td.active-day { outline: 2px solid #496f72; outline-offset: -2px; z-index: 2; }
.monthly-matrix td.today-day { box-shadow: inset 0 0 0 1px #789397; }
.monthly-matrix td.today-day.selected-day { box-shadow: 0 2px 5px rgba(28, 55, 60, 0.16), inset 0 0 0 1px #789397; }
.monthly-matrix td.pending-day:not(.selected-day) { box-shadow: inset 0 -2px 0 #b2a678; }
.collaborator-preview {
  position: absolute;
  inset: 2px 2px auto auto;
  color: #526b77;
  font-size: 11px;
  font-style: italic;
  font-weight: 600;
  line-height: 1;
}

.collaborator-context-actions {
  position: sticky;
  top: var(--map-actions-sticky-top, 0);
  z-index: 7;
  display: flex;
  width: var(--view-perimeter-width, fit-content);
  max-width: none;
  flex-wrap: nowrap;
  align-items: end;
  gap: 8px;
  box-sizing: border-box;
  min-height: 62px;
  height: 62px;
  max-height: 62px;
  overflow: hidden;
  border: 0;
  border-radius: 0 0 10px 10px;
  background: var(--panel);
  padding: 10px 12px;
}
.collaborator-context-actions:empty {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.active-map-field { position: relative; z-index: 8; outline: 2px solid #496f72; outline-offset: -2px; }
.context-action-heading { grid-area: dates; display: flex; flex-wrap: wrap; gap: 7px 12px; align-items: baseline; }
.context-action-heading span { color: var(--muted); font-size: 13px; }
.context-action-choices { grid-area: actions; }
.context-action-choices, .context-action-controls { display: flex; flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; }
.context-action-choices button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
.context-action-form { grid-area: fields; display: flex; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; gap: 7px 10px; align-items: end; }
.context-action-form label { display: grid; gap: 3px; font-weight: 400; text-transform: none; }
.context-action-form input, .context-action-form select, .context-action-form textarea { padding: 6px 8px; font-weight: 400; }
.context-ref { flex: 0 0 7rem; }
.context-time { flex: 0 0 8rem; }
.context-obs { flex: 1 1 0; min-width: 4rem; max-width: none; }
.context-intent { flex: 0 0 8rem; }
.context-attachment { display: flex !important; flex: 0 1 auto; flex-direction: row; align-items: center; gap: 6px !important; }
.compact-attach-button { min-height: 32px; padding: 0 10px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0); white-space: nowrap; }
.attachment-preview-list { display: flex; flex: 0 1 auto; flex-wrap: nowrap; gap: 5px 8px; min-width: 0; }
.context-attachment .attachment-preview-list { flex: 0 1 auto; }
.attachment-preview-row { display: inline-flex; max-width: 100%; align-items: center; gap: 6px; border-radius: 6px; background: #f2f6f6; padding: 3px 6px; font-size: 12px; }
.attachment-preview-row > span { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-preview-row .table-action { min-height: 25px; margin: 0; padding: 0 7px; font-size: 12px; }
.attachment-thumbnail { width: 34px; height: 28px; border-radius: 4px; object-fit: cover; }
.submitted-attachments .table-action { min-height: 26px; margin: 1px 4px 1px 0; padding: 0 7px; font-size: 12px; }
.attachment-viewer { width: min(920px, calc(100vw - 28px)); max-width: none; height: min(760px, calc(100dvh - 28px)); max-height: none; border: 0; border-radius: 10px; padding: 0; background: transparent; }
.attachment-viewer::backdrop { background: rgba(25, 36, 40, 0.48); }
.attachment-viewer-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: 100%; height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); box-shadow: 0 18px 55px rgba(20, 34, 38, 0.25); }
.attachment-viewer header, .attachment-viewer footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-color: var(--line); }
.attachment-viewer header { border-bottom: 1px solid var(--line); }
.attachment-viewer footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.attachment-viewer h2 { margin: 0; font-size: 17px; }
.attachment-viewer small { display: block; margin-top: 2px; color: var(--muted); }
.attachment-viewer-content { display: grid; min-height: 0; place-items: center; overflow: auto; background: #eef2f2; }
.attachment-viewer-content img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.attachment-viewer-content iframe { width: 100%; height: 100%; min-height: 420px; border: 0; background: white; }
.attachment-preview-unavailable { max-width: 32rem; margin: 20px; color: var(--muted); text-align: center; }
.attachment-download { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.context-action-controls { flex: 0 0 auto; margin-left: auto; }
.context-action-form input, .context-action-form select { width: auto; max-width: 100%; }
.context-obs textarea { min-width: 0; width: 100%; height: 2rem; min-height: 2rem; max-height: 2rem; overflow: auto; resize: none; white-space: nowrap; }
.context-action-error { flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.context-action-error { min-height: 0; margin: 0; color: var(--danger); font-weight: 700; }
.context-action-error:empty { display: none; }
.context-action-notice { grid-area: notice; flex: 0 1 auto; margin: 0; color: var(--danger); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.context-action-controls { justify-content: flex-end; }
.rh-conflict-dialog { width: min(680px, calc(100vw - 28px)); max-width: none; border: 0; border-radius: 10px; padding: 0; }
.rh-conflict-dialog::backdrop { background: rgba(25, 36, 40, 0.42); }
.rh-conflict-panel { display: grid; gap: 12px; padding: 18px; background: var(--panel); }
.rh-conflict-panel h2, .rh-conflict-panel p { margin: 0; }
.rh-conflict-list { display: grid; gap: 7px; max-height: min(52vh, 420px); overflow-y: auto; }
.rh-conflict-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.rh-conflict-row select { width: auto; min-width: 8rem; }
.rh-conflict-controls { display: flex; justify-content: flex-end; gap: 8px; }
.rh-removal-list { max-height: min(38vh, 300px); margin: 0; overflow-y: auto; }
.rh-removal-dialog textarea { width: 100%; resize: vertical; }
.rh-remove-action { flex: 0 0 auto; }

.collaborator-map-wrap { position: relative; max-height: none; overflow: visible; }
.collaborator-map-wrap .annual-matrix { width: max-content; min-width: 0; table-layout: fixed; }
.collaborator-map-wrap .annual-matrix th:first-child { width: var(--annual-month-width, 108px); min-width: var(--annual-month-width, 108px); max-width: var(--annual-month-width, 108px); }
.annual-scope .annual-matrix tbody th:first-child { font-weight: 400; text-align: right; }
.personal-view .annual-matrix tbody th:first-child { font-weight: 400; }
.collaborator-map-wrap .annual-matrix thead th:not(:first-child):not(:last-child),
.collaborator-map-wrap .annual-matrix td { width: 34px; min-width: 34px; max-width: 34px; }
.annual-matrix .annual-total,
.annual-matrix .annual-total-header { width: var(--annual-total-width, 220px); min-width: var(--annual-total-width, 220px); max-width: var(--annual-total-width, 220px); }
.collaborator-map-wrap .annual-matrix thead th { position: sticky; top: var(--map-table-sticky-top, 0); z-index: 6; }
.monthly-map-wrap { position: relative; max-height: none; overflow: visible; }
.monthly-map-wrap .monthly-matrix { width: max-content; min-width: 0; table-layout: fixed; }
.monthly-map-wrap .monthly-matrix th:first-child { width: var(--monthly-employee-width, 170px); min-width: var(--monthly-employee-width, 170px); max-width: var(--monthly-employee-width, 170px); position: sticky; left: 0; z-index: 5; }
.monthly-map-wrap .monthly-matrix tbody th:first-child { font-weight: 400; }
.monthly-map-wrap .monthly-matrix thead th { position: sticky; top: var(--map-table-sticky-top, 0); z-index: 6; }
.monthly-map-wrap .monthly-matrix thead th:first-child { z-index: 7; }
.monthly-map-wrap .monthly-matrix thead th:not(:first-child):not(:last-child),
.monthly-map-wrap .monthly-matrix td[data-date],
.monthly-map-wrap .monthly-matrix td.disabled-day { width: 34px; min-width: 34px; max-width: 34px; }
.monthly-matrix .monthly-row-total,
.monthly-matrix .monthly-total-header {
  width: var(--monthly-total-width, 180px);
  min-width: var(--monthly-total-width, 180px);
  max-width: var(--monthly-total-width, 180px);
}
.annual-print-action-row { width: min(100%, 1420px); display: flex; justify-content: flex-end; margin: 0 0 6px; }
.annual-print-button { padding: 6px 10px; font-size: 0.82rem; }
.annual-print-dialog { width: min(1180px, calc(100vw - 28px)); max-width: none; height: min(860px, calc(100vh - 28px)); max-height: none; padding: 0; border: 1px solid #aeb8ba; border-radius: 8px; background: #e8ecec; overflow: auto; }
.annual-print-dialog::backdrop { background: rgba(24, 36, 38, 0.48); }
.annual-print-controls { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 8px 12px; background: #f7f9f9; border-bottom: 1px solid #ccd4d5; }
.annual-print-controls strong { margin-right: auto; font-size: 0.9rem; }
.annual-print-sheet { box-sizing: border-box; width: 1120px; min-height: 790px; margin: 16px auto; padding: 30px 32px 24px; color: #202829; background: white; box-shadow: 0 2px 12px rgba(29, 43, 45, 0.16); }
.annual-print-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 10px; border-bottom: 1px solid #758386; padding-bottom: 5px; }
.annual-print-heading h1 { margin: 0; font-size: 20px; font-weight: 600; }
.annual-print-heading p { display: flex; gap: 22px; margin: 0; font-size: 13px; }
.annual-print-map { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 10px; }
.annual-print-map th, .annual-print-map td { height: 30px; padding: 0; border: 1px solid #aeb7b9; text-align: center; vertical-align: middle; position: relative; overflow: hidden; }
.annual-print-map thead th { height: 22px; background: #eef1f1; font-weight: 500; }
.annual-print-map th:first-child { width: 42px; font-weight: 400; text-transform: uppercase; }
.annual-print-map th:last-child, .annual-print-map td:last-child { width: 94px; padding: 2px 4px; text-align: left; font-size: 8px; line-height: 1.15; }
.annual-print-map td.disabled-day { background: #e5e8e8; }
.annual-print-map td.weekend-day { background: #f1f2f2; }
.annual-print-map td.holiday-day { background: #e9e3d5; box-shadow: inset 0 -2px 0 #ae9566; }
.annual-print-map [data-type-letter] { font-size: 12px; font-weight: 600; }
.annual-print-map [data-type-letter="A"] { color: #8d3f3f; }
.annual-print-map [data-type-letter="B"] { color: #76454a; }
.annual-print-map [data-type-letter="C"] { color: #356b70; }
.annual-print-map [data-type-letter="F"] { color: #a45f2a; }
.annual-print-map [data-type-letter="I"] { color: #793f35; }
.annual-print-map [data-type-letter="J"] { color: #8a6a24; }
.annual-print-map [data-type-letter="N"] { color: #526b7a; }
.annual-print-map [data-type-letter="P"] { color: #6d607d; }
.annual-print-map [data-type-letter="T"] { color: #526f4d; }
.annual-print-map .partial-time-marker { width: 0; height: 0; border-left: 4px solid transparent; border-top: 4px solid #40585b; background: transparent; border-radius: 0; }
.annual-print-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 14px; margin-top: 10px; font-size: 10px; }
.annual-print-summary strong { font-weight: 600; }
.annual-print-summary span { white-space: nowrap; }
.annual-print-legend { margin: 7px 0 0; color: #536164; font-size: 8px; line-height: 1.3; }
.annual-print-parental { display: flex; gap: 8px; flex: 1 0 100%; }
.annual-print-observations { margin-top: 8px; break-before: auto; break-inside: avoid; }
.annual-print-observations h2 { margin: 0 0 5px; font-size: 12px; }
.annual-print-observations table { width: 100%; border-collapse: collapse; font-size: 9px; }
.annual-print-observations th, .annual-print-observations td { padding: 2px 5px; border: 1px solid #c7cecf; text-align: left; vertical-align: top; }
.annual-print-observations th:first-child { width: 78px; }
.annual-print-observations th:nth-child(2) { width: 110px; }
.annual-print-complementary { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; align-items: start; }
.annual-print-complementary > section:only-child { grid-column: 1 / -1; }
.annual-print-complementary td:last-child { max-width: 0; overflow-wrap: anywhere; }

@page { size: A4 landscape; margin: 8mm; }

@media print {
  html, body { width: auto; min-width: 0; height: auto; margin: 0; padding: 0; background: white; }
  body > * { display: none !important; }
  body > .annual-print-dialog[open] { display: block !important; position: static; width: auto; height: auto; margin: 0; padding: 0; border: 0; overflow: visible; background: white; }
  .annual-print-dialog::backdrop, .annual-print-controls { display: none !important; }
  .annual-print-sheet { width: 100%; min-height: 0; margin: 0; padding: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .annual-print-heading { margin-bottom: 2.5mm; padding-bottom: 1.5mm; }
  .annual-print-heading h1 { font-size: 14pt; }
  .annual-print-heading p { font-size: 9pt; }
  .annual-print-map { font-size: 6.5pt; }
  .annual-print-map th, .annual-print-map td { height: 7.5mm; }
  .annual-print-map thead th { height: 5.5mm; }
  .annual-print-map th:first-child { width: 11mm; }
  .annual-print-map th:last-child, .annual-print-map td:last-child { width: 24mm; font-size: 5.5pt; }
  .annual-print-map [data-type-letter] { font-size: 8pt; }
  .annual-print-summary { margin-top: 2.5mm; gap: 1.5mm 4mm; font-size: 7pt; }
  .annual-print-legend { margin-top: 1.5mm; font-size: 6pt; }
  .annual-print-observations { margin-top: 4mm; }
  .annual-print-observations table { font-size: 7pt; }
}
.monthly-row-total { padding: 7px 10px; text-align: left; font-size: 12px; font-weight: 400; }
.monthly-context-actions { box-sizing: border-box; margin-bottom: 10px; }
.monthly-employee-resizer { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.monthly-employee-resizer::after { content: ""; position: absolute; top: 20%; bottom: 20%; left: 3px; border-right: 1px solid #91a0a5; }
.rh-official-controls { grid-area: fields; display: flex; flex: 1 1 auto; width: 100%; min-width: 0; flex-wrap: nowrap; align-items: end; gap: 7px 10px; }
.rh-type-chooser { flex: 0 0 13rem; min-width: 0; font-weight: 400; text-transform: none; }
.rh-type-chooser select { width: 100%; padding: 6px 8px; }
.suggested-value { color: #8a9498; }
.annual-rh-actions { box-sizing: border-box; margin-bottom: 10px; }
.personal-view > .collaborator-context-actions { box-sizing: border-box; }
body[data-current-view="colaborador"] .collaborator-context-actions { background-color: #f1f6fa; }
body[data-current-view="mensal"] .collaborator-context-actions { background-color: #f1f6f4; }
body[data-current-view="anual"] .collaborator-context-actions { background-color: #faf7ef; }
body[data-current-view="colaborador"] .collaborator-context-actions:empty,
body[data-current-view="mensal"] .collaborator-context-actions:empty,
body[data-current-view="anual"] .collaborator-context-actions:empty { background-color: var(--bg); }
:is(.annual-matrix, .monthly-matrix) { border-collapse: separate; border-spacing: 1px; }
:is(.annual-matrix, .monthly-matrix) td[data-date] { border-radius: 4px; background-clip: padding-box; }
.partial-time-marker { position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; background: currentColor; opacity: 0.58; pointer-events: none; }
.legacy-time-marker { position: absolute; top: 2px; right: 2px; width: 0; height: 0; border-left: 6px solid transparent; border-top: 6px solid #6f7779; opacity: 0.72; pointer-events: none; }
.annual-print-map .legacy-time-marker { border-left-width: 4px; border-top-width: 4px; }
.data-table tr[aria-selected="true"] { outline: 2px solid var(--accent); outline-offset: -2px; background: #eef7f6; }

.annual-total {
  padding: 7px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 400;
}
.annual-matrix td.annual-total { font-weight: 400; }
.annual-total-header { position: sticky; }
.annual-total-resizer { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.annual-total-resizer::after { content: ""; position: absolute; top: 20%; bottom: 20%; left: 3px; border-right: 1px solid #91a0a5; }
.resizable-history { width: fit-content; min-width: 0; table-layout: fixed; }
.resizable-history th, .resizable-history td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resizable-history td[data-column-key="actions"] { white-space: normal; }
.resizable-history td[data-column-key="actions"] .table-action { display: block; width: 100%; max-width: 100%; height: auto; margin: 3px 0; box-sizing: border-box; white-space: normal; overflow-wrap: anywhere; }
.resizable-history thead th { position: sticky; }
.history-column-resizer { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.history-column-resizer::after { content: ""; position: absolute; top: 20%; bottom: 20%; left: 3px; border-right: 1px solid #9aa8ac; }
.resizable-history thead th[draggable="true"] { cursor: grab; }
.resizable-history thead th.column-dragging { opacity: 0.62; }
.resizable-history thead th.column-drop-before { box-shadow: inset 2px 0 #69878c; }
.resizable-history thead th.column-drop-after { box-shadow: inset -2px 0 #69878c; }

.type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 8px;
}

.split-view {
  display: grid;
  gap: 18px;
}

.personal-view {
  display: grid;
  gap: 16px;
}

.day-summary {
  border-block: 1px solid var(--line);
  background: var(--panel);
  padding: 13px 0;
}

.day-detail-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 0;
  font-size: 13px;
}
.day-detail-line span { display: inline-flex; align-items: center; }
.day-detail-line span + span::before { content: "|"; margin: 0 9px; color: var(--line); }

.personal-scope .map-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 16px;
}
.personal-scope .map-header .topbar { grid-column: 1; }
.personal-scope .map-header .filters {
  grid-column: 2;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.personal-scope .map-header .filters label { min-width: auto; }
.personal-scope .map-header .filters select { width: auto; min-width: 6.5rem; }
.personal-scope .map-header .summary-grid { grid-column: 1 / -1; margin-top: 6px; margin-bottom: 8px; }
.personal-scope .summary-card { min-width: 102px; padding: 7px 10px; }
.personal-scope .summary-card strong { margin-top: 2px; font-size: 19px; }

.day-summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 14px 11px;
}

.day-summary-heading small,
.day-summary-heading strong {
  display: block;
}

.day-summary-heading small,
.day-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.day-summary-heading strong {
  margin-top: 3px;
  font-size: 20px;
}

.day-summary-heading span {
  color: var(--muted);
  font-size: 13px;
}

.summary-action {
  margin-left: auto;
}

.day-summary dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--line);
}

.day-summary dl > div {
  min-width: 0;
  background: var(--panel);
  padding: 10px 14px;
}

.day-summary dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.day-summary .summary-wide {
  grid-column: span 2;
}

.stack-section h2 {
  margin: 0 0 10px;
  font-size: 17px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 8px;
  background: #eef2f2;
  color: #405056;
  font-weight: 700;
}

.status-submitted,
.status-review {
  background: #fff4ce;
  color: #6f4e00;
}

.status-approved {
  background: #dff3e4;
  color: #1f6b3a;
}

.status-rejected,
.status-canceled {
  background: #fde7e9;
  color: #a4262c;
}

.table-action {
  min-height: 30px;
  margin-right: 6px;
  padding: 0 10px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.config-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.config-grid h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.config-grid p {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 800;
}

.config-grid small {
  color: var(--muted);
  line-height: 1.5;
}

.dialog {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

.dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.dialog header, .dialog footer, .form-dates { flex-shrink: 0; }
.form-dates { padding: 12px 18px; display: grid; gap: 8px; }
.form-scroll { min-height: 48px; overflow-y: auto; overscroll-behavior: contain; }
.dialog .form-error:empty { display: none; }
.dialog .form-error { max-height: 70px; overflow-y: auto; flex-shrink: 0; }

.dialog::backdrop {
  background: rgba(11, 23, 27, 0.48);
}

.dialog header,
.dialog footer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog footer {
  grid-template-columns: auto 1fr auto auto;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog h2 {
  margin: 0;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: #eef2f2;
  color: var(--ink);
  font-size: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.wide {
  grid-column: 1 / -1;
}

.date-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.date-trigger {
  width: 100%;
  text-align: left;
}

.date-picker {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
}

.date-picker-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.date-picker-nav strong { font-size: 14px; }
.date-picker-nav button { padding: 0 12px; }

.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.date-picker-grid abbr {
  text-align: center;
  padding: 7px 0;
  text-decoration: none;
  font-weight: 700;
}

.calendar-date {
  min-width: 0;
  min-height: 36px;
  padding: 0;
  background: #f0f4f4;
  color: var(--ink);
}

.calendar-weekend { --day-background: #e9edf9; background: #e9edf9; color: #40558a; }
.calendar-holiday { --day-background: #fff0d3; background: #fff0d3; color: #845000; }
.calendar-date:disabled { cursor: not-allowed; text-decoration: line-through; }
.calendar-date:hover:enabled { background: var(--day-background, #f0f4f4); outline: 2px solid var(--accent); outline-offset: -2px; }
.calendar-date[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 800; }
.date-picker button:focus-visible, .date-trigger:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.calendar-legend { display: flex; gap: 8px; margin: 10px 0 0; font-size: 12px; }
.calendar-legend span { padding: 3px 6px; border-radius: 4px; }
.period-info { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.date-picker { width: 100%; }
.calendar-conflict { text-decoration: line-through; text-decoration-thickness: 2px; }
.calendar-date.range-interior { box-shadow: inset 0 -3px var(--accent), inset 0 3px var(--accent); border-radius: 0; }
.calendar-date.range-endpoint { box-shadow: inset 0 0 0 3px var(--accent); border-radius: 9px; font-weight: 800; }
.calendar-date.calendar-conflict { outline: 1px dashed var(--danger); outline-offset: -2px; }
.interval-conflicts { color: var(--danger); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.occurrence-pending { font-style: italic; font-weight: 400; color: #69788b; }
.occurrence-official { font-style: normal; font-weight: 800; color: var(--ink); }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="A"] { color: #8d3f3f; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="B"] { color: #76454a; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="C"] { color: #356b70; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="F"] { color: #a45f2a; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="I"] { color: #793f35; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="J"] { color: #8a6a24; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="N"] { color: #526b7a; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="P"] { color: #6d607d; }
:is(.annual-matrix, .monthly-matrix) [data-type-letter="T"] { color: #526f4d; }
:is(.annual-matrix, .monthly-matrix) td.past-day [data-type-letter] { color: #9aa2a5; font-weight: 400; }
.matrix td > span + span { margin-left: 3px; }
.calendar-date { position: relative; display: flex; align-items: center; justify-content: center; gap: 5px; }
.calendar-occurrences { display: inline-flex; gap: 2px; font-size: 11px; }

@media (max-height: 850px) {
  .dialog header, .dialog footer { padding: 8px 12px; }
  .dialog h2 { font-size: 19px; }
  .form-dates { padding: 8px 12px; gap: 5px; }
  .date-field { gap: 4px; }
  .calendar-date { min-height: 30px; }
  .date-picker-grid abbr { padding: 3px 0; }
  .calendar-legend { margin-top: 5px; gap: 4px; font-size: 11px; }
  .calendar-legend span { padding: 2px 4px; }
  .period-info { font-size: 12px; line-height: 1.3; }
  .date-picker-nav { margin-bottom: 4px; }
}

@media (max-height: 600px) and (min-width: 600px) {
  .dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 8px); }
  .dialog form { max-height: calc(100dvh - 8px); }
  .dialog header, .dialog footer { padding: 4px 8px; }
  .dialog header button, .dialog footer button { min-height: 28px; }
  .form-dates { padding: 4px 8px; gap: 3px; }
  .form-scroll { min-height: 32px; padding: 8px; }
  .date-picker .period-info { display: none; }
  .form-dates .date-field { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
  .form-dates .date-picker { grid-column: 1 / -1; }
  .date-trigger { min-height: 26px; font-size: 12px; }
  .date-picker { padding: 4px; }
  .date-picker-nav button { min-height: 24px; }
  .calendar-legend { margin-top: 2px; font-size: 10px; }
  .date-picker-grid { gap: 2px; }
  .date-picker-grid abbr { padding: 0; font-size: 11px; }
  .calendar-date { min-height: 20px; }
}

.form-error {
  min-height: 22px;
  margin: 0;
  padding: 0 18px 16px;
  color: var(--danger);
  font-weight: 700;
}

/* Shared calendar and map context; day backgrounds stay owned by day nature. */
.dialog { width: min(1080px, calc(100vw - 28px)); }
.date-trigger { display: block; border-radius: 7px; background: #e7eeee; padding: 8px 10px; color: var(--ink); }
.calendar-day-number.has-content { font-style: italic; color: #69788b; font-weight: 400; }
.calendar-date-description { margin: 3px 0 0; font-size: 12px; line-height: 1.2; }
@media (max-height: 700px) and (max-width: 599px) {
  .calendar-date { min-height: 24px; }
  .date-picker { padding: 5px; }
  .calendar-legend { flex-wrap: wrap; }
}
.calendar-day-details p { margin: 5px 0; }
.calendar-day-details small { display: block; color: var(--muted); }
.process-choice { display: block; width: 100%; height: auto; text-align: left; white-space: normal; overflow-wrap: anywhere; margin: 5px 0; padding: 8px; }
.process-choice[aria-pressed="true"], tr[data-process-id]:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.map-header { position: sticky; top: 46px; z-index: 8; background: var(--bg); padding: 6px 0; }
.main .map-header { width: min(100%, 1420px); border-radius: 10px; padding: 7px 9px; }
.monthly-scope .map-header { width: min(100%, 1260px); }
:is(.personal-scope, .monthly-scope, .annual-scope, .data-scope, .company-scope) .map-header {
  width: var(--view-perimeter-width, max-content);
  max-width: none;
}
:is(.monthly-scope, .data-scope, .company-scope) #view,
.personal-scope .collaborator-map-wrap,
.annual-scope .collaborator-map-wrap,
.data-scope .table-wrap {
  width: var(--view-perimeter-width, max-content);
  max-width: none;
}
:is(.data-scope, .company-scope) .table-wrap { max-height: none; overflow: visible; }
:is(.data-scope, .company-scope) .data-table thead th { top: var(--map-table-sticky-top, 0); }
:is(.personal-scope, .monthly-scope, .annual-scope, .data-scope, .company-scope) .map-header .summary-grid { overflow: visible; }
body[data-current-view="colaborador"] .map-header { background: #f1f6fa; }
body[data-current-view="mensal"] .map-header { background: #f1f6f4; }
body[data-current-view="anual"] .map-header { background: #faf7ef; }
body:is([data-current-view="colaborador"], [data-current-view="mensal"], [data-current-view="anual"]) .map-header {
  border-radius: 10px 10px 0 0;
}
body[data-current-view="dados"] .map-header { background: #f2f5f7; }
body[data-current-view="config"] .map-header { background: #f5f5f3; }
body[data-current-view="colaborador"] .nav-item.active { background: #38566d; }
body[data-current-view="mensal"] .nav-item.active { background: #365f56; }
body[data-current-view="anual"] .nav-item.active { background: #675b3d; }
body[data-current-view="dados"] .nav-item.active { background: #435966; }
body[data-current-view="config"] .nav-item.active { background: #515956; }
.monthly-scope .map-header, .annual-scope .map-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 12px;
}
.title-row { display: flex; align-items: center; min-width: 0; gap: 8px; flex-wrap: wrap; }
.title-row > h1 { flex: 0 0 auto; }
.title-row > p { flex: 1 0 100%; min-height: 1.15em; }
.title-filters { display: inline-flex; align-items: center; min-width: 0; gap: 8px; }
.title-filters:not(:empty)::before { content: "—"; color: var(--muted); }
.title-filter { display: inline-flex; align-items: center; min-width: 0 !important; gap: 6px; }
.title-filter + .title-filter::before { content: "—"; color: var(--muted); }
.title-filter + #employeeFilter::before { content: none; }
.title-filter .filter-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: nowrap; font-size: inherit; color: inherit; text-transform: none; }
.title-filter select { width: auto !important; min-width: 5.6rem !important; max-width: 15rem; padding: 5px 24px 5px 7px; font-weight: 500; text-overflow: ellipsis; }
.annual-scope #employeeFilter .filter-label, .monthly-scope #monthFilter .filter-label { display: none; }
.title-actions { display: inline-flex; margin-left: auto; }
.annual-scope .map-header, .monthly-scope .map-header { grid-template-rows: auto auto; }
.annual-scope .map-header .topbar, .monthly-scope .map-header .topbar { grid-column: 1 / -1; grid-row: 1; }
.annual-scope .map-header .topbar h1, .monthly-scope .map-header .topbar h1 { grid-column: auto; grid-row: auto; }
.annual-scope .map-header .topbar p, .monthly-scope .map-header .topbar p { min-height: 1.15em; margin: 0; color: var(--muted); }
.annual-scope .map-header .summary-grid, .monthly-scope .map-header .summary-grid { grid-row: 2; }
.annual-scope .map-header > .filters, .monthly-scope .map-header > .filters { display: none; }
.annual-scope .collaborator-map-wrap, .personal-view .collaborator-map-wrap { max-height: none; }
.focused-employee-row > th { box-shadow: inset 3px 0 var(--accent); background: #edf6f4; }
.existing-record-obs { grid-area: obs; display: flex; flex: 1 1 28rem; min-width: 0; flex-wrap: nowrap; align-items: end; gap: 8px; }
.existing-record-obs label { flex: 1 1 auto; min-width: 12rem; }
.existing-record-obs textarea { width: 100%; height: 2rem; min-height: 2rem; max-height: 2rem; overflow: auto; resize: none; white-space: nowrap; }
.existing-record-obs small { min-width: 8rem; color: var(--muted); }
.rh-type-chooser { flex-basis: 10.5rem; min-width: 10.5rem; max-width: 12rem; }
#recordType, #requestTypeChoice { width: min(100%, 12rem); }
.annual-information { width: min(100%, 1420px); margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.annual-information h2 { margin: 0 0 8px; font-size: 16px; }
.annual-information-totals { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }
.annual-information-legend { margin: 9px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.annual-notes { width: min(100%, 1420px); margin-top: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.annual-notes h2 { margin: 0 0 7px; font-size: 16px; }
.annual-notes-list { display: grid; gap: 4px; }
.annual-notes-list p { margin: 0; font-size: 13px; }
.annual-print-notes { break-inside: avoid; margin-top: 3mm; }
.annual-print-complementary .annual-print-notes { margin-top: 8px; }
.annual-print-notes h2 { margin: 0 0 2mm; font-size: 11pt; }
.annual-print-notes table { width: 100%; border-collapse: collapse; }
.annual-print-notes th, .annual-print-notes td { border: 1px solid #b7c0c4; padding: 1.2mm 1.6mm; text-align: left; font-size: 8pt; }
.annual-scope .collaborator-map-wrap { width: var(--view-perimeter-width, max-content); max-width: none; }
.personal-view > .collaborator-context-actions { order: 1; }
.personal-view > .collaborator-map-wrap { order: 2; }
.personal-view > section:last-child { order: 4; }
.monthly-all-months { display: grid; gap: 16px; }
.monthly-month-section > h2 { margin: 0 0 5px; font-size: 15px; }
.monthly-all-months .monthly-map-wrap { max-height: none; }
.app-bar .title-filters:not(:empty)::before { content: none; }
.app-bar .title-filter + .title-filter::before { color: #b8c9cc; }
.monthly-scope .map-header .topbar, .annual-scope .map-header .topbar,
.monthly-scope .map-header .topbar > div, .annual-scope .map-header .topbar > div { display: contents; }
.monthly-scope .map-header .topbar h1, .annual-scope .map-header .topbar h1 { grid-column: 1 / -1; grid-row: 1; margin: 0; }
.monthly-scope .map-header .topbar p, .annual-scope .map-header .topbar p { grid-column: 1; grid-row: 2; margin: 0; }
.monthly-scope .map-header .filters, .annual-scope .map-header .filters { grid-column: 2; grid-row: 2; justify-self: end; width: auto; margin: 0; padding: 0; border: 0; background: transparent; }
.monthly-scope .map-header .filters label, .annual-scope .map-header .filters label { min-width: auto; }
.monthly-scope .map-header .filters select, .annual-scope .map-header .filters select { width: auto; min-width: 6.5rem; }
.monthly-scope .map-header .summary-grid, .annual-scope .map-header .summary-grid { grid-column: 1 / -1; grid-row: 3; margin: 6px 0 8px; }
.monthly-context-actions, .annual-rh-actions { padding-block: 7px; gap: 5px 9px; }
.monthly-context-actions .context-action-heading, .annual-rh-actions .context-action-heading { margin: 0; }
.monthly-context-actions .context-action-form, .annual-rh-actions .context-action-form { gap: 5px 8px; }
.monthly-context-actions .context-action-notice, .annual-rh-actions .context-action-notice { color: var(--muted); font-weight: 400; }
.map-header .filters { margin: 8px 0; padding: 0; border: 0; background: transparent; }
.map-header .summary-grid { display: flex; overflow-x: auto; margin: 8px 0 0; padding: 2px; }
.summary-card { flex: 0 0 auto; min-width: 110px; text-align: left; color: var(--ink); padding: 8px 12px; }
.summary-card:hover { background: #eef4f4; }
.summary-card strong { font-size: 19px; }
.summary-card[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
.matrix td.summary-highlight { outline: 3px solid #a77916; outline-offset: -3px; }
.summary-highlight:not(td) { outline: 2px solid #a77916; outline-offset: -2px; }
.employee-context { margin-top: 18px; }
.employee-context label { color: #d7e3e5; }
.calendar-actions { margin: 12px 0; flex-wrap: wrap; }
.conflict-review { margin-top: 18px; padding: 14px; border: 1px solid var(--danger); background: white; }
.conflict-review fieldset { margin: 12px 0; border: 1px solid var(--line); }
.monthly-scope .map-header .topbar, .annual-scope .map-header .topbar { display: block; grid-column: 1 / -1; grid-row: 1; }
.monthly-scope .map-header .topbar > .title-row, .annual-scope .map-header .topbar > .title-row { display: flex; }
.monthly-scope .map-header .topbar h1, .annual-scope .map-header .topbar h1 { grid-column: auto; grid-row: auto; }
.monthly-scope .map-header .topbar p, .annual-scope .map-header .topbar p { grid-column: auto; grid-row: auto; }
.monthly-scope .map-header .summary-grid, .annual-scope .map-header .summary-grid { grid-row: 2; }

/* Cabeçalho compacto dos mapas: os filtros fazem parte do título. */
.monthly-scope .map-header .topbar > .title-row,
.annual-scope .map-header .topbar > .title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.monthly-scope .title-filters,
.annual-scope .title-filters {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
}
.monthly-scope .title-filter,
.annual-scope .title-filter {
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  width: auto;
}
.monthly-scope .title-filter select,
.annual-scope .title-filter select {
  width: auto !important;
  min-width: 5.6rem !important;
  max-width: 14rem;
}
.monthly-scope .title-actions,
.annual-scope .title-actions { margin-left: auto; }
.monthly-scope .title-row > p { flex: 1 0 100%; }
.annual-scope .title-row > p[hidden] { display: none; }
@media (max-width: 860px) {
  .app-bar { position: sticky; width: 100%; min-width: 100vw; flex-wrap: wrap; padding: 6px 9px; gap: 4px 7px; }
  .brand { margin-right: 3px; }
  .nav { order: 2; width: 100%; overflow-x: auto; }
  .nav-item { flex: 0 0 auto; padding-inline: 8px; }
  .app-bar-context { margin-left: 0; max-width: 100%; overflow-x: auto; }
  .app-bar .title-filter .filter-label { display: none; }
  .app-bar .title-filter select { max-width: 9.5rem; }
  .map-header { top: 78px; }
  .map-header .topbar h1 { font-size: 21px; }
  .map-header .topbar p { font-size: 12px; }
  .map-header .filters { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .map-header .filters label { flex: 0 0 auto; min-width: 0; }
  .employee-context { margin-top: 10px; }
  .collaborator-context-actions { flex-wrap: nowrap; }
  .personal-scope .map-header { display: block; }
  .personal-scope .map-header .filters { margin: 6px 0; padding: 7px; }
  .personal-scope .map-header .filters select { width: auto; max-width: min(16rem, 70vw); }
  .monthly-scope .map-header, .annual-scope .map-header { display: block; }
  .monthly-scope .map-header .topbar, .annual-scope .map-header .topbar,
  .monthly-scope .map-header .topbar > div, .annual-scope .map-header .topbar > div { display: block; }
  .monthly-scope .map-header .topbar > .title-row, .annual-scope .map-header .topbar > .title-row { display: flex; }
  .title-actions { margin-left: 0; }
  .title-filter select { max-width: 11rem; }
  .monthly-scope .map-header .filters, .annual-scope .map-header .filters { margin: 6px 0; padding: 7px; }
  .monthly-scope .map-header .filters select, .annual-scope .map-header .filters select { width: auto; max-width: min(16rem, 70vw); }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    top: 0;
    z-index: 5;
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filters {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar button,
  .filters button {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .time-range {
    grid-template-columns: 1fr;
  }

  .day-summary dl {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .day-summary .summary-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .attachment-viewer { width: calc(100vw - 12px); height: calc(100dvh - 12px); }
  .attachment-viewer-content iframe { min-height: 280px; }
  .attachment-viewer header, .attachment-viewer footer { padding: 8px; }
  .day-summary dl {
    grid-template-columns: 1fr;
  }

  .day-summary .summary-wide {
    grid-column: auto;
  }
}
