/* ── miSearch Console Material 3 Flat 2-Pane Architecture (Matching miMail) ── */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200');

/* ── Light Mode Design Tokens ── */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-hover: rgba(0, 0, 0, 0.05);
  --surface-container: #f1f3f4;
  --surface-container-high: #e8eaed;
  --surface-container-highest: #dfe1e5;
  --surface-container-low: #ffffff;
  
  --text-primary: #1f1f1f;
  --text-secondary: #5f6368;
  --text-muted: #80868b;
  
  --border-color: rgba(0, 0, 0, 0.06);
  --border-subtle: rgba(0, 0, 0, 0.03);
  
  --accent-brand: #7c3aed;
  --accent-brand-hover: #6d28d9;
  --accent-brand-light: #ede9fe;
  --accent-brand-text: #5b21b6;
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);

  --sidebar-width: 250px;
  --header-height: 64px;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.08);
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ── Dark Mode Design Tokens (Exact miMail Match) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #1f1f1f;
    --bg-secondary: #181818;
    --bg-hover: rgba(255, 255, 255, 0.06);
    --surface-container: #2b2b2b;
    --surface-container-high: #333333;
    --surface-container-highest: #3d3d3d;
    --surface-container-low: #1f1f1f;
    
    --text-primary: #f2f2f2;
    --text-secondary: #9aa0a6;
    --text-muted: #70757a;
    
    --border-color: rgba(255, 255, 255, 0.06);
    --border-subtle: rgba(255, 255, 255, 0.03);
    
    --accent-brand: #8b5cf6;
    --accent-brand-hover: #a78bfa;
    --accent-brand-light: rgba(139, 92, 246, 0.22);
    --accent-brand-text: #ddd6fe;

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.15);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.15);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.15);
  }
}

[data-theme="dark"] {
  --bg-primary: #1f1f1f;
  --bg-secondary: #181818;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --surface-container: #2b2b2b;
  --surface-container-high: #333333;
  --surface-container-highest: #3d3d3d;
  --surface-container-low: #1f1f1f;
  
  --text-primary: #f2f2f2;
  --text-secondary: #9aa0a6;
  --text-muted: #70757a;
  
  --border-color: rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.03);
  
  --accent-brand: #8b5cf6;
  --accent-brand-hover: #a78bfa;
  --accent-brand-light: rgba(139, 92, 246, 0.22);
  --accent-brand-text: #ddd6fe;

  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.15);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.15);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.15);
}

/* ── Reset & Non-Scrolling Frame Layout ── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* App 2-Pane Frame Layout: lock 100vh viewport for dashboard & console tool pages */
html:not(.landing-page),
body:not(.landing-page) {
  height: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
}

/* Public Landing Homepage: natural full-height document scrolling */
html.landing-page,
body.landing-page {
  height: auto !important;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto !important;
  overflow-x: hidden;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
}

body {
  display: flex;
  flex-direction: column;
}

/* ── Scrollbars ── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, 0.18); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.35); }
[data-theme="light"] * { scrollbar-color: rgba(0, 0, 0, 0.16) transparent; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.18); }

/* ── Top Header Navigation Bar ── */
.app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  border: none !important;
  border-bottom: none !important;
  z-index: 100;
  gap: 16px;
}

.landing-header {
  height: var(--header-height);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hamburger-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease;
}
.hamburger-btn:hover {
  background: var(--bg-hover);
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.3px;
}

.header-title-text {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.app-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: var(--surface-container);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}
.app-header-btn:hover {
  background: var(--surface-container-high);
}

/* ── 2-Pane Application Frame ── */
.app-container {
  display: flex;
  flex: 1;
  min-height: 0;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  overflow: hidden;
  background-color: var(--bg-primary);
  position: relative;
}

/* ── Fixed Left Sidebar (Independently Scrollable, Smooth Collapsing Rail) ── */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-primary);
  padding: 8px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  border: none !important;
  box-shadow: none !important;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 90;
  transition: width 240ms cubic-bezier(0.2, 0, 0, 1), min-width 240ms cubic-bezier(0.2, 0, 0, 1), padding 240ms cubic-bezier(0.2, 0, 0, 1);
}

