:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --line: #dbe2df;
  --text: #16221f;
  --muted: #66736f;
  --primary: #1d5d50;
  --primary-strong: #123d35;
  --accent: #b08d2f;
  --danger: #a93535;
  --shadow: 0 16px 40px rgba(22, 34, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.auth-only .app-shell {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(176, 141, 47, 0.12), transparent 32%),
    linear-gradient(135deg, #eef4f1 0%, #f8faf9 100%);
}

body.auth-only .auth-screen {
  display: grid;
}

.auth-card {
  width: min(100%, 520px);
  padding: 28px;
}

.auth-screen.session-ended {
  background: rgba(17, 23, 21, 0.96);
}

.auth-screen.session-ended .auth-card {
  width: auto;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: center;
}

#authEndedPanel h2 {
  color: #fff;
  font-size: 44px;
  letter-spacing: 0.08em;
}

.auth-brand {
  margin-bottom: 20px;
}

.auth-form {
  grid-template-columns: 1fr;
  margin-bottom: 0;
}

.auth-switches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

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

button.secondary,
button.ghost,
button.small {
  background: #edf3f1;
  color: var(--primary-strong);
}

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

button.small {
  min-height: 34px;
  padding: 0 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #12211d;
  color: white;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-button {
  width: 100%;
  min-height: 0;
  padding: 0;
  background: transparent;
  border-radius: 8px;
  justify-content: flex-start;
  text-align: left;
}

.brand-button:hover {
  background: #203b34;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: #12160f;
  font-weight: 800;
}

.brand-logo {
  display: block;
  object-fit: contain;
  background: white;
  padding: 3px;
}

.brand small {
  display: block;
  color: #b7c4c0;
  margin-top: 3px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-group {
  display: grid;
  gap: 6px;
  padding: 10px 8px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(183, 196, 192, 0.08);
}

.nav-group-title {
  margin: 0 0 4px;
  padding: 6px 10px;
  color: #f2f6f4;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(176, 141, 47, 0.24), rgba(176, 141, 47, 0.06));
  border: 1px solid rgba(176, 141, 47, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #d9e4e1;
}

.nav-subitem {
  padding-left: 18px;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 8px;
  padding: 0 6px;
  border-radius: 999px;
  background: #c53a3a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.nav-item.active,
.nav-item:hover {
  background: #203b34;
  color: white;
}

.nav-item.nav-item-disabled,
.nav-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.storage-actions {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.main {
  padding: 28px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.persistence-notice {
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 0.95rem;
}

.persistence-notice code {
  font-size: 0.92em;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.topbar-actions,
.inline-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.subtabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.afastamento-header-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.afastamento-header-stack .subtabs {
  margin-bottom: 0;
}

.subtabs .small.active {
  background: var(--primary);
  color: #fff;
}

.topbar-actions .search {
  width: 180px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

#dashboard .metrics .metric:nth-child(1) { order: 1; }
#dashboard .metrics .metric:nth-child(2) { order: 5; }
#dashboard .metrics .metric:nth-child(3) { order: 6; }
#dashboard .metrics .metric:nth-child(4) { order: 4; }
#dashboard .metrics .metric:nth-child(5) { order: 2; }
#dashboard .metrics .metric:nth-child(6) { order: 3; }

.metric,
.panel,
.form-grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric strong {
  font-size: 30px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.85fr);
  grid-template-areas:
    "service leaves vehicles";
  gap: 18px;
}

.dashboard-grid > .panel {
  min-width: 0;
}

.dashboard-service {
  grid-area: service;
}

.dashboard-leaves {
  grid-area: leaves;
}

.dashboard-vehicles {
  grid-area: vehicles;
}

.dashboard-leaves .status-list,
.dashboard-vehicles .status-list {
  max-height: none;
  overflow: visible;
  min-width: 0;
}

#dashboard .dashboard-leaves .status-item,
#dashboard .dashboard-vehicles .status-item {
  font-size: 11px;
}

#dashboard .dashboard-leaves .status-item strong,
#dashboard .dashboard-vehicles .status-item strong {
  font-size: 11px;
}

#dashboard .dashboard-leaves .status-item .muted,
#dashboard .dashboard-vehicles .status-item .muted {
  font-size: 11px;
}

.leave-item {
  align-items: flex-start;
}

.leave-item > div {
  display: block;
  line-height: 1;
  max-height: none;
}

.leave-item strong,
.leave-item span {
  display: block;
}

.dashboard-afastamento-group h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--primary-strong);
}

.dashboard-section-break {
  border-top: 1px solid var(--line);
  margin: 10px 0;
}

.dashboard-hero {
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(300px, 430px) 1fr;
  align-items: start;
  gap: 18px;
}

.workbench.create-mode {
  grid-template-columns: 1fr;
}

.workbench.create-mode .form-grid {
  width: 100%;
  max-width: none;
}

.workbench.create-mode .list-panel {
  display: none;
}

#servidores .workbench {
  grid-template-columns: minmax(225px, 322px) minmax(0, 1fr);
}

#viaturas .workbench,
#abastecimentos .workbench,
#afastamentos .workbench,
#convocacoes .workbench,
#transacao_penal .workbench {
  grid-template-columns: minmax(225px, 322px) minmax(0, 1fr);
}

