/* ═══════════════════════════════════════════
   BringIt – Premium UX/UI Redesign
   Modern Hebrew Layout · Indigo-Teal Accent
   ═══════════════════════════════════════════ */

:root {
  /* Colors */
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --secondary: #0ea5e9;
  --secondary-light: #38bdf8;
  --secondary-dark: #0369a1;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-alt: #f9fafb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --border-focus: #a5b4fc;
  
  /* Gradients */
  --gradient-brand: linear-gradient(135deg, var(--primary), var(--secondary));
  --gradient-brand-hover: linear-gradient(135deg, var(--primary-dark), var(--secondary-dark));
  --gradient-glow: linear-gradient(135deg, rgba(79,70,229,0.05), rgba(14,165,233,0.05));
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-premium: 0 20px 25px -5px rgba(79,70,229,0.05), 0 10px 10px -5px rgba(0,0,0,0.03);
  
  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* Animation */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Assistant', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  /* direction is intentionally NOT hardcoded here — it inherits from the
     html[dir] attribute (toggled dynamically by i18n.js between rtl/ltr) */
}

body.app-booting .app {
  visibility: hidden;
}

/* Subtle Animated Background Elements */
.app {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  overflow-x: hidden;
}

.app::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 450px;
  background: radial-gradient(circle at 50% -100px, rgba(79,70,229,0.06) 0%, rgba(14,165,233,0.03) 50%, transparent 100%);
  z-index: -1;
  pointer-events: none;
}

.shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px;
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
}

/* Views switching */
.view {
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Typography Defaults */
h1, h2, h3, h4 {
  font-family: inherit;
  font-weight: 700;
  color: #111827;
  letter-spacing: 0;
}

/* ── App Header ── */
.app-header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  padding-top: max(env(safe-area-inset-top, 0px), 0px);
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
}

/* Standalone / PWA / Installed App / Android & iOS display modes */
@media all and (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  .app-header {
    padding-top: max(env(safe-area-inset-top, 0px), 42px) !important;
  }
  .app-footer {
    padding-bottom: max(calc(10px + env(safe-area-inset-bottom, 0px)), 28px) !important;
  }
  .app {
    padding-bottom: max(calc(85px + env(safe-area-inset-bottom, 0px)), 110px) !important;
  }
}

/* Class fallback for standalone PWA / WebAPK */
html.is-standalone .app-header {
  padding-top: max(env(safe-area-inset-top, 0px), 42px) !important;
}
html.is-standalone .app-footer {
  padding-bottom: max(calc(10px + env(safe-area-inset-bottom, 0px)), 28px) !important;
}
html.is-standalone .app {
  padding-bottom: max(calc(85px + env(safe-area-inset-bottom, 0px)), 110px) !important;
}

/* Native Capacitor App (Java native layer handles window insets on the container view) */
html.is-capacitor .app-header {
  padding-top: 0px !important;
}
html.is-capacitor .app-footer {
  padding-bottom: 8px !important;
}
html.is-capacitor .app {
  padding-bottom: 70px !important;
}

/* iOS Standalone notch clearance */
@supports (-webkit-touch-callout: none) {
  @media all and (display-mode: standalone) {
    .app-header {
      padding-top: max(env(safe-area-inset-top, 0px), 48px) !important;
    }
  }
}

.app-footer {
  position: fixed;
  bottom: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 100;
  text-align: center;
  padding: 8px 16px;
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.app-footer-content {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.app-version {
  font-weight: 700;
  color: var(--primary);
  background: rgba(79, 70, 229, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
}

.header-container {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: start;
  flex-shrink: 0;
}

.logo-box {
  width: 38px;
  height: 38px;
  min-width: 38px;
  color: white;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(79,70,229,0.15);
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 800;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}

.brand-text p {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}

.user-profile-pill {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 6px;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  min-width: 0;
  flex-shrink: 1;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: start;
  line-height: 1.15;
  min-width: 0;
  max-width: 110px;
  overflow: hidden;
}

.user-profile-info strong {
  font-size: 0.78rem;
  color: #1f2937;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
}

.user-status-badge {
  font-size: 0.62rem;
  font-weight: 700;
  color: #059669;
  background: #ecfdf5;
  padding: 1px 6px;
  border-radius: 99px;
  margin-top: 1px;
  white-space: nowrap;
}

.user-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 0 2px 6px rgba(79,70,229,0.12);
  flex-shrink: 0;
}

.logout-icon-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
  flex-shrink: 0;
}

.logout-icon-btn:hover {
  color: var(--danger);
  background: #fef2f2;
}

.logout-icon-btn svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 520px) {
  .header-container {
    padding: 6px 8px;
    gap: 6px;
  }
  .brand-text p {
    display: none;
  }
  .brand-text h2 {
    font-size: 1.05rem;
  }
  .header-actions {
    gap: 4px;
  }
  .user-profile-pill {
    padding: 2px 5px;
    gap: 4px;
  }
  .user-profile-info {
    max-width: 80px;
  }
  .user-profile-info strong {
    font-size: 0.72rem;
  }
  .user-status-badge {
    font-size: 0.58rem;
    padding: 0 4px;
  }
  .header-actions .btn-outline {
    padding: 4px 6px;
    font-size: 0.75rem;
    height: 28px;
  }
}

