/* ===================================================================
   VAYUSHIELD AI — AIR INTELLIGENCE STUDIO STYLESHEET
   Design System: Midnight Navy, Clean-Air Teal & CPCB Spectrum
   =================================================================== */

:root {
  --bg-base: #0a1118;
  --bg-surface: #101c27;
  --bg-card: #152433;
  --bg-card-hover: #1b2e42;
  --bg-glass: rgba(16, 28, 39, 0.85);
  
  --border-subtle: #1e354a;
  --border-accent: rgba(0, 229, 179, 0.3);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --brand-teal: #00e5b3;
  --brand-cyan: #00d2ff;
  --brand-mint: #2dd4bf;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  /* CPCB Indian NAQI Palette */
  --cpcb-good: #007a52;
  --cpcb-satisfactory: #92d050;
  --cpcb-moderate: #ffc000;
  --cpcb-poor: #ff7e00;
  --cpcb-very-poor: #c00000;
  --cpcb-severe: #8f3f97;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 229, 179, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

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

/* Header */
.app-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}

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

.logo-mark {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-icon {
  width: 100%;
  height: 100%;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-pill {
  background: linear-gradient(135deg, var(--brand-teal), var(--brand-cyan));
  color: #03141f;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-tagline {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

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

.city-selector-wrapper, .lang-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.control-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--brand-teal);
  pointer-events: none;
}

select {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px 8px 32px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.lang-selector-wrapper select {
  padding-left: 12px;
}

select:focus, input:focus, textarea:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 2px rgba(0, 229, 179, 0.2);
}

/* Primary Navigation Tabs */
.primary-tabs {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  padding: 0 24px;
  gap: 8px;
  overflow-x: auto;
}

.tab-button {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 14px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.2s;
}

.tab-button:hover {
  color: var(--text-main);
}

.tab-button.active {
  color: var(--brand-teal);
  border-bottom-color: var(--brand-teal);
}

.tab-button.active .tab-icon {
  transform: translateY(-1px);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sub-bars & Banners */
.panel-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 8px 14px;
  background: rgba(21, 36, 51, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}

.status-meta, .source-attribution {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-dot {
  color: var(--text-dim);
}

.source-link {
  color: var(--brand-teal);
  text-decoration: none;
}
.source-link:hover {
  text-decoration: underline;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 20px;
}

.card:hover {
  border-color: rgba(0, 229, 179, 0.25);
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
}

.card-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* Badges & Pills */
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

.badge-fresh {
  background: rgba(0, 229, 179, 0.15);
  color: var(--brand-teal);
  border: 1px solid rgba(0, 229, 179, 0.3);
}

.badge-model {
  background: rgba(0, 210, 255, 0.15);
  color: var(--brand-cyan);
  border: 1px solid rgba(0, 210, 255, 0.3);
}

.badge-info {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.badge-stale {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-cached {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.category-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  color: #fff;
  background: #64748b;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-teal);
  color: #03141f;
}
.btn-primary:hover {
  background: #00ffc8;
  box-shadow: 0 0 12px rgba(0, 229, 179, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--brand-teal);
}
.btn-outline:hover {
  background: rgba(0, 229, 179, 0.1);
  border-color: var(--brand-teal);
}

.btn-assistant {
  background: linear-gradient(135deg, rgba(0, 229, 179, 0.15), rgba(0, 210, 255, 0.15));
  border: 1px solid rgba(0, 229, 179, 0.4);
  color: var(--brand-teal);
  padding: 7px 14px;
}
.btn-assistant:hover {
  background: linear-gradient(135deg, rgba(0, 229, 179, 0.25), rgba(0, 210, 255, 0.25));
  box-shadow: var(--shadow-glow);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  background: var(--brand-teal);
  border-radius: 50%;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.btn-icon {
  width: 16px;
  height: 16px;
}

.btn-sparkle {
  background: linear-gradient(135deg, #00d2ff, #00e5b3);
  color: #03141f;
  font-weight: 700;
}

/* ===================================================================
   TAB 1: AIR PULSE LAYOUT
   =================================================================== */
.airpulse-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
  margin-bottom: 20px;
}

.aqi-hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.aqi-display-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 16px 0;
}

.aqi-number {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
}

.aqi-scale {
  font-size: 1rem;
  color: var(--text-dim);
  font-weight: 500;
}

.aqi-details {
  flex: 1;
}

.dominant-pollutant-row {
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.highlight-val {
  color: var(--brand-teal);
  margin-left: 6px;
}

.cpcb-scale-bar {
  display: flex;
  height: 8px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: rgba(255,255,255,0.05);
}

.scale-segment {
  flex: 1;
}
.seg-good { background: var(--cpcb-good); }
.seg-sat { background: var(--cpcb-satisfactory); }
.seg-mod { background: var(--cpcb-moderate); }
.seg-poor { background: var(--cpcb-poor); }
.seg-verypoor { background: var(--cpcb-very-poor); }
.seg-severe { background: var(--cpcb-severe); }

.health-advisory-box {
  background: rgba(16, 28, 39, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 14px;
}

.advisory-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-amber);
  margin-bottom: 6px;
}

.advisory-icon {
  width: 16px;
  height: 16px;
}

.advisory-text {
  font-size: 0.84rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* Pollutant Cards Grid */
.pollutants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.pollutant-card {
  background: rgba(16, 28, 39, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  transition: transform 0.2s, border-color 0.2s;
}

.pollutant-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-teal);
}

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

.pollutant-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.pollutant-val {
  font-size: 1.45rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #fff;
}

.pollutant-unit {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-left: 4px;
}

.pollutant-subindex {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* 24-hr Forecast Timeline */
.forecast-timeline-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 0 6px 0;
}

.forecast-hour-col {
  flex: 0 0 74px;
  background: rgba(16, 28, 39, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hour-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

.forecast-val {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin: 8px 0;
}

.hour-inversion-badge {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

/* ===================================================================
   TAB 2: HOME SHIELD LAYOUT
   =================================================================== */
.homeshield-layout {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group-full {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-control, input[type="text"], input[type="number"] {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
}

.form-actions {
  grid-column: 1 / -1;
  margin-top: 8px;
}

/* CADR Calculator */
.dimensions-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.dim-field label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.cadr-output-box {
  background: rgba(16, 28, 39, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 14px;
}

.cadr-status-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 8px;
}

.cadr-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* Adaptive Ventilation Timeline */
.ventilation-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
}

.timeline-slot-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(16, 28, 39, 0.5);
  border-left: 4px solid var(--brand-teal);
  border-radius: var(--radius-md);
  gap: 12px;
}

.slot-time-col {
  flex: 0 0 90px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.slot-content-col {
  flex: 1;
}

.slot-rec-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
}

.slot-rationale {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* AI Attribution Pill */
.ai-attribution-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 229, 179, 0.1);
  border: 1px solid rgba(0, 229, 179, 0.3);
  color: var(--brand-teal);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.markdown-content {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-main);
}
.markdown-content p {
  margin-bottom: 10px;
}
.markdown-content ul, .markdown-content ol {
  padding-left: 20px;
  margin-bottom: 12px;
}
.markdown-content li {
  margin-bottom: 4px;
}
.markdown-content h3, .markdown-content h4 {
  color: #fff;
  margin: 14px 0 6px 0;
}

/* Hacks Grid */
.hacks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hack-item {
  background: rgba(16, 28, 39, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.hack-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--brand-teal);
  margin-bottom: 4px;
}

.hack-impact {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hack-action {
  font-size: 0.8rem;
  color: var(--text-main);
}

/* ===================================================================
   TAB 3: IMPACT LAB
   =================================================================== */
.impactlab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.category-filter-pills {
  display: flex;
  gap: 8px;
}

.pill-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn.active, .pill-btn:hover {
  background: var(--brand-teal);
  color: #03141f;
  border-color: var(--brand-teal);
}

.impactlab-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
  margin-bottom: 20px;
}

.swap-description-box {
  background: rgba(16, 28, 39, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 10px 0 16px 0;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.slider-val-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-teal);
}

.custom-range {
  width: 100%;
  accent-color: var(--brand-teal);
  cursor: pointer;
}

.simulator-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--bg-card), rgba(21, 36, 51, 0.7));
}

.metric-card-pm {
  border-left: 3px solid var(--brand-cyan);
}

.metric-card-inr {
  border-left: 3px solid var(--brand-teal);
}

.metric-number {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  letter-spacing: -0.02em;
}

.metric-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: 4px;
}

.metric-subtext {
  font-size: 0.75rem;
  color: var(--brand-mint);
  margin-top: 6px;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.comparison-table th, .comparison-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.comparison-table th {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.uncertainty-row {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===================================================================
   TAB 4: COMMUNITY ACTION
   =================================================================== */
.community-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.group-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ledger-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.ledger-stat-box {
  background: rgba(16, 28, 39, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-highlight {
  border-color: rgba(0, 229, 179, 0.4);
  background: rgba(0, 229, 179, 0.05);
}

.ledger-stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  display: block;
}

.ledger-stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.action-task-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(16, 28, 39, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  gap: 16px;
}

.action-status-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.status-completed {
  background: rgba(0, 229, 179, 0.15);
  color: var(--brand-teal);
}
.status-in-progress {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}
.status-pending {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

/* ===================================================================
   PERSISTENT AI ASSISTANT DRAWER
   =================================================================== */
.assistant-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.assistant-drawer.open {
  right: 0;
}

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

.drawer-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-icon {
  width: 28px;
  height: 28px;
}

.drawer-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.drawer-context-pill {
  font-size: 0.68rem;
  color: var(--brand-teal);
  display: block;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}
.btn-close:hover {
  color: #fff;
}

.quick-chips-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.chip-btn {
  background: rgba(21, 36, 51, 0.8);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  cursor: pointer;
}
.chip-btn:hover {
  background: rgba(0, 229, 179, 0.15);
  color: var(--brand-teal);
  border-color: var(--brand-teal);
}

.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: 90%;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-message.user {
  align-self: flex-end;
}

.message-bubble {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  line-height: 1.5;
}

.chat-message.assistant .message-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.chat-message.user .message-bubble {
  background: var(--brand-teal);
  color: #03141f;
  font-weight: 500;
}

.attribution-tag {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 4px;
}

.drawer-input-form {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
}

.btn-send {
  background: var(--brand-teal);
  border: none;
  color: #03141f;
  border-radius: var(--radius-md);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.hidden, .drawer-backdrop.hidden, .hidden {
  display: none !important;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

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

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  display: none;
}
.drawer-backdrop.active {
  display: block;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .airpulse-grid, .homeshield-layout, .impactlab-grid {
    grid-template-columns: 1fr;
  }
  .ledger-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .header-controls {
    width: 100%;
    justify-content: space-between;
  }
  .pollutants-grid, .metrics-grid, .hacks-grid {
    grid-template-columns: 1fr;
  }
  .assistant-drawer {
    width: 100vw;
    right: -100vw;
  }
}

/* Spinner and Loading States */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 229, 179, 0.2);
  border-top-color: var(--brand-teal);
  border-radius: 50%;
  animation: vayu-spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 16px;
  color: var(--text-muted);
  text-align: center;
}

/* Accessibility & Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .spinner {
    animation: none;
    border-top-color: var(--brand-teal);
  }
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  background: var(--brand-teal);
  color: #0b111e;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  z-index: 10000;
  text-decoration: none;
  font-size: 0.85rem;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 12px;
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

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

/* WCAG 2.2 AA Focus Indicators */
:focus-visible {
  outline: 2px solid #00e5b3 !important;
  outline-offset: 2px !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #00e5b3 !important;
  outline-offset: 2px !important;
}

/* WCAG 2.2 Target Size Minimum (24x24 CSS pixels) */
button,
select,
.tab-button,
.pill-btn,
.btn-close {
  min-height: 24px;
  min-width: 24px;
}


