:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #677086;
  --line: #dde3ee;
  --brand: #176b87;
  --brand-strong: #0d4f66;
  --accent: #d94f30;
  --ok: #1f8a5b;
  --warn: #a96c00;
  --danger: #b42318;
  --radius: 8px;
  --app-menu-offset: 112px;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-width: 320px;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  cursor: pointer;
  border-radius: var(--radius);
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: #2d3649;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 24px 68px;
  background:
    linear-gradient(rgba(17, 32, 51, 0.72), rgba(17, 32, 51, 0.72)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 24px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.login-panel h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  margin: 8px 0 12px;
}

.login-logo {
  width: min(260px, 100%);
  height: auto;
  margin-bottom: 18px;
}

.portal-logo {
  width: 150px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.16));
}

.credential-box {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding-top: var(--app-menu-offset);
  padding-bottom: 48px;
}

.app-footer {
  width: min(100%, 1800px);
  margin: 0 auto;
  padding: 10px clamp(16px, 2.2vw, 28px) 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.app-shell > .app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  width: 100%;
  max-width: none;
  padding: 9px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 24px rgba(23, 32, 51, 0.08);
}

.app-footer [data-app-version] {
  color: var(--brand-strong);
}

.login-footer {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 14px;
  width: auto;
  color: rgba(255, 255, 255, 0.82);
}

.login-footer [data-app-version] {
  color: #fff;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: #172033;
  color: #fff;
  box-shadow: 0 8px 28px rgba(23, 32, 51, 0.18);
}

.sidebar > div:first-child {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 170px;
}

.sidebar > div:first-child .portal-logo {
  justify-self: center;
}

.sidebar > div:first-child .eyebrow {
  justify-self: center;
  text-align: center;
}

.sidebar h2 {
  font-size: 1rem;
  white-space: nowrap;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 800;
}

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

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
  padding: 4px 2px;
  scrollbar-width: thin;
}

.nav button {
  flex: 0 0 auto;
  text-align: center;
  background: transparent;
  color: #c8d3e4;
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.nav button.active,
.nav button:hover {
  background: #24344f;
  color: #fff;
}

.nav-group {
  position: relative;
  flex: 0 0 auto;
}

.nav-parent {
  width: 100%;
}

.nav-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  display: none;
  min-width: 190px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: #172033;
  box-shadow: 0 16px 34px rgba(23, 32, 51, 0.28);
}

.nav-group.open .nav-submenu,
.nav-group:hover .nav-submenu,
.nav-group:focus-within .nav-submenu {
  display: grid;
  gap: 6px;
}

.nav-submenu button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.nav-group.has-active > .nav-parent {
  background: #24344f;
  color: #fff;
}

.user-card {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
}

.user-card small {
  color: #aebcd2;
  grid-column: 1;
}

.user-card button {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-height: 34px;
  padding: 0 12px;
}

.workspace {
  width: min(100%, 1800px);
  margin-inline: auto;
  padding: clamp(16px, 2.2vw, 28px);
  display: grid;
  gap: 24px;
  align-content: start;
  min-width: 0;
}

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

.topbar h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.view {
  display: none;
}

.active-view {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.panel,
.request-card,
.metrics article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(23, 32, 51, 0.06);
}

.panel {
  padding: 20px;
  min-width: 0;
}

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

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

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

.primary {
  background: var(--brand);
  color: #fff;
}

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

.link-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--brand-strong);
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button:hover {
  color: var(--brand);
}

.secondary {
  background: #e9f3f7;
  color: var(--brand-strong);
}

