:root {
  --bg: #0f0f14;
  --surface: #1a1a24;
  --border: #2e2e42;
  --text: #f2f2f8;
  --muted: #9a9ab0;
  --accent: #e91e8c;
  --accent-dim: #b8156f;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 10px;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }

.view { min-height: 100vh; }
.hidden { display: none !important; }

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(233, 30, 140, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(233, 30, 140, 0.08), transparent),
    var(--bg);
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-card {
  padding: 2rem 2rem 1.5rem;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo-img {
  display: block;
  max-width: 220px;
  width: 100%;
  height: auto;
  margin: 0 auto 1rem;
}

.brand-logo {
  display: block;
  max-width: 160px;
  width: 100%;
  height: auto;
  margin-bottom: 0.75rem;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.login-logo-pink { color: var(--text); }
.login-logo-pay {
  background: var(--accent);
  color: #fff;
  padding: 0.1rem 0.55rem;
  border-radius: 8px;
  margin-left: 0.15rem;
}

.login-header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.login-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.login-form .field {
  margin-bottom: 1rem;
}

.login-form label {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.login-form input {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 30, 140, 0.2);
}

.field-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.login-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  background: rgba(239, 68, 68, 0.12);
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.login-submit {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  margin-top: 0.25rem;
}

.login-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(233, 30, 140, 0.35); }
.login-submit:active { transform: translateY(0); }

.login-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.login-footer code {
  background: #252535;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

.dev-credits {
  margin: 0;
  width: 100%;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.dev-credits-company {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
  text-align: center;
}

.dev-credits-powered {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 400;
  line-height: 1.3;
  opacity: 0.85;
  text-align: center;
}

.dev-credits a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.dev-credits a:hover {
  text-decoration: underline;
}

/* Indicador de ligação à base de dados */
.db-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #252535;
  white-space: nowrap;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.db-status-label {
  font-weight: 600;
  letter-spacing: 0.02em;
}
.db-status-icon {
  display: block;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.db-status--ok .db-status-icon {
  color: #34d399;
  filter: drop-shadow(0 0 4px rgba(52, 211, 153, 0.65));
}
.db-status--err .db-status-icon {
  color: #f87171;
}
.db-status--ok {
  color: #6ee7b7 !important;
  border-color: rgba(52, 211, 153, 0.55) !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(52, 211, 153, 0.12) 100%) !important;
  box-shadow:
    0 0 0 1px rgba(52, 211, 153, 0.12),
    0 0 20px rgba(52, 211, 153, 0.28) !important;
}
.db-status--ok .db-status-label {
  color: #6ee7b7 !important;
}
.db-status--err {
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.55) !important;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, rgba(248, 113, 113, 0.1) 100%) !important;
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.12),
    0 0 16px rgba(248, 113, 113, 0.22) !important;
}
.db-status--err .db-status-label {
  color: #fca5a5 !important;
}
.db-status--pending {
  color: #94a3b8;
  border-color: var(--border);
  background: #252535;
  box-shadow: none;
}
.db-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.db-status--pending .db-status-dot {
  animation: db-status-pulse 1.25s ease-in-out infinite;
}
@keyframes db-status-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}

.login-status-host,
.topbar-db,
.sidebar-server-status {
  color: inherit;
}

.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--danger); font-size: 0.9rem; }

label { display: block; margin: 0.75rem 0 0.25rem; font-size: 0.85rem; color: var(--muted); }
input, select, button {
  font: inherit; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); padding: 0.55rem 0.75rem;
}
input, select { width: 100%; }
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 2.75rem; }
.password-toggle {
  position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0;
  background: none; border: none; color: var(--muted); border-radius: 4px;
}
.password-toggle:hover { color: var(--text); background: #252535; }
.password-toggle svg { display: block; }
button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-dim); }
button.link { background: none; border: none; color: var(--muted); padding: 0; }
button.nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.6rem 0.75rem;
  color: var(--muted);
  border-radius: 8px;
}
button.nav:hover, button.nav.active { background: #252535; color: var(--text); }
button.nav.active .nav-icon { color: var(--accent); }
.nav-icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.nav-icon svg { width: 1.25rem; height: 1.25rem; display: block; }
.nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

#app-view {
  display: grid;
  grid-template-columns: var(--sidebar-width, 240px) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}
#app-view.sidebar-collapsed {
  --sidebar-width: 68px;
  --sb-icon: 1.25rem;
  --sb-icon-box: 1.35rem;
  --sb-row-py: 0.65rem;
  --sb-row-px: 0.35rem;
}
.app-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  background: #252535;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.topbar-toggle:hover { border-color: var(--accent); color: var(--accent); }
.topbar-heading { flex: 1; min-width: 0; }
.topbar-heading h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
}
.topbar-subtitle { margin: 0.15rem 0 0; font-size: 0.82rem; }
.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.topbar-db {
  display: inline-flex;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  color: inherit;
  white-space: nowrap;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.55);
}
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1rem 0.85rem; display: flex; flex-direction: column; min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  transition: padding 0.22s ease, transform 0.22s ease;
}
#app-view.sidebar-collapsed .sidebar {
  padding: 0.75rem 0.4rem;
  align-items: stretch;
}
.sidebar-brand {
  flex-shrink: 0;
  margin-bottom: 1rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-logo-full {
  display: block;
  max-width: 100%;
  height: auto;
}
.brand-mark {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: rgba(236, 72, 153, 0.12);
  color: var(--accent);
}
#app-view.sidebar-collapsed .brand-logo-full { display: none; }
#app-view.sidebar-collapsed .nav-label,
#app-view.sidebar-collapsed .user-info,
#app-view.sidebar-collapsed .logout-label { display: none; }
#app-view.sidebar-collapsed button.nav {
  justify-content: center;
  padding: 0.65rem 0.35rem;
}
#app-view.sidebar-collapsed .sidebar-foot { align-items: stretch; }
#app-view.sidebar-collapsed .nav-divider { margin: 0.35rem 0.15rem; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--accent); margin-bottom: 0.25rem; }
.db-badge {
  font-size: 0.75rem; background: #252535; padding: 0.35rem 0.5rem;
  border-radius: 4px; color: var(--ok); margin-bottom: 1rem;
}
.sidebar nav { flex: 1; }
.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.app-version {
  margin: 0;
  text-align: center;
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
#app-view.sidebar-collapsed .sidebar-version {
  font-size: 0.6rem;
  padding: 0 0.15rem;
}
.sidebar-server-status {
  margin: 0;
  padding: 0 0.15rem;
  display: flex;
  justify-content: center;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.5rem;
  background: #252535;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  color: var(--text);
}
.user-card:hover { border-color: var(--accent); background: #2a2a3a; }
.user-avatar-slot {
  width: auto;
  height: auto;
}
.user-avatar-slot .user-avatar {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.95rem;
}
.user-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.user-info { min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-tenant {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-plan {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-link { font-size: 0.8rem; padding: 0.25rem 0.5rem; align-self: flex-start; }
.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-logout:hover {
  color: #fca5a5;
  border-color: #7f1d1d;
  background: #450a0a;
}
.btn-logout .nav-icon svg { flex-shrink: 0; opacity: 0.85; }

/* Sidebar colapsado: mesma métrica de ícone em nav, logo, BD, perfil e logout */
#app-view.sidebar-collapsed .brand-mark {
  display: flex;
  width: 100%;
  height: auto;
  padding: var(--sb-row-py) var(--sb-row-px);
  border-radius: 8px;
  background: none !important;
}
#app-view.sidebar-collapsed .brand-mark svg {
  width: var(--sb-icon);
  height: var(--sb-icon);
}
#app-view.sidebar-collapsed button.nav,
#app-view.sidebar-collapsed .user-card,
#app-view.sidebar-collapsed .btn-logout,
#app-view.sidebar-collapsed .sidebar-server-status .db-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--sb-row-py) var(--sb-row-px) !important;
  gap: 0 !important;
  min-height: 0;
  border: none !important;
  background: none !important;
  box-shadow: none !important;
  border-radius: 8px;
}
#app-view.sidebar-collapsed button.nav:hover,
#app-view.sidebar-collapsed .user-card:hover {
  background: #252535 !important;
  border: none !important;
}
#app-view.sidebar-collapsed .btn-logout:hover {
  background: #450a0a !important;
  border: none !important;
  color: #fca5a5;
}
#app-view.sidebar-collapsed .sidebar-server-status {
  display: flex !important;
  justify-content: center;
  width: 100%;
  padding: 0;
  margin: 0;
}
#app-view.sidebar-collapsed .sidebar-server-status .db-status-label {
  display: none !important;
}
#app-view.sidebar-collapsed .nav-icon,
#app-view.sidebar-collapsed .user-avatar-slot {
  width: var(--sb-icon-box);
  height: var(--sb-icon-box);
}
#app-view.sidebar-collapsed .nav-icon svg,
#app-view.sidebar-collapsed .sidebar-server-status .db-status-icon {
  width: var(--sb-icon);
  height: var(--sb-icon);
}
#app-view.sidebar-collapsed .user-avatar-slot .user-avatar {
  width: var(--sb-icon);
  height: var(--sb-icon);
  font-size: 0.55rem;
  line-height: 1;
}
#app-view.sidebar-collapsed .sidebar-server-status .db-status-icon {
  color: #34d399 !important;
  filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.75));
}