@media (max-width: 380px) {
  .user-profile-info {
    max-width: 60px;
  }
  .logo-box {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }
  .brand-text h2 {
    font-size: 0.95rem;
  }
}

/* ── Buttons ── */
button {
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: var(--transition);
  text-decoration: none;
}

button:active {
  transform: scale(0.98);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn-md {
  padding: 10px 18px;
  font-size: 0.9rem;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 4px 10px rgba(79,70,229,0.15);
}

.btn-primary:hover {
  background: var(--gradient-brand-hover);
  box-shadow: 0 6px 14px rgba(79,70,229,0.22);
}

.btn-secondary {
  background: #eef2ff;
  color: var(--primary);
}

.btn-secondary:hover {
  background: #e0e7ff;
}

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: #374151;
}

.btn-outline:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fee2e2;
}

.btn-danger:hover {
  background: #fee2e2;
}

/* ── Form Inputs ── */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  text-align: start;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  background: white;
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

/* direction/text-align on form controls cannot use logical properties
   (direction itself isn't a logical prop) — scope explicitly to RTL mode.
   In LTR mode the browser default (direction: ltr; text-align: left) applies. */
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea {
  direction: rtl;
  text-align: right;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(165,180,252,0.25);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

/* ── Surfaces & Cards ── */
.surface, .auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  transition: var(--transition);
}

/* ── View: Home / Hero ── */
.hero-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-top: 16px;
}

.hero-card {
  background: var(--gradient-glow), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-premium);
  display: flex;
  align-items: center;
}

