@import url("https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-hover: #f8fbfb;
  --surface-muted: #f6f9fa;
  --surface-strong: #ecf2f4;
  --text-strong: #18222e;
  --text: #243141;
  --muted: #667587;
  --muted-soft: #95a3b1;
  --line: #d8e3e8;
  --line-strong: #c4d2d8;
  --teal: #4d8081;
  --teal-soft: #8db4b5;
  --teal-dark: #365f60;
  --teal-deep: #274748;
  --teal-tint: #edf7f7;
  --green: #3a7459;
  --green-tint: #f1f8f3;
  --green-line: #cbe1d6;
  --amber: #a87a3f;
  --amber-tint: #fff8e8;
  --amber-line: #ead9b2;
  --red: #a85e49;
  --red-tint: #fff7f4;
  --red-line: #e6c4b8;
  --indigo: #6575c8;
  --nav: #fbfdfd;
  --charcoal: #2a2a2a;
  --shadow: 0 20px 50px rgba(31, 48, 62, 0.08);
  --shadow-soft: 0 14px 32px rgba(31, 48, 62, 0.07);
  --shadow-card: 0 10px 24px rgba(31, 48, 62, 0.05);
  --shadow-control: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --shadow-hover: 0 14px 28px rgba(31, 48, 62, 0.065);
  --focus: 0 0 0 3px rgba(77, 128, 129, 0.14);
  --control-height: 46px;
  --control-radius: 13px;
  --control-bg: #ffffff;
  --control-bg-hover: #f9fcfc;
  --control-border: #ccdbe3;
  --control-border-hover: #a9bec8;
  --button-primary: #eef5f5;
  --button-primary-hover: #e1eded;
  --button-primary-border: #b8d0d2;
  --button-primary-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --button-secondary: #ffffff;
  --button-secondary-hover: #f7fbfc;
  --button-danger: #a85e49;
  --button-danger-bg: #fff7f4;
  --button-danger-hover: #fff0ea;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --radius-xl: 22px;
  --content-max: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Nunito Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body:not(.auth-page) {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding: 30px;
  background:
    linear-gradient(180deg, #fbfdfd 0%, var(--bg) 48%, #edf3f4 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
}

::placeholder {
  color: #8fa0b4;
  opacity: 1;
}

button,
a,
input,
textarea {
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

input:disabled,
textarea:disabled {
  cursor: not-allowed;
  background: var(--surface-muted);
  color: var(--muted);
}

button:active {
  transform: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  width: min(100%, 1420px);
  height: calc(100vh - 60px);
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar {
  position: relative;
  top: auto;
  height: 100%;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--nav);
  color: var(--text);
  padding: 32px 20px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: grid;
  gap: 8px;
  align-items: start;
  margin-bottom: 28px;
}

.brand-logo {
  display: block;
  width: 150px;
  height: auto;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: var(--teal);
  font-weight: 700;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 169, 170, 0.44) transparent;
}

.nav-list::-webkit-scrollbar {
  width: 6px;
}

.nav-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(121, 169, 170, 0.44);
}

.nav-list a {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 45px;
  color: var(--muted);
  text-decoration: none;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  outline-offset: 3px;
}

.nav-list a:hover {
  border-color: #d4e2e6;
  background: var(--surface);
  color: var(--teal-deep);
}

.nav-list a.active {
  border-color: rgba(46, 104, 105, 0.22);
  background: linear-gradient(135deg, var(--teal-dark), var(--teal-deep));
  color: #fff;
  box-shadow: 0 14px 28px rgba(46, 104, 105, 0.18);
}

.nav-list a:active {
  transform: none;
}

.nav-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: inherit;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: auto;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--button-secondary);
  color: var(--teal-dark);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: none;
}

.main {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px 46px 44px;
  background: #f6fafb;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 169, 170, 0.46) transparent;
}

.main::-webkit-scrollbar {
  width: 8px;
}

.main::-webkit-scrollbar-thumb {
  border: 2px solid #f6fafb;
  border-radius: 999px;
  background: rgba(121, 169, 170, 0.46);
}

.topbar,
.page-stack,
.mensagem {
  width: min(100%, var(--content-max));
  margin-inline: auto;
}

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

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.eyebrow::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--teal-dark);
  content: "";
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
  color: var(--text-strong);
}

