* {
  box-sizing: border-box;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card);
  color: var(--ink);
  padding: 8px 13px;
}
button:hover {
  background: var(--muted);
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}
.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.primary:hover {
  background: var(--primary-hover);
}
.danger {
  color: var(--red);
}
.workspace {
  padding: 28px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
h1 {
  font-size: 27px;
  line-height: 1.2;
  margin: 0 0 8px;
}
h2 {
  font-size: 19px;
  margin: 0 0 14px;
}
h3 {
  font-size: 16px;
  margin: 16px 0 8px;
}
p {
  margin: 8px 0;
}
.sub {
  color: var(--muted-foreground);
  font-size: 14px;
}
.actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar {
  margin: 16px 0;
}
.toolbar input {
  flex: 1;
  min-width: 190px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.stat small {
  display: block;
  color: var(--muted-foreground);
  font-size: 14px;
}
.stat strong {
  font-size: 32px;
  display: block;
  margin: 7px 0 2px;
  letter-spacing: -1px;
}
.stat .hint {
  font-size: 12px;
  color: var(--muted-foreground);
}
.split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
.panel {
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-head h2 {
  margin: 0;
}
.table-wrap {
  overflow: auto;
}
.daily-report-bu {
  padding-top: 18px;
  margin-top: 22px;
  border-top: 1px solid var(--border);
}
.daily-report-bu h3,
.daily-report-bu h4 {
  margin: 0 0 10px;
}
.daily-report-bu h4 {
  margin-top: 18px;
}
.daily-report-bu ul {
  margin: 0;
  padding-left: 18px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th {
  text-align: left;
  background: var(--muted);
  font-weight: 600;
  color: var(--muted-foreground);
}
th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
td button {
  padding: 5px 9px;
  font-size: 14px;
}
.empty {
  padding: 35px 20px;
  text-align: center;
  border: 1px dashed var(--input);
  border-radius: 9px;
  color: var(--muted-foreground);
}
.empty strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  line-height: 1.5;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--muted);
  color: var(--foreground);
  white-space: nowrap;
}
.badge.red {
  background: var(--danger-soft);
  color: var(--danger-soft-fg);
}
.badge.teal {
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
}
.badge.dark {
  background: var(--indigo-soft);
  color: var(--indigo-soft-fg);
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 7px;
}
.board-frame {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: auto;
  max-height: 72vh;
}
.board {
  min-width: 2480px;
  table-layout: fixed;
}
.board th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--muted);
}
.board th:first-child,
.board td:first-child {
  width: 145px;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}
