/* GreenSync Lead Studio — Native Responsive Stylesheet (Zero External CDNs) */

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  --accent: #10b981;
  --accent-hover: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-ink: #ffffff;

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.16);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.16);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --tap-min: 44px;
  --transition-fast: 150ms ease;
}

html[data-theme="dark"] {
  --bg-page: #0b1117;
  --bg-surface: #121a23;
  --bg-elevated: #18222e;
  --bg-subtle: #0f161e;
  --bg-hover: #1e2a38;
  --border: #263445;
  --border-strong: #35475c;

  --text-primary: #f1f5f9;
  --text-secondary: #9fb0c3;
  --text-muted: #75879b;

  --badge-danger-text: #fca5a5;
  --badge-amber-text: #fcd34d;
  --badge-accent-text: #6ee7b7;
  --badge-info-text: #7dd3fc;

  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
  --frame-border: #334155;
}

html[data-theme="light"] {
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-subtle: #eef2f6;
  --bg-hover: #e2e8f0;
  --border: #d5dee8;
  --border-strong: #b6c4d4;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --badge-danger-text: #b91c1c;
  --badge-amber-text: #92400e;
  --badge-accent-text: #047857;
  --badge-info-text: #0369a1;

  --shadow-lg: 0 20px 44px rgba(15, 23, 42, 0.14);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --frame-border: #1e293b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Studio Shell & Mobile Preview Frame */
.studio-shell {
  min-height: 100vh;
  width: 100%;
  background: var(--bg-page);
  position: relative;
}

.studio-shell.is-mobile-preview {
  width: 390px;
  max-width: 100%;
  min-height: 844px;
  margin: 1rem auto;
  border: 6px solid var(--frame-border);
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg-page);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--tap-min);
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-secondary[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--badge-accent-text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-danger-outline {
  background: transparent;
  color: var(--badge-danger-text);
  border-color: rgba(239, 68, 68, 0.45);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger-soft);
}

/* Inputs */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-label,
.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.text-input,
.select-input,
.code-textarea,
.plain-textarea {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-primary);
  font-size: 0.94rem;
  transition: border-color var(--transition-fast);
}

.text-input:focus,
.select-input:focus,
.code-textarea:focus,
.plain-textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.code-textarea {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 210px;
}

.plain-textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.5;
}

.inline-error {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--badge-danger-text);
  font-size: 0.88rem;
  font-weight: 500;
}

/* Login Gate */
.login-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.14), transparent 45%),
    var(--bg-page);
}

