:root {
  color-scheme: light;
  --bg: #f6f8f8;
  --panel: #ffffff;
  --ink: #172326;
  --muted: #637276;
  --line: #dce4e6;
  --brand: #165a72;
  --brand-strong: #0e4051;
  --accent: #2f8f6b;
  --danger: #b84242;
  --warning: #9b6a13;
  --shadow: 0 14px 36px rgba(15, 40, 50, 0.1);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

.sidebar {
  background: #102e3a;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f4c95d;
  color: #102e3a;
  font-weight: 800;
  font-size: 1.3rem;
}

.brand strong,
.brand small {
  display: block;
}

.app-version {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 5px;
  padding: 2px 6px;
  border: 1px solid rgba(244, 201, 93, 0.42);
  border-radius: 999px;
  background: rgba(244, 201, 93, 0.12);
  color: #f4c95d;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  white-space: nowrap;
}

.brand small {
  color: #b8ced5;
  margin-top: 3px;
}

.sidebar-user {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: -18px;
  padding-left: 56px;
}

.sidebar-user span {
  min-width: 0;
  overflow: hidden;
  color: #b8ced5;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f4c95d;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sidebar-user-actions {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

.sidebar-help-link {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background: linear-gradient(135deg, #f6f8f8 0%, #e8f4f5 100%);
}

.auth-card {
  width: min(100%, 380px);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.auth-card h1 {
  font-size: 1.45rem;
}

.auth-card .app-version {
  border-color: #c8dfe5;
  background: #e8f4f5;
  color: var(--brand);
}

.auth-card form {
  display: grid;
  gap: 12px;
}

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

.auth-card button {
  width: 100%;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 90px;
}

.password-toggle,
.auth-card .password-toggle,
.choice-dialog .password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  width: auto;
  min-height: 28px;
  padding: 0 9px;
  transform: translateY(-50%);
  border: 1px solid #c8dfe5;
  border-radius: 6px;
  background: #edf7f7;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.password-toggle:hover {
  background: #dff0f2;
}

.password-toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-error {
  min-height: 18px;
  color: var(--danger);
  font-weight: 700;
}

.auth-error.is-success {
  color: var(--success);
}

@media (max-width: 560px) {
  .auth-form-grid {
    grid-template-columns: 1fr;
  }
}

body.is-showing-welcome {
  overflow: hidden;
}

html.has-pending-welcome body {
  background: #102e3a;
}

html.has-pending-welcome .app-shell {
  visibility: hidden;
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(16, 46, 58, 0.96) 0%, rgba(22, 90, 114, 0.92) 44%, rgba(246, 248, 248, 0.98) 44.2%, rgba(246, 248, 248, 1) 100%);
  animation: welcome-fade-in 180ms ease-out both;
}

.welcome-screen.is-leaving {
  pointer-events: none;
  animation: welcome-fade-out 240ms ease-in both;
}

.welcome-card {
  width: min(100%, 520px);
  display: grid;
  gap: 22px;
  padding: 30px;
  border: 1px solid rgba(220, 228, 230, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(8, 30, 38, 0.24);
}

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

.welcome-brand img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
}

.welcome-brand strong,
.welcome-brand span {
  display: block;
}

.welcome-brand strong {
  color: var(--brand-strong);
  font-size: 1.35rem;
}

.welcome-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.welcome-brand .app-version {
  display: inline-flex;
  margin-top: 0;
  border-color: #c8dfe5;
  background: #e8f4f5;
  color: var(--brand);
  font-size: 0.68rem;
}

.welcome-copy {
  display: grid;
  gap: 8px;
}

.welcome-copy h1 {
  color: var(--ink);
  font-size: 2rem;
  line-height: 1.08;
}

.welcome-copy p:last-child {
  color: var(--muted);
  line-height: 1.5;
}

.welcome-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}

.welcome-status span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8f4f5;
  color: var(--brand-strong);
  font-weight: 800;
}

.welcome-status strong {
  color: var(--brand);
}

.welcome-progress {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce4e6;
}

.welcome-progress span {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #165a72, #12a6b3, #f4c95d);
  animation: welcome-progress 1.15s ease-in-out infinite;
}

@keyframes welcome-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes welcome-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes welcome-progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(230%);
  }
}

@media (max-width: 640px) {
  .welcome-screen {
    padding: 18px;
    background:
      linear-gradient(160deg, rgba(16, 46, 58, 0.96) 0%, rgba(22, 90, 114, 0.92) 34%, rgba(246, 248, 248, 0.98) 34.2%, rgba(246, 248, 248, 1) 100%);
  }

  .welcome-card {
    gap: 18px;
    padding: 22px;
  }

  .welcome-brand img {
    width: 48px;
    height: 48px;
  }

  .welcome-brand strong {
    font-size: 1.18rem;
  }

  .welcome-brand span {
    font-size: 0.78rem;
  }

  .welcome-copy h1 {
    font-size: 1.55rem;
  }
}

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

nav > [data-view="dashboard"] {
  order: 1;
}

nav > [data-view="clientes"] {
  order: 2;
}

nav > [data-view="servicos"] {
  order: 3;
}

nav > [data-menu-group="financeiro"] {
  order: 4;
}

nav > [data-menu-group="administracao"] {
  order: 6;
}

nav > [data-submenu="financeiro"] {
  order: 5;
}

nav > [data-submenu="administracao"] {
  order: 7;
}

nav > [data-view="ajuda"] {
  order: 8;
}

.nav-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  color: #dcebf0;
  background: transparent;
}

.nav-button:hover,
.nav-button.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-submenu {
  display: grid;
  gap: 6px;
  margin-top: -3px;
  padding-left: 14px;
}

.nav-submenu[hidden] {
  display: none !important;
}

.nav-menu-toggle.is-open {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-sub-button {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 0.88rem;
  color: #c7dbe2;
}

.help-panel .toolbar {
  align-items: flex-start;
}

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

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

.help-section,
.help-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

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

.help-section h3,
.help-grid h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.help-section p,
.help-grid p {
  color: var(--muted);
}

.help-section ol,
.help-section ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
}

.help-section li::marker {
  color: var(--brand);
  font-weight: 800;
}

.help-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--brand);
  background: #eef8fa;
  color: #164a59 !important;
  font-weight: 700;
}

.help-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.help-flow span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid #cfe2e8;
  border-radius: 8px;
  background: #f5fbfc;
  color: var(--brand-dark);
  font-weight: 800;
  text-align: center;
}

.documentation-panel {
  display: grid;
  gap: 16px;
}

.documentation-toolbar {
  align-items: center;
}

.documentation-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 16px;
}

.documentation-index {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 14px;
  background: #f7fafb;
}

.documentation-index label {
  display: grid;
  gap: 6px;
  color: #52656c;
  font-size: 0.8rem;
  font-weight: 800;
}

.documentation-index input {
  width: 100%;
}

.documentation-filter-group {
  display: grid;
  gap: 8px;
}

.documentation-filter-group h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 0.86rem;
}

