/* ==========================================================================
   Soft Bento Design System — Strict 6-Color Executive Palette Edition
   Branch: ui-redesign (Pure Visual Reskin — Zero Logic/DOM Removal)
   Strict Palette:
     #0B132B (Midnight Navy)  | #1C2541 (Executive Navy) | #3A506B (Slate Steel)
     #5BC0DE (Sky Cyan)       | #F4D6B0 (Warm Sand)      | #D97706 (Rich Amber)
   ========================================================================== */

:root {
  /* Exact 6 Approved Palette Colors */
  --c-midnight: #0B132B;
  --c-navy: #1C2541;
  --c-slate: #3A506B;
  --c-sky: #5BC0DE;
  --c-sand: #F4D6B0;
  --c-amber: #D97706;

  /* Semantic Soft Bento Tokens (Strictly Derived from the 6 Colors + White) */
  --bg: #EFF4F8;
  --card: #FFFFFF;
  --primary: #1C2541;
  --primary-hover: #0B132B;
  --primary-soft: #5BC0DE;
  --primary-tint: rgba(91, 192, 222, 0.16);
  --accent: #D97706;
  --accent-soft: #F4D6B0;
  --accent-tint: rgba(244, 214, 176, 0.48);
  --text: #0B132B;
  --muted: #3A506B;
  --success: #5BC0DE;
  --danger: #D97706;

  /* Legacy Variable Mapping */
  --surface: var(--card);
  --surface-alt: rgba(58, 80, 107, 0.06);
  --text-muted: var(--muted);
  --border: rgba(58, 80, 107, 0.14);
  --radius: 20px;
  --shadow: 0 4px 20px rgba(11, 19, 43, 0.08);
  --shadow-hover: 0 12px 32px rgba(11, 19, 43, 0.14);
}