.topbar p {
  max-width: 760px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.periodo-topbar {
  display: inline-flex;
  margin-left: 8px;
  color: var(--teal-dark);
  font-weight: 700;
}

.topbar button,
.secondary-button,
.form-actions button[type="button"],
.pagination .secondary-button,
.icon-button,
.logout-button {
  min-height: var(--control-height);
  border: 1px solid var(--control-border);
  border-radius: 14px;
  background: var(--button-secondary);
  color: var(--teal-dark);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: none;
}

.topbar button:hover,
.secondary-button:hover,
.form-actions button[type="button"]:hover,
.pagination .secondary-button:hover,
.icon-button:hover,
.logout-button:hover {
  border-color: var(--control-border-hover);
  background: var(--button-secondary-hover);
  box-shadow: none;
  transform: none;
}

.user-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal-dark);
  padding: 7px 9px 7px 7px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-control);
  cursor: pointer;
  text-align: left;
}

.user-chip[hidden] {
  display: none;
}

.user-chip img {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(133, 162, 177, 0.16);
}

.user-menu {
  position: relative;
  width: 100%;
}

.user-menu-button {
  padding-right: 12px;
}

.user-menu-button:hover,
.user-menu-button:focus,
.user-menu-button[aria-expanded="true"] {
  border-color: #b8d2d4;
  background: #ffffff;
  transform: none;
}

.user-avatar-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.user-status-dot {
  position: absolute;
  right: -2px;
  bottom: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: #13b9a8;
  box-shadow: 0 0 0 1px rgba(19, 185, 168, 0.16);
}

.user-chip-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.user-chip-copy strong,
.user-chip-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-copy strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.user-chip-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.user-menu-arrow {
  color: var(--muted-soft);
  font-size: 10px;
  line-height: 1;
  transition: transform 0.16s ease;
}

.user-menu-button[aria-expanded="true"] .user-menu-arrow {
  transform: rotate(180deg);
}

.user-submenu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 20;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  padding: 8px;
  box-shadow: 0 14px 30px rgba(31, 48, 62, 0.1);
}

.user-submenu::before {
  position: absolute;
  bottom: -5px;
  left: 28px;
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  content: "";
  transform: rotate(45deg);
}

.user-submenu[hidden] {
  display: none;
}

.user-submenu-header {
  display: grid;
  gap: 3px;
  padding: 8px 9px 9px;
}

.user-submenu-header span {
  color: var(--muted-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.user-submenu-header strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-submenu-divider {
  height: 1px;
  margin: 0 5px 6px;
  background: rgba(133, 162, 177, 0.16);
}

.user-submenu-action {
  display: flex;
  gap: 9px;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  min-height: 39px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 0 10px;
  color: var(--teal-dark);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
}

.user-submenu-action svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.user-submenu-action:hover,
.user-submenu-action:focus,
.user-submenu-action.active {
  background: var(--teal-tint);
  color: var(--teal-dark);
}

.user-submenu .menu-logout {
  color: var(--button-danger);
}

.user-submenu .menu-logout:hover,
.user-submenu .menu-logout:focus {
  background: var(--button-danger-bg);
  color: #9d4f3b;
}

.primary-action {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  border: 1px solid var(--button-primary-border);
  border-radius: 14px;
  background: var(--button-primary);
  color: var(--teal-dark);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.primary-action:hover {
  border-color: #b4cccc;
  background: var(--button-primary-hover);
  box-shadow: none;
  transform: none;
}

.primary-action svg,
.icon-button svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.primary-action span {
  color: inherit;
  font-size: inherit;
}

.page-stack {
  display: grid;
  gap: 20px;
}

.dashboard-overview {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 2.15fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 4px;
  margin-bottom: 2px;
}

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

.module-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.module-summary .kpi:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.module-summary .kpi.contratos {
  --accent: var(--muted);
}

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-card);
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.kpi:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card);
}

.kpi-primary {
  display: grid;
  align-content: center;
  min-height: 116px;
  padding: 20px;
}

.kpi::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--accent, var(--teal-dark));
  opacity: 0.5;
  content: "";
}

.metric-label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-label-text {
  min-width: 0;
}

.kpi strong {
  display: block;
  margin-top: 9px;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}

.kpi-primary strong {
  font-size: 30px;
}

.kpi-compact {
  min-height: 106px;
  padding: 17px 18px;
}