.penal-section {
  margin-top: 18px;
}

.penal-dashboard {
  display: grid;
  gap: 18px;
}

.penal-dashboard-fixed {
  position: sticky;
  top: 0;
  z-index: 8;
  padding-top: 4px;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 82%, rgba(245, 247, 246, 0) 100%);
}

.penal-dashboard-fixed .panel:last-child {
  box-shadow: 0 10px 28px rgba(22, 34, 31, 0.06);
}

.penal-module-areas {
  position: sticky;
  top: 236px;
  z-index: 7;
}

.penal-metrics {
  margin-top: 14px;
}

.penal-pending-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.penal-pending-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.penal-pending-item strong {
  color: var(--primary-strong);
}

.penal-pending-item .badge {
  white-space: nowrap;
}

.penal-acordos-dashboard {
  margin-bottom: 18px;
}

.penal-acordos-dashboard-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.penal-acordo-card {
  border: 2px solid #c8d8d2;
  border-radius: 12px;
  padding: 16px;
  background: linear-gradient(180deg, #fbfdfc 0%, #f3f8f6 100%);
  display: grid;
  gap: 12px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
  position: relative;
  overflow: hidden;
}

.penal-acordo-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, #1f6a4e 0%, #3a8a6d 100%);
}

.penal-acordo-card:hover {
  border-color: #9bb9af;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.09);
}

.penal-acordo-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-left: 4px;
}

.penal-acordo-card-header h3 {
  margin: 0 0 4px;
  color: var(--primary-strong);
  font-size: 16px;
}

.penal-acordo-link {
  font-size: 16px;
}

.penal-acordo-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-left: 4px;
}

.penal-acordo-values article {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.penal-acordo-values span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.penal-acordo-values strong {
  color: var(--primary-strong);
  font-size: 16px;
}

.penal-progress-block {
  display: grid;
  gap: 8px;
  padding-left: 4px;
}

.penal-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.penal-progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #dde8e4;
  overflow: hidden;
}

.penal-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f6a4e 0%, #2f8b69 100%);
  transition: width 0.2s ease;
}

@media (max-width: 1180px) {
  .penal-acordos-dashboard-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .penal-acordos-dashboard-list {
    grid-template-columns: 1fr;
  }
}

.penal-tabs .small.active {
  background: var(--primary);
  color: #fff;
}

.penal-notes-grid {
  display: grid;
  gap: 14px;
}

.penal-note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfa;
  display: grid;
  gap: 12px;
}

.penal-note-card h3 {
  margin: 0;
  color: var(--primary-strong);
  font-size: 15px;
}

.penal-note-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.penal-note-fields .field[data-span="full"] {
  grid-column: 1 / -1;
}

.penal-hint {
  font-size: 12px;
}

.tables-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: start;
  gap: 18px;
}

.scale-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  align-items: start;
}

.table-menu {
  display: grid;
  gap: 8px;
}

.table-menu .nav-item {
  background: #edf3f1;
  color: var(--primary-strong);
}

.table-menu .nav-item.active,
.table-menu .nav-item:hover {
  background: var(--primary);
  color: white;
}

.catalog-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.report-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.report-result {
  overflow: auto;
}

.transp-preso-calendar {
  display: grid;
  gap: 18px;
}

.transp-preso-month-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  flex-wrap: wrap;
}

.transp-preso-weekdays,
.transp-preso-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 16px;
}

