/* ==========================================================================
   FlowPDV Master Admin ? Design System (from scratch)
   Navy/slate surfaces ? Brand orange CTAs ? Cyan secondary accents
   Fonts: Plus Jakarta Sans + JetBrains Mono
   ========================================================================== */

:root {
  --surface-body: #1a2836;
  --surface-panel: #24384c;
  --surface-raised: #2e4660;
  --surface-inset: #1e3144;
  --surface-hover: #355270;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-default: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --brand-orange: #f39237;
  --brand-orange-deep: #d97706;
  --brand-orange-soft: rgba(243, 146, 55, 0.16);
  --brand-orange-glow: rgba(243, 146, 55, 0.35);

  --accent-cyan: #38bdf8;
  --accent-cyan-bright: #7dd3fc;
  --accent-cyan-soft: rgba(56, 189, 248, 0.14);

  --ok: #34d399;
  --ok-soft: rgba(16, 185, 129, 0.16);
  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --danger-solid: #ef4444;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --shadow-orange: 0 8px 24px var(--brand-orange-glow);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --topbar-h: 64px;
  --drawer-w: 580px;
  --sheet-max: 720px;
  --space: 20px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Legacy aliases used by inline JS / HTML */
  --bg-body: var(--surface-body);
  --bg-card: var(--surface-raised);
  --bg-card-hover: var(--surface-hover);
  --bg-input: var(--surface-panel);
  --border-color: var(--border-default);
  --text-main: var(--text-primary);
  --text-dim: var(--text-muted);
  --accent-green: var(--ok);
  --accent-amber: var(--warn);
  --accent-red: var(--danger-solid);
  --accent-indigo: var(--accent-cyan);
  --accent-purple: var(--accent-cyan);
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

html,
body,
button,
input,
select,
textarea,
a {
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(243, 146, 55, 0.07), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(56, 189, 248, 0.06), transparent 50%),
    var(--surface-body);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  font-size: 14px;
  font-weight: 500;
}

body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
  touch-action: none !important;
  -webkit-overflow-scrolling: auto !important;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}

a:hover {
  color: var(--accent-cyan-bright);
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
}

code,
.mono,
.cell-chave code,
.cell-venc strong {
  font-family: var(--font-mono);
}

/* Scrollbar */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: rgba(26, 40, 54, 0.6);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb {
  background: #3a5570;
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #4a6a88;
}

/* Number inputs ? hide spinners */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type='number'] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Autofill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--surface-panel) inset !important;
  box-shadow: 0 0 0 1000px var(--surface-panel) inset !important;
  caret-color: var(--text-primary);
  transition: background-color 9999s ease-in-out 0s;
}

/* ==========================================================================
   1) LOGIN ? split brand + form (new) + legacy .login-card
   ========================================================================== */
.login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(800px 420px at 50% 0%, rgba(243, 146, 55, 0.1), transparent 55%),
    radial-gradient(600px 360px at 80% 100%, rgba(56, 189, 248, 0.07), transparent 50%),
    var(--surface-body);
}

/* New split login — activates when brand pane is present */
#login-screen,
.login-screen {
  width: 100vw;
  max-width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
}

#login-screen:has(> .login-brand-pane),
.login-screen:has(> .login-brand-pane) {
  display: grid !important;
  grid-template-columns: minmax(320px, 1.15fr) minmax(340px, 0.85fr) !important;
  align-items: stretch;
  justify-content: stretch;
  width: 100vw;
  max-width: 100%;
  padding: 0;
  background: var(--surface-body);
}

.login-screen > .login-brand-pane {
  flex: 1 1 55%;
}

.login-screen > .login-form-pane {
  flex: 1 1 45%;
}

.login-brand-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 56px;
  background:
    linear-gradient(160deg, rgba(243, 146, 55, 0.12) 0%, transparent 42%),
    linear-gradient(200deg, #152433 0%, #1a2836 55%, #203348 100%);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
}

.login-brand-pane::after {
  content: '';
  position: absolute;
  inset: auto -20% -30% 20%;
  height: 55%;
  background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.12), transparent 70%);
  pointer-events: none;
}

.login-hero-icon {
  width: auto;
  height: auto;
  max-width: min(220px, 70%);
  max-height: 200px;
  object-fit: contain;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.login-brand-pane .login-tagline,
.login-brand-pane .login-subtitle {
  position: relative;
  z-index: 1;
  max-width: 360px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-secondary);
}

.login-form-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--surface-panel);
}

.login-form-pane .login-form,
.login-form-pane form {
  width: 100%;
  max-width: 400px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-lg);
}

.login-wordmark {
  width: min(220px, 72%);
  height: auto;
  margin: 0 auto 18px;
}

.login-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.login-access-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
}

.login-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
  line-height: 1.45;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-label-login {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.input-login {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--surface-panel);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input-login::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.input-login:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--brand-orange-soft);
}

.login-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.btn-login-primary {
  width: 100%;
  height: 48px;
  margin-top: 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-deep));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter 0.15s var(--ease), transform 0.15s var(--ease);
}

.btn-login-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-login-primary:active {
  transform: scale(0.98);
}

/* ==========================================================================
   2) APP SHELL ? topbar + workspace (new)
   Legacy: .app-container / .master-header / .master-main
   ========================================================================== */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.app-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space) 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell > .topbar,
.app-container > .topbar,
.app-container > .master-header {
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar,
.master-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--topbar-h);
  padding: 12px 20px;
  margin: 12px 0 20px;
  background: rgba(36, 56, 76, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.brand-title span {
  color: var(--brand-orange);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 1px;
}

.topbar-nav,
.nav-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-user-chip,
#master-logged-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
  flex-shrink: 0;
}

.workspace,
.master-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding-bottom: 24px;
}

/* ==========================================================================
   3) PAGE HERO
   ========================================================================== */
.page-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 2px 2px;
}

.page-hero h1,
.page-hero .page-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}

.page-hero p,
.page-hero .page-desc {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.page-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   4) STATS STRIP ? one panel, vertical rules (NOT floating cards)
   Also styles legacy .metrics-grid / .metric-card as strip cells
   ========================================================================== */
.stats-strip,
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  gap: 0;
}

.stat-cell,
.metrics-grid .metric-card,
.stats-strip .metric-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 20px 22px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.stat-cell + .stat-cell,
.metrics-grid .metric-card + .metric-card,
.stats-strip .metric-card + .metric-card {
  border-left: 1px solid var(--border-default);
}

.stat-cell::before,
.metrics-grid .metric-card::before {
  content: none;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-icon,
.metric-icon-tile {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--surface-panel);
  color: var(--text-secondary);
}

.metric-icon-tile.mrr {
  color: var(--ok);
  background: var(--ok-soft);
}

.metric-icon-tile.ativas {
  color: var(--accent-cyan);
  background: var(--accent-cyan-soft);
}

.metric-icon-tile.vencendo {
  color: var(--warn);
  background: var(--warn-soft);
}

.metric-icon-tile.bloqueadas {
  color: var(--danger);
  background: var(--danger-soft);
}

