:root {
  --bg: #f3efe3;
  --bg-soft: #fffaf0;
  --ink: #17251d;
  --muted: #667363;
  --green: #286f3d;
  --green-2: #55a35f;
  --leaf: #9fc36b;
  --orange: #d8782e;
  --line: #dbe1d1;
  --danger: #b73434;
  --shadow: 0 18px 42px rgba(24, 43, 33, 0.13);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Nunito", Arial, sans-serif;
  color: var(--ink);
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(circle at 8% 4%, rgba(159, 195, 107, 0.34), transparent 28%),
    radial-gradient(circle at 98% 8%, rgba(216, 120, 46, 0.14), transparent 22%),
    linear-gradient(135deg, rgba(255, 250, 240, 0.98), rgba(235, 242, 221, 0.9)),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(47, 127, 69, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 127, 69, 0.04) 1px, transparent 1px);
  background-size: 34px 34px;
}

button, input, select, textarea { font: inherit; }
button, .file-action { user-select: none; }
.hidden { display: none !important; }
.print-only { display: none !important; }
.muted, .hint { color: var(--muted); }

.auth-gate {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr);
  align-items: stretch;
  padding: 0;
  background: #122619;
}

.auth-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("./images/sobre-loja.jpg?v=20260502-1") center / cover no-repeat;
}

.auth-gate::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(18, 38, 25, 0.92) 0%, rgba(18, 38, 25, 0.78) 35%, rgba(18, 38, 25, 0.34) 68%, rgba(18, 38, 25, 0.18) 100%);
}

.auth-card {
  width: min(460px, calc(100% - 40px));
  display: grid;
  gap: 14px;
  align-self: center;
  justify-self: center;
  padding: 28px;
  border: 1px solid rgba(47, 127, 69, 0.18);
  border-radius: 18px;
  background: #fffaf0;
  box-shadow: 0 28px 70px rgba(5, 24, 12, 0.24);
}

.auth-gate .auth-card::after {
  content: "Caderneta digital para clientes, contas e comprovantes";
  position: fixed;
  right: clamp(34px, 5vw, 72px);
  bottom: clamp(34px, 5vw, 72px);
  max-width: 720px;
  color: #fff;
  font-family: "Sora", Arial, sans-serif;
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  font-weight: 800;
  line-height: 1.05;
  text-shadow: 0 8px 32px rgba(0, 0, 0, 0.32);
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
  flex-wrap: wrap;
}

.auth-brand-title, .brand strong, h1, h2 {
  font-family: "Sora", Arial, sans-serif;
  letter-spacing: 0;
}

.auth-brand-title {
  color: var(--green);
  font-size: 1.35rem;
  font-weight: 800;
}

.auth-brand-sub, .eyebrow {
  color: var(--orange);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.auth-foot strong {
  color: var(--green);
  white-space: nowrap;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  line-height: 1.25;
}

.remember-row input {
  appearance: none;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 2px solid rgba(40, 111, 61, 0.42);
  border-radius: 5px;
  background: #fff;
  accent-color: var(--green);
  cursor: pointer;
}

.remember-row input:checked {
  border-color: var(--green);
  background:
    linear-gradient(135deg, transparent 0 42%, #fff 42% 58%, transparent 58%),
    linear-gradient(45deg, transparent 0 46%, #fff 46% 62%, transparent 62%),
    var(--green);
  background-size: 12px 12px, 8px 8px, auto;
  background-position: 4px 2px, 2px 7px, center;
  background-repeat: no-repeat;
}

.remember-row input:focus {
  box-shadow: 0 0 0 4px rgba(85, 163, 95, 0.14);
}

.settings-list {
  display: grid;
  gap: 16px;
}

.user-form {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(160px, 0.9fr);
  align-items: end;
  margin-bottom: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.setting-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(47, 127, 69, 0.16);
  border-radius: var(--radius-sm);
  background: #f8fbf2;
  color: var(--ink);
}

.setting-row input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  accent-color: var(--green);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  padding: 20px;
  border-right: 1px solid rgba(47, 127, 69, 0.16);
  background: #fffaf0;
}

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

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 800;
}

.brand-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(47, 127, 69, 0.18);
  background: #fff;
  box-shadow: 0 12px 28px rgba(47, 127, 69, 0.16);
}

.brand-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 3px;
}

.module-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.module-nav button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  font-weight: 900;
}

.module-nav button.active {
  border-color: rgba(47, 127, 69, 0.18);
  background: #eef6e8;
  color: var(--green);
}

