/* Ajustes globais para desktop, tablet e celular. */
html {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  max-width: 100%;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.45;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

iframe {
  max-width: 100%;
}

button,
input,
select,
textarea {
  max-width: 100%;
  min-width: 0;
}

fieldset {
  min-width: 0;
}

.customer-form > p {
  display: grid;
  gap: 7px;
  margin: 0 0 18px;
}

.customer-form > p > label {
  font-size: .9rem;
  font-weight: 700;
}

.customer-form > p > input:not([type="checkbox"]),
.customer-form > p > select,
.customer-form > p > textarea,
.inline-form input,
.inline-form select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #bdc9d9;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.customer-form > p > textarea {
  min-height: 110px;
  resize: vertical;
}

.customer-form .helptext {
  color: var(--muted);
  font-size: .82rem;
}

.customer-form .errorlist {
  margin: 0;
  padding-left: 20px;
  color: var(--danger);
}

.errorlist {
  margin: 0;
  padding-left: 20px;
  color: var(--danger);
  font-size: .82rem;
}

.error,
.field .error {
  color: var(--danger);
  font-size: .82rem;
}

.inline-form {
  max-width: 100%;
}

.button,
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.search-form input,
.search-form select {
  min-height: 42px;
}

/* Controles marcáveis não devem herdar o tamanho dos campos de texto. */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 18px;
  accent-color: var(--blue-700);
}

.field-check-compact {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding-top: 0;
  cursor: pointer;
}

.field-check-compact input[type="checkbox"],
.field-check-compact input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex-basis: 16px;
}

.field-check-compact > span {
  line-height: 1.2;
}

:focus-visible {
  outline: 3px solid rgba(85, 120, 100, .42);
  outline-offset: 2px;
}

.brand,
.brand > span:last-child,
.page-heading > div,
.module-card > div,
.panel,
.metric,
.alert-row > span,
.detail-grid > div,
.dashboard-grid > *,
.integration-grid > * {
  min-width: 0;
}

.brand strong,
.page-heading h1,
.page-heading p,
.module-card h2,
.module-card p,
.detail-grid strong,
.alert-row,
td,
th {
  overflow-wrap: anywhere;
}