.ghost {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

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

.success {
  background: var(--ok);
  color: #fff;
}

.success:hover {
  filter: brightness(0.95);
}

.whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: #e4f8ed;
  color: #137d42;
  text-decoration: none;
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metrics article {
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}

.report-company-budget strong {
  display: block;
  margin-top: 8px;
  color: var(--brand-dark);
}

.metrics span {
  display: block;
  max-width: 100%;
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
  word-break: normal;
}

.report-company-budget span {
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

.metrics small,
.request-card dl,
.request-card p,
.lists {
  color: var(--muted);
}

.dashboard-period-form {
  display: flex;
  align-items: end;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  padding: 14px;
  margin-bottom: 14px;
}

.dashboard-period-form label {
  min-width: 150px;
}

.dashboard-period-form select {
  min-width: 150px;
}

.dashboard-metric-card {
  border-color: var(--metric-line, var(--line));
  background: var(--metric-bg, var(--panel));
  color: var(--metric-color, var(--ink));
}

.dashboard-metric-card small {
  color: var(--metric-color, var(--muted));
  font-weight: 900;
}

.metric-waiting {
  --metric-bg: #fffbeb;
  --metric-line: #fde68a;
  --metric-color: #a96c00;
}

.metric-approved {
  --metric-bg: #f0fdf4;
  --metric-line: #bbf7d0;
  --metric-color: #15803d;
}

.metric-total {
  --metric-bg: #eff6ff;
  --metric-line: #bfdbfe;
  --metric-color: #1d4ed8;
}

.metric-rejected {
  --metric-bg: #fef2f2;
  --metric-line: #fecaca;
  --metric-color: #b42318;
}

.request-grid,
.budget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.annual-budget-form h3 {
  grid-column: 1 / -1;
}

.annual-budget-months {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.dashboard-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.dashboard-section-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.dashboard-section-title h2 {
  font-size: 1.08rem;
  color: #354056;
}

.fiscal-month-dash {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.fiscal-month-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(23, 32, 51, 0.06);
}

.fiscal-month-card h3 {
  font-size: 1rem;
  color: #354056;
}

.fiscal-month-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.fiscal-month-stat {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #f8fafc;
}

.fiscal-month-stat span {
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 900;
}

.fiscal-month-stat small {
  color: var(--muted);
  font-weight: 900;
}

.fiscal-month-stat strong {
  font-size: 0.94rem;
  white-space: nowrap;
}

.fiscal-total {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.fiscal-posted {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.fiscal-missing {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b42318;
}

.store-budget-dash {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  margin: 16px 0;
}

.store-budget-card {
  min-height: 156px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  text-align: left;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow);
}

.store-budget-card:hover,
.store-budget-card.active {
  border-color: var(--store-color, var(--brand));
  background: color-mix(in srgb, var(--store-color, var(--brand)) 10%, #fff);
}

.store-budget-card span,
.store-budget-card em {
  font-size: 0.86rem;
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.store-budget-card strong {
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--store-color, var(--brand));
}

.store-budget-card small {
  color: var(--muted);
  font-weight: 800;
}

.store-budget-values {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.store-budget-values .over {
  color: var(--danger);
}

.request-grid {
  align-items: start;
  overflow: visible;
}

.kanban-column {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.kanban-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #eef6f8;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--brand-strong);
}

.kanban-list {
  display: grid;
  gap: 12px;
}

.column-picker {
  margin-bottom: 12px;
}

.inline-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.inline-filter select {
  min-height: 34px;
}

.department-budget-panel {
  display: grid;
  gap: 10px;
}

.budget-summary-line {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 10px;
}

.budget-summary-line > span {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.budget-summary-line strong {
  color: var(--ink);
}

.budget-summary-card {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.budget-summary-card.selected {
  border-color: rgba(26, 115, 141, 0.38);
  background: #eef9fb;
}

.budget-summary-card strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.budget-summary-card b {
  color: var(--ink);
}

.danger-text {
  color: var(--danger) !important;
}

.budget-flags {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 10px;
}

.check-list.budget-flags label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: center;
}

.check-list.budget-flags label.budget-limit-row {
  grid-template-columns: minmax(0, 1fr) 112px minmax(125px, auto);
}

.budget-limit-row small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

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

.account-alert-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  cursor: pointer;
}

.account-alert-card:has(input:checked) {
  border-color: #8ccfdc;
  background: #eef9fb;
  color: var(--brand-strong);
}

.account-alert-card input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.account-alert-card span {
  display: grid;
  gap: 3px;
}

.account-alert-card small {
  color: var(--muted);
  font-weight: 700;
}

.supplier-scope-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.supplier-scope-grid .approval-scope {
  min-width: 0;
}

.account-scope-grid .approval-scope {
  min-width: 0;
}

.account-select-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.account-select-all {
  width: max-content;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
  font-weight: 900;
}

.supplier-account-option {
  align-items: flex-start;
  border-left: 5px solid var(--department-color, var(--brand));
  border-radius: 7px;
  padding: 7px 8px;
  background: #f8fbfc;
}

.supplier-account-option span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.supplier-account-option strong {
  color: var(--text);
  font-size: 0.9rem;
}

.supplier-account-option small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.supplier-account-option em {
  color: var(--department-color, var(--brand));
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.supplier-filter-form {
  display: grid;
  grid-template-columns: minmax(min(220px, 100%), 1fr) minmax(140px, 160px) max-content;
  gap: 12px;
  align-items: end;
}

#supplierLists {
  display: block;
}

.supplier-table-wrap {
  padding: 0;
}

.account-table-wrap {
  padding: 0;
}

.account-table-wrap th:last-child,
.account-table-wrap td:last-child {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.account-table-wrap .row-actions {
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.status-pill.inactive {
  background: #fff1f2;
  color: var(--danger);
}

.status-pill.success {
  background: #dcfce7;
  color: var(--ok);
}

.status-pill.danger {
  background: #fee4e2;
  color: var(--danger);
}

.small-action {
  width: max-content;
  min-width: 96px;
  min-height: 42px;
  padding-inline: 14px;
  align-self: end;
}

.compact-report {
  align-items: end;
}

#fiscalValidationForm {
  grid-template-columns: minmax(min(220px, 100%), 300px) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

#fiscalValidationForm .fiscal-company-field {
  max-width: 300px;
}

#fiscalValidationForm .fiscal-company-field select {
  height: 42px;
}

.fiscal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-self: end;
  width: 100%;
}

.fiscal-actions .small-action {
  width: auto;
  min-width: 126px;
  min-height: 38px;
  padding-inline: 10px;
}

.fiscal-source-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fiscal-state-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfc;
  color: var(--muted);
  font-size: 12px;
}

.fiscal-state-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.fiscal-state-item + .fiscal-state-item {
  padding-top: 8px;
}

.fiscal-state-item strong {
  color: var(--text);
}

.fiscal-state-item span,
.fiscal-state-item small {
  color: var(--muted);
  font-weight: 700;
}

.fiscal-auto-status {
  margin: -8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.fiscal-history-form {
  display: grid;
  grid-template-columns:
    minmax(min(190px, 100%), 250px)
    minmax(150px, 170px)
    minmax(150px, 170px)
    minmax(112px, 132px)
    minmax(112px, 132px)
    minmax(190px, 240px)
    minmax(360px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
}

.fiscal-history-form input[type="date"],
.fiscal-search-field input,
#fiscalNbsStatus,
#fiscalDocumentType {
  min-width: 0;
}

.fiscal-history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: end;
  justify-self: end;
  width: 100%;
}

.fiscal-history-button {
  width: auto;
  min-width: 108px;
  min-height: 38px;
  padding-inline: 10px;
}

#fiscalExternalValidateButton {
  min-width: 168px;
}

#fiscalExportXlsButton {
  background: #dcfce7;
  color: #15803d;
}

#fiscalExportPdfButton {
  background: #fee2e2;
  color: #b42318;
}

#fiscalValidationSummary {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

#fiscalValidationSummary .fiscal-money-card {
  grid-column: span 2;
}