.sidebar-footer {
  display: grid;
  gap: 10px;
}

.sidebar-footer span {
  color: var(--muted);
  font-weight: 900;
}

.main-shell {
  width: min(1680px, 100%);
  min-width: 0;
  padding: clamp(18px, 2vw, 30px);
}

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

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.db-pill {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(47, 127, 69, 0.22);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 900;
}

.db-pill.online {
  border-color: rgba(40, 111, 61, 0.34);
  background: #edf7e7;
  color: var(--green);
}

.db-pill.offline {
  border-color: rgba(183, 52, 52, 0.22);
  background: #fff1f1;
  color: var(--danger);
}

.btn {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 900;
}

.btn-main {
  background: linear-gradient(135deg, var(--green), var(--green-2));
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 127, 69, 0.2);
}

.btn-soft {
  border: 1px solid rgba(47, 127, 69, 0.26);
  background: #fff;
  color: var(--green);
}

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

.btn-table {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 0.88rem;
}

.inline-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.full { width: 100%; }

.file-action {
  display: inline-grid;
  place-items: center;
}

.file-action input { display: none; }

.module {
  display: none;
}

.module.active {
  display: grid;
  gap: 16px;
}

.hero {
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: end;
  gap: 16px;
  padding: 28px;
  border-radius: var(--radius);
  background:
    linear-gradient(105deg, rgba(13, 31, 20, 0.88), rgba(27, 70, 39, 0.58) 58%, rgba(216, 120, 46, 0.18)),
    url("./images/hero-fullhd.jpg?v=20260502-1") center 46% / cover no-repeat;
  box-shadow: var(--shadow);
}

.hero h2 {
  max-width: 17ch;
  color: #fff;
  font-size: clamp(1.9rem, 3.2vw, 3.2rem);
  line-height: 1.05;
}

.hero-total {
  display: grid;
  gap: 4px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(8px);
}

.hero-total span {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 900;
}

.hero-total strong {
  font-family: "Sora", Arial, sans-serif;
  font-size: 1.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.bi-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 12px;
}

.chart-panel {
  min-height: 310px;
}

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

.chart-panel canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.chart-legend {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-weight: 900;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-legend i {
  width: 13px;
  height: 13px;
  border-radius: 4px;
}

.stat-card, .panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(20, 39, 29, 0.07);
}

.stat-card {
  display: grid;
  gap: 4px;
  padding: 16px;
}

.stat-card span {
  color: var(--muted);
  font-weight: 900;
}

.stat-card strong {
  font-family: "Sora", Arial, sans-serif;
  font-size: 1.35rem;
}

.danger-card {
  border-color: rgba(183, 52, 52, 0.25);
  background: #fff8f8;
}

.danger-card strong {
  color: var(--danger);
}

.panel {
  padding: 18px;
}

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

.two-column {
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.single-column {
  display: grid;
  max-width: 1180px;
}

.account-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  max-width: 100%;
}

.compact-list {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(47, 127, 69, 0.18);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
  font-weight: 700;
}

select {
  text-overflow: ellipsis;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: rgba(40, 111, 61, 0.65);
  box-shadow: 0 0 0 4px rgba(85, 163, 95, 0.14);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 8px;
  margin-bottom: 12px;
}

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

.client-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(47, 127, 69, 0.14);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 11px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.client-item.active {
  border-color: rgba(40, 111, 61, 0.7);
  background: #f4faee;
}