.metric-value,
.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.15;
}

.metric-card.mrr .metric-value,
.stat-cell.mrr .metric-value,
.stat-cell.mrr .stat-value {
  color: var(--ok);
  font-family: var(--font-mono);
  font-size: 22px;
}

.metric-sub,
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   5) TOOLBAR ? search + filter pills
   Legacy: .controls-bar
   ========================================================================== */
.toolbar,
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
  height: 42px;
  padding: 0 14px;
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.search-icon {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.search-box input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.filter-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.filter-btn.active {
  background: var(--brand-orange-soft);
  color: var(--brand-orange);
  box-shadow: inset 0 0 0 1px rgba(243, 146, 55, 0.35);
}

/* ==========================================================================
   6) DATA PANEL + MASTER TABLE
   Legacy: .table-section
   ========================================================================== */
.data-panel,
.table-section {
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.master-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.master-table th {
  background: var(--surface-panel);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}

.master-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-primary);
  vertical-align: middle;
}

.master-table tr:last-child td {
  border-bottom: none;
}

.master-table-row {
  transition: background 0.15s var(--ease);
}

@media (hover: hover) {
  .master-table tbody tr:hover td {
    background: rgba(53, 82, 112, 0.35);
  }
}

.mobile-td-label {
  display: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.cell-chave code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan-bright);
}

.cell-venc strong {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

/* ==========================================================================
   BADGES
   ========================================================================== */
.badge,
.badge-tag-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.2;
}

.badge-tag-sm {
  font-size: 10px;
  padding: 3px 8px;
}

.badge-ativa {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-vencendo {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-bloqueada {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-master {
  display: inline-flex;
  align-items: center;
  background: var(--brand-orange-soft);
  color: var(--brand-orange);
  border: 1px solid rgba(243, 146, 55, 0.4);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.08em;
}

.badge-terminal {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.badge-terminal.livre {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.badge-terminal.lotado {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-terminal-user {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-pri,
.btn-sec,
.btn-ghost,
.btn-primary-cta,
.btn-novo-cliente,
.btn-planos,
.btn-logout,
.btn-close,
.btn-close-modal,
.btn-editar-modern,
.btn-excluir-modal,
.btn-desvincular-terminais,
.btn-desvincular-individual,
.btn-add-dias,
.btn-atualizar-auditoria,
.btn-limpar-auditoria,
.btn-action-icon {
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
    color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease),
    filter 0.15s var(--ease);
}

.btn-pri,
.btn-primary-cta,
.btn-novo-cliente {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-deep));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--shadow-orange);
}

.btn-pri:hover,
.btn-primary-cta:hover,
.btn-novo-cliente:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-pri:active,
.btn-primary-cta:active,
.btn-novo-cliente:active {
  transform: scale(0.98);
}

.btn-sec {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-sec:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-sec:active {
  transform: scale(0.98);
}

.btn-ghost,
.btn-planos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-ghost:hover,
.btn-planos:hover {
  background: var(--accent-cyan-soft);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan-bright);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-weight: 700;
  font-size: 13px;
}

.btn-logout:hover {
  background: var(--danger-solid);
  border-color: #dc2626;
  color: #fff;
}

.btn-close,
.btn-close-modal {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--surface-panel);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.btn-close:hover,
.btn-close-modal:hover {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--danger);
}

.btn-close:active,
.btn-close-modal:active {
  transform: scale(0.95);
}

.btn-editar-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(243, 146, 55, 0.35);
  background: var(--brand-orange-soft);
  color: var(--brand-orange);
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
}

.btn-editar-modern:hover {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-deep));
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: var(--shadow-orange);
}

.btn-editar-modern:active {
  transform: scale(0.98);
}

.btn-excluir-modal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  margin-top: 8px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.35);
  font-size: 13px;
  font-weight: 800;
}

.btn-excluir-modal:hover {
  background: var(--danger-solid);
  color: #fff;
  border-color: #dc2626;
}

.btn-desvincular-terminais {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 6px;
}

.btn-desvincular-terminais:hover {
  background: var(--danger-solid);
  color: #fff;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-desvincular-individual {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-desvincular-individual:hover {
  background: var(--danger-solid);
  color: #fff;
  border-color: #dc2626;
}

.btn-add-dias {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-orange-deep));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 12px var(--brand-orange-glow);
}

.btn-add-dias:hover {
  filter: brightness(1.06);
}

.btn-atualizar-auditoria {
  height: 38px;
  box-sizing: border-box;
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-atualizar-auditoria:hover {
  background: rgba(56, 189, 248, 0.22);
  color: var(--accent-cyan-bright);
}

.btn-atualizar-auditoria:active {
  transform: scale(0.97);
}

.btn-limpar-auditoria {
  height: 38px;
  box-sizing: border-box;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-limpar-auditoria:hover {
  background: var(--danger-solid);
  color: #fff;
}

.btn-limpar-auditoria:active {
  transform: scale(0.97);
}

.btn-action-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.btn-action-icon.edit:hover {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan-bright);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35);
}

.btn-action-icon.delete {
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--danger);
}

.btn-action-icon.delete:hover {
  background: var(--danger-solid);
  border-color: #dc2626;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-action-icon:active {
  transform: scale(0.95);
}

.btn-link-planos:hover {
  color: var(--accent-cyan-bright) !important;
}

.btn-modal-footer {
  min-width: 120px;
  height: 44px !important;
}

/* ==========================================================================
   7) MODALS ? overlay + sheet + drawer
   .modal-card aliases .modal-sheet for backward compatibility
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 16, 24, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-overlay.active {
  display: flex;
}

.modal-sheet,
.modal-card {
  width: 100%;
  max-width: var(--sheet-max);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: sheetIn 0.22s var(--ease);
}

.modal-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(var(--drawer-w), 100%);
  min-width: min(520px, 100%);
  max-width: 640px;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-raised);
  border: none;
  border-left: 1px solid var(--border-default);
  border-radius: 0;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: drawerIn 0.28s var(--ease);
  margin: 0;
}

/* Drawer wins over .modal-card sheet styles */
.modal-overlay .modal-drawer.modal-card {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(var(--drawer-w), 100vw);
  max-width: 640px;
  min-width: 0;
  height: 100%;
  max-height: none;
  border-radius: 0;
  border: none;
  border-left: 1px solid var(--border-default);
  margin: 0;
  animation: drawerIn 0.28s var(--ease);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.45);
}

.modal-overlay:has(.modal-drawer) {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.modal-drawer .modal-head,
.modal-drawer .modal-header {
  padding: 18px 22px;
  background: linear-gradient(180deg, #334d68 0%, var(--surface-panel) 100%);
}

.modal-drawer .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 24px;
  -webkit-overflow-scrolling: touch;
}

.modal-drawer .modal-footer,
.modal-drawer .modal-foot {
  padding: 14px 22px;
  background: rgba(15, 23, 42, 0.35);
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes drawerIn {
  from {
    transform: translateX(24px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.modal-head,
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
  background: var(--surface-panel);
  flex-shrink: 0;
}

.modal-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.modal-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-orange-soft);
  color: var(--brand-orange);
  border: 1px solid rgba(243, 146, 55, 0.3);
  font-size: 16px;
  flex-shrink: 0;
}

.modal-header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.modal-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-orange);
}