.transp-preso-weekdays span {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.transp-preso-day {
  min-height: 126px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #f8fbfa;
  color: var(--text);
  box-shadow: 0 6px 18px rgba(16, 24, 40, 0.04);
}

.transp-preso-day.allowed {
  background: linear-gradient(180deg, #f2fbf6 0%, #e7f6ee 100%);
  border-color: #8dc0aa;
  box-shadow: 0 10px 20px rgba(31, 106, 78, 0.08);
}

.transp-preso-day.allowed:hover {
  background: linear-gradient(180deg, #ebf8f1 0%, #dff1e7 100%);
  border-color: #6fa78f;
}

.transp-preso-day.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 93, 80, 0.15), 0 12px 28px rgba(16, 24, 40, 0.08);
}

.transp-preso-day.filled {
  background: linear-gradient(180deg, #eef4ff 0%, #dfe9ff 100%);
  border-color: #7e9fd8;
  box-shadow: 0 10px 22px rgba(61, 96, 168, 0.1);
}

.transp-preso-day.inactive {
  background: linear-gradient(180deg, #fff3f3 0%, #fde2e2 100%);
  border-color: #d98888;
  color: #7f1d1d;
  box-shadow: 0 10px 22px rgba(160, 38, 38, 0.08);
}

.transp-preso-day.disabled {
  background: linear-gradient(180deg, #f4f6f8 0%, #eceff3 100%);
  border-color: #d5dbe3;
  color: #6b7280;
  opacity: 1;
  box-shadow: none;
}

.transp-preso-day--empty {
  visibility: hidden;
  min-height: 0;
  padding: 0;
  border: 0;
}

.transp-preso-day-number {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-strong);
}

.transp-preso-day.disabled .transp-preso-day-number {
  color: #7b8794;
}

.transp-preso-day.filled .transp-preso-day-number {
  color: #284b8f;
}

.transp-preso-day.inactive .transp-preso-day-number {
  color: #991b1b;
}

.transp-preso-day-weekday,
.transp-preso-day-holiday {
  font-size: 12px;
}

.transp-preso-day-holiday {
  color: var(--danger);
  font-weight: 700;
}

.transp-preso-day-summary {
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
  font-weight: 600;
}

.transp-preso-editor {
  margin-top: 18px;
}

#transpPresoAdminPanel {
  margin: 18px 0;
}

#transpPresoLimitForm {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  align-items: end;
}

#transpPresoLimitForm .field {
  min-width: 0;
}

#transpPresoLimitForm .form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  padding-top: 4px;
}

#transpPresoLimitForm .form-actions button {
  flex: 0 0 auto;
}

#transpPresoLimitSummary {
  margin: 0 18px 18px;
  line-height: 1.5;
}

.transp-preso-compatibility {
  display: grid;
  gap: 6px;
  grid-column: 1 / -1;
}

.report-output {
  width: 100%;
  max-width: 190mm;
  margin: 0 auto 22px;
  font-size: 11px;
  line-height: 1.2;
}

.report-output h3,
.report-empty h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--primary-strong);
}

.report-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.report-brand strong,
.report-brand h2 {
  margin: 0 0 4px;
  color: var(--primary-strong);
}

.report-brand p {
  margin: 0;
}

.report-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  flex: 0 0 auto;
}

.report-output .muted {
  font-size: 10px;
}

.report-output table {
  min-width: 0;
  table-layout: fixed;
}

.report-output th,
.report-output td {
  padding: 4px 5px;
  font-size: 10px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.report-output th {
  color: var(--primary-strong);
}

.report-output th:first-child,
.report-output td:first-child {
  width: 40%;
}

.report-output.report-mcf table {
  table-layout: fixed;
}

#mcfResult {
  width: 100%;
  overflow-x: auto;
}

#mcfResult .report-output.report-mcf {
  max-width: none;
  width: 100%;
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.35;
}

#mcfResult .report-output.report-mcf .muted {
  font-size: 12px;
}

#mcfResult .report-output.report-mcf th,
#mcfResult .report-output.report-mcf td {
  font-size: 12px;
  padding: 6px 7px;
}

#metaResult {
  width: 100%;
  overflow-x: auto;
}

#metaResult .report-output.report-meta {
  max-width: none;
  width: 100%;
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.35;
}

#metaResult .report-output.report-meta .muted {
  font-size: 12px;
}

#metaResult .report-output.report-meta th,
#metaResult .report-output.report-meta td {
  font-size: 12px;
  padding: 6px 7px;
}

