/* ==========================================================================
   RallyNPS - Application Styles
   ========================================================================== */

/* ---------- Custom Properties ---------- */
:root {
  /* RallyTasks design-system palette — deep forest green, earth tones (not neon) */
  --rally-green: #35644F;
  --rally-green-hover: #2D5541;
  --rally-dark: #244737;
  --rally-darker: #1A3328;
  --rally-light: #D7E8DD;
  --rally-lightest: #F1F6F3;
  --rally-accent: #A8D5B5;
  --rally-muted: #7AA88A;
  --rally-cream: #F0EDE5;
  --rally-ink: #0F1A14;
  --rally-card-ink: #111C16;
  --rally-border-ink: #2D4A35;

  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --red-500: #EF4444;
  --red-600: #DC2626;
  --red-50: #FEF2F2;
  --yellow-500: #EAB308;
  --yellow-400: #FACC15;
  --yellow-50: #FEFCE8;
  --blue-500: #3B82F6;
  --blue-50: #EFF6FF;

  --white: #FFFFFF;
  --black: #000000;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, monospace;

  --sidebar-width: 240px;
  --topbar-height: 56px;
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--rally-green); text-decoration: none; }
a:hover { color: var(--rally-dark); }

img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ---------- Typography ---------- */
h1 { font-size: 1.875rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem;   font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem;  font-weight: 600; line-height: 1.3; }
h4 { font-size: 1.1rem;   font-weight: 600; line-height: 1.4; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }

/* ---------- Layout: App Shell ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform var(--transition-base);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
}

.sidebar-logo svg { flex-shrink: 0; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.sidebar-nav-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.sidebar-nav-item.active {
  background: var(--rally-lightest);
  color: var(--rally-dark);
}

.sidebar-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav-item.active svg { opacity: 1; }

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gray-400);
  padding: 18px 12px 6px;
}

/* Org switcher in sidebar bottom */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--gray-200);
}

.org-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.org-switcher:hover { background: var(--gray-100); }
.org-switcher:focus-visible {
  outline: 2px solid var(--rally-green);
  outline-offset: 2px;
}

.org-switcher-arrow {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.org-switcher-arrow.open { transform: rotate(180deg); }

.org-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--rally-green);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.org-switcher-info {
  flex: 1;
  min-width: 0;
}

.org-switcher-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-switcher-plan {
  font-size: 0.7rem;
  color: var(--gray-400);
}

.org-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.org-dropdown.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.org-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  outline: none;
}

.org-dropdown-item:hover,
.org-dropdown-item.focused { background: var(--gray-100); }
.org-dropdown-item.active { background: var(--rally-lightest); color: var(--rally-dark); }
.org-dropdown-item.active.focused { background: var(--rally-light); }

.org-dropdown-item-info {
  flex: 1;
  min-width: 0;
}

.org-dropdown-item-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-dropdown-item-meta {
  font-size: 0.7rem;
  color: var(--gray-400);
  display: flex;
  gap: 6px;
}

.org-dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

.org-dropdown-create {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--rally-green);
  font-weight: 500;
  outline: none;
}

.org-dropdown-create:hover,
.org-dropdown-create.focused {
  background: var(--rally-lightest);
}

.org-dropdown-create svg {
  flex-shrink: 0;
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
}

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

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-menu:hover { background: var(--gray-100); }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gray-300);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
}

.page-content {
  padding: 24px;
  max-width: 1200px;
}

.page-content-wide {
  padding: 24px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

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

.btn-primary {
  background: var(--rally-green);
  color: var(--white);
  border-color: var(--rally-green);
}

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

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn-danger {
  background: var(--red-500);
  color: var(--white);
  border-color: var(--red-500);
}

.btn-danger:hover:not(:disabled) {
  background: var(--red-600);
  border-color: var(--red-600);
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-900);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

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

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--rally-green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.form-input.error,
.form-textarea.error {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea { min-height: 100px; resize: vertical; }
.form-error { font-size: 0.8rem; color: var(--red-500); margin-top: 4px; }

.form-input-group {
  display: flex;
  align-items: stretch;
}

.form-input-group .form-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.form-input-addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-left: 0;
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--gray-500);
  white-space: nowrap;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--white);
}

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

.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}

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

