@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;650;700;750;800&family=Geist:wght@400;500;600;650;700;750;800&display=swap");

:root {
  color-scheme: dark;
  --bg: #100f14;
  --sidebar: #15131b;
  --panel: #191720;
  --surface: #211e2a;
  --field: #15131c;
  --line: #302a3c;
  --line-strong: #4b415d;
  --ink: #f5f2fa;
  --muted: #b2a9c1;
  --accent: #f9d477;
  --accent-hover: #ffe29b;
  --accent-ink: #241905;
  --violet: #cdb8ff;
  --violet-bg: #302545;
  --success: #a9edc3;
  --danger: #ffb0b9;
  --radius: 14px;
  --heading-font: "Geist", "DM Sans", system-ui, sans-serif;
  --body-font: "DM Sans", system-ui, sans-serif;
}

body {
  min-width: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  background: var(--bg);
  color: var(--ink);
  font-size: .9375rem;
  line-height: 1.5;
}

[hidden] { display: none !important; }

button,
input,
select,
textarea { font: inherit; }

button:disabled {
  cursor: wait;
  opacity: .65;
}

:where(button, input, select, textarea, a, [tabindex]):focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
}

a { color: var(--violet); }

:where(h1, h2, h3, h4):not(:where(#contratoArea *)),
.stat-number { font-family: var(--heading-font); }

:where(h3, h4):not(:where(#contratoArea *)) {
  line-height: 1.2;
  letter-spacing: -.02em;
}

#app-shell {
  min-height: 100vh;
  min-width: 0;
}

#app-shell > .container,
#app-shell main.container {
  width: 100%;
  max-width: 1920px;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(24px, 2.5vw, 38px) clamp(13px, 1.65vw, 32px) 64px;
}

.page { min-width: 0; animation: none; }

.tabs {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 3px 18px;
  margin-bottom: 22px;
  padding: 0;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  position: relative;
  min-height: 43px;
  padding: 9px 4px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 650;
  transition: color .18s ease;
}

.tab-btn.active,
.tab-btn:hover {
  background: transparent;
  color: var(--ink);
  transform: none;
}

.tab-btn.active::after {
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: var(--violet);
  content: "";
}

.tab-content {
  min-width: 0;
  padding: clamp(12px, 1.35vw, 21px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 10px 28px rgba(5, 4, 8, .12);
}

.tab-panel { min-width: 0; }

.workspace-status {
  margin-bottom: 20px;
  padding: 11px 14px;
  border: 1px solid #654936;
  border-radius: 8px;
  background: #31251e;
  color: #ffdaab;
  font-size: .875rem;
}

.table-responsive td.empty-cell {
  padding: 24px 15px;
  color: var(--muted);
  text-align: center;
  white-space: normal;
}

.table-responsive {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 18px;
  overflow: auto;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 11px;
  scrollbar-color: var(--line-strong) var(--field);
}

.table-responsive:last-child { margin-bottom: 0; }

.table-responsive table {
  overflow: visible;
  border-radius: 0;
  box-shadow: none;
  color: var(--ink);
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}

.table-responsive th,
.table-responsive td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}

.table-responsive th {
  background: var(--surface);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}

.table-responsive td {
  min-width: 46px;
  overflow-wrap: anywhere;
}

.table-responsive tbody tr:nth-child(even) { background: #191620; }
.table-responsive tbody tr:hover { background: #221c2e; }
.table-responsive tbody tr:last-child td { border-bottom: 0; }

#tab-fluxo .table-responsive.detalhe { max-height: min(72vh, 620px); }

#tab-fluxo table.detalhe {
  width: 100% !important;
  min-width: 0 !important;
}

#tab-fluxo table.detalhe th,
#tab-fluxo table.detalhe td {
  border-color: var(--line);
}

#tab-fluxo table.detalhe thead th,
#tab-fluxo table.detalhe th:first-child,
#tab-fluxo table.detalhe td:first-child {
  background: var(--surface);
  color: var(--ink);
}

#tab-fluxo table.detalhe tfoot th,
#tab-fluxo table.detalhe tfoot th:first-child {
  color: var(--accent);
  background: #24272b;
}