.kpi-compact strong {
  font-size: 21px;
}

.kpi.receita {
  --accent: var(--teal-dark);
}

.kpi.despesas {
  --accent: var(--red);
}

.kpi.reserva {
  --accent: var(--amber);
}

.kpi.saldo {
  --accent: var(--indigo);
}

.kpi.contratos {
  --accent: var(--muted);
}

.panel {
  min-width: 0;
  overflow: hidden;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.panel:hover {
  border-color: var(--line-strong);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfd 100%);
}

.panel-header-actions {
  align-items: center;
}

.panel-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-strong);
}

.panel-title-text {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.panel-header span {
  color: var(--muted);
  font-size: 11px;
}

.panel-header .primary-action span {
  color: inherit;
  font-size: inherit;
}

.projecoes-panel {
  display: grid;
}

.projecoes-table .table-wrap {
  border-top: 1px solid var(--line);
}

.projecoes-table th {
  background: #f9fcfc;
}

.projecoes-table th,
.projecoes-table td {
  padding: 13px 16px;
}

.projecoes-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.projecoes-table td {
  font-size: 13px;
}

.projecoes-table tbody tr:hover {
  background: #fafdfd;
}

.projecoes-table .pagination {
  padding-top: 12px;
  padding-bottom: 12px;
  background: #fcfefe;
}

.finance-analysis {
  display: block;
  margin-bottom: 2px;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(72px, auto);
  gap: 10px;
  padding: 12px 18px 16px;
  align-items: stretch;
}

.health-grid article {
  display: grid;
  gap: 3px;
  min-height: 72px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfd 100%);
  padding: 10px 12px;
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}

.health-grid article:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.health-grid article.insight {
  min-height: 72px;
  padding: 10px 12px;
}

.health-grid article.support {
  background: #fcfefe;
  min-height: 72px;
  padding: 10px 12px;
}

.health-grid article.lead {
  border-color: var(--line-strong);
  background: #f4fbfb;
}

.health-grid article.lead strong {
  font-size: 18px;
}

.health-grid article.subtle {
  border-color: #e7edf0;
  background: #fdfefe;
}

.health-grid strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.health-grid article.insight strong {
  font-size: 17px;
}

.health-grid .risk-alert {
  border-color: #efc9bb;
  background: #fff8f6;
}

.health-grid .risk-alert strong {
  color: var(--red);
}

.health-grid .risk-ok {
  border-color: var(--green-line);
  background: #f7fbf8;
}

.health-grid .support {
  color: var(--muted);
}

.health-grid .support strong {
  color: var(--text-strong);
  font-size: 14px;
}

.health-grid .subtle strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.form-panel {
  position: sticky;
  top: 20px;
}

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

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

.form-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid label,
.field {
  display: grid;
  gap: 7px;
}

.form-grid input,
.form-grid textarea,
.login-form input,
.table-toolbar input,
.select-trigger {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: linear-gradient(180deg, #ffffff 0%, #fdfefe 100%);
  color: var(--text);
  padding: 10px 15px;
  box-shadow: var(--shadow-control);
}

.form-grid input:hover,
.form-grid textarea:hover,
.login-form input:hover,
.table-toolbar input:hover {
  border-color: var(--control-border-hover);
  background: var(--control-bg-hover);
}

.select-trigger:hover {
  border-color: var(--control-border-hover);
  background-color: var(--control-bg-hover);
}

.form-grid input:focus,
.form-grid textarea:focus,
.login-form input:focus,
.period-field input:focus,
.table-toolbar input:focus,
.select-trigger:focus-visible,
.select-field.is-open .select-trigger {
  border-color: var(--teal-soft);
  box-shadow: var(--focus), var(--shadow-control);
  outline: none;
}

.select-field {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  text-align: left;
}

.select-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-arrow {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 6px solid #5f6f83;
  transition: transform 0.16s ease;
}

.select-field.is-open .select-arrow {
  transform: rotate(180deg);
}

.select-field.is-disabled .select-trigger {
  cursor: not-allowed;
  background: var(--surface-muted);
  color: var(--muted);
}

.select-menu {
  position: fixed;
  z-index: 1800;
  overflow: auto;
  max-height: min(320px, calc(100vh - 24px));
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(31, 48, 62, 0.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 169, 170, 0.44) transparent;
}

.select-menu::-webkit-scrollbar {
  width: 7px;
}

.select-menu::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(121, 169, 170, 0.44);
}

