:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg: #f3f4f6;
  --text: #1f2937;
  --card-bg: #ffffff;
  --border: #e5e7eb;
}

body {
  font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif);
  background-color: var(--color-canvas, var(--bg));
  color: var(--color-text-primary, var(--text));
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading, sans-serif);
  color: var(--color-text-primary, var(--text));
}

h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

h2 {
  font-size: 22px;
  font-weight: 600;
}

h3 {
  font-size: 18px;
  font-weight: 500;
}

[class*="muted"],
[class*="secondary"],
[class*="helper"],
[class*="subtitle"],
[class*="caption"],
[class*="meta"] {
  color: var(--color-text-secondary);
  font-size: 13px;
}

small,
.text-small {
  font-size: 13px;
  color: var(--color-text-secondary);
}

code, pre, .mono {
  font-family: var(--font-mono, monospace);
}

/* ── Page-level wrappers ──────────────────────────────── */
.page,
.main-content,
main,
#main,
.content-wrapper,
.container {
  background: var(--color-canvas);
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.container h2 {
  text-align: left;
  margin-bottom: 1rem;
}

/* ── Auth page centering layout ──────────────────────── */
body.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-canvas);
  padding: 24px;
  box-sizing: border-box;
}

body.auth-body .container {
  background: none;
  box-shadow: none;
  max-width: 440px;
  width: 100%;
  padding: 0;
  margin: 0;
}

/* ── Auth card ───────────────────────────────────────── */
#login-form,
#signup-form,
#forgot-form,
#studio-form,
#callback-card,
#reset-card {
  background: var(--color-surface);
  padding: 40px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-clay-raised);
  border: none;
  width: 100%;
  box-sizing: border-box;
}

/* ── Auth headings & subtitle ────────────────────────── */
.auth-heading {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 600;
  color: var(--color-navy);
  margin: 0 0 8px;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--color-text-secondary);
  margin: 0 0 24px;
}

/* ── Auth success message ────────────────────────────── */
.success-message {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Auth error message (inline, only when populated) ── */
.error:not(:empty) {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
}

.btn-google {
  background-color: #ffffff;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 9999px !important;
  width: 100% !important;
}

.btn-google:hover {
  background-color: #f9fafb;
}

.auth-nav-link {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--color-text-secondary);
}

.auth-nav-link a,
.auth-nav-link a:visited {
  color: var(--color-navy);
  text-decoration: none;
  font-weight: 500;
}

.auth-nav-link a:hover {
  text-decoration: underline;
}

/* ── Auth callback / reset state messages ────────────── */
.callback-state .callback-message {
  font-size: 1rem;
  color: var(--color-text-primary);
  margin: 0 0 1rem;
}

.callback-state .callback-error {
  color: var(--color-error-text);
}

.form-group {
  margin-bottom: 1.5rem;
}

/* ── Labels ──────────────────────────────────────────── */
label,
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

/* ── Inputs ──────────────────────────────────────────── */
input,
textarea,
select,
.form-group input {
  font-family: var(--font-body);
  font-size: 15px;
  height: 48px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-input);
  padding: 0 16px;
  background: white;
  color: var(--color-text-primary);
  transition: border-color var(--transition-hover), box-shadow var(--transition-hover);
  width: 100%;
  box-sizing: border-box;
}

textarea {
  height: auto;
  min-height: 120px;
  padding: 12px 16px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-navy);
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 40, 65, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: rgba(74, 96, 112, 0.6);
}

input:disabled,
textarea:disabled,
select:disabled {
  opacity: 0.5;
  background: var(--color-canvas);
  cursor: not-allowed;
}

input.error, input.is-invalid, input[aria-invalid="true"],
textarea.error, textarea.is-invalid, textarea[aria-invalid="true"],
select.error, select.is-invalid, select[aria-invalid="true"] {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(214, 69, 49, 0.15);
}


.error {
  color: #dc2626;
  margin-top: 1rem;
  text-align: center;
  min-height: 1.5em;
}

/* ── Top Navigation Bar ───────────────────────────────── */
.navbar,
.topbar,
header nav {
  background: var(--color-surface);
  box-shadow: var(--shadow-clay-standard);
  padding: 0 24px;
  height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1;
}

/* ── Brand wordmark & tagline (navbar + drawer) ─────── */
.brand-wordmark {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: #162841;
  line-height: 1;
}