#fiscalValidationSummary .fiscal-money-card span {
  font-size: 1.9rem;
  white-space: nowrap;
}

.pagination-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.check-inline {
  min-height: 42px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: end;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfc;
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}

.check-inline input {
  width: auto;
  min-height: auto;
  margin: 0;
}

.budget-card {
  padding: 18px;
}

.budget-row {
  display: grid;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.budget-row:first-of-type {
  border-top: 0;
}

.report-department-row {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-left: 5px solid var(--department-color, var(--brand));
  padding-left: 12px;
}

.report-department-row:first-of-type {
  border-top: 0;
}

.report-department-row summary {
  display: grid;
  gap: 7px;
  cursor: pointer;
  list-style: none;
}

.report-department-row summary::-webkit-details-marker {
  display: none;
}

.report-account-list {
  display: grid;
  gap: 8px;
  padding: 10px 0 0 18px;
}

.report-account-row {
  display: grid;
  gap: 6px;
}

.account-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 26px;
  min-height: 26px;
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid #b8dce6;
  border-radius: 999px;
  background: #eef9fb;
  color: #174c5b;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
  cursor: help;
}

.account-help::before {
  content: attr(data-help);
  position: absolute;
  z-index: 30;
  left: 0;
  bottom: calc(100% + 10px);
  display: none;
  width: min(340px, 78vw);
  padding: 12px 14px;
  border: 1px solid #b8dce6;
  border-radius: 10px;
  background: #eef9fb;
  box-shadow: 0 16px 32px rgba(21, 57, 74, 0.16);
  color: #174c5b;
  white-space: normal;
}