.select-option {
  display: block;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  padding: 9px 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.select-option:hover,
.select-option.is-active {
  background: var(--teal-tint);
  color: var(--teal-dark);
}

.select-option.is-selected {
  border-color: var(--teal-dark);
  background: linear-gradient(180deg, var(--teal-dark), var(--teal-deep));
  color: #ffffff;
  font-weight: 700;
}

.select-option.is-selected:hover,
.select-option.is-selected.is-active {
  background: var(--teal-deep);
  color: #ffffff;
}

.select-option:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.date-picker-field {
  display: block;
  width: 100%;
}

.date-input-shell {
  position: relative;
  display: block;
}

.date-picker-input {
  padding-right: 46px;
  font-variant-numeric: tabular-nums;
}

.date-picker-button {
  position: absolute;
  top: 50%;
  right: 7px;
  display: inline-grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.date-picker-button:hover,
.date-picker-field.is-open .date-picker-button {
  background: var(--teal-tint);
  color: var(--teal-dark);
}

.date-picker-button:disabled {
  transform: translateY(-50%);
}

.date-picker-field.is-open .date-picker-input {
  border-color: var(--teal-soft);
  box-shadow: var(--focus), var(--shadow-control);
}

.date-picker-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.date-picker-menu {
  position: fixed;
  z-index: 1800;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(31, 48, 62, 0.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 169, 170, 0.44) transparent;
}

.date-picker-menu::-webkit-scrollbar {
  width: 7px;
}

.date-picker-menu::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(121, 169, 170, 0.44);
}

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

.calendar-header strong {
  font-size: 13px;
  font-weight: 800;
  text-transform: capitalize;
}

.calendar-nav {
  display: inline-flex;
  gap: 4px;
}

.calendar-nav button,
.calendar-actions button {
  min-height: 29px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--teal-dark);
  padding: 6px 9px;
  cursor: pointer;
  font-weight: 700;
}