.table tr:hover td { background: var(--gray-50); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-green  { background: var(--rally-light); color: var(--rally-dark); }
.badge-yellow { background: var(--yellow-50);   color: #92400E; }
.badge-red    { background: var(--red-50);      color: var(--red-600); }
.badge-blue   { background: var(--blue-50);     color: #1D4ED8; }
.badge-gray   { background: var(--gray-100);    color: var(--gray-600); }

/* ---------- Dashboard: NPS Score Card ---------- */
.nps-score-card {
  text-align: center;
  padding: 32px 24px;
}

.nps-score-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.nps-score-value {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
}

.nps-score-value.positive { color: var(--rally-green); }
.nps-score-value.neutral  { color: var(--yellow-500); }
.nps-score-value.negative { color: var(--red-500); }

.nps-score-range {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 8px;
}

.nps-response-count {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-top: 12px;
}

/* ---------- Dashboard: NPS Breakdown Bar ---------- */
.nps-breakdown {
  margin: 24px 0;
}

.nps-bar-container {
  display: flex;
  height: 40px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-200);
}

.nps-bar-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white);
  transition: width 0.6s ease;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.nps-bar-promoters  { background: var(--rally-green); }
.nps-bar-passives   { background: var(--yellow-400); color: var(--gray-800); }
.nps-bar-detractors { background: var(--red-500); }

.nps-breakdown-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  gap: 16px;
}

.nps-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.nps-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nps-legend-dot.promoter  { background: var(--rally-green); }
.nps-legend-dot.passive   { background: var(--yellow-400); }
.nps-legend-dot.detractor { background: var(--red-500); }

.nps-legend-value {
  font-weight: 700;
  margin-left: 4px;
}

/* ---------- Dashboard: Response Feed ---------- */
.response-feed { display: flex; flex-direction: column; gap: 1px; }

.response-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}

.response-item:last-child { border-bottom: 0; }

.response-emoji {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.response-emoji.promoter  { background: var(--rally-light); }
.response-emoji.passive   { background: var(--yellow-50); }
.response-emoji.detractor { background: var(--red-50); }

.response-body { flex: 1; min-width: 0; }

.response-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.response-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.response-score-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.response-score-badge.promoter  { background: var(--rally-light); color: var(--rally-dark); }
.response-score-badge.passive   { background: var(--yellow-50); color: #92400E; }
.response-score-badge.detractor { background: var(--red-50); color: var(--red-600); }

.response-time {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.response-comment {
  font-size: 0.875rem;
  color: var(--gray-700);
  margin-top: 4px;
  line-height: 1.5;
}

.response-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.response-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--gray-100);
  color: var(--gray-600);
}

.response-tag.ai-sentiment { background: var(--blue-50); color: #1D4ED8; }
.response-tag.ai-theme { background: var(--rally-lightest); color: var(--rally-dark); }

/* ---------- Dashboard: Filters ---------- */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  align-items: start;
}

.filter-sidebar .card { padding: 16px; }

.filter-group {
  margin-bottom: 16px;
}

.filter-group:last-child { margin-bottom: 0; }

.filter-group-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--gray-600);
  transition: all var(--transition-fast);
}

.filter-option:hover { background: var(--gray-100); }

.filter-option.active {
  background: var(--rally-lightest);
  color: var(--rally-dark);
  font-weight: 500;
}

.filter-option .count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* ---------- Dashboard: NPS Graph ---------- */
.nps-graph-container {
  padding: 20px;
  height: 200px;
  position: relative;
}

.nps-graph-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-bottom: 24px;
}

.nps-graph-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.nps-graph-bar {
  width: 100%;
  max-width: 32px;
  border-radius: 4px 4px 0 0;
  background: var(--rally-green);
  transition: height 0.4s ease;
  min-height: 2px;
}

.nps-graph-bar.negative { background: var(--red-500); }

.nps-graph-bar-label {
  font-size: 0.65rem;
  color: var(--gray-400);
  margin-top: 6px;
  white-space: nowrap;
}

.nps-graph-zero-line {
  position: absolute;
  left: 20px;
  right: 20px;
  border-top: 1px dashed var(--gray-300);
}

/* ---------- Search ---------- */
.search-input-wrap {
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-input-wrap .form-input {
  padding-left: 36px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  padding: 24px;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(10px) scale(0.98);
  transition: transform var(--transition-base);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-lg { max-width: 720px; }

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  transition: all var(--transition-fast);
}

.modal-close:hover { background: var(--gray-100); color: var(--gray-600); }

.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  min-width: 280px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn 0.3s ease;
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast-success { border-left: 3px solid var(--rally-green); }
.toast-error   { border-left: 3px solid var(--red-500); }
.toast-info    { border-left: 3px solid var(--blue-500); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--rally-green);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 4px; }

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px;
  color: var(--gray-400);
  font-size: 0.9rem;
}

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

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--gray-400);
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 20px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Empty State V2 (Panel Review D P0) ---------- */
.empty-state--v2 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 96px 24px;
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
}

