:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --ink: #172027;
  --muted: #66737f;
  --line: #dce3e8;
  --green: #14805e;
  --blue: #2563a8;
  --red: #bc3a3a;
  --yellow: #aa7600;
  --teal: #167c83;
  --shadow: 0 18px 40px rgba(23, 32, 39, 0.08);
  --logo-sidebar-width: 239px;
  --logo-sidebar-height: 56px;
  --logo-login-width: 239px;
  --logo-login-height: 56px;
  --logo-receipt-width: 239px;
  --logo-receipt-height: 56px;
}

* { box-sizing: border-box; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.public-page, .login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(20,128,94,.12), transparent 35%),
    linear-gradient(320deg, rgba(37,99,168,.1), transparent 40%),
    var(--bg);
}

.public-shell, .login-card, .install-card {
  width: min(100%, 760px);
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.public-hero, .login-card, .install-card { padding: 30px; }
.login-card { max-width: 440px; }
.install-card { max-width: 820px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: 30px; }
h2 { margin-bottom: 5px; font-size: 19px; }
h3 { margin-bottom: 8px; }
p { color: var(--muted); }

.public-actions, .topbar, .panel-header, .client-hero, .client-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.public-actions { justify-content: flex-start; margin-top: 22px; flex-wrap: wrap; }

.admin-tabs {
  position: sticky;
  top: 0;
  z-index: 1;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 8px 22px rgba(23,32,39,.06);
}

.admin-tabs-toggle,
.mobile-menu-button {
  display: none;
}

.mobile-logout,
.client-mobile-logout,
.sidebar-logout,
.drawer-title,
.drawer-backdrop {
  display: none;
}

.mobile-admin-nav {
  width: 100%;
  display: grid;
  gap: 6px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.mobile-admin-nav a {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  padding: 0 12px;
  color: #d8e5eb;
  font-size: 14px;
  font-weight: 750;
}

.mobile-admin-nav a span:first-of-type,
.admin-tabs a span:first-of-type {
  min-width: 0;
}

.nav-badge {
  min-width: 20px;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border-radius: 999px;
  padding: 0 6px;
  color: #fff;
  background: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.mobile-admin-nav a.active,
.mobile-admin-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.11);
}

.sidebar-logout {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  background: rgba(255,255,255,.08);
  font-weight: 800;
}

.sidebar-logout:hover {
  background: rgba(255,255,255,.13);
}

.admin-tabs a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 750;
}

.nav-icon {
  width: 17px;
  height: 17px;
  display: inline-block;
  flex: 0 0 17px;
  object-fit: contain;
  opacity: .78;
}

.admin-tabs .nav-icon {
  filter: none;
}

.admin-tabs a.active .nav-icon,
.mobile-logout .nav-icon,
.client-mobile-logout .nav-icon,
.nav-item .nav-icon,
.mobile-admin-nav .nav-icon {
  filter: brightness(0) invert(1);
}

.admin-tabs a.active .nav-icon,
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon,
.mobile-admin-nav a.active .nav-icon,
.mobile-admin-nav a:hover .nav-icon {
  opacity: 1;
}

.admin-tabs a:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.admin-tabs a.active {
  color: #fff;
  background: var(--green);
}

.primary-button, .ghost-button, .row-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0 16px;
  font-weight: 750;
}

.primary-button { border: 0; color: var(--button-primary-text); background: var(--green); }
.ghost-button, .row-action {
  color: var(--button-secondary-text);
  background: var(--button-secondary-bg);
  border-color: var(--button-secondary-border);
}
.link-action { margin-bottom: 8px; }
.full { width: 100%; }

.stack-form { display: grid; gap: 14px; }
.stack-form label, .login-card label { display: grid; gap: 6px; color: var(--ink); font-weight: 700; }
.login-card form { display: grid; gap: 14px; }
input, select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}
input[type="file"] { padding: 9px 12px; }
textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}

.receipt-review-form {
  min-width: 260px;
  display: grid;
  gap: 8px;
}

.review-note {
  margin-top: 6px;
  border-left: 3px solid var(--line);
  padding-left: 8px;
  color: var(--ink);
  font-size: 13px;
  white-space: normal;
}

.backup-actions {
  display: grid;
  gap: 12px;
}
.package-list { margin-top: 14px; }
.package-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.package-row p {
  margin-bottom: 0;
}
.package-row form {
  margin: 0;
}