.calendar-nav button {
  width: 28px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.calendar-nav button:hover,
.calendar-actions button:hover {
  background: var(--teal-tint);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.calendar-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.calendar-weekdays span {
  display: grid;
  min-height: 22px;
  place-items: center;
}

.calendar-day {
  display: grid;
  min-width: 0;
  height: 30px;
  min-height: 30px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.calendar-day:hover {
  background: var(--teal-tint);
  color: var(--teal-dark);
}

.calendar-day.is-outside {
  color: var(--muted-soft);
  font-weight: 600;
}

.calendar-day.is-today {
  border-color: var(--teal-soft);
}

.calendar-day.is-selected,
.calendar-day.is-selected:hover {
  border-color: var(--teal-dark);
  background: linear-gradient(180deg, var(--teal-dark), var(--teal-deep));
  color: #ffffff;
}

.calendar-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.form-grid textarea {
  min-height: 72px;
  resize: vertical;
}

.form-grid input[data-mask="money"],
.form-grid input[data-mask="percent"],
.table-toolbar input[type="search"] {
  font-variant-numeric: tabular-nums;
}

.form-grid input[data-mask="money"],
.form-grid input[data-mask="percent"] {
  text-align: right;
}

.input-suffix {
  position: relative;
  display: block;
}

.input-suffix input {
  padding-right: 46px;
}

.input-suffix > span {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  pointer-events: none;
  transform: translateY(-50%);
}

.field-label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.help-icon {
  position: relative;
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border: 1px solid #bdcbd4;
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.help-icon::after {
  display: none;
  content: none;
}

.help-icon::before {
  display: none;
  content: none;
}

.help-icon:hover::after,
.help-icon:focus::after,
.help-icon:hover::before,
.help-icon:focus::before {
  display: none;
}

.floating-tooltip {
  position: fixed;
  z-index: 2000;
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
  white-space: normal;
  box-shadow: 0 16px 34px rgba(15, 23, 32, 0.2);
}

.floating-tooltip[hidden] {
  display: none;
}

.span-2,
.span-4 {
  grid-column: 1 / -1;
}

.advanced-fields {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fbfdfd;
  transition:
    border-color 0.16s ease,
    background 0.16s ease;
}

.advanced-fields[open] {
  border-color: var(--line-strong);
  background: #ffffff;
}

.advanced-fields summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 11px 13px;
}

.advanced-fields summary:hover {
  color: var(--teal-dark);
}

.advanced-content {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.form-grid input[readonly] {
  background: var(--surface-muted);
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 11px;
  align-items: center;
  grid-column: 1 / -1;
}

.form-actions button,
.login-form button {
  min-height: var(--control-height);
  border: 1px solid var(--button-primary-border);
  border-radius: 14px;
  background: var(--button-primary);
  color: var(--teal-dark);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.form-actions button[type="button"],
.pagination .secondary-button {
  border-color: var(--line-strong);
  background: var(--button-secondary);
  color: var(--teal-dark);
  box-shadow: none;
}

.form-actions button:focus-visible,
.login-form button:focus-visible,
.period-submit:focus-visible,
.primary-action:focus-visible,
.secondary-button:focus-visible,
.icon-button:focus-visible {
  box-shadow: var(--focus);
}

.form-actions button:hover,
.login-form button:hover,
.period-submit:hover {
  background: var(--button-primary-hover);
  box-shadow: none;
  transform: none;
}

.form-actions button[type="button"]:hover,
.pagination .secondary-button:hover {
  background: var(--button-secondary-hover);
}

.form-actions button:active,
.login-form button:active,
.period-submit:active,
.primary-action:active,
.secondary-button:active,
.icon-button:active {
  transform: none;
}

.period-filter {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(150px, 180px) max-content;
  gap: 10px;
  align-items: end;
  justify-content: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
}

.period-field input {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--control-bg);
  color: var(--text);
  padding: 10px 15px;
  box-shadow: var(--shadow-control);
}

.period-field {
  align-self: stretch;
}

.period-submit {
  justify-self: start;
  min-width: 124px;
  min-height: var(--control-height);
  border: 1px solid var(--button-primary-border);
  border-radius: 14px;
  background: var(--button-primary);
  color: var(--teal-dark);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.table-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) repeat(3, minmax(150px, 0.65fr));
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfd 0%, #f8fbfc 100%);
}

.toolbar-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.toolbar-search:only-child {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow: auto;
  max-width: 100%;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 169, 170, 0.44) transparent;
}

.table-wrap::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(121, 169, 170, 0.44);
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  background: #fbfdfd;
}

tbody tr:hover {
  background: var(--surface-hover);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.align-right {
  text-align: right;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
  padding: 28px 18px;
}

.table-actions {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--control-border);
  border-radius: 13px;
  background: var(--button-secondary);
  color: var(--teal-dark);
  cursor: pointer;
  box-shadow: none;
}

.icon-button:hover,
.icon-button:focus {
  border-color: var(--control-border-hover);
  background: var(--button-secondary-hover);
  transform: none;
}

.icon-button.danger-button {
  border-color: var(--red-line);
  background: var(--button-danger-bg);
  color: var(--button-danger);
}

.icon-button.danger-button:hover,
.icon-button.danger-button:focus {
  border-color: #e5a994;
  background: var(--button-danger-hover);
}

.icon-button:active {
  transform: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.status-pill.positivo {
  border-color: var(--green-line);
  background: var(--green-tint);
  color: var(--green);
}

.status-pill.pendente {
  border-color: var(--amber-line);
  background: var(--amber-tint);
  color: #8a6531;
}

.status-pill.neutro {
  border-color: var(--line);
  background: var(--surface-muted);
  color: #59677a;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdfd 0%, #f8fbfc 100%);
  color: var(--muted);
  font-size: 13px;
}

.cadastro-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: visible;
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  background: transparent;
}

.cadastro-dialog::backdrop {
  background: rgba(29, 42, 58, 0.3);
  backdrop-filter: blur(8px);
}

.dialog-card {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(29, 42, 58, 0.16);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfd 100%);
}

.dialog-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
}

.dialog-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-body {
  overflow: auto;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(121, 169, 170, 0.44) transparent;
}

.dialog-body::-webkit-scrollbar {
  width: 8px;
}

.dialog-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(121, 169, 170, 0.44);
}

.dialog-body .form-grid {
  padding-bottom: 28px;
}

.pagination-select {
  width: auto;
  min-width: 130px;
}

.page-count {
  min-width: 46px;
  text-align: center;
}