.brand-tagline {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4A6070;
  line-height: 1;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-user button {
  width: auto;
  padding: 0.5rem 1rem;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tagline,
.brand-subtitle {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

/* ── Claymorphism Cards ────────────────────────────────── */
.card,
.panel,
.section,
.box,
.widget,
.metric-card,
.stat-card,
.info-card,
section,
article {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-clay-standard);
  border: none;
  padding: 24px;
}

/* Clickable / hoverable card lift */
.card.clickable, .card.hoverable, .card.interactive,
.panel.clickable, .panel.hoverable, .panel.interactive,
.metric-card, .stat-card, .info-card,
[onclick].card, [onclick].panel, [onclick].box {
  transition: all var(--transition-hover);
  cursor: pointer;
}

.card.clickable:hover, .card.hoverable:hover, .card.interactive:hover,
.panel.clickable:hover, .panel.hoverable:hover, .panel.interactive:hover,
.metric-card:hover, .stat-card:hover, .info-card:hover,
[onclick].card:hover, [onclick].panel:hover, [onclick].box:hover {
  box-shadow: var(--shadow-clay-raised);
  transform: translateY(-1px);
}

/* Dashboard Cards */
.main-content h1 {
  margin-bottom: 4px;
}

.card {
  margin-bottom: 2rem;
}

.card h3 {
  margin-top: 0;
}

.integration-status {
  margin: 1.5rem 0;
}

.status-badge,
.subscription-status,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-badge);
  font-size: 12px;
  font-weight: 500;
}

.status-badge.disconnected {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border: none;
  border-radius: var(--radius-badge);
  padding: 6px 16px;
  font-weight: 500;
}

.status-badge.loading {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.status-badge.connected {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: none;
  border-radius: var(--radius-badge);
  padding: 6px 16px;
  font-weight: 500;
}

/* ── Primary button ──────────────────────────────────── */
button,
.btn,
.btn-primary,
button[type="submit"],
.primary {
  font-family: var(--font-body);
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 28px;
  transition: all var(--transition-hover);
  cursor: pointer;
  min-height: 44px;
  background: var(--color-navy);
  color: white;
  border: none;
  box-shadow: var(--shadow-clay-light);
  width: auto;
}

button:hover,
.btn:hover,
.btn-primary:hover,
button[type="submit"]:hover,
.primary:hover {
  background: var(--color-navy-hover);
  transform: scale(1.02);
}

button:active,
.btn:active,
.btn-primary:active,
button[type="submit"]:active,
.primary:active {
  background: var(--color-navy-active);
  transform: scale(0.97);
}

button:disabled,
.btn:disabled,
.btn-primary:disabled,
button[type="submit"]:disabled,
.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Mindbody Integration States ─────────────────────────────────────── */

/* Card header: icon + title column */
.mb-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 1rem;
}