/* Base Canvas & Airy Typography */
body {
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .kpi-value, .hl-value {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
}

/* Smooth Progress Hairline (Midnight -> Sky -> Amber) */
.filter-progress-bar {
  height: 3px;
  background: linear-gradient(90deg, #1C2541 0%, #5BC0DE 55%, #D97706 100%);
}

/* ==========================================================================
   App Shell + Collapsible Floating Deep-Navy Sidebar
   ========================================================================== */
.app-shell {
  grid-template-columns: 274px 1fr;
  gap: 6px;
  background: var(--bg);
  transition: grid-template-columns 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 92px 1fr;
}

body.sidebar-hidden .app-shell {
  grid-template-columns: 0 1fr;
  gap: 0;
}

.sidebar {
  background: linear-gradient(180deg, #0B132B 0%, #1C2541 68%, #3A506B 155%);
  color: #FFFFFF;
  border-left: none;
  border-radius: 26px;
  margin: 16px 16px 16px 0;
  height: calc(100vh - 32px);
  top: 16px;
  padding: 16px 14px 14px;
  gap: 10px;
  box-shadow: 0 16px 38px rgba(11, 19, 43, 0.28);
  overflow-x: hidden;
  overflow-y: auto;
  transition: width 0.26s cubic-bezier(0.22, 1, 0.36, 1), padding 0.26s ease, margin 0.26s ease, opacity 0.2s ease, transform 0.26s ease;
}

body.sidebar-hidden .sidebar {
  opacity: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
  transform: translateX(30px);
}

.brand {
  padding: 2px 4px 12px;
  border-bottom: 1px solid rgba(91, 192, 222, 0.18);
  justify-content: space-between;
  position: relative;
}

.sidebar-collapse-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(91, 192, 222, 0.24);
  background: rgba(58, 80, 107, 0.42);
  color: #F4D6B0;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s ease, color 0.18s ease, transform 0.24s ease;
}

.sidebar-collapse-btn:hover {
  background: #5BC0DE;
  color: #0B132B;
  border-color: #5BC0DE;
}

body.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.topbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-topbar-toggle {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: none;
  background: var(--card);
  color: #1C2541;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(11, 19, 43, 0.1);
  flex-shrink: 0;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar-topbar-toggle:hover {
  background: #1C2541;
  color: #5BC0DE;
  transform: translateY(-1px);
}

/* Collapsed Slim Icon Rail (92px Capsule) */
body.sidebar-collapsed .sidebar {
  padding: 18px 10px;
  align-items: center;
}

body.sidebar-collapsed .brand {
  flex-direction: column;
  gap: 10px;
  padding: 0 0 12px;
  width: 100%;
  align-items: center;
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .user-prof-info,
body.sidebar-collapsed .user-prof-meta,
body.sidebar-collapsed .conn-row .nav-label {
  display: none !important;
}

body.sidebar-collapsed .user-profile-card,
body.sidebar-collapsed .connection-card {
  padding: 8px;
  align-items: center;
  width: 100%;
}

body.sidebar-collapsed .user-prof-top {
  justify-content: center;
}

body.sidebar-collapsed .btn-outline-light {
  padding: 8px;
  width: 40px;
  height: 40px;
}

body.sidebar-collapsed .nav-menu {
  width: 100%;
  align-items: center;
}

body.sidebar-collapsed .nav-item {
  width: 46px;
  height: 46px;
  padding: 0;
  justify-content: center;
  border-radius: 14px;
}

body.sidebar-collapsed .nav-ico,
body.sidebar-collapsed .nav-item.active .nav-ico {
  background: transparent;
}

body.sidebar-collapsed .security-badge {
  justify-content: center;
  padding: 10px;
  width: 44px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: #FFFFFF;
  border: 2px solid #F4D6B0;
  border-radius: 14px;
  padding: 3px;
  box-shadow: 0 6px 16px rgba(11, 19, 43, 0.35);
}

.brand-text h1 {
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-text span {
  color: #F4D6B0;
  font-size: 11px;
}

.user-profile-card,
.connection-card {
  background: rgba(58, 80, 107, 0.32);
  border: 1px solid rgba(91, 192, 222, 0.16);
  border-radius: 16px;
  padding: 9px 11px;
  backdrop-filter: blur(8px);
}

.user-avatar {
  background: #F4D6B0;
  color: #0B132B;
  border-radius: 11px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(11, 19, 43, 0.28);
}

.user-prof-info strong,
.conn-row strong {
  color: #FFFFFF;
  font-size: 13px;
}

.user-prof-info small,
.conn-meta {
  color: rgba(244, 214, 176, 0.86);
  font-size: 11px;
}

.user-prof-meta {
  background: rgba(11, 19, 43, 0.45);
  color: #5BC0DE;
  border: 1px solid rgba(91, 192, 222, 0.18);
  font-size: 11px;
}

/* Status Dot strictly inside palette (Sky Cyan = live/online, Amber = demo/warn/error) */
.status-dot,
.status-dot.ok,
.status-dot.live,
.status-dot.online,
.status-dot.connected {
  background: #5BC0DE !important;
  box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.25) !important;
}

.status-dot.demo,
.status-dot.warn,
.status-dot.error,
.status-dot.offline {
  background: #D97706 !important;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.28) !important;
}

.nav-menu {
  gap: 4px;
}

.nav-item {
  color: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  padding: 8.5px 11px;
  font-size: 13.5px;
  font-weight: 500;
  border-right: none;
  gap: 10px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.nav-item:hover {
  background: rgba(58, 80, 107, 0.55);
  color: #FFFFFF;
  transform: translateX(-2px);
}

.nav-item.active {
  background: #FFFFFF;
  color: #0B132B;
  font-weight: 700;
  border-right: none;
  box-shadow: 0 8px 20px rgba(11, 19, 43, 0.32);
}

.nav-ico {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: #5BC0DE;
  background: rgba(58, 80, 107, 0.45);
  flex-shrink: 0;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-item:hover .nav-ico {
  background: rgba(91, 192, 222, 0.2);
  color: #F4D6B0;
}

.nav-item.active .nav-ico {
  background: rgba(91, 192, 222, 0.22);
  color: #1C2541;
}

.sidebar-footer {
  border-top: 1px solid rgba(91, 192, 222, 0.16);
  padding-top: 12px;
}

.security-badge {
  background: rgba(11, 19, 43, 0.42);
  border: 1px solid rgba(244, 214, 176, 0.18);
  border-radius: 15px;
  padding: 9px 11px;
  color: #F4D6B0;
}

.security-badge strong { color: #FFFFFF; }
.security-badge small { color: rgba(244, 214, 176, 0.8); }

.btn-outline-light {
  background: rgba(58, 80, 107, 0.45);
  border: 1px solid rgba(91, 192, 222, 0.28);
  color: #FFFFFF;
  border-radius: 12px;
}

.btn-outline-light:hover {
  background: #5BC0DE;
  border-color: #5BC0DE;
  color: #0B132B;
}

/* ==========================================================================
   Main Workspace + Clean Topbar + Segmented Pill Filter Bento Card
   ========================================================================== */
.main-content {
  padding: 22px 26px 46px;
  max-width: 1560px;
}

.topbar {
  background: transparent;
  margin-bottom: 18px;
  padding: 4px 2px;
}

.topbar-title h2 {
  font-size: 22px;
  font-weight: 700;
  color: #0B132B;
  letter-spacing: -0.015em;
}

.topbar-title p {
  font-size: 12.5px;
  color: #3A506B;
  margin-top: 2px;
}

/* Soft Bento Pill Buttons */
.btn-primary,
.btn-secondary,
.btn-ghost {
  border-radius: 12px;
  font-weight: 600;
  padding: 9px 16px;
}

.btn-primary {
  background: #1C2541;
  color: #FFFFFF;
  border: none;
  box-shadow: 0 6px 16px rgba(11, 19, 43, 0.22);
}

.btn-primary:hover {
  background: #0B132B;
  color: #F4D6B0;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(11, 19, 43, 0.3);
}

.btn-secondary {
  background: var(--card);
  color: #1C2541;
  border: 1.5px solid #3A506B;
  box-shadow: 0 2px 10px rgba(11, 19, 43, 0.05);
}

.btn-secondary:hover {
  background: var(--primary-tint);
  border-color: #1C2541;
  color: #0B132B;
}

.btn-ghost {
  color: #3A506B;
}

.btn-ghost:hover {
  background: var(--primary-tint);
  color: #0B132B;
}

/* Independent White Soft Bento Filter Card with Segmented Pill Rails */
.filter-bar {
  background: var(--card);
  border: none;
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(11, 19, 43, 0.08);
  gap: 14px;
}

.filter-row-top {
  border-bottom: 1px solid rgba(58, 80, 107, 0.1);
  padding-bottom: 14px;
  gap: 12px;
}

/* Segmented Pill Rail for Day Mode & Presets */
.day-mode-group,
.presets {
  background: rgba(58, 80, 107, 0.07);
  padding: 5px 7px;
  border-radius: 14px;
  gap: 5px;
}

.day-mode-title {
  color: #3A506B;
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
}

.mode-pill,
.preset-btn {
  background: transparent;
  border: none;
  border-radius: 10px;
  color: #3A506B;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.mode-pill:hover,
.preset-btn:hover {
  background: rgba(91, 192, 222, 0.18);
  color: #0B132B;
}

.mode-pill.active,
.preset-btn.active {
  background: #1C2541;
  color: #FFFFFF;
  border: none;
  box-shadow: 0 4px 12px rgba(11, 19, 43, 0.24);
}

/* Inputs & Selects: 12px radius, soft palette fill */
.field-inline {
  font-size: 12px;
  font-weight: 600;
  color: #3A506B;
}

.field-inline input,
.field-inline select,
.search-input {
  background: rgba(58, 80, 107, 0.07);
  border: 1.5px solid transparent;
  border-radius: 12px;
  color: #0B132B;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.field-inline input:focus,
.field-inline select:focus,
.search-input:focus {
  background: #FFFFFF;
  border-color: #5BC0DE;
  outline: none;
  box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.22);
}

.window-preview-badge {
  background: var(--accent-tint);
  color: #0B132B;
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
}

.brand-dock-wrap {
  border-top: 1px solid rgba(58, 80, 107, 0.1);
  padding-top: 12px;
}

.brand-dock-label {
  color: #3A506B;
  font-size: 12px;
  font-weight: 600;
}

.brand-chip {
  background: rgba(58, 80, 107, 0.06);
  border: 1.5px solid transparent;
  color: #0B132B;
  border-radius: 999px;
  padding: 6px 12px 6px 9px;
  font-weight: 600;
}

.brand-chip:hover {
  background: var(--primary-tint);
  border-color: #5BC0DE;
  color: #0B132B;
  box-shadow: 0 6px 16px rgba(11, 19, 43, 0.1);
}

.brand-chip.active {
  background: #1C2541;
  color: #FFFFFF;
  border-color: #1C2541;
  box-shadow: 0 6px 18px rgba(11, 19, 43, 0.28);
}

.brand-chip-share {
  background: #FFFFFF;
  color: #1C2541;
}

.brand-chip.active .brand-chip-share {
  background: #D97706;
  color: #FFFFFF;
}

.active-filter-chip {
  background: var(--primary-tint);
  border: 1px solid rgba(91, 192, 222, 0.32);
  border-radius: 14px;
  color: #0B132B;
  padding: 10px 14px;
}

/* Banners strictly inside palette */
.notice-banner {
  background: var(--accent-tint);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #0B132B;
  border-radius: 16px;
}

.error-banner {
  background: rgba(217, 119, 6, 0.14);
  border: 1px solid #D97706;
  color: #0B132B;
  border-radius: 16px;
}

/* ==========================================================================
   Soft Bento Page Scope (.bento-page) — True Bento Grid Proportions
   ========================================================================== */
.bento-page .kpi-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.bento-page .mini-kpi-grid {
  gap: 20px;
  margin-bottom: 20px;
}

.bento-page .highlights-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.bento-page .charts-grid-main {
  display: grid;
  grid-template-columns: 1.75fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.bento-page .charts-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Independent White Soft Bento Cards */
.bento-page .kpi-card,
.bento-page .highlight-card,
.bento-page .card {
  background: var(--card);
  border: none;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(11, 19, 43, 0.08);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}

.bento-page .kpi-card:hover,
.bento-page .highlight-card:hover,
.bento-page .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(11, 19, 43, 0.13);
}

/* Spacious KPI Tile Anatomy */
.bento-page .kpi-card {
  min-height: 132px;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

/* Subtle Corner Orbs strictly from Sky Cyan & Warm Sand */
.bento-page .kpi-card:not(.kpi-primary)::after {
  content: '';
  position: absolute;
  bottom: -24px;
  left: -24px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 192, 222, 0.22) 0%, transparent 70%);
  pointer-events: none;
}

.bento-page .kpi-card:nth-child(3)::after,
.bento-page .kpi-card:nth-child(5)::after {
  background: radial-gradient(circle, rgba(244, 214, 176, 0.5) 0%, transparent 70%);
}

/* Featured Soft Bento Hero KPI Card (Midnight -> Executive Navy + Sky & Amber Orbs) */
.bento-page .kpi-card.kpi-primary {
  background: linear-gradient(135deg, #0B132B 0%, #1C2541 60%, #3A506B 100%);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 14px 30px rgba(11, 19, 43, 0.32);
}

.bento-page .kpi-card.kpi-primary::before {
  content: '';
  position: absolute;
  top: -32px;
  left: -26px;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 192, 222, 0.32) 0%, transparent 70%);
  pointer-events: none;
}

.bento-page .kpi-card.kpi-primary::after {
  content: '';
  position: absolute;
  bottom: -44px;
  right: -22px;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.34) 0%, transparent 70%);
  pointer-events: none;
}

.bento-page .kpi-head {
  font-size: 13px;
  font-weight: 500;
  color: #3A506B;
  position: relative;
  z-index: 1;
}

.bento-page .kpi-card.kpi-primary .kpi-head {
  color: #F4D6B0;
}

/* Clear, Legible Large Figures + Strict-Palette Up/Down Badges */
.bento-page .kpi-value {
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #0B132B;
  line-height: 1.25;
  position: relative;
  z-index: 1;
}

.bento-page .kpi-card.kpi-primary .kpi-value {
  font-size: 30px;
  font-weight: 600;
  color: #FFFFFF;
}

.bento-page .kpi-sub {
  font-size: 12.5px;
  font-weight: 500;
  color: #3A506B;
  position: relative;
  z-index: 1;
}

.bento-page .kpi-card.kpi-primary .kpi-sub {
  color: rgba(244, 214, 176, 0.92);
}

.bento-page .kpi-badge {
  background: rgba(58, 80, 107, 0.12);
  color: #1C2541;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Positive / Growth -> Sky Cyan (#5BC0DE) | Decline / Alert -> Amber (#D97706) on Warm Sand (#F4D6B0) */
.bento-page .kpi-badge.up {
  background: rgba(91, 192, 222, 0.24);
  color: #0B132B;
}

.bento-page .kpi-badge.down {
  background: #F4D6B0;
  color: #D97706;
}

.bento-page .kpi-card.kpi-primary .kpi-badge {
  background: #FFFFFF;
  color: #0B132B;
  box-shadow: 0 3px 10px rgba(11, 19, 43, 0.25);
}

.bento-page .kpi-card.kpi-primary .kpi-badge.up {
  background: #5BC0DE;
  color: #0B132B;
}

.bento-page .kpi-card.kpi-primary .kpi-badge.down {
  background: #F4D6B0;
  color: #D97706;
}

/* Highlights Bento Strip — Strictly 6-Color Circular Badges */
.bento-page .highlight-card {
  padding: 18px 20px;
  gap: 16px;
}

.bento-page .hl-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 22px;
}

.bento-page .hl-emerald { background: rgba(91, 192, 222, 0.22); }
.bento-page .hl-sky { background: rgba(58, 80, 107, 0.14); }
.bento-page .hl-amber { background: rgba(244, 214, 176, 0.65); }

.bento-page .hl-label {
  font-size: 12px;
  color: #3A506B;
  font-weight: 500;
}

.bento-page .hl-value {
  font-size: 16.5px;
  font-weight: 600;
  color: #0B132B;
  margin: 2px 0;
}

.bento-page .hl-sub {
  font-size: 12px;
  color: #3A506B;
}

/* Card Header: 14px Top-Right Title, Subtle Pill Export Tool Top-Left */
.bento-page .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.bento-page .card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #0B132B;
  line-height: 1.4;
}

.bento-page .card-header p {
  font-size: 12px;
  color: #3A506B;
  margin-top: 2px;
}

.bento-page .card-header .btn-ghost.btn-xs {
  background: rgba(58, 80, 107, 0.08);
  color: #1C2541;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.bento-page .card-header .btn-ghost.btn-xs:hover {
  background: var(--primary-tint);
  color: #0B132B;
}

.bento-page .chart-wrap {
  height: 315px;
}

.bento-page .chart-wrap.chart-tall {
  height: 340px;
}

.bento-page .chart-wrap.chart-donut {
  height: 225px;
}

.bento-page .mini-legend {
  gap: 6px;
  margin-top: 14px;
}

.bento-page .legend-item {
  border-radius: 12px;
  padding: 7px 10px;
  background: rgba(58, 80, 107, 0.04);
  transition: background 0.15s ease;
}

.bento-page .legend-item:hover {
  background: var(--primary-tint);
}

.bento-page .legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

/* ==========================================================================
   Soft Bento Tables (Ready for Rollout in Step 4)
   ========================================================================== */
.bento-page .table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: none;
}

.bento-page .data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.bento-page .data-table thead th {
  background: rgba(91, 192, 222, 0.16);
  color: #0B132B;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  padding: 13px 14px;
  white-space: nowrap;
}

.bento-page .data-table thead th:first-child {
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

.bento-page .data-table thead th:last-child {
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.bento-page .data-table tbody td {
  border-left: none;
  border-right: none;
  border-bottom: 1px solid rgba(58, 80, 107, 0.1);
  padding: 13px 14px;
  color: #0B132B;
}

.bento-page .data-table tbody tr {
  transition: background 0.15s ease;
}

.bento-page .data-table tbody tr:hover td {
  background: rgba(91, 192, 222, 0.12);
}

.bento-page .data-table tfoot td {
  background: rgba(244, 214, 176, 0.32);
  color: #0B132B;
  font-weight: 700;
  border: none;
  padding: 13px 14px;
}

.bento-page .share-bar {
  background: rgba(58, 80, 107, 0.12);
  border-radius: 999px;
  height: 8px;
}

.bento-page .share-bar span {
  background: linear-gradient(90deg, #1C2541, #5BC0DE);
  border-radius: 999px;
}

/* Sub-tabs inside Bento Pages */
.bento-page .subtab-btn {
  background: var(--card);
  border: none;
  border-radius: 14px;
  color: #3A506B;
  box-shadow: 0 4px 16px rgba(11, 19, 43, 0.07);
}

.bento-page .subtab-btn:hover {
  background: var(--primary-tint);
  color: #0B132B;
}

.bento-page .subtab-btn.active {
  background: #1C2541;
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(11, 19, 43, 0.25);
}

@media (max-width: 1280px) {
  .bento-page .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    margin: 12px;
    height: auto;
    position: relative;
    top: 0;
  }
  .bento-page .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bento-page .highlights-grid,
  .bento-page .charts-grid-main,
  .bento-page .charts-grid-two {
    grid-template-columns: 1fr;
  }
}

@media print {
  body { background: #FFFFFF !important; }
  .bento-page .kpi-card.kpi-primary {
    background: #1C2541 !important;
    color: #FFFFFF !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==========================================================================
   Soft Bento Native-Feel Custom Scrollbars (Strictly 6-Color Palette)
   Zero browser arrow buttons, rounded floating pills matching the theme
   ========================================================================== */

/* 1. Main Page & Inner Scrollable Areas */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  background: rgba(58, 80, 107, 0.34);
  border-radius: 999px;
  border: 2px solid var(--bg);
  transition: background 0.18s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #5BC0DE;
}

::-webkit-scrollbar-thumb:active {
  background: #1C2541;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Inner White Cards / Tables / Modals */
.card ::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.modal-card::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px;
}

.card ::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(58, 80, 107, 0.26);
  border: 2px solid transparent;
  background-clip: content-box;
}

.card ::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover,
.modal-card::-webkit-scrollbar-thumb:hover {
  background: #5BC0DE;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* 2. Deep Navy Floating Sidebar: Frosted Sand/Sky Pill Inset from Rounded Corners */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
  margin: 18px 0;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(244, 214, 176, 0.22);
  border-radius: 999px;
  border: 1.5px solid transparent;
  background-clip: content-box;
}

.sidebar:hover::-webkit-scrollbar-thumb {
  background: rgba(91, 192, 222, 0.45);
  border: 1.5px solid transparent;
  background-clip: content-box;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #5BC0DE;
  border: 1.5px solid transparent;
  background-clip: content-box;
}

/* Firefox-only fallback (kept inside @supports so Chrome/Edge 121+ keep full custom pill styling) */
@supports not selector(::-webkit-scrollbar) {
  html, body {
    scrollbar-width: thin;
    scrollbar-color: #3A506B #EFF4F8;
  }
  .sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(91, 192, 222, 0.45) transparent;
  }
}


/* ==========================================================================
   Step 4 Full Rollout: All Secondary Pages, Modals, Badges & Login Screen
   Strictly 6-Color Executive Palette (#0B132B, #1C2541, #3A506B, #5BC0DE, #F4D6B0, #D97706)
   ========================================================================== */

/* Smooth Bento Tab Transition */
@keyframes bentoFadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-panel.active.bento-page {
  animation: bentoFadeUp 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Soft Tinted Feature Cards (Employee Meals, Incremental Sync, Coverage Bar) */
.bento-page .bento-tint-card {
  background: linear-gradient(135deg, #FFFFFF 0%, rgba(91, 192, 222, 0.08) 100%);
  box-shadow: 0 4px 20px rgba(11, 19, 43, 0.08), inset 0 0 0 1px rgba(91, 192, 222, 0.28);
}

.bento-page .bento-accent-card {
  background: linear-gradient(135deg, #FFFFFF 0%, rgba(244, 214, 176, 0.22) 100%);
  box-shadow: 0 4px 20px rgba(11, 19, 43, 0.08), inset 0 0 0 1px rgba(217, 119, 6, 0.26);
}

.bento-page .bento-status-line {
  font-size: 13px;
  font-weight: 600;
  color: #1C2541;
  background: rgba(91, 192, 222, 0.14);
  padding: 8px 14px;
  border-radius: 12px;
  display: inline-block;
}

.warehouse-coverage-bar {
  background: rgba(244, 214, 176, 0.42);
  border: 1px solid rgba(217, 119, 6, 0.32);
  color: #0B132B;
  border-radius: 14px;
}

/* Mini KPI Grid (4-Column Balanced Bento for Products / Warehouse / Admin) */
.bento-page .mini-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* Card Toolbar Inputs */
.bento-page .card-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Badges, Chips & Semantic Pills — Strictly 6-Color Palette */
.bento-page .promo-channel-pill {
  background: rgba(91, 192, 222, 0.16);
  color: #0B132B;
  border: 1px solid rgba(91, 192, 222, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
}

.bento-page .promo-status-dot.active {
  background: rgba(91, 192, 222, 0.2);
  color: #0B132B;
  border: 1px solid rgba(91, 192, 222, 0.45);
}

.bento-page .promo-status-dot.archived {
  background: rgba(58, 80, 107, 0.12);
  color: #3A506B;
  border: 1px solid rgba(58, 80, 107, 0.22);
}

.bento-page .promo-rule-box strong { color: #0B132B; }
.bento-page .promo-rule-box small { color: #3A506B; }

.bento-page .promo-target-chip {
  background: rgba(244, 214, 176, 0.45);
  color: #0B132B;
  border: none;
  border-radius: 999px;
}

.bento-page .cat-badge,
.bento-page .type-badge,
.bento-page .badge-pill,
.bento-page .status-pill {
  border-radius: 999px;
  font-weight: 600;
}

/* Warehouse Progress & Audit Panel */
.bento-page .sync-progress-card {
  background: linear-gradient(135deg, #0B132B 0%, #1C2541 100%);
  color: #FFFFFF;
  box-shadow: 0 14px 32px rgba(11, 19, 43, 0.28);
}

.bento-page .sync-progress-card .card-header h3 { color: #FFFFFF; }
.bento-page .sync-progress-card .card-header p { color: #F4D6B0; }

.bento-page .sync-progress-card .btn-secondary {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(244, 214, 176, 0.45);
  color: #FFFFFF;
}

.bento-page .sync-progress-card .btn-secondary:hover {
  background: #D97706;
  border-color: #D97706;
  color: #FFFFFF;
}

.bento-page .progress-track {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  height: 11px;
  overflow: hidden;
}

.bento-page .progress-fill {
  background: linear-gradient(90deg, #5BC0DE 0%, #F4D6B0 65%, #D97706 100%);
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.bento-page .progress-meta {
  color: #F4D6B0;
}

.bento-page .sync-controls-row {
  background: rgba(58, 80, 107, 0.06);
  padding: 12px 14px;
  border-radius: 14px;
}

.bento-page .audit-summary-strip {
  gap: 10px;
}

.bento-page .audit-pill {
  border-radius: 14px;
  background: rgba(58, 80, 107, 0.07);
  color: #0B132B;
  border: none;
}

.bento-page .audit-pill.ok {
  background: rgba(91, 192, 222, 0.18);
  color: #0B132B;
  border: 1px solid rgba(91, 192, 222, 0.35);
}

.bento-page .audit-pill.warn {
  background: rgba(244, 214, 176, 0.55);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.bento-page .audit-subtabs {
  background: rgba(58, 80, 107, 0.06);
  padding: 5px;
  border-radius: 14px;
  gap: 6px;
}

.bento-page .audit-subtab {
  border: none;
  background: transparent;
  color: #3A506B;
  border-radius: 10px;
  font-weight: 600;
}

.bento-page .audit-subtab:hover {
  background: rgba(91, 192, 222, 0.18);
  color: #0B132B;
}

.bento-page .audit-subtab.active {
  background: #1C2541;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(11, 19, 43, 0.22);
}

.bento-page .audit-badge.cash { background: rgba(91, 192, 222, 0.22); color: #0B132B; }
.bento-page .audit-badge.card { background: rgba(28, 37, 65, 0.12); color: #1C2541; }
.bento-page .audit-badge.credit { background: rgba(58, 80, 107, 0.18); color: #0B132B; }
.bento-page .audit-badge.warn { background: #F4D6B0; color: #D97706; }

.bento-page .audit-id-chip {
  background: rgba(58, 80, 107, 0.1);
  color: #1C2541;
  border-radius: 8px;
}

/* Reports & Export Center Bento Cards */
.bento-page .export-cards-grid {
  gap: 20px;
}

.bento-page .export-card {
  background: var(--card);
  border: none;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 4px 20px rgba(11, 19, 43, 0.08);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}

.bento-page .export-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(11, 19, 43, 0.14);
}

.bento-page .export-ico {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: inline-grid;
  place-items: center;
  background: rgba(91, 192, 222, 0.16);
  margin-bottom: 10px;
}

.bento-page .export-card:nth-child(2) .export-ico {
  background: rgba(244, 214, 176, 0.52);
}

.bento-page .export-card:nth-child(3) .export-ico {
  background: rgba(58, 80, 107, 0.14);
}

.bento-page .export-card h3 { color: #0B132B; }
.bento-page .export-card p { color: #3A506B; }

.bento-page .archive-grid {
  gap: 20px;
  margin-top: 20px;
}

.bento-page .file-row,
.bento-page .file-item {
  border-radius: 12px;
  border: 1px solid rgba(58, 80, 107, 0.1);
  background: rgba(58, 80, 107, 0.03);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bento-page .file-row:hover,
.bento-page .file-item:hover {
  background: rgba(91, 192, 222, 0.12);
  border-color: rgba(91, 192, 222, 0.35);
}

/* Admin Roles Grid & Cards */
.bento-page .roles-grid {
  gap: 18px;
}

.bento-page .role-card {
  background: var(--card);
  border: 1px solid rgba(58, 80, 107, 0.14);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 4px 16px rgba(11, 19, 43, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.bento-page .role-card:hover {
  transform: translateY(-2px);
  border-color: #5BC0DE;
  box-shadow: 0 10px 26px rgba(11, 19, 43, 0.11);
}

.bento-page .role-card-head h4 { color: #0B132B; }
.bento-page .role-card-desc { color: #3A506B; }

/* ==========================================================================
   All 3 Executive Modals (userAccessModal, roleEditModal, configModal)
   ========================================================================== */
.modal-backdrop {
  background: rgba(11, 19, 43, 0.62);
  backdrop-filter: blur(6px);
}

.modal-card {
  background: #FFFFFF;
  border: none;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(11, 19, 43, 0.34);
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(135deg, #0B132B 0%, #1C2541 100%);
  color: #FFFFFF;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(91, 192, 222, 0.2);
}

.modal-header h3 { color: #FFFFFF; }
.modal-header p { color: #F4D6B0; }

.modal-close {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
}

.modal-close:hover {
  background: #D97706;
  color: #FFFFFF;
}

.modal-body {
  padding: 22px 24px;
}

.form-field span {
  color: #0B132B;
  font-weight: 600;
}

.form-field input,
.form-field select {
  background: rgba(58, 80, 107, 0.07);
  border: 1.5px solid transparent;
  border-radius: 12px;
  color: #0B132B;
  padding: 10px 12px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-field input:focus,
.form-field select:focus {
  background: #FFFFFF;
  border-color: #5BC0DE;
  outline: none;
  box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.22);
}

.bento-details-box {
  border: 1px solid rgba(58, 80, 107, 0.16);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(58, 80, 107, 0.04);
  color: #0B132B;
}

.check-grid-branches label,
.perms-check-grid label {
  background: rgba(58, 80, 107, 0.06);
  border-radius: 10px;
  color: #0B132B;
}

.check-grid-branches label:hover,
.perms-check-grid label:hover {
  background: rgba(91, 192, 222, 0.18);
}

.modal-status.ok {
  background: rgba(91, 192, 222, 0.18);
  color: #0B132B;
  border: 1px solid rgba(91, 192, 222, 0.45);
  border-radius: 12px;
}

.modal-status.err {
  background: rgba(244, 214, 176, 0.55);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.45);
  border-radius: 12px;
}

/* ==========================================================================
   Login Page (login.html) — Executive Midnight + Sky & Amber Ambient Glow
   ========================================================================== */
.auth-overlay {
  background:
    radial-gradient(circle at 12% 48%, rgba(217, 119, 6, 0.34) 0%, transparent 42%),
    radial-gradient(circle at 88% 42%, rgba(91, 192, 222, 0.32) 0%, transparent 42%),
    linear-gradient(145deg, #0B132B 0%, #1C2541 62%, #0B132B 100%);
}

.auth-card {
  background: #FFFFFF;
  border: none;
  border-radius: 26px;
  padding: 32px 30px;
  box-shadow: 0 28px 70px rgba(11, 19, 43, 0.52);
}

.auth-logo {
  border-radius: 16px;
  border: 2px solid #F4D6B0;
  background: #FFFFFF;
  box-shadow: 0 8px 20px rgba(11, 19, 43, 0.14);
}

.auth-brand h2 {
  color: #0B132B;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
}

.auth-brand p {
  color: #3A506B;
}

.auth-submit-btn {
  background: #1C2541;
  color: #FFFFFF;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 14.5px;
  box-shadow: 0 8px 22px rgba(11, 19, 43, 0.24);
}

.auth-submit-btn:hover {
  background: #0B132B;
  color: #F4D6B0;
}

.auth-foot-note {
  background: rgba(58, 80, 107, 0.06);
  color: #3A506B;
  border-radius: 12px;
  padding: 10px 12px;
}

.totp-banner {
  background: rgba(91, 192, 222, 0.16);
  border: 1px solid rgba(91, 192, 222, 0.38);
  border-radius: 14px;
  color: #0B132B;
}

.totp-banner p {
  color: #3A506B;
}

@media (max-width: 1180px) {
  .bento-page .mini-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .bento-page .mini-kpi-grid {
    grid-template-columns: 1fr;
  }
}


/* Explicit 6-Color Overrides for Customer Category, State & Role Permission Pills */
.cust-type-pill,
.cust-type-pill.walk,
.cust-type-pill.cat-other {
  background: rgba(58, 80, 107, 0.12);
  color: #3A506B;
}

.cust-type-pill.reg,
.cust-type-pill.cat-delivery_app {
  background: rgba(91, 192, 222, 0.22);
  color: #0B132B;
}

.cust-type-pill.cat-company_app {
  background: #1C2541;
  color: #FFFFFF;
}

.cust-type-pill.cat-direct {
  background: rgba(58, 80, 107, 0.18);
  color: #0B132B;
}

.cust-type-pill.cat-employees {
  background: #F4D6B0;
  color: #0B132B;
}

.cust-type-pill.cat-special {
  background: rgba(217, 119, 6, 0.18);
  color: #D97706;
}

.state-pill,
.state-pill.done {
  background: rgba(91, 192, 222, 0.22);
  color: #0B132B;
}

.state-pill.invoiced {
  background: #F4D6B0;
  color: #0B132B;
}

.role-perm-chip {
  background: rgba(91, 192, 222, 0.2);
  color: #0B132B;
}

.role-perm-chip.off {
  background: rgba(244, 214, 176, 0.65);
  color: #D97706;
}


/* ==========================================================================
   Filter Bar Redesign: Spacious, Zero-Scrollbar Layout + Restaurant Toggle Switch
   Strictly 6-Color Palette (#0B132B, #1C2541, #3A506B, #5BC0DE, #F4D6B0, #D97706)
   ========================================================================== */
.filter-bar {
  overflow: visible;
  padding: 20px 22px;
  gap: 16px;
}

.filter-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(58, 80, 107, 0.1);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: rgba(58, 80, 107, 0.06);
  padding: 5px;
  border-radius: 14px;
}

/* Sleek Restaurant Timing ON/OFF Toggle Box */
.restaurant-mode-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: rgba(58, 80, 107, 0.06);
  padding: 8px 14px;
  border-radius: 16px;
  border: 1px solid rgba(58, 80, 107, 0.1);
}

.bento-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.bento-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.bento-switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(58, 80, 107, 0.32);
  transition: background 0.22s ease, box-shadow 0.22s ease;
  flex-shrink: 0;
}

.bento-switch-thumb {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(11, 19, 43, 0.24);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.bento-switch-input:checked + .bento-switch-track {
  background: #1C2541;
  box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.24);
}

.bento-switch-input:checked + .bento-switch-track .bento-switch-thumb {
  transform: translateX(-20px);
  background: #5BC0DE;
}

.bento-switch-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.bento-switch-text strong {
  font-size: 12.5px;
  font-weight: 700;
  color: #0B132B;
}

.bento-switch-text small {
  font-size: 11px;
  font-weight: 500;
  color: #3A506B;
}

.restaurant-hour-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 12px;
  border-right: 1px solid rgba(58, 80, 107, 0.18);
  font-size: 12px;
  font-weight: 600;
  color: #3A506B;
}

.restaurant-hour-wrap select {
  background: #FFFFFF;
  border: 1.5px solid rgba(58, 80, 107, 0.18);
  border-radius: 10px;
  color: #0B132B;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.restaurant-hour-wrap select:focus {
  outline: none;
  border-color: #5BC0DE;
  box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.22);
}

.timing-saved-badge {
  font-size: 11px;
  font-weight: 700;
  color: #0B132B;
  background: rgba(91, 192, 222, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Row 2: Clean Spacious CSS Grid (Zero Clipping, Zero Horizontal Scroll) */
.filter-row-bottom {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.filter-bar .filter-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) repeat(3, minmax(0, 1.15fr)) auto;
  gap: 12px;
  align-items: end;
  width: 100%;
}

.filter-bar .filter-inputs .field-inline {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  min-width: 0;
}

.filter-bar .filter-inputs .field-inline span {
  font-size: 11.5px;
  font-weight: 700;
  color: #3A506B;
  padding-right: 2px;
}

.filter-bar .filter-inputs .field-inline input,
.filter-bar .filter-inputs .field-inline select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background: rgba(58, 80, 107, 0.06);
  border: 1.5px solid transparent;
  border-radius: 12px;
  color: #0B132B;
  font-size: 13px;
}

.filter-bar .filter-inputs .field-inline input:focus,
.filter-bar .filter-inputs .field-inline select:focus {
  background: #FFFFFF;
  border-color: #5BC0DE;
  box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.22);
}

.filter-apply-btn {
  height: 40px;
  padding: 0 22px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.window-preview-badge {
  align-self: flex-start;
  background: rgba(244, 214, 176, 0.42);
  color: #0B132B;
  border: 1px solid rgba(217, 119, 6, 0.22);
  border-radius: 12px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
}

/* Row 3: Zero-Scrollbar Wrapping Channel / Brand Quick Filter Dock */
.brand-dock-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(58, 80, 107, 0.1);
  overflow: visible !important;
}

.brand-dock {
  display: flex;
  flex-wrap: wrap !important;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
}

@media (max-width: 1220px) {
  .filter-bar .filter-inputs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .filter-apply-btn {
    width: 100%;
  }
}

@media (max-width: 680px) {
  .filter-bar .filter-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .restaurant-hour-wrap {
    border-right: none;
    padding-right: 0;
  }
}


/* ==========================================================================
   Hourly Orders & Peak Intelligence Page (6-Color Soft Bento)
   ========================================================================== */
.hourly-subpanel { display: none; }
.hourly-subpanel.active { display: block; animation: bentoFadeUp 0.22s ease; }

.hourly-metric-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(58, 80, 107, 0.07);
  padding: 4px;
  border-radius: 12px;
}

.metric-pill {
  border: none;
  background: transparent;
  color: #3A506B;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.metric-pill:hover {
  background: rgba(91, 192, 222, 0.18);
  color: #0B132B;
}

.metric-pill.active {
  background: #1C2541;
  color: #FFFFFF;
}

/* Pressure Classification Badges */
.pressure-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pressure-pill.peak {
  background: #D97706;
  color: #FFFFFF;
}

.pressure-pill.high {
  background: #F4D6B0;
  color: #0B132B;
}

.pressure-pill.medium {
  background: rgba(91, 192, 222, 0.2);
  color: #0B132B;
}

.pressure-pill.quiet {
  background: rgba(58, 80, 107, 0.1);
  color: #3A506B;
}

/* 7x24 Weekday x Hour Executive Heatmap */
.heatmap-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #3A506B;
}

.hm-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  min-width: 820px;
}

.heatmap-table th {
  font-size: 11px;
  font-weight: 600;
  color: #3A506B;
  padding: 4px 2px;
  text-align: center;
  white-space: nowrap;
}

.heatmap-table th.hm-day-col {
  text-align: right;
  padding: 6px 10px;
  min-width: 78px;
  color: #0B132B;
  font-size: 12px;
  font-weight: 700;
}

.heatmap-cell {
  height: 32px;
  min-width: 28px;
  border-radius: 7px;
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  cursor: default;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.heatmap-cell:hover {
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(11, 19, 43, 0.22);
  position: relative;
  z-index: 2;
}

/* Pure 6-Color Palette Intensity Scale */
.hm-lvl-0 { background: rgba(58, 80, 107, 0.06); color: #3A506B; }
.hm-lvl-1 { background: rgba(91, 192, 222, 0.22); color: #0B132B; }
.hm-lvl-2 { background: rgba(91, 192, 222, 0.52); color: #0B132B; }
.hm-lvl-3 { background: #3A506B; color: #FFFFFF; }
.hm-lvl-4 { background: #1C2541; color: #F4D6B0; }
.hm-lvl-5 { background: #D97706; color: #FFFFFF; }


/* Never dim, shift, or freeze any report/chart while filters are updating */
.main-content.is-filtering .tab-panel.active {
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
}


/* ==========================================================================
   Full Mobile Web App & PWA Responsive Architecture (All 10 Pages + 3 Modals)
   Desktop (>960px) untouched; Mobile/Tablet (<=960px) feels like a native app!
   Strictly 6-Color Palette (#0B132B, #1C2541, #3A506B, #5BC0DE, #F4D6B0, #D97706)
   ========================================================================== */

/* Desktop defaults for mobile-only elements */
.mobile-drawer-backdrop,
.mobile-bottom-nav,
.mobile-filter-bar {
  display: none;
}

.filter-bar-body {
  display: contents;
}

/* Prevent accidental horizontal page drift on any viewport */
html,
body,
.app-shell,
.main-content {
  max-width: 100%;
  overflow-x: clip;
}

/* Sticky weekday label column inside 7x24 Heatmap when swiping horizontally on mobile */
.heatmap-table th.hm-day-col {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #FFFFFF;
  box-shadow: -4px 0 8px rgba(11, 19, 43, 0.05);
}

/* Touch-smooth scroll for all wide data tables */
.bento-page .table-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.bento-page .data-table td.num-cell {
  white-space: nowrap;
}

/* ==========================================================================
   Tablet & Mobile Web App Layout (<= 960px)
   ========================================================================== */
@media (max-width: 960px) {
  body {
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    -webkit-tap-highlight-color: rgba(91, 192, 222, 0.18);
  }

  .app-shell,
  body.sidebar-collapsed .app-shell,
  body.sidebar-hidden .app-shell {
    display: block;
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  /* Slide-Over RTL Native App Drawer */
  .sidebar,
  body.sidebar-collapsed .sidebar,
  body.sidebar-hidden .sidebar {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: min(300px, 84vw) !important;
    height: 100dvh !important;
    margin: 0 !important;
    border-radius: 26px 0 0 26px !important;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 16px calc(22px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 1200;
    transform: translateX(106%) !important;
    opacity: 1 !important;
    pointer-events: none !important;
    box-shadow: -14px 0 42px rgba(11, 19, 43, 0.42);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1) !important;
    align-items: stretch !important;
  }

  body.mobile-drawer-open .sidebar {
    transform: translateX(0) !important;
    pointer-events: auto !important;
  }

  /* Always show full labels inside mobile drawer even if desktop was collapsed */
  body.sidebar-collapsed .brand-text,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .user-prof-info,
  body.sidebar-collapsed .user-prof-meta,
  body.sidebar-collapsed .conn-row .nav-label {
    display: block !important;
  }

  body.sidebar-collapsed .brand {
    flex-direction: row;
    justify-content: space-between;
  }

  body.sidebar-collapsed .nav-item {
    width: 100%;
    height: auto;
    padding: 10px 12px;
    justify-content: flex-start;
  }

  body.sidebar-collapsed .btn-outline-light {
    width: 100%;
    height: auto;
    padding: 9px 12px;
  }

  body.sidebar-collapsed .security-badge {
    width: 100%;
    justify-content: flex-start;
  }

  /* Frosted Backdrop behind Mobile Drawer */
  .mobile-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 19, 43, 0.56);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }

  body.mobile-drawer-open .mobile-drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.mobile-drawer-open {
    overflow: hidden;
  }

  /* Main Workspace Mobile Spacing */
  .main-content {
    padding: 10px 12px 24px;
    width: 100%;
  }

  /* Sticky App-Style Top Bar */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(239, 244, 248, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin: -10px -12px 12px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px;
    border-bottom: 1px solid rgba(58, 80, 107, 0.1);
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-title-wrap {
    width: 100%;
    gap: 10px;
  }

  .topbar-title {
    min-width: 0;
    flex: 1;
  }

  .topbar-title h2 {
    font-size: 17px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-title p {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .topbar-actions button {
    padding: 8px 6px;
    font-size: 11.5px;
    min-height: 38px;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Compact Collapsible Mobile Filter Card */
  .filter-bar {
    padding: 12px 14px;
    border-radius: 18px;
    margin-bottom: 14px;
    gap: 12px;
  }

  .mobile-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-filter-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    color: #0B132B;
    font-size: 12.5px;
    font-weight: 700;
  }

  .mobile-filter-summary svg {
    color: #5BC0DE;
    flex-shrink: 0;
  }

  .mobile-filter-summary span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1C2541;
    color: #FFFFFF;
    border: none;
    border-radius: 11px;
    padding: 8px 13px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    min-height: 36px;
  }

  .mobile-filter-toggle-btn .mft-chevron {
    transition: transform 0.22s ease;
  }

  .filter-bar.filters-expanded .mobile-filter-toggle-btn .mft-chevron {
    transform: rotate(180deg);
  }

  .filter-bar-body {
    display: none;
    flex-direction: column;
    gap: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(58, 80, 107, 0.1);
  }

  .filter-bar.filters-expanded .filter-bar-body {
    display: flex;
    animation: bentoFadeUp 0.2s ease;
  }

  /* Native Fixed Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: #0B132B;
    border-top: 1px solid rgba(91, 192, 222, 0.2);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 28px rgba(11, 19, 43, 0.28);
  }

  .mbn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    background: transparent;
    color: rgba(244, 214, 176, 0.78);
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 4px;
    border-radius: 12px;
    cursor: pointer;
    min-height: 50px;
    transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
  }

  .mbn-item:active {
    transform: scale(0.94);
  }

  .mbn-item.active {
    background: rgba(91, 192, 222, 0.18);
    color: #5BC0DE;
    font-weight: 700;
  }

  .mbn-item.hidden {
    display: none !important;
  }

  /* Balanced Mobile Bento Grids */
  .bento-page .kpi-grid,
  .bento-page .mini-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
  }

  .bento-page .kpi-grid .kpi-card.kpi-primary,
  .bento-page .mini-kpi-grid .kpi-card.kpi-primary {
    grid-column: 1 / -1;
  }

  .bento-page .kpi-card {
    min-height: 108px;
    padding: 15px 14px;
    border-radius: 18px;
  }

  .bento-page .kpi-value {
    font-size: 20px;
  }

  .bento-page .kpi-card.kpi-primary .kpi-value {
    font-size: 25px;
  }

  .bento-page .highlights-grid,
  .bento-page .charts-grid-main,
  .bento-page .charts-grid-two,
  .bento-page .export-cards-grid,
  .bento-page .archive-grid,
  .bento-page .roles-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 14px;
  }

  .bento-page .card {
    padding: 16px 14px;
    border-radius: 18px;
  }

  .bento-page .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 14px;
  }

  .bento-page .card-tools {
    width: 100%;
  }

  .bento-page .card-tools .search-input,
  .bento-page .card-tools select {
    flex: 1 1 140px;
    min-height: 40px;
  }

  .bento-page .chart-wrap { height: 250px; }
  .bento-page .chart-wrap.chart-tall { height: 265px; }
  .bento-page .chart-wrap.chart-donut { height: 205px; }

  /* Sub-tabs & Metric Pills Wrap Cleanly */
  .subtabs-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }

  .bento-page .subtab-btn {
    padding: 10px 10px;
    font-size: 12px;
    text-align: center;
    min-height: 42px;
  }

  .hourly-metric-pills {
    width: 100%;
    justify-content: space-between;
  }

  .metric-pill {
    flex: 1;
    text-align: center;
    padding: 7px 6px;
    font-size: 11.5px;
  }

  /* Compact Readable Mobile Tables */
  .bento-page .data-table thead th,
  .bento-page .data-table tbody td,
  .bento-page .data-table tfoot td {
    padding: 10px 10px;
    font-size: 12.5px;
  }

  .csv-buttons-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .csv-buttons-row button {
    width: 100%;
    font-size: 12px;
    padding: 10px 8px;
    justify-content: center;
  }
}

/* ==========================================================================
   Smartphones Fine-Tuning (<= 640px) — Zero iOS Zoom, Bottom-Sheet Modals
   ========================================================================== */
@media (max-width: 640px) {
  /* Prevent iOS Safari auto-zoom on form focus (must be >= 16px) */
  .filter-bar input,
  .filter-bar select,
  .search-input,
  .form-field input,
  .form-field select,
  .restaurant-hour-wrap select {
    font-size: 16px !important;
  }

  .topbar-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .restaurant-mode-box {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .restaurant-hour-wrap {
    width: 100%;
    justify-content: space-between;
    border-right: none;
    padding-right: 0;
    padding-top: 8px;
    border-top: 1px solid rgba(58, 80, 107, 0.14);
  }

  .restaurant-hour-wrap select {
    flex: 1;
    max-width: 68%;
  }

  .filter-bar .filter-inputs {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .filter-bar .filter-inputs .field-inline:nth-child(3),
  .filter-bar .filter-inputs .field-inline:nth-child(4),
  .filter-bar .filter-inputs .field-inline:nth-child(5),
  .filter-apply-btn {
    grid-column: 1 / -1;
  }

  .filter-apply-btn {
    height: 44px;
    font-size: 14px;
  }

  .window-preview-badge {
    width: 100%;
    font-size: 11.5px;
    line-height: 1.5;
  }

  .brand-chip {
    font-size: 12px;
    padding: 6px 10px 6px 8px;
  }

  .bento-page .kpi-value {
    font-size: 18px;
  }

  .bento-page .kpi-card.kpi-primary .kpi-value {
    font-size: 23px;
  }

  .bento-page .kpi-head {
    font-size: 11.5px;
  }

  .bento-page .kpi-sub {
    font-size: 11px;
  }

  .bento-page .highlight-card {
    padding: 14px;
    gap: 12px;
  }

  .bento-page .hl-icon {
    width: 44px;
    height: 44px;
    font-size: 19px;
  }

  .csv-buttons-row {
    grid-template-columns: 1fr;
  }

  /* Native Bottom-Sheet Modals on Smartphones */
  .modal-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-card,
  .modal-card-lg {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92dvh !important;
    border-radius: 24px 24px 0 0 !important;
    margin: 0 !important;
  }

  .modal-header {
    padding: 16px 18px;
  }

  .modal-body {
    padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    max-height: 76dvh;
    overflow-y: auto;
  }

  .ua-grid-2 {
    grid-template-columns: 1fr !important;
  }

  .check-grid-branches,
  .perms-check-grid,
  .perms-override-grid {
    grid-template-columns: 1fr !important;
  }

  .modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }

  .modal-actions button,
  .modal-actions > div {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .modal-actions button {
    min-height: 44px;
    justify-content: center;
  }

  /* Login Page on Mobile Phones */
  .auth-overlay {
    padding: 16px;
    min-height: 100dvh;
    align-items: center;
  }

  .auth-card {
    width: 100%;
    max-width: 100%;
    padding: 24px 18px;
    border-radius: 22px;
  }

  .auth-brand {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .auth-submit-btn {
    min-height: 48px;
    font-size: 15px;
  }
}

@media (max-width: 390px) {
  .bento-page .kpi-grid,
  .bento-page .mini-kpi-grid {
    grid-template-columns: 1fr;
  }
}


/* ==========================================================================
   Hybrid Mobile Table Engine (<= 640px):
   1) Expandable Soft Bento Cards (Zero Horizontal Scroll) — Default
   2) Cards | Table 1-Tap Switcher + Frozen First Column in Table Mode
   Strictly 6-Color Palette (#0B132B, #1C2541, #3A506B, #5BC0DE, #F4D6B0, #D97706)
   ========================================================================== */

/* Hidden cleanly on Desktop & Wide Tablets (> 640px) */
.mobile-table-mode-bar,
.mcard-toggle-row,
.mcard-rank-badge {
  display: none !important;
}

@media (max-width: 640px) {
  /* Per-Table Mode Switcher Bar (Cards | Table) */
  .mobile-table-mode-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding: 6px 8px;
    background: rgba(58, 80, 107, 0.06);
    border-radius: 12px;
  }

  .mtm-hint {
    font-size: 11px;
    font-weight: 600;
    color: #3A506B;
  }

  .mtm-pills {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #FFFFFF;
    padding: 3px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(11, 19, 43, 0.06);
  }

  .mtm-btn {
    border: none;
    background: transparent;
    color: #3A506B;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
  }

  .mtm-btn.active {
    background: #1C2541;
    color: #FFFFFF;
  }

  /* ------------------------------------------------------------------
     MODE A: EXPANDABLE SOFT BENTO CARDS (Zero Horizontal Scroll!)
     ------------------------------------------------------------------ */
  .table-wrap.mobile-mode-cards {
    overflow-x: visible !important;
  }

  .table-wrap.mobile-mode-cards .data-table,
  .table-wrap.mobile-mode-cards .data-table tbody,
  .table-wrap.mobile-mode-cards .data-table tfoot {
    display: block;
    width: 100%;
  }

  .table-wrap.mobile-mode-cards .data-table thead {
    display: none !important;
  }

  .table-wrap.mobile-mode-cards .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    background: #FFFFFF;
    border: 1px solid rgba(58, 80, 107, 0.13);
    border-radius: 16px;
    padding: 12px 13px;
    box-shadow: 0 3px 14px rgba(11, 19, 43, 0.06);
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr.mcard-expanded {
    border-color: #5BC0DE;
    box-shadow: 0 8px 22px rgba(11, 19, 43, 0.1);
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr:hover td {
    background: transparent;
  }

  /* Empty state row spans cleanly */
  .table-wrap.mobile-mode-cards .data-table tbody tr.mcard-empty-row {
    display: block;
    cursor: default;
    text-align: center;
    padding: 16px;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr td {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 !important;
    border: none !important;
    text-align: right !important;
    font-size: 13px;
    color: #0B132B;
    min-width: 0;
  }

  /* Micro Arabic Label above each card metric */
  .table-wrap.mobile-mode-cards .data-table tbody tr td[data-label]:not(.mcard-title-cell):not(.mcard-rank-cell):not(.mcard-toggle-row)::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 600;
    color: #3A506B;
    line-height: 1.2;
  }

  /* Title / Entity Cell spans full width at the top of the card */
  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-title-cell {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #0B132B;
    padding-bottom: 8px !important;
    border-bottom: 1px solid rgba(58, 80, 107, 0.1) !important;
    white-space: normal;
  }

  /* Hide standalone numeric rank cell when merged into title badge */
  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-rank-cell {
    display: none !important;
  }

  .mcard-rank-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 8px;
    background: rgba(91, 192, 222, 0.2);
    color: #0B132B;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
  }

  /* Primary Key Metric highlight */
  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-primary-metric {
    font-size: 14.5px;
    font-weight: 700;
    color: #1C2541;
  }

  /* Action Button Cell spans cleanly */
  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-action-cell {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-top: 6px !important;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-action-cell::before {
    display: none !important;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-action-cell button {
    width: 100%;
    min-height: 36px;
    justify-content: center;
    background: rgba(91, 192, 222, 0.18);
    color: #0B132B;
    border-radius: 10px;
    font-weight: 700;
  }

  /* Secondary Detail Cells: Hidden until card is expanded! */
  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-detail-cell {
    display: none;
    background: rgba(58, 80, 107, 0.05);
    padding: 7px 9px !important;
    border-radius: 10px;
    font-size: 12.5px;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr.mcard-expanded td.mcard-detail-cell {
    display: flex;
    animation: bentoFadeUp 0.16s ease;
  }

  /* Full-width 1-tap Expand / Collapse Strip at bottom of each card */
  .table-wrap.mobile-mode-cards .data-table tbody tr td.mcard-toggle-row {
    display: flex !important;
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    padding: 7px 10px !important;
    border-radius: 10px;
    background: rgba(58, 80, 107, 0.06);
    color: #1C2541;
    font-size: 11.5px;
    font-weight: 700;
    user-select: none;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr.mcard-expanded td.mcard-toggle-row {
    background: rgba(91, 192, 222, 0.18);
    color: #0B132B;
  }

  .mcard-chev {
    display: inline-block;
    transition: transform 0.2s ease;
  }

  .table-wrap.mobile-mode-cards .data-table tbody tr.mcard-expanded .mcard-chev {
    transform: rotate(180deg);
  }

  /* Executive Total Card (tfoot) in Cards Mode */
  .table-wrap.mobile-mode-cards .data-table tfoot {
    margin-top: 12px;
  }

  .table-wrap.mobile-mode-cards .data-table tfoot tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
    background: #1C2541;
    color: #FFFFFF;
    border-radius: 16px;
    padding: 13px 14px;
    margin-bottom: 8px;
  }

  .table-wrap.mobile-mode-cards .data-table tfoot tr td {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 !important;
    background: transparent !important;
    color: #FFFFFF !important;
    border: none !important;
    text-align: right !important;
    font-size: 13px;
  }

  .table-wrap.mobile-mode-cards .data-table tfoot tr td:first-child {
    grid-column: 1 / -1;
    color: #F4D6B0 !important;
    font-size: 13.5px;
    padding-bottom: 6px !important;
    border-bottom: 1px solid rgba(244, 214, 176, 0.22) !important;
  }

  .table-wrap.mobile-mode-cards .data-table tfoot tr td[data-label]:not(:first-child)::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 500;
    color: #F4D6B0;
  }

  /* ------------------------------------------------------------------
     MODE B: HORIZONTAL TABLE WITH FROZEN FIRST COLUMN + SCROLL SHADOW
     ------------------------------------------------------------------ */
  .table-wrap.mobile-mode-table {
    overflow-x: auto !important;
    position: relative;
    border: 1px solid rgba(58, 80, 107, 0.12);
    border-radius: 14px;
  }

  .table-wrap.mobile-mode-table .mcard-toggle-row {
    display: none !important;
  }

  .table-wrap.mobile-mode-table .data-table th.mcol-sticky,
  .table-wrap.mobile-mode-table .data-table td.mcol-sticky {
    position: sticky;
    right: 0;
    z-index: 3;
    background: #FFFFFF;
    box-shadow: -5px 0 10px rgba(11, 19, 43, 0.07);
    max-width: 145px;
    white-space: normal;
  }

  .table-wrap.mobile-mode-table .data-table thead th.mcol-sticky {
    background: #EFF4F8;
    z-index: 4;
  }

  .table-wrap.mobile-mode-table .data-table tfoot td.mcol-sticky {
    background: #F4D6B0;
    color: #0B132B;
    z-index: 4;
  }
}


/* ==========================================================================
   Mobile Sticky Column Anti-Blanking Fix (iOS Safari + Mobile Chrome GPU)
   + Interactive Tap Readout for 7x24 Heatmap
   ========================================================================== */
.heatmap-tap-readout {
  font-size: 12px;
  font-weight: 600;
  color: #0B132B;
  background: rgba(91, 192, 222, 0.14);
  border: 1px solid rgba(91, 192, 222, 0.3);
  border-radius: 10px;
  padding: 7px 12px;
  margin-bottom: 10px;
}

.heatmap-cell.hm-selected {
  outline: 2px solid #0B132B;
  outline-offset: -1px;
}

@media (max-width: 960px) {
  /* Kill ancestor CSS transforms on mobile so position:sticky NEVER blanks during vertical scroll! */
  .tab-panel.active.bento-page,
  .hourly-subpanel.active,
  .prod-subpanel.active,
  .adm-subpanel.active {
    animation: none !important;
    transform: none !important;
  }

  .bento-page .card:hover,
  .bento-page .kpi-card:hover,
  .bento-page .highlight-card:hover {
    transform: none !important;
  }

  /* Force crisp opaque GPU layer on sticky weekday column in 7x24 Heatmap */
  .heatmap-table {
    border-collapse: separate;
    border-spacing: 3px;
  }

  .heatmap-table th.hm-day-col {
    background: #FFFFFF !important;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }
}

@media (max-width: 640px) {
  /* In Mobile Table Mode: hide redundant '#' column so sticky Name column sits cleanly at right:0 with zero overlap! */
  .table-wrap.mobile-mode-table .data-table {
    border-collapse: collapse;
  }

  .table-wrap.mobile-mode-table .data-table th.mcard-rank-cell,
  .table-wrap.mobile-mode-table .data-table td.mcard-rank-cell {
    display: none !important;
  }

  .table-wrap.mobile-mode-table .data-table th.mcol-sticky,
  .table-wrap.mobile-mode-table .data-table td.mcol-sticky {
    position: sticky;
    right: 0;
    z-index: 4;
    background: #FFFFFF !important;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
    box-shadow: -4px 0 8px rgba(11, 19, 43, 0.08);
    min-width: 118px;
    max-width: 150px;
  }

  .table-wrap.mobile-mode-table .data-table thead th.mcol-sticky {
    background: #EFF4F8 !important;
    z-index: 5;
  }

  .table-wrap.mobile-mode-table .data-table tfoot td.mcol-sticky {
    background: #F4D6B0 !important;
    color: #0B132B !important;
    z-index: 5;
  }
}


/* Remember-Me Control on Login Screen (Strictly 6-Color Palette) */
.remember-me-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(58, 80, 107, 0.06);
  border: 1px solid rgba(58, 80, 107, 0.12);
  cursor: pointer;
  user-select: none;
}

.remember-me-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #1C2541;
  cursor: pointer;
  flex-shrink: 0;
}

.remember-me-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.remember-me-text strong {
  font-size: 13px;
  font-weight: 700;
  color: #0B132B;
}

.remember-me-text small {
  font-size: 11px;
  color: #3A506B;
}

/* ============================================================================
   Conversational On-Premise AI Chat Shell (Strictly 6-Color Executive Palette)
   ============================================================================ */
.ai-chat-shell {
  padding: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 230px);
  max-height: calc(100vh - 150px);
  border: 1px solid rgba(58, 80, 107, 0.16) !important;
}

.ai-chat-header {
  background: linear-gradient(135deg, #0B132B 0%, #1C2541 100%);
  color: #FFFFFF;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.ai-chat-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ai-bot-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(91, 192, 222, 0.16);
  border: 1px solid rgba(91, 192, 222, 0.4);
  color: #5BC0DE;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-chat-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-chat-title-row h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #FFFFFF;
}

.ai-live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #F4D6B0;
  display: inline-block;
}

.ai-live-dot.is-llm {
  background: #5BC0DE;
  box-shadow: 0 0 0 4px rgba(91, 192, 222, 0.25);
}

.ai-chat-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  color: rgba(244, 214, 176, 0.88);
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(91, 192, 222, 0.18);
  border: 1px solid rgba(91, 192, 222, 0.35);
  color: #5BC0DE;
  font-size: 11.5px;
  font-weight: 700;
}

.ai-pill-muted {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.ai-pill-shield {
  background: rgba(244, 214, 176, 0.16);
  border-color: rgba(244, 214, 176, 0.42);
  color: #F4D6B0;
}

.ai-memory-drawer {
  background: #FFFFFF;
  border-bottom: 1px solid rgba(58, 80, 107, 0.16);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-memory-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-memory-drawer-head strong {
  color: #0B132B;
  font-size: 13.5px;
  display: block;
}

.ai-memory-drawer-head p {
  margin: 2px 0 0;
  color: #3A506B;
  font-size: 12px;
}

.ai-memory-head-btns {
  display: flex;
  gap: 6px;
}

.ai-memory-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-memory-form select {
  width: 165px;
}

.ai-memory-form input {
  flex: 1;
  min-width: 200px;
}

.ai-memory-msg {
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.ai-memory-msg.ok {
  background: rgba(91, 192, 222, 0.14);
  color: #0B132B;
  border: 1px solid rgba(91, 192, 222, 0.4);
}

.ai-memory-msg.err {
  background: rgba(217, 119, 6, 0.12);
  color: #D97706;
  border: 1px solid rgba(217, 119, 6, 0.35);
}

.ai-memory-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 170px;
  overflow-y: auto;
}

.ai-memory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 10px;
  background: #EFF4F8;
  border: 1px solid rgba(58, 80, 107, 0.12);
}

.ai-memory-item-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.ai-memory-cat {
  font-size: 11px;
  font-weight: 700;
  color: #1C2541;
  background: #F4D6B0;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.ai-memory-text {
  font-size: 12.5px;
  color: #0B132B;
}

.ai-memory-empty {
  font-size: 12px;
  color: #3A506B;
  padding: 6px 2px;
}

.ai-new-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.ai-model-select {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border: 1px solid rgba(91, 192, 222, 0.35);
  border-radius: 10px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ai-model-select option {
  background: #0B132B;
  color: #FFFFFF;
}

.ai-team-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-team-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: #EFF4F8;
  border: 1px solid rgba(58, 80, 107, 0.22);
  color: #1C2541;
  font-size: 11px;
  font-weight: 700;
}

.ai-team-arrow {
  color: #D97706;
  font-weight: 700;
  font-size: 12px;
}

.ai-quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 11px 18px;
  background: #EFF4F8;
  border-bottom: 1px solid rgba(58, 80, 107, 0.12);
}

.ai-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(58, 80, 107, 0.2);
  background: #FFFFFF;
  color: #1C2541;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.ai-chip:hover {
  background: #1C2541;
  border-color: #1C2541;
  color: #FFFFFF;
}

.ai-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  background: #EFF4F8;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 88%;
}

.ai-msg-user {
  align-self: flex-start;
  flex-direction: row-reverse;
}

.ai-msg-bot {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: #0B132B;
  color: #5BC0DE;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-msg-avatar-user {
  background: #D97706;
  color: #FFFFFF;
}

.ai-msg-bubble {
  border-radius: 18px;
  padding: 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ai-msg-user .ai-msg-bubble {
  background: #1C2541;
  color: #FFFFFF;
  border-top-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(11, 19, 43, 0.12);
}

.ai-msg-bot .ai-msg-bubble {
  background: #FFFFFF;
  color: #0B132B;
  border: 1px solid rgba(58, 80, 107, 0.14);
  border-top-left-radius: 6px;
  box-shadow: 0 4px 16px rgba(11, 19, 43, 0.05);
}

.ai-msg-text {
  font-size: 14px;
  line-height: 1.75;
  word-wrap: break-word;
}

.ai-msg-text p {
  margin: 0 0 6px;
}

.ai-msg-text p:last-child {
  margin-bottom: 0;
}

.ai-md-h {
  font-weight: 700;
  color: #0B132B;
  margin: 8px 0 4px;
  font-size: 14.5px;
}

.ai-md-list {
  margin: 4px 0 8px;
  padding: 0 20px 0 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ai-md-gap {
  height: 6px;
}

.ai-thinking {
  color: #3A506B;
  font-weight: 600;
}

.ai-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-right: 3px;
  background: #5BC0DE;
  vertical-align: middle;
  animation: aiBlink 0.8s steps(2) infinite;
}

@keyframes aiBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.ai-err-text {
  color: #D97706;
  font-weight: 700;
}

.ai-msg-meta {
  font-size: 11px;
  color: #3A506B;
  border-top: 1px solid rgba(58, 80, 107, 0.09);
  padding-top: 6px;
}

.ai-inline-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
}

.ai-mini-kpi {
  background: #EFF4F8;
  border: 1px solid rgba(58, 80, 107, 0.12);
  border-right: 3px solid #3A506B;
  border-radius: 11px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-mini-kpi.is-pos {
  border-right-color: #5BC0DE;
}

.ai-mini-kpi.is-neg {
  border-right-color: #D97706;
}

.ai-mini-kpi span {
  font-size: 11px;
  color: #3A506B;
  font-weight: 600;
}

.ai-mini-kpi strong {
  font-size: 14px;
  color: #0B132B;
  font-weight: 700;
}

.ai-data-drawer {
  background: #EFF4F8;
  border: 1px solid rgba(58, 80, 107, 0.14);
  border-radius: 12px;
  overflow: hidden;
}

.ai-data-drawer summary {
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 700;
  color: #1C2541;
  cursor: pointer;
  user-select: none;
}

.ai-data-drawer-body {
  padding: 12px;
  background: #FFFFFF;
  border-top: 1px solid rgba(58, 80, 107, 0.1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-inline-sec-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0B132B;
  margin-bottom: 8px;
}

.ai-inline-chart-wrap {
  height: 220px;
  position: relative;
}

.ai-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid rgba(58, 80, 107, 0.14);
}

.ai-composer-input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: 1.5px solid rgba(58, 80, 107, 0.22);
  border-radius: 14px;
  padding: 11px 14px;
  background: #EFF4F8;
  color: #0B132B;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  max-height: 130px;
}

.ai-composer-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: #5BC0DE;
  box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.2);
}

.ai-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  background: #D97706 !important;
  color: #FFFFFF !important;
  font-weight: 700;
  white-space: nowrap;
}

.ai-send-btn:hover {
  background: #1C2541 !important;
  color: #FFFFFF !important;
}

@media (max-width: 960px) {
  .ai-chat-shell {
    min-height: calc(100vh - 210px);
    max-height: none;
  }
  .ai-msg {
    max-width: 96%;
  }
  .ai-chat-thread {
    padding: 12px;
    max-height: 58vh;
  }
  .ai-composer-input {
    font-size: 16px;
  }
  .ai-quick-bar {
    padding: 10px 12px;
  }
}