.account-help::after {
  content: "";
  position: absolute;
  z-index: 31;
  left: 10px;
  bottom: calc(100% + 5px);
  display: none;
  width: 10px;
  height: 10px;
  border-right: 1px solid #b8dce6;
  border-bottom: 1px solid #b8dce6;
  background: #eef9fb;
  transform: rotate(45deg);
}

.account-help:hover::before,
.account-help:focus::before,
.account-help:hover::after,
.account-help:focus::after {
  display: block;
}

.budget-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--bar-width, 0%);
  background: var(--bar-color, var(--store-color, var(--brand)));
}

.bar.over span {
  background: var(--danger);
}

.pie-card {
  min-height: 300px;
}

.pie-layout {
  display: grid;
  justify-items: center;
  align-items: start;
  gap: 16px;
  margin-top: 14px;
}

.pie-chart {
  width: min(170px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--pie));
  box-shadow: inset 0 0 0 18px #fff, 0 8px 22px rgba(23, 32, 51, 0.12);
}

.pie-legend {
  width: 100%;
  display: grid;
  gap: 8px;
}

.legend-row {
  width: 100%;
  min-height: 0;
  padding: 7px 8px;
  border-radius: var(--radius);
  background: transparent;
  font-weight: 700;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  color: #354056;
  text-align: left;
}

.legend-row:not(:disabled):hover,
.legend-row.active {
  background: #e9f3f7;
  color: var(--brand-strong);
}

.legend-row:disabled {
  cursor: default;
}

.legend-row small {
  color: var(--muted);
  font-weight: 800;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot);
}

.request-card {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.invoice-form {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 32, 51, 0.58);
}

.modal-panel {
  width: min(520px, 100%);
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(23, 32, 51, 0.28);
}