.btn,
.modal-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  max-width: 100%;
  margin: 0 4px 8px 0;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: .8125rem;
  font-weight: 750;
  line-height: 1.3;
  text-align: center;
  transition: background .18s ease, border-color .18s ease;
}

.btn:hover,
.modal-footer button:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
}

.btn-action,
.modal-body :is(.edit-prev, .remove-prev) {
  display: inline-grid;
  min-width: 34px;
  min-height: 34px;
  margin: 1px;
  padding: 4px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: .875rem;
  cursor: pointer;
}

.btn-action:hover,
.modal-body :is(.edit-prev, .remove-prev):hover {
  background: var(--violet-bg);
  border-color: var(--violet);
}

#refreshItemBtn,
#btnFiltrarMov,
#btnAplicarFiltro,
:is(#remCatEnt, #remCatSai, #addSubEnt, #addSubSai) {
  border-color: var(--line-strong);
  background: var(--surface) !important;
  color: var(--ink);
}

:is(#refreshItemBtn, #btnFiltrarMov, #btnAplicarFiltro, #remCatEnt, #remCatSai, #addSubEnt, #addSubSai):hover {
  background: var(--violet-bg) !important;
  border-color: var(--violet);
}

:where(input:not([type="checkbox"], [type="radio"]), select, textarea),
.modal-body :is(input:not([type="checkbox"], [type="radio"]), select, textarea) {
  min-height: 38px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-size: .875rem;
}

input::placeholder,
textarea::placeholder { color: var(--muted); opacity: 1; }

input[type="checkbox"],
input[type="radio"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--violet);
}

input::file-selector-button {
  margin-right: 8px;
  padding: 3px 7px;
  border: 0;
  border-radius: 4px;
  background: var(--violet-bg);
  color: var(--ink);
  cursor: pointer;
}

.tab-panel label,
.modal-body label {
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 650;
}

.tab-panel > div:has(> :is(#fStatus, #btnFiltrarMov)) {
  display: flex;
  align-items: flex-end !important;
  flex-wrap: wrap;
  gap: 8px 12px;
}

#tab-mov label:has(> :is(input, select)) {
  display: grid;
  gap: 5px;
  max-width: 100%;
}

:is(#btnFiltrarMov, #btnAplicarFiltro) { margin-bottom: 0; }
#tab-controle label:has(+ #fStatus) { align-self: center; }

#tab-clientes > div:has(> #filterClientes) {
  display: inline-block;
  width: min(100%, 300px);
  margin: 0 0 8px 6px !important;
}

#filterClientes { padding: 8px 10px !important; }

#tab-concluidos :is(#upload-group, #search-group) { min-width: 0; max-width: 100%; }
#concSearchInput {
  width: min(100%, 350px) !important;
  border-color: var(--line-strong) !important;
}

#tab-termos :is(label, input, select, .btn) { margin: 0 8px 12px 0 !important; }
#tab-termos .btn { vertical-align: baseline; }

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--violet-bg);
  color: var(--violet);
  font-size: .75rem;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
}