.empty-state-icon--v2 {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  background: color-mix(in srgb, var(--rally-green, #35644F) 12%, transparent);
  color: var(--rally-green, #35644F);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.empty-state-icon--v2 svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
}

.empty-state-heading {
  font-family: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900, #111827);
  margin: 0 0 8px;
  line-height: 1.3;
}

.empty-state-description {
  font-size: 0.95rem;
  color: var(--gray-500, #6B7280);
  margin: 0 0 24px;
  line-height: 1.5;
  max-width: 420px;
}

.empty-state-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-state-extra {
  width: 100%;
  margin-top: 12px;
}

.empty-state-example-card {
  background: var(--gray-50, #F9FAFB);
  border: 1px dashed var(--gray-200, #E5E7EB);
  border-radius: 12px;
  padding: 20px;
  text-align: left;
  max-width: 420px;
  margin: 0 auto;
}

.empty-state-example-card blockquote {
  margin: 0 0 8px;
  font-style: italic;
  color: var(--gray-600, #4B5563);
  font-size: 0.9rem;
  line-height: 1.5;
}

.empty-state-example-card cite {
  font-style: normal;
  color: var(--gray-400, #9CA3AF);
  font-size: 0.8rem;
}

.empty-state-embed-preview {
  background: var(--white, #fff);
  border: 1px solid var(--gray-200, #E5E7EB);
  border-radius: 12px;
  padding: 20px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.empty-state-embed-preview-score {
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--rally-green, #35644F);
  line-height: 1;
}

.empty-state-embed-preview-label {
  font-size: 0.8rem;
  color: var(--gray-500, #6B7280);
  text-align: left;
}

.empty-state-embed-preview-label strong {
  display: block;
  color: var(--gray-800, #1F2937);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.empty-state-input-row {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}

.empty-state-input-row .form-input {
  flex: 1;
}

@media (max-width: 640px) {
  .empty-state--v2 {
    padding: 64px 16px;
  }
  .empty-state-heading {
    font-size: 1.25rem;
  }
  .empty-state-actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }
  .empty-state-actions .btn {
    width: 100%;
  }
}

/* ---------- Onboarding ---------- */
.onboarding-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--gray-50);
}

.onboarding-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  padding: 48px 40px;
}

.onboarding-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
}

.onboarding-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 32px;
}

.onboarding-progress-step {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-200);
  transition: background 0.3s ease;
}

.onboarding-progress-step.completed { background: var(--rally-green); }
.onboarding-progress-step.active { background: var(--rally-green); }

.onboarding-step-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.onboarding-step-desc {
  font-size: 0.95rem;
  color: var(--gray-500);
  margin-bottom: 28px;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
}

.onboarding-skip {
  font-size: 0.85rem;
  color: var(--gray-400);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.onboarding-skip:hover { color: var(--gray-600); }

/* ---------- Onboarding coach chat (step 0) ---------- */
.onboarding-card-coach { max-width: 560px; }

.coach-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
  max-height: 340px;
  overflow-y: auto;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  border: 1px solid var(--gray-200);
}

.coach-msg {
  display: flex;
  width: 100%;
}

.coach-msg-bot { justify-content: flex-start; }
.coach-msg-user { justify-content: flex-end; }

.coach-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.coach-msg-bot .coach-bubble {
  background: var(--white);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: 4px;
}

.coach-msg-user .coach-bubble {
  background: var(--rally-green);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.coach-msg-typing .coach-bubble {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}

.coach-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: coach-dot-bounce 1.2s infinite ease-in-out both;
}

.coach-dot:nth-child(1) { animation-delay: -0.32s; }
.coach-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes coach-dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .coach-dot { animation: none; opacity: 0.6; }
}

.coach-form { width: 100%; }

.coach-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.coach-input-row .form-input {
  flex: 1;
  min-width: 0;
}

/* Color picker */
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker-swatch {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  border: 2px solid var(--gray-200);
  cursor: pointer;
  overflow: hidden;
}

.color-picker-swatch input[type="color"] {
  width: 60px;
  height: 60px;
  border: none;
  cursor: pointer;
  margin: -6px;
}

/* File upload */
.file-upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-upload-zone:hover {
  border-color: var(--rally-green);
  background: var(--rally-lightest);
}

.file-upload-zone.dragging {
  border-color: var(--rally-green);
  background: var(--rally-light);
}

.file-upload-icon {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--gray-400);
}

.file-upload-text {
  font-size: 0.9rem;
  color: var(--gray-500);
}

.file-upload-text strong { color: var(--rally-green); }

/* Email preview */
.email-preview-frame {
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.email-preview-inner {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 32px;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.email-preview-inner h3 {
  margin-bottom: 12px;
}

.email-preview-scores {
  display: flex;
  gap: 6px;
  margin: 20px 0;
}

.email-preview-score {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: default;
}

/* ---------- Status Dots ---------- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.active    { background: var(--rally-green); }
.status-dot.draft     { background: var(--gray-400); }
.status-dot.completed { background: var(--blue-500); }

/* ---------- Stats Grid ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  margin-bottom: 6px;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* ---------- Login Page ---------- */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  max-width: 400px;
  width: 100%;
}

.login-card .card {
  padding: 40px;
  text-align: left;
}

/* ---------- Auth Tabs (Phone | Email | Google) ---------- */
.auth-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--gray-500);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.auth-tab:hover:not(:disabled) { color: var(--rally-green); }
.auth-tab:focus-visible {
  outline: 2px solid var(--rally-green);
  outline-offset: 2px;
  border-radius: 4px;
}
.auth-tab.active {
  color: var(--rally-green);
  border-bottom-color: var(--rally-green);
}
.auth-tab:disabled {
  color: var(--gray-300);
  cursor: not-allowed;
}

/* ---------- Feedback Widget Placeholder ---------- */
.feedback-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 90;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .filter-sidebar {
    order: -1;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .page-content {
    padding: 16px;
  }

  /* Mobile bottom nav */
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    z-index: 40;
    padding: 4px 0;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    font-size: 0.65rem;
    color: var(--gray-500);
    cursor: pointer;
  }

  .mobile-nav-item.active { color: var(--rally-green); }
  .mobile-nav-item svg { width: 22px; height: 22px; }

  .main-content {
    padding-bottom: 72px;
  }

  .nps-score-value { font-size: 3rem; }

  .nps-breakdown-legend {
    flex-direction: column;
    gap: 8px;
  }

  .onboarding-card {
    padding: 32px 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal { margin: 12px; }
}

@media (min-width: 769px) {
  .mobile-nav { display: none; }
  .mobile-menu-btn { display: none; }
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ==========================================================================
   RallyNPS Marketing Pages — `m-` prefixed to avoid collisions with the app
   RallyTasks design-system palette on a deep forest ink background.
   ========================================================================== */

.m-page {
  background: var(--rally-ink);
  color: var(--rally-cream);
  font-family: var(--font-sans);
  line-height: 1.55;
  min-height: 100vh;
}

.m-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

.m-container--narrow { max-width: 820px; }

/* Header / nav */
.m-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(140%) blur(8px);
  background: rgba(15, 26, 20, 0.85);
  border-bottom: 1px solid var(--rally-border-ink);
}
.m-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.m-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--rally-cream);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
}
.m-brand:hover { color: var(--rally-cream); }
.m-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--rally-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.m-nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.m-nav-links a {
  color: var(--rally-cream);
  opacity: 0.85;
  font-size: 0.95rem;
  text-decoration: none;
}
.m-nav-links a:hover,
.m-nav-links a:focus-visible { opacity: 1; color: var(--rally-accent); }
.m-nav-links a:focus-visible {
  outline: 2px solid var(--rally-accent);
  outline-offset: 3px;
  border-radius: 3px;
}
.m-nav-cta {
  background: var(--rally-green);
  color: var(--rally-cream) !important;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  border: 1px solid var(--rally-border-ink);
  transition: background 150ms ease, transform 150ms ease;
}
.m-nav-cta:hover { background: var(--rally-green-hover); opacity: 1 !important; }

@media (max-width: 720px) {
  .m-nav-links { gap: 16px; }
  .m-nav-links .m-hide-sm { display: none; }
}

/* Hero */
.m-hero {
  padding: 96px 0 72px;
  position: relative;
  overflow: hidden;
}
.m-hero::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 520px;
  height: 520px;
  background: radial-gradient(closest-side, rgba(168, 213, 181, 0.18), transparent 70%);
  pointer-events: none;
}
.m-eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rally-accent);
  font-weight: 600;
  margin-bottom: 20px;
  padding: 6px 12px;
  border: 1px solid var(--rally-border-ink);
  border-radius: 999px;
  background: rgba(168, 213, 181, 0.06);
}
.m-h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.6rem);
  line-height: 1.08;
  font-weight: 800;
  color: var(--rally-cream);
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  max-width: 22ch;
}
.m-h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--rally-accent) 0%, var(--rally-cream) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.m-lede {
  font-size: clamp(1.05rem, 1.8vw, 1.2rem);
  color: var(--rally-cream);
  opacity: 0.85;
  max-width: 56ch;
  margin-bottom: 32px;
}
.m-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}
.m-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
  cursor: pointer;
}
.m-btn:focus-visible {
  outline: 2px solid var(--rally-accent);
  outline-offset: 3px;
}
.m-btn-primary {
  background: var(--rally-green);
  color: var(--rally-cream);
  border-color: var(--rally-green);
}
.m-btn-primary:hover { background: var(--rally-green-hover); border-color: var(--rally-green-hover); color: var(--rally-cream); }
.m-btn-ghost {
  background: transparent;
  color: var(--rally-cream);
  border-color: var(--rally-border-ink);
}
.m-btn-ghost:hover { background: var(--rally-card-ink); border-color: var(--rally-muted); color: var(--rally-cream); }
.m-fineprint {
  color: var(--rally-muted);
  font-size: 0.85rem;
}