/* ── Sidebar Brand Header (Mobile Drawer Only, strictly hidden on Desktop) ── */
.sidebar-brand-header {
  display: none !important;
}

.sidebar-nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.sidebar-nav-bottom {
  margin-top: auto;
  padding-top: 12px;
  width: 100%;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 150ms ease, color 150ms ease, width 240ms cubic-bezier(0.2, 0, 0, 1), padding 240ms cubic-bezier(0.2, 0, 0, 1);
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.sidebar-nav-item:hover {
  background: var(--surface-container);
}
.sidebar-nav-item.active {
  background: var(--accent-brand-light);
  color: var(--accent-brand-text);
  font-weight: 700;
}
.sidebar-nav-item.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
  color: var(--accent-brand);
}
.sidebar-nav-item span:not(.material-symbols-outlined) {
  transition: opacity 180ms ease, max-width 240ms ease;
  white-space: nowrap;
  overflow: hidden;
}

/* ── Desktop Collapsed Sidebar Rail Mode ── */
@media (min-width: 901px) {
  html.sidebar-collapsed-mode .app-sidebar,
  .app-sidebar.collapsed {
    width: 68px;
    min-width: 68px;
    padding: 8px 8px 16px;
    align-items: center;
  }

  html.sidebar-collapsed-mode .app-sidebar .sidebar-nav-group,
  .app-sidebar.collapsed .sidebar-nav-group {
    align-items: center;
  }

  html.sidebar-collapsed-mode .app-sidebar .sidebar-nav-bottom,
  .app-sidebar.collapsed .sidebar-nav-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  html.sidebar-collapsed-mode .app-sidebar .sidebar-nav-item,
  .app-sidebar.collapsed .sidebar-nav-item {
    width: 46px;
    height: 46px;
    padding: 0;
    justify-content: center;
    border-radius: var(--radius-full);
    margin: 0 auto 4px;
    gap: 0;
  }

  html.sidebar-collapsed-mode .app-sidebar .sidebar-nav-item span:not(.material-symbols-outlined),
  .app-sidebar.collapsed .sidebar-nav-item span:not(.material-symbols-outlined) {
    opacity: 0;
    max-width: 0;
    display: none;
  }

  html.sidebar-collapsed-mode .app-sidebar .sidebar-nav-item .material-symbols-outlined,
  .app-sidebar.collapsed .sidebar-nav-item .material-symbols-outlined {
    font-size: 22px;
    margin: 0;
  }

  .app-main {
    transition: margin 240ms cubic-bezier(0.2, 0, 0, 1), border-radius 240ms ease;
  }
}

/* ── Mobile Sidebar Drawer Overlay ── */
.sidebar-overlay {
  display: none;
}

/* ── Floating Rounded Main Workspace Card (Exact miMail Match) ── */
.app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  background-color: var(--surface-container);
  border-radius: var(--radius-xl);
  margin: 0 16px 16px 0;
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border: none !important;
  box-shadow: none !important;
  transition: background-color 180ms ease;
}

/* ── Nested Surface Cards Inside Main Workspace ── */
.feature-card, .m3-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: none !important;
  box-shadow: none !important;
  margin-bottom: 20px;
}

/* ── Tutorial Step Number Badges (Fully rounded on all devices) ── */
.tutorial-step-badge {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  aspect-ratio: 1 / 1;
  border-radius: 50% !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #ffffff;
  flex-shrink: 0 !important;
}

.console-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.feature-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.console-card-icon {
  font-size: 24px;
  color: var(--accent-brand);
}

/* ── Stats Metric Cards (Nested in Main Workspace) ── */
.stats-counter-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-counter-card {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 160ms ease;
}
.stat-counter-card:hover {
  transform: translateY(-2px);
}

.stat-counter-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.stat-counter-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Material 3 Buttons ── */
.m3-btn-filled, .btn-pill-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-brand);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 160ms ease;
  box-shadow: none;
  white-space: nowrap;
}
.m3-btn-filled:hover, .btn-pill-primary:hover {
  background: var(--accent-brand-hover);
  transform: translateY(-1px);
}

