/* ==========================================================
   BASE
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  /* V5.6.C.1 — kill horizontal overflow that caused the page to
     "jump" sideways on Chrome iPhone when an element exceeded vw. */
  overflow-x: hidden;
  max-width: 100%;
}
html { -webkit-text-size-adjust: 100%; } /* don't auto-resize text in landscape */

/* Force HTML5 hidden attribute to win against any display: rules below.
   Without this, `display: flex` on #login-screen overrides hidden. */
[hidden] { display: none !important; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button {
  font-family: inherit;
  cursor: pointer;
  /* V5.6.C.1 — disable double-tap zoom on action buttons + remove
     the iOS tap highlight that flashes blue under touches. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
/* V5.6.C.1 — iOS auto-zooms ANY input < 16px on focus, then doesn't
   zoom back. The fix is a 16px minimum on all form fields. */
input, select, textarea {
  font-family: inherit;
  font-size: 16px;
  touch-action: manipulation;
}
a { color: #16a34a; text-decoration: none; -webkit-tap-highlight-color: transparent; }
code { font-family: ui-monospace, 'Cascadia Code', Menlo, monospace; font-size: 13px; }

/* ==========================================================
   LOGIN
   ========================================================== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  padding: 20px;
}
.login-box {
  background: white;
  padding: 40px 32px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-icon { font-size: 56px; margin-bottom: 12px; }
.login-title { margin: 0 0 8px; font-size: 24px; font-weight: 800; color: #1f2937; }
.login-subtitle { margin: 0 0 28px; font-size: 14px; color: #6b7280; }
.login-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  font-family: ui-monospace, 'Cascadia Code', Menlo, monospace;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 14px;
}
.login-input:focus { border-color: #16a34a; }
.login-error { color: #dc2626; font-size: 13px; min-height: 20px; margin: 0 0 12px; font-weight: 600; }
.btn-primary {
  background: #16a34a; color: white; border: none;
  padding: 14px 24px; font-size: 15px; font-weight: 700;
  border-radius: 10px; width: 100%;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: #15803d; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.login-hint { margin: 20px 0 0; font-size: 12px; color: #9ca3af; }

/* ==========================================================
   APP HEADER
   ========================================================== */
.app-header {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: white;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 12px rgba(22, 163, 74, 0.25);
  position: sticky; top: 0; z-index: 50;
}
.app-title { font-size: 20px; font-weight: 800; margin: 0; display: flex; align-items: center; gap: 8px; }
.header-actions { display: flex; gap: 8px; }
.btn-header {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
}
.btn-header:hover { background: rgba(255, 255, 255, 0.28); }

/* ==========================================================
   LAYOUT
   ========================================================== */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.section { margin-bottom: 28px; }
.section-title {
  font-size: 15px; font-weight: 700; color: #4b5563;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin: 0 0 12px; padding: 0 4px;
}

/* ==========================================================
   STATS
   ========================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border-top: 4px solid;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.stat-card.green  { border-color: #16a34a; }
.stat-card.orange { border-color: #f59e0b; }
.stat-card.blue   { border-color: #3b82f6; }
.stat-card.purple { border-color: #8b5cf6; }
.stat-label { font-size: 11px; color: #6b7280; text-transform: uppercase; font-weight: 700; letter-spacing: 0.6px; }
.stat-value { font-size: 28px; font-weight: 800; color: #111827; margin: 4px 0 0; }
.stat-sub { font-size: 12px; color: #9ca3af; margin-top: 2px; }

/* ==========================================================
   ACTIONS BAR
   ========================================================== */
.actions-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.btn {
  border: none;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: transform 0.08s, background 0.15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-create { background: #16a34a; color: white; }
.btn-create:hover:not(:disabled) { background: #15803d; }
.btn-refresh { background: white; color: #16a34a; border: 1.5px solid #16a34a; }
.btn-refresh:hover:not(:disabled) { background: #f0fdf4; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-secondary { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }
.btn-secondary:hover:not(:disabled) { background: #e5e7eb; }
.btn-orange { background: #f59e0b; color: white; }
.btn-orange:hover:not(:disabled) { background: #d97706; }
.btn-small { padding: 6px 12px; font-size: 12px; }

/* ==========================================================
   CLIENTS TABLE
   ========================================================== */
.clients-card { background: white; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); overflow: hidden; }
.clients-table { width: 100%; border-collapse: collapse; }
.clients-table th, .clients-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.clients-table th {
  background: #fafafa;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: #6b7280;
  letter-spacing: 0.5px;
}
.clients-table tr:last-child td { border-bottom: none; }
.clients-table tr:hover td { background: #f9fafb; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-orange{ background: #ffedd5; color: #9a3412; }
.token-mask { font-family: ui-monospace, monospace; font-size: 12px; color: #6b7280; }
.empty-state { padding: 40px; text-align: center; color: #9ca3af; }

/* ==========================================================
   MODALS
   ========================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
  overflow-y: auto;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: white;
  border-radius: 14px;
  max-width: 600px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-large { max-width: 800px; }
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { margin: 0; font-size: 18px; font-weight: 800; }
.modal-close {
  background: transparent; border: none; font-size: 22px;
  color: #9ca3af; padding: 0; line-height: 1;
}
.modal-close:hover { color: #1f2937; }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ==========================================================
   FORMS
   ========================================================== */
.form-row { margin-bottom: 14px; }
.form-row.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.form-required { color: #dc2626; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #16a34a; }
.form-textarea { font-family: ui-monospace, monospace; font-size: 12px; min-height: 70px; resize: vertical; }
.form-help { font-size: 11px; color: #9ca3af; margin-top: 3px; }

/* ==========================================================
   TOKENS DISPLAY (after create / regenerate)
   ========================================================== */
.tokens-block {
  background: #fef3c7;
  border: 2px solid #f59e0b;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.tokens-warn {
  font-weight: 700; color: #92400e;
  font-size: 13px; margin: 0 0 10px;
  display: flex; align-items: center; gap: 6px;
}
.token-row {
  background: white;
  padding: 10px 12px;
  border-radius: 7px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #fde68a;
}
.token-key { font-size: 11px; font-weight: 700; color: #92400e; min-width: 130px; text-transform: uppercase; }
.token-value {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  flex: 1;
  word-break: break-all;
  color: #1f2937;
}
.install-heading {
  margin: 18px 0 8px;
  font-size: 13px;
  color: #4b5563;
}
.install-block {
  background: #1f2937;
  color: #f3f4f6;
  padding: 14px 16px;
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

/* ==========================================================
   DETAIL VIEW
   ========================================================== */
.detail-section {
  padding: 14px 0;
  border-bottom: 1px solid #f3f4f6;
}
.detail-section:last-child { border-bottom: none; }
.detail-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  font-weight: 700;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 18px;
  font-size: 13px;
}
.detail-key { color: #6b7280; }
.detail-val { font-weight: 600; color: #1f2937; word-break: break-all; }

.tm-state { margin-bottom: 8px; }
.tm-form { margin-top: 10px; }
.tm-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==========================================================
   TOAST
   ========================================================== */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #1f2937;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.25s ease-out;
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: #16a34a; }
#toast.error   { background: #dc2626; }
#toast.warning { background: #f59e0b; }

/* ==========================================================
   SPINNER
   ========================================================== */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid #e5e7eb;
  border-top-color: #16a34a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { color: #9ca3af; padding: 20px; text-align: center; }

/* ==========================================================
   V5.6.C — SEARCH BAR
   ========================================================== */
.search-bar {
  position: relative;
  margin-bottom: 12px;
}
.search-input {
  width: 100%;
  padding: 12px 38px 12px 14px;
  font-size: 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.08);
}
.search-clear {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  background: #e5e7eb;
  border: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-clear:hover { background: #d1d5db; }

/* ==========================================================
   V5.6.C — STATUS TABS
   ========================================================== */
.status-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 12px;
  margin: 0 -4px 12px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.status-tabs::-webkit-scrollbar { height: 4px; }
.status-tabs::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 4px; }

.status-tab {
  background: white;
  border: 1.5px solid #e5e7eb;
  color: #4b5563;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.status-tab:hover { border-color: #16a34a; color: #16a34a; }
.status-tab.is-active {
  background: #16a34a;
  border-color: #16a34a;
  color: white;
}
.status-tab-count {
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}
.status-tab.is-active .status-tab-count {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================
   V5.6.C — PAYMENTS PENDING SECTION
   ========================================================== */
.payments-card {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 12px;
}
.payment-row {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border: 1px solid #fde68a;
}
.payment-row:last-child { margin-bottom: 0; }
.payment-row-info { flex: 1; min-width: 220px; }
.payment-row-title { font-size: 14px; font-weight: 700; color: #1f2937; }
.payment-row-meta { font-size: 12px; color: #6b7280; margin-top: 2px; }
.payment-row-amount {
  font-size: 16px;
  font-weight: 800;
  color: #b45309;
  white-space: nowrap;
}
.payment-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================
   V5.6.C — CLIENT CARDS (mobile-first replacement for table)
   ========================================================== */
.clients-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}
.client-card {
  background: white;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  position: relative;
}
.client-card:hover {
  border-color: #16a34a;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.08);
}
.client-card-status-bar {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  border-radius: 12px 0 0 12px;
}
.client-card-status-bar.status-active   { background: #16a34a; }
.client-card-status-bar.status-pending  { background: #f59e0b; }
.client-card-status-bar.status-expired  { background: #6b7280; }
.client-card-status-bar.status-disabled { background: #dc2626; }

.client-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-left: 10px;
}
.client-card-identity { flex: 1; min-width: 0; }
.client-card-name {
  font-size: 15px;
  font-weight: 800;
  color: #111827;
  margin: 0 0 2px;
  word-break: break-word;
}
.client-card-email {
  font-size: 12.5px;
  color: #6b7280;
  word-break: break-all;
}
.client-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: #6b7280;
  padding-left: 10px;
  margin-bottom: 12px;
}
.client-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.client-card-meta-item strong {
  color: #1f2937;
  font-weight: 600;
}
.client-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 10px;
}

/* Status badges with consistent visual weight */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.status-pill.status-active   { background: #dcfce7; color: #166534; }
.status-pill.status-pending  { background: #ffedd5; color: #9a3412; }
.status-pill.status-expired  { background: #f3f4f6; color: #4b5563; }
.status-pill.status-disabled { background: #fee2e2; color: #991b1b; }

/* Per-card action buttons */
.btn-mini {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  border: 1.5px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s, border-color 0.15s;
  background: #f9fafb;
  color: #1f2937;
  border-color: #e5e7eb;
}
.btn-mini:hover { background: #f3f4f6; border-color: #d1d5db; }
.btn-mini.btn-mini-success { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.btn-mini.btn-mini-success:hover { background: #bbf7d0; }
.btn-mini.btn-mini-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn-mini.btn-mini-warning:hover { background: #fde68a; }
.btn-mini.btn-mini-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn-mini.btn-mini-danger:hover { background: #fecaca; }
.btn-mini.btn-mini-whatsapp { background: #25d366; color: white; border-color: #1ea34c; }
.btn-mini.btn-mini-whatsapp:hover { background: #1ea34c; }

/* ==========================================================
   V5.6.C — SHOPIFY INSTALL SECTION (in detail modal)
   ========================================================== */
.install-section {
  background: linear-gradient(135deg, #f0fdf4, #ffffff);
  border: 1.5px solid #bbf7d0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.install-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.install-step:last-child { margin-bottom: 0; }
.install-step-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: #16a34a;
  color: white;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}
.install-step-body { flex: 1; min-width: 0; }
.install-step-title { font-size: 13.5px; font-weight: 700; color: #166534; margin: 0 0 4px; }
.install-step-text { font-size: 13px; color: #1f2937; margin: 0; line-height: 1.5; }
.install-snippet {
  background: #1f2937;
  color: #f3f4f6;
  padding: 12px 14px;
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 8px;
  position: relative;
  max-height: 240px;
  overflow-y: auto;
}
.install-snippet-copy {
  background: #16a34a;
  color: white;
  border: none;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.install-snippet-copy:hover { background: #15803d; }

/* ==========================================================
   V5.6.C — SUBSCRIPTION ACTIONS BLOCK (in detail modal)
   ========================================================== */
.sub-actions-block {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.sub-actions-block .btn {
  padding: 12px 14px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sub-expires-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  background: #f3f4f6;
  color: #1f2937;
}
.sub-expires-pill.is-expired { background: #fee2e2; color: #991b1b; }
.sub-expires-pill.is-soon    { background: #fef3c7; color: #92400e; }
.sub-expires-pill.is-far     { background: #dcfce7; color: #166534; }

/* ==========================================================
   V5.6.C — CONFIRM MODAL
   ========================================================== */
.modal-confirm { max-width: 420px; }
.confirm-message {
  font-size: 14.5px;
  color: #1f2937;
  line-height: 1.55;
  margin: 0;
}

/* ==========================================================
   V5.6.C.1 — DEDUP BADGE in payments banner
   ========================================================== */
.dup-badge {
  display: inline-block;
  background: #f59e0b;
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: 1px;
  letter-spacing: 0.3px;
}

/* ==========================================================
   V5.6.C.1 — HOVER GUARD (mouse-only, prevents touch "stuck hover")
   ==========================================================
   On touch devices, :hover sticks AFTER tap until the user taps
   somewhere else, which made our cards "jump" by 3px and stay
   shifted. Wrapping all hover transforms behind (hover: hover)
   means only mice trigger them — touch gets a clean tap with no
   layout shift.
*/
@media (hover: hover) {
  .client-card:hover {
    border-color: #16a34a;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.08);
  }
  .btn:hover:not(:disabled) { transform: translateY(-1px); }
  .btn-mini:hover { background: #f3f4f6; border-color: #d1d5db; }
  .btn-mini.btn-mini-success:hover { background: #bbf7d0; }
  .btn-mini.btn-mini-warning:hover { background: #fde68a; }
  .btn-mini.btn-mini-danger:hover  { background: #fecaca; }
  .btn-mini.btn-mini-whatsapp:hover { background: #1ea34c; }
  .status-tab:hover { border-color: #16a34a; color: #16a34a; }
}
/* On touch (no hover capability), kill the hover transforms entirely
   so a tap doesn't leave the card visually shifted. */
@media (hover: none) {
  .client-card:hover,
  .btn:hover,
  .btn-mini:hover,
  .status-tab:hover { transform: none !important; }
  .client-card { transition: border-color 0.15s; }
  .btn { transition: background 0.15s; }
}

/* Active-press feedback for touch (subtle, no layout shift) */
.btn:active:not(:disabled),
.btn-mini:active,
.status-tab:active {
  filter: brightness(0.95);
}

/* ==========================================================
   MOBILE
   ========================================================== */
@media (max-width: 768px) {
  .container { padding: 16px 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .clients-table { display: none; } /* old table — hidden, replaced by .clients-list */
  .form-row.row-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .sub-actions-block { grid-template-columns: 1fr; }
  .app-title { font-size: 17px; }
  .btn-header { padding: 7px 11px; font-size: 12px; }
  .actions-bar .btn { flex: 1; min-width: 130px; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .install-section { padding: 12px; }
  .install-snippet { font-size: 11px; padding: 10px; } /* keep readable, no auto-zoom */
  .payment-row { padding: 10px 12px; }
  .payment-row-actions { width: 100%; }
  .payment-row-actions .btn { flex: 1; }

  /* V5.6.C.1 — sticky header was trapping a 1px overflow on iPhone
     when the title flexbox grew. Cap the inner row to 100vw and
     ensure the actions never push horizontally. */
  .app-header {
    max-width: 100vw;
    padding: 14px 14px;
  }
  .header-actions { flex-shrink: 0; }
  .container { max-width: 100vw; }

  /* V5.6.C.1 — modal max-height with safe scroll on small viewports */
  .modal {
    max-height: calc(100vh - 24px);
  }

  /* V5.6.C.1 — search input stays 16px so iOS doesn't zoom on focus */
  .search-input { font-size: 16px; }
  .form-input, .form-select, .form-textarea, .login-input { font-size: 16px; }
}