.documentation-filter-links,
.documentation-tags,
.documentation-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.documentation-filter-links button,
.documentation-tags button,
.documentation-filter-chip {
  border: 1px solid #cfe2e8;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.documentation-filter-links button:hover,
.documentation-filter-links button.is-active,
.documentation-tags button:hover,
.documentation-filter-chip:hover {
  border-color: var(--brand);
  background: #e7f7f8;
}

.documentation-results {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.documentation-result-summary {
  align-items: baseline;
  display: flex;
  gap: 8px;
  color: #52656c;
}

.documentation-result-summary strong {
  color: var(--brand-dark);
  font-size: 1.4rem;
}

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

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

.documentation-card h3 {
  margin: 2px 0 6px;
  color: var(--ink);
  font-size: 1.04rem;
}

.documentation-card p,
.documentation-card li {
  color: var(--muted);
  line-height: 1.45;
}

.documentation-card ul {
  display: grid;
  gap: 6px;
  margin: 0 0 0 18px;
}

.documentation-card li::marker {
  color: var(--brand);
  font-weight: 800;
}

.sidebar-tools {
  display: grid;
  gap: 14px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-tools h2 {
  margin: 0;
  color: #fff;
  font-size: 0.88rem;
}

.sidebar-actions {
  display: grid;
  gap: 8px;
}

.sidebar-actions button {
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-weight: 700;
  text-align: left;
  padding: 0 12px;
}

.sidebar-actions button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar-summary {
  display: grid;
  gap: 8px;
}

.sidebar-summary div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-summary span {
  color: #b8ced5;
  font-size: 0.75rem;
  font-weight: 700;
}

.sidebar-summary strong {
  color: #fff;
  font-size: 0.94rem;
}

.content {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

h2 {
  font-size: 1.1rem;
}

.topbar-actions,
.toolbar,
.form-actions,
.status-row,
.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

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

.row-actions .small-button {
  flex: 0 0 auto;
  min-width: 78px;
  padding-inline: 10px;
  text-align: center;
}

.sort-header {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 6px;
  justify-content: flex-start;
  padding: 0;
  text-align: left;
  width: 100%;
}

.sort-header:hover,
.sort-header.is-active {
  color: var(--brand);
}

.sort-marker {
  display: inline-block;
  min-width: 10px;
}

.row-actions [data-print-budget] {
  min-width: 92px;
}

.row-actions [data-share-budget] {
  min-width: 128px;
}

.budget-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  grid-column: 1 / -1;
}

.budget-form-actions button {
  width: auto;
  min-width: 132px;
}

.primary-button,
.success-button,
.ghost-button,
.danger-button,
.small-button {
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

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

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

.success-button {
  background: #198754;
  color: #fff;
}

.success-button:hover {
  background: #146c43;
}

.ghost-button,
.small-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

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

.small-button {
  min-height: 34px;
  padding: 0 8px;
  font-size: 0.86rem;
}

a.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.view {
  display: none;
}

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

.hidden {
  display: none !important;
}

.floating-message {
  position: fixed;
  left: 50%;
  top: 18px;
  z-index: 9999;
  max-width: min(520px, calc(100vw - 28px));
  transform: translate(-50%, -16px);
  border: 1px solid #e0b400;
  border-radius: 8px;
  background: #fff3b0;
  color: #b00020;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.floating-message.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.floating-message.is-success {
  border-color: #188a57;
  background: #e5f7ee;
  color: #0b5a38;
}

.processing-message {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(16, 46, 58, 0.35);
}

.processing-message.is-visible {
  display: grid;
}

.processing-dialog {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.processing-dialog strong,
.processing-dialog small {
  display: block;
}

.processing-dialog small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.processing-spinner {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 4px solid #dce4e6;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: processing-spin 0.8s linear infinite;
}

@keyframes processing-spin {
  to {
    transform: rotate(360deg);
  }
}

.choice-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 45, 55, 0.45);
}

.approved-budget-locked input:disabled,
.approved-budget-locked textarea:disabled,
.approved-budget-locked select:disabled,
.approved-budget-locked button:disabled {
  border-color: #cbd4d7;
  background: #edf1f2;
  color: #7a878b;
  opacity: 1;
}

.approved-budget-locked [name="status"] {
  border-color: #e0b400;
  background: #fff8cf;
  color: #8a1f1f;
  font-weight: 800;
}

.choice-dialog {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.choice-dialog h2,
.choice-dialog p {
  margin: 0;
}

.choice-dialog h2 {
  font-size: 1.1rem;
}

.choice-dialog p {
  color: var(--muted);
}

.choice-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard-banner {
  overflow: hidden;
  background: transparent;
}

.dashboard-banner img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: contain;
}

.dashboard-charts {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.chart-card {
  min-height: 292px;
  box-shadow: none;
}

.chart-card h2 {
  margin-bottom: 12px;
}

.chart-empty {
  display: grid;
  min-height: 200px;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.pie-chart {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.pie-chart svg {
  width: 150px;
  height: 150px;
}

.chart-legend {
  display: grid;
  gap: 8px;
}

.chart-legend div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 3px 8px;
  align-items: center;
  font-size: 0.82rem;
}

.chart-legend span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.chart-legend strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-legend small {
  grid-column: 2;
  color: var(--muted);
}

.bar-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(62px, 1fr);
  gap: 10px;
  min-height: 220px;
  align-items: end;
  overflow-x: auto;
  padding-bottom: 2px;
}

.bar-column {
  display: grid;
  grid-template-rows: auto 150px auto;
  gap: 6px;
  min-width: 62px;
  text-align: center;
}

.clickable-chart-item {
  cursor: pointer;
}

.clickable-chart-item:hover .bar-track {
  box-shadow: inset 0 0 0 2px rgba(22, 90, 114, 0.18);
}

.bar-value {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  min-height: 28px;
}

.bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  border-bottom: 1px solid var(--line);
}

.bar-track span {
  display: block;
  width: 74%;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #0aa8b5, #165a72);
}

.bar-label {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-list-panel .budget-table {
  font-size: 0.86rem;
}

.dashboard-list-panel th,
.dashboard-list-panel td {
  padding: 8px 9px;
}

.dashboard-list-panel .small-button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.84rem;
}

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

.split-grid {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: start;
}

.clientes-layout {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  gap: 20px 10px;
  align-items: start;
}

.client-logo-panel {
  display: grid;
  place-items: center;
  min-height: 302px;
  padding: 0 12px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fff;
}

.client-logo-panel img {
  display: block;
  width: min(238px, 100%);
  height: auto;
}

.clientes-list-panel {
  min-height: 184px;
  align-self: center;
  box-shadow: none;
}

.clientes-list-panel .toolbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.clientes-list-panel .toolbar input,
.list-search-input {
  max-width: none;
  width: 100%;
}

.clientes-list-panel .toolbar h2,
.servicos-list-panel .toolbar h2,
.usuarios-list-panel .toolbar h2,
.files-panel .toolbar h2 {
  margin-bottom: 0;
}

.cliente-list-new-button,
.servico-list-new-button,
.orcamento-list-new-button,
.usuario-list-new-button,
.files-list-refresh-button {
  display: inline-flex;
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 110px;
  width: auto;
}

.usuarios-list-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.usuarios-list-toolbar .usuario-new-action-button {
  display: inline-flex !important;
  align-items: center;
  flex: 0 0 auto;
  justify-content: center;
  margin-left: 0;
  min-width: 136px;
  width: auto;
}

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

.files-row-actions .small-button {
  flex: 0 0 auto;
}

@media (max-width: 920px) {
  .files-toolbar-refresh-button {
    display: none;
  }

  .files-list-refresh-button {
    display: block;
    margin-top: 9px;
    min-height: 38px;
    position: static;
    width: 100%;
    z-index: 2;
  }

  .files-table-wrap .files-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .files-table-wrap .files-row-actions .small-button {
    min-width: 0;
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}

.clientes-list-panel table {
  min-width: 650px;
}

.clientes-list-panel .table-wrap {
  max-height: 176px;
  overflow-y: auto;
}

.clientes-list-panel table {
  font-size: 0.9rem;
}

.clientes-list-panel th,
.clientes-list-panel td {
  padding: 8px 9px;
}

.clientes-list-panel .small-button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.86rem;
}

.clientes-list-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.cliente-form-panel {
  grid-column: 1 / -1;
  box-shadow: none;
}

.cliente-form-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr);
  gap: 12px 34px;
  align-items: start;
}

.cliente-form-grid h2 {
  grid-column: 1 / -1;
}

.cliente-form-grid label:has(textarea) {
  grid-column: span 1;
}

.cliente-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  grid-column: 1 / -1;
}

.cliente-form-actions button {
  width: auto;
  min-width: 132px;
}

.cliente-orcamentos-resumo {
  grid-column: 1 / -1;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cliente-orcamentos-resumo h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.cliente-orcamentos-resumo .table-wrap {
  max-height: 220px;
  overflow-y: auto;
}

.cliente-orcamentos-resumo table {
  width: 100%;
  min-width: 0;
  font-size: 0.9rem;
}

.cliente-orcamentos-resumo th,
.cliente-orcamentos-resumo td {
  padding: 8px 10px;
}

.servicos-layout {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  gap: 20px 10px;
  align-items: start;
}

.servico-logo-panel img {
  width: min(238px, 100%);
}

.servicos-list-panel {
  min-height: 184px;
  align-self: center;
  box-shadow: none;
}

.servicos-list-panel .toolbar {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.servicos-list-panel .table-wrap {
  max-height: 176px;
  overflow-y: auto;
}

.servicos-list-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.servicos-list-panel table {
  min-width: 650px;
  font-size: 0.9rem;
}

.servicos-list-panel th,
.servicos-list-panel td {
  padding: 8px 9px;
}

.servicos-list-panel .small-button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.86rem;
}

.servico-form-panel {
  grid-column: 1 / -1;
  box-shadow: none;
}

.servico-form-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr);
  gap: 12px 34px;
  align-items: start;
}

.servico-form-grid label:has(textarea) {
  grid-column: span 2;
}

.orcamentos-layout {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  gap: 20px 10px;
  align-items: start;
}

.usuarios-layout {
  display: grid;
  gap: 18px;
  align-items: start;
}

.orcamento-logo-panel img {
  width: min(238px, 100%);
}

.orcamento-logo-panel {
  min-height: 184px;
}

.orcamentos-list-panel {
  min-height: 184px;
  align-self: center;
  box-shadow: none;
}

.orcamentos-list-panel .toolbar {
  display: grid;
  gap: 12px;
}

.orcamentos-list-panel .table-wrap {
  max-height: 230px;
  overflow-y: auto;
}

.orcamentos-list-panel .table-wrap:has(.is-selected) {
  padding-bottom: 56px;
}

.orcamentos-list-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.orcamentos-list-panel table {
  font-size: 0.9rem;
}

.orcamentos-list-panel th,
.orcamentos-list-panel td {
  padding: 8px 9px;
}

.orcamentos-list-panel .small-button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.86rem;
}

.orcamento-form-panel {
  grid-column: 1 / -1;
  box-shadow: none;
}

.orcamento-form-grid {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr);
  gap: 12px 34px;
  align-items: start;
}

.usuario-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px 24px;
  align-items: start;
}

.checkbox-line {
  min-height: 40px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 20px;
  color: var(--ink);
  font-weight: 700;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.usuarios-list-panel .table-wrap {
  max-height: 260px;
  overflow-y: auto;
}

.usuarios-list-panel thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.files-table-wrap {
  max-height: 520px;
  overflow-y: auto;
}

.orcamento-form-grid .budget-client-search,
.orcamento-form-grid .budget-items,
.orcamento-form-grid .budget-client-line,
.orcamento-form-grid label:has(textarea),
.orcamento-form-grid .total-box {
  grid-column: span 2;
}

.budget-client-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.budget-service-line {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.budget-client-line label {
  min-width: 0;
}

.budget-item .budget-service-line label {
  grid-column: auto;
  min-width: 0;
}

.budget-client-add-button,
.budget-service-add-button {
  align-self: end;
  justify-self: end;
  width: 42px;
  min-width: 42px;
  min-height: 38px;
  height: 40px;
  padding-inline: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.panel,
.stat-card,
.empty-state {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.stat-card {
  padding: 18px;
}

.stat-card small {
  color: var(--muted);
  display: block;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.8rem;
}

#relatorios-view .report-stats-grid .stat-card {
  min-width: 0;
  padding: 12px;
}

#relatorios-view .report-stats-grid .stat-card small {
  font-size: 0.78rem;
  line-height: 1.15;
}

#relatorios-view .report-stats-grid .stat-card strong {
  overflow-wrap: anywhere;
  font-size: 1.28rem;
  line-height: 1.08;
}

#relatorios-view,
#relatorios-view .panel,
#relatorios-view .stat-card,
#relatorios-view .dashboard-charts,
#relatorios-view .reports-grid,
#relatorios-view .chart-card,
#relatorios-view .report-panel,
#relatorios-view .table-wrap {
  min-width: 0;
  max-width: 100%;
}