.badge-a-alugar,
.badge-previsto { background: #29243b; color: #d6c4ff; }
.badge-alugado,
.badge-concluido { background: #1f382e; color: var(--success); }
.badge-a-vencer,
.badge-pendente { background: #42311f; color: #ffd397; }
.badge-atrasado,
.badge-cancelado { background: #48262f; color: var(--danger); }

#tab-mov td[style*="color:green"] { color: var(--success) !important; }
#tab-mov td[style*="color:red"],
.modal-body strong[style*="color:red"] { color: var(--danger) !important; }

.stats-container,
.dashboard-cards {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  gap: 12px !important;
  margin-bottom: 22px !important;
}

.stat-card,
.dashboard-cards > div {
  --status: var(--violet);
  min-width: 0;
  padding: 15px 16px !important;
  border: 1px solid var(--line) !important;
  border-radius: 11px !important;
  background: var(--surface);
  box-shadow: none !important;
  text-align: left !important;
}

.stat-card:hover { transform: none; }
.stat-card.alugado { --status: var(--success); }
.stat-card.a-vencer { --status: #ffd397; }
.stat-card.atrasado { --status: var(--danger); }

.stat-card h4,
.dashboard-cards h4 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 650;
}

.stat-card h4::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--status);
  vertical-align: .1em;
  content: "";
}

.stat-card .stat-number,
:is(#cardTotalAlug, #cardConclu, #cardFatur, #cardItemCount, #cardItemFatur, #cardRec, #cardPag, #cardSaldo) {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: clamp(1.25rem, 3vw, 1.9rem) !important;
  font-weight: 750;
  letter-spacing: -.055em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

:is(#tab-geral, #tab-por-item, #tab-fluxo) > div:first-child {
  flex-wrap: wrap;
  gap: 10px;
}

:is(#chartGeral, #chartItem, #chartFluxo) {
  max-width: 100%;
  min-height: clamp(158px, 32vw, 248px);
  padding: 12px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.modal-overlay {
  background: rgba(8, 6, 13, .78);
  backdrop-filter: blur(3px);
}

.modal-container {
  width: min(92%, 550px);
  max-width: none;
  max-height: 88vh;
  max-height: 88dvh;
  padding: clamp(18px, 3vw, 26px);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .38);
  scrollbar-color: var(--line-strong) var(--panel);
}

.modal-header {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-family: var(--heading-font);
  font-size: 1.3rem;
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1.2;
}

.modal-body input[readonly] { background: var(--surface); color: var(--muted); }

.modal-body hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.modal-body table { font-size: .8125rem; }
.modal-body :is(table th, table td) { padding: 5px; }
.modal-body table th { background: var(--surface); }
.modal-body table tbody tr:nth-child(even) { background: var(--field); }

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.modal-footer button { margin: 0; }
.modal-footer :is(button.save, button.finalize) { background: var(--accent); color: var(--accent-ink); }
.modal-footer :is(button.save, button.finalize):hover { background: var(--accent-hover); }
.modal-footer :is(button.cancel, button.addItem) {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.modal-footer :is(button.cancel, button.addItem):hover {
  background: var(--violet-bg);
  color: var(--ink);
}

#toast-container {
  top: auto;
  right: clamp(12px, 3vw, 28px);
  bottom: clamp(12px, 3vw, 28px);
  width: min(365px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
  transition: opacity .2s ease, transform .2s ease;
  transform: translateY(8px);
}

.toast.show { transform: translateY(0); }
.toast.success { background: #1e352a; color: var(--success); }
.toast.error { background: #3d232d; color: var(--danger); }
.toast.info { background: var(--violet-bg); color: var(--ink); }

#contratoArea {
  color-scheme: light;
  background: #fff;
}

.contract-preview {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-color: var(--line-strong) var(--field);
}

@media (max-width: 620px) {
  #app-shell > .container,
  #app-shell main.container { padding: 23px 13px 42px; }

  .tabs { gap: 0 15px; margin-bottom: 15px; }
  .tab-btn { font-size: .8125rem; padding-inline: 2px; }
  .tab-content { padding: 13px; border-radius: 13px; }

  .stats-container,
  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
  }

  .stat-card,
  .dashboard-cards > div { padding: 12px !important; }

  #tab-clientes > div:has(> #filterClientes) {
    display: block;
    margin-left: 0 !important;
  }

  #tab-termos :is(input, select, label) { display: block; }

  .btn-action,
  .modal-body :is(.edit-prev, .remove-prev) {
    min-width: 40px;
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}


.app-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  padding: 19px 16px 12px;
  background: var(--sidebar);
  color: var(--ink);
  text-align: left;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.app-brand {
  display: block;
  width: min(100%, 144px);
  min-width: 0;
}

.app-brand img,
.auth-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.app-brand img {
  width: min(100%, 80px);
  margin-inline: auto;
}

.app-sidebar .menu {
  display: flex;
  gap: 5px;
  min-width: 0;
}

.app-sidebar .menu button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: .8125rem;
  line-height: 1.2;
  font-weight: 650;
  text-align: left;
  transition: background .18s ease, color .18s ease;
}

.app-sidebar .menu button:hover {
  background: var(--surface);
  color: var(--ink);
  transform: none;
}

.app-sidebar .menu button.active {
  background: var(--violet-bg);
  color: #e6d8ff;
  border-color: #503e6d;
  transform: none;
}

.app-sidebar :is(.menu button, #auth-signout) svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
}

.session-box { min-width: 0; }
.session-identity { min-width: 0; }

#session-email {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-size: .75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#auth-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 650;
  cursor: pointer;
}

#auth-signout:hover { background: var(--violet-bg); }

.page-header {
  margin-bottom: 23px;
}

.page-header h1 {
  margin: 0;
  font: 750 clamp(2rem, 4vw, 3.15rem)/1.05 var(--heading-font);
  letter-spacing: -.065em;
}

.page-header p {
  max-width: 62ch;
  margin-top: 7px;
  color: var(--muted);
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
  scrollbar-color: var(--line-strong) var(--field);
}

.auth-view {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding: clamp(17px, 5vw, 65px);
  place-items: center;
  background:
    radial-gradient(ellipse at 4% 100%, #271d37 0%, transparent 48%),
    radial-gradient(ellipse at 95% 0%, #201927 0%, transparent 45%),
    var(--bg);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.22fr) minmax(290px, .95fr);
  width: 100%;
  max-width: 1010px;
  overflow: hidden;
  border: 1px solid #3b304b;
  border-radius: 25px;
  background: var(--panel);
  box-shadow: 0 34px 115px rgba(4, 3, 7, .4);
}

.auth-brand-panel {
  display: flex;
  min-width: 0;
  min-height: 490px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: clamp(28px, 4.2vw, 52px);
  border-right: 1px solid #443459;
  background:
    radial-gradient(ellipse at 88% 100%, #56406b 0%, transparent 65%),
    radial-gradient(ellipse at 15% 60%, #332640 0%, transparent 70%),
    linear-gradient(145deg, #221b2d 10%, #392b49 100%);
  text-align: center;
}

.auth-logo {
  display: block;
  width: min(100%, 228px);
}

.auth-intro h1 {
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  line-height: 1.05;
  font-weight: 750;
  letter-spacing: -.06em;
  text-wrap: balance;
}

.auth-intro p {
  max-width: 32ch;
  margin: 12px auto 0;
  color: #ddd1ec;
  font-size: clamp(.9rem, 2vw, 1.03rem);
}

.auth-intro .auth-welcome {
  margin: 0 auto 8px;
  color: var(--violet);
  font-weight: 750;
}

.auth-card {
  align-content: center;
  min-width: 0;
  padding: clamp(27px, 4vw, 52px);
}

.auth-heading { margin-bottom: 26px; }

.auth-heading h2 {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: -.055em;
}

.auth-heading p {
  margin-top: 8px;
  color: var(--muted);
  font-size: .875rem;
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field label {
  font-size: .8125rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 44px;
  padding: 8px 11px;
}

.auth-submit {
  min-height: 45px;
  margin-top: 1px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  cursor: pointer;
}

.auth-submit:hover { background: var(--accent-hover); }

.auth-reset {
  justify-self: start;
  min-height: 30px;
  padding: 3px 0;
  border: 0;
  background: transparent;
  color: var(--violet);
  font-size: .8125rem;
  font-weight: 650;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-message {
  margin-top: 11px;
  color: var(--muted);
  font-size: .8125rem;
  overflow-wrap: anywhere;
}

.auth-message:empty { display: none; }
.auth-message:is(.error, [data-state="error"], [data-type="error"]) { color: var(--danger); }
.auth-message:is(.success, [data-state="success"], [data-type="success"]) { color: var(--success); }

@media (min-width: 980px) {
  .app-sidebar {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
    align-items: center;
    gap: 16px;
    padding: 10px clamp(16px, 2vw, 36px);
  }

  .app-sidebar .app-brand { width: min(100%, 127px); }
  .app-sidebar .menu { justify-content: center; flex-wrap: wrap; }
  .app-sidebar .menu button { min-height: 42px; padding-inline: 13px; }

  .session-box {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
  }

  #session-email { max-width: min(17vw, 220px); }
}

@media (max-width: 979px) {
  .app-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px 12px;
    padding-inline: clamp(13px, 4vw, 30px);
  }

  .app-sidebar .menu {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .session-box {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .session-identity { max-width: min(28vw, 220px); }
}

@media (max-width: 720px) {
  .auth-layout { grid-template-columns: minmax(0, 1fr); max-width: 435px; }
  .auth-brand-panel {
    min-height: 0;
    gap: 13px;
    padding: 18px 22px;
    border-right: 0;
    border-bottom: 1px solid #443459;
  }

  .auth-logo { width: min(100%, 144px); }
  .auth-intro h1 { font-size: clamp(1.75rem, 7.2vw, 2.2rem); }
  .auth-intro p { margin-top: 6px; }
  .auth-card { padding: 22px; }
  .auth-heading { margin-bottom: 16px; }
}

@media (max-width: 420px) {
  .app-sidebar .menu button { gap: 5px; padding-inline: 7px; font-size: .75rem; }
  .app-sidebar .menu button svg { flex-basis: 14px; width: 14px; height: 14px; }
  .app-sidebar .app-brand { width: min(100%, 108px); }
  .app-brand img { width: min(100%, 64px); }
  .session-identity { max-width: 20vw; }
  .page-header { margin-bottom: 17px; }
}


.btn-action {
  border-color: var(--line);
  background: var(--field);
  color: var(--muted);
}

.btn-action svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.btn-action:hover { color: var(--ink); }

.btn-action:is([aria-label^="Excluir"], [aria-label^="Cancelar"]):hover {
  border-color: #9e5365;
  background: #42252f;
  color: var(--danger);
}

:is(#cardFatur, #cardItemFatur, #cardSaldo) { color: var(--accent); }

.table-responsive:has(> [data-record-table]) {
  overflow: clip;
}

.table-responsive > [data-record-table] {
  width: 100%;
  min-width: 0;
  font-size: .9375rem;
  line-height: 1.4;
}

.table-responsive > [data-record-table] :is(th, td) {
  min-width: 0;
  padding: 13px 10px;
  vertical-align: middle;
}

.table-responsive > [data-record-table] th {
  color: #cec5db;
  font-size: .8125rem;
  line-height: 1.28;
  white-space: normal;
  overflow-wrap: normal;
}

.table-responsive > [data-record-table] td {
  overflow-wrap: break-word;
  word-break: normal;
}

.table-responsive > [data-record-table] td[data-column-format="whole"],
#tab-mov [data-record-table] td[data-column-label="Tipo"] {
  white-space: nowrap;
}

[data-record-table] .badge {
  max-width: 100%;
  white-space: normal;
}

.table-responsive > [data-record-table] .table-actions {
  display: inline-grid;
  grid-template-columns: repeat(2, 34px);
  gap: 5px;
  align-items: start;
  vertical-align: middle;
}

.table-responsive > [data-record-table] .table-actions:has(> button:only-child) {
  grid-template-columns: 34px;
}

.table-actions .btn-action { margin: 0; }

#tab-fluxo .table-responsive.detalhe:has(> [data-record-table]) {
  overflow: hidden auto;
}

#tab-fluxo .table-responsive.detalhe:not(.is-mobile-scroll):has(> #tblDetalheSai),
#tab-fluxo .table-responsive.detalhe:has(> .is-stacked) {
  max-height: none;
  overflow: clip;
}

#tab-fluxo table.detalhe[data-record-table]:not(.is-stacked) :is(th, td) {
  padding: 13px 9px;
}

#tab-fluxo table.detalhe[data-record-table]:not(.is-stacked) :is(th, td):first-child {
  min-width: 155px;
}

.table-responsive:has(> [data-record-table].is-stacked) {
  background: transparent;
  border: 0;
  border-radius: 0;
}

.table-responsive > [data-record-table].is-stacked {
  display: block;
  position: relative;
  text-align: left;
}

[data-record-table]:not(.is-stacked) [data-column-label="Ações"] {
  width: 1%;
  white-space: nowrap;
}

#tab-fluxo table.detalhe[data-record-table].is-stacked :is(tbody, tfoot) :is(th, td) {
  position: static;
  min-width: 0;
  border: 0;
  background: transparent;
}

/* The header remains available to assistive technology in the grouped layout. */
[data-record-table].is-stacked thead {
  display: block;
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#tab-fluxo table.detalhe[data-record-table].is-stacked thead th { position: static; }

[data-record-table].is-stacked :is(tbody, tfoot) { display: block; }

[data-record-table].is-stacked :is(tbody, tfoot) > tr {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 124px), 1fr));
  align-items: start;
  gap: 14px 17px;
  margin-bottom: 10px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
}

.table-responsive > [data-record-table].is-stacked :is(tbody, tfoot) > tr > :is(th, td) {
  position: static;
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

[data-record-table].is-stacked :is(td, th)[data-column-label]::before {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: normal;
  content: attr(data-column-label);
  content: attr(data-column-label) / "";
}

[data-record-table].is-stacked :is(td[colspan], td[data-column-label="Ações"]) {
  grid-column: 1 / -1;
}

.table-responsive > [data-record-table].is-stacked .table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

@media (max-width: 620px) {
  .table-responsive > [data-record-table].is-stacked :is(tbody, tfoot) > tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 13px 12px;
  }

  [data-record-table].is-stacked td[data-column-label="Observações"] {
    grid-column: 1 / -1;
  }
}

:is(.table-responsive, .history-table).is-mobile-scroll {
  max-width: 100%;
  overflow: auto hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) var(--field);
}

.history-table.is-mobile-scroll {
  border: 1px solid var(--line);
  border-radius: 9px;
}

.is-mobile-scroll > [data-record-table] {
  width: max-content;
  min-width: 100%;
  font-size: .875rem;
}

.is-mobile-scroll > .history-changes { min-width: 510px; }

.is-mobile-scroll > :is([data-record-table], .history-changes) :is(th, td) {
  padding: 10px;
  border-inline-end: 1px solid var(--line);
}

.is-mobile-scroll > :is([data-record-table], .history-changes) :is(th, td):last-child {
  border-inline-end: 0;
}

.is-mobile-scroll > [data-record-table] th { white-space: nowrap; }

.is-mobile-scroll > [data-record-table] td:not([data-column-format], [data-column-label="Ações"], [colspan]) {
  max-width: 13rem;
  overflow-wrap: anywhere;
}

.is-mobile-scroll > [data-record-table] td[colspan] { text-align: left !important; }

.table-responsive.is-mobile-scroll > [data-record-table] .table-actions {
  display: inline-flex;
  gap: 4px;
}

.is-mobile-scroll .table-actions .btn-action {
  width: 44px;
  height: 44px;
}

#tab-fluxo .table-responsive.detalhe.is-mobile-scroll:has(> [data-record-table]) {
  max-height: none;
  overflow: auto hidden;
}

