/* Divan Executive Intelligence Platform Design System */
/* Apple Analytics + Linear + Notion + Stripe Aesthetics */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Canvas & Surfaces */
  --bg-app: #F7F6F3;
  --bg-surface: #FFFFFF;
  --bg-surface-subtle: #F0EFEA;
  --bg-hover: #F2F1EC;
  --bg-input: #EFEFEA;
  
  /* Borders */
  --border-light: rgba(0, 0, 0, 0.06);
  --border-card: rgba(0, 0, 0, 0.07);
  --border-focus: #9B1C31;

  /* Typography Colors */
  --text-title: #191919;
  --text-body: #37352F;
  --text-muted: #787774;
  --text-subtle: #9B9A97;

  /* Executive Brand & Priority Colors */
  --color-primary: #9B1C31;
  --color-primary-soft: #FBF0F2;
  --color-primary-hover: #831628;

  --color-success: #2E7D5B;
  --color-success-bg: #EDF7F1;
  --color-warning: #C88B2F;
  --color-warning-bg: #FDF6EC;
  --color-risk: #D64545;
  --color-risk-bg: #FDF0F0;

  /* Geometry & Shadows */
  --radius-card: 12px;
  --radius-inner: 8px;
  --radius-pill: 9999px;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.02), 0 6px 16px rgba(0, 0, 0, 0.03);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.05), 0 12px 28px rgba(0, 0, 0, 0.04);
  --shadow-pill: 0 1px 4px rgba(0, 0, 0, 0.04);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* Executive Sidebar Navigation */
.sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  z-index: 30;
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0 8px 20px 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 18px;
}

.divan-logo-img {
  height: 58px;
  width: auto;
  object-fit: contain;
  margin-bottom: 10px;
}

.brand-badge-text {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-inner);
  color: var(--text-body);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.nav-item i {
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--text-title);
}

.nav-item:hover i {
  color: var(--text-title);
}

.nav-item.active {
  background-color: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-item.active i {
  color: var(--color-primary);
}

.badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.badge-risk {
  background-color: var(--color-risk-bg);
  color: var(--color-risk);
}

.badge-primary {
  background-color: var(--color-primary-soft);
  color: var(--color-primary);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #FFF;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.avatar.avatar-brand {
  background: #FFFFFF;
  border: 1px solid var(--border-card);
  padding: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.avatar-brand-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.user-info .name {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-title);
}

.user-info .role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Language Switcher */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 3px 4px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pill);
}

.lang-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn:hover {
  color: var(--text-title);
}

.lang-btn.active {
  background: var(--text-title);
  color: #FFFFFF;
}

/* Main Content Viewport */
.main-content {
  flex: 1;
  padding: 32px 44px 80px;
  overflow-y: auto;
  max-width: 1440px;
  margin: 0 auto;
}

/* Header Action Bar */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.5px;
}

.page-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.pill-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-title);
  outline: none;
  cursor: pointer;
  box-shadow: var(--shadow-pill);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--color-primary);
  color: #FFFFFF;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
  box-shadow: 0 2px 8px rgba(155, 28, 49, 0.2);
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
}

/* Viewport Containers */
.content-view {
  display: none;
  animation: viewFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.content-view.active {
  display: block;
}

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

/* ========================================================
   1. EXECUTIVE OVERVIEW SCREEN
   ======================================================== */
.kpi-row-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

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

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.8px;
  line-height: 1.1;
}

.kpi-subtext {
  font-size: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-subtext.positive { color: var(--color-success); font-weight: 600; }
.kpi-subtext.warning { color: var(--color-warning); font-weight: 600; }
.kpi-subtext.risk { color: var(--color-risk); font-weight: 600; }

/* Primary Chart Container */
.executive-chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

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

.chart-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-title);
}

.chart-header span {
  font-size: 12px;
  color: var(--text-muted);
}

.chart-box {
  height: 240px;
  width: 100%;
}

/* Executive AI Insight Banner */
.executive-ai-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-card);
  padding: 22px 26px;
  box-shadow: var(--shadow-card);
}

.ai-banner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ai-statement {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-title);
  line-height: 1.5;
  margin-bottom: 10px;
}

.ai-directive {
  font-size: 13.5px;
  color: var(--text-body);
  line-height: 1.5;
}

/* ========================================================
   2. BRANCH INTELLIGENCE SCREEN (Cards Not Tables)
   ======================================================== */
.branch-filters-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.pills-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-card);
}

.pill-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn.active {
  background: var(--text-title);
  color: #FFF;
}

.search-input-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  width: 280px;
  color: var(--text-title);
  box-shadow: var(--shadow-pill);
}

.branch-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.branch-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s, box-shadow 0.15s;
}

.branch-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.branch-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.branch-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-title);
}