.report-output.report-mcf th,
.report-output.report-mcf td {
  white-space: nowrap;
}

.report-output.report-mcf th:nth-child(1),
.report-output.report-mcf td:nth-child(1) {
  width: 12%;
}

.report-output.report-mcf th:nth-child(2),
.report-output.report-mcf td:nth-child(2) {
  width: 48%;
}

.report-output.report-mcf th:nth-child(3),
.report-output.report-mcf td:nth-child(3) {
  width: 18%;
}

.report-output.report-mcf th:nth-child(4),
.report-output.report-mcf td:nth-child(4),
.report-output.report-mcf th:nth-child(5),
.report-output.report-mcf td:nth-child(5) {
  width: 11%;
  text-align: center;
}

.report-output.report-meta table {
  table-layout: fixed;
}

.report-output.report-meta th,
.report-output.report-meta td {
  white-space: nowrap;
}

.report-output.report-meta th:nth-child(1),
.report-output.report-meta td:nth-child(1) {
  width: 14%;
}

.report-output.report-meta th:nth-child(2),
.report-output.report-meta td:nth-child(2) {
  width: 50%;
}

.report-output.report-meta th:nth-child(3),
.report-output.report-meta td:nth-child(3) {
  width: 36%;
}

.scale-document {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.scale-document-month {
  width: 100%;
  max-width: 190mm;
  margin: 0 auto 22px;
  font-size: 11px;
  line-height: 1.2;
}

.scale-header {
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
}

.scale-header h3,
.scale-day h4,
.scale-group h5 {
  margin: 0;
}

.scale-day {
  display: grid;
  gap: 12px;
  page-break-inside: avoid;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.scale-group {
  display: grid;
  gap: 8px;
  page-break-inside: avoid;
}

.scale-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.scale-away-text {
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.scale-away-text-ferias {
  color: #b42318;
}

.scale-away-text-outros {
  color: #8a2f6b;
  text-decoration-style: dashed;
}

.scale-away-text-folga {
  color: #8a5a12;
  text-decoration-style: dotted;
}

.scale-away-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.scale-away-badge-ferias {
  background: #fde7e9;
  color: #b42318;
  border-color: #f5c2c7;
}

.scale-away-badge-outros {
  background: #f6e9f4;
  color: #8a2f6b;
  border-color: #e4c6dd;
}

.scale-away-badge-folga {
  background: #fff2dd;
  color: #8a5a12;
  border-color: #eed3a4;
}

.scale-row-away td {
  color: var(--danger);
}

.scale-row-away-ferias td {
  background: rgba(180, 35, 24, 0.05);
}

.scale-row-away-outros td {
  background: rgba(138, 47, 107, 0.06);
}

.scale-row-away-folga td {
  background: rgba(138, 90, 18, 0.06);
}

.scale-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.scale-month-group .badge {
  white-space: normal;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
}

.scale-document-month .scale-header h3 {
  font-size: 18px;
}

.scale-document-month .report-logo {
  width: 52px;
  height: 52px;
}

.scale-document-month .report-brand {
  margin-bottom: 8px;
}

.scale-document-month .scale-header p,
.scale-document-month .muted {
  font-size: 10px;
}

.scale-document-month .scale-group h5,
.scale-document-month .scale-group-head h5 {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-strong);
}

.scale-document-month table {
  min-width: 0;
  table-layout: fixed;
}

.scale-document-month th,
.scale-document-month td {
  padding: 4px 5px;
  font-size: 10px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.scale-document-month th:first-child,
.scale-document-month td:first-child {
  width: 40%;
}

.scale-section-break {
  height: 0;
  border-top: 2px solid var(--line);
  margin: 4px 0 2px;
}

.form-grid {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea,
.search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 10px;
  background: white;
  color: var(--text);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field select[multiple] {
  min-height: 170px;
}

.field select:disabled {
  background: #f0f3f2;
  color: var(--muted);
  cursor: not-allowed;
}

.checkbox-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
}

.calculated-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3f1;
  padding: 10px;
  color: var(--muted);
}

.calculated-field strong {
  color: var(--primary-strong);
}

.retirement-preview {
  display: grid;
  gap: 10px;
}

.retirement-preview-body {
  display: grid;
  gap: 10px;
}

.retirement-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: 12px;
}

.retirement-rule-list {
  display: grid;
  gap: 10px;
}

.retirement-rule-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.retirement-rule-card.best {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.retirement-rule-head {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.server-condition-badges {
  display: inline-grid;
  gap: 4px;
  margin-top: 4px;
  justify-items: start;
}

.server-condition-badges .badge {
  white-space: nowrap;
  width: fit-content;
  max-width: 100%;
}

.photo-preview {
  min-height: 58px;
  display: flex;
  align-items: center;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.list-panel {
  min-width: 0;
}

.table-wrap {
  overflow: auto;
}

#servidores .table-wrap,
#afastamentos .table-wrap,
#convocacoes .table-wrap {
  overflow-x: auto;
  overflow-y: auto;
}

#convocacoes .inline-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

#convocacoes .inline-filters > * {
  min-width: 0;
}

#convocacoes #convocacaoDateFilter {
  flex: 0 0 170px;
}

#convocacoes #convocacaoServidorFilter {
  flex: 1 1 320px;
}