.content { padding: 1.25rem 1.75rem 2rem; overflow: auto; flex: 1; }
.panel-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.panel-head h2 { margin: 0; flex: 1; }
.panel-head-split { justify-content: space-between; align-items: flex-start; gap: 1rem; }
.panel-head-title { flex: 1; min-width: 0; }
.panel-head-title h2 { flex: unset; }
.btn-money-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-money-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(236, 72, 153, 0.06);
}
.btn-money-toggle[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(236, 72, 153, 0.45);
}
.btn-money-toggle .icon-eye-off.hidden,
.btn-money-toggle .icon-eye.hidden { display: none; }
.panel-head-compact { margin-bottom: 0; }
.panel-head-compact h2,
.redemption-page > .panel-head h2,
.company-page > .panel-head h2,
.dashboard-page > .panel-head h2 { display: none; }

.dashboard-page {
  width: 100%;
  max-width: none;
}
.dashboard-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem 1rem;
  width: 100%;
  margin-bottom: 1.25rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-sizing: border-box;
  overflow-x: auto;
}
.dashboard-period-label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.dashboard-toolbar .filter-bar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem 0.65rem;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.dashboard-toolbar .filter-bar label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
  font-size: 0.75rem;
}
.dashboard-toolbar .filter-bar input {
  min-width: 9rem;
  width: 9rem;
  padding: 0.45rem 0.5rem;
}
.dashboard-toolbar .filter-bar button {
  flex-shrink: 0;
  white-space: nowrap;
}
.dashboard-kpi {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
  width: 100%;
}
@media (max-width: 1200px) {
  .dashboard-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .dashboard-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  min-height: 5.5rem;
  min-width: 0;
  box-sizing: border-box;
}
.kpi-icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(236, 72, 153, 0.1);
  color: var(--accent);
}
.kpi-icon svg { width: 1.25rem; height: 1.25rem; display: block; }
.kpi-icon.blue { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.kpi-icon.green { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.kpi-icon.amber { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.kpi-body { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.kpi-body strong {
  font-size: 1.35rem;
  line-height: 1.15;
  color: var(--text);
  font-weight: 700;
}
.kpi-body strong.accent { color: var(--accent); }
.kpi-body > span { font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.kpi-body small { font-size: 0.72rem; margin-top: 0.1rem; }

.profile-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  max-width: 900px;
}
.profile-form h3 { margin: 0 0 1rem; font-size: 1rem; color: var(--muted); }
.profile-form input[readonly] { opacity: 0.75; cursor: default; }
.profile-msg { margin: 0.75rem 0 0; font-size: 0.9rem; padding: 0.55rem 0.75rem; border-radius: 6px; }
.profile-msg.ok { background: #14532d; color: #86efac; }
.profile-msg.err { background: #450a0a; color: #fca5a5; }
.panel-flash { margin: 0 0 1rem; font-size: 0.9rem; padding: 0.65rem 0.85rem; border-radius: 8px; border: 1px solid transparent; }
.panel-flash.ok { background: #14532d; color: #86efac; border-color: #166534; }
.panel-flash.err { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
.panel-head-sub { margin: 0.25rem 0 0; font-size: 0.9rem; }
.platform-mgmt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.platform-mgmt-page .dashboard-kpi { margin-bottom: 1rem; }
.dashboard-kpi-platform {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 1400px) {
  .dashboard-kpi-platform { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .dashboard-kpi-platform { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .dashboard-kpi-platform { grid-template-columns: 1fr; }
  .btn-money-toggle-label { display: none; }
}
.chart-canvas-wrap-compact { height: 220px; }
@media (max-width: 1100px) {
  .platform-mgmt-grid { grid-template-columns: 1fr; }
}
.profile-form button[type="submit"] { margin-top: 1rem; }

.event-select { max-width: 280px; flex: 1; min-width: 160px; }
.panel-hint { margin: -0.5rem 0 1rem; font-size: 0.85rem; }
.badge.ingresso { background: #1e3a5f; color: #93c5fd; }
.badge.produto { background: #4a1942; color: #f9a8d4; }
.badge.tempo { background: #134e4a; color: #5eead4; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.card strong { display: block; font-size: 1.5rem; color: var(--accent); }
.card span { color: var(--muted); font-size: 0.85rem; }

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.65rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #252535; color: var(--muted); font-weight: 600; }
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
  font-size: 0.75rem;
}
.badge.approved, .badge.published, .badge.open, .badge.active, .badge.owner { background: #14532d; color: #86efac; }
.badge.pending, .badge.draft { background: #422006; color: #fcd34d; }
.badge.blocked, .badge.inactive, .badge.cancelled, .badge.closed { background: #450a0a; color: #fca5a5; }
.badge.valid { background: #14532d; color: #86efac; }
.badge.redeemed { background: #1e3a5f; color: #93c5fd; }
.badge.operator { background: #1e3a5f; color: #93c5fd; }
.badge.connection.online { background: #14532d; color: #86efac; }
.badge.connection.offline { background: #3f3f46; color: #a1a1aa; }

.redemption-layout {
  display: grid; grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr); gap: 1rem; margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .redemption-layout { grid-template-columns: 1fr; } }

.redemption-page { max-width: 1200px; }
.redemption-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.1rem 1.25rem;
}
.redemption-hero-icon {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(236, 72, 153, 0.12);
  color: var(--accent);
}
.redemption-hero-lead {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 1rem;
}
.redemption-hero-text p:last-child { margin: 0; }
.redemption-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
@media (max-width: 640px) { .redemption-filters { grid-template-columns: 1fr; } }
.redemption-code-field { margin-bottom: 0.5rem; }
.redemption-code-field .scan-input {
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  font-family: ui-monospace, monospace;
}
.redemption-strict { margin: 0.5rem 0 0.75rem; }
.card-panel-title {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.redemption-result-empty .redemption-result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 220px;
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
}
.redemption-result-empty .redemption-result-placeholder svg { opacity: 0.35; }
.redemption-result-empty .redemption-result-placeholder p { margin: 0; max-width: 16rem; font-size: 0.9rem; }
.redemption-result:not(.redemption-result-empty) .redemption-result-placeholder { display: none; }
.redemption-recent-section { margin-top: 0.5rem; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.section-head .section-title { margin: 0; }
.section-hint { margin: 0; font-size: 0.82rem; }
.redemption-recent-table .empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state-card {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  max-width: 640px;
  text-align: center;
}
.empty-state-card .empty-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1rem;
  border-radius: 999px;
  background: rgba(236, 72, 153, 0.12);
  color: var(--accent, #ec4899);
}
.empty-state-card .empty-state-icon svg {
  width: 1.65rem;
  height: 1.65rem;
}
.empty-state-card .empty-state-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}
.empty-state-card .empty-state-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.empty-state-steps {
  margin: 0 0 1.35rem;
  padding-left: 1.2rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}
.empty-state-steps li + li { margin-top: 0.35rem; }
.empty-state-steps code {
  font-size: 0.82rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}

#terminals-list:has(.terminals-empty-wrap) {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: min(52vh, 420px);
  border: none;
  background: transparent;
  overflow: visible;
}
.empty-state-wrap.terminals-empty-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}
.empty-state-wrap.terminals-empty-wrap .empty-state-card {
  max-width: 520px;
  width: 100%;
  margin: 0;
}
.terminals-empty .empty-state-steps {
  margin-bottom: 0;
}
.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.company-page { width: 100%; max-width: none; }
.company-profile-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}
.company-card {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
}
.company-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.company-card-head h3 { margin: 0; font-size: 1.15rem; }
.company-card .muted { margin: 0.2rem 0 0; font-size: 0.85rem; }
.company-refund-reset-row { margin: 0.65rem 0 0.25rem; }
.company-refund-form { margin-top: 0.75rem; }
.profile-refund-hint { margin: 0.5rem 0 0; font-size: 0.82rem; line-height: 1.45; }
.company-plan-line { margin: 0 0 0.35rem; font-size: 0.95rem; }
.company-features-line { margin: 0 0 0.75rem !important; font-size: 0.82rem !important; }
.company-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-top: 0.75rem;
}
@media (max-width: 480px) { .company-stat-grid { grid-template-columns: 1fr; } }
.company-stat {
  background: #252535;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}
.company-stat strong {
  display: block;
  font-size: 1.35rem;
  color: var(--accent);
  line-height: 1.2;
}
.company-stat span { font-size: 0.75rem; color: var(--muted); }
.company-detail-list { margin: 0; padding: 0; list-style: none; }
.company-detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.company-detail-list li:last-child { border-bottom: none; }
.company-detail-list dt { color: var(--muted); margin: 0; flex-shrink: 0; }
.company-detail-list dd { margin: 0; text-align: right; word-break: break-word; }
.company-contract-hint { margin: 0 0 0.75rem; font-size: 0.82rem; }
.company-contract-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.company-contract-iframe {
  width: 100%;
  min-height: min(72vh, 720px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1a1a24;
}
.company-card .card-panel-title {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.card-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}
.scan-input {
  font-family: ui-monospace, monospace; font-size: 1.15rem;
  letter-spacing: 0.04em; padding: 0.75rem !important;
}
.event-pos-option {
  margin-top: 1rem;
}
.event-pos-option .feature-check {
  width: 100%;
}
.event-pos-option.hidden {
  display: none;
}

dialog.dialog-event {
  max-width: 560px;
  max-height: min(92dvh, 920px);
}

dialog.dialog-ticket {
  max-width: 560px;
}

dialog.dialog-product {
  max-width: 620px;
}

dialog.dialog-subcategories {
  max-width: 640px;
}

dialog[open]:not(.dialog-scroll) {
  overflow: visible;
}

dialog.dialog-scroll {
  max-height: min(92dvh, 920px);
  overflow: hidden;
  margin: auto;
}

dialog.dialog-scroll form {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 920px);
  padding: 0;
  overflow: hidden;
}

dialog.dialog-scroll .dialog-head {
  flex-shrink: 0;
  padding: 1.5rem 1.5rem 0;
  margin-bottom: 0;
}

dialog.dialog-scroll .dialog-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  overscroll-behavior: contain;
}

dialog.dialog-scroll menu {
  flex-shrink: 0;
  margin-top: 0;
  padding: 1rem 1.5rem 1.5rem;
  background: var(--surface);
}

.form-field-label {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.subcategory-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.15rem 0 0;
}

.subcategory-chip {
  position: relative;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.subcategory-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.subcategory-chip span {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.subcategory-chip:hover span {
  border-color: #3d3d55;
  background: #14141c;
}

.subcategory-chip:has(input:checked) span {
  border-color: var(--accent);
  background: rgba(233, 30, 140, 0.12);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(233, 30, 140, 0.25);
}

.subcategory-chip:has(input:focus-visible) span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.subcategory-picker-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.ticket-active-check {
  width: 100%;
}

.ticket-catalog-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
}

.product-option-check {
  width: 100%;
}

.product-stock-wrap {
  margin-top: 0.75rem;
  max-width: 14rem;
}

.product-stock-wrap.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.product-image-field {
  margin-top: 0.85rem;
}

.product-catalog-hint {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
}

.subcategory-add-grid {
  display: grid;
  grid-template-columns: 1fr 6.5rem auto;
  gap: 0.75rem 1rem;
  align-items: start;
}

.subcategory-add-action .subcategory-add-btn {
  width: 100%;
  white-space: nowrap;
  padding: 0.55rem 1rem;
}

.subcategory-sort-field input {
  width: 100%;
}

.subcategory-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.subcategory-list-head .form-section-title {
  margin-bottom: 0;
}

#subcategories-count {
  font-size: 0.8rem;
  white-space: nowrap;
}

.subcategories-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}

.subcategories-table-wrap .subcategories-empty {
  margin: 0;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.88rem;
}

.admin-grid.subcategories-grid col.col-name { width: auto; }
.admin-grid.subcategories-grid col.col-sort { width: 5.5rem; }
.admin-grid.subcategories-grid col.col-status { width: 6.5rem; }
.admin-grid.subcategories-grid col.col-actions { width: 7.5rem; }

.subcategories-table-wrap .subcategory-edit-name,
.subcategories-table-wrap .subcategory-edit-sort {
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.88rem;
}

.subcategories-table-wrap .subcategory-edit-sort {
  max-width: 4.5rem;
  text-align: right;
}

@media (max-width: 560px) {
  .subcategory-add-grid {
    grid-template-columns: 1fr;
  }
  .subcategory-add-action .subcategory-add-btn {
    width: auto;
  }
}

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin: 0.75rem 0; font-size: 0.85rem; color: var(--muted); }
.checkbox-row input { width: auto; }
.redemption-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.redemption-msg { margin-top: 0.75rem; font-size: 0.9rem; padding: 0.65rem 0.85rem; border-radius: 6px; }
.redemption-msg.ok { background: #14532d; color: #86efac; }
.redemption-msg.err { background: #450a0a; color: #fca5a5; }
.redemption-msg.warn { background: #422006; color: #fcd34d; }
.redemption-result h3 { margin: 0 0 0.75rem; color: var(--accent); }
.redemption-result dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0; font-size: 0.9rem; }
.redemption-result dt { color: var(--muted); }
.redemption-result .pickup-highlight { font-size: 1.25rem; font-weight: 700; color: var(--accent); margin: 0.5rem 0; }
.section-title { margin: 1.5rem 0 0.75rem; font-size: 1rem; color: var(--muted); }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); padding: 0; max-width: 420px; width: 90%;
}
dialog.dialog-wide { max-width: 720px; width: min(720px, 94vw); }
dialog form { padding: 1.5rem; }
.dialog-head { margin-bottom: 1.25rem; }
.dialog-head h3 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.dialog-sub { margin: 0; font-size: 0.85rem; }

.form-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1rem;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-field label {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}
dialog .form-field label { margin-top: 0; }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  margin: 0;
}
.form-field.span-2 { grid-column: span 2; }
.form-field.span-3 { grid-column: span 3; }
.form-field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.form-field-hint.form-field-error { color: #f87171; }
input.input-invalid,
select.input-invalid,
textarea.input-invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.35);
}
.feature-checks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}
.feature-check {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  padding: 0.85rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
}
.feature-check:hover {
  border-color: #3d3d55;
  background: #14141c;
}
.feature-check:has(input:checked) {
  border-color: var(--accent);
  background: rgba(233, 30, 140, 0.08);
  box-shadow: 0 0 0 1px rgba(233, 30, 140, 0.25);
}
.feature-check:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.feature-check input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.feature-check-box {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  pointer-events: none;
}
.feature-check:has(input:checked) .feature-check-box {
  border-color: var(--accent);
  background: var(--accent);
}
.feature-check:has(input:checked) .feature-check-box::after {
  content: '';
  position: absolute;
  left: 0.2rem;
  top: 0.02rem;
  width: 0.35rem;
  height: 0.6rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.feature-check-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  pointer-events: none;
}
.feature-check-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}
.feature-check-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.35;
}
.feature-check:has(input:checked) .feature-check-title {
  color: #fff;
}

.form-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
}
.form-checks label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.form-checks input { width: auto; }

@media (max-width: 640px) {
  .feature-checks { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .form-field.span-2, .form-field.span-3 { grid-column: span 1; }
}

dialog menu { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; padding: 0; border-top: 1px solid var(--border); padding-top: 1rem; }
dialog::backdrop { background: rgba(0,0,0,0.6); }

.actions {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
td .actions { width: 100%; }
table th:last-child,
table td:has(.actions) {
  text-align: right;
  white-space: nowrap;
}
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.38rem 0.72rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #252535;
  color: var(--muted);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-action svg {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
  opacity: 0.9;
}
.btn-action:hover {
  color: var(--text);
  background: #2e2e42;
  border-color: #454560;
}
.btn-action.btn-edit {
  border-color: rgba(233, 30, 140, 0.4);
  color: #f9a8d4;
  background: rgba(233, 30, 140, 0.1);
}
.btn-action.btn-edit:hover {
  border-color: var(--accent);
  background: rgba(233, 30, 140, 0.22);
  color: #fff;
  box-shadow: 0 2px 8px rgba(233, 30, 140, 0.25);
}
.btn-action.btn-success {
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
  background: rgba(34, 197, 94, 0.1);
}
.btn-action.btn-success:hover {
  border-color: var(--ok);
  background: rgba(34, 197, 94, 0.2);
  color: #dcfce7;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
}
.btn-action.btn-danger {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
}
.btn-action.btn-danger:hover {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.2);
  color: #fee2e2;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}
.btn-action.btn-unlink {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.1);
}
.btn-action.btn-unlink:hover {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}
.btn-action.btn-link {
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
  background: rgba(52, 211, 153, 0.1);
}
.btn-action.btn-link:hover {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.2);
  color: #a7f3d0;
  box-shadow: 0 2px 8px rgba(52, 211, 153, 0.2);
}
.btn-action.btn-neutral:hover {
  border-color: #5a5a72;
  color: var(--text);
}

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end;
}
.filter-bar label { margin: 0; font-size: 0.75rem; }
.filter-bar input, .filter-bar select { width: auto; min-width: 140px; }
.filter-bar button { padding: 0.5rem 0.85rem; }

.table-toolbar {
  margin-bottom: 0.75rem;
}
.table-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  width: 100%;
  max-width: 22rem;
}
.table-search .table-search-icon {
  position: absolute;
  left: 0.65rem;
  pointer-events: none;
  flex-shrink: 0;
  color: var(--muted);
}
.table-search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.table-search-input:focus {
  outline: none;
  border-color: var(--accent);
}
.table-search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.sub-tabs {
  display: flex; gap: 0.35rem; margin-bottom: 1rem;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
button.sub-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0; color: var(--muted); padding: 0.55rem 1rem;
  margin-bottom: -1px;
}
button.sub-tab:hover { color: var(--text); background: #252535; }
button.sub-tab.active {
  color: var(--accent); border-bottom-color: var(--accent); background: #252535;
}
.report-tab-panel { margin-top: 0.25rem; }
.report-table-section {
  margin-bottom: 1.75rem;
}
.report-table-section:last-child {
  margin-bottom: 0.35rem;
}
.report-tab-panel .report-table-toolbar {
  margin: 0 0 0.65rem;
}
.report-tab-panel .report-table-body {
  min-height: 0;
}
.report-tab-panel .report-table-section .pagination-bar {
  margin-top: 0.65rem;
  margin-bottom: 0;
}
.report-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 1.25rem 0 0.5rem;
}
.report-section-head:first-child { margin-top: 0; }
.report-section-head h3 {
  margin: 0;
  flex: 1 1 auto;
  font-size: 1rem;
  color: var(--muted);
}
.report-export-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}
.btn-report-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #252535;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-report-export:hover {
  color: var(--text);
  background: #2e2e42;
  border-color: #454560;
}
.btn-report-export svg {
  width: 1.05rem;
  height: 1.05rem;
  opacity: 0.92;
}

.report-tab-panel table.report-grid {
  table-layout: fixed;
}
.report-tab-panel table.report-grid col.col-main { width: auto; }
.report-tab-panel table.report-grid col.col-type { width: 6.25rem; }
.report-tab-panel table.report-grid col.col-qty { width: 4.25rem; }
.report-tab-panel table.report-grid col.col-total { width: 7.5rem; }
.report-tab-panel table.report-grid-terminal col.col-type { width: 14rem; }
.report-tab-panel table.report-grid-terminal td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-tab-panel table.report-grid th:nth-child(2):empty,
.report-tab-panel table.report-grid td.col-spacer {
  padding: 0;
  border-bottom-color: transparent;
}
.report-tab-panel table.report-grid th:nth-child(2):not(:empty),
.report-tab-panel table.report-grid td:nth-child(2).num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.report-tab-panel table.report-grid th:nth-child(3),
.report-tab-panel table.report-grid th:nth-child(4),
.report-tab-panel table.report-grid td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.report-tab-panel table.report-grid-audit-wide {
  table-layout: fixed;
}
.report-tab-panel table.report-grid-audit-wide col.col-qty { width: 4.25rem; }
.report-tab-panel table.report-grid-audit-wide col.col-total { width: 7.5rem; }
.report-tab-panel table.report-grid-audit-wide th:nth-last-child(-n+2),
.report-tab-panel table.report-grid-audit-wide td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.report-tab-panel table.report-grid-payments {
  table-layout: fixed;
}
.report-tab-panel table.report-grid-payments col.col-main { width: auto; }
.report-tab-panel table.report-grid-payments col.col-qty { width: 4.5rem; }
.report-tab-panel table.report-grid-payments col.col-total { width: 7.5rem; }
.report-tab-panel table.report-grid-payments th:nth-child(n+2),
.report-tab-panel table.report-grid-payments td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.report-tab-panel table.report-grid-payments td.net-total {
  color: #7dd3fc;
  font-weight: 600;
}

.admin-grid.payments-summary-grid {
  table-layout: fixed;
  width: 100%;
}
.admin-grid.payments-summary-grid col.col-main { width: auto; }
.admin-grid.payments-summary-grid col.col-qty { width: 10rem; }
.admin-grid.payments-summary-grid col.col-total { width: 11rem; }
.admin-grid.payments-summary-grid th.num,
.admin-grid.payments-summary-grid td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.admin-grid.payments-summary-grid td.net-total {
  color: #7dd3fc;
  font-weight: 600;
}

.admin-grid.refunds-grid {
  table-layout: fixed;
  width: 100%;
}
.admin-grid.refunds-grid col.col-date { width: 11%; }
.admin-grid.refunds-grid col.col-sale { width: 6%; }
.admin-grid.refunds-grid col.col-event { width: 16%; }
.admin-grid.refunds-grid col.col-payment { width: 9%; }
.admin-grid.refunds-grid col.col-total { width: 9%; }
.admin-grid.refunds-grid col.col-operator { width: 11%; }
.admin-grid.refunds-grid col.col-reason { width: 38%; }
.admin-grid.refunds-grid th.num,
.admin-grid.refunds-grid td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.admin-grid.refunds-grid td.col-reason {
  text-align: right;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}
.admin-grid.refunds-grid th.col-reason {
  text-align: center;
}
.admin-grid.refunds-grid td.col-date,
.admin-grid.refunds-grid td.col-sale,
.admin-grid.refunds-grid td.col-event,
.admin-grid.refunds-grid td.col-operator {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

#sessions-list table.sessions-grid {
  table-layout: fixed;
  width: 100%;
  min-width: 72rem;
}
#sessions-list table.sessions-grid col.col-id { width: 6.5rem; }
#sessions-list table.sessions-grid col.col-terminal { width: 10rem; }
#sessions-list table.sessions-grid col.col-status { width: 5.75rem; }
#sessions-list table.sessions-grid col.col-opening { width: 6.75rem; }
#sessions-list table.sessions-grid col.col-total { width: 7.5rem; }
#sessions-list table.sessions-grid col.col-qty { width: 3.75rem; }
#sessions-list table.sessions-grid col.col-operator { width: 8rem; }
#sessions-list table.sessions-grid col.col-opened-at { width: 10.5rem; }
#sessions-list table.sessions-grid col.col-closed-at { width: 10.5rem; }
#sessions-list table.sessions-grid col.col-closed-by { width: 8rem; }
#sessions-list table.sessions-grid th,
#sessions-list table.sessions-grid td {
  padding: 0.6rem 0.7rem;
}
#sessions-list table.sessions-grid td.col-id,
#sessions-list table.sessions-grid td.col-terminal,
#sessions-list table.sessions-grid td.col-operator {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}
#sessions-list table.sessions-grid td.col-closed-by {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
  text-align: right;
}
#sessions-list table.sessions-grid td.col-id .mono-cell,
#sessions-list table.sessions-grid td.col-terminal .mono-cell {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sessions-list table.sessions-grid th:nth-child(4),
#sessions-list table.sessions-grid th:nth-child(5),
#sessions-list table.sessions-grid th:nth-child(6),
#sessions-list table.sessions-grid th:nth-child(8),
#sessions-list table.sessions-grid th:nth-child(9),
#sessions-list table.sessions-grid th:nth-child(10),
#sessions-list table.sessions-grid td.num,
#sessions-list table.sessions-grid td.col-datetime,
#sessions-list table.sessions-grid td.col-closed-by {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#sessions-list table.sessions-grid td.col-status,
#sessions-list table.sessions-grid th:nth-child(3) {
  text-align: left;
}
#sessions-list .table-wrap {
  overflow-x: auto;
}