.mb-card-icon-wrap {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: rgba(22, 40, 65, 0.08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mb-card-title-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mb-state {
  margin-top: 0.5rem;
}

/* Status row (badge + meta) */
.mb-status-row {
  margin-bottom: 0.75rem;
}

.mb-message {
  margin: 0.5rem 0 0.75rem;
  line-height: 1.5;
}

.mb-meta {
  margin: 0.25rem 0 1rem;
  color: #6b7280;
  font-size: 0.9rem;
}

/* Pending activation / syncing badge */
.status-badge.status-pending {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border: none;
}

/* Pending action buttons row */
.mb-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ── Secondary button (outline) ──────────────────────── */
.btn-secondary,
.btn-outline {
  background: white;
  border: 2px solid var(--color-border);
  color: var(--color-navy);
  font-family: var(--font-body);
  border-radius: 9999px !important;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 20px;
  transition: all var(--transition-hover);
  cursor: pointer;
  min-height: 44px;
  width: auto;
}

.btn-secondary:hover,
.btn-outline:hover {
  background: white;
  border-color: var(--color-navy);
  transform: scale(1.02);
}

.btn-secondary:active,
.btn-outline:active {
  transform: scale(0.97);
}

/* ── Ghost / small inline button ─────────────────────── */
.btn-ghost {
  background: none;
  border: none;
  color: var(--color-navy);
  font-family: var(--font-body);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  transition: all var(--transition-hover);
  cursor: pointer;
  min-height: 36px;
  box-shadow: none;
  width: auto;
}

.btn-ghost:hover {
  background: rgba(22, 40, 65, 0.05);
  transform: none;
}

/* ── Danger button ───────────────────────────────────── */
.btn-danger {
  background: var(--color-error);
  color: white;
  border: none;
  font-family: var(--font-body);
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 500;
  padding: 12px 28px;
  transition: all var(--transition-hover);
  cursor: pointer;
  min-height: 44px;
  width: auto;
}

/* ── Destructive text link (Cancel Subscription, etc.) ── */
.btn-text-danger {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  min-height: unset;
  color: #D64531;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
  border-radius: 0;
  display: inline;
  width: auto;
  transform: none;
}

.btn-text-danger:hover {
  color: #B83829;
  background: none;
  box-shadow: none;
  transform: none;
  text-decoration: underline;
}

.btn-danger:hover {
  background: #B83829;
  transform: scale(1.02);
}

.btn-danger:active {
  background: #9C2F22;
  transform: scale(0.97);
}

/* Warning banner */
.warning-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  color: #92400e;
  margin: 0.75rem 0;
}

/* Field helpers and inline errors */
.field-helper {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.field-error {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: #dc2626;
}

.field-error a {
  color: #dc2626;
  text-decoration: underline;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 0.25rem;
}

.btn-secondary .spinner {
  border-color: rgba(79,70,229,0.3);
  border-top-color: var(--primary);
}

.spinner-dark {
  border-color: rgba(31,41,55,0.2);
  border-top-color: var(--text);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton loader */
.mb-skeleton-wrap {
  margin-top: 1rem;
}

.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-badge {
  height: 1.5rem;
  width: 7rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.skeleton-line {
  height: 1rem;
  width: 60%;
  margin-bottom: 1rem;
}

.skeleton-btn {
  height: 2.75rem;
  width: 10rem;
  border-radius: 4px;
}

/* ── Call Metrics Section ─────────────────────────────────────────────── */

.cm-period-label {
  font-size: 0.8rem;
  font-weight: 400;
  color: #6b7280;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Summary stat grid */
.cm-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cm-stat-card {
  background: var(--color-surface);
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-clay-standard);
  padding: 1rem 1.25rem;
}

/* ── Stat card icon circle ────────────────────────────── */
.cm-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cm-stat-value {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.cm-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cm-stat-sub {
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 0.2rem;
}

/* Table */
.cm-table-wrap {
  overflow-x: auto;
}

.cm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cm-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  white-space: nowrap;
}

/* ── Dashboard section headings ──────────────────────── */
.dashboard-section-h {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  color: var(--color-navy);
  margin-top: 0;
}

/* ── Call log table rows ─────────────────────────────── */
.cm-table tr {
  min-height: 52px;
}

.cm-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--color-text-primary);
  vertical-align: middle;
  height: 52px;
}

/* ── Call log status badges ──────────────────────────── */
.badge-booked {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border-radius: var(--radius-badge);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-missed {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border-radius: var(--radius-badge);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-info {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  border-radius: var(--radius-badge);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-new-client {
  background: rgba(22, 40, 65, 0.08);
  color: var(--color-navy);
  border-radius: var(--radius-badge);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-returning-client {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  border-radius: var(--radius-badge);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
}

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

.cm-table tbody tr:hover {
  background: var(--bg);
}

.cm-empty-msg {
  color: #6b7280;
  font-size: 0.9rem;
  padding: 1rem 0;
}

/* Skeleton states for call metrics */
.cm-skeleton-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cm-skeleton-stat {
  height: 5rem;
  border-radius: 6px;
}

.cm-skeleton-table {
  height: 8rem;
  border-radius: 6px;
}

/* Checkout error banner extras */
.checkout-error-banner {
  margin: 0;
  border-radius: 0;
  justify-content: space-between;
}

.checkout-banner-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: #92400e;
  padding: 0 0 0 0.75rem;
  flex-shrink: 0;
}

.checkout-banner-dismiss:hover {
  color: #78350f;
}

/* ── Subscription banners ────────────────────────────────────────────────── */

/* Trial info bar — subtle blue */
.sub-trial-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: #eff6ff;
  border-bottom: 1px solid #bfdbfe;
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  color: #1e40af;
  flex-wrap: wrap;
}

.sub-trial-link {
  color: #1d4ed8;
  font-weight: 500;
  text-decoration: underline;
  white-space: nowrap;
}

.sub-trial-link:hover {
  color: #1e3a8a;
}

/* Past-due banner — red */
.sub-past-due-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: #fef2f2;
  border-bottom: 1px solid #fca5a5;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  color: #991b1b;
  flex-wrap: wrap;
}

/* No-sub banner — yellow */
.sub-no-sub-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background-color: #fffbeb;
  border-bottom: 1px solid #fcd34d;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  color: #92400e;
  flex-wrap: wrap;
}

/* Banner action buttons */
.sub-banner-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: unset;
  box-shadow: none;
  transition: background 180ms ease-out, transform 120ms ease-out;
}

.sub-banner-btn-danger {
  background-color: #dc2626;
  color: #fff;
}

.sub-banner-btn-danger:hover {
  background-color: #b91c1c;
}

.sub-banner-btn-warning {
  background-color: #d97706;
  color: #fff;
}

.sub-banner-btn-warning:hover {
  background-color: #b45309;
}

/* Suspended note inside MB active state */
.mb-suspended-note {
  font-size: 0.875rem;
  color: #dc2626;
  margin: 0.5rem 0 0;
}

/* ── Billing page ─────────────────────────────────────────────────────────── */

.billing-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-clay-standard);
  border: none;
  padding: 24px;
}

.page-subtitle {
  font-size: 15px;
  color: #4A6070;
  margin: 4px 0 20px 0;
}

.billing-section-heading {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: #162841;
  margin: 0 0 12px 0;
  text-align: left;
}

.billing-section-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-navy);
  margin: 0 0 1rem;
}

.billing-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-size: 0.925rem;
}

.billing-row:last-of-type {
  border-bottom: none;
}

.billing-label {
  flex: 0 0 150px;
  color: var(--text-muted, #6b7280);
  font-size: 0.875rem;
}

.billing-value {
  flex: 1;
  color: var(--text, #111827);
  font-weight: 500;
}

.billing-total {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.1;
}

/* ── Plan Details card (redesigned) ──────────────────────────────────── */
.pd-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.10), -6px -6px 12px rgba(255, 255, 255, 0.9);
  padding: 28px;
}