.modal-header h3,
.modal-header-titles h3,
.modal-head h3 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 22px;
  min-height: 0;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #3a5570;
  border-radius: 4px;
}

.modal-foot,
.modal-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-default);
  background: var(--surface-panel);
  flex-shrink: 0;
}

.modal-footer-main-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
}

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-group.span-2 {
  grid-column: span 2;
}

.form-group label,
.box-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.form-group input:not([type='checkbox']):not([type='radio']),
.form-group select,
.form-group textarea,
.venc-date-input,
.venc-dias-number {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--surface-panel);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.form-group textarea {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.45;
}

.form-group input:not([type='checkbox']):not([type='radio']):focus,
.form-group select:focus,
.form-group textarea:focus,
.venc-date-input:focus,
.venc-dias-number:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--brand-orange-soft);
}

.form-group input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-orange);
  cursor: pointer;
  flex-shrink: 0;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-box-highlight {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-default);
  padding: 14px;
  border-radius: var(--radius-md);
}

#cli-categorias {
  font-family: var(--font-mono);
  font-size: 12px;
}

.presets-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.preset-cat-btn {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--surface-panel);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  transition: transform 0.15s var(--ease), filter 0.15s var(--ease), border-color 0.15s var(--ease);
}

.preset-cat-btn.cat-adega {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border-color: rgba(124, 58, 237, 0.3);
}

.preset-cat-btn.cat-mercado {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.preset-cat-btn.cat-acougue {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

.preset-cat-btn.cat-hortifruti {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.3);
}

.preset-cat-btn.cat-padaria {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border-color: rgba(236, 72, 153, 0.3);
}

.preset-cat-btn.cat-conveniencia {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border-color: rgba(6, 182, 212, 0.3);
}

.preset-cat-btn.cat-tabacaria {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.preset-cat-btn.cat-vestuario {
  background: rgba(217, 70, 239, 0.15);
  color: #e879f9;
  border-color: rgba(217, 70, 239, 0.3);
}

.preset-cat-btn.cat-geral {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.3);
}

.preset-cat-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.preset-cat-btn:active {
  transform: scale(0.97);
}

.categorias-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  min-height: 24px;
  width: 100%;
  align-items: center;
}

.categoria-chip-preview {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--surface-panel);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1.2;
}

.vencimento-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.venc-feedback-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--ok);
  font-family: var(--font-mono);
}

.vencimento-inputs-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.venc-date-input {
  flex: 1;
  min-width: 160px;
}

.venc-add-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.venc-dias-number {
  width: 88px;
  text-align: center;
  font-family: var(--font-mono);
}

.quick-days-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.quick-day-btn {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--surface-panel);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease);
}

.quick-day-btn.cortesia {
  background: rgba(243, 146, 55, 0.12);
  color: var(--brand-orange);
  border-color: rgba(243, 146, 55, 0.3);
}

.quick-day-btn.normal {
  background: var(--accent-cyan-soft);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
}

.quick-day-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

/* ==========================================================================
   PLANOS & TERMINAIS
   ========================================================================== */
.titulo-planos-cadastrados {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 18px 0 12px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.plano-card-item {
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.plano-card-item:hover {
  border-color: rgba(243, 146, 55, 0.4);
  background: rgba(30, 49, 68, 0.9);
}

.terminal-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.terminal-item-card:hover {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(56, 189, 248, 0.3);
}

.terminal-item-info {
  flex: 1;
  min-width: 0;
}

/* ==========================================================================
   RESPONSIVE ? 1100 / 768 / 480
   ========================================================================== */
@media (max-width: 1100px) {
  #login-screen:has(> .login-brand-pane),
  .login-screen:has(> .login-brand-pane) {
    grid-template-columns: 1fr !important;
  }

  .login-brand-pane {
    padding: 32px 28px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    min-height: auto;
  }

  .login-brand-pane .login-subtitle,
  .login-brand-pane .login-tagline {
    font-size: 15px;
    max-width: none;
  }

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

  .stat-cell:nth-child(odd),
  .metrics-grid .metric-card:nth-child(odd) {
    border-left: none;
  }

  .stat-cell:nth-child(n + 3),
  .metrics-grid .metric-card:nth-child(n + 3) {
    border-top: 1px solid var(--border-default);
  }

  .stat-cell:nth-child(even),
  .metrics-grid .metric-card:nth-child(even) {
    border-left: 1px solid var(--border-default);
  }

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

  .topbar,
  .master-header {
    flex-wrap: wrap;
  }

  .modal-drawer {
    width: min(100%, 560px);
    min-width: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --space: 12px;
  }

  .app-container {
    padding: 0 12px 24px;
  }

  .topbar,
  .master-header {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    margin: 10px 0 14px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  #master-logged-user,
  .header-user-chip {
    grid-column: 1 / 2;
    max-width: none;
    width: 100%;
  }

  #btn-header-logout {
    grid-column: 2 / 3;
    width: 100%;
    justify-content: center;
  }

  #btn-header-auditoria,
  #btn-header-planos {
    width: 100%;
    justify-content: center;
  }

  #btn-header-novo-cliente {
    grid-column: 1 / -1;
    width: 100%;
  }

  .toolbar,
  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: 0;
    width: 100%;
  }

  .filter-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .filter-btn {
    padding: 8px 4px;
    font-size: 11px;
    text-align: center;
    justify-content: center;
  }

  .data-panel,
  .table-section {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }

  .master-table,
  .master-table tbody {
    display: block;
    width: 100%;
  }

  .master-table thead {
    display: none;
  }

  .master-table tr.master-table-row {
    display: flex;
    flex-direction: column;
    background: var(--surface-raised) !important;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    gap: 4px;
  }

  .master-table tr.master-table-row td,
  .master-table tr.master-table-row:hover td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
    gap: 8px;
    background: transparent !important;
  }

  .master-table tr.master-table-row td.cell-store {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-default);
    justify-content: flex-start;
  }

  .master-table tr.master-table-row td.cell-acoes {
    border-bottom: none;
    padding-top: 10px;
    justify-content: stretch;
  }

  .master-table tr.master-table-row td.cell-acoes .btn-editar-modern {
    width: 100%;
    padding: 12px;
    font-size: 14px;
  }

  .mobile-td-label {
    display: inline-block;
  }

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

  .form-group.span-2 {
    grid-column: span 1;
  }

  .modal-overlay {
    padding: 8px;
  }

  .modal-sheet,
  .modal-card {
    max-width: 100%;
    width: 100%;
    max-height: 94vh;
    height: 94vh;
    border-radius: 14px;
  }

  .modal-drawer {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-left: none;
  }

  .modal-head,
  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-foot,
  .modal-footer {
    padding: 12px 14px;
  }

  .modal-footer-main-row {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 8px;
  }

  .btn-modal-footer {
    width: 100%;
    min-width: 0;
    font-size: 13px !important;
  }

  #btn-excluir-cliente {
    width: 100% !important;
  }

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

  .page-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  #form-cadastrar-plano > div:first-of-type {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  #modal-auditoria .modal-body > div:first-of-type {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  #modal-auditoria .modal-body > div:first-of-type > div {
    min-width: 100% !important;
  }
}