.mensagem {
  margin: 0 auto 18px;
  border: 1px solid #c5e2d2;
  border-radius: var(--radius-sm);
  background: #f5fff9;
  color: #3d7257;
  padding: 12px 14px;
  box-shadow: var(--shadow-control);
}

.mensagem.erro {
  border-color: #e9c1b1;
  background: #fff8f4;
  color: #9b4f39;
}

.erro {
  margin: 18px 0;
  border: 1px solid #e9c1b1;
  border-radius: var(--radius-sm);
  background: rgba(255, 248, 244, 0.88);
  color: #9b4f39;
  padding: 14px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    linear-gradient(180deg, #fbfdfd 0%, var(--bg) 52%, #edf4f4 100%);
  padding: 28px;
}

.auth-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 38px;
}

.auth-card .brand-logo {
  width: 168px;
}

.auth-brand {
  justify-items: center;
  text-align: center;
  color: var(--text);
  margin-bottom: 30px;
}

.auth-brand small {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form button {
  width: 100%;
}

@media (max-width: 1180px) {
  .dashboard-overview {
    grid-template-columns: 1fr;
  }

  .health-grid,
  .module-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-support {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .projecoes-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .form-panel {
    position: static;
  }
}

@media (max-width: 980px) {
  body:not(.auth-page) {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 14px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 28px);
    overflow: visible;
    border-radius: 24px;
  }

  .sidebar {
    position: static;
    height: auto;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(218, 226, 233, 0.78);
    max-width: 100vw;
    overflow: visible;
  }

  .sidebar-user {
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .sidebar-user .user-chip {
    min-height: 50px;
    width: min(260px, 42vw);
  }

  .sidebar-user .user-submenu {
    top: calc(100% + 10px);
    bottom: auto;
    right: auto;
    left: 0;
    width: min(242px, calc(100vw - 32px));
  }

  .sidebar-user .user-submenu::before {
    top: -6px;
    right: auto;
    bottom: auto;
    left: 156px;
    border: 0;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .main {
    height: auto;
    overflow: visible;
    padding: 30px 26px 34px;
  }

  .brand {
    flex: 0 0 auto;
    margin-bottom: 0;
  }

  .nav-list {
    flex: 1 1 auto;
    grid-auto-flow: column;
    overflow-x: auto;
    overflow-y: hidden;
    min-width: 0;
    scroll-snap-type: x proximity;
  }

  .nav-list a {
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .logout-button {
    flex: 0 0 auto;
    margin-top: 0;
    min-width: 74px;
    width: auto;
  }

  .kpi-support {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-support .kpi {
    padding: 18px;
  }

  .kpi-support .kpi strong {
    font-size: 19px;
  }

  .kpi-compact strong {
    font-size: 20px;
  }

  .kpi-primary strong {
    font-size: 32px;
  }

  .form-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .period-filter {
    grid-template-columns: minmax(180px, 1fr) minmax(150px, 180px) auto;
  }
}

@media (max-width: 640px) {
  body:not(.auth-page) {
    padding: 0;
  }

  .app-shell {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .main {
    padding: 24px 16px 28px;
  }

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

  .topbar h1 {
    font-size: 29px;
  }

  .topbar p {
    font-size: 14px;
  }

  .periodo-topbar {
    display: flex;
    margin: 4px 0 0;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .form-grid,
  .form-grid.compact,
  .health-grid,
  .table-toolbar,
  .period-filter {
    grid-template-columns: 1fr;
  }

  .kpi-support {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .kpi {
    padding: 17px 18px;
  }

  .kpi strong {
    font-size: 21px;
  }

  .panel-header,
  .table-toolbar,
  .pagination {
    padding-right: 18px;
    padding-left: 18px;
  }

  .form-grid {
    padding: 18px;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions button {
    flex: 1 1 150px;
  }

  .period-submit {
    width: 100%;
  }

  .pagination {
    gap: 8px;
  }

  .sidebar {
    flex-wrap: wrap;
  }

  .nav-list {
    flex-basis: 100%;
    order: 3;
  }

  .sidebar-user {
    order: 2;
  }

  .sidebar-user .user-chip {
    width: min(100%, 212px);
  }

  .auth-page {
    padding: 16px;
  }

  .auth-card {
    padding: 30px 24px;
  }
}