.permission-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-strong);
}

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

.permission-check {
  min-width: 0;
  display: flex !important;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600 !important;
}

.permission-check input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
  flex: 0 0 18px;
}

.permission-check span {
  min-width: 0;
}

.moderator-row {
  align-items: flex-start;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.color-settings-form {
  gap: 12px;
}

.color-settings-form .permission-box {
  gap: 8px;
  padding: 12px;
}

.color-settings-form .permission-box > strong {
  font-size: 14px;
}

.color-settings-form .permission-box > p {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.35;
}

.color-token-grid,
.color-settings-form .form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 10px;
  align-items: start;
}

.color-settings-form label {
  min-width: 0;
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
}

.color-settings-form .permission-box > label {
  width: 110px;
  justify-self: start;
}

.color-settings-form input[type="color"] {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  padding: 3px;
  border-radius: 8px;
  overflow: hidden;
}

.alert {
  margin: 0 0 16px;
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid transparent;
}
.alert.success { color: #0c694b; background: #def8ed; border-color: #b8ead7; }
.alert.danger { color: #9b2727; background: #ffe5e5; border-color: #ffc7c7; }

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: #162129;
  color: #f7fbfd;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-has-logo {
  width: 100%;
  justify-content: center;
}
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1aa178, #2d77bc);
  font-weight: 800;
}
.brand-logo {
  width: min(100%, var(--logo-sidebar-width));
  height: var(--logo-sidebar-height);
  display: block;
  object-fit: contain;
  object-position: center center;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  flex: 0 1 auto;
}
.brand span { display: block; margin-top: 2px; color: #aab8c2; font-size: 13px; }

.sidebar-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.login-logo {
  width: min(100%, var(--logo-login-width));
  height: var(--logo-login-height);
  display: block;
  object-fit: contain;
  object-position: center center;
  margin: 0 auto 18px;
}

.login-brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #1aa178, #2d77bc);
  font-weight: 800;
}

.main-nav { display: grid; gap: 8px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: #d8e5eb;
}
.nav-item.active, .nav-item:hover { color: #fff; background: rgba(255,255,255,.11); }

.sidebar-card {
  margin-top: auto;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  padding: 16px;
  color: #dce8ed;
}
.sidebar-card strong { display: block; color: #fff; margin-top: 6px; }
.version-card {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  padding: 14px;
  color: #dce8ed;
}
.version-card span,
.version-card small {
  display: block;
  color: #aab8c2;
  font-size: 12px;
}
.version-card strong {
  display: block;
  margin: 5px 0;
  color: #fff;
  font-size: 18px;
}
.status-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: #2fd097;
}

.workspace { padding: 28px; overflow-x: hidden; }
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.app-footer span,
.app-footer small {
  display: block;
  font-size: 12px;
}
.app-footer strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0 16px;
}

.metric-card, .panel, .payment-panel, .client-hero {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric-card { padding: 18px; border-top: 4px solid transparent; }
.metric-card span, .metric-card small, .muted { color: var(--muted); }
.metric-card strong { display: block; margin: 8px 0 7px; font-size: 28px; }
.accent-green { border-top-color: var(--green); }
.accent-blue { border-top-color: var(--blue); }
.accent-red { border-top-color: var(--red); }
.accent-yellow { border-top-color: var(--yellow); }

.dashboard-panel {
  grid-column: span 2;
}

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

.bar-chart {
  min-height: 250px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.bar-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  text-align: center;
}

.bar-value {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bar-track {
  height: 170px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface-strong);
  overflow: hidden;
}

.bar-track span {
  width: 100%;
  min-height: 8px;
  display: block;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--green), #0d6f54);
}

.bar-column strong {
  color: var(--ink);
  font-size: 12px;
}

.stat-bars {
  display: grid;
  gap: 13px;
}

.stat-bar-row {
  display: grid;
  gap: 7px;
}

.stat-bar-row > div:first-child,
.due-item,
.delinquency-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-bar-row span,
.due-item span,
.delinquency-grid span {
  color: var(--muted);
  font-size: 12px;
}

.stat-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}

.stat-track span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--blue);
}