/* Row 1: plan name + status badge */
.pd-row1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.pd-plan-name {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  color: #162841;
  line-height: 1.2;
}

/* Row 2: metric blocks */
.pd-metrics {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 24px;
}

.pd-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  padding: 0 16px;
}

.pd-metric:first-child {
  padding-left: 0;
}

.pd-metric:last-child {
  padding-right: 0;
}

.pd-metric-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4A6070;
  line-height: 1;
}

.pd-metric-number {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}

.pd-metric-billed { color: #162841; }
.pd-metric-active { color: #4CAF82; }
.pd-metric-rate   { color: #8C6918; }

/* Vertical divider between metric blocks */
.pd-metric-divider {
  width: 1px;
  background: #DDE4EC;
  margin: 4px 0;
  flex-shrink: 0;
  align-self: stretch;
}

/* Row 3: qty adjuster separator */
#qty-change-wrap {
  border-top: 1px solid #DDE4EC;
  padding-top: 16px;
}

/* Mobile: stack metric blocks */
@media (max-width: 540px) {
  .pd-metrics {
    flex-direction: column;
    gap: 16px;
  }
  .pd-metric {
    padding: 0;
  }
  .pd-metric-divider {
    display: none;
  }
  .pd-metric-number {
    font-size: 28px;
  }
}

/* Status badges */
.billing-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
}

.billing-badge-trial {
  background: rgba(22, 40, 65, 0.08);
  color: var(--color-navy);
}

.billing-badge-active {
  background: #E8F5EE;
  color: #347A52;
}

.billing-badge-past-due {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.billing-badge-canceled {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
}

/* Billing page contextual notes */
.billing-note {
  font-size: 0.875rem;
  color: var(--text-muted, #6b7280);
  margin: 0;
  line-height: 1.5;
}

.billing-note-error {
  color: var(--color-error-text);
}

/* ── Invoices table ───────────────────────────────────────────────────────── */

.inv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.inv-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #6b7280);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.inv-table tbody tr:nth-child(even) {
  background: var(--color-canvas);
}

.inv-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
  color: var(--color-text-primary);
  vertical-align: middle;
  font-size: 14px;
  height: 52px;
}

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

.inv-number {
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--text-muted, #6b7280);
}

.inv-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.inv-badge-paid {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.inv-badge-open {
  background: rgba(140, 105, 24, 0.10);
  color: #8C6918;
}

.inv-badge-void {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
}

.inv-badge-uncollectible {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

.inv-view-link {
  font-size: 0.85rem;
  color: var(--color-navy);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.inv-view-link:hover {
  text-decoration: underline;
}

/* ── Location Selection Modal ─────────────────────────────────────────── */

.loc-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.45) !important;
  backdrop-filter: blur(4px) !important;
  z-index: 1000 !important;
  display: flex;
  align-items: center !important;
  justify-content: center !important;
}

.loc-modal {
  display: block !important;
  box-sizing: border-box !important;
  background: white !important;
  border-radius: 20px !important;
  padding: 28px !important;
  width: 90% !important;
  max-width: 520px !important;
  max-height: 80vh !important;
  overflow-y: auto !important;
  box-shadow: 8px 8px 16px rgba(0,0,0,0.13), -8px -8px 16px rgba(255,255,255,0.95) !important;
  position: relative !important;
}

.loc-modal-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: #162841;
  margin: 0 0 8px 0;
}

.loc-modal-desc {
  font-size: 14px;
  color: #4A6070;
  margin: 0 0 20px 0;
}

.loc-cards-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
  width: 100% !important;
}

.loc-cards-wrap .loc-card,
.loc-cards-wrap > div {
  background: white;
  border: 2px solid #DDE4EC;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box !important;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 200ms ease-out, background 200ms ease-out;
}

.loc-cards-wrap label {
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.loc-cards-wrap .loc-card.selected,
.loc-cards-wrap > div.selected {
  border-color: #162841;
  background: rgba(22, 40, 65, 0.04);
}

.loc-cards-wrap input[type="checkbox"] {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  border-radius: 6px !important;
  border: 2px solid #DDE4EC !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  cursor: pointer !important;
  background: white !important;
  position: relative !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

.loc-cards-wrap input[type="checkbox"]:checked {
  background: #162841 !important;
  border-color: #162841 !important;
}

.loc-cards-wrap input[type="checkbox"]:checked::after {
  content: '' !important;
  display: block !important;
  position: absolute !important;
  left: 5px !important;
  top: 2px !important;
  width: 6px !important;
  height: 10px !important;
  border: 2px solid white !important;
  border-top: none !important;
  border-left: none !important;
  transform: rotate(45deg) !important;
}

.loc-card-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
}

.loc-card-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: #162841;
}

/* .loc-card-address is the canonical class; .loc-card-location is the alias used by existing JS */
.loc-card-address,
.loc-card-location {
  font-size: 13px;
  color: #4A6070;
}