.branch-location {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.priority-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.priority-Healthy { background: var(--color-success-bg); color: var(--color-success); }
.priority-Monitor { background: var(--color-warning-bg); color: var(--color-warning); }
.priority-ActionRequired { background: var(--color-risk-bg); color: var(--color-risk); }
.priority-Critical { background: var(--color-primary-soft); color: var(--color-primary); }

.branch-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 14px;
  text-align: center;
}

.metric-col strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-title);
}

.metric-col span {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.branch-card-footer {
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.45;
}

/* ========================================================
   3. TOPIC INTELLIGENCE (2x2 Executive Matrix)
   ======================================================== */
.matrix-container-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.matrix-chart-wrapper {
  height: 420px;
  width: 100%;
}

/* ========================================================
   4. ANOMALY CENTER (AI-Detected Anomalies - Modernized UX)
   ======================================================== */
.anomaly-filters-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.anomalies-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.anomaly-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 22px 26px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}

.anomaly-card-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

.anomaly-card-item.sev-Critical {
  border-left: 4px solid #E11D48;
}

.anomaly-card-item.sev-ActionRequired {
  border-left: 4px solid #F59E0B;
}

.anomaly-card-item.sev-Monitor {
  border-left: 4px solid #3B82F6;
}

.anomaly-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.anomaly-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Category Specific Calm Colors */
.cat-FoodSafety { background: #FEF3C7; color: #B45309; }
.cat-HygieneCrisis { background: #FFE4E6; color: #BE123C; }
.cat-ReputationRisk { background: #EEF2FF; color: #4338CA; }
.cat-OperationalFailure { background: #F3E8FF; color: #6D28D9; }

.anomaly-grid-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .anomaly-grid-details {
    grid-template-columns: 1fr;
  }
}

.anomaly-source-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-inner);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-body);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.anomaly-box-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  margin-bottom: 8px;
  letter-spacing: 0.4px;
}

.anomaly-ai-box {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-inner);
  padding: 14px 18px;
  font-size: 13px;
  color: #166534;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.anomaly-ai-box.active-risk {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}

.anomaly-meta-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 8px;
}

/* ========================================================
   5. REVIEW EXPLORER (Card Browser Not Tables)
   ======================================================== */
.review-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.review-card-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
}

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

.review-author-location {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-title);
}

.review-channel-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface-subtle);
  color: var(--text-muted);
}

.ai-tags-row {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ai-topic-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: #EBF3FE;
  color: #1877F2;
}

/* ========================================================
   6. ACTION CENTER (Linear / Notion Kanban Layout)
   ======================================================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: flex-start;
}

.kanban-col {
  background: var(--bg-surface-subtle);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 480px;
}

.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
}

.kanban-col-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-title);
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-inner);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-title);
  margin-bottom: 6px;
}

.kanban-card-location {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kanban-card-impact {
  font-size: 11.5px;
  color: var(--text-body);
  background: #F8FAFC;
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.kanban-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ========================================================
   7. AI COPILOT & INSIGHTS
   ======================================================== */
.copilot-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.copilot-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
}

.copilot-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-title);
}

.copilot-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  display: flex;
  gap: 12px;
  max-width: 80%;
}

.chat-bubble.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble-content {
  background: var(--bg-surface-subtle);
  padding: 14px 18px;
  border-radius: var(--radius-card);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-title);
  white-space: pre-line;
}

.chat-bubble.user .chat-bubble-content {
  background: var(--color-primary);
  color: #FFF;
}

.copilot-input-row {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
}

.copilot-input-row input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.copilot-input-row input:focus {
  border-color: var(--color-primary);
  background: #FFF;
}

/* ========================================================
   MOBILE DRAWER & RESPONSIVE UX SYSTEM
   ======================================================== */
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  padding: 8px 10px;
  border-radius: var(--radius-inner);
  cursor: pointer;
  color: var(--text-title);
  box-shadow: var(--shadow-pill);
  transition: background 0.15s;
}

.menu-toggle-btn:hover {
  background: var(--bg-hover);
}

.mobile-close-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-inner);
  transition: all 0.15s;
}

.mobile-close-btn:hover {
  color: var(--text-title);
  background: var(--bg-hover);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 80;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 84vw;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  }

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

  .menu-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    padding: 24px 20px 80px;
  }

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

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

@media (max-width: 768px) {
  .top-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }

  .page-title h1 {
    font-size: 20px;
  }

  .header-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }

  .pill-select {
    flex: 1;
  }

  .kpi-row-4 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .branch-filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .pills-group {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    scrollbar-width: none;
    padding: 4px;
  }
  
  .pills-group::-webkit-scrollbar {
    display: none;
  }

  .search-input-pill {
    width: 100%;
  }

  .branch-cards-grid {
    grid-template-columns: 1fr;
  }

  .anomaly-grid-details {
    grid-template-columns: 1fr;
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }

  .kanban-col {
    min-height: auto;
  }

  .matrix-chart-wrapper {
    height: 320px;
  }
}