#relatorios-view {
  overflow-x: hidden;
}

#relatorios-view .report-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

#relatorios-view .dashboard-charts,
#relatorios-view .reports-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
}

#relatorios-view .table-wrap {
  overflow-x: hidden;
}

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

#relatorios-view .report-panel table {
  font-size: 0.8rem;
}

#relatorios-view .report-panel th,
#relatorios-view .report-panel td {
  padding: 7px 6px;
}

#relatorios-view .report-panel th:last-child,
#relatorios-view .report-panel td:last-child {
  width: 108px;
  text-align: right;
}

#relatorios-view .report-panel td:first-child {
  overflow-wrap: anywhere;
}

#relatorios-view .bar-chart {
  grid-auto-columns: minmax(0, 1fr);
  overflow-x: hidden;
}

#relatorios-view .bar-column {
  min-width: 0;
}

#relatorios-view .pie-chart {
  grid-template-columns: minmax(108px, 140px) minmax(0, 1fr);
}

#relatorios-view .chart-legend {
  min-width: 0;
}

@media (max-width: 760px) {
  #relatorios-view .pie-chart {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  #relatorios-view .pie-chart .chart-legend {
    width: 100%;
  }
}

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

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
}

.status-alert-field {
  background: #fff3b0;
  border-color: #e0b400;
  color: #b00020;
  font-weight: 800;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
}

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

.budget-table {
  min-width: 720px;
}

.budget-table th:last-child,
.budget-table td:last-child {
  width: 180px;
}

.clientes-list-panel table th:last-child,
.clientes-list-panel table td:last-child,
.servicos-list-panel table th:last-child,
.servicos-list-panel table td:last-child {
  width: 180px;
}

.orcamentos-list-panel .budget-table {
  min-width: 900px;
}

.orcamentos-list-panel .budget-table th:last-child,
.orcamentos-list-panel .budget-table td:last-child {
  width: 340px;
}

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #f1f7f9;
}

.clickable-row.is-selected td {
  background: #eaf4f7;
}

.budget-preview-row td {
  background: #f7fafb;
  padding: 0;
}

.budget-preview {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.budget-preview h3 {
  font-size: 0.95rem;
  margin: 0;
}

.budget-preview table {
  min-width: 0;
}

.budget-preview th,
.budget-preview td {
  padding: 8px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eaf4f0;
  color: #21664c;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge.warning {
  background: #fff3d9;
  color: var(--warning);
}

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

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

.password-policy-hint {
  grid-column: 1 / -1;
  margin: -4px 0 2px;
  font-size: 0.82rem;
  line-height: 1.35;
}

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

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

.budget-client-search {
  display: grid;
  gap: 8px;
}

.client-result-button {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: auto;
  padding: 10px 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.client-result-button:hover {
  border-color: var(--brand);
}

.client-result-button span {
  color: var(--muted);
  font-size: 0.82rem;
}

.budget-item {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  align-items: end;
}

.budget-item label:first-child {
  grid-column: 1 / -1;
}

.budget-item > .budget-service-line > label:first-child {
  grid-column: auto;
}

.budget-item button {
  min-height: 40px;
}

.total-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
  font-size: 1.2rem;
  font-weight: 800;
}

.print-area {
  display: none;
}

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

.report-export-panel {
  display: grid;
  gap: 14px;
}

.report-export-panel p {
  color: var(--muted);
  margin: 4px 0 0;
}

.report-export-actions {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(96px, 120px));
  justify-content: flex-start;
  padding-top: 12px;
}

.report-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(190px, 260px);
  gap: 12px;
  align-items: end;
}

.report-filter-grid label {
  min-width: 0;
}

.report-filter-grid input,
.report-filter-grid select {
  width: 100%;
}

.report-filter-grid .form-actions {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.report-filter-grid .form-actions button,
.report-export-actions button {
  justify-content: center;
  min-width: 96px;
  width: 100%;
}

.permissions-panel {
  border-top: 1px solid #dbe6e9;
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  padding-top: 10px;
}

.permissions-panel .toolbar {
  align-items: center;
  margin: 0;
}

.permission-toolbar-actions,
.permission-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-group {
  border: 1px solid #dbe6e9;
  border-radius: 6px;
  display: block;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.permission-group summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  list-style: none;
  min-height: 42px;
  padding: 9px 12px;
  user-select: none;
}

.permission-group summary::-webkit-details-marker {
  display: none;
}

.permission-group summary span {
  color: #165a72;
  font-weight: 800;
}

.permission-group summary::after {
  color: #60737a;
  content: "+";
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.permission-group[open] summary {
  border-bottom: 1px solid #dbe6e9;
}

.permission-group[open] summary::after {
  content: "-";
}

.permission-group-body {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  padding: 10px;
}

.permission-group-actions {
  grid-column: 1 / -1;
}

.auditoria-panel {
  display: grid;
  gap: 14px;
}

.audit-filters summary {
  display: none;
}

.audit-filter-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.audit-filter-grid .form-actions {
  grid-column: 1 / -1;
}

.audit-pagination {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.audit-maintenance {
  background: #f7fafb;
  border: 1px solid #d9e3e7;
  border-radius: 8px;
  padding: 12px;
}

.audit-maintenance summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  list-style: none;
}

.audit-maintenance summary::-webkit-details-marker {
  display: none;
}

.audit-maintenance summary::after {
  content: "Abrir";
  color: #165a72;
  font-size: 12px;
  font-weight: 800;
}

.audit-maintenance[open] summary::after {
  content: "Fechar";
}

.audit-maintenance summary span {
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.audit-maintenance small,
.audit-pagination span {
  color: #52656c;
  font-size: 13px;
}

.audit-maintenance-body {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.audit-maintenance label {
  color: #52656c;
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 4px;
  min-width: 120px;
}

.audit-maintenance select {
  border: 1px solid #d9e3e7;
  border-radius: 8px;
  min-height: 38px;
  padding: 0 10px;
}

.audit-pagination {
  border-top: 1px solid #e6edf0;
  padding-top: 10px;
}

.audit-table-wrap {
  max-height: 520px;
}

.audit-table-wrap code {
  color: #52656c;
  font-size: 11px;
  white-space: normal;
  word-break: break-word;
}

.report-panel {
  align-content: start;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 14px;
  }

  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-submenu {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 0;
  }

  .nav-button {
    text-align: center;
    padding-inline: 8px;
  }

  .content {
    padding: 18px;
  }

  .topbar,
  .split-grid,
  .stats-grid,
  .dashboard-charts,
  .reports-grid,
  .report-filter-grid,
  .audit-filter-grid,
  .clientes-layout,
  .cliente-form-grid,
  .servicos-layout,
  .servico-form-grid,
  .orcamentos-layout,
  .usuarios-layout,
  .orcamento-form-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .client-logo-panel,
  .cliente-form-panel,
  .servico-form-panel,
  .servico-form-grid label:has(textarea),
  .orcamento-form-panel,
  .orcamento-form-grid .budget-client-search,
  .orcamento-form-grid .budget-items,
  .orcamento-form-grid label:has(textarea),
  .orcamento-form-grid .total-box {
    grid-column: auto;
  }

  .budget-item {
    grid-template-columns: 1fr 1fr;
  }

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

  .audit-maintenance-body {
    align-items: stretch;
    flex-direction: column;
  }

  .audit-pagination .row-actions,
  .audit-maintenance button,
  .audit-maintenance label {
    width: 100%;
  }
}

@media (min-width: 641px) and (max-width: 920px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
  }

  .sidebar {
    position: sticky;
    inset: 0 0 auto;
    z-index: 5;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: max(8px, env(safe-area-inset-top)) 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 9px 20px rgba(8, 30, 38, 0.18);
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .brand strong {
    font-size: 0.9rem;
  }

  .brand small,
  .sidebar-tools,
  .client-logo-panel {
    display: none;
  }

  .sidebar-user {
    justify-self: end;
    max-width: min(100%, 320px);
    margin: 0;
    padding-left: 0;
  }

  .sidebar-user span {
    max-width: 240px;
  }

  nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
  }

  .nav-submenu {
    display: contents;
  }

  .nav-button,
  .nav-sub-button {
    min-width: 0;
    min-height: 36px;
    padding: 6px 4px;
    border-radius: 7px;
    font-size: 0.78rem;
    line-height: 1.15;
    text-align: center;
  }

  .content {
    width: 100%;
    padding: 12px;
  }

  .view.is-active {
    gap: 12px;
  }

  .dashboard-banner img {
    width: 100%;
    max-height: 92px;
    object-fit: contain;
  }

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

  .dashboard-charts,
  .reports-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .clientes-layout,
  .servicos-layout,
  .orcamentos-layout,
  .split-grid,
  .orcamento-form-grid,
  .usuarios-layout,
  .usuario-form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

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

  .cliente-form-grid label:has([name="endereco"]),
  .cliente-form-grid label:has(textarea),
  .servico-form-grid label:has([name="nome"]),
  .servico-form-grid label:has(textarea) {
    grid-column: 1 / -1;
  }

  .content .panel,
  .content .stat-card,
  .content .table-wrap,
  .dashboard-charts > *,
  .reports-grid > * {
    min-width: 0;
    max-width: 100%;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
  }

  .dashboard-list-panel .table-wrap {
    overflow-x: hidden;
  }

  .dashboard-list-panel .budget-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.78rem;
  }

  .dashboard-list-panel th,
  .dashboard-list-panel td {
    padding: 6px 5px;
  }

  .dashboard-list-panel .budget-table th:nth-child(6),
  .dashboard-list-panel .budget-table td:nth-child(6) {
    display: none;
  }

  .dashboard-list-panel .budget-table th:first-child,
  .dashboard-list-panel .budget-table td:first-child {
    width: 72px;
  }

  .dashboard-list-panel .budget-table th:nth-child(3),
  .dashboard-list-panel .budget-table td:nth-child(3) {
    width: 86px;
  }

  .dashboard-list-panel .budget-table th:nth-child(4),
  .dashboard-list-panel .budget-table td:nth-child(4) {
    width: 104px;
  }

  .dashboard-list-panel .budget-table th:nth-child(5),
  .dashboard-list-panel .budget-table td:nth-child(5) {
    width: 108px;
  }

  .dashboard-list-panel .budget-table td:nth-child(2) {
    overflow-wrap: anywhere;
  }

  .dashboard-list-panel .badge {
    display: inline-flex;
    max-width: 100%;
    justify-content: center;
    white-space: normal;
  }

  .clientes-list-panel .row-actions,
  .servicos-list-panel .row-actions,
  .orcamentos-list-panel .row-actions,
  .dashboard-list-panel .row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: end;
    white-space: normal;
  }

  .clientes-list-panel .row-actions button,
  .servicos-list-panel .row-actions button,
  .orcamentos-list-panel .row-actions button,
  .dashboard-list-panel .row-actions button {
    min-width: 88px;
    min-height: 34px;
    padding-inline: 10px;
    white-space: nowrap;
  }

  .clientes-list-panel table th:last-child,
  .clientes-list-panel table td:last-child,
  .servicos-list-panel table th:last-child,
  .servicos-list-panel table td:last-child {
    width: 204px;
  }

  .clientes-list-panel table {
    min-width: 0;
    table-layout: fixed;
  }

  .clientes-list-panel th,
  .clientes-list-panel td {
    padding: 7px 6px;
  }

  .clientes-list-panel table th:nth-child(3),
  .clientes-list-panel table td:nth-child(3) {
    display: none;
  }

  .clientes-list-panel table th:first-child,
  .clientes-list-panel table td:first-child {
    width: 128px;
  }

  .clientes-list-panel table th:nth-child(4),
  .clientes-list-panel table td:nth-child(4) {
    width: 126px;
  }

  .clientes-list-panel .row-actions,
  .servicos-list-panel .row-actions {
    gap: 6px;
  }

  .clientes-list-panel .row-actions button,
  .servicos-list-panel .row-actions button {
    min-width: 82px;
    padding-inline: 8px;
    font-size: 0.8rem;
  }

  .orcamentos-list-panel .row-actions [data-share-budget] {
    min-width: 128px;
  }

  .orcamentos-list-panel .table-wrap {
    overflow-x: hidden;
  }

  .orcamentos-list-panel .budget-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.78rem;
  }

  .orcamentos-list-panel th,
  .orcamentos-list-panel td {
    padding: 6px 5px;
  }

  .orcamentos-list-panel .budget-table th:nth-child(3),
  .orcamentos-list-panel .budget-table td:nth-child(3) {
    display: none;
  }

  .orcamentos-list-panel .budget-table th:first-child,
  .orcamentos-list-panel .budget-table td:first-child {
    width: 72px;
  }

  .orcamentos-list-panel .budget-table th:nth-child(4),
  .orcamentos-list-panel .budget-table td:nth-child(4) {
    width: 102px;
  }

  .orcamentos-list-panel .budget-table th:nth-child(5),
  .orcamentos-list-panel .budget-table td:nth-child(5) {
    width: 96px;
  }

  .orcamentos-list-panel .budget-table th:last-child,
  .orcamentos-list-panel .budget-table td:last-child {
    width: 332px;
  }

  .orcamentos-list-panel .budget-table td:nth-child(2) {
    overflow-wrap: anywhere;
  }

  .bar-chart {
    grid-auto-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .bar-column {
    min-width: 0;
  }

  .bar-value {
    overflow: hidden;
    font-size: 0.66rem;
  }

  .report-panel .table-wrap {
    overflow-x: hidden;
  }

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

  .report-panel th:last-child,
  .report-panel td:last-child {
    width: 112px;
    text-align: right;
  }

  .report-panel td:first-child {
    overflow-wrap: anywhere;
  }
}