.loc-modal-actions {
  border-top: 1px solid #DDE4EC;
  padding-top: 20px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.loc-modal-actions .loc-summary {
  font-size: 13px;
  color: #4A6070;
}

.loc-modal-actions .btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.loc-selection-count {
  font-size: 13px;
  color: #4A6070;
  margin: 12px 0 0;
}

.loc-upgrade-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}

.loc-upgrade-link:hover {
  text-decoration: underline;
}

@media (max-width: 767px) {
  .loc-modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 85vh;
    padding: 24px 20px;
  }

  .loc-modal-overlay {
    align-items: flex-end;
  }
}

.provision-success {
  background: #f0fdf4;
  border: 1px solid #4ade80;
  border-radius: 4px;
  color: #166534;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

/* ── Quantity adjustment control ─────────────────────────────────────── */

.qty-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #DDE4EC;
  border-radius: 9999px;
  background: #ffffff;
  color: var(--color-navy);
  font-size: 18px;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  min-height: unset;
  box-shadow: none;
}

.qty-btn:hover {
  border-color: #162841;
  background: rgba(22, 40, 65, 0.05);
  color: #162841;
}

.qty-input {
  width: 4rem;
  text-align: center;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 0.35rem 0.25rem;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.qty-input[type=number] {
  -moz-appearance: textfield;
}

/* Subscription verifying banner — neutral, shown while polling after checkout */
.sub-verifying-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: #f9fafb;
  border-bottom: 1px solid var(--border, #e5e7eb);
  padding: 0.65rem 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted, #6b7280);
}

/* ── Location phone number table ──────────────────────────────────────────── */
.phones-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.phones-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  border-bottom: 1.5px solid var(--border);
}

.phones-table td {
  padding: 0.6rem 0.75rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.phones-table tbody tr:hover {
  background: #f9fafb;
}

.loc-phone-number {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.loc-phone-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.loc-phone-active {
  background: #E8F5EE;
  color: #347A52;
}

.loc-phone-inactive {
  background: #F6F7F9;
  color: #4A6070;
  border: 1px solid #DDE4EC;
}

.phones-helper-note {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════ */

/* ── Keyframes ───────────────────────────────────────── */
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
}

/* ── Base toast ──────────────────────────────────────── */
.toast,
.notification,
.alert-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 360px;
  width: max-content;
  background: var(--color-surface);
  border-radius: var(--radius-toast);
  box-shadow: var(--shadow-clay-raised);
  padding: 16px 20px;
  animation: toast-in 300ms ease-out both;
  overflow: hidden;
}

.toast.is-exiting,
.notification.is-exiting,
.alert-toast.is-exiting {
  animation: toast-out 200ms ease-in both;
}

/* ── Left accent bar ─────────────────────────────────── */
.toast::before,
.notification::before,
.alert-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 2px 0 0 2px;
  background: var(--color-info);
}

.toast.toast-success::before,
.notification.toast-success::before,
.alert-toast.toast-success::before { background: var(--color-success); }

.toast.toast-error::before,
.notification.toast-error::before,
.alert-toast.toast-error::before   { background: var(--color-error); }

.toast.toast-warning::before,
.notification.toast-warning::before,
.alert-toast.toast-warning::before { background: var(--color-warning); }

.toast.toast-info::before,
.notification.toast-info::before,
.alert-toast.toast-info::before    { background: var(--color-info); }

/* ── Toast content ───────────────────────────────────── */
.toast-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-left: 4px;
}

.toast-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-primary);
  line-height: 1.4;
}

.toast-description {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 2px;
  line-height: 1.45;
}

/* ── Toast close button ──────────────────────────────── */
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  width: 20px;
  height: 20px;
  min-width: unset;
  border-radius: 50%;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity var(--transition-hover);
}

.toast-close:hover {
  opacity: 1;
  box-shadow: none;
  transform: none;
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .toast,
  .notification,
  .alert-toast {
    right: 50%;
    transform: translateX(50%);
    bottom: 16px;
    max-width: calc(100vw - 32px);
    width: calc(100vw - 32px);
  }

  .toast.is-exiting,
  .notification.is-exiting,
  .alert-toast.is-exiting {
    transform: translateX(50%) translateY(8px) scale(0.96);
  }
}


/* ═══════════════════════════════════════════════════════
   MODALS / DIALOGS
   ═══════════════════════════════════════════════════════ */

/* ── Keyframes ───────────────────────────────────────── */
@keyframes modal-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-backdrop-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modal-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* ── Backdrop ────────────────────────────────────────── */
.modal,
.dialog,
[role="dialog"] {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modal-backdrop-in 250ms ease-out both;
}

.modal.is-exiting,
.dialog.is-exiting,
[role="dialog"].is-exiting {
  animation: modal-backdrop-out 200ms ease-in both;
}

/* ── Modal container ─────────────────────────────────── */
.modal-container,
.modal-content,
.dialog-content {
  background: var(--color-surface);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-clay-raised);
  padding: 32px;
  max-width: 520px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modal-in 400ms var(--transition-spring) both;
}