@media (max-width: 480px) {
  .stats-strip,
  .metrics-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-cell,
  .metrics-grid .metric-card,
  .stats-strip .metric-card {
    border-left: none !important;
  }

  .stat-cell + .stat-cell,
  .metrics-grid .metric-card + .metric-card {
    border-top: 1px solid var(--border-default);
  }

  .metric-value,
  .stat-value {
    font-size: 22px;
  }

  .filter-btn {
    font-size: 10px;
    padding: 6px 2px;
  }

  .presets-category-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .quick-days-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-card {
    padding: 28px 20px 24px;
  }

  .brand-title {
    font-size: 16px;
  }

  .categoria-chip-preview {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .form-box-highlight {
    padding: 12px;
  }

  .vencimento-inputs-row {
    flex-direction: column;
    align-items: stretch;
  }

  .venc-add-group {
    width: 100%;
  }

  .venc-dias-number {
    flex: 1;
  }

  .btn-add-dias {
    flex: 1;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Layout v3.0 extras (HTML structure hooks) --- */
.login-brand-points {
  list-style: none;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.login-brand-points li {
  font-size: 14px;
  font-weight: 650;
  color: #cbd5e1;
  padding-left: 18px;
  position: relative;
}
.login-brand-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-orange);
}
.login-form-inner { width: 100%; max-width: 400px; }
.login-form-title {
  margin: 10px 0 6px;
  font-size: 26px;
  font-weight: 850;
  color: #f8fafc;
  letter-spacing: -0.03em;
}
.login-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.login-access-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.25);
}
.page-hero-title {
  margin: 0;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: #f8fafc;
}
.page-hero-sub {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
}
.stat-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value { display: block; }
.stat-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.data-panel-scroll { overflow: auto; width: 100%; }
.modal-brand-thumb {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
}
.modal-footer, .modal-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.22);
}
.modal-footer-main-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.nav-pill { min-height: 38px; }

/* ==========================================================================
   v3.1 ? SIDEBAR SHELL + LICENSE CARDS (layout break from old table dashboard)
   ========================================================================== */
:root {
  --sidebar-w: 248px;
}

.app-shell--sidebar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  width: 100%;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.35) 0%, transparent 40%),
    var(--surface-body);
}

#app-container[style*="display: none"],
#login-screen[style*="display: none"] {
  display: none !important;
}

.app-shell--sidebar .sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px;
  background: linear-gradient(180deg, #1e3144 0%, #182937 100%);
  border-right: 1px solid var(--border-default);
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

/* Wordmark for dark surfaces: Flow white ? PDV orange */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.brand-mark-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
}

.brand-mark-word {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
}

.brand-flow {
  color: #ffffff !important;
}

.brand-pdv {
  color: var(--brand-orange) !important;
}

.brand-mark--lg .brand-mark-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
}

.brand-mark--lg .brand-mark-word {
  font-size: 34px;
}

.login-brand-pane .brand-mark {
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.sidebar-logo {
  width: min(100%, 168px);
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.side-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.side-link.is-active {
  background: var(--brand-orange-soft);
  border-color: rgba(243, 146, 55, 0.35);
  color: #fff;
}

.side-link-ico {
  width: 22px;
  text-align: center;
  opacity: 0.85;
  font-size: 14px;
}

.sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-logout {
  width: 100%;
  justify-content: center;
}

.app-shell--sidebar .stage {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 28px 36px;
  overflow-x: hidden;
}

.stage-header {
  display: block;
  width: 100%;
}

.stage-heading {
  width: 100%;
}

.stage-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

.stage-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.stage-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #fff;
  line-height: 1;
  margin: 0;
}

.stage-title-row .btn-novo-cliente,
.stage-title-row .btn-primary-cta {
  flex-shrink: 0;
  height: 42px;
  margin: 0;
}

/* KPI rail ? compact strip, not big dashboard cards */
.app-shell--sidebar .kpi-rail,
.app-shell--sidebar .metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
  border-radius: 0;
}

.app-shell--sidebar .kpi,
.app-shell--sidebar .metrics-grid .metric-card {
  background: var(--surface-raised);
  border: 1px solid var(--border-default) !important;
  border-radius: var(--radius-md) !important;
  padding: 14px 16px;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  min-height: 0;
}

.app-shell--sidebar .kpi + .kpi,
.app-shell--sidebar .metrics-grid .metric-card + .metric-card {
  border-left: 1px solid var(--border-default) !important;
}

.app-shell--sidebar .kpi::before,
.app-shell--sidebar .metrics-grid .metric-card::before {
  display: none;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.kpi-value,
.app-shell--sidebar .metric-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.2;
}

.app-shell--sidebar .kpi.mrr .kpi-value,
.app-shell--sidebar .metric-card.mrr .metric-value {
  color: var(--ok);
  font-family: var(--font-mono);
  font-size: 18px;
}

.kpi-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.app-shell--sidebar .stage-tools,
.app-shell--sidebar .toolbar,
.app-shell--sidebar .controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* License board ? card grid instead of table */
.license-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  align-content: start;
}

.license-empty {
  grid-column: 1 / -1;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface-panel);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
  font-weight: 600;
}

.license-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 14px;
  background: linear-gradient(165deg, #334d68 0%, var(--surface-raised) 48%);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.license-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ok);
}

.license-card.tone-warn::before { background: var(--warn); }
.license-card.tone-danger::before { background: var(--danger); }

.license-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.license-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lic-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  flex-shrink: 0;
}

.lic-avatar--emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.license-card-id {
  flex: 1;
  min-width: 0;
}

.license-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.25;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.license-meta {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.license-status {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.license-status.status-ok {
  background: var(--ok-soft);
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.28);
}

.license-status.status-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.28);
}

.license-status.status-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.28);
}