.board th:first-child {
  z-index: 3;
}
.board td {
  padding: 10px;
  border-right: 1px solid var(--border);
  height: 180px;
}
.drop {
  min-height: 150px;
}
.drop.over {
  background: var(--accent-soft);
  outline: 2px dashed var(--accent);
  outline-offset: -3px;
}
.postit {
  display: block;
  width: 100%;
  text-align: left;
  color: #21323d;
  border: 1px solid #00000012;
  border-left: 4px solid #00000018;
  border-radius: 6px;
  padding: 11px;
  margin: 0 0 9px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 6%);
  font-size: 14px;
  cursor: grab;
  white-space: normal;
}
.postit:hover {
  filter: brightness(0.97);
}
.postit.green {
  background: #d7edbf;
}
.postit.yellow {
  background: #fff0ad;
}
.postit.pink {
  background: #f8cedf;
}
.postit.blue {
  background: #c8e4f9;
}
.postit.overdue {
  border: 2px solid #c52d40;
  border-left-width: 5px;
}
.postit .code {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.postit .description {
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
.postit .meta {
  font-size: 12px;
  margin-top: 5px;
}
.backlog {
  display: flex;
  gap: 12px;
  overflow: auto;
  padding: 6px 2px;
  min-height: 95px;
}
.backlog .postit {
  min-width: 215px;
  width: 215px;
}
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted-foreground);
  margin: 14px 0;
}
.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.notice {
  background: var(--accent-soft);
  color: var(--accent-soft-fg);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  margin: 12px 0 18px;
}
.tabs {
  display: flex;
  gap: 8px;
  margin: 15px 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.tabs button.selected {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
}
.list {
  display: grid;
  gap: 12px;
}
.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
}
.list-item small {
  display: block;
  color: var(--muted-foreground);
  font-size: 12px;
  margin-top: 5px;
}
.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 55px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  margin: 15px 0;
}
.bar {
  background: var(--muted);
  height: 9px;
  border-radius: 10px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--teal);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(920px, 94vw);
  max-height: 92vh;
  padding: 0;
  color: var(--ink);
}
dialog::backdrop {
  background: rgb(9 9 11 / 55%);
  backdrop-filter: blur(2px);
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 5;
}
.modal-head h2 {
  margin: 0;
}
.modal-body {
  padding: 22px 24px;
}
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--card);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 14px;
  font-weight: 600;
}
.field.full {
  grid-column: 1/-1;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--input);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--background);
  font-size: 14px;
}
input[type='checkbox'] {
  width: auto;
}
input[type='color'] {
  height: 42px;
}
textarea {
  resize: vertical;
  min-height: 80px;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring-soft);
}
.required {
  color: var(--red);
}
.error {
  color: var(--red);
  font-size: 14px;
}
/* Erro do formulário: linha própria no topo do rodapé fixo, só quando há mensagem. */
.modal-foot {
  flex-wrap: wrap;
}
.modal-foot #form-error {
  flex: 1 0 100%;
  order: -2;
  margin: 0;
  font-weight: 600;
}
.modal-foot #form-error:empty {
  display: none;
}
.timeline {
  border-left: 2px solid var(--border);
  padding-left: 18px;
  margin-left: 5px;
}
.event {
  margin: 15px 0;
  position: relative;
  font-size: 14px;
}
.event:before {
  content: '';
  position: absolute;
  left: -24px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}