.modal.is-exiting .modal-container,
.modal.is-exiting .modal-content,
.dialog.is-exiting .dialog-content {
  animation: modal-out 200ms ease-in both;
}

/* ── Modal sections ──────────────────────────────────── */
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-navy);
  margin: 0;
  line-height: 1.3;
}

.modal-body {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

/* ── Modal close ─────────────────────────────────────── */
.modal-close {
  flex-shrink: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 4px;
  width: 32px;
  height: 32px;
  min-width: unset;
  border-radius: 50%;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  transition: background var(--transition-hover), color var(--transition-hover);
}

.modal-close:hover {
  background: var(--color-canvas);
  color: var(--color-navy);
  box-shadow: none;
  transform: none;
}

/* ── Mobile — bottom sheet ───────────────────────────── */
@media (max-width: 520px) {
  .modal,
  .dialog,
  [role="dialog"] {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container,
  .modal-content,
  .dialog-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 85vh;
    animation: modal-sheet-in 400ms var(--transition-spring) both;
  }
}

@keyframes modal-sheet-in {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ═══════════════════════════════════════════════════════
   PAGE TRANSITION
   ═══════════════════════════════════════════════════════ */

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-content,
.page-content,
#main,
main {
  animation: page-enter var(--transition-page) ease-out both;
}


/* ═══════════════════════════════════════════════════════
   SKELETON LOADING
   ═══════════════════════════════════════════════════════ */

@keyframes skeleton-pulse {
  0%,
  100% { opacity: 1; }
  50%  { opacity: 0.5; }
}

.skeleton,
.loading-skeleton {
  background: var(--color-border);
  border-radius: 8px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  display: block;
}


/* ═══════════════════════════════════════════════════════
   REDUCED MOTION FALLBACK (belt-and-suspenders)
   ═══════════════════════════════════════════════════════ */

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


/* ═══════════════════════════════════════════════════════
   UNIFIED BADGE SYSTEM
   Applies to .status-badge, .subscription-status, .badge
   ═══════════════════════════════════════════════════════ */

/* ── Badge dot (color indicator inside badge) ────────── */
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: currentColor;
  display: inline-block;
}

/* ── Syncing dot pulse ───────────────────────────────── */
@keyframes badge-dot-pulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

/* ── Active pulsating dot ────────────────────────────── */
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0   rgba(76, 175, 130, 0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(76, 175, 130, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(76, 175, 130, 0);   }
}

.active-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF82;
  flex-shrink: 0;
  display: inline-block;
  animation: pulse-dot 2s ease-in-out infinite;
}

.status-badge.syncing .badge-dot,
.subscription-status.syncing .badge-dot,
.badge.syncing .badge-dot,
.badge-syncing .badge-dot {
  animation: badge-dot-pulse 1.4s ease-in-out infinite;
}


/* ── Subscription status ─────────────────────────────── */

/* trialing */
.status-badge.trialing,
.subscription-status.trialing,
.badge.trialing,
.badge-trialing {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

/* active */
.status-badge.active,
.subscription-status.active,
.badge.active,
.badge-active {
  background: #E8F5EE;
  color: #347A52;
}

/* past_due */
.status-badge.past-due,
.status-badge.past_due,
.subscription-status.past-due,
.subscription-status.past_due,
.badge.past-due,
.badge.past_due,
.badge-past-due {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

/* canceled / cancelled / paused / expired */
.status-badge.canceled,
.status-badge.cancelled,
.status-badge.paused,
.status-badge.expired,
.subscription-status.canceled,
.subscription-status.cancelled,
.subscription-status.paused,
.subscription-status.expired,
.badge.canceled,
.badge.cancelled,
.badge.paused,
.badge.expired,
.badge-canceled,
.badge-cancelled,
.badge-paused,
.badge-expired {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}


/* ── Location status ─────────────────────────────────── */

.location-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-badge);
  font-size: 12px;
  font-weight: 500;
}