#convocacoes #convocacaoPeriodFilter {
  flex: 0 0 180px;
}

#servidores table,
#afastamentos table,
#convocacoes table {
  min-width: 980px;
}

#servidores th,
#servidores td,
#afastamentos th,
#afastamentos td,
#convocacoes th,
#convocacoes td {
  font-size: 12px;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}

#servidores table {
  min-width: 0;
  table-layout: fixed;
}

#servidores th,
#servidores td {
  font-size: 12px;
  padding: 7px 5px;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  border-radius: 0;
  font-weight: 700;
}

.table-sort:hover,
.table-sort.active {
  background: transparent;
  color: var(--primary);
}

.table-sort-indicator {
  font-size: 11px;
  line-height: 1;
}

#servidores th:nth-child(1),
#servidores td:nth-child(1) {
  width: 54px;
}

#servidores th:nth-child(2),
#servidores td:nth-child(2) {
  width: 72px;
}

#servidores th:nth-child(3),
#servidores td:nth-child(3) {
  width: 22%;
}

#servidores th:nth-child(4),
#servidores td:nth-child(4) {
  width: 24%;
}

#servidores th:nth-child(5),
#servidores td:nth-child(5) {
  width: 12%;
}

#servidores th:nth-child(6),
#servidores td:nth-child(6) {
  width: 18%;
}

#servidores th:nth-child(7),
#servidores td:nth-child(7) {
  width: 88px;
}

#convocacoes th:nth-child(1),
#convocacoes td:nth-child(1) {
  width: 18%;
}

#convocacoes th:nth-child(2),
#convocacoes td:nth-child(2) {
  width: 24%;
}

#convocacoes th:nth-child(3),
#convocacoes td:nth-child(3) {
  width: 16%;
}

#convocacoes th:nth-child(4),
#convocacoes td:nth-child(4) {
  width: 30%;
}