.license-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.28);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.lic-k {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.lic-v {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.lic-v.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.lic-v.link {
  color: var(--accent-cyan);
  text-decoration: none;
}

.lic-v.link:hover {
  text-decoration: underline;
}

.lic-s {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.license-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.license-key {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan-bright);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.license-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .app-shell--sidebar .kpi-rail,
  .app-shell--sidebar .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell--sidebar {
    flex-direction: column;
  }

  .app-shell--sidebar .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
  }

  .sidebar-brand {
    flex-direction: row;
    align-items: center;
    border-bottom: none;
    margin: 0;
    padding: 0 8px 0 0;
  }

  .sidebar-logo {
    width: 120px;
  }

  .brand-mark-icon {
    width: 34px;
    height: 34px;
  }

  .brand-mark-word {
    font-size: 18px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex: 1;
    flex-wrap: wrap;
  }

  .side-link {
    width: auto;
    padding: 8px 12px;
  }

  .sidebar-foot {
    flex-direction: row;
    align-items: center;
    border-top: none;
    padding-top: 0;
    width: 100%;
  }

  .side-logout {
    width: auto;
  }

  .app-shell--sidebar .stage {
    padding: 16px 14px 28px;
  }

  .stage-title {
    font-size: 22px;
  }

  .license-board {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   v3.2.1 ? Modal cliente polido (sheet + abas)
   ========================================================================== */
#modal-cliente.modal-overlay {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-cliente-sheet {
  width: min(680px, 96vw);
  max-width: 680px;
  height: auto;
  max-height: min(88vh, 820px);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #334d68 0%, var(--surface-raised) 28%);
  border: 1px solid var(--border-default);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  animation: sheetIn 0.22s var(--ease);
}

.modal-cliente-sheet .modal-head,
.modal-cliente-sheet .modal-header {
  padding: 16px 20px;
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-cliente-sheet .modal-header-titles h3 {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.cli-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  margin: 0 12px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.cli-tabs::-webkit-scrollbar {
  display: none;
}

.cli-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex: 1 1 auto;
  text-align: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.cli-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.cli-tab.is-active {
  color: #fff;
  background: var(--brand-orange-soft);
  border-color: rgba(243, 146, 55, 0.4);
  box-shadow: inset 0 0 0 1px rgba(243, 146, 55, 0.12);
}

.modal-body--tabs {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 8px;
  background: transparent;
}

.cli-tab-panel[hidden] {
  display: none !important;
}

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

.cli-tab-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px;
  font-weight: 500;
  line-height: 1.4;
}

.cli-logo-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.28);
  border: 1px solid var(--border-default);
  border-radius: 14px;
}

.cli-logo-avatar {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: var(--surface-inset);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  overflow: hidden;
}

.cli-logo-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cli-logo-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cli-logo-meta strong {
  font-size: 13px;
  color: #fff;
}

.cli-logo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.cli-logo-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.btn-attach-logo {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(243, 146, 55, 0.45);
  background: var(--brand-orange-soft);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.btn-attach-logo:hover {
  background: rgba(243, 146, 55, 0.28);
}

.cli-logo-url {
  width: 100%;
  min-width: 0;
  height: 36px !important;
  font-size: 12px !important;
  padding: 0 10px !important;
}

.cli-logo-ready {
  font-size: 10px;
  font-weight: 800;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: var(--radius-pill);
  padding: 3px 8px;
}

.modal-cliente-sheet .cli-form-grid,
.modal-cliente-sheet .form-grid {
  gap: 12px 14px;
}

.modal-cliente-sheet .form-group label {
  font-size: 11px;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.modal-cliente-sheet .form-group input:not([type='checkbox']):not([type='radio']),
.modal-cliente-sheet .form-group select,
.modal-cliente-sheet .form-group textarea,
.modal-cliente-sheet .cli-logo-url {
  height: 40px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.45);
  border-color: var(--border-default);
}

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

.mod-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.mod-chip:hover {
  border-color: var(--border-strong);
}

.mod-chip:has(input:checked) {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
}

.mod-chip input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-cyan);
  flex-shrink: 0;
}

.cli-subbox {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.32);
  border: 1px solid var(--border-default);
  border-radius: 12px;
}

.cli-subbox strong,
.cli-subbox > label {
  display: block;
  color: var(--accent-cyan-bright);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.cli-subbox--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cli-subbox--row select {
  min-width: 180px;
  height: 38px;
  border-radius: 8px;
}

.voucher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 6px;
}

.voucher-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.modal-cliente-sheet .presets-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.modal-cliente-sheet .preset-cat-btn {
  height: 40px;
  border-radius: 10px;
  font-size: 12px;
}

.modal-cliente-sheet .form-box-highlight {
  padding: 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.28);
  border: 1px solid var(--border-default);
}

.modal-cliente-sheet .quick-days-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.modal-cliente-sheet .quick-day-btn {
  height: 34px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.cli-chave-row {
  display: flex;
  gap: 8px;
}

.cli-chave-row input {
  flex: 1;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--accent-cyan-bright);
  letter-spacing: 0.4px;
}

.cli-chave-row .btn-sec {
  height: 40px;
  padding: 0 14px;
  flex-shrink: 0;
}

#cli-pin-gerente {
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 16px;
}

.cli-term-limit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cli-term-limit input {
  width: 70px;
  height: 38px;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--accent-cyan);
  border-radius: 8px;
}

.cli-term-list {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.cli-term-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.cli-term-list-head strong {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

#cli-terminais-lista-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-footer--cliente {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.28);
  flex-wrap: wrap;
}

.modal-footer--cliente .modal-footer-main-row {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.btn-excluir-inline {
  width: auto !important;
  margin: 0 !important;
  height: 40px;
  padding: 0 14px;
  font-size: 12px;
}

@media (max-width: 640px) {
  #modal-cliente.modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-cliente-sheet {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
  }

  .mod-grid,
  .modal-cliente-sheet .presets-category-grid {
    grid-template-columns: 1fr 1fr;
  }

  .modal-cliente-sheet .quick-days-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cli-logo-card {
    grid-template-columns: 64px 1fr;
  }

  .cli-logo-actions {
    grid-template-columns: 1fr;
  }

  .cli-tabs {
    margin: 0 10px;
    padding: 6px;
  }

  .cli-tab {
    padding: 8px 8px;
    font-size: 11px;
  }
}

/* ==========================================================================
   v3.2.2 ? Modal premium polish
   ========================================================================== */
.modal-cliente-sheet {
  background: #2a4058 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.modal-cliente-sheet .modal-eyebrow {
  color: var(--brand-orange) !important;
  letter-spacing: 0.14em;
}

.modal-cliente-sheet .modal-header-titles h3 {
  color: #fff !important;
  font-weight: 800;
}

.modal-cliente-sheet .cli-tab-hint {
  color: #cbd5e1 !important;
  font-size: 13px;
}

.modal-cliente-sheet .form-group label,
.modal-cliente-sheet .box-label,
.modal-cliente-sheet .cli-subbox > label,
.modal-cliente-sheet .cli-subbox strong {
  color: #e2e8f0 !important;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.01em;
}

.modal-cliente-sheet .cli-logo-sub,
.modal-cliente-sheet .cli-tab-hint {
  color: #94a3b8 !important;
}

.modal-cliente-sheet .form-group input:not([type='checkbox']):not([type='radio']),
.modal-cliente-sheet .form-group select,
.modal-cliente-sheet .cli-logo-url {
  color: #f8fafc !important;
  background: #1e3144 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.modal-cliente-sheet .form-group input::placeholder,
.modal-cliente-sheet .cli-logo-url::placeholder {
  color: #64748b !important;
}

.modal-cliente-sheet #cli-categorias {
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  color: #f1f5f9 !important;
  font-size: 13px !important;
}

.modal-cliente-sheet .categorias-preview span,
.modal-cliente-sheet .categorias-preview .cat-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.cli-logo-actions {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
}

.cli-logo-url.is-local-file {
  color: #6ee7b7 !important;
  font-weight: 700;
  cursor: default;
}

.btn-logo-clear {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.4);
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.btn-logo-clear:hover {
  color: #fff;
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(239, 68, 68, 0.15);
}

/* Presets unificados (sem arco-iris) */
.modal-cliente-sheet .preset-cat-btn,
.modal-cliente-sheet .preset-cat-btn[class*='cat-'] {
  background: #1e3144 !important;
  color: #f1f5f9 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.modal-cliente-sheet .preset-cat-btn:hover {
  border-color: rgba(243, 146, 55, 0.45) !important;
  background: rgba(243, 146, 55, 0.12) !important;
  color: #fff !important;
}

/* Quick days unificados */
.modal-cliente-sheet .quick-day-btn,
.modal-cliente-sheet .quick-day-btn.cortesia,
.modal-cliente-sheet .quick-day-btn.normal {
  background: #1e3144 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.modal-cliente-sheet .quick-day-btn:hover {
  border-color: rgba(243, 146, 55, 0.5) !important;
  color: #fff !important;
  background: rgba(243, 146, 55, 0.14) !important;
}

.modal-cliente-sheet .mod-chip {
  background: #1e3144;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.modal-cliente-sheet .mod-chip:has(input:checked) {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
}

.modal-cliente-sheet .cli-subbox {
  background: #24384c;
  border-color: rgba(255, 255, 255, 0.1);
}

.modal-cliente-sheet .form-box-highlight {
  background: #24384c !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.modal-cliente-sheet .venc-feedback-badge {
  color: #6ee7b7 !important;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

/* Footer sempre em uma linha */
.modal-footer--cliente {
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100%;
}

.modal-footer--cliente #btn-excluir-cliente.btn-excluir-modal {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
  display: none;
}

.modal-footer--cliente #btn-excluir-cliente[style*='inline-flex'],
.modal-footer--cliente #btn-excluir-cliente[style*='flex'] {
  display: inline-flex !important;
}