.stat-track .status-paid,
.stat-track .package-fill { background: var(--green); }
.stat-track .status-late { background: var(--red); }
.stat-track .status-cancelled { background: #8d99a6; }

.internal-alerts-panel {
  border-top: 4px solid var(--blue);
}

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

.internal-alerts-grid a {
  min-width: 0;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-strong);
}

.internal-alerts-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.internal-alerts-grid strong {
  font-size: 24px;
}

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

.due-item {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.due-item:last-child {
  border-bottom: 0;
}

.due-item > div {
  display: grid;
  gap: 4px;
}

.due-item > div:last-child {
  text-align: right;
}

.delinquency-panel {
  border-top: 4px solid var(--red);
}

.delinquency-grid {
  align-items: stretch;
}

.delinquency-grid > div {
  flex: 1 1 0;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.delinquency-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

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

.settings-grid {
  display: block;
  margin-top: 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.metrics-grid.tab-panel.active {
  display: grid;
}

.admin-grid.tab-panel.active { display: block; }

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

.package-note {
  margin: 12px 0 0;
}
.edit-client-box {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.wide-panel { grid-row: span 3; }
.wide-panel + .wide-panel { margin-top: 16px; }
.panel, .payment-panel { padding: 20px; }
.panel-header { margin-bottom: 18px; }
.panel-header.compact { align-items: flex-start; }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1040px; border-collapse: collapse; }
.clients-table { min-width: 960px; }
th {
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  text-transform: uppercase;
}
td { border-top: 1px solid var(--line); padding: 14px 12px; vertical-align: middle; }
.empty-state {
  color: var(--muted);
  text-align: center;
}
.client-name { font-weight: 800; }
.client-site { color: var(--muted); font-size: 13px; }
.client-site,
.clients-table td,
.clients-table strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8) {
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}
.badge.paid,
.badge.approved { background: #def8ed; color: #0c694b; }
.badge.open,
.badge.due,
.badge.pending { background: #e6f0ff; color: #1e5796; }
.badge.late,
.badge.rejected { background: #ffe5e5; color: #9b2727; }

.action-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.action-group form {
  margin: 0;
}

.action-group-compact {
  flex-wrap: wrap;
}

.action-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.client-link {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.action-whatsapp {
  color: var(--button-whatsapp-text);
  background: var(--button-whatsapp-bg);
  border-color: var(--button-whatsapp-border);
}

.action-paid {
  color: var(--button-success-text);
  background: var(--button-success-bg);
}

.action-secondary {
  color: var(--button-info-text);
  background: var(--button-info-bg);
  border-color: var(--button-info-border);
}

.action-danger {
  color: var(--button-danger-text);
  background: var(--button-danger-bg);
  border-color: var(--button-danger-border);
}

.bulk-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.bulk-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.bulk-check input,
.invoice-check {
  width: 18px;
  min-height: 18px;
  height: 18px;
}


.timeline, .webhook-list, .history-list { display: grid; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 12px; }
.timeline-item > span {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--line);
}
.timeline-item.done > span { background: var(--green); }
.timeline-item.warning > span { background: var(--yellow); }
.timeline-item.danger > span { background: var(--red); }

.webhook-list > div, .history-list > div {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-strong);
}

.history-mobile-filters,
.history-list-mobile {
  display: none;
}

.history-mobile-filters {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.history-month-form {
  display: none;
  margin-bottom: 10px;
}

.history-month-form label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 700;
}

.history-month-badge {
  display: none;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.history-filter {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.history-filter.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.history-mobile-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

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

.history-mobile-item summary::-webkit-details-marker {
  display: none;
}

.history-mobile-head {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.history-mobile-head strong,
.history-mobile-head small {
  overflow-wrap: anywhere;
}

.history-mobile-toggle {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.history-mobile-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.history-mobile-body p {
  margin: 0;
}

.history-empty {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
}
.mini-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  font-weight: 900;
}
.mini-icon.success { background: #def8ed; color: #0c694b; }
.mini-icon.pending { background: #fff3cd; color: #805700; }

.client-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  margin-top: 16px;
}

.client-password-panel {
  grid-column: 2;
}
.client-hero {
  min-height: 210px;
  padding: 28px;
  color: #fff;
  background:
    linear-gradient(105deg, rgba(13,35,46,.96), rgba(21,102,108,.84)),
    radial-gradient(circle at 84% 22%, rgba(255,255,255,.24), transparent 25%),
    #16313d;
}
.client-hero h1, .client-hero p, .client-hero .eyebrow { color: #fff; }
.client-total {
  min-width: 230px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.1);
}
.client-total strong { display: block; margin: 8px 0; font-size: 22px; }
.client-total small { color: #d9f2f4; }

.invoice-summary {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-strong);
}
.invoice-summary strong { display: block; margin: 8px 0; font-size: 30px; }
.payment-box {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}
.qr-mock {
  width: 132px;
  height: 132px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.qr-mock span {
  border-radius: 4px;
  background:
    linear-gradient(90deg, #172027 45%, transparent 45% 55%, #172027 55%),
    linear-gradient(#172027 45%, transparent 45% 55%, #172027 55%);
}

.pix-qr {
  width: 148px;
  height: 148px;
  object-fit: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pix-reference {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #c9ddfb;
  border-radius: 8px;
  background: #e6f0ff;
  color: #1e5796;
}

.pix-reference span,
.pix-reference small {
  display: block;
  color: #1e5796;
}

.pix-reference strong {
  display: block;
  margin: 4px 0;
}
code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.copy-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.copy-box code {
  white-space: normal;
  word-break: break-all;
}
.settings-logo {
  max-width: 180px;
  max-height: 80px;
  object-fit: contain;
  display: block;
  margin-bottom: 14px;
}

.logo-size-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.receipt-page {
  display: grid;
  place-items: start center;
  padding: 28px;
  background: #eef2f4;
}

.receipt-card {
  width: min(100%, 760px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.receipt-logo {
  width: min(100%, var(--logo-receipt-width));
  height: var(--logo-receipt-height);
  object-fit: contain;
  object-position: center center;
}

.receipt-status {
  margin: 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: #def8ed;
  color: #0c694b;
}

.receipt-status strong {
  display: block;
  margin: 6px 0 3px;
  font-size: 28px;
}

.receipt-status p {
  margin-bottom: 0;
  color: #0c694b;
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.receipt-grid > div {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.receipt-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.receipt-grid strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.receipt-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.receipt-footer p {
  margin-bottom: 0;
}

.receipt-model-two {
  border-top: 8px solid var(--blue);
}

.receipt-model-two .receipt-header {
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.receipt-model-two .receipt-logo {
  margin: 0 auto;
}

.receipt-model-two .receipt-status {
  border: 1px solid #c9ddfb;
  background: #eef5ff;
  color: var(--ink);
  text-align: center;
}

.receipt-model-two .receipt-status p {
  color: var(--muted);
}

.receipt-model-two .receipt-status strong {
  color: var(--green);
}

.receipt-model-two .receipt-grid {
  grid-template-columns: 1fr;
}

.receipt-model-two .receipt-grid > div {
  background: #fff;
}

@media screen and (max-width: 1080px) {
  .metrics-grid, .admin-grid, .client-layout { grid-template-columns: 1fr 1fr; }
  .dashboard-panel {
    grid-column: 1 / -1;
  }
  .wide-panel, .client-hero { grid-column: 1 / -1; }
}

@media screen and (max-width: 720px) {
  body.drawer-open { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; }
  .workspace { padding: 18px; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
  }
  .brand {
    justify-content: flex-start;
    flex: 0 0 auto;
    width: 100%;
  }
  .brand-logo {
    width: min(62vw, var(--logo-sidebar-width));
    max-width: 100%;
    margin: 0;
  }
  .mobile-menu-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    padding: 0 13px;
    color: #fff;
    background: rgba(255,255,255,.1);
    cursor: pointer;
    font-weight: 800;
  }
  .sidebar-menu {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 41;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: min(78vw, 300px);
    height: 100vh;
    padding: 16px 14px;
    border-top: 0;
    background: #162129;
    box-shadow: 18px 0 40px rgba(0,0,0,.25);
    transform: translateX(-105%);
    transition: transform .2s ease;
    overflow-y: auto;
  }
  .sidebar-menu.open {
    display: flex;
    transform: translateX(0);
  }
  .drawer-open .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    background: rgba(10, 18, 24, .5);
  }
  .drawer-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,.14);
    color: #fff;
    font-weight: 850;
  }
  .drawer-title > span {
    min-width: 0;
    font-size: 15px;
    white-space: nowrap;
  }
  .main-nav {
    display: none;
    grid-template-columns: 1fr;
    width: 100%;
  }
  .nav-item {
    justify-content: center;
    text-align: center;
  }
  .mobile-admin-nav {
    width: 100%;
    display: grid;
    gap: 4px;
    padding-top: 2px;
    border-top: 0;
  }
  .mobile-admin-nav a {
    width: 100%;
    min-height: 39px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    padding: 0 14px;
    color: #d8e5eb;
    font-size: 15px;
    font-weight: 750;
    text-align: left;
  }
  .mobile-admin-nav a.active,
  .mobile-admin-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,.11);
  }
  .mobile-logout {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 0;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 8px;
    padding: 0 10px;
    color: #fff;
    background: rgba(255,255,255,.08);
    font-size: 13px;
    font-weight: 800;
  }
  .sidebar-logout {
    display: none;
  }
  .logout-icon {
    position: relative;
    width: 16px;
    height: 16px;
    display: inline-block;
    flex: 0 0 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
  }
  .logout-icon::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -4px;
    width: 2px;
    height: 9px;
    border-radius: 2px;
    background: currentColor;
    transform: translateX(-50%);
  }
  .mobile-logout:hover {
    background: rgba(255,255,255,.13);
  }
  .client-mobile-logout {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 8px;
    padding: 0 12px;
    color: #fff;
    background: rgba(255,255,255,.1);
    font-size: 13px;
    font-weight: 800;
  }
  .client-sidebar .sidebar-menu {
    gap: 14px;
  }
  .client-sidebar .main-nav {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 6px;
  }
  .client-sidebar .nav-item {
    justify-content: flex-start;
    text-align: left;
  }
  .client-layout[data-client-layout] .history-panel,
  .client-layout[data-client-layout] .client-password-panel {
    display: none;
  }
  .client-layout[data-client-layout].show-history .history-panel,
  .client-layout[data-client-layout].show-password .client-password-panel {
    display: block;
  }
  .topbar, .panel-header, .client-hero, .payment-box { align-items: stretch; flex-direction: column; }
  .login-logo { width: min(78vw, var(--logo-login-width)); }
  .receipt-logo { width: min(76vw, var(--logo-receipt-width)); }
  .form-grid, .admin-grid, .client-layout, .text-settings-grid { grid-template-columns: 1fr; }
  .internal-alerts-grid { grid-template-columns: 1fr; }
  .permission-grid { grid-template-columns: 1fr; }
  .color-token-grid,
  .color-settings-form .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .color-settings-form .permission-box > label {
    width: 100%;
  }
  .history-list-desktop {
    display: none;
  }
  .history-mobile-filters,
  .history-list-mobile,
  .history-month-form,
  .history-month-badge {
    display: grid;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
  }
  .dashboard-panel {
    grid-column: 1 / -1;
  }
  .bar-chart {
    min-height: 210px;
    gap: 8px;
  }
  .bar-track {
    height: 130px;
  }
  .bar-value,
  .bar-column strong {
    font-size: 10px;
  }
  .due-item,
  .delinquency-grid {
    align-items: stretch;
    flex-direction: column;
  }
  .due-item > div:last-child {
    text-align: left;
  }
  .metric-card {
    padding: 13px;
  }
  .metric-card strong {
    font-size: 24px;
  }
  .metric-card span,
  .metric-card small {
    font-size: 12px;
  }
  .copy-box { grid-template-columns: 1fr; }
  .bulk-bar { align-items: stretch; flex-direction: column; }
  .package-row {
    align-items: stretch;
    flex-direction: column;
  }
  .package-row .action-button {
    width: 100%;
  }
  .admin-tabs { display: none; }
  .admin-tabs-toggle { display: none !important; }
  .action-group {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: stretch;
    gap: 6px;
    overflow: visible;
    padding-bottom: 0;
  }
  .action-group > a,
  .action-group > form {
    flex: 1 1 0;
    min-width: 0;
  }
  .action-group form { margin: 0; }
  .action-button {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 0 8px;
    font-size: 11px;
    line-height: 1.1;
    text-align: center;
    white-space: normal;
  }
  .table-wrap { overflow-x: visible; }
  table { min-width: 0; }
  .clients-table {
    min-width: 0;
    table-layout: fixed;
  }
  thead { display: none; }
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    max-width: 100%;
  }
  tr {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    overflow: hidden;
  }
  td {
    min-height: 0;
    border-top: 0;
    padding: 8px 0;
    white-space: normal !important;
    overflow: hidden;
  }
  td[data-label]:not([data-label=""]) {
    display: grid;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-width: 0;
  }
  td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }
  td[data-label="Acao"] {
    display: block;
    width: 100%;
    min-width: 0;
    grid-template-columns: none !important;
    padding-top: 12px;
  }
  td[data-label="Acao"]::before { display: none; }
  td:first-child {
    padding-bottom: 0;
  }
  .clients-table td[data-label]:not([data-label=""]) {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .clients-table td[data-label="Cliente"] {
    display: block;
    padding-bottom: 10px;
  }
  .clients-table td[data-label="Cliente"]::before {
    display: none;
  }
  .clients-table td[data-label="Cliente"] strong {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
  }
  .clients-table td {
    padding: 6px 0;
  }
  .clients-table td > * {
    min-width: 0;
    max-width: 100%;
  }
  .clients-table .action-button {
    width: 100%;
  }
  .clients-table .action-group {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .clients-table .action-group > a,
  .clients-table .action-group > form {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
  .clients-table .client-site,
  .clients-table strong {
    display: block;
    max-width: 100%;
  }
  td.empty-state {
    display: block;
    padding: 16px 0;
    text-align: left;
  }
  .payment-box { display: flex; }
  .receipt-header, .receipt-footer { align-items: stretch; flex-direction: column; }
  .receipt-grid { grid-template-columns: 1fr; }
  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    margin-top: 20px;
  }
}

@media screen and (max-width: 380px) {
  .color-token-grid,
  .color-settings-form .form-grid {
    grid-template-columns: 1fr;
  }
  .action-group {
    flex-wrap: wrap;
  }
  .action-group > a,
  .action-group > form {
    flex-basis: calc(50% - 3px);
  }
}

@media print {
  @page {
    size: A4;
    margin: 4mm;
  }
  html,
  body {
    width: auto;
    min-height: 0;
    margin: 0;
    background: #fff;
    font-size: 12px;
  }
  .receipt-page {
    display: block;
    min-height: 0 !important;
    height: auto !important;
    padding: 0;
    background: #fff;
    overflow: visible;
  }
  .receipt-card {
    width: 100%;
    max-width: none;
    border: 0;
    box-shadow: none;
    padding: 0;
    page-break-after: avoid;
  }
  .receipt-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    flex-direction: row !important;
    gap: 10px;
    padding-bottom: 5px;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .receipt-logo {
    width: auto !important;
    max-width: 160px;
    max-height: 38px;
  }
  .receipt-header .eyebrow {
    margin-bottom: 2px;
    font-size: 10px;
  }
  .receipt-header h1 {
    margin-bottom: 1px;
    font-size: 20px;
    line-height: 1.1;
  }
  .receipt-header p {
    margin-bottom: 0;
  }
  .receipt-status {
    margin: 7px 0;
    padding: 8px;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .receipt-status .badge {
    min-height: 20px;
    padding: 0 8px;
    font-size: 11px;
  }
  .receipt-status strong {
    margin: 4px 0 1px;
    font-size: 25px;
    line-height: 1.1;
  }
  .receipt-status p {
    font-size: 12px;
  }
  .receipt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 5px;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .receipt-grid > div {
    min-height: 0;
    padding: 6px 8px;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .receipt-grid span {
    font-size: 9px;
    line-height: 1.15;
  }
  .receipt-grid strong {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.2;
  }
  .receipt-footer {
    display: flex !important;
    flex-direction: row !important;
    margin-top: 7px;
    padding-top: 6px;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .receipt-footer p {
    font-size: 11px;
    line-height: 1.25;
  }
  .receipt-model-two .receipt-header {
    align-items: center;
    flex-direction: column !important;
    justify-content: center;
    text-align: center;
  }
  .receipt-model-two .receipt-grid {
    grid-template-columns: 1fr !important;
  }
  .receipt-model-two .receipt-grid > div {
    padding: 5px 8px;
  }
  .receipt-footer button { display: none; }
  .receipt-card::after,
  .receipt-page::after {
    display: none !important;
    content: none !important;
  }
}