.event small {
  display: block;
  color: var(--muted-foreground);
  font-size: 12px;
}
.evidence {
  max-width: 100%;
  max-height: 250px;
  border-radius: 7px;
  margin: 12px 0;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  color: var(--toast-fg);
  background: var(--toast);
  border-radius: 9px;
  max-width: min(500px, 90vw);
  padding: 14px 20px;
  z-index: 100;
  box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
}
.toast.error {
  background: var(--red);
  color: #fff;
}
/* Navegadores sem popover (popover.js): fechado some; aberto fica por cima do resto. */
.no-popover [popover]:not(.popover-open) {
  display: none;
}
.no-popover .popover-open {
  z-index: 1000;
}
/* O aviso é um popover (fica acima das janelas): desfaz o posicionamento padrão dele. */
.toast[popover] {
  inset: auto 22px 22px auto;
  margin: 0;
  border: 0;
  overflow: visible;
}
.footnote {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 12px;
}
.week-label {
  font-weight: 600;
  color: var(--accent);
}
.checklist label {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}
.checklist input {
  width: auto;
}
.module-access {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--input);
  border-radius: 8px;
}
.module-access legend {
  padding: 0 5px;
  font-size: 14px;
  font-weight: 700;
}
.module-access > p {
  margin: 0 0 12px;
  color: var(--muted-foreground);
  font-size: 12px;
}
.module-access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.module-access-item {
  display: grid;
  grid-template-columns: auto 28px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.module-access-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.module-access-item input {
  width: auto;
}
.module-access-icon {
  display: grid;
  place-items: center;
  color: var(--accent);
}
.module-access-icon svg {
  width: 18px;
  height: 18px;
}
.module-access-item strong,
.module-access-item small {
  display: block;
}
.module-access-item small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
}
.sector-link {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--input);
  border-radius: 8px;
}
.sector-link legend {
  padding: 0 5px;
  font-size: 14px;
  font-weight: 700;
}
.sector-link > p {
  margin: 0 0 12px;
  color: var(--muted-foreground);
  font-size: 12px;
}
.sector-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.sector-link-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}
.sector-link-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.sector-link-item input {
  width: auto;
}
.sector-link-item strong,
.sector-link-item small {
  display: block;
}
.sector-link-item small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted-foreground);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
}
.routine-row {
  display: grid;
  grid-template-columns: 1fr 110px 120px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
@media (max-width: 1100px) {
  .workspace {
    padding: 20px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .split {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .workspace {
    padding: 16px;
  }
  .heading {
    flex-direction: column;
  }
  h1 {
    font-size: 24px;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 15px;
  }
  .stat strong {
    font-size: 28px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .module-access-grid {
    grid-template-columns: 1fr;
  }
  .sector-link-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .bar-row {
    grid-template-columns: 100px 1fr 45px;
  }
  .modal-body {
    padding: 18px;
  }
  .routine-row {
    grid-template-columns: 1fr;
  }
  .toolbar > * {
    flex: 1;
  }
  .toolbar input {
    min-width: 100%;
  }
}
@media print {
  aside,
  .topbar,
  .actions,
  .toolbar,
  .tabs,
  button,
  .toast {
    display: none !important;
  }
  .app {
    display: block;
  }
  .workspace {
    padding: 0;
  }
  .panel {
    break-inside: avoid;
  }
  .board-frame {
    overflow: visible;
    max-height: none;
  }
  .board {
    min-width: 0;
    font-size: 8px;
  }
  .board th:first-child,
  .board td:first-child {
    position: static;
    width: auto;
  }
  .stats {
    grid-template-columns: repeat(4, 1fr);
  }
  body {
    background: #fff;
  }
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.filters input {
  min-width: 0;
}
.filter-more {
  margin: -3px 0 20px;
  color: var(--muted-foreground);
  font-size: 14px;
}
.filter-more summary {
  cursor: pointer;
}
.filter-more .toolbar {
  margin-bottom: 0;
}
.check-grid {
  display: flex;
  gap: 10px 20px;
  flex-wrap: wrap;
}
.check-grid label {
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 6px;
}
.check-grid input {
  width: auto;
}
.routine-owners {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.routine-owners legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}
.routine-owners .sub {
  margin: 0 0 6px;
}
.kanban {
  display: grid;
  grid-template-columns: repeat(7, minmax(240px, 1fr));
  gap: 14px;
  overflow: auto;
  padding: 8px 2px 18px;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  min-height: 350px;
}
.kanban-col h3 {
  margin-top: 2px;
}
.schedule-table {
  min-width: 2200px;
}
.schedule-table th,
.schedule-table td {
  text-align: center;
  white-space: nowrap;
  padding: 6px;
}
.schedule-table th:first-child {
  position: sticky;
  left: 0;
  background: var(--muted);
  z-index: 1;
  text-align: left;
  min-width: 170px;
}
.schedule-cell {
  min-width: 56px;
  font-size: 12px;
  padding: 6px;
}
.outside-month {
  background: var(--surface);
  color: var(--faint);
}
.routine-table {
  min-width: 920px;
}
.routine-table th:first-child {
  min-width: 235px;
  max-width: 300px;
}
.routine-status {
  width: 100%;
  font-size: 14px;
}
.routine-status.done {
  background: var(--success-soft);
  color: var(--success-soft-fg);
  border-color: var(--success-border);
}
.today-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.today-grid small {
  display: block;
  color: var(--muted-foreground);
  font-size: 12px;
}
.today-grid strong {
  font-size: 25px;
  display: block;
}
.hours-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
}
.category-remove {
  border: 0;
  background: transparent;
  padding: 0 3px;
  color: inherit;
  line-height: 1;
}
.trend {
  width: 100%;
  height: auto;
  display: block;
}
.alert-list {
  padding-left: 20px;
  font-size: 14px;
}
.alert-list li {
  margin: 12px 0;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--muted);
  padding: 12px;
  font-size: 12px;
  max-height: 250px;
  overflow: auto;
}
dialog details {
  font-size: 12px;
  color: var(--muted-foreground);
}
@media (max-width: 1100px) {
  .today-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 700px) {
  .filters {
    grid-template-columns: 1fr 1fr;
  }
  .filters input#search {
    grid-column: 1/-1;
    min-width: 0;
  }
  .today-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hours-groups {
    grid-template-columns: 1fr;
  }
  .kanban {
    grid-template-columns: repeat(7, 240px);
  }
}
@page {
  margin: 10mm;
}
@media print {
  html,
  body,
  .app,
  main,
  .workspace,
  #view,
  .reports-page,
  .report-output {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
  /* shell.css e mobile.css (que vale na impressão: a folha tem ~718px) vêm depois e
     devolvem o espaço da área de trabalho e do painel. Esse espaço no fim, sozinho,
     virava uma página em branco quando o relatório terminava perto do fim da folha. */
  .workspace,
  #view {
    padding: 0 !important;
  }
  .report-output {
    margin: 0 !important;
    padding: 0 !important;
  }
  .reports-page,
  .report-output,
  .report-output .daily-report-bu {
    display: block !important;
  }
  .reports-page,
  .report-output,
  .report-output h2,
  .report-output h3,
  .report-output h4,
  .report-output table,
  .report-output th,
  .report-output td,
  .report-output .stat,
  .report-output .panel-head {
    color: #111 !important;
  }
  .report-output .sub,
  .report-output small,
  .report-output th,
  .report-output .hint {
    color: #444 !important;
  }
  .report-output .stat,
  .report-output th {
    background: transparent !important;
  }
  .report-output .stat,
  .report-output th,
  .report-output td,
  .report-output .daily-report-bu {
    border-color: #bbb !important;
  }
  .reports-page > .print-only,
  .reports-page > .heading,
  .report-controls,
  .report-history {
    display: none !important;
  }
  .report-output {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .report-output,
  .report-output .daily-report-bu {
    break-inside: auto;
    page-break-inside: auto;
  }
  .report-output .daily-report-bu .panel-head,
  .report-output .daily-report-bu h4,
  .report-output .daily-report-bu .stats,
  .report-output thead,
  .report-output tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-output .daily-report-bu .panel-head,
  .report-output .daily-report-bu h4 {
    break-after: avoid;
    page-break-after: avoid;
  }
  .report-output .daily-report-bu,
  .report-output .table-wrap,
  .report-output table,
  .report-output tbody {
    break-before: auto !important;
    break-after: auto !important;
    break-inside: auto !important;
    page-break-before: auto !important;
    page-break-after: auto !important;
    page-break-inside: auto !important;
  }
  .report-output .daily-report-bu .split {
    display: block;
  }
  .report-output .daily-report-bu .split > div {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  details.filter-more,
  .filters,
  .footnote {
    display: none !important;
  }
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .table-wrap {
    overflow: visible;
  }
  table {
    font-size: 10px;
  }
  th,
  td {
    padding: 5px;
  }
  .today-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  .schedule-table {
    min-width: 0;
  }
  .kanban {
    display: block;
  }
  .kanban-col {
    break-inside: avoid;
    min-height: 0;
  }
  .postit {
    break-inside: avoid;
  }
  .panel {
    break-inside: auto;
  }
  pre {
    max-height: none;
  }
  dialog[open] {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
  }
  .app:has(~ dialog[open]) {
    display: none !important;
  }
  body:has(dialog[open]) dialog {
    border: 0;
  }
  .board-frame {
    overflow: auto;
  }
  .routine-table {
    min-width: 0;
  }
}
.kanban {
  align-items: start;
}
.panel,
.stat,
.split > * {
  min-width: 0;
}
.stat strong {
  overflow-wrap: anywhere;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
}
.split {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}
@media (max-width: 1100px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .stat strong {
    font-size: 1.25rem;
  }
  .filters {
    gap: 8px;
  }
  .stat {
    padding: 13px;
  }
  .form-grid > * {
    min-width: 0;
  }
}
