/*
 * CalVerve 2027 - Premium White Theme Design System
 * Clean, Clinical, Elegant & Highly Professional
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/remixicon@4.3.0/fonts/remixicon.css');

:root {
  /* Color Palette - Crisp Professional White & Healthcare Blues */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-card-muted: #f1f5f9;
  --bg-subtle: #f8fafc;

  --border-light: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;

  /* Accent & Status Colors */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-subtle: #e0f2fe;
  --primary-dark: #0c4a6e;

  --accent: #2563eb;
  --accent-light: #eff6ff;

  --success: #059669;
  --success-subtle: #ecfdf5;
  --warning: #d97706;
  --warning-subtle: #fffbeb;
  --danger: #dc2626;
  --danger-subtle: #fef2f2;
  --info: #0284c7;
  --info-subtle: #f0f9ff;
  --purple: #7c3aed;
  --purple-subtle: #f5f3ff;
  --indigo: #4f46e5;
  --indigo-subtle: #eef2ff;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 30px -4px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --shadow-mockup: 0 25px 50px -12px rgba(15, 23, 42, 0.18);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions & Curves */
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Animations */
@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  0% { opacity: 0; transform: translateY(-16px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(2, 132, 199, 0); }
}

@keyframes pulseSuccess {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
}

@keyframes shimmerEffect {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotateX(4deg); }
  50% { transform: translateY(-6px) rotateX(2deg); }
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  background-image: 
    radial-gradient(at 100% 0%, rgba(224, 242, 254, 0.4) 0px, transparent 50%),
    radial-gradient(at 0% 100%, rgba(240, 253, 244, 0.35) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  animation: fadeInUp 0.4s ease-out;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

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

a:hover {
  color: var(--primary-hover);
}

/* Layout Containers */
.app-container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 24px;
}

.main-content {
  flex: 1;
  padding: 32px 0 64px 0;
}

/* Navigation Header */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  color: #fff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

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

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--primary-subtle);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: var(--primary-subtle);
}

.nav-link.active {
  color: var(--primary-dark);
  font-weight: 700;
}

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

.user-profile-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  background: var(--bg-card-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
}

.avatar {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* Cards & Surfaces */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

/* Luxury Card Hover Light Sheen */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  pointer-events: none;
  transition: left 0.75s ease;
  z-index: 5;
}

.card:hover::before {
  left: 160%;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.09), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
  border-color: #cbd5e1;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #fafafa;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  line-height: 1.3;
  position: relative;
  overflow: hidden;
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #0274b3 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0274b3 0%, var(--primary-dark) 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.4);
}

.btn-secondary {
  background: #fff;
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.btn-secondary:hover {
  background: var(--bg-card-muted);
  border-color: #cbd5e1;
  color: var(--text-main);
  transform: translateY(-1px);
}

.btn-outline-primary {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary-subtle);
  color: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

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

/* Badges & Status Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  line-height: 1.2;
  text-transform: capitalize;
  transition: var(--transition);
}

/* Live Pulsing Dot for Status Indicators */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.pulse-dot.dot-success {
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  animation: pulseSuccess 2s infinite;
}

.pulse-dot.dot-primary {
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
  animation: pulseGlow 2s infinite;
}

.pulse-dot.dot-warning {
  background: var(--warning);
  box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7);
  animation: pulseGlow 2s infinite;
}