.location-status.active,
.active-badge {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.location-status.inactive,
.inactive-badge {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}


/* ── Invoice / payment status ────────────────────────── */

/* paid → success green (same as active) */
.badge-paid,
.inv-badge.badge-paid {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

/* open / pending → warning gold (same as trialing) */
.badge-open,
.badge-pending,
.inv-badge.badge-open,
.inv-badge.badge-pending {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

/* overdue → error red (same as past_due) */
.badge-overdue,
.inv-badge.badge-overdue {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

/* void / uncollectible → muted (same as canceled) */
.badge-void,
.badge-uncollectible,
.inv-badge.badge-void,
.inv-badge.badge-uncollectible {
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}


/* ── Mindbody / integration connection status ────────── */

/* Connected — success green */
.status-badge.badge-connected,
.badge.badge-connected,
.badge-connected {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

/* Not connected / disconnected — error red */
.status-badge.badge-not-connected,
.badge.badge-not-connected,
.badge-not-connected {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}

/* Syncing — warning gold with pulsing dot */
.status-badge.badge-syncing,
.badge.badge-syncing,
.badge-syncing {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
   Breakpoints: <768px mobile | 768–1023px tablet | ≥1024px desktop
   ══════════════════════════════════════════════════════════════ */

/* ── Global: prevent horizontal overflow ─────────────────────── */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

/* ── Hamburger button (hidden on tablet+desktop) ─────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  order: -1;
}

.nav-hamburger:hover {
  background: var(--color-canvas);
  box-shadow: none;
  transform: none;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-navy);
  border-radius: 1px;
  pointer-events: none;
  transition: background var(--transition-hover);
}

/* ── Mobile drawer overlay ───────────────────────────────────── */
.nav-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 800;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.nav-drawer-overlay.is-open {
  display: block;
  animation: modal-backdrop-in 200ms ease-out both;
}

/* ── Mobile drawer panel ─────────────────────────────────────── */
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: var(--color-surface);
  z-index: 801;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.14);
  transform: translateX(-100%);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.nav-drawer.is-open {
  transform: translateX(0);
}

/* ── Drawer: header ──────────────────────────────────────────── */
.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  min-height: 64px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.nav-drawer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1;
}

.nav-drawer-close {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--color-canvas);
  border: none;
  border-radius: 50%;
  color: var(--color-text-secondary);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  padding: 0;
}

.nav-drawer-close:hover {
  background: var(--color-border);
  color: var(--color-navy);
  box-shadow: none;
  transform: none;
}

/* ── Drawer: nav links ───────────────────────────────────────── */
.nav-drawer-links {
  flex: 1;
  padding: 8px 0;
}

.nav-drawer-link {
  display: flex;
  align-items: center;
  padding: 0 24px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background var(--transition-hover), color var(--transition-hover),
              border-color var(--transition-hover);
}

.nav-drawer-link:hover {
  background: var(--color-canvas);
  color: var(--color-navy);
  border-left-color: var(--color-border);
}

.nav-drawer-link.nav-drawer-link-active {
  color: var(--color-navy);
  font-weight: 600;
  border-left-color: var(--color-navy);
  background: rgba(22, 40, 65, 0.04);
}

/* ── Drawer: user footer ─────────────────────────────────────── */
.nav-drawer-user {
  padding: 20px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.nav-drawer-user-email {
  font-size: 13px;
  color: var(--color-text-secondary);
  word-break: break-all;
  min-height: 0;
}

.nav-drawer-signout {
  width: 100%;
  background: var(--color-canvas);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 500;
  border-radius: var(--radius-button);
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: background var(--transition-hover), color var(--transition-hover);
}

.nav-drawer-signout:hover {
  background: var(--color-border);
  color: var(--color-navy);
  box-shadow: none;
  transform: none;
}

/* ══════════════════════════════════════════════════════════════
   @media ≥ 1024px  DESKTOP
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
  .cm-summary-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ══════════════════════════════════════════════════════════════
   @media 768px–1023px  TABLET
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  .cm-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ══════════════════════════════════════════════════════════════
   @media < 768px  MOBILE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── Page edges: 16px on mobile ─────────────────────── */
  .container,
  .main-content {
    padding: 16px;
  }

  /* ── Navbar ──────────────────────────────────────────── */
  .navbar,
  .topbar,
  header nav {
    padding: 0 12px;
    gap: 8px;
  }

  .nav-hamburger {
    display: flex;
  }

  .navbar-nav,
  .navbar-user {
    display: none;
  }

  .navbar-brand {
    font-size: 15px;
  }

  /* ── KPI stat grid: single column ───────────────────── */
  .cm-summary-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* ── Call log table → stacked cards ─────────────────── */
  .cm-table-wrap {
    overflow-x: visible;
  }

  .cm-table {
    display: block;
    width: 100%;
  }

  .cm-table thead {
    display: none;
  }

  .cm-table tbody {
    display: block;
  }

  .cm-table tr {
    display: block;
    background: var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-clay-standard);
    padding: 16px;
    margin-bottom: 12px;
    border: none;
    min-height: unset;
  }

  .cm-table td {
    display: block;
    border: none;
    padding: 4px 0;
    height: auto;
    font-size: 14px;
  }

  /* Inline labels via ::before on each column */
  .cm-table td::before {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    margin-right: 6px;
  }

  .cm-table td:nth-child(1)::before { content: "Time: "; }
  .cm-table td:nth-child(2)::before { content: "Caller: "; }
  .cm-table td:nth-child(3)::before { content: "Location: "; }
  .cm-table td:nth-child(4)::before { content: "Client: "; }
  .cm-table td:nth-child(5)::before { content: "Result: "; }
  .cm-table td:nth-child(6)::before { content: "Duration: "; }

  /* ── Billing: invoice table → stacked cards ──────────── */
  #invoices-table-wrap {
    overflow-x: visible;
  }

  .inv-table {
    display: block;
    width: 100%;
  }

  .inv-table thead {
    display: none;
  }

  .inv-table tbody {
    display: block;
  }

  .inv-table tr {
    display: block;
    background: var(--color-surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-clay-standard);
    padding: 16px;
    margin-bottom: 12px;
    border: none;
  }

  .inv-table td {
    display: block;
    border: none;
    padding: 4px 0;
    height: auto;
    font-size: 14px;
  }

  .inv-table td::before {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    margin-right: 6px;
  }

  .inv-table td:nth-child(1)::before { content: "Invoice: "; }
  .inv-table td:nth-child(2)::before { content: "Period: "; }
  .inv-table td:nth-child(3)::before { content: "Amount: "; }
  .inv-table td:nth-child(4)::before { content: "Status: "; }
  .inv-table td:nth-child(5)::before { content: "Action: "; }

  /* ── Auth pages: full-width, top-anchored ────────────── */
  body.auth-body {
    align-items: flex-start;
    padding: 16px;
    min-height: 100dvh;
  }

  body.auth-body .container,
  body.auth-body > .container {
    max-width: 100%;
    width: 100%;
  }

  /* Auth cards: reduce padding, tighter radius */
  #login-form,
  #signup-form,
  #forgot-form,
  #studio-form,
  #callback-card,
  #reset-card {
    padding: 24px 16px;
    border-radius: 16px;
  }

  /* Full-width primary buttons inside auth pages */
  body.auth-body button,
  body.auth-body .btn,
  body.auth-body .btn-primary {
    width: 100%;
    box-sizing: border-box;
  }

  /* ── Modals → bottom sheet on mobile ─────────────────── */
  .modal-content,
  .modal-box,
  [class*="modal-"] > .modal-inner {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    transform: none !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 24px 24px 0 0 !important;
    animation: mobile-sheet-up 320ms var(--transition-spring) both;
  }

  @keyframes mobile-sheet-up {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }

  /* ── General: font floor, touch targets ──────────────── */
  body {
    font-size: 15px;
  }

  p, li, label, .form-hint, .field-error,
  .sub-banner-btn {
    font-size: 14px;
  }

  /* Minimum 44×44px touch targets */
  .btn,
  button,
  input[type="submit"],
  input[type="button"],
  select {
    min-height: 44px;
  }
}