@media (min-width: 921px) and (max-width: 1368px) and (max-height: 1024px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
  }

  .sidebar {
    position: sticky;
    inset: 0 0 auto;
    z-index: 5;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 9px 20px rgba(8, 30, 38, 0.18);
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .brand strong {
    font-size: 0.9rem;
  }

  .brand small,
  .sidebar-tools,
  .client-logo-panel {
    display: none;
  }

  nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-submenu {
    display: contents;
  }

  .nav-button,
  .nav-sub-button {
    min-width: 0;
    min-height: 36px;
    padding: 6px 5px;
    border-radius: 7px;
    font-size: 0.8rem;
    line-height: 1.15;
    text-align: center;
  }

  .content {
    width: 100%;
    padding: 12px 16px 28px;
  }

  .clientes-layout,
  .servicos-layout,
  .orcamentos-layout,
  .usuarios-layout,
  .split-grid,
  .orcamento-form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .content .panel,
  .content .stat-card,
  .content .table-wrap,
  .dashboard-charts > *,
  .reports-grid > * {
    min-width: 0;
    max-width: 100%;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
  }

  .orcamentos-list-panel .budget-table th:last-child,
  .orcamentos-list-panel .budget-table td:last-child {
    width: 340px;
  }
}

@media (min-width: 641px) and (max-width: 1368px) {
  .dashboard-list-panel .table-wrap {
    overflow-x: hidden;
  }

  .dashboard-list-panel .budget-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.78rem;
  }

  .dashboard-list-panel th,
  .dashboard-list-panel td {
    padding: 6px 5px;
  }

  .dashboard-list-panel .budget-table th:nth-child(6),
  .dashboard-list-panel .budget-table td:nth-child(6) {
    display: none;
  }

  .dashboard-list-panel .budget-table th:first-child,
  .dashboard-list-panel .budget-table td:first-child {
    width: 72px;
  }

  .dashboard-list-panel .budget-table th:nth-child(3),
  .dashboard-list-panel .budget-table td:nth-child(3) {
    width: 86px;
  }

  .dashboard-list-panel .budget-table th:nth-child(4),
  .dashboard-list-panel .budget-table td:nth-child(4) {
    width: 104px;
  }

  .dashboard-list-panel .budget-table th:nth-child(5),
  .dashboard-list-panel .budget-table td:nth-child(5) {
    width: 108px;
  }

  .dashboard-list-panel .budget-table td:nth-child(2) {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
    font-size: 0.88rem;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
  }

  .sidebar {
    position: sticky;
    inset: 0 0 auto;
    z-index: 5;
    display: grid;
    gap: 6px;
    padding: max(7px, env(safe-area-inset-top)) 6px 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 9px 20px rgba(8, 30, 38, 0.18);
  }

  .sidebar .brand,
  .sidebar-tools,
  .client-logo-panel {
    display: none;
  }

  .sidebar-user {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    justify-content: initial;
    width: 100%;
    margin: 0;
    padding-left: 0;
  }

  .sidebar-user span {
    max-width: none;
    text-align: left;
  }

  .sidebar-user button {
    flex: 0 0 auto;
  }

  .sidebar-user-actions {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    gap: 12px;
    align-items: center;
    justify-self: end;
    white-space: nowrap;
  }

  .sidebar-user .sidebar-help-link {
    display: inline-block;
    width: auto;
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #f4c95d;
    font-size: 0.72rem;
    line-height: 1.2;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .nav-submenu {
    display: contents;
  }

  .nav-button,
  .nav-sub-button {
    min-width: 0;
    min-height: 36px;
    padding: 5px 3px;
    border-radius: 7px;
    font-size: 0.71rem;
    line-height: 1.15;
    text-align: center;
  }

  .content {
    width: 100%;
    padding: 8px 7px 28px;
  }

  .view.is-active {
    gap: 8px;
  }

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

  .usuarios-list-panel,
  .usuario-form-panel,
  .permissions-panel,
  .permission-group {
    min-width: 0;
  }

  .permission-group {
    grid-template-columns: minmax(0, 1fr);
  }

  .permission-group-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .permission-toolbar-actions,
  .permission-group-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .permission-toolbar-actions button,
  .permission-group-actions button {
    width: 100%;
  }

  .panel,
  .stat-card {
    padding: 8px;
    border-radius: 7px;
  }

  h2 {
    margin-bottom: 6px;
    font-size: 0.98rem;
  }

  .auditoria-panel {
    gap: 9px;
  }

  .auditoria-panel .toolbar {
    align-items: start;
  }

  .auditoria-panel .toolbar p {
    margin: 2px 0 0;
    font-size: 0.76rem;
    line-height: 1.25;
  }

  .audit-filters {
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .audit-filters summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    color: #165a72;
    font-weight: 800;
  }

  .audit-filters summary::-webkit-details-marker {
    display: none;
  }

  .audit-filters summary::after {
    content: "Abrir";
    font-size: 0.72rem;
  }

  .audit-filters[open] summary::after {
    content: "Fechar";
  }

  .audit-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 9px;
  }

  .audit-filter-grid label {
    min-width: 0;
    font-size: 0.72rem;
  }

  .audit-filter-grid label:nth-child(1),
  .audit-filter-grid label:nth-child(2) {
    grid-column: 1 / -1;
  }

  .audit-filter-grid input,
  .audit-filter-grid select {
    min-height: 36px;
    padding: 0 9px;
  }

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

  .audit-filter-grid .form-actions button {
    width: 100%;
    min-height: 38px;
  }

  .audit-maintenance {
    padding: 9px;
  }

  .audit-maintenance summary {
    align-items: flex-start;
  }

  .audit-maintenance small {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .audit-maintenance-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 9px;
  }

  .audit-maintenance-body label {
    grid-column: 1 / -1;
  }

  .audit-maintenance button {
    min-height: 36px;
    padding-inline: 8px;
  }

  .audit-table-wrap {
    max-height: min(54svh, 520px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  .audit-table-wrap table {
    display: block;
    min-width: 0;
    table-layout: auto;
    font-size: 0.78rem;
  }

  .audit-table-wrap thead {
    display: none;
  }

  .audit-table-wrap tbody {
    display: grid;
    gap: 8px;
  }

  .audit-table-wrap tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .audit-table-wrap tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
    font-size: 0.76rem;
  }

  .audit-table-wrap tbody td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .audit-table-wrap tbody td:nth-child(1)::before {
    content: "Data";
  }

  .audit-table-wrap tbody td:nth-child(2)::before {
    content: "Usuário";
  }

  .audit-table-wrap tbody td:nth-child(3)::before {
    content: "Perfil";
  }

  .audit-table-wrap tbody td:nth-child(4)::before {
    content: "Ação";
  }

  .audit-table-wrap tbody td:nth-child(5)::before {
    content: "Módulo";
  }

  .audit-table-wrap tbody td:nth-child(6)::before {
    content: "Item";
  }

  .audit-table-wrap tbody td:nth-child(7)::before {
    content: "Detalhes";
  }

  .audit-table-wrap tbody td:nth-child(8)::before {
    content: "IP";
  }

  .audit-table-wrap tbody td:nth-child(4),
  .audit-table-wrap tbody td:nth-child(7),
  .audit-table-wrap tbody td:nth-child(8) {
    grid-column: 1 / -1;
  }

  .audit-table-wrap code {
    display: block;
    max-height: 72px;
    overflow: auto;
    font-size: 0.68rem;
    white-space: pre-wrap;
  }

  .audit-pagination {
    gap: 7px;
    padding-top: 7px;
  }

  .audit-pagination .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .files-panel .toolbar,
  .usuarios-list-panel .toolbar {
    align-items: stretch;
    gap: 8px;
  }

  .files-panel .toolbar button {
    width: 100%;
    min-height: 38px;
  }

  .files-toolbar-refresh-button {
    display: none;
  }

  .files-table-wrap,
  .users-table-wrap {
    max-height: min(54svh, 520px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  .files-table-wrap table,
  .users-table-wrap table {
    display: block;
    min-width: 0;
    table-layout: auto;
    font-size: 0.78rem;
  }

  .files-table-wrap thead,
  .users-table-wrap thead {
    display: none;
  }

  .files-table-wrap tbody,
  .users-table-wrap tbody {
    display: grid;
    gap: 8px;
  }

  .files-table-wrap tbody tr,
  .users-table-wrap tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .users-table-wrap tbody tr.is-selected {
    border-color: #0aa8b5;
    background: #eefbfc;
  }

  .files-table-wrap tbody td,
  .users-table-wrap tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
    font-size: 0.76rem;
  }

  .files-table-wrap tbody td::before,
  .users-table-wrap tbody td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .files-table-wrap tbody td:nth-child(1),
  .files-table-wrap tbody td:nth-child(5),
  .users-table-wrap tbody td:nth-child(2),
  .users-table-wrap tbody td:nth-child(3),
  .users-table-wrap tbody td:nth-child(6) {
    grid-column: 1 / -1;
  }

  .files-table-wrap tbody td:nth-child(1)::before {
    content: "Arquivo";
  }

  .files-table-wrap tbody td:nth-child(2)::before {
    content: "Origem";
  }

  .files-table-wrap tbody td:nth-child(3)::before {
    content: "Tamanho";
  }

  .files-table-wrap tbody td:nth-child(4)::before {
    content: "Atualizado";
  }

  .files-table-wrap tbody td:nth-child(5)::before {
    content: "Acoes";
  }

  .users-table-wrap tbody td:nth-child(1)::before {
    content: "Usuario";
  }

  .users-table-wrap tbody td:nth-child(2)::before {
    content: "Nome";
  }

  .users-table-wrap tbody td:nth-child(3)::before {
    content: "E-mail";
  }

  .users-table-wrap tbody td:nth-child(4)::before {
    content: "Perfil";
  }

  .users-table-wrap tbody td:nth-child(5)::before {
    content: "Status";
  }

  .users-table-wrap tbody td:nth-child(6)::before {
    content: "Acoes";
  }

  .files-table-wrap .row-actions,
  .users-table-wrap .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    overflow: visible;
    padding-bottom: 0;
  }

  .files-table-wrap .row-actions a,
  .files-table-wrap .row-actions button,
  .users-table-wrap .row-actions button {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }

  .dashboard-banner img {
    width: 100%;
    min-height: 58px;
    max-height: 78px;
    object-fit: contain;
  }

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

  .stat-card small {
    font-size: 0.7rem;
  }

  .stat-card strong {
    overflow-wrap: anywhere;
    font-size: 1rem;
  }

  .dashboard-charts,
  .reports-grid,
  .clientes-layout,
  .servicos-layout,
  .orcamentos-layout,
  .orcamento-form-grid,
  .usuario-form-grid,
  .split-grid {
    gap: 8px;
  }

  .chart-card {
    min-width: 0;
    min-height: auto;
  }

  .reports-grid,
  .report-panel,
  .report-panel .table-wrap {
    min-width: 0;
  }

  .report-panel .table-wrap {
    overflow-x: hidden;
  }

  .report-panel table {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.78rem;
  }

  .report-panel th,
  .report-panel td {
    padding: 6px 4px;
  }

  .report-panel th:last-child,
  .report-panel td:last-child {
    width: 96px;
    text-align: right;
  }

  .report-panel td:first-child {
    overflow-wrap: anywhere;
  }

  .pie-chart {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    justify-items: stretch;
  }

  .pie-chart svg {
    width: 92px;
    height: 92px;
    justify-self: center;
  }

  .chart-legend,
  .pie-chart .chart-legend {
    min-width: 0;
    width: 100%;
  }

  .bar-chart {
    grid-auto-columns: minmax(42px, 60px);
    min-height: 112px;
    gap: 6px;
  }

  .bar-column {
    grid-template-rows: auto 58px auto;
    min-width: 42px;
    gap: 3px;
  }

  .bar-value,
  .bar-label {
    font-size: 0.68rem;
  }

  .table-wrap {
    max-width: 100%;
    width: 100%;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .clientes-list-panel .row-actions,
  .servicos-list-panel .row-actions,
  .orcamentos-list-panel .row-actions,
  .dashboard-list-panel .row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    white-space: nowrap;
  }

  .clientes-list-panel .row-actions button,
  .servicos-list-panel .row-actions button,
  .orcamentos-list-panel .row-actions button,
  .dashboard-list-panel .row-actions button {
    flex: 0 0 auto;
    width: auto;
    min-width: 86px;
    min-height: 34px;
    padding-inline: 8px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .orcamentos-list-panel .row-actions [data-share-budget] {
    min-width: 128px;
  }

  .clientes-list-panel,
  .servicos-list-panel,
  .orcamentos-list-panel,
  .usuarios-list-panel {
    min-width: 0;
    min-height: 0;
    align-self: start;
  }

  .clientes-list-panel .table-wrap,
  .servicos-list-panel .table-wrap {
    max-height: min(54svh, 520px);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .clientes-list-panel table,
  .servicos-list-panel table {
    display: block;
    min-width: 0;
  }

  .clientes-list-panel thead,
  .servicos-list-panel thead {
    display: none;
  }

  .clientes-list-panel tbody,
  .servicos-list-panel tbody {
    display: grid;
    gap: 7px;
  }

  .clientes-list-panel tbody tr,
  .servicos-list-panel tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .clientes-list-panel tbody td,
  .servicos-list-panel tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .clientes-list-panel tbody td:nth-child(2),
  .servicos-list-panel tbody td:nth-child(2),
  .clientes-list-panel tbody td:last-child,
  .servicos-list-panel tbody td:last-child {
    grid-column: 1 / -1;
  }

  .clientes-list-panel tbody td::before,
  .servicos-list-panel tbody td:not(:last-child)::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .clientes-list-panel tbody td:nth-child(1)::before {
    content: "Documento";
  }

  .clientes-list-panel tbody td:nth-child(2)::before {
    content: "Cliente";
  }

  .clientes-list-panel tbody td:nth-child(3)::before {
    content: "Contato";
  }

  .clientes-list-panel tbody td:nth-child(4)::before {
    content: "Cidade";
  }

  .clientes-list-panel tbody td:nth-child(5)::before {
    content: "Status";
  }

  .clientes-list-panel tbody td:nth-child(6)::before {
    content: "Responsável";
  }

  .servicos-list-panel tbody td:nth-child(1)::before {
    content: "Código";
  }

  .servicos-list-panel tbody td:nth-child(2)::before {
    content: "Serviço";
  }

  .servicos-list-panel tbody td:nth-child(3)::before {
    content: "Tipo";
  }

  .servicos-list-panel tbody td:nth-child(4)::before {
    content: "Status";
  }

  .servicos-list-panel tbody td:nth-child(5)::before {
    content: "Valor";
  }

  .clientes-list-panel .row-actions,
  .servicos-list-panel .row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .clientes-list-panel .row-actions button,
  .servicos-list-panel .row-actions button {
    width: auto;
    min-height: 36px;
    padding-inline: 9px;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .cliente-orcamentos-resumo .table-wrap {
    max-height: min(38svh, 340px);
    overflow-x: hidden;
  }

  .cliente-orcamentos-resumo table,
  .cliente-orcamentos-resumo thead,
  .cliente-orcamentos-resumo tbody,
  .cliente-orcamentos-resumo tr,
  .cliente-orcamentos-resumo td {
    display: block;
  }

  .cliente-orcamentos-resumo thead {
    display: none;
  }

  .cliente-orcamentos-resumo tbody {
    display: grid;
    gap: 7px;
  }

  .cliente-orcamentos-resumo tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .cliente-orcamentos-resumo tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .cliente-orcamentos-resumo tbody td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .cliente-orcamentos-resumo tbody td:nth-child(1)::before {
    content: "Orçamento";
  }

  .cliente-orcamentos-resumo tbody td:nth-child(2)::before {
    content: "Data";
  }

  .cliente-orcamentos-resumo tbody td:nth-child(3)::before {
    content: "Status";
  }

  .cliente-orcamentos-resumo tbody td:nth-child(4)::before {
    content: "Total";
  }

  .cliente-list-new-button,
  .servico-list-new-button,
  .orcamento-list-new-button,
  .usuario-list-new-button,
  .files-list-refresh-button {
    display: block;
    width: 100%;
    margin-top: 8px;
    min-height: 38px;
    position: static;
    z-index: 2;
  }

  .cliente-form-panel,
  .servico-form-panel,
  .orcamento-form-panel,
  .usuario-form-panel {
    scroll-margin-top: 112px;
  }

  .cliente-form-panel.is-mobile-hidden,
  .servico-form-panel.is-mobile-hidden,
  .orcamento-form-panel.is-mobile-hidden,
  .usuario-form-panel.is-mobile-hidden {
    display: none;
  }

  .dashboard-list-panel .budget-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.76rem;
  }

  .dashboard-list-panel .table-wrap {
    overflow-x: hidden;
  }

  .dashboard-list-panel th,
  .dashboard-list-panel td {
    padding: 5px 3px;
  }

  .dashboard-list-panel .budget-table th:nth-child(5),
  .dashboard-list-panel .budget-table td:nth-child(5),
  .dashboard-list-panel .budget-table th:nth-child(6),
  .dashboard-list-panel .budget-table td:nth-child(6) {
    display: none;
  }

  .dashboard-list-panel .budget-table th:first-child,
  .dashboard-list-panel .budget-table td:first-child {
    width: 50px;
  }

  .dashboard-list-panel .budget-table th:nth-child(3),
  .dashboard-list-panel .budget-table td:nth-child(3) {
    width: 68px;
  }

  .dashboard-list-panel .budget-table th:nth-child(4),
  .dashboard-list-panel .budget-table td:nth-child(4) {
    width: 78px;
  }

  .dashboard-list-panel .budget-table td:nth-child(2) {
    overflow-wrap: anywhere;
  }

  .dashboard-list-panel .budget-table th {
    font-size: 0.65rem;
  }

  .dashboard-list-panel .budget-table td:nth-child(4) {
    text-align: center;
  }

  .dashboard-list-panel .badge {
    max-width: 100%;
    padding-inline: 3px;
    border-radius: 6px;
    font-size: 0.61rem;
    line-height: 1.12;
    overflow-wrap: normal;
    white-space: normal;
  }

  .orcamentos-list-panel .table-wrap {
    max-height: 280px;
    overflow-x: hidden;
  }

  .orcamentos-list-panel .table-wrap:has(.budget-preview-row) {
    max-height: 440px;
  }

  .orcamentos-list-panel .budget-table {
    display: block;
    min-width: 0;
  }

  .orcamentos-list-panel .budget-table thead {
    display: none;
  }

  .orcamentos-list-panel .budget-table tbody {
    display: grid;
    gap: 7px;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row.is-selected {
    border-color: #0aa8b5;
    background: #eefbfc;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td {
    min-width: 0;
    padding: 0;
    border: 0;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:first-child {
    align-self: center;
    font-size: 0.84rem;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:first-child::before {
    content: "Orçamento ";
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(2) {
    grid-column: 1 / -1;
    overflow-wrap: anywhere;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(2)::before,
  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(3)::before,
  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(5)::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(2)::before {
    content: "Cliente";
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(3)::before {
    content: "Data";
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(5)::before {
    content: "Total";
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:nth-child(5) {
    justify-self: end;
    text-align: right;
    font-weight: 700;
  }

  .orcamentos-list-panel .budget-table > tbody > tr.clickable-row > td:last-child {
    grid-column: 1 / -1;
    padding-top: 3px;
  }

  .orcamentos-list-panel .budget-table .row-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .orcamentos-list-panel .budget-table .row-actions button {
    width: auto;
    min-height: 36px;
    padding-inline: 9px;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .orcamentos-list-panel .budget-preview-row,
  .orcamentos-list-panel .budget-preview-row > td,
  .orcamentos-list-panel .budget-preview {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .orcamentos-list-panel .budget-preview-row {
    border: 1px solid #bfe8ec;
    border-radius: 7px;
    background: #f7fcfd;
  }

  .orcamentos-list-panel .budget-preview-row > td {
    padding: 7px;
    border: 0;
  }

  .orcamentos-list-panel .budget-preview table {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: 6px;
  }

  .orcamentos-list-panel .budget-preview thead {
    display: none;
  }

  .orcamentos-list-panel .budget-preview tbody {
    display: contents;
  }

  .orcamentos-list-panel .budget-preview tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .orcamentos-list-panel .budget-preview tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .orcamentos-list-panel .budget-preview tbody td:nth-child(2) {
    grid-column: span 2;
  }

  .orcamentos-list-panel .budget-preview tbody td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .orcamentos-list-panel .budget-preview tbody td:nth-child(1)::before {
    content: "Código";
  }

  .orcamentos-list-panel .budget-preview tbody td:nth-child(2)::before {
    content: "Serviço";
  }

  .orcamentos-list-panel .budget-preview tbody td:nth-child(3)::before {
    content: "Qtd.";
  }

  .orcamentos-list-panel .budget-preview tbody td:nth-child(4)::before {
    content: "Valor";
  }

  .orcamentos-list-panel .budget-preview tbody td:nth-child(5)::before {
    content: "Desconto";
  }

  .orcamentos-list-panel .budget-preview tbody td:nth-child(6)::before {
    content: "Total";
  }
}

@media (min-width: 641px) and (max-width: 920px) and (max-height: 500px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100svh;
  }

  .sidebar {
    position: sticky;
    inset: 0 0 auto;
    z-index: 5;
    display: grid;
    gap: 5px;
    padding: max(6px, env(safe-area-inset-top)) 8px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 9px 20px rgba(8, 30, 38, 0.18);
  }

  .sidebar .brand,
  .sidebar-tools,
  .client-logo-panel {
    display: none;
  }

  .sidebar-user {
    justify-content: center;
    width: 100%;
    margin: 0;
    padding-left: 0;
  }

  .sidebar-user span {
    max-width: calc(100vw - 100px);
    text-align: center;
  }

  nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
  }

  .nav-submenu {
    display: contents;
  }

  .nav-button,
  .nav-sub-button {
    min-width: 0;
    min-height: 34px;
    padding: 5px 4px;
    border-radius: 7px;
    font-size: 0.76rem;
    line-height: 1.15;
    text-align: center;
  }

  .content {
    width: 100%;
    padding: 8px 10px 22px;
  }

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

  .usuarios-list-panel,
  .usuario-form-panel,
  .permissions-panel,
  .permission-group {
    min-width: 0;
  }

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

  .permission-group-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .permission-toolbar-actions,
  .permission-group-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .permission-toolbar-actions button,
  .permission-group-actions button {
    width: 100%;
  }

  .auditoria-panel {
    gap: 8px;
  }

  .auditoria-panel .toolbar p {
    margin: 2px 0 0;
    font-size: 0.74rem;
    line-height: 1.2;
  }

  .audit-filters {
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .audit-filters summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    list-style: none;
    color: #165a72;
    font-weight: 800;
  }

  .audit-filters summary::-webkit-details-marker {
    display: none;
  }

  .audit-filters summary::after {
    content: "Abrir";
    font-size: 0.72rem;
  }

  .audit-filters[open] summary::after {
    content: "Fechar";
  }

  .audit-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 8px;
  }

  .audit-filter-grid label {
    min-width: 0;
    font-size: 0.7rem;
  }

  .audit-filter-grid input,
  .audit-filter-grid select {
    min-height: 34px;
    padding: 0 8px;
  }

  .audit-filter-grid .form-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .audit-maintenance {
    padding: 8px;
  }

  .audit-maintenance small {
    font-size: 0.7rem;
  }

  .audit-maintenance-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 8px;
  }

  .audit-maintenance-body label {
    min-width: 0;
  }

  .audit-maintenance button {
    min-height: 34px;
    padding-inline: 8px;
  }

  .audit-table-wrap {
    max-height: min(46svh, 260px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  .audit-table-wrap table {
    display: block;
    min-width: 0;
    table-layout: auto;
    font-size: 0.76rem;
  }

  .audit-table-wrap thead {
    display: none;
  }

  .audit-table-wrap tbody {
    display: grid;
    gap: 7px;
  }

  .audit-table-wrap tbody tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .audit-table-wrap tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
    font-size: 0.74rem;
  }

  .audit-table-wrap tbody td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .audit-table-wrap tbody td:nth-child(1)::before {
    content: "Data";
  }

  .audit-table-wrap tbody td:nth-child(2)::before {
    content: "Usuario";
  }

  .audit-table-wrap tbody td:nth-child(3)::before {
    content: "Perfil";
  }

  .audit-table-wrap tbody td:nth-child(4)::before {
    content: "Acao";
  }

  .audit-table-wrap tbody td:nth-child(5)::before {
    content: "Modulo";
  }

  .audit-table-wrap tbody td:nth-child(6)::before {
    content: "Item";
  }

  .audit-table-wrap tbody td:nth-child(7)::before {
    content: "Detalhes";
  }

  .audit-table-wrap tbody td:nth-child(8)::before {
    content: "IP";
  }

  .audit-table-wrap tbody td:nth-child(4),
  .audit-table-wrap tbody td:nth-child(7),
  .audit-table-wrap tbody td:nth-child(8) {
    grid-column: span 2;
  }

  .audit-table-wrap code {
    display: block;
    max-height: 56px;
    overflow: auto;
    font-size: 0.66rem;
    white-space: pre-wrap;
  }

  .audit-pagination {
    gap: 7px;
    padding-top: 7px;
  }

  .audit-pagination .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .files-panel .toolbar,
  .usuarios-list-panel .toolbar {
    align-items: stretch;
    gap: 8px;
  }

  .files-panel .toolbar button {
    width: 100%;
    min-height: 34px;
  }

  .files-toolbar-refresh-button {
    display: none;
  }

  .files-table-wrap,
  .users-table-wrap {
    max-height: min(46svh, 260px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  .files-table-wrap table,
  .users-table-wrap table {
    display: block;
    min-width: 0;
    table-layout: auto;
    font-size: 0.76rem;
  }

  .files-table-wrap thead,
  .users-table-wrap thead {
    display: none;
  }

  .files-table-wrap tbody,
  .users-table-wrap tbody {
    display: grid;
    gap: 7px;
  }

  .files-table-wrap tbody tr,
  .users-table-wrap tbody tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
  }

  .users-table-wrap tbody tr.is-selected {
    border-color: #0aa8b5;
    background: #eefbfc;
  }

  .files-table-wrap tbody td,
  .users-table-wrap tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    overflow-wrap: anywhere;
    font-size: 0.74rem;
  }

  .files-table-wrap tbody td::before,
  .users-table-wrap tbody td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.56rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .files-table-wrap tbody td:nth-child(1),
  .files-table-wrap tbody td:nth-child(5),
  .users-table-wrap tbody td:nth-child(2),
  .users-table-wrap tbody td:nth-child(3),
  .users-table-wrap tbody td:nth-child(6) {
    grid-column: span 2;
  }

  .files-table-wrap tbody td:nth-child(1)::before {
    content: "Arquivo";
  }

  .files-table-wrap tbody td:nth-child(2)::before {
    content: "Origem";
  }

  .files-table-wrap tbody td:nth-child(3)::before {
    content: "Tamanho";
  }

  .files-table-wrap tbody td:nth-child(4)::before {
    content: "Atualizado";
  }

  .files-table-wrap tbody td:nth-child(5)::before {
    content: "Acoes";
  }

  .users-table-wrap tbody td:nth-child(1)::before {
    content: "Usuario";
  }

  .users-table-wrap tbody td:nth-child(2)::before {
    content: "Nome";
  }

  .users-table-wrap tbody td:nth-child(3)::before {
    content: "E-mail";
  }

  .users-table-wrap tbody td:nth-child(4)::before {
    content: "Perfil";
  }

  .users-table-wrap tbody td:nth-child(5)::before {
    content: "Status";
  }

  .users-table-wrap tbody td:nth-child(6)::before {
    content: "Acoes";
  }

  .files-table-wrap .row-actions,
  .users-table-wrap .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
    overflow: visible;
    padding-bottom: 0;
  }

  .files-table-wrap .row-actions a,
  .files-table-wrap .row-actions button,
  .users-table-wrap .row-actions button {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
  }

  .cliente-list-new-button,
  .servico-list-new-button,
  .orcamento-list-new-button,
  .usuario-list-new-button,
  .files-list-refresh-button {
    display: block;
    width: 100%;
    margin-top: 7px;
    min-height: 34px;
    position: static;
    z-index: 2;
  }

  .cliente-form-panel,
  .servico-form-panel,
  .orcamento-form-panel,
  .usuario-form-panel {
    scroll-margin-top: 76px;
  }

  .cliente-form-panel.is-mobile-hidden,
  .servico-form-panel.is-mobile-hidden,
  .orcamento-form-panel.is-mobile-hidden,
  .usuario-form-panel.is-mobile-hidden {
    display: none;
  }

  .clientes-layout,
  .servicos-layout,
  .orcamentos-layout,
  .usuarios-layout,
  .split-grid,
  .dashboard-charts,
  .reports-grid,
  .stats-grid {
    min-width: 0;
  }

  .clientes-layout > *,
  .servicos-layout > *,
  .orcamentos-layout > *,
  .usuarios-layout > *,
  .split-grid > *,
  .dashboard-charts > *,
  .reports-grid > *,
  .content .panel,
  .content .table-wrap {
    min-width: 0;
    max-width: 100%;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
  }

  .view.is-active {
    gap: 10px;
  }

  .dashboard-banner img {
    max-height: 76px;
    object-fit: contain;
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .stats-grid .stat-card strong {
    overflow-wrap: anywhere;
    font-size: 1.42rem;
    line-height: 1.1;
  }

  .dashboard-charts,
  .reports-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .chart-card,
  .dashboard-list-panel,
  .report-panel,
  .report-panel .table-wrap {
    min-width: 0;
  }

  .report-panel .table-wrap {
    overflow-x: hidden;
  }

  .report-panel table {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.82rem;
  }

  .report-panel th:last-child,
  .report-panel td:last-child {
    width: 112px;
    text-align: right;
  }

  .report-panel td:first-child {
    overflow-wrap: anywhere;
  }

  .pie-chart {
    gap: 8px;
  }

  .pie-chart svg {
    width: 112px;
    height: 112px;
  }

  .bar-chart {
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
    min-height: 150px;
  }

  .bar-column {
    min-width: 0;
  }

  .bar-value {
    overflow: hidden;
    font-size: 0.62rem;
  }

  .dashboard-list-panel .budget-table {
    min-width: 0;
    table-layout: fixed;
  }

  .dashboard-list-panel .budget-table th:first-child,
  .dashboard-list-panel .budget-table td:first-child {
    width: 72px;
  }

  .dashboard-list-panel .budget-table th:nth-child(3),
  .dashboard-list-panel .budget-table td:nth-child(3) {
    width: 92px;
  }

  .dashboard-list-panel .budget-table th:nth-child(4),
  .dashboard-list-panel .budget-table td:nth-child(4) {
    width: 110px;
  }

  .dashboard-list-panel .budget-table th:nth-child(5),
  .dashboard-list-panel .budget-table td:nth-child(5) {
    width: 112px;
  }

  #dashboard-view .dashboard-list-panel .budget-table th:nth-child(5),
  #dashboard-view .dashboard-list-panel .budget-table td:nth-child(5),
  #dashboard-view .dashboard-list-panel .budget-table th:nth-child(6),
  #dashboard-view .dashboard-list-panel .budget-table td:nth-child(6) {
    display: none;
  }
}

@media (max-width: 920px) {
  .files-toolbar-refresh-button {
    display: none !important;
  }

  .files-list-refresh-button {
    display: block !important;
    margin-top: 9px;
    min-height: 38px;
    position: static;
    width: 100%;
    z-index: 2;
  }

  .files-table-wrap .files-row-actions {
    display: grid !important;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
  }

  .files-table-wrap .files-row-actions .small-button {
    justify-content: center;
    min-width: 0;
    text-align: center;
    width: 100%;
  }
}

@media (max-width: 920px) {
  nav {
    grid-template-columns: repeat(5, minmax(86px, 1fr)) !important;
    gap: 5px;
  }

  nav > [data-menu-group="administracao"] {
    order: 5;
  }

  nav > [data-submenu="financeiro"] {
    order: 6;
  }

  nav > [data-submenu="administracao"] {
    order: 7;
  }

  .nav-submenu {
    grid-column: 1 / -1;
    display: grid !important;
    gap: 3px;
    justify-self: end;
    margin: 0;
    padding-left: 0;
    width: auto;
  }

  .nav-submenu[hidden] {
    display: none !important;
  }

  .nav-submenu[data-submenu="financeiro"] {
    grid-template-columns: repeat(2, minmax(86px, 1fr));
  }

  .nav-submenu[data-submenu="administracao"] {
    grid-template-columns: repeat(4, minmax(86px, 1fr));
  }

  .help-manual,
  .help-grid {
    grid-template-columns: 1fr;
  }

  .documentation-layout,
  .documentation-card-grid {
    grid-template-columns: 1fr;
  }

  .documentation-toolbar {
    align-items: stretch;
  }

  .documentation-toolbar button {
    width: 100%;
  }

  .help-flow {
    grid-template-columns: 1fr;
  }

  .nav-button,
  .nav-sub-button {
    min-width: 0;
    min-height: 36px;
    padding: 5px 4px;
    border-radius: 7px;
    font-size: 0.72rem;
    line-height: 1.12;
    text-align: center;
  }
}

@media (max-width: 640px) {
  nav {
    grid-template-columns: repeat(5, minmax(66px, 1fr)) !important;
    gap: 4px;
  }

  nav > [data-view="ajuda"] {
    display: none !important;
  }

  .sidebar-user {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto !important;
    column-gap: 10px;
    align-items: center;
    justify-items: stretch;
    text-align: left;
  }

  #current-user-name {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    text-align: left;
  }

  #logout-app {
    white-space: nowrap;
  }

  .sidebar-user-actions {
    display: inline-flex !important;
    grid-column: 2;
    grid-row: 1;
    gap: 12px;
    align-items: center;
    justify-self: end;
    white-space: nowrap;
  }

  .nav-button,
  .nav-sub-button {
    min-height: 37px;
    padding: 5px 2px;
    font-size: 0.62rem;
  }

  .sidebar-user .sidebar-help-link {
    display: inline-block !important;
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #f4c95d;
    font-size: 0.72rem;
    line-height: 1.2;
    text-decoration: underline;
    white-space: nowrap;
  }

  .nav-submenu[data-submenu="financeiro"],
  .nav-submenu[data-submenu="administracao"] {
    gap: 3px;
  }

  .nav-submenu[data-submenu="financeiro"] {
    grid-template-columns: repeat(2, minmax(66px, 1fr));
  }

  .nav-submenu[data-submenu="administracao"] {
    grid-template-columns: repeat(4, minmax(66px, 1fr));
  }
}

@media (max-width: 920px) {
  .sidebar {
    transition: transform 180ms ease, box-shadow 180ms ease;
    will-change: transform;
  }

  .sidebar.is-hidden-on-scroll {
    box-shadow: none;
    pointer-events: none;
    transform: translateY(calc(-100% - 2px));
  }
}

@media (max-width: 920px) {
  html,
  body,
  .app-shell,
  .content,
  .view,
  .panel {
    overflow-anchor: none;
  }

  .clientes-list-panel,
  .servicos-list-panel,
  .usuarios-list-panel,
  .files-panel {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    align-self: start !important;
  }

  .clientes-layout,
  .servicos-layout,
  .usuarios-layout {
    align-items: start !important;
  }

  .cliente-list-new-button,
  .servico-list-new-button,
  .orcamento-list-new-button,
  .usuario-list-new-button,
  .files-list-refresh-button,
  .files-toolbar-refresh-button {
    bottom: auto !important;
    flex: 0 0 auto !important;
    display: block !important;
    margin-top: 0 !important;
    min-width: 96px;
    position: static !important;
    width: auto !important;
  }

  .cliente-form-panel.is-mobile-hidden,
  .servico-form-panel.is-mobile-hidden,
  .usuario-form-panel.is-mobile-hidden {
    display: none !important;
  }

  body.is-resetting-compact-scroll .content {
    padding-bottom: 8px !important;
  }

  body.is-resetting-compact-scroll .view.is-active {
    align-content: start !important;
    gap: 8px !important;
  }

  .clientes-list-panel,
  .servicos-list-panel,
  .usuarios-list-panel,
  .files-panel {
    min-height: 0 !important;
  }

  .clientes-list-panel .toolbar,
  .servicos-list-panel .toolbar,
  .orcamentos-list-panel .toolbar,
  .usuarios-list-panel .toolbar,
  .files-panel .toolbar {
    align-items: center !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    justify-content: space-between !important;
  }

  .clientes-list-panel .table-wrap,
  .servicos-list-panel .table-wrap,
  .orcamentos-list-panel .table-wrap,
  .files-table-wrap,
  .users-table-wrap {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    padding-right: 0 !important;
  }
}

@media (max-width: 920px) {
  nav > [data-view="ajuda"] {
    display: none !important;
  }

  .sidebar-user .sidebar-help-link {
    display: inline-block !important;
    width: auto;
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #f4c95d;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
  }

  .sidebar-user-actions {
    display: inline-flex !important;
    gap: 12px;
    align-items: center;
    white-space: nowrap;
  }

  .orcamentos-list-panel .toolbar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
  }

  .orcamentos-list-panel .toolbar h2 {
    min-width: 0;
    margin: 0;
  }

  .orcamento-list-new-button {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center;
    justify-content: center;
    width: auto !important;
    min-width: 108px;
    margin: 0 !important;
  }

  .orcamento-form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .orcamento-form-grid > *,
  .orcamento-form-grid .budget-client-search,
  .orcamento-form-grid .budget-client-line,
  .orcamento-form-grid .budget-items,
  .orcamento-form-grid label:has(textarea),
  .orcamento-form-grid .total-box,
  .orcamento-form-grid .budget-form-actions {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
  }

  .orcamento-form-grid > .ghost-button {
    width: 100%;
  }

  .budget-item > .budget-service-line {
    display: grid !important;
    grid-column: 1 / -1 !important;
    grid-template-columns: minmax(0, 1fr) 44px !important;
    gap: 8px !important;
    align-items: end !important;
    width: 100% !important;
  }

  .budget-item > .budget-service-line > label {
    grid-column: auto !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  .budget-item > .budget-service-line select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .budget-item > .budget-service-line .budget-service-add-button {
    align-self: end !important;
    justify-self: stretch !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .app-shell {
    display: block;
  }

  .sidebar,
  .topbar,
  .view {
    display: none !important;
  }

  .print-area {
    display: block;
    padding: 0;
    color: #111;
  }

  .print-area table {
    min-width: 0;
  }

  .proposal-page {
    width: 210mm;
    height: 297mm;
    position: relative;
    overflow: hidden;
    page-break-after: always;
    background: #fff;
    font-family: Arial, Helvetica, sans-serif;
  }

  .proposal-page:last-child {
    page-break-after: auto;
  }

  .proposal-bg,
  .budget-title-img {
    position: absolute;
    display: block;
  }

  .page-1-bg {
    left: 2.96mm;
    top: 19.98mm;
    width: 197.45mm;
    height: 253.86mm;
  }

  .page-2-bg {
    left: 2.96mm;
    top: 22.09mm;
    width: 198.57mm;
    height: 253.79mm;
  }

  .page-4-bg {
    left: 2.96mm;
    top: 31.06mm;
    width: 198.0mm;
    height: 243.4mm;
  }

  .page-3-bg {
    left: 0;
    top: 0;
    width: 210mm;
    height: 297mm;
    object-fit: cover;
  }

  .budget-print-page {
    padding: 0;
    color: #111;
    font-size: 11pt;
  }

  .budget-title-img {
    left: 59.1mm;
    top: 27.7mm;
    width: 95.6mm;
    height: 31.5mm;
  }

  .budget-number {
    position: absolute;
    left: 0;
    top: 48mm;
    width: 210mm;
    color: #20232b;
    font-size: 30pt;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0;
  }

  .budget-field {
    position: absolute;
    font-size: 14pt;
    line-height: 1.2;
    display: grid;
    grid-template-columns: 25mm minmax(0, 1fr);
    column-gap: 2mm;
    align-items: baseline;
  }

  .budget-field strong {
    font-weight: 700;
    text-align: left;
  }

  .budget-field span {
    min-width: 0;
  }

  .budget-client {
    left: 9.9mm;
    top: 77mm;
    width: 145mm;
  }

  .budget-address {
    left: 9.9mm;
    top: 83.2mm;
    width: 190mm;
    font-size: 12pt;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .budget-phone {
    left: 9.9mm;
    top: 89.4mm;
    width: 82mm;
    grid-template-columns: 25mm minmax(0, 1fr);
    font-size: 12pt;
  }

  .budget-date {
    left: 9.9mm;
    top: 95.8mm;
    width: 82mm;
  }

  .budget-print-table {
    position: absolute;
    left: 7mm;
    top: 103.5mm;
    width: 190mm;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 10.5pt;
  }

  .budget-print-table th,
  .budget-print-table td {
    border: 0.34mm solid #8c8c8c;
    padding: 1.8mm 2.2mm;
    color: #111;
  }

  .budget-print-table th {
    font-size: 11pt;
    font-weight: 700;
    text-transform: none;
  }

  .budget-print-table th:nth-child(1),
  .budget-print-table td:nth-child(1) {
    width: 18mm;
  }

  .budget-print-table th:nth-child(2),
  .budget-print-table td:nth-child(2) {
    width: 70mm;
    border-right: 0.34mm solid #8c8c8c;
  }

  .budget-print-table th:nth-child(3),
  .budget-print-table td:nth-child(3) {
    border-left: 0.34mm solid #8c8c8c;
  }

  .budget-print-table th:nth-child(3),
  .budget-print-table td:nth-child(3) {
    width: 13mm;
    text-align: center;
  }

  .budget-print-table th:nth-child(4),
  .budget-print-table td:nth-child(4),
  .budget-print-table th:nth-child(5),
  .budget-print-table td:nth-child(5),
  .budget-print-table th:nth-child(6),
  .budget-print-table td:nth-child(6) {
    width: 29mm;
    text-align: right;
  }

  .budget-total-label,
  .budget-total-value {
    position: absolute;
    top: 197mm;
    font-size: 13pt;
    font-weight: 700;
  }

  .budget-total-label {
    left: 120mm;
  }

  .budget-total-value {
    right: 9.5mm;
  }

  .budget-terms {
    position: absolute;
    left: 9.5mm;
    top: 207mm;
    width: 190mm;
    margin: 0;
    padding-left: 5mm;
    font-size: 11pt;
    line-height: 1.55;
  }

  .budget-approval {
    position: absolute;
    left: 68mm;
    top: 246mm;
    width: 78mm;
    text-align: center;
    font-size: 11pt;
  }

  .budget-approval p,
  .budget-approval span,
  .budget-approval strong {
    display: block;
    margin: 0 0 2mm;
  }

  .signature-line {
    height: 1px;
    background: #111;
    margin: 12mm 0 2mm;
  }

  .budget-notes {
    position: absolute;
    left: 9.5mm;
    bottom: 11mm;
    width: 190mm;
    margin: 0;
    font-size: 10pt;
  }
}