.studio-shell.is-mobile-preview .login-gate {
  min-height: 832px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.login-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.login-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.login-checking {
  margin: 0;
  font-size: 0.88rem;
  color: var(--badge-accent-text);
  background: var(--accent-soft);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.login-footnote {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* Header */
.workspace-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.studio-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.header-brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.header-status-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.meta-pill-ok {
  background: var(--accent-soft);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--badge-accent-text);
}

.meta-pill-warn {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--badge-amber-text);
}

.meta-pill-muted {
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Main Content */
.studio-main {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.4rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* KPI Summary Bar */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.kpi-note {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Pipeline Section */
.pipeline-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pipeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.section-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.section-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.pipeline-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.state-banner {
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.92rem;
}

/* Desktop Table */
.leads-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.leads-table th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.leads-table td {
  padding: 0.8rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.lead-row {
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.lead-row:hover {
  background: var(--bg-hover);
}

.lead-biz-name {
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}

.lead-sub-meta {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.col-actions {
  text-align: right;
  white-space: nowrap;
}

/* Badges & Status Pills */
.flags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.audit-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.25;
  border: 1px solid transparent;
}

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

.badge-amber {
  background: var(--amber-soft);
  color: var(--badge-amber-text);
  border-color: rgba(245, 158, 11, 0.35);
}

.badge-clean {
  background: var(--accent-soft);
  color: var(--badge-accent-text);
  border-color: rgba(16, 185, 129, 0.35);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.24rem 0.62rem;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.status-new {
  background: var(--info-soft);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--badge-info-text);
}

.status-draft-ready {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--badge-amber-text);
}

.status-approved,
.status-sent,
.status-replied {
  background: var(--accent-soft);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--badge-accent-text);
}

.status-archived {
  opacity: 0.72;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: 0.22rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
}

.score-critical {
  background: var(--danger-soft);
  color: var(--badge-danger-text);
}

.score-warn {
  background: var(--amber-soft);
  color: var(--badge-amber-text);
}

.score-good {
  background: var(--accent-soft);
  color: var(--badge-accent-text);
}

/* Mobile Stacked Cards (hidden on wide desktop unless .is-mobile-preview) */
.leads-cards {
  display: none;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.lead-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.lead-card:hover {
  border-color: var(--accent);
}

.lead-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.lead-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.lead-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.lead-card-draft-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Slide-Over Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 10, 16, 0.68);
  display: flex;
  justify-content: flex-end;
}

.studio-shell.is-mobile-preview .drawer-backdrop {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  min-height: 100%;
  justify-content: stretch;
}

.lead-drawer {
  width: min(720px, 100%);
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.studio-shell.is-mobile-preview .lead-drawer {
  width: 100%;
  border-left: none;
  max-height: 832px;
}

.drawer-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.drawer-badges-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.drawer-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.drawer-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.drawer-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.business-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.meta-item-wide {
  grid-column: 1 / -1;
}

.meta-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.meta-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.audit-score-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.audit-score-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audit-score-number {
  font-size: 0.95rem;
}

.audit-meter {
  width: 100%;
  height: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.audit-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: var(--accent);
  transition: width 220ms ease;
}

.audit-meter-fill.is-critical {
  background: var(--danger);
}

.audit-meter-fill.is-warn {
  background: var(--amber);
}

.audit-flags-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.gdpr-banner {
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--text-primary);
  font-size: 0.84rem;
  line-height: 1.45;
}

.editor-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.tab-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
  background: var(--bg-subtle);
  gap: 0.2rem;
}

.tab-btn {
  min-height: var(--tap-min);
  padding: 0.4rem 0.85rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.dirty-badge {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--badge-amber-text);
  background: var(--amber-soft);
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-pill);
}

.email-preview-frame {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.drawer-footer {
  padding: 0.9rem 1.2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.drawer-footer-secondary,
.drawer-footer-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* Confirmation Modal */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(5, 10, 16, 0.75);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.studio-shell.is-mobile-preview .confirm-backdrop {
  position: sticky;
  bottom: 0;
  min-height: 100%;
}

.confirm-dialog {
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.confirm-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.confirm-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.confirm-summary {
  margin: 0;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.confirm-summary dt {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.confirm-summary dd {
  margin: 0.1rem 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

/* Toasts */
.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.78rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.6);
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.65);
  color: var(--badge-danger-text);
}

/* Responsive Breakpoints & Mobile Preview Parity */
@media (max-width: 1080px) {
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-group-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .studio-header {
    padding: 0.8rem 0.95rem;
  }

  .studio-main {
    padding: 0.95rem 0.9rem 2rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .leads-table-wrap {
    display: none;
  }

  .leads-cards {
    display: grid;
  }

  .business-meta-grid {
    grid-template-columns: 1fr;
  }

  .drawer-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .drawer-footer-secondary,
  .drawer-footer-primary {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

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

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Force exact mobile layout inside 390px desktop preview container */
.studio-shell.is-mobile-preview .studio-header {
  padding: 0.8rem 0.9rem;
}

.studio-shell.is-mobile-preview .header-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.studio-shell.is-mobile-preview .studio-main {
  padding: 0.9rem 0.85rem 2rem;
}

.studio-shell.is-mobile-preview .kpi-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.studio-shell.is-mobile-preview .kpi-value {
  font-size: 1.45rem;
}

.studio-shell.is-mobile-preview .filter-bar {
  grid-template-columns: 1fr;
}

.studio-shell.is-mobile-preview .leads-table-wrap {
  display: none;
}

.studio-shell.is-mobile-preview .leads-cards {
  display: grid;
}

.studio-shell.is-mobile-preview .business-meta-grid {
  grid-template-columns: 1fr;
}

.studio-shell.is-mobile-preview .drawer-header,
.studio-shell.is-mobile-preview .drawer-body,
.studio-shell.is-mobile-preview .drawer-footer {
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

.studio-shell.is-mobile-preview .drawer-footer {
  flex-direction: column;
  align-items: stretch;
}

.studio-shell.is-mobile-preview .drawer-footer-secondary,
.studio-shell.is-mobile-preview .drawer-footer-primary {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.studio-shell.is-mobile-preview .confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