.hero-copy {
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: rgba(79,70,229,0.06);
  color: var(--primary);
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-copy h1 {
  font-size: clamp(2rem, 3.5vw, 3rem);
  line-height: 1.2;
  color: #111827;
}

.hero-text {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.hero-actions button {
  flex: 1;
}

/* Preview Panels */
.preview-stack {
  display: grid;
  gap: 16px;
}

.preview-panel {
  padding: 20px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.preview-head strong {
  font-size: 1.1rem;
}

.preview-head p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.preview-items {
  display: grid;
  gap: 10px;
}

.preview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
}

.preview-item strong {
  color: var(--primary);
}

.quick-notes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px;
}

.note-chip {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: #4b5563;
}

/* ── View: Auth ── */
.auth-container {
  max-width: 440px;
  margin: 32px auto;
}

.panel {
  display: none !important;
}

.panel.active {
  display: flex !important;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.auth-card {
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h2 {
  font-size: 1.5rem;
  margin-top: 4px;
  margin-bottom: 4px;
}

.auth-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-note-box {
  background: #f9fafb;
  border-inline-start: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.auth-note-box h4 {
  font-size: 0.88rem;
  color: var(--primary);
  margin-bottom: 2px;
}

.auth-note-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  background: #f3f4f6;
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 8px 0;
  font-size: 0.88rem;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: var(--radius-md);
  align-self: stretch;
  margin-top: 8px;
}

.filter-tab {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.85rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.filter-tab .filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s;
}

.filter-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.filter-tab.active .filter-count {
  background: var(--primary-light, #e0e7ff);
  color: var(--primary, #4f46e5);
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  padding: 0 10px;
}

#googleSignInButton {
  width: 100%;
}

/* ── View: Dashboard ── */
.dashboard-stack {
  display: grid;
  gap: 24px;
}

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .dashboard-quick-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-hero h2 {
  font-size: 1.6rem;
}

.dashboard-hero p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.action-surface {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compact-head {
  margin-bottom: 12px;
}

.compact-head h4 {
  font-size: 1rem;
  font-weight: 800;
}

.user-template-picker {
  order: 2;
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.user-template-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.user-template-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  box-shadow: none;
}

.user-template-card strong,
.user-template-card span {
  display: block;
}

.user-template-card strong {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
}

.user-template-card span,
.user-template-card p {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.user-template-card p {
  display: -webkit-box;
  min-height: 2.1em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#view-create-group .surface {
  display: flex;
  flex-direction: column;
}

#view-create-group #createGroupForm {
  order: 1;
}

#view-create-group .user-template-picker {
  order: 2;
}

.selected-template-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(79, 70, 229, 0.16);
  border-radius: var(--radius-lg);
  background: rgba(79, 70, 229, 0.05);
}

.selected-template-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.selected-template-head strong,
.selected-template-head p {
  display: block;
}

.selected-template-head p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.template-source-label {
  display: none;
}

.template-items-editor {
  display: grid;
  gap: 8px;
}

.template-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 38px;
  gap: 8px;
  align-items: center;
}

.template-item-row input {
  min-height: 38px;
  padding: 8px 10px;
}

.template-item-row [data-template-item-quantity] {
  text-align: center;
}

.template-row-remove {
  min-width: 38px;
  min-height: 38px;
  padding: 0 !important;
  color: var(--danger);
}

.groups-title-container {
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

/* Groups List Grid */
.group-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.group-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.group-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.group-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.group-card-head h4 {
  font-size: 1.1rem;
  font-weight: 700;
}

.group-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.group-card-actions button {
  flex: 1;
}

/* ── View: Group ── */
.group-page {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.group-hero {
  background: var(--gradient-brand);
  color: white;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}

.group-hero h2 {
  color: white;
  font-size: 1.4rem;
  margin-top: 4px;
  margin-bottom: 2px;
}

.group-hero .section-kicker {
  background: rgba(255,255,255,0.18);
  color: white;
}

.group-description {
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  font-size: 0.95rem;
}

.group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.group-hero .btn-primary {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.group-hero .btn-primary:hover {
  background: rgba(255, 255, 255, 0.3);
}

.group-hero .btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: white;
}

.group-hero .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
}

.group-summary-box {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 20px;
  border-radius: var(--radius-lg);
  min-width: 240px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.group-summary-box strong {
  color: white;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  margin-bottom: 6px;
  display: block;
}

.group-summary-box p {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.group-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.group-layout-single {
  width: 100%;
}

.group-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Items List ── */
.items-surface {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.item-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.item-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.item-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.item-top h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.35;
  margin: 0;
  flex: 1;
}

.item-top strong {
  font-size: 0.95rem;
  color: #111827;
  flex-shrink: 0;
  margin-inline-start: 8px;
  white-space: nowrap;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 24px;
}

.progress-track {
  height: 6px;
  background: #f3f4f6;
  border-radius: 99px;
  overflow: hidden;
  width: 100%;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-brand);
  border-radius: 99px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  width: 100%;
}

.item-actions button {
  flex: 1 1 auto;
  font-size: 0.8rem !important;
  padding: 6px 8px !important;
  min-height: 34px;
  white-space: nowrap;
}

/* When there are admin buttons too, the claim button gets its own full row */
.item-actions button[data-claim-item]:not(:only-child) {
  flex: 1 1 100%;
}

/* ── Members List ── */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}

.member-row:last-child {
  border-bottom: none;
}

/* ── Status Pills & Chips ── */
.group-type-tag, .status-chip, .pill, .tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.group-type-tag {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-chip {
  background: #ecfdf5;
  color: #047857;
}

.pill {
  background: #f3f4f6;
  color: #4b5563;
}

.tag {
  background: #f5f3ff;
  color: #6d28d9;
}

/* ── Bottom Navigation Bar ── */
.bottom-nav {
  position: fixed;
  bottom: 16px;
  /* left/50% + translateX(-50%) is a physical viewport-centering technique,
     not a start/end concern — it is direction-agnostic and stays as-is */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 500px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(229, 231, 235, 0.8);
  border-radius: 99px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 6px;
  display: flex;
  gap: 4px;
  z-index: 1000;
}

.bottom-nav button {
  flex: 1;
  padding: 10px 0;
  background: transparent;
  color: var(--text-muted);
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: var(--transition);
}

.bottom-nav button.active {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,0.2);
}

/* ── Toast ── */
.toast-host {
  position: fixed;
  bottom: 84px;
  /* physical centering technique (see .bottom-nav) — direction-agnostic */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1100;
  pointer-events: none;
}

.toast {
  background: #1f2937;
  color: white;
  padding: 8px 18px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastIn {
  from { transform: translateY(12px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Responsive Adaptations ── */
@media (max-width: 900px) {
  .hero-layout, .dashboard-grid, .group-layout {
    grid-template-columns: 1fr;
  }

  .hero-card {
    order: -1;
  }

  .hero-layout {
    margin-top: 8px;
    gap: 14px;
  }

  .hero-copy {
    gap: 10px;
  }

  .preview-stack {
    gap: 10px;
  }

  .preview-panel {
    padding: 14px;
  }

  .preview-head {
    margin-bottom: 8px;
  }

  .preview-items {
    gap: 6px;
  }

  .quick-notes {
    padding: 10px;
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .shell {
    padding: 16px 12px;
  }
  
  .surface, .auth-card {
    padding: 18px;
  }
  
  .hero-copy {
    padding: 16px 16px;
    align-items: center;
    text-align: center;
  }
  
  .hero-copy h1 {
    font-size: 1.6rem;
  }
  
  .hero-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .field-span-2 {
    grid-column: auto;
  }
  
  .group-hero {
    padding: 20px;
    flex-direction: column;
  }
  
  .group-summary-box {
    min-width: 0;
  }
  
  .header-container {
    padding: 10px 12px;
  }
  
  .brand-text p {
    display: none;
  }
  
  .user-profile-pill {
    padding: 2px 6px 2px 10px;
    gap: 8px;
  }
  
  .user-profile-info strong {
    font-size: 0.75rem;
  }
  
  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
}

/* ── Dynamic Classes from JS ── */
.primary-button {
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: var(--transition);
  text-decoration: none;
  background: var(--gradient-brand);
  color: white;
  padding: 10px 18px;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(79,70,229,0.15);
}

.primary-button:hover {
  background: var(--gradient-brand-hover);
  box-shadow: 0 6px 14px rgba(79,70,229,0.22);
}

.ghost-button {
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: var(--transition);
  text-decoration: none;
  background: white;
  border: 1px solid var(--border);
  color: #374151;
  padding: 10px 18px;
  font-size: 0.9rem;
}

.ghost-button:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

[data-remove-item].ghost-button {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fee2e2;
}

[data-remove-item].ghost-button:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.muted {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ── Dashboard Layout Redesign ── */
.dashboard-welcome-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  text-align: start;
}
.welcome-copy h2 {
  font-size: 1.4rem;
  color: #111827;
  font-weight: 800;
  margin-bottom: 4px;
}
.welcome-copy p {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.welcome-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn-ghost {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid var(--border);
  font-weight: 700;
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-ghost:hover {
  background: #e5e7eb;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.stat-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: start;
}
.stat-kicker {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
}
.stat-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.stat-icon-wrapper svg {
  width: 18px;
  height: 18px;
}
.clipboard-theme {
  background: #e0e7ff;
  color: var(--primary);
}
.package-theme {
  background: #fef3c7;
  color: #d97706;
}
.save-theme {
  background: #ecfdf5;
  color: #059669;
}

/* Live Status Summary Card */
.live-status-surface {
  margin-bottom: 12px;
  padding: 14px 18px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.live-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.live-status-title-group h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 2px;
}
.live-status-title-group p {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.live-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
}
.live-status-badge.inactive {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fef3c7;
}
.live-status-badge.active {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #d1fae5;
}
.live-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.live-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.live-stat-item:hover {
  background: #f3f4f6;
}
.live-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}
.live-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #374151;
  margin: 2px 0 1px 0;
}
.live-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Events list */
.events-section {
  margin-top: 8px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar,
.admin-content,
.admin-panel,
.admin-template-form {
  min-width: 0;
}

.admin-sidebar {
  position: sticky;
  top: 112px;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-sidebar-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.admin-sidebar-head h2 {
  font-size: 1.35rem;
}

.admin-nav {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  font-weight: 800;
  text-align: start;
  padding: 0 14px;
}

.admin-nav.active {
  border-color: rgba(79, 70, 229, 0.16);
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
}

.admin-sidebar-actions {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.admin-panel {
  display: none;
  gap: 18px;
}

.admin-panel.active {
  display: grid;
}

.admin-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-panel-head h2 {
  margin-bottom: 6px;
  font-size: 1.45rem;
}

.admin-panel-head p {
  color: var(--text-muted);
}

.admin-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.admin-chart-card {
  display: grid;
  gap: 14px;
}

.admin-chart-head h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.admin-chart-head p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.admin-chart {
  display: grid;
  gap: 12px;
  min-height: 150px;
  align-content: center;
}

.chart-row {
  display: grid;
  gap: 7px;
}

.chart-row-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.86rem;
}

.chart-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2ff;
  overflow: hidden;
}

.chart-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-brand);
}

.progress-donut {
  --progress: 0%;
  width: 128px;
  height: 128px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--primary) var(--progress), #e5e7eb 0);
  position: relative;
}

.progress-donut::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--surface);
}

.progress-donut strong,
.progress-donut span {
  position: relative;
  z-index: 1;
}

.progress-donut strong {
  font-size: 1.35rem;
}

.progress-donut span {
  margin-top: 30px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend b {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
}

.admin-row-tall {
  align-items: flex-start;
}

.admin-row strong,
.admin-row span {
  display: block;
}

.admin-row strong {
  font-weight: 800;
  color: var(--text);
}

.admin-row span {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-row-meta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-template-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-template-form label:nth-of-type(3),
.admin-template-form label:nth-of-type(4),
.admin-form-actions {
  grid-column: 1 / -1;
}

.admin-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

.danger-action {
  color: var(--danger) !important;
  border-color: rgba(239, 68, 68, 0.22) !important;
  background: rgba(239, 68, 68, 0.06) !important;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.events-title-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #111827;
}
.events-title-wrapper h3 {
  font-size: 1.15rem;
  font-weight: 700;
}
.save-server-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(79,70,229,0.06);
  padding: 3px 8px;
  border-radius: 99px;
}
.dashed-empty-state {
  border: 2px dashed #d1d5db;
  background: #f9fafb;
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.empty-state-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 300px;
}
.empty-icon-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.my-area-btn {
  width: 100%;
  max-width: 160px;
  margin-bottom: 6px;
  min-height: 36px;
  box-shadow: 0 4px 12px rgba(79,70,229,0.1);
}
.empty-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-charts-grid {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    position: static;
  }
  .dashboard-welcome-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .live-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .selected-template-head {
    flex-direction: column;
  }
  .user-template-list {
    max-height: none;
  }
  .admin-template-form {
    grid-template-columns: 1fr;
  }
  .admin-row {
    align-items: stretch;
    flex-direction: column;
  }
  .admin-row-meta {
    justify-content: flex-start;
  }
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  inset-inline-start: 0;
  inset-inline-end: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
  padding: 16px;
  box-sizing: border-box;
}

.modal-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 92%;
  max-width: 480px;
  max-height: 85vh;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  box-sizing: border-box;
}

/* direction isn't a logical property — scope explicitly to RTL mode,
   same pattern as the form controls above */
html[dir="rtl"] .modal-card {
  direction: rtl;
}

.modal-card h3 {
  font-size: 1.2rem;
  margin-bottom: 16px;
  font-weight: 700;
  color: #111827;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-body label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 6px;
  display: block;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-shrink: 0;
}

.modal-actions button {
  flex: 1;
}

.modal-close-icon {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.modal-close-icon:hover {
  background: var(--surface-alt, #f3f4f6);
  color: var(--text, #111827);
}

/* AI advisor loader and animations */
.ai-loader {
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* AI Advice Modal & Card Design */
.ai-advice-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px;
}

.ai-card {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-sizing: border-box;
  font-size: 0.93rem;
  line-height: 1.6;
  text-align: right;
  direction: rtl;
}

.ai-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ai-card-overview {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.07), rgba(14, 165, 233, 0.07));
  border: 1px solid rgba(79, 70, 229, 0.18);
  color: #1e1b4b;
}

.ai-card-overview .ai-card-title {
  color: var(--primary);
}

.ai-card-quantities {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

.ai-card-quantities .ai-card-title {
  color: #334155;
}

.ai-card-missing {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}

.ai-card-missing .ai-card-title {
  color: #15803d;
}

.ai-missing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ai-missing-chip {
  background: #ffffff;
  border: 1px solid #86efac;
  color: #166534;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.ai-card-tip {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
}

.ai-card-tip .ai-card-title {
  color: #b45309;
}

.ai-advice-body {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

.ai-advice-body::-webkit-scrollbar {
  width: 6px;
}

.ai-advice-body::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

/* App Footer */
.app-footer-fixpoint {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
  z-index: 10;
}

/* Sheets Importer Styles */
.sheets-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-alt);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 8px;
  font-size: 0.9rem;
}

.sheets-preview-row input[type="text"] {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: var(--text);
  padding: 2px 4px;
}

.sheets-preview-row input[type="number"] {
  width: 50px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text);
  padding: 4px;
}

.sheets-preview-row button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.sheets-preview-row button:hover {
  color: #ef4444;
}

/* ── Rich Semantic SEO & GEO Section ── */
.seo-geo-section {
  margin-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.seo-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seo-block h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.seo-block p.seo-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.seo-steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 6px;
}

.seo-step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.seo-step-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.seo-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.seo-step-info h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text);
}

.seo-step-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.seo-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.seo-case-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.seo-case-card .icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.seo-case-card p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.seo-faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.seo-faq-item h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--text);
}

.seo-faq-item p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