#users-list table.users-grid {
  table-layout: fixed;
  width: 100%;
}
#users-list table.users-grid col.col-name { width: 12rem; }
#users-list table.users-grid col.col-email { width: auto; }
#users-list table.users-grid col.col-role { width: 8.5rem; }
#users-list table.users-grid col.col-status { width: 6.5rem; }
#users-list table.users-grid col.col-actions { width: 6.5rem; }
#users-list table.users-grid td.col-actions .actions {
  flex-wrap: nowrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

dialog.dialog-user-password {
  max-width: 480px;
}

dialog.dialog-confirm {
  max-width: 400px;
  padding: 0;
  text-align: center;
}

.confirm-dialog-body {
  padding: 1.75rem 1.5rem 0.25rem;
}

.confirm-dialog-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.15);
  color: #fca5a5;
}

dialog.dialog-confirm h3 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.confirm-dialog-message {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}

.confirm-dialog-message strong {
  color: var(--text);
  font-weight: 600;
}

.confirm-dialog-message .confirm-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

dialog.dialog-confirm menu {
  justify-content: center;
  gap: 0.65rem;
  padding: 1rem 1.5rem 1.5rem;
  margin-top: 0;
}

button.btn-confirm-danger {
  background: #b91c1c;
  border-color: #b91c1c;
}