#convocacoes th:nth-child(5),
#convocacoes td:nth-child(5) {
  width: 12%;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.row-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.table-link {
  color: var(--primary-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.icon-button {
  min-width: 34px;
  padding: 0 8px;
  font-size: 16px;
  line-height: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #edf3f1;
  color: var(--primary-strong);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge.warn {
  background: #fbf3d8;
  color: #755900;
}

.badge.off {
  background: #f2e6e6;
  color: #842828;
}

.status-list,
.timeline {
  display: grid;
  gap: 10px;
}

.status-item,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.vehicle-swatch {
  width: 42px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(22, 34, 31, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  flex: 0 0 42px;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-inline select {
  flex: 1 1 auto;
}

.vehicle-swatch-form {
  width: 20px;
  height: 38px;
  flex: 0 0 20px;
  border-radius: 4px;
}

.link-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  min-height: 0;
  text-align: left;
  box-shadow: none;
}

.link-button:hover {
  background: transparent;
}

.dashboard-link {
  color: var(--primary-strong);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.service-summary {
  display: grid;
  gap: 12px;
}

.service-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.service-counts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: baseline;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.service-counts strong {
  font-size: 22px;
}

.service-list {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.service-list div {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) minmax(220px, 1.35fr) minmax(90px, 0.55fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  min-width: 0;
  font-size: 11px;
  align-items: start;
}

.service-list span {
  color: var(--muted);
  white-space: normal;
}

.service-list div > * {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
}

.service-list div > :nth-child(2) {
  padding-left: 28px;
}

.service-list strong {
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

#dashboard .service-summary,
#dashboard .unit-groups,
#dashboard .unit-group,
#dashboard .service-list {
  min-width: 0;
}

#dashboard .service-head,
#dashboard .service-counts,
#dashboard .service-list,
#dashboard .service-list div,
#dashboard .service-list strong,
#dashboard .service-list span {
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  hyphens: none;
}

#dashboard .service-list {
  overflow: auto;
}

#dashboard .service-counts {
  font-size: 12px;
}

.unit-groups {
  display: grid;
  gap: 14px;
}

.unit-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.unit-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3f1;
}

.muted {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  background: #12211d;
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.detail-dialog {
  width: min(820px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0;
}

.detail-dialog::backdrop {
  background: rgba(18, 33, 29, 0.45);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.detail-body {
  padding: 18px;
  overflow: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-section + .detail-section {
  margin-top: 18px;
}

.detail-section-header {
  margin-bottom: 10px;
}

.detail-table-wrap table {
  min-width: 760px;
}

.detail-photo {
  max-width: 180px;
  max-height: 180px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: zoom-in;
}

.detail-photo-button {
  border: 0;
  padding: 0;
  background: transparent;
  display: inline-flex;
  cursor: zoom-in;
}

.image-preview-dialog {
  width: min(96vw, 1200px);
  max-width: 96vw;
  max-height: 96vh;
  border: 0;
  padding: 0;
  background: transparent;
}

.image-preview-dialog::backdrop {
  background: rgba(10, 18, 16, 0.78);
}

.image-preview-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.image-preview-img {
  max-width: min(92vw, 1120px);
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: #fff;
}

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

  .sidebar {
    position: static;
  }

  .nav,
  .storage-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .dashboard-grid,
  .workbench,
  .tables-layout,
  .catalog-form,
  .report-form,
  .penal-note-fields,
  .scale-layout {
    grid-template-columns: 1fr;
  }

  .transp-preso-weekdays,
  .transp-preso-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transp-preso-day--empty {
    display: none;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px;
  }

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

  .topbar-actions,
  .inline-actions {
    width: 100%;
  }

  .penal-acordo-card-header,
  .penal-progress-meta {
    flex-direction: column;
  }

  .penal-acordo-values {
    grid-template-columns: 1fr;
  }

  .retirement-meta {
    grid-template-columns: 1fr;
  }

  .topbar-actions button,
  .inline-actions button,
  .search {
    flex: 1 1 100%;
  }

  .topbar-actions .search,
  .detail-grid {
    width: 100%;
    grid-template-columns: 1fr;
  }

  #transpPresoLimitForm {
    grid-template-columns: 1fr;
  }

  .service-list div {
    grid-template-columns: 1fr;
  }

  #dashboard .service-list div {
    grid-template-columns: minmax(170px, 1.2fr) minmax(220px, 1.35fr) minmax(90px, 0.55fr);
    min-width: 0;
  }

  .transp-preso-weekdays,
  .transp-preso-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  .sidebar,
  .topbar,
  .inline-actions,
  .form-grid,
  .table-menu,
  .catalog-form,
  #reportPrintBtn,
  #generateScaleBtn,
  #printScalePreviewBtn,
  #clearBtn,
  #seedBtn,
  #loadImportedBtn {
    display: none !important;
  }

  .app-shell,
  .main,
  .view.active,
  .panel,
  .scale-layout {
    display: block;
    box-shadow: none;
    border: 0;
    padding: 0;
    margin: 0;
  }

  .report-output,
  #scalePreview {
    overflow: visible;
  }

  .report-output {
    max-width: 194mm;
    margin: 0;
  }

  .report-logo {
    width: 48px;
    height: 48px;
  }

  .scale-document-month {
    max-width: 194mm;
    margin: 0;
    gap: 8px;
  }

  .scale-section-break {
    margin: 2px 0 0;
  }

  body.print-scale-preview #escalas .scale-layout > .list-panel,
  body.print-scale-preview #escalas .panel-header,
  body.print-scale-preview #escalas .inline-actions {
    display: none !important;
  }

  body.print-scale-preview #escalas,
  body.print-scale-preview #escalas .scale-layout,
  body.print-scale-preview #escalas .scale-layout > .panel,
  body.print-scale-preview #scalePreview {
    display: block !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
  }

  body.print-scale-preview .view:not(#escalas) {
    display: none !important;
  }
}