#tab-fluxo .is-mobile-scroll > table.detalhe[data-record-table] {
  width: max-content !important;
  min-width: 100% !important;
}

#tab-fluxo .is-mobile-scroll > table.detalhe[data-record-table] :is(th, td):first-child {
  min-width: 120px;
}

@media (max-width: 420px) {
  .dashboard-cards > div:has(#cardSaldo) { grid-column: 1 / -1; }

  .dashboard-cards > div {
    min-width: 0 !important;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .dashboard-cards { grid-template-columns: minmax(0, 1fr); }
}


#access-admin {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.access-card {
  min-width: 0;
  padding: clamp(15px, 3vw, 25px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--panel);
}

.access-card h2 {
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -.035em;
}

.access-toolbar,
.access-controls,
.access-actions {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.access-toolbar { justify-content: space-between; margin-bottom: 14px; }
.access-controls { flex-wrap: nowrap; }
.access-toolbar .btn,
.access-actions .btn,
.access-users .btn { margin: 0; }

.access-controls input { width: min(100%, 225px); }
.access-editor-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 185px);
  gap: 13px;
  margin: 17px 0;
}

.access-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.access-field { display: grid; gap: 5px; }
.access-field label,
.access-editor legend { color: var(--muted); font-size: .8125rem; font-weight: 700; }
.access-field input[readonly] { background: var(--surface); }