.nav-toggle {
  display: none;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.nav-toggle > span:first-child {
  font-size: 1.2rem;
  line-height: 1;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.table-wrap > table {
  width: 100%;
  min-width: 680px;
}

table {
  font-variant-numeric: tabular-nums;
}

th,
td {
  vertical-align: top;
}

.search-form {
  align-items: stretch;
  flex-wrap: wrap;
}

.search-form > input,
.search-form > select,
.search-form > label {
  flex: 1 1 180px;
}

.search-form > .button {
  flex: 0 0 auto;
}

.heading-buttons,
.form-actions,
.report-links,
.receipt-actions {
  flex-wrap: wrap;
}

.chart-panel,
.calendar-panel,
.wake-week,
.seller-nav {
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.bar-chart,
.line-chart {
  min-width: 620px;
}

.chart-panel {
  overflow-x: auto;
}

#title-preview {
  height: clamp(420px, 70vh, 720px) !important;
}

/* Escala visual uniforme e melhor aproveitamento do conteúdo. */
.page-content {
  padding-top: 24px;
  padding-bottom: 42px;
}

.page-heading {
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 4px 0 6px;
  font-size: clamp(1.65rem, 2.4vw, 2rem);
  line-height: 1.16;
}

.page-heading h2,
.panel h2,
.report-links h2 {
  font-size: clamp(1.15rem, 1.7vw, 1.4rem);
  line-height: 1.25;
}

.panel h2:first-child {
  margin-top: 0;
}

.panel h3 {
  font-size: 1.05rem;
  line-height: 1.3;
}

.page-heading p {
  max-width: 760px;
  font-size: .94rem;
  line-height: 1.45;
}

.eyebrow {
  font-size: .74rem;
  letter-spacing: .1em;
}

.panel {
  padding: 18px;
}

.section-block {
  margin-top: 26px;
}

.metric-grid {
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 90px;
  justify-content: center;
  padding: 14px 16px;
  gap: 3px;
}

.metric span {
  font-size: .9rem;
}

.metric strong {
  font-size: clamp(1.4rem, 2.2vw, 1.65rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric small {
  font-size: .76rem;
}

.module-grid {
  gap: 15px;
}

.module-card {
  gap: 14px;
  padding: 18px;
}

.module-card h2 {
  margin-bottom: 5px;
  font-size: 1.04rem;
}

.module-card p {
  margin-bottom: 9px;
  font-size: .9rem;
}

.dashboard-grid,
.dashboard-columns,
.integration-grid {
  gap: 16px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.75fr) minmax(290px, .9fr);
  margin-bottom: 18px;
}

.line-chart {
  min-height: 190px;
  gap: 7px;
  padding: 20px 4px 6px;
}

.line-point {
  min-width: 46px;
  height: 155px;
}

.line-point small,
.bar-column small {
  font-size: .75rem;
}

.bar-chart {
  height: 230px;
}

.alert-list {
  gap: 8px;
}

.alert-row {
  gap: 12px;
  padding: 10px 11px;
  font-size: .9rem;
}

th {
  padding: 10px;
  font-size: .74rem;
}

td {
  padding: 12px 10px;
  font-size: .92rem;
}

.detail-grid {
  gap: 20px;
}

.detail-grid > div > span:first-child,
.detail-label {
  color: var(--muted);
  font-size: .78rem;
}

.back-button {
  margin-bottom: 16px;
}

.finance-menu {
  justify-content: flex-start;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.table-actions form,
td > form {
  display: inline-flex;
  margin: 0;
}

.text-end {
  text-align: right;
  white-space: nowrap;
}

.prose-card {
  max-width: 900px;
  line-height: 1.65;
}

.prose-card h2 {
  margin: 0 0 7px;
}

.prose-card h2:not(:first-child) {
  margin-top: 22px;
}

.prose-card p {
  margin: 0 0 12px;
  color: #3f4942;
}

.auth-card > h1 {
  margin: 5px 0 8px;
  font-size: 1.7rem;
}

.calendar-navigation h2 {
  font-size: 1.25rem;
}

.receipt-header h1 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.receipt-text {
  font-size: 1rem;
}

@media (max-width: 1100px) {
  .shell {
    width: min(100% - 28px, 1180px);
  }

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

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

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

@media (max-width: 1024px) {
  .topbar-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    min-height: 64px;
    gap: 10px;
    padding: 9px 0;
  }

  .brand {
    overflow: hidden;
  }

  .brand strong,
  .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    grid-column: 1 / -1;
    width: 100%;
    max-height: calc(100vh - 88px);
    margin: 0;
    padding: 8px;
    overflow: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 10px;
    background: rgba(16, 47, 38, .96);
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav > a,
  .nav-group > summary {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
  }

  .nav-group,
  .nav-subgroup {
    position: static;
  }

  .nav-submenu,
  .nav-flyout {
    position: static;
    width: auto;
    max-height: none;
    margin: 3px 0 7px 10px;
    padding: 4px;
    overflow: visible;
    border: 0;
    border-left: 2px solid rgba(255, 255, 255, .2);
    border-radius: 0;
    box-shadow: none;
  }

  .nav-submenu a,
  .nav-subgroup > summary {
    min-height: 42px;
    padding: 10px 11px;
  }

  .nav-subgroup > summary,
  .nav-flyout a {
    color: var(--ink);
  }

  .nav-cascade {
    overflow: visible;
  }

  .user-actions {
    justify-self: end;
  }

  .dashboard-grid,
  .integration-grid,
  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding-top: 24px;
    padding-bottom: 42px;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  .brand small,
  .user-name {
    display: none;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .page-heading h1 {
    font-size: clamp(1.45rem, 6.5vw, 1.8rem);
  }

  .heading-actions > .button,
  .heading-actions > form,
  .heading-buttons,
  .heading-buttons > .button,
  .heading-buttons > form,
  .heading-buttons > form > .button {
    width: 100%;
  }

  .module-grid,
  .form-grid,
  .detail-grid,
  .permission-grid ul {
    grid-template-columns: 1fr;
  }

  .module-card {
    padding: 18px;
  }

  .panel {
    padding: 17px;
    border-radius: 13px;
  }

  .table-wrap.panel,
  .panel.table-wrap {
    padding: 12px 0;
  }

  .table-wrap > h2,
  .table-wrap > h3,
  .table-wrap > p {
    padding-inline: 14px;
  }

  th,
  td {
    padding: 11px 10px;
  }

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

  .search-form > input,
  .search-form > select,
  .search-form > label,
  .search-form > .button {
    width: 100%;
  }

  .inline-form {
    display: flex;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .inline-form > .button {
    width: 100%;
  }

  .field-check {
    min-height: 44px;
    padding-top: 0;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions > .button,
  .form-actions > form,
  .form-actions > form > .button {
    flex: 1 1 160px;
  }

  .alert-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .alert-row > strong,
  .alert-row > .status,
  .due-summary {
    align-self: flex-start;
    text-align: left;
  }

  .calendar-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .calendar-navigation h2,
  .calendar-navigation > .button:nth-child(2) {
    grid-column: 1 / -1;
  }

  .calendar-navigation > .button:nth-child(2) {
    grid-row: 1;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(92px, 1fr));
    min-width: 644px;
  }

  .calendar-day {
    min-height: 92px;
  }

  .wake-week {
    scroll-snap-type: x proximity;
  }

  .wake-day {
    scroll-snap-align: start;
  }

  .integration-summary,
  .indicator-list > span {
    align-items: flex-start;
    flex-direction: column;
  }

  .indicator-list small {
    text-align: left;
  }

  .footer-content {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .shell {
    width: min(100% - 16px, 1180px);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

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

  .nav-toggle > span:last-child {
    display: none;
  }

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

  .metric {
    padding: 15px;
  }

  .metric strong {
    font-size: 1.45rem;
  }

  .module-card {
    gap: 12px;
  }

  .module-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .finance-menu {
    flex-direction: column;
  }

  .form-actions > .button,
  .form-actions > form,
  .form-actions > form > .button,
  .receipt-actions > .button {
    width: 100%;
  }

  .quick-punch-form {
    padding: 15px;
  }

  .auth-card {
    padding: 20px 16px;
  }

  .receipt-amount {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .receipt-amount strong {
    font-size: 1.55rem;
  }

  .receipt-cancelled {
    inset: 42% auto auto 4%;
    font-size: 2.5rem;
    border-width: 5px;
  }
}