.badge-secondary { background: var(--bg-card-muted); color: var(--text-muted); }
.badge-primary { background: var(--primary-subtle); color: var(--primary-dark); }
.badge-success { background: var(--success-subtle); color: #047857; }
.badge-warning { background: var(--warning-subtle); color: #b45309; }
.badge-danger { background: var(--danger-subtle); color: #b91c1c; }
.badge-info { background: var(--info-subtle); color: #0369a1; }
.badge-purple { background: var(--purple-subtle); color: #6d28d9; }
.badge-indigo { background: var(--indigo-subtle); color: #4338ca; }
.badge-cyan { background: #ecfeff; color: #0e7490; }
.badge-amber { background: #fffbeb; color: #b45309; }
.badge-teal { background: #f0fdfa; color: #0f766e; }

/* Grid & Utilities */
.grid {
  display: grid;
  gap: 24px;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

@media (max-width: 1024px) {
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-cols-4, .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
}

/* Stat Widget Cards */
.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition: var(--transition);
}

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

.stat-info .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-info .stat-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
}

.stat-info .stat-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.table th {
  background: var(--bg-subtle);
  padding: 12px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 14px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background: #f8fafc;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.9rem;
}

.alert-danger { background: var(--danger-subtle); color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: var(--success-subtle); color: #065f46; border: 1px solid #a7f3d0; }
.alert-info { background: var(--info-subtle); color: #075985; border: 1px solid #bae6fd; }
.alert-warning { background: var(--warning-subtle); color: #92400e; border: 1px solid #fde68a; }

/* Wizard Steps Indicator */
.wizard-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-bottom: 36px;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 30px;
  right: 30px;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.wizard-step-item {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}

.step-bubble {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--transition);
  margin-bottom: 8px;
}

.wizard-step-item.active .step-bubble {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15);
}

.wizard-step-item.completed .step-bubble {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

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

.wizard-step-item.active .step-label {
  color: var(--text-main);
  font-weight: 700;
}

/* Modals - Full Screen / Spacious Responsive Sheet */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 680px;
  width: 100%;
  box-shadow: 0 25px 60px -10px rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(226, 232, 240, 0.9);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

/* Full Screen Studio Modal for 13-Leaf Inspector */
.modal-backdrop:has(.modal-xl) {
  padding: 0 !important;
}

.modal-dialog.modal-xl {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  margin: 0 !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
}

.modal-dialog .card-header {
  padding: 14px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-dialog .card-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

.modal-dialog .card-footer {
  padding: 12px 24px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  position: sticky;
  bottom: 0;
  z-index: 20;
  flex-shrink: 0;
}

/* Theme Navigation Bar inside Studio Modal */
.modal-theme-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-theme-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-theme-nav-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

@keyframes modalPop {
  0% { transform: scale(0.96) translateY(12px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Footer */
.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  padding: 24px 0;
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.specs-pill-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spec-pill {
  font-size: 0.72rem;
  background: var(--bg-card-muted);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* Demo Role Bar */
.demo-role-banner {
  background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  padding: 8px 16px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.demo-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.demo-btn:hover {
  background: #ffffff;
  color: #0f172a;
}

/* ==========================================================================
   RESPONSIVE LAYER — adapts the portal to tablet & mobile screen sizes.
   Light theme is preserved; these are layout / scale adjustments only.
   ========================================================================== */

/* Grid tracks and their items must be allowed to shrink below their intrinsic
   content width. Otherwise an inner horizontal scroller (e.g. the 13-leaf
   thumbnail rail) forces the whole track to overflow instead of scrolling.
   This keeps the theme studio modal and split layouts contained at every size. */
.page-split,
.studio-split,
.filter-grid,
.flow-grid {
  min-width: 0;
}
.page-split > *,
.studio-split > *,
.filter-grid > *,
.flow-grid > * {
  min-width: 0;
}

/* Inline-grid collapse hooks (classes added to page markup). The !important
   is required to override the inline `grid-template-columns` declarations. */
@media (max-width: 900px) {
  .page-split,
  .studio-split {
    grid-template-columns: 1fr !important;
  }
  .wizard-preview-rail {
    position: static !important;
    top: auto !important;
    margin-top: 24px;
  }
}

@media (max-width: 768px) {
  .filter-grid {
    grid-template-columns: 1fr !important;
  }
  .flow-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 480px) {
  .flow-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Header — let the nav wrap to its own horizontally-scrollable row */
@media (max-width: 1024px) {
  .header-inner {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
  }
  .header-inner nav {
    order: 3;
    width: 100%;
    min-width: 0;
  }
  .nav-links {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .nav-link {
    white-space: nowrap;
  }
}

/* Phone layout — tighten padding, trim non-essential header text */
@media (max-width: 640px) {
  .app-container {
    padding: 0 16px;
  }
  .main-content {
    padding: 20px 0 48px 0;
  }
  .brand-subtitle,
  .brand-badge,
  .user-info {
    display: none;
  }
  .brand-title {
    font-size: 1.1rem;
  }
  .card-header {
    flex-wrap: wrap;
    gap: 10px;
  }
  .card-body {
    padding: 18px;
  }
  .btn-lg {
    padding: 12px 20px;
    font-size: 0.95rem;
  }
}

/* Wizard stepper — horizontal scroll with compact bubbles on phones */
@media (max-width: 640px) {
  .wizard-steps {
    justify-content: flex-start;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
  }
  .wizard-steps::before {
    display: none;
  }
  .wizard-step-item {
    flex: 0 0 auto;
    min-width: 82px;
  }
  .step-bubble {
    width: 34px;
    height: 34px;
    font-size: 0.85rem;
    margin-bottom: 6px;
  }
  .step-label {
    font-size: 0.68rem;
  }
}

/* Modal footer actions — allow full-width primary action on small screens */
@media (max-width: 560px) {
  .modal-dialog .card-footer {
    flex-wrap: wrap;
  }
  .modal-dialog .card-footer .btn-lg {
    width: 100%;
    justify-content: center;
  }
  .modal-theme-nav-btn {
    max-width: 180px;
  }
}