.access-editor fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.access-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
  gap: 8px;
  margin: 7px 0 17px;
}

.access-options label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-size: .8125rem;
  cursor: pointer;
}

.access-options label:has(input:checked) {
  border-color: #655283;
  background: var(--violet-bg);
}

.access-options label:has(input:focus-visible) {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.access-options label input { flex-shrink: 0; }
.btn.access-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.btn.access-secondary:hover {
  border-color: var(--violet);
  background: var(--violet-bg);
}

.access-users {
  margin: 0;
  padding: 0;
  list-style: none;
}

.access-users:empty,
.access-message:empty { display: none; }

.access-users li {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 88px minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  gap: 12px 15px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.access-email {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: .875rem;
  font-weight: 700;
}

.access-scope,
.access-message {
  min-width: 0;
  color: var(--muted);
  font-size: .8125rem;
}

.access-message { margin-top: 12px; }
.access-message[data-state="error"] { color: var(--danger); }
.access-message[data-state="success"] { color: var(--success); }
#access-retry { margin-top: 8px; }

@media (min-width: 980px) {
  .access-options { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  #access-editor-heading, #access-email { scroll-margin-top: 175px; }

  .access-users li {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
  }

  .access-scope { grid-column: 1; }
}

@media (max-width: 520px) {
  .app-sidebar .menu:has(#btn-acessos:not([hidden])) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .access-editor-fields { grid-template-columns: minmax(0, 1fr); }
  .access-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .access-controls { width: 100%; flex-wrap: wrap; }
  .access-controls input { min-width: min(100%, 145px); flex: 1 0 145px; }
}


.history-toolbar-copy p {
  margin-top: 5px;
  color: var(--muted);
  font-size: .8125rem;
}

.history-entries {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.history-entry { border-top: 1px solid var(--line); }

.history-summary {
  display: grid;
  grid-template-columns: minmax(120px, .65fr) minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 12px;
  padding: 12px 5px;
  border-radius: 6px;
  list-style: none;
  cursor: pointer;
}

.history-summary::-webkit-details-marker { display: none; }
.history-summary:hover { background: var(--surface); }

.history-summary:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 1px;
}

.history-stamp,
.history-subject {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-stamp span,
.history-subject small {
  color: var(--muted);
  font-size: .75rem;
  overflow-wrap: anywhere;
}

.history-time {
  color: var(--ink);
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}

.history-subject strong {
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.history-chevron {
  width: 7px;
  height: 7px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-2px) rotate(45deg);
}

.history-entry[open] .history-chevron { transform: translateY(1px) rotate(225deg); }

.history-detail {
  margin: 1px 0 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--field);
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 10px;
}

.history-meta:empty { display: none; }
.history-meta div { max-width: 100%; }

.history-meta dt {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}

.history-meta dd {
  color: var(--ink);
  font-size: .8125rem;
  overflow-wrap: anywhere;
}

.history-changes {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .8125rem;
  text-align: left;
}

.history-changes th,
.history-changes td {
  padding: 8px 7px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.history-changes thead th {
  color: var(--muted);
  background: var(--surface);
}

.history-changes tbody th { width: 26%; }
.history-changes tbody tr:nth-child(even) { background: var(--panel); }

.history-footer .btn { margin: 12px 0 0; }

@media (max-width: 620px) {
  .history-summary {
    grid-template-columns: minmax(0, 1fr) 12px;
    gap: 6px;
  }

  .history-subject { grid-column: 1; grid-row: 1; }
  .history-chevron { grid-column: 2; grid-row: 1; }
  .history-stamp {
    display: flex;
    grid-column: 1 / -1;
    gap: 3px 10px;
    flex-wrap: wrap;
  }

  .history-summary .badge { justify-self: start; }
  .history-changes :is(td, th) { padding: 7px 5px; }
}

@media (max-width: 580px) {
  .app-sidebar .menu:has(#btn-historico:not([hidden])) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .app-sidebar .menu:has(#btn-historico:not([hidden])) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.test-environment {
  display: inline-block;
  width: fit-content;
  margin: 0 0 .65rem;
  padding: .32rem .52rem;
  border: 1px solid #614672;
  border-radius: 6px;
  background: var(--violet-bg);
  color: #efe5ff;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.35;
}

.app-brand .test-environment {
  margin: .5rem 0 0;
}

[data-modo-consulta] :is(
  #addClienteBtn, #addItemBtn, #addContaBtn, #addCatEnt, #remCatEnt, #addSubEnt,
  #addCatSai, #remCatSai, #addSubSai, #btnAddAlug, #addMovBtn, #upload-group,
  #tab-concluidos [data-action="delete"],
  :is(#tab-clientes, #tab-itens, #tab-contas, #tab-entradas, #tab-saidas, #tab-controle, #tab-mov) [data-column-label="Ações"]
) {
  display: none !important;
}