/* ══════════════════════════════════════════════════════════════
   @media < 480px  VERY SMALL PHONES
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 479px) {
  /* Hide non-essential Duration column */
  .cm-table td:nth-child(6) {
    display: none;
  }
}


/* ══════════════════════════════════════════════════════════════
   SIDEBAR NAVIGATION  (#162841 dark sidebar)
   ══════════════════════════════════════════════════════════════ */

/* ── Body layout: push content right of fixed sidebar ───────── */
@media (min-width: 768px) {
  body {
    padding-left: 260px;
  }
}

/* ── Desktop sidebar ──────────────────────────────────────────── */
.sidebar-nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: #162841;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 767px) {
  .sidebar-nav {
    display: none;
  }
}

/* ── Sidebar: brand header ────────────────────────────────────── */
.sidebar-brand-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 20px 16px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-wordmark {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
}

.sidebar-tagline {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1;
}

/* ── Sidebar: nav links ───────────────────────────────────────── */
.sidebar-links {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 2px 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  transition: background 200ms ease-out, color 200ms ease-out;
  position: relative;
  min-height: unset;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-link.sidebar-link-active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

/* 4px × 20px white pill indicator at left edge of active item */
.sidebar-link.sidebar-link-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: #ffffff;
  border-radius: 9999px;
}

/* ── Sidebar: icon ────────────────────────────────────────────── */
.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon svg,
.sidebar-link svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.75;
  display: block;
}

/* ── Sidebar: user footer ─────────────────────────────────────── */
.sidebar-user-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user-email {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: unset;
}

.sidebar-user-role {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.2;
}

.sidebar-signout-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 200ms ease-out, color 200ms ease-out;
  box-shadow: none;
  font-family: inherit;
}

.sidebar-signout-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

.sidebar-signout-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

/* ── Mobile top bar ───────────────────────────────────────────── */
.mob-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #162841;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
}

@media (max-width: 767px) {
  .mob-topbar {
    display: flex;
  }

  body {
    padding-top: 56px;
  }
}

.mob-hamburger {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.mob-hamburger:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  transform: none;
}

.mob-topbar-brand {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

/* ── Mobile drawer overlay ────────────────────────────────────── */
.mob-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
}

.mob-overlay.is-open {
  display: block;
}

/* ── Mobile drawer panel ──────────────────────────────────────── */
.mob-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  max-width: 85vw;
  background: #162841;
  z-index: 301;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 300ms ease-out;
  overflow-y: auto;
  overflow-x: hidden;
}

.mob-drawer.is-open {
  transform: translateX(0);
}

/* ── Icon-only circular buttons (generic) ────────────────────── */
.btn-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Border-radius per button role is defined on each class above:
   Primary / .btn-primary → 9999px
   Secondary / .btn-secondary / .btn-outline → 10px
   Ghost / .btn-ghost → 8px
   Qty steppers / .qty-btn → 8px
   Danger text / .btn-text-danger → 0 (plain link)
   Sidebar / .sidebar-signout-btn / .mob-hamburger → 50% (circular icon buttons)
*/