.m3-btn-outlined, .btn-pill-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: none !important;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: all 160ms ease;
  white-space: nowrap;
}
.m3-btn-outlined:hover, .btn-pill-secondary:hover {
  background: var(--bg-hover);
}

.m3-btn-tonal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-brand-light);
  color: var(--accent-brand-text);
  font-weight: 700;
  font-size: 13px;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 160ms ease;
}
.m3-btn-tonal:hover {
  opacity: 0.9;
}

.m3-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
  font-size: 12.5px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 150ms ease;
}
.m3-btn-danger:hover {
  opacity: 0.85;
}

/* ── Form Inputs ── */
.m3-form-group {
  margin-bottom: 18px;
}
.m3-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.m3-input {
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius-full);
  background: var(--surface-container);
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 160ms ease;
}
.m3-input:focus {
  border-color: var(--accent-brand);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px var(--accent-brand-light);
}

.m3-textarea {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-container);
  border: 1px solid transparent;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: all 160ms ease;
}
.m3-textarea:focus {
  border-color: var(--accent-brand);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px var(--accent-brand-light);
}

/* ── Responsive Tables ── */
.console-table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.console-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.console-table th {
  background: var(--surface-container);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.console-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.console-table tr:last-child td {
  border-bottom: none;
}
.console-table tr:hover td {
  background: var(--surface-container);
}

/* ── Status Badges ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }

/* ── Account Popover ── */
.account-profile-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  align-items: center;
  z-index: 200;
  animation: popoverFadeIn 160ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.account-profile-popover.active {
  display: flex;
}
@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-user-email {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-align: center;
  word-break: break-all;
}
.popover-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-brand);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  overflow: hidden;
}
.popover-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.popover-user-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-align: center;
}

/* ── Public Landing Hero ── */
.landing-hero {
  padding: 60px 24px 80px;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}
.landing-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.landing-desc {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 36px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}
.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 0 24px 80px;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Toast Notifications ── */
.m3-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
  width: auto;
  max-width: 90vw;
}

.m3-toast {
  background: var(--surface-container-high);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastSlideUp 180ms ease forwards;
}
@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Mobile Responsive Breakpoints ── */
@media (max-width: 900px) {
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100%;
  }
  .app-container {
    height: auto;
    min-height: calc(100vh - var(--header-height));
    overflow: visible;
  }

  /* Hide header logo/brand on mobile so only hamburger button is in top-left */
  .app-header .landing-logo {
    display: none !important;
  }

  /* Single unified sidebar slides out full height on mobile */
  .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.35);
    z-index: 200;
    background-color: var(--bg-primary);
    padding: 16px 14px 20px;
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }

  /* Brand Header visible at top of sliding sidebar */
  .sidebar-brand-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px 16px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
  }
  .sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.2px;
  }
  .sidebar-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }
  .sidebar-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
  }
  .sidebar-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  /* Mobile clean backdrop overlay */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms ease;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .app-main {
    margin: 0 10px 12px;
    border-radius: var(--radius-lg);
    padding: 20px 16px 36px;
    overflow: visible;
    height: auto;
  }
  .mobile-hide-text {
    display: none;
  }
}

@media (max-width: 600px) {
  .stats-counter-group {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-counter-card {
    padding: 16px 12px;
  }
  .stat-counter-value {
    font-size: 1.5rem;
  }
  .feature-card, .m3-card {
    padding: 18px 14px;
    border-radius: var(--radius-md);
  }
  .app-header, .landing-header {
    padding: 0 14px;
  }
}

/* ── Material 3 Success / Dialog Modal ── */
.m3-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  animation: modalBackdropFadeIn 200ms ease forwards;
}

@keyframes modalBackdropFadeIn {
  to { opacity: 1; }
}

.m3-modal-card {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: 36px 32px 32px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  position: relative;
  transform: scale(0.92) translateY(12px);
  animation: modalPopIn 260ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalPopIn {
  to { transform: scale(1) translateY(0); }
}

.m3-modal-icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.08);
}

.m3-modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.m3-modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.m3-modal-property-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-container);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 18px;
}

.m3-modal-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.m3-modal-close-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.m3-modal-close-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}