/* Social proof strip */
.m-proof {
  padding: 32px 0;
  border-top: 1px solid var(--rally-border-ink);
  border-bottom: 1px solid var(--rally-border-ink);
  background: rgba(17, 28, 22, 0.6);
}
.m-proof-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.m-proof-label {
  color: var(--rally-muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.m-proof-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: center;
  opacity: 0.65;
}
.m-proof-logo {
  color: var(--rally-cream);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

/* Sections */
.m-section {
  padding: 80px 0;
  border-bottom: 1px solid var(--rally-border-ink);
}
.m-section--tight { padding: 56px 0; }
.m-section-head {
  max-width: 52ch;
  margin: 0 auto 48px;
  text-align: center;
}
.m-section-kicker {
  color: var(--rally-accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  margin-bottom: 12px;
}
.m-h2 {
  font-size: clamp(1.6rem, 3.6vw, 2.3rem);
  font-weight: 800;
  color: var(--rally-cream);
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: 14px;
}
.m-h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--rally-cream);
  margin-bottom: 8px;
}
.m-body { color: var(--rally-cream); opacity: 0.82; }
.m-body p + p { margin-top: 12px; }

/* Grid: 3-column + generic */
.m-grid {
  display: grid;
  gap: 24px;
}
.m-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.m-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) {
  .m-grid--3, .m-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .m-grid--2, .m-grid--3, .m-grid--4 { grid-template-columns: 1fr; }
}