.modal-footer--cliente .modal-footer-main-row {
  margin-left: auto !important;
  flex: 0 0 auto;
}

.modal-cliente-sheet .btn-pri {
  box-shadow: none !important;
  background: var(--brand-orange) !important;
}

.modal-cliente-sheet .btn-pri:hover {
  background: var(--brand-orange-deep) !important;
  filter: none;
}

.modal-cliente-sheet .cli-tabs {
  background: #1e3144;
  border-color: rgba(255, 255, 255, 0.08);
}

.modal-cliente-sheet .cli-tab {
  color: #94a3b8;
}

.modal-cliente-sheet .cli-tab.is-active {
  color: #fff;
  background: rgba(243, 146, 55, 0.18);
  border-color: rgba(243, 146, 55, 0.45);
}

@media (max-width: 640px) {
  .modal-footer--cliente {
    flex-wrap: wrap !important;
  }

  .cli-logo-actions {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   v3.2.3 ? Modal cliente: footer row + selects escuros + altura auto
   ========================================================================== */
.modal-cliente-sheet {
  height: auto !important;
  max-height: min(90vh, 780px) !important;
  color-scheme: dark;
}

.modal-cliente-sheet .modal-body--tabs {
  flex: 0 1 auto !important;
  max-height: calc(90vh - 190px);
  padding-bottom: 18px !important;
}

/* Footer: UMA linha ? Excluir | ..... | Cancelar | Salvar */
.modal-cliente-sheet > .modal-footer,
.modal-cliente-sheet .modal-footer--cliente,
#modal-cliente .modal-footer.modal-footer--cliente {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  padding: 14px 18px !important;
  margin: 0 !important;
  width: 100% !important;
  box-sizing: border-box;
  background: #24384c !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.modal-footer-spacer {
  flex: 1 1 auto;
  min-width: 8px;
}

#modal-cliente #btn-excluir-cliente,
#modal-cliente .btn-danger-ghost {
  width: auto !important;
  min-width: 88px;
  height: 42px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border-radius: 10px;
  background: transparent;
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.45);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex: 0 0 auto;
}

#modal-cliente #btn-excluir-cliente:hover,
#modal-cliente .btn-danger-ghost:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #fff;
  border-color: #f87171;
}

#modal-cliente .modal-footer--cliente .btn-modal-footer {
  width: auto !important;
  min-width: 110px;
  height: 42px !important;
  flex: 0 0 auto;
  margin: 0 !important;
}

#modal-cliente .modal-footer--cliente .btn-pri {
  min-width: 160px;
  box-shadow: none !important;
}

/* Todos os selects do modal ? sem fundo branco do Windows */
.modal-cliente-sheet select,
.modal-cliente-sheet .cli-select,
#modal-cliente select {
  appearance: none !important;
  -webkit-appearance: none !important;
  color-scheme: dark !important;
  background-color: #1e3144 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 10px !important;
  height: 42px !important;
  padding: 0 36px 0 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
}

.modal-cliente-sheet select option,
#modal-cliente select option {
  background: #1e3144;
  color: #f8fafc;
}

.cli-atendimento {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 240px);
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 14px !important;
}

.cli-atendimento-copy label {
  display: block;
  margin-bottom: 4px;
  color: #f1f5f9 !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

.cli-atendimento .cli-select {
  width: 100%;
}

.modal-cliente-sheet .cli-logo-card {
  background: #24384c;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-cliente-sheet .mod-chip {
  min-height: 44px;
}

@media (max-width: 640px) {
  #modal-cliente .modal-footer.modal-footer--cliente {
    flex-wrap: wrap !important;
  }

  .modal-footer-spacer {
    display: none;
  }

  #modal-cliente #btn-excluir-cliente {
    order: 3;
    width: 100% !important;
  }

  .cli-atendimento {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   v3.2.4 ? Categorias premium + Excluir sem bug visual
   ========================================================================== */
#modal-cliente #btn-excluir-cliente,
#modal-cliente .btn-danger-ghost {
  all: unset;
  box-sizing: border-box;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: 42px;
  min-width: 96px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.5) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  color: #fca5a5 !important;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  outline: none !important;
  box-shadow: none !important;
  flex: 0 0 auto;
}

#modal-cliente #btn-excluir-cliente[hidden] {
  display: none !important;
}

#modal-cliente #btn-excluir-cliente:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  color: #fff !important;
  border-color: #f87171 !important;
}

.cli-cat-board {
  margin-top: 16px;
  padding: 14px;
  background: #24384c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

.cli-cat-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cli-cat-board-head strong {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.cli-cat-count {
  font-size: 11px;
  font-weight: 800;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
}

.cli-cat-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 44px;
  align-content: start;
  margin-bottom: 14px;
}

.cli-cat-empty {
  margin: 0;
  grid-column: 1 / -1;
  padding: 16px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.35);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.cli-cat-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: none;
  min-height: 38px;
  height: 38px;
  padding: 0 8px 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1e3144;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.cli-cat-chip:hover {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(239, 68, 68, 0.12);
}

.cli-cat-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: none;
  flex: 1;
  min-width: 0;
}

.cli-cat-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.cli-cat-chip:hover .cli-cat-chip-x {
  background: rgba(248, 113, 113, 0.25);
  color: #fecaca;
}