dialog.dialog-prompt {
  max-width: 440px;
  padding: 0;
}

.prompt-dialog-form {
  margin: 0;
}

.prompt-dialog-body {
  padding: 1.5rem 1.5rem 0.5rem;
  text-align: left;
}

dialog.dialog-prompt h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  text-align: center;
}

.prompt-dialog-message {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.prompt-dialog-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.prompt-dialog-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, var(--surface));
  color: var(--text);
  font: inherit;
  resize: vertical;
  min-height: 4.5rem;
}

.prompt-dialog-input:focus {
  outline: 2px solid rgba(233, 30, 140, 0.35);
  border-color: var(--accent);
}
.prompt-dialog-input-line {
  min-height: auto;
  resize: none;
}

.prompt-dialog-error {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: #fca5a5;
}

dialog.dialog-prompt menu {
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.5rem 1.5rem;
  margin-top: 0;
}

dialog.dialog-notice {
  max-width: 440px;
  padding: 0;
  text-align: center;
}

.notice-dialog-body {
  padding: 1.75rem 1.5rem 0.25rem;
}

.notice-dialog-spinner {
  display: inline-block;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 1rem;
  border: 3px solid rgba(233, 30, 140, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: notice-spin 0.75s linear infinite;
}

@keyframes notice-spin {
  to { transform: rotate(360deg); }
}

.notice-dialog-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

dialog.dialog-notice.notice--success .notice-dialog-icon {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

dialog.dialog-notice.notice--warning .notice-dialog-icon {
  background: rgba(234, 179, 8, 0.15);
  color: #fcd34d;
}

dialog.dialog-notice.notice--error .notice-dialog-icon {
  background: rgba(185, 28, 28, 0.15);
  color: #fca5a5;
}

dialog.dialog-notice.notice--loading .notice-dialog-icon {
  display: none;
}

dialog.dialog-notice h3 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.notice-dialog-message {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
}

.notice-dialog-detail {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.75rem;
  max-height: 10rem;
  overflow: auto;
  text-align: left;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #fca5a5;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}

dialog.dialog-notice menu {
  justify-content: center;
  padding: 1rem 1.5rem 1.5rem;
  margin-top: 0;
}

button.btn-confirm-danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}

.user-password-target {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.user-password-name {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
}

.admin-grid { table-layout: fixed; width: 100%; }
.admin-grid td.col-actions .actions { justify-content: flex-end; }
.admin-grid td.num,
.admin-grid th.num { text-align: right; font-variant-numeric: tabular-nums; }

.admin-grid.events-grid col.col-name { width: auto; }
.admin-grid.events-grid col.col-venue { width: 9rem; }
.admin-grid.events-grid col.col-date { width: 10.5rem; }
.admin-grid.events-grid col.col-status { width: 6.5rem; }
.admin-grid.events-grid col.col-mode { width: 9.5rem; }
.admin-grid.events-grid col.col-flag { width: 7rem; }
.admin-grid.events-grid col.col-actions { width: 6.5rem; }

.admin-grid.tickets-grid col.col-name { width: auto; }
.admin-grid.tickets-grid col.col-sub { width: 8rem; }
.admin-grid.tickets-grid col.col-price { width: 7rem; }
.admin-grid.tickets-grid col.col-id { width: 5rem; }
.admin-grid.tickets-grid col.col-status { width: 6.5rem; }
.admin-grid.tickets-grid col.col-actions { width: 6.5rem; }
.admin-grid.tickets-grid th:nth-child(3),
.admin-grid.tickets-grid td:nth-child(3) { text-align: right; }

.admin-grid.products-grid col.col-photo { width: 4.5rem; }
.admin-grid.products-grid col.col-name { width: auto; }
.admin-grid.products-grid col.col-sub { width: 7rem; }
.admin-grid.products-grid col.col-location { width: 7rem; }
.admin-grid.products-grid col.col-price { width: 7rem; }
.admin-grid.products-grid col.col-stock { width: 5rem; }
.admin-grid.products-grid col.col-id { width: 4.5rem; }
.admin-grid.products-grid col.col-status { width: 6.5rem; }
.admin-grid.products-grid col.col-actions { width: 6.5rem; }
.admin-grid.products-grid th:nth-child(5),
.admin-grid.products-grid th:nth-child(6),
.admin-grid.products-grid td:nth-child(5),
.admin-grid.products-grid td:nth-child(6) { text-align: right; }
.admin-grid.products-grid .thumb-cell img { max-width: 40px; max-height: 40px; border-radius: 4px; }

.admin-grid.terminals-grid col.col-serial { width: 13rem; }
.admin-grid.terminals-grid col.col-name { width: auto; }
.admin-grid.terminals-grid col.col-connection { width: 7rem; }
.admin-grid.terminals-grid col.col-status { width: 6.5rem; }
.admin-grid.terminals-grid col.col-actions { width: 6.75rem; }
.admin-grid.terminals-grid td.col-actions .actions {
  flex-wrap: nowrap;
  gap: 0.3rem;
  justify-content: flex-end;
}
.admin-grid.terminals-grid td.col-serial {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, monospace; font-size: 0.82rem;
}

.admin-grid.sales-grid col.col-date { width: 10.5rem; }
.admin-grid.sales-grid col.col-event { width: auto; }
.admin-grid.sales-grid col.col-operator { width: 8rem; }
.admin-grid.sales-grid col.col-payment { width: 6.5rem; }
.admin-grid.sales-grid col.col-status { width: 6.5rem; }
.admin-grid.sales-grid col.col-total { width: 7.5rem; }
.admin-grid.sales-grid col.col-items { width: 9.5rem; }
.admin-grid.sales-grid col.col-actions { width: 10rem; }
.admin-grid.sales-grid td.col-actions {
  padding-left: 1.25rem;
}
.admin-grid.sales-grid td.col-actions .actions {
  justify-content: flex-end;
}
.admin-grid.sales-grid th.col-actions,
.admin-grid.sales-grid td.col-actions {
  padding-left: 1.25rem;
}
.admin-grid.sales-grid th.num,
.admin-grid.sales-grid td.num {
  text-align: right;
  padding-right: 1rem;
}
.admin-grid.sales-grid th.col-items,
.admin-grid.sales-grid td.col-items {
  text-align: center;
  vertical-align: middle;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.sale-qty-chips {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
}
.sale-qty-chip {
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0.2rem 0.45rem;
}
.sale-qty-chip:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.btn-action-compact {
  padding: 0.4rem 0.45rem;
  min-width: 2rem;
  justify-content: center;
}
.actions.actions-inline {
  flex-wrap: nowrap;
  gap: 0.3rem;
}
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pagination-info { font-size: 0.85rem; color: var(--muted); }
.pagination-info strong { color: var(--text); }
.pagination-controls { display: flex; align-items: center; gap: 0.5rem; }
.pagination-current {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 0.35rem;
  min-width: 6.5rem;
  text-align: center;
}
.contract-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2, rgba(0, 0, 0, 0.03));
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.terms-acceptance-info {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  font-size: 0.84rem;
}
.terms-acceptance-info.pending {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.35);
}
.terms-dialog .dialog-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding-top: 0.25rem;
}
.terms-dialog-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem !important;
}
.terms-dialog-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.terms-dialog-logo {
  display: block;
  width: min(220px, 42vw);
  height: auto;
  flex-shrink: 0;
}
.terms-dialog-brand-text h3 {
  margin: 0 0 0.2rem;
}
.terms-dialog-brand-text .dialog-sub {
  margin: 0;
}
.terms-provider-card {
  margin-top: 0;
  margin-bottom: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.84rem;
  line-height: 1.45;
  background: var(--surface-2, rgba(0, 0, 0, 0.03));
}
.terms-provider-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
}
.terms-provider-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #e91e8c);
  background: rgba(233, 30, 140, 0.1);
  border: 1px solid rgba(233, 30, 140, 0.25);
}
.terms-provider-name {
  font-size: 0.92rem;
}
.terms-provider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
}
.terms-provider-grid > div { min-width: 0; }
.terms-provider-grid .span-2 { grid-column: 1 / -1; }
.terms-provider-grid dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #8a8a9a);
}
.terms-provider-grid dd {
  margin: 0.1rem 0 0;
  font-size: 0.84rem;
}
.terms-content {
  max-height: none;
  overflow: visible;
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2, rgba(0, 0, 0, 0.03));
  font-size: 0.86rem;
  line-height: 1.55;
}
.terms-content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.terms-content-head h4 {
  margin: 0;
  font-size: 0.95rem;
}
.terms-version-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent, #e91e8c);
  background: rgba(233, 30, 140, 0.08);
  border: 1px solid rgba(233, 30, 140, 0.2);
  white-space: nowrap;
}
.terms-section {
  padding: 0.65rem 0 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.terms-section:last-child { border-bottom: none; padding-bottom: 0; }
.terms-section-title {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 0.45rem;
  font-size: 0.92rem;
  line-height: 1.35;
}
.terms-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent, #e91e8c);
  flex-shrink: 0;
}
.terms-content h4 {
  margin: 1rem 0 0.35rem;
  font-size: 0.92rem;
}
.terms-content h4:first-child { margin-top: 0; }
.terms-content p { margin: 0 0 0.55rem; }
.terms-section p:last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .terms-dialog-brand { flex-direction: column; align-items: flex-start; }
  .terms-provider-grid { grid-template-columns: 1fr; }
  .terms-provider-grid .span-2 { grid-column: auto; }
}
.terms-accept-check { margin-top: 0.25rem; }
.terms-signature-block {
  margin: 0.85rem 0 0.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2, rgba(0, 0, 0, 0.03));
}
.terms-signature-block .form-field { margin-bottom: 0.75rem; }
.terms-signature-block .form-field:last-child { margin-bottom: 0; }
.terms-signature-pad-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.terms-signature-canvas {
  display: block;
  width: 100%;
  height: 140px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}