.modal-panel.wide-modal {
  width: min(820px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.modal-head h2 {
  margin: 4px 0 0;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.status {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.status.aprovada {
  background: #dcfce7;
  color: var(--ok);
}

.status.reprovada {
  background: #fee4e2;
  color: var(--danger);
}

.status.cancelada {
  background: #f1f5f9;
  color: #64748b;
}

.status.supervisor,
.status.gerente,
.status.master {
  background: #fff4d6;
  color: var(--warn);
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 7px 10px;
  margin: 0;
  font-size: 0.92rem;
}

dt {
  font-weight: 800;
  color: #354056;
}

dd {
  margin: 0;
}

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

.section-actions {
  display: flex;
  justify-content: flex-end;
}

.compact-search {
  grid-template-columns: minmax(170px, 230px) minmax(190px, 260px) minmax(170px, 220px) auto;
  align-items: end;
}

.compact-search button {
  width: auto;
  min-height: 42px;
  padding-inline: 18px;
  justify-self: start;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.table-head span {
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  width: 100%;
  max-width: calc(100vw - clamp(32px, 4.4vw, 56px));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.request-table th,
.request-table td {
  white-space: nowrap;
}

.request-table td:nth-child(6) {
  min-width: 220px;
  white-space: normal;
}

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

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.request-search-list {
  display: grid;
  gap: 10px;
}

.request-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.request-search-row.has-actions {
  grid-template-columns: minmax(0, 1fr) 214px;
}

.request-search-fields {
  display: grid;
  grid-template-columns: var(--request-search-columns);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.request-search-field {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.request-search-field small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.request-search-field strong {
  min-width: 0;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.request-search-actions {
  justify-self: end;
  width: 214px;
}

.request-search-actions .row-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.request-search-actions .row-actions button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.74rem;
}

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

.subnav button {
  background: #e9eef6;
  color: #354056;
}

.subnav button.active {
  background: var(--brand);
  color: #fff;
}

.user-subview {
  display: none;
  gap: 16px;
}

.active-subview {
  display: grid;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #354056;
}

.tag input {
  width: auto;
}

.approval-scope {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

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

.scope-grid span {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

.check-list {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.check-list input {
  width: auto;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #354056;
  font-weight: 900;
  background: #f8fafc;
}

.comparison-table th,
.comparison-table td {
  min-width: 150px;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
  min-width: 190px;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
}

.comparison-table th:first-child {
  z-index: 2;
  background: #f8fafc;
}

.comparison-cell {
  display: grid;
  gap: 6px;
}

.comparison-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.comparison-bar i {
  display: block;
  width: var(--bar-width, 0%);
  height: 100%;
  background: var(--brand);
}

.fiscal-supplier-cnpj {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.supplier-check,
.mini-add-supplier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.supplier-check {
  background: #dcfce7;
  color: #15803d;
}

.mini-add-supplier {
  min-height: 22px;
  padding: 0;
  border: 1px solid #9ed6e2;
  background: #eef9fb;
  color: var(--brand-strong);
  cursor: pointer;
}

.mini-add-supplier:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 1180px) {
  :root {
    --app-menu-offset: 164px;
  }

  .sidebar {
    grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  }

  .user-card {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .fiscal-history-form {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .fiscal-history-actions {
    grid-column: 1 / -1;
  }

  .fiscal-month-dash {
    grid-template-columns: 1fr;
  }

  #fiscalValidationSummary .fiscal-money-card {
    grid-column: span 1;
  }
}

@media (max-width: 980px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .supplier-scope-grid,
  .account-scope-grid,
  .supplier-filter-form,
  #fiscalValidationForm,
  .compact-search {
    grid-template-columns: 1fr;
  }

  .small-action,
  .compact-search button,
  .supplier-filter-form button {
    width: 100%;
  }
}

.records-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.lists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 14px;
}

.list-card {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.list-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
}

.account-tree {
  display: grid;
  gap: 12px;
}

.account-tree details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.account-tree summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-weight: 900;
}

.account-tree summary small {
  color: var(--muted);
  font-weight: 800;
}

.account-tree-company > summary {
  background: #f0f7f9;
  color: var(--brand-strong);
}

.account-tree-departments {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.account-tree-department > summary {
  background: #f8fafc;
}

.account-tree-accounts {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.account-tree-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.account-tree-row strong {
  display: inline-block;
  font-size: 0.92rem;
  line-height: 1.2;
}

.account-tree-row p {
  display: inline-block;
  margin: 0 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.account-budget-batch {
  display: grid;
  gap: 8px;
}

.account-budget-batch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfc;
}

.account-budget-batch-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.account-budget-batch-row strong {
  color: var(--text);
  font-size: 0.92rem;
}

.account-budget-batch-row small {
  color: var(--muted);
  font-weight: 700;
}

.account-budget-batch-row input {
  min-width: 0;
}

.error {
  color: var(--danger);
  min-height: 20px;
}

@media (max-width: 860px) {
  :root {
    --app-menu-offset: 214px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
    max-height: 70vh;
    overflow-y: auto;
  }

  .sidebar > div:first-child {
    min-width: 0;
    justify-items: center;
  }

  .portal-logo {
    width: 120px;
  }

  .user-card {
    grid-template-columns: 1fr auto;
  }

  .nav {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-group {
    width: auto;
  }

  .nav-submenu {
    position: absolute;
    margin-top: 0;
    box-shadow: 0 16px 34px rgba(23, 32, 51, 0.28);
  }

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

  .metrics,
  .fiscal-month-values,
  .budget-grid,
  .form-grid,
  .supplier-scope-grid,
  .supplier-filter-form,
  #fiscalValidationForm,
  .fiscal-history-form,
  .records-layout {
    grid-template-columns: 1fr;
  }

  .compact-search {
    grid-template-columns: 1fr;
  }

  .fiscal-history-actions {
    justify-content: stretch;
  }

  .request-search-actions .row-actions button {
    padding-inline: 6px;
  }

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

  .fiscal-history-button,
  #fiscalExternalValidateButton {
    width: 100%;
  }

  .pie-chart {
    width: 130px;
  }

  .workspace {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  :root {
    --app-menu-offset: 198px;
  }

  .login-shell {
    padding: 14px;
  }

  .login-panel,
  .panel,
  .modal-panel {
    padding: 16px;
  }

  .workspace {
    gap: 16px;
    padding: 14px;
  }

  .sidebar {
    padding: 12px;
  }

  .portal-logo {
    width: 112px;
  }

  .metrics span {
    font-size: clamp(1.35rem, 6vw, 1.7rem);
  }

  .fiscal-actions,
  .fiscal-history-actions,
  .actions,
  .row-actions,
  .section-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .fiscal-actions .small-action,
  .row-actions button,
  .actions button,
  .actions a,
  .section-actions button {
    width: 100%;
  }

  .table-wrap {
    max-width: calc(100vw - 28px);
  }
}