@media (max-width: 640px) {
  .cli-cat-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.cli-cat-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.cli-cat-add-row input {
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1e3144;
  color: #f8fafc;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.cli-cat-add-row input:focus {
  outline: none;
  border-color: rgba(243, 146, 55, 0.55);
  box-shadow: 0 0 0 3px rgba(243, 146, 55, 0.15);
}

.cli-cat-advanced {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}

.cli-cat-advanced summary {
  cursor: pointer;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  user-select: none;
  list-style: none;
}

.cli-cat-advanced summary::-webkit-details-marker {
  display: none;
}

.cli-cat-advanced summary::before {
  content: '? ';
  color: var(--brand-orange);
}

.cli-cat-advanced[open] summary::before {
  content: '? ';
}

.cli-cat-advanced textarea {
  margin-top: 10px;
  width: 100%;
  min-height: 72px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #1e3144;
  color: #e2e8f0;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  resize: vertical;
}

.modal-cliente-sheet .presets-category-grid {
  gap: 8px !important;
}

.modal-cliente-sheet .preset-cat-btn {
  height: 42px !important;
}

/* ==========================================================================
   v3.2.6 — Altura fixa do modal + gap header/tabs + Plano organizado
   ========================================================================== */
#modal-cliente .modal-cliente-sheet {
  height: min(720px, 90vh) !important;
  max-height: min(720px, 90vh) !important;
  min-height: min(720px, 90vh) !important;
  display: flex !important;
  flex-direction: column !important;
}

#modal-cliente .modal-cliente-sheet > .modal-head,
#modal-cliente .modal-cliente-sheet > .modal-header {
  flex: 0 0 auto;
  padding: 18px 20px 14px !important;
  margin: 0 !important;
  border-bottom: none !important;
}

#modal-cliente .cli-tabs {
  flex: 0 0 auto;
  margin: 0 16px 12px !important;
  padding: 6px !important;
}

#modal-cliente .modal-body--tabs {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 4px 20px 16px !important;
}

#modal-cliente .modal-footer--cliente {
  flex: 0 0 auto;
}

/* Painel de aba sempre ocupa a área (evita jump visual interno) */
#modal-cliente .cli-tab-panel.is-active {
  min-height: 100%;
}

/* Plano */
.cli-plano-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cli-plano-card {
  padding: 14px;
  background: #24384c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

.cli-plano-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cli-plano-card-head strong {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

#modal-cliente .venc-feedback-badge {
  font-family: var(--font-sans) !important;
  font-size: 11px !important;
  font-weight: 800;
  color: #6ee7b7 !important;
  background: rgba(16, 185, 129, 0.14) !important;
  border: 1px solid rgba(52, 211, 153, 0.28) !important;
  border-radius: 999px;
  padding: 5px 10px;
  box-shadow: none !important;
}

.cli-plano-date-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr auto;
  gap: 10px;
  align-items: end;
}

.cli-plano-date-row .form-group {
  margin: 0;
}

.cli-plano-date-row .venc-dias-number,
.cli-plano-date-row .venc-date-input {
  width: 100%;
}

.cli-plano-add {
  height: 42px !important;
  min-width: 110px;
  padding: 0 14px !important;
  border-radius: 10px !important;
  background: #1e3144 !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  cursor: pointer;
}

.cli-plano-add:hover {
  background: rgba(243, 146, 55, 0.16) !important;
  border-color: rgba(243, 146, 55, 0.45) !important;
}

.cli-plano-quick-label {
  margin: 12px 0 8px !important;
}

#modal-cliente .quick-days-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin-top: 0 !important;
}

#modal-cliente .quick-day-btn {
  height: 38px !important;
  border-radius: 10px !important;
  background: #1e3144 !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

#modal-cliente .quick-day-btn:hover {
  border-color: rgba(243, 146, 55, 0.5) !important;
  background: rgba(243, 146, 55, 0.14) !important;
  color: #fff !important;
  transform: none !important;
  filter: none !important;
}

@media (max-width: 640px) {
  #modal-cliente .modal-cliente-sheet {
    height: 94vh !important;
    min-height: 94vh !important;
    max-height: 94vh !important;
  }

  .cli-plano-date-row {
    grid-template-columns: 1fr 1fr;
  }

  .cli-plano-add {
    grid-column: 1 / -1;
    width: 100%;
  }

  #modal-cliente .quick-days-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ==========================================================================
   v3.2.9 / v3.3.3 — Vencimento alinhado + chave bloqueada
   ========================================================================== */
#modal-cliente .cli-plano-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

#modal-cliente .cli-venc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

#modal-cliente .cli-venc-field label {
  display: block;
  height: 14px;
  line-height: 14px;
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
}

#modal-cliente .cli-venc-field .venc-date-input {
  width: 100%;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  display: flex;
  align-items: center;
  cursor: pointer;
}

#modal-cliente .cli-venc-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#modal-cliente .cli-venc-add-row .venc-dias-number {
  width: 76px;
  min-width: 76px;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
  margin: 0 !important;
  padding: 0 8px !important;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
}

#modal-cliente .cli-venc-add-row .cli-plano-add {
  flex: 1;
  width: auto !important;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
  margin: 0 !important;
  padding: 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #1e3144 !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  cursor: pointer;
  white-space: nowrap;
}

#modal-cliente .cli-venc-add-row .cli-plano-add:hover {
  background: rgba(243, 146, 55, 0.16) !important;
  border-color: rgba(243, 146, 55, 0.45) !important;
}

#modal-cliente #cli-vencimento::-webkit-calendar-picker-indicator {
  cursor: pointer !important;
  opacity: 0.85;
}

@media (max-width: 640px) {
  #modal-cliente .cli-plano-controls {
    grid-template-columns: 1fr;
  }
}

/* X das categorias — SVG centrado (restauração) */
#modal-cliente .cli-cat-chip-x {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px;
  min-height: 22px;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
  line-height: 0 !important;
  flex-shrink: 0;
}
#modal-cliente .cli-cat-chip-x svg {
  display: block;
  width: 10px;
  height: 10px;
}
#modal-cliente .cli-cat-chip:hover .cli-cat-chip-x {
  background: rgba(248, 113, 113, 0.28) !important;
  color: #fecaca !important;
}


/* ==========================================================================
   v3.3.0 — pagina premium: CTA na toolbar, KPIs em faixa, cards mais limpos
   ========================================================================== */
.app-shell--sidebar .stage {
  gap: 16px;
  padding: 28px 32px 40px;
  max-width: 1480px;
}

.stage-kicker {
  color: var(--brand-orange) !important;
  margin-bottom: 6px !important;
  letter-spacing: 0.16em !important;
}

.stage-title {
  font-size: 30px !important;
  letter-spacing: -0.045em !important;
}

.stage-sub {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
}

.app-shell--sidebar .kpi-rail,
.app-shell--sidebar .metrics-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0 !important;
  background: #2a4058 !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18) !important;
}

.app-shell--sidebar .kpi,
.app-shell--sidebar .metrics-grid .metric-card {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 16px 20px !important;
  min-height: 92px;
}