/* Cards */
.m-card {
  background: var(--rally-card-ink);
  border: 1px solid var(--rally-border-ink);
  border-radius: 14px;
  padding: 28px;
  transition: border-color 150ms ease, transform 150ms ease;
}
.m-card:hover { border-color: var(--rally-muted); }
.m-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(168, 213, 181, 0.12);
  color: var(--rally-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* Feature rows */
.m-feature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 56px 0;
}
.m-feature-row + .m-feature-row { border-top: 1px solid var(--rally-border-ink); }
@media (max-width: 860px) { .m-feature-row { grid-template-columns: 1fr; gap: 24px; } }

/* List styles */
.m-list { list-style: none; padding: 0; margin: 0; }
.m-list li {
  padding-left: 28px;
  position: relative;
  margin-bottom: 10px;
  color: var(--rally-cream);
  opacity: 0.88;
}
.m-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--rally-green);
  border: 2px solid var(--rally-accent);
}

/* Pricing teaser tiles */
.m-price-tile {
  background: var(--rally-card-ink);
  border: 1px solid var(--rally-border-ink);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
}
.m-price-tile--featured {
  border-color: var(--rally-accent);
  box-shadow: 0 0 0 1px rgba(168, 213, 181, 0.25);
}
.m-price-tile h3 { font-size: 1rem; color: var(--rally-accent); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.1em; }
.m-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--rally-cream);
  margin-bottom: 4px;
}
.m-price small { font-size: 0.9rem; opacity: 0.7; font-weight: 500; }

/* Rally band */
.m-rally-band {
  padding: 64px 0;
  background: linear-gradient(180deg, rgba(17, 28, 22, 0.0), rgba(17, 28, 22, 0.6));
  border-top: 1px solid var(--rally-border-ink);
  border-bottom: 1px solid var(--rally-border-ink);
}
.m-rally-band p { color: var(--rally-cream); opacity: 0.9; }