.terms-signature-clear {
  align-self: flex-start;
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
}
.terms-signature-hint {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}
.terms-dialog-error {
  margin: 0.5rem 0 0;
  color: var(--danger, #c62828);
  font-size: 0.85rem;
}
dialog.terms-dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
dialog.terms-dialog {
  max-height: min(calc(100dvh - 1.5rem), 920px);
  margin: auto;
}
dialog.terms-dialog form.terms-dialog-form {
  max-height: min(calc(100dvh - 1.5rem), 920px);
}
dialog.terms-dialog .dialog-head {
  padding-bottom: 0.75rem;
}
.danger-link { color: var(--danger, #c62828); }
button.btn-page {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #252535;
  color: var(--text);
}
button.btn-page:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(233, 30, 140, 0.12);
  color: #fff;
}
button.btn-page:disabled { opacity: 0.4; cursor: not-allowed; }

dialog.dialog-sale { max-width: 780px; }
dialog.dialog-sale .sale-detail {
  padding: 1.5rem 1.5rem 0;
  max-height: min(70vh, 520px);
  overflow-y: auto;
}
.sale-dialog-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0;
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid var(--border);
}
.sale-dialog-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1; }
.sale-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.sale-modal-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.sale-modal-head h3 { margin: 0 0 0.35rem; font-size: 1.2rem; line-height: 1.3; }
.sale-modal-meta { margin: 0; font-size: 0.85rem; color: var(--muted); }
.sale-modal-total {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.sale-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}
.sale-summary-item {
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sale-summary-item span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sale-summary-item strong { font-size: 0.9rem; font-weight: 600; }
.sale-section { margin-bottom: 1rem; }
.sale-section h4 {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
  width: 100%;
}
.dashboard-page .charts-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem 0.75rem;
  height: 200px;
  min-height: 200px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.chart-head { margin-bottom: 0.35rem; flex-shrink: 0; }
.chart-head h3 { margin: 0; font-size: 0.9rem; color: var(--text); font-weight: 600; }
.chart-hint { margin: 0.15rem 0 0; font-size: 0.72rem; }
.chart-canvas-wrap {
  position: relative;
  flex: 0 0 115px;
  height: 115px;
  min-height: 115px;
  max-height: 115px;
  width: 100%;
  overflow: hidden;
}
.chart-box canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: 115px;
}