.app-shell--sidebar .kpi + .kpi,
.app-shell--sidebar .metrics-grid .metric-card + .metric-card {
  border-left: 1px solid rgba(255,255,255,0.08) !important;
}

.app-shell--sidebar .stage-tools,
.app-shell--sidebar .toolbar,
.app-shell--sidebar .controls-bar {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  padding: 8px !important;
  background: #2a4058 !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  border-radius: 14px !important;
}

.app-shell--sidebar .search-box {
  flex: 1 1 auto;
  min-width: 180px;
  height: 40px;
  background: #1e3144;
  border-color: rgba(255,255,255,0.08);
  border-radius: 10px;
}

.app-shell--sidebar .filter-group {
  flex: 0 0 auto;
  background: #1e3144;
  border-color: rgba(255,255,255,0.08);
  border-radius: 10px;
}

.app-shell--sidebar .btn-novo-cliente {
  flex: 0 0 auto;
  height: 40px !important;
  padding: 0 16px !important;
  border-radius: 10px !important;
  margin: 0 !important;
  box-shadow: none !important;
  white-space: nowrap;
}

.license-board {
  gap: 12px !important;
}

.license-card {
  background: #2e4660 !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

.license-card:hover {
  transform: translateY(-1px);
  border-color: rgba(243,146,55,0.28) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22) !important;
}

.license-actions .btn-ghost,
.license-actions .btn-sm,
.license-actions .btn-editar-modern {
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
}

@media (max-width: 980px) {
  .app-shell--sidebar .stage-tools {
    flex-wrap: wrap !important;
  }
  .app-shell--sidebar .search-box {
    width: 100%;
    flex: 1 1 100%;
  }
  .app-shell--sidebar .btn-novo-cliente {
    margin-left: auto !important;
  }
  .app-shell--sidebar .kpi-rail,
  .app-shell--sidebar .metrics-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .app-shell--sidebar .kpi:nth-child(n+3),
  .app-shell--sidebar .metrics-grid .metric-card:nth-child(n+3) {
    border-top: 1px solid rgba(255,255,255,0.08) !important;
  }
}


/* ==========================================================================
   v3.3.1 — Modal: categorias em select, add no topo, plano compacto
   ========================================================================== */
#modal-cliente .cli-cat-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  margin-bottom: 14px;
  align-items: end;
}

#modal-cliente .cli-cat-toolbar .form-group {
  margin: 0;
}

#modal-cliente .cli-cat-add-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

#modal-cliente .cli-cat-add-row input,
#modal-cliente .cli-cat-add-btn {
  height: 40px !important;
  min-height: 40px !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
  margin: 0 !important;
}

#modal-cliente .cli-cat-add-btn {
  padding: 0 14px;
  border: 1px solid rgba(243,146,55,0.5);
  background: rgba(243,146,55,0.16);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

#modal-cliente .cli-cat-add-btn:hover {
  background: rgba(243,146,55,0.28);
}

#modal-cliente .cli-cat-board {
  margin-top: 0;
}

#modal-cliente .cli-plano-stack {
  gap: 12px;
}

#modal-cliente .cli-plano-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#modal-cliente .cli-plano-top .form-group {
  margin: 0;
}

#modal-cliente .cli-plano-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

#modal-cliente .cli-plano-chave {
  margin: 0;
}

#modal-cliente .cli-plano-chave .cli-chave-row {
  align-items: stretch;
}

#modal-cliente .cli-plano-chave .cli-chave-row input,
#modal-cliente .cli-plano-chave .cli-chave-row .btn-sec {
  height: 42px !important;
  min-height: 42px !important;
  box-sizing: border-box;
  border-radius: 10px;
  margin: 0;
}

#modal-cliente #cli-chave.cli-chave-locked,
#modal-cliente #cli-chave.cli-chave-locked:hover,
#modal-cliente #cli-chave.cli-chave-locked:focus,
#modal-cliente #cli-chave.cli-chave-locked:read-only,
#modal-cliente #cli-chave.cli-chave-locked:-webkit-autofill,
#modal-cliente #cli-chave.cli-chave-locked:-webkit-autofill:hover,
#modal-cliente #cli-chave.cli-chave-locked:-webkit-autofill:focus {
  background-color: #162433 !important;
  background-image: none !important;
  color: #7dd3fc !important;
  -webkit-text-fill-color: #7dd3fc !important;
  caret-color: transparent;
  cursor: default;
  border: 1px dashed rgba(125, 211, 252, 0.28) !important;
  box-shadow: inset 0 0 0 1000px #162433 !important;
  -webkit-box-shadow: inset 0 0 0 1000px #162433 !important;
  outline: none !important;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 0 14px !important;
  opacity: 1;
}

#modal-cliente .cli-plano-pin {
  margin: 0;
}

#modal-cliente .cli-plano-pin .cli-pin-row input,
#modal-cliente #cli-pin-gerente {
  width: 100%;
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
  padding: 0 14px !important;
  margin: 0 !important;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 15px;
  background: var(--surface-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

#modal-cliente #cli-pin-gerente:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--brand-orange-soft);
}

#modal-cliente .cli-plano-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

#modal-cliente .cli-plano-shortcuts .quick-day-btn {
  width: 100%;
  height: 36px !important;
  border-radius: 10px;
  background: #1e3144;
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

#modal-cliente .cli-plano-shortcuts .quick-day-btn:hover {
  border-color: rgba(243,146,55,0.45);
  background: rgba(243,146,55,0.14);
  color: #fff;
}

@media (max-width: 640px) {
  #modal-cliente .cli-cat-toolbar,
  #modal-cliente .cli-plano-top,
  #modal-cliente .cli-plano-controls {
    grid-template-columns: 1fr !important;
  }

  #modal-cliente .cli-plano-chave .cli-chave-row {
    flex-wrap: wrap;
  }

  #modal-cliente .cli-plano-chave .cli-chave-row .btn-sec {
    width: 100%;
  }
}

/* ==========================================================================
   v3.3.4 — Alinhamento Master com Flow, Vencimento 2 cols, Chave com padding,
            PIN do Gerente na aba Plano e aba renomeada para Terminal
   ========================================================================== */

/* Navegação compacta, sem reduzir toda a interface por zoom. */
@media (max-width: 640px) {
  .sidebar { display:flex!important; flex-direction:column!important; gap:14px!important; padding:16px!important; }
  .sidebar-brand { align-self:flex-start; }
  .sidebar-nav { width:100%; display:grid!important; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .sidebar-nav .side-link { min-width:0; min-height:44px; height:44px!important; max-height:44px; padding:10px 6px; justify-content:center; gap:6px; font-size:12px; }
  .sidebar-foot { display:flex!important; width:100%; gap:10px; margin-top:0!important; padding-top:0!important; }
  .sidebar-user { flex:1; min-width:0; }
  .side-logout { flex:0 0 64px; }
  .stage { min-width:0; padding:22px 16px!important; }
  input,select,textarea { font-size:16px!important; }
  .modal { max-width:calc(100vw - 20px); }
}