.client-name {
  display: block;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-phone {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.client-balance {
  color: var(--green);
  font-weight: 900;
  white-space: nowrap;
}

.client-balance.open { color: var(--danger); }

.row-overdue td {
  background: #fff8f8;
}

.empty-state {
  min-height: 430px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.empty-state p {
  max-width: 42ch;
  color: var(--muted);
  font-weight: 800;
}

.account-view {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.account-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 18px;
  align-items: start;
}

.balance-box {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fffdf7, #f4faee);
  border: 1px solid rgba(47, 127, 69, 0.16);
  justify-self: end;
  width: 100%;
}

.balance-box span {
  color: var(--muted);
  font-weight: 900;
}

.balance-box strong {
  color: var(--green);
  font-family: "Sora", Arial, sans-serif;
  font-size: 1.5rem;
}

.balance-box strong.open { color: var(--danger); }
.balance-box strong.overdue { color: var(--danger); }

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

.entry-form {
  display: grid;
  grid-template-columns: minmax(170px, 1.15fr) minmax(132px, 0.85fr) minmax(112px, 0.7fr) minmax(230px, 1.7fr) minmax(132px, 0.85fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(47, 127, 69, 0.13);
  border-radius: var(--radius);
  background: #f8fbf2;
}

.entry-form label:nth-child(6) {
  grid-column: 1 / span 1;
}

.entry-form label:nth-child(7) {
  grid-column: 2 / span 3;
}

.entry-form button[type="submit"] {
  width: 100%;
  min-width: 112px;
  grid-column: 5;
}

.entry-form input[type="file"] {
  min-height: 42px;
  max-width: 100%;
  overflow: hidden;
  padding: 8px;
  font-size: 0.82rem;
}

.entry-form input[type="file"]::file-selector-button {
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  background: #eef6e8;
  color: var(--green);
  cursor: pointer;
  margin-right: 8px;
  padding: 5px 10px;
  font-weight: 900;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

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

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

th {
  background: #f8fbf2;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }
.money { text-align: right; white-space: nowrap; }
.danger-money { color: var(--danger); font-weight: 900; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

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

.status-pill.ok {
  background: #fff7df;
  color: var(--orange);
}

.status-pill.partial {
  background: #fff7df;
  color: var(--orange);
}

.status-pill.paid {
  background: #edf7e7;
  color: var(--green);
}

.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.tag.debit {
  background: #ffeaea;
  color: var(--danger);
}

.tag.credit {
  background: #edf7e7;
  color: var(--green);
}

.link-action {
  color: var(--green);
  font-weight: 900;
  text-decoration: none;
}

.icon-btn {
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: var(--radius-sm);
  background: #fff1f1;
  color: var(--danger);
  cursor: pointer;
  font-weight: 900;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #17251d;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(13, 31, 20, 0.52);
}

.modal-card {
  width: min(1180px, 96vw);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf0;
  box-shadow: var(--shadow);
  padding: 18px;
}

@media (max-width: 1280px) {
  .account-layout {
    grid-template-columns: 1fr;
  }

  .compact-list {
    position: static;
    max-height: none;
  }
}

@media (max-width: 1080px) {
  .app, .two-column, .account-layout, .hero, .account-header {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    grid-template-rows: auto auto auto;
    gap: 16px;
  }

  .module-nav {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .module-nav button {
    text-align: center;
  }

  .compact-list {
    position: static;
    max-height: none;
  }

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

  .entry-form button[type="submit"] {
    grid-column: auto;
  }

  .bi-grid,
  .chart-box {
    grid-template-columns: 1fr;
  }

  .entry-form label:nth-child(6) {
    grid-column: auto;
  }

  .entry-form label:nth-child(7) {
    grid-column: 1 / -1;
  }

  .auth-gate {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .auth-gate .auth-card::after {
    display: none;
  }
}

@media (max-width: 640px) {
  body {
    background:
      linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(239, 247, 231, 0.96)),
      var(--bg);
  }

  body::before {
    background-size: 26px 26px;
  }

  .auth-gate {
    min-height: 100dvh;
    padding: 14px;
    align-items: center;
  }

  .auth-card {
    width: 100%;
    padding: 20px;
    border-radius: 14px;
  }

  .auth-brand {
    justify-content: flex-start;
  }

  .auth-brand-title {
    font-size: 1.1rem;
  }

  .app {
    display: block;
  }

  .main-shell {
    padding: 12px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    gap: 10px;
    padding: 10px 12px 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(47, 127, 69, 0.16);
    box-shadow: 0 8px 22px rgba(20, 39, 29, 0.08);
  }

  .brand {
    gap: 9px;
  }

  .sidebar .brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .sidebar .brand strong {
    font-size: 0.98rem;
  }

  .sidebar .brand small {
    font-size: 0.78rem;
  }

  .module-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }

  .module-nav button {
    min-width: 0;
    min-height: 40px;
    padding: 8px 6px;
    border-radius: 999px;
    text-align: center;
    font-size: 0.82rem;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
  }

  .topbar h1 {
    font-size: 1.65rem;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .top-actions .btn,
  .top-actions .file-action,
  .db-pill {
    width: 100%;
  }

  .hero {
    min-height: 210px;
    grid-template-columns: 1fr;
    align-items: end;
    padding: 18px;
  }

  .hero h2 {
    max-width: 13ch;
    font-size: 2rem;
  }

  .hero-total {
    padding: 12px;
  }

  .hero-total strong {
    font-size: 1.45rem;
  }

  .stats-grid,
  .entry-form,
  .user-form,
  .search-row,
  .two-column,
  .account-layout,
  .account-header {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card,
  .panel {
    border-radius: 10px;
  }

  .stat-card {
    padding: 13px;
  }

  .panel {
    padding: 14px;
  }

  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .bi-grid,
  .chart-box {
    grid-template-columns: 1fr;
  }

  .chart-panel {
    min-height: auto;
  }

  .chart-box canvas {
    max-width: 260px;
    justify-self: center;
  }

  .compact-list {
    max-height: 280px;
  }

  .client-item {
    padding: 10px;
  }

  .balance-box {
    justify-self: stretch;
  }

  .account-actions,
  .form-actions,
  .inline-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .entry-form {
    gap: 10px;
    padding: 12px;
  }

  .entry-form label:nth-child(6) { grid-column: auto; }
  .entry-form label:nth-child(7) { grid-column: auto; }
  .entry-form button[type="submit"] { grid-column: auto; }

  input,
  select,
  textarea,
  .btn {
    min-height: 44px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    display: grid;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
  }

  td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: right;
    overflow-wrap: anywhere;
  }

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

  td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--muted);
    text-align: left;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  td[colspan] {
    display: block;
    text-align: left;
  }

  td[colspan]::before {
    display: none;
  }

  .money {
    text-align: right;
  }

  .icon-btn {
    margin-left: auto;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    width: 100%;
    max-height: 90dvh;
    padding: 14px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #fff !important;
    color: #111;
    font-size: 11px;
  }

  body::before,
  .auth-gate,
  .sidebar,
  .topbar,
  .hero,
  .stats-grid,
  .account-actions,
  .entry-form,
  .toast,
  .compact-list,
  .empty-state,
  .modal,
  .module:not(#module-contas) {
    display: none !important;
  }

  .print-only {
    display: flex !important;
  }

  .app,
  .main-shell,
  .module.active,
  .account-layout,
  .account-panel,
  .account-view {
    display: block;
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
    background: #fff;
  }

  .panel {
    border: 0;
    box-shadow: none;
    padding: 0;
    background: #fff;
  }

  .print-sheet-header {
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #1f5130;
    margin-bottom: 14px;
  }

  .print-sheet-header div {
    display: grid;
    gap: 2px;
  }

  .print-sheet-header strong {
    color: #1f5130;
    font-family: "Sora", Arial, sans-serif;
    font-size: 20px;
  }

  .print-sheet-header span {
    color: #555;
    font-weight: 800;
  }

  .account-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48mm;
    gap: 10mm;
    align-items: stretch;
    padding: 0 0 8px;
    border-bottom: 1px solid #d8d8d8;
  }

  .account-header .eyebrow {
    color: #1f5130;
    font-size: 9px;
  }

  .account-header h2 {
    margin-top: 2px;
    font-size: 24px;
    line-height: 1.1;
  }

  .account-header .muted {
    margin-top: 5px;
    color: #555;
    font-size: 10px;
  }

  .balance-box {
    align-content: center;
    border: 1px solid #1f5130;
    border-radius: 0;
    background: #f4f8f1 !important;
    padding: 10px;
  }

  .balance-box span {
    color: #333;
    font-size: 10px;
  }

  .balance-box strong {
    color: #111 !important;
    font-size: 19px;
  }

  .print-client-details {
    display: grid !important;
    grid-template-columns: 34mm 45mm minmax(0, 1fr);
    gap: 7px;
    margin: 10px 0 14px;
  }

  .print-client-details div {
    display: grid;
    gap: 2px;
    min-height: 34px;
    border: 1px solid #d8d8d8;
    padding: 6px 8px;
  }

  .print-client-details span {
    color: #666;
    font-size: 8.5px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .print-client-details strong {
    color: #111;
    font-size: 10.5px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table {
    min-width: 0;
    border-collapse: collapse;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  th,
  td {
    border: 1px solid #d7d7d7;
    padding: 6px 7px;
    font-size: 9.5px;
    line-height: 1.25;
  }

  th {
    background: #eef5ea !important;
    color: #1f5130;
    font-size: 8px;
  }

  td:nth-child(7),
  th:nth-child(7),
  td:nth-child(9),
  th:nth-child(9) {
    display: none;
  }

  .tag,
  .status-pill {
    min-height: 0;
    border: 1px solid #cfcfcf;
    border-radius: 0;
    background: transparent !important;
    color: #111 !important;
    padding: 2px 5px;
    font-size: 8.5px;
  }

  .money {
    white-space: nowrap;
  }
}