/* Altura fixa igual nos 4 gráficos do dashboard */
.chart-box.chart-sales-day .chart-canvas-wrap,
.chart-box.chart-kind .chart-canvas-wrap,
.chart-box.chart-events .chart-canvas-wrap,
.chart-box.chart-payment .chart-canvas-wrap {
  flex: 0 0 115px;
  min-height: 115px;
  height: 115px;
  max-height: 115px;
}

.img-preview { margin: 0.5rem 0; min-height: 80px; }
.img-preview img {
  max-width: 100%; max-height: 160px; border-radius: 8px;
  border: 1px solid var(--border); object-fit: cover;
}
.thumb-cell img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }

@media (max-width: 900px) {
  .charts-grid,
  .dashboard-page .charts-grid { grid-template-columns: 1fr; }
}

/* ─── Responsive: tablets & mobile ─── */

@media (max-width: 1024px) {
  .content { padding: 1rem 1.25rem 1.75rem; }

  .dashboard-toolbar {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .dashboard-toolbar .filter-bar {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .panel-head-split {
    flex-direction: column;
    align-items: stretch;
  }
  .panel-head-split .btn-money-toggle {
    align-self: flex-start;
  }

  #sessions-list table.sessions-grid { min-width: 48rem; }
  #sessions-list table.sessions-grid th:nth-child(1),
  #sessions-list table.sessions-grid td:nth-child(1),
  #sessions-list table.sessions-grid th:nth-child(4),
  #sessions-list table.sessions-grid td:nth-child(4),
  #sessions-list table.sessions-grid th:nth-child(6),
  #sessions-list table.sessions-grid td:nth-child(6),
  #sessions-list table.sessions-grid th:nth-child(7),
  #sessions-list table.sessions-grid td:nth-child(7),
  #sessions-list table.sessions-grid th:nth-child(10),
  #sessions-list table.sessions-grid td:nth-child(10) { display: none; }

  .admin-grid.events-grid th:nth-child(1),
  .admin-grid.events-grid td:nth-child(1),
  .admin-grid.events-grid th:nth-child(6),
  .admin-grid.events-grid td:nth-child(6),
  .admin-grid.events-grid th:nth-child(7),
  .admin-grid.events-grid td:nth-child(7) { display: none; }

  .admin-grid.sales-grid th:nth-child(3),
  .admin-grid.sales-grid td:nth-child(3),
  .admin-grid.sales-grid th:nth-child(4),
  .admin-grid.sales-grid td:nth-child(4),
  .admin-grid.sales-grid th:nth-child(7),
  .admin-grid.sales-grid td:nth-child(7) { display: none; }

  .admin-grid.products-grid th:nth-child(1),
  .admin-grid.products-grid td:nth-child(1),
  .admin-grid.products-grid th:nth-child(3),
  .admin-grid.products-grid td:nth-child(3),
  .admin-grid.products-grid th:nth-child(4),
  .admin-grid.products-grid td:nth-child(4),
  .admin-grid.products-grid th:nth-child(6),
  .admin-grid.products-grid td:nth-child(6),
  .admin-grid.products-grid th:nth-child(7),
  .admin-grid.products-grid td:nth-child(7) { display: none; }

  #platform-companies-list table th:nth-child(4),
  #platform-companies-list table td:nth-child(4),
  #platform-companies-list table th:nth-child(5),
  #platform-companies-list table td:nth-child(5),
  #platform-companies-list table th:nth-child(6),
  #platform-companies-list table td:nth-child(6),
  #platform-companies-list table th:nth-child(7),
  #platform-companies-list table td:nth-child(7),
  #platform-companies-list table th:nth-child(8),
  #platform-companies-list table td:nth-child(8) { display: none; }

  #platform-plans-list table th:nth-child(4),
  #platform-plans-list table td:nth-child(4),
  #platform-plans-list table th:nth-child(5),
  #platform-plans-list table td:nth-child(5),
  #platform-plans-list table th:nth-child(6),
  #platform-plans-list table td:nth-child(6),
  #platform-plans-list table th:nth-child(7),
  #platform-plans-list table td:nth-child(7) { display: none; }
}

@media (max-width: 768px) {
  #app-view { grid-template-columns: 1fr; }
  #app-view.sidebar-collapsed { --sidebar-width: 0px; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: min(280px, 88vw);
    min-height: 100vh;
    transform: translateX(-105%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
    padding: 1rem 0.85rem;
    align-items: stretch;
  }
  #app-view.sidebar-collapsed .brand-logo-full,
  #app-view.sidebar-collapsed .nav-label,
  #app-view.sidebar-collapsed .user-info,
  #app-view.sidebar-collapsed .logout-label { display: revert; }
  #app-view.sidebar-collapsed .brand-mark { display: none; }
  #app-view.sidebar-collapsed button.nav { justify-content: flex-start; padding: 0.6rem 0.75rem; }
  #app-view.sidebar-collapsed .user-card,
  #app-view.sidebar-collapsed .btn-logout {
    justify-content: flex-start;
    padding: 0.55rem 0.75rem !important;
    background: revert !important;
    border: revert !important;
    box-shadow: revert !important;
  }
  #app-view.sidebar-collapsed .user-card { padding: 0.55rem 0.5rem !important; }
  #app-view.sidebar-collapsed .user-avatar-slot .user-avatar {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.95rem;
  }
  #app-view.sidebar-open .sidebar { transform: translateX(0); }
  #app-view.sidebar-collapsed .sidebar { transform: translateX(-105%); }
  .sidebar-backdrop:not(.hidden) { display: block; }
  .topbar-db { display: none; }

  .content { padding: 0.85rem 1rem 1.5rem; }
  .topbar {
    padding: 0.65rem max(0.85rem, env(safe-area-inset-right, 0px)) 0.65rem max(0.85rem, env(safe-area-inset-left, 0px));
    gap: 0.65rem;
  }
  .topbar-heading h1 { font-size: 1rem; }
  .topbar-subtitle { font-size: 0.75rem; }

  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .panel-head h2 { flex: unset; font-size: 1.15rem; }
  .panel-head .filter-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .panel-head .filter-bar label {
    flex-direction: column;
    align-items: stretch;
    white-space: normal;
  }
  .panel-head .filter-bar input,
  .panel-head .filter-bar select {
    width: 100%;
    min-width: 0;
  }
  .panel-head .filter-bar button { width: 100%; }
  .panel-head > .event-select {
    max-width: none;
    width: 100%;
    min-width: 0;
  }
  .panel-head > .primary,
  .panel-head > .secondary {
    width: 100%;
    justify-content: center;
  }
  .panel-head > .report-export-actions { align-self: flex-start; }

  .table-search { max-width: none; }
  .table-toolbar { margin-bottom: 0.65rem; }

  th, td { padding: 0.5rem 0.6rem; font-size: 0.82rem; }

  .admin-grid.tickets-grid th:nth-child(2),
  .admin-grid.tickets-grid td:nth-child(2),
  .admin-grid.tickets-grid th:nth-child(4),
  .admin-grid.tickets-grid td:nth-child(4) { display: none; }

  .admin-grid.terminals-grid th:nth-child(3),
  .admin-grid.terminals-grid td:nth-child(3) { display: none; }

  .admin-grid.events-grid th:nth-child(3),
  .admin-grid.events-grid td:nth-child(3) { display: none; }

  #users-list table.users-grid th:nth-child(2),
  #users-list table.users-grid td:nth-child(2) { display: none; }

  #sessions-list table.sessions-grid { min-width: 28rem; }
  #sessions-list table.sessions-grid th:nth-child(9),
  #sessions-list table.sessions-grid td:nth-child(9) { display: none; }

  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
  }
  .pagination-controls { justify-content: center; }
  .pagination-current { min-width: 0; }

  .sub-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 0;
    padding-bottom: 0;
  }
  button.sub-tab {
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
  }

  .report-section-head {
    flex-direction: column;
    align-items: stretch;
  }
  .report-export-actions { margin-left: 0; }

  dialog,
  dialog.dialog-wide,
  dialog.dialog-sale,
  dialog.dialog-event,
  dialog.dialog-product {
    width: min(100%, 96vw);
    max-width: none;
    margin: auto;
  }
  dialog.dialog-scroll {
    max-height: min(96dvh, 920px);
  }
  dialog.dialog-scroll form {
    max-height: min(96dvh, 920px);
  }
  dialog.dialog-scroll .dialog-head,
  dialog.dialog-scroll .dialog-scroll-body,
  dialog.dialog-scroll menu {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  dialog form { padding: 1rem; }
  dialog menu {
    flex-wrap: wrap;
    justify-content: stretch;
  }
  dialog menu button,
  dialog menu .btn-action {
    flex: 1 1 auto;
    min-width: calc(50% - 0.25rem);
    justify-content: center;
  }

  .sale-modal-head {
    flex-direction: column;
    align-items: stretch;
  }
  .sale-modal-total { font-size: 1.25rem; }
  .sale-dialog-menu {
    flex-direction: column;
    align-items: stretch;
    padding: 0.85rem 1rem 1rem;
  }
  .sale-dialog-actions { width: 100%; }
  .sale-dialog-actions .btn-action { flex: 1 1 calc(50% - 0.25rem); }

  .redemption-hero {
    flex-direction: column;
    padding: 1rem;
  }
  .redemption-actions button { flex: 1 1 calc(50% - 0.25rem); }

  .company-card { padding: 1rem; }
  .company-card-head { flex-direction: column; align-items: stretch; }
  .company-detail-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
  .company-detail-list dd { text-align: left; }
  .company-contract-iframe { min-height: min(55vh, 480px); }

  .card-panel { padding: 0.85rem 1rem; }
  .kpi-card { padding: 0.85rem; min-height: 0; }
  .kpi-body strong { font-size: 1.15rem; }

  .dashboard-kpi { gap: 0.65rem; }
  .dashboard-toolbar {
    padding: 0.55rem 0.75rem;
    gap: 0.5rem;
  }
  .dashboard-period-label { width: 100%; }
  .dashboard-toolbar .filter-bar input {
    width: 100%;
    min-width: 0;
  }

  .content {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
  }
  .sidebar {
    padding-left: max(0.85rem, env(safe-area-inset-left, 0px));
    padding-top: max(1rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 640px) {
  .login-view { padding: 1rem; }
  .login-card { padding: 1.5rem 1.25rem 1.25rem; }
  .login-logo-img { max-width: 180px; }

  .content { padding: 0.75rem 0.85rem 1.25rem; }

  .dashboard-kpi { grid-template-columns: 1fr 1fr; }
  .dashboard-kpi-platform { grid-template-columns: 1fr 1fr; }

  .panel-hint { font-size: 0.8rem; margin-bottom: 0.75rem; }

  .panel-head > .primary,
  .panel-head > .secondary {
    font-size: 0.88rem;
    padding: 0.55rem 0.75rem;
  }

  .btn-action {
    font-size: 0.68rem;
    padding: 0.32rem 0.55rem;
  }
  .actions { gap: 0.25rem; }

  .admin-grid.sales-grid th:nth-child(1),
  .admin-grid.sales-grid td:nth-child(1) { display: none; }

  .chart-box {
    height: auto;
    min-height: 180px;
    max-height: none;
    padding: 0.65rem 0.75rem;
  }
  .chart-canvas-wrap,
  .chart-box.chart-sales-day .chart-canvas-wrap,
  .chart-box.chart-kind .chart-canvas-wrap,
  .chart-box.chart-events .chart-canvas-wrap,
  .chart-box.chart-payment .chart-canvas-wrap {
    flex: 1 1 auto;
    min-height: 130px;
    height: 130px;
    max-height: 130px;
  }

  .empty-state-card { padding: 1.5rem 1rem; }

  dialog menu button,
  dialog menu .btn-action {
    min-width: 100%;
  }
  .sale-dialog-actions .btn-action { min-width: 100%; }

  .redemption-actions {
    flex-direction: column;
  }
  .redemption-actions button { width: 100%; }

  .confirm-dialog-body { padding: 1.25rem 1rem 0.25rem; }
  dialog.dialog-confirm menu {
    flex-direction: column;
    padding: 0.85rem 1rem 1.25rem;
  }
  dialog.dialog-confirm menu button { width: 100%; }
}

@media (max-width: 480px) {
  .dashboard-kpi,
  .dashboard-kpi-platform { grid-template-columns: 1fr; }

  .kpi-icon {
    width: 2rem;
    height: 2rem;
  }
  .kpi-icon svg { width: 1.05rem; height: 1.05rem; }

  #sessions-list table.sessions-grid { min-width: 0; width: 100%; }
  #sessions-list table.sessions-grid th:nth-child(8),
  #sessions-list table.sessions-grid td:nth-child(8) { display: none; }

  .pagination-controls { flex-wrap: wrap; }
  button.btn-page { flex: 1 1 calc(50% - 0.25rem); text-align: center; }
}