/* Footer */
.m-footer {
  padding: 56px 0 40px;
  background: var(--rally-ink);
  color: var(--rally-cream);
}
.m-footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}
@media (max-width: 760px) { .m-footer-grid { grid-template-columns: 1fr 1fr; } }
.m-footer h4 {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rally-accent);
  margin-bottom: 14px;
  font-weight: 700;
}
.m-footer a {
  display: block;
  color: var(--rally-cream);
  opacity: 0.75;
  font-size: 0.92rem;
  margin-bottom: 8px;
  text-decoration: none;
}
.m-footer a:hover, .m-footer a:focus-visible { opacity: 1; color: var(--rally-accent); }
.m-footer a:focus-visible {
  outline: 2px solid var(--rally-accent); outline-offset: 2px; border-radius: 3px;
}
.m-footer-legal {
  padding-top: 28px;
  border-top: 1px solid var(--rally-border-ink);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--rally-muted);
  font-size: 0.82rem;
}

/* Inline badges (survey types) */
.m-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.m-badge {
  background: rgba(168, 213, 181, 0.08);
  border: 1px solid var(--rally-border-ink);
  color: var(--rally-cream);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}

/* Small quote */
.m-quote {
  background: var(--rally-card-ink);
  border: 1px solid var(--rally-border-ink);
  border-left: 3px solid var(--rally-accent);
  border-radius: 12px;
  padding: 24px 28px;
  color: var(--rally-cream);
  font-size: 1.05rem;
  line-height: 1.5;
}
.m-quote cite {
  display: block;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--rally-muted);
  font-style: normal;
}

/* ---------- Word Cloud ---------- */
.word-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 16px;
  min-height: 80px;
}
.word-cloud-item {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  line-height: 1.2;
  font-weight: 500;
  white-space: nowrap;
}
.word-cloud-item:hover {
  opacity: 0.8;
  transform: scale(1.08);
}
.word-cloud-item:active {
  transform: scale(0.96);
}
.word-cloud-item.active {
  outline: 2px solid var(--rally-green);
  outline-offset: 2px;
}
.word-cloud-item--positive {
  background: rgba(53, 100, 79, 0.1);
  color: var(--rally-green);
}
.word-cloud-item--negative {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red-500);
}
.word-cloud-item--neutral {
  background: var(--gray-100);
  color: var(--gray-600);
}
.word-cloud-item-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.word-cloud-ticket-btn {
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  background: transparent;
  color: var(--gray-600, #4b5563);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.word-cloud-ticket-btn:hover {
  background: var(--gray-100, #f3f4f6);
  color: var(--red-500, #ef4444);
}
.word-cloud-ticket-btn:focus-visible {
  outline: 2px solid var(--rally-green, #35644F);
  outline-offset: 2px;
}
.word-cloud-hint {
  text-align: center;
}

@media (max-width: 640px) {
  .word-cloud {
    gap: 6px 8px;
    padding: 12px 8px;
  }
  .word-cloud-item {
    padding: 3px 8px;
  }

/* ==========================================================================
   Evidence Panel (Reverse-Brief Inspector)
   "Why?" button + evidence modal for AI claim traceability
   ========================================================================== */

.btn-evidence {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--rally-green);
  background: var(--rally-lightest);
  border: 1px solid var(--rally-accent);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.4;
  vertical-align: middle;
  margin-left: 4px;
}
.btn-evidence:hover {
  background: var(--rally-light);
  color: var(--rally-dark);
  border-color: var(--rally-green);
}
.btn-evidence:active {
  transform: scale(0.97);
}

/* Evidence modal sizing */
.evidence-modal .modal {
  max-width: 640px;
  max-height: 80vh;
}
.evidence-modal .modal-body {
  overflow-y: auto;
  max-height: 60vh;
}

.evidence-claim {
  padding: 10px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  color: var(--gray-700);
  margin-bottom: 12px;
  line-height: 1.45;
}

.evidence-count {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 10px;
  font-weight: 500;
}

.evidence-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.evidence-item {
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  transition: border-color 0.15s;
}
.evidence-item:hover {
  border-color: var(--rally-accent);
}

.evidence-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.evidence-date {
  font-size: 11px;
  color: var(--gray-400);
}

.evidence-survey {
  font-size: 11px;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 1px 6px;
  border-radius: 4px;
}

.evidence-comment {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.45;
  margin: 0 0 6px 0;
}

.evidence-themes {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
