/* ==========================================================================
   Design System & CSS Variables
   ========================================================================== */
:root {
  /* Colors */
  --clr-primary: #FF6900;
  --clr-primary-hover: #C78308;
  --clr-accent: #111111;

  --clr-bg-app: #f5f6f8;
  --clr-surface: #ffffff;
  --clr-surface-elevated: #ffffff;

  --clr-text-primary: #1a1d20;
  --clr-text-secondary: #5a6268;
  --clr-text-muted: #9ba3a9;

  --clr-border: #e5e9eb;

  --clr-success: #10b981;
  --clr-success-bg: #d1fae5;
  --clr-warning: #f59e0b;
  --clr-warning-bg: #fef3c7;
  --clr-danger: #ef4444;
  --clr-danger-bg: #fee2e2;
  --clr-info: #3b82f6;
  --clr-info-bg: #dbeafe;

  --font-family: "Inter", system-ui, -apple-system, sans-serif;

  --sidebar-width: 220px;
  --sidebar-collapsed-width: 62px;
  --header-height: 66px;
  --border-radius: 12px;
  --border-radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Ultra-thin scrollbars — no track, no arrows */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-primary) transparent;
}
*::-webkit-scrollbar {
  width: 2px !important;
  height: 2px !important;
}
*::-webkit-scrollbar-track {
  background: transparent !important;
  border: none;
}
*::-webkit-scrollbar-thumb {
  background: var(--clr-primary) !important;
  border-radius: 10px;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--clr-primary-hover) !important;
}
*::-webkit-scrollbar-button {
  display: none !important;
  height: 0;
  width: 0;
}
*::-webkit-scrollbar-corner {
  display: none !important;
  background: transparent;
}

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

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* ==========================================================================
   Application Shell Layout
   ========================================================================== */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar (Phase 2) ── */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition:
    width var(--sidebar-transition),
    min-width var(--sidebar-transition);
  flex-shrink: 0;
}

/* Collapsed state */
.app-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}
.app-sidebar.collapsed .nav-group-label,
.app-sidebar.collapsed .sidebar-brand-text {
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  width: 0;
}
.app-sidebar.collapsed .nav-item {
  padding: 0.75rem;
  justify-content: center;
  gap: 0;
}
.app-sidebar.collapsed .nav-item span {
  display: none;
}
.app-sidebar.collapsed .nav-item svg {
  flex-shrink: 0;
}
.app-sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0;
}
.app-sidebar.collapsed .sidebar-brand img {
  display: none;
}
.app-sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}
.app-sidebar.collapsed .nav-group {
  margin-bottom: 0.75rem;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1rem 0 1.25rem;
  border-bottom: 1px solid var(--clr-border);
  justify-content: space-between;
  gap: 0.5rem;
  overflow: hidden;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--clr-bg-app);
  border: 1px solid var(--clr-border);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  color: var(--clr-text-secondary);
}
.sidebar-collapse-btn:hover {
  background: var(--clr-border);
  color: var(--clr-text-primary);
}
.sidebar-collapse-btn svg {
  transition: transform var(--sidebar-transition);
}

.sidebar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--clr-text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
}
.sidebar-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 8px;
}
.sidebar-brand-text {
  white-space: nowrap;
  overflow: hidden;
  transition:
    opacity var(--sidebar-transition),
    width var(--sidebar-transition);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
}

.nav-group {
  margin-bottom: 1.5rem;
}

.nav-group-label {
  padding: 0 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--clr-text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.6rem 1.25rem;
  color: var(--clr-text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  gap: 0.7rem;
  transition:
    background 0.15s,
    color 0.15s;
  border-radius: 0;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--clr-text-primary);
}

.nav-item.active {
  background-color: rgba(233, 41, 14, 0.08);
  color: var(--clr-primary);
  font-weight: 600;
  border-right: 3px solid var(--clr-primary);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Important for flexbox truncation */
}

/* ── Header (Phase 1) ── */
.app-header {
  height: var(--header-height);
  background-color: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
  gap: 1rem;
}

/* Notification badge */
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--clr-danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 50px;
  padding: 1px 4px;
  min-width: 15px;
  text-align: center;
  border: 1.5px solid var(--clr-surface);
  line-height: 1.4;
  pointer-events: none;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-search {
  position: relative;
}
.header-search input {
  background: var(--clr-bg-app);
  border: 1px solid var(--clr-border);
  border-radius: 50px;
  padding: 0.5rem 1rem 0.5rem 2.4rem;
  width: 280px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--clr-text-primary);
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ba3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.header-search input::placeholder {
  color: var(--clr-text-muted);
}
.header-search input:focus {
  border-color: var(--clr-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(233, 41, 14, 0.08);
  background-color: #fff;
}

.branch-selector {
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.48rem 2.5rem 0.48rem 0.85rem;
  background: var(--clr-bg-app);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--clr-text-primary);
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  appearance: none;
  font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ba3af' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  max-width: 200px;
}
.branch-selector:focus,
.branch-selector:hover {
  border-color: var(--clr-primary);
  background-color: #fff;
}

.demo-badge {
  background-color: var(--clr-warning-bg);
  color: #92400e;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Content */
.content-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

/* ==========================================================================
   UI Components
   ========================================================================== */
.page-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--clr-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Cards */
.card {
  background: var(--clr-surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
  padding: 1.25rem;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: var(--clr-success-bg);
  color: var(--clr-success);
}
.badge-warning {
  background: var(--clr-warning-bg);
  color: var(--clr-warning);
}
.badge-danger {
  background: var(--clr-danger-bg);
  color: var(--clr-danger);
}
.badge-info {
  background: var(--clr-info-bg);
  color: var(--clr-info);
}
.badge-status-new {
  background: var(--clr-info-bg);
  color: var(--clr-info);
}
.badge-status-preparing {
  background: var(--clr-warning-bg);
  color: var(--clr-warning);
}
.badge-status-ready {
  background: var(--clr-success-bg);
  color: var(--clr-success);
}
.badge-status-completed {
  background: var(--clr-border);
  color: var(--clr-text-secondary);
}
.badge-status-cancelled {
  background: var(--clr-danger-bg);
  color: var(--clr-danger);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: var(--border-radius-sm);
  font-weight: 500;
  transition: all 0.2s;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--clr-primary);
  color: #1a1d20;
}
.btn-primary:hover {
  background: var(--clr-primary-hover);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--clr-border);
  color: var(--clr-text-primary);
}
.btn-outline:hover {
  background: var(--clr-bg-app);
}

.btn-success {
  background: var(--clr-success);
  color: white;
}
.btn-success:hover {
  background: #0e9f6e;
}
.btn-warning {
  background: var(--clr-warning);
  color: white;
}
.btn-warning:hover {
  background: #d97706;
}
.btn-danger {
  background: var(--clr-danger);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}
.btn-info {
  background: var(--clr-info);
  color: white;
}
.btn-info:hover {
  background: #2563eb;
}

/* ==========================================================================
   Dashboard Grid & Widgets
   ========================================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.col-span-3 {
  grid-column: span 3;
}
.col-span-4 {
  grid-column: span 4;
}
.col-span-6 {
  grid-column: span 6;
}
.col-span-8 {
  grid-column: span 8;
}
.col-span-12 {
  grid-column: span 12;
}

/* KPI Cards */
.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem; /* Reduced padding */
}
.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--clr-text-secondary);
  font-size: 0.75rem; /* Reduced from 0.9rem */
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-bg-app);
  color: var(--clr-text-secondary);
}
.kpi-value {
  font-size: 1.25rem; /* Reduced from 1.75rem */
  font-weight: 700;
  color: var(--clr-text-primary);
  margin-bottom: 0.25rem;
}
.kpi-trend {
  display: flex;
  align-items: center;
  font-size: 0.7rem; /* Reduced from 0.8rem */
  gap: 0.25rem;
}
.trend-up {
  color: var(--clr-success);
}
.trend-down {
  color: var(--clr-danger);
}
.trend-text {
  color: var(--clr-text-muted);
}

/* ── Order Stats Row ── */
.orders-stats-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}
.order-stat-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  overflow: hidden;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.order-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  background: var(--osc-accent, var(--clr-border));
}
.order-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.order-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--clr-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.order-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--osc-accent, var(--clr-text-primary));
  line-height: 1;
}
.order-stat-sub {
  font-size: 0.7rem;
  color: var(--clr-text-muted);
}
@media (max-width: 1280px) {
  .orders-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 768px) {
  .orders-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Charts */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.chart-title {
  font-size: 1.1rem;
  font-weight: 600;
}
.chart-actions select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius-sm);
  font-size: 0.8rem;
  background: var(--clr-surface);
}

/* Order Snapshot */
.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}
.snapshot-item {
  background: var(--clr-bg-app);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid transparent;
}
.snapshot-item:hover {
  border-color: var(--clr-primary);
  background: white;
}
.snapshot-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.snapshot-label {
  font-size: 0.8rem;
  color: var(--clr-text-secondary);
  font-weight: 500;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--clr-border);
}
.data-table th {
  font-weight: 600;
  color: var(--clr-text-secondary);
  background: var(--clr-bg-app);
  position: sticky;
  top: 0;
}
.data-table tr:hover td {
  background-color: var(--clr-bg-app);
}

/* AI Insights */
.ai-insight {
  background: linear-gradient(145deg, #fff9f5 0%, #ffffff 100%);
  border: 1px solid #ffe4d6;
  border-left: 4px solid var(--clr-primary);
}
.ai-insight-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--clr-primary);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   View Management
   ========================================================================== */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}
.view-section.active {
  display: block;
}

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

/* ==========================================================================
   Drawers (Order Details)
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.drawer-overlay.active {
  display: block;
  opacity: 1;
}
.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 450px;
  max-width: 100%;
  background: var(--clr-surface);
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.drawer-panel.open {
  transform: translateX(0);
}
.drawer-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}
.drawer-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--clr-border);
  background: var(--clr-bg-app);
}

/* ==========================================================================
   POS Layout
   ========================================================================== */
.pos-layout {
  display: flex;
  gap: 1.5rem;
  height: calc(100vh - var(--header-height) - 4rem);
}
.pos-categories {
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  min-height: 0;
}
.pos-category-btn {
  padding: 0.75rem;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius-sm);
  text-align: left;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}
.pos-category-btn:hover,
.pos-category-btn.active {
  background: rgba(233, 41, 14, 0.1);
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}
.pos-products {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-content: start;
  overflow-y: auto;
  min-height: 0;
  /* Hide scrollbar — keep scroll functional */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pos-products::-webkit-scrollbar {
  display: none;
}
.pos-product-card {
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  height: 280px;
  position: relative;
  padding: 0;
}
.pos-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
  border-color: var(--clr-primary);
}
.pos-product-card:active {
  transform: translateY(0);
}

.pos-img-wrap {
  height: 120px;
  width: 120px;
  margin: 10px auto 0 auto;
  border-radius: 8px; /* Fully rounded since it is a floating square */
  overflow: hidden;
  background: #f8f9fa;
  position: relative;
  flex-shrink: 0;
}
.pos-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.pos-product-card:hover .pos-img-wrap img {
  transform: scale(1.08);
}

.pos-status {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pos-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}
.pos-content-top {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.pos-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--clr-text-primary);
  line-height: 1.25;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pos-desc {
  font-size: 0.7rem;
  color: var(--clr-text-secondary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.pos-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.pos-price {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--clr-primary);
}
.pos-add-btn {
  background: var(--clr-bg-app);
  color: var(--clr-primary);
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s;
  pointer-events: none;
  font-family: inherit;
}
.pos-product-card:hover .pos-add-btn {
  background: var(--clr-primary);
  color: #1a1d20;
  border-color: var(--clr-primary);
}
.pos-cart {
  width: 350px;
  background: var(--clr-surface);
  border-radius: var(--border-radius);
  border: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  position: relative;
}
.pos-cart .drawer-header {
  position: sticky;
  top: 0;
  background: var(--clr-surface);
  z-index: 10;
}
.pos-cart .drawer-footer {
  margin-top: auto;
  background: var(--clr-surface);
  z-index: 10;
}
.pos-cart-items {
  flex: 1 0 auto;
  padding: 1rem;
}

/* POS Type Tabs */
.pos-type-toggle {
  display: flex;
  background: var(--clr-bg-app);
  border-radius: 8px;
  padding: 0.25rem;
  gap: 0.25rem;
}
.pos-type-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--clr-text-secondary);
  transition: all 0.2s;
}
.pos-type-btn:hover {
  color: var(--clr-text-primary);
}
.pos-type-btn.active {
  background: var(--clr-surface);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 1200px) {
  .pos-products {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 768px) {
  .pos-products {
    grid-template-columns: repeat(1, 1fr);
  }
}

.pos-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--clr-bg-app);
  transition: border-color 0.2s;
}
.pos-input:focus {
  border-color: var(--clr-primary);
  outline: none;
}
.pos-cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px dashed var(--clr-border);
}

/* ==========================================================================
   KDS Kanban Layout
   ========================================================================== */
.kds-layout {
  display: flex;
  gap: 1rem;
  height: calc(100vh - var(--header-height) - 4rem);
  overflow-x: auto;
}
.kds-column {
  flex: 1;
  min-width: 300px;
  background: #eaecef;
  border-radius: var(--border-radius-sm);
  display: flex;
  flex-direction: column;
}
.kds-column-header {
  padding: 1rem;
  font-weight: 700;
  border-bottom: 2px solid var(--clr-border);
  display: flex;
  justify-content: space-between;
}
.kds-column-body {
  padding: 1rem;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.kds-card {
  background: var(--clr-surface);
  border-radius: var(--border-radius-sm);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 1.25rem;
  border-left: 5px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.kds-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}
.kds-card.urgent {
  border-left-color: var(--clr-danger);
}
.kds-card.new {
  border-left-color: var(--clr-info);
}
.kds-card.preparing {
  border-left-color: var(--clr-warning);
}
.kds-card.ready {
  border-left-color: var(--clr-success);
}
.kds-card button {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: 6px;
  transition:
    background-color 0.2s,
    color 0.2s;
}
.kds-card button:hover {
  filter: brightness(0.9);
}

/* ==========================================================================
   Filters Bar
   ========================================================================== */
.filters-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.filters-bar select,
.filters-bar input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius-sm);
  background: var(--clr-surface);
}

/* ==========================================================================
   Map & Floor Plan (Phase 5)
   ========================================================================== */
.map-placeholder {
  padding: 3rem 1rem;
  background: #eaecef;
  border-style: dashed;
}

.floor-plan-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1rem 0;
}
.restaurant-table {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: transform 0.2s;
  box-shadow: var(--shadow-sm);
}
.restaurant-table:hover {
  transform: scale(1.05);
}
.table-available {
  background: var(--clr-success);
}
.table-occupied {
  background: var(--clr-danger);
}
.table-reserved {
  background: var(--clr-warning);
}

/* ==========================================================================
   Inner Tabs (Phase 4)
   ========================================================================== */
.inner-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--clr-border);
  margin-bottom: 1.5rem;
}
.inner-tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  font-weight: 600;
  color: var(--clr-text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; /* overlap the border */
  transition: all 0.2s;
}
.inner-tab:hover {
  color: var(--clr-primary);
}
.inner-tab.active {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
}
.inv-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}
.inv-tab-content.active {
  display: block;
}
/* Floor Plan Styling */
.floor-plan-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
  background: var(--clr-bg-app);
  border-radius: var(--border-radius);
  border: 1px dashed var(--clr-border);
}
.restaurant-table-card {
  background: var(--clr-surface);
  border: 2px solid var(--clr-border);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s;
}
.restaurant-table-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--clr-border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}
.table-id {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--clr-text-primary);
}
.table-capacity {
  font-size: 0.75rem;
  color: var(--clr-text-secondary);
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.table-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.table-actions {
  margin-top: 0.5rem;
}

.table-available {
  border-color: var(--clr-success);
  border-top-width: 4px;
}
.table-occupied {
  border-color: var(--clr-danger);
  border-top-width: 4px;
}
.table-reserved {
  border-color: var(--clr-warning);
  border-top-width: 4px;
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */
.mobile-toggle {
  display: none;
  font-size: 1.5rem;
}

@media (max-width: 1024px) {
  .header-search input {
    width: 180px;
  }

  .col-span-3,
  .col-span-4 {
    grid-column: span 6;
  }
  .col-span-8 {
    grid-column: span 12;
  }
  .snapshot-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .pos-layout {
    flex-direction: column;
    height: auto;
  }
  .pos-categories {
    width: 100%;
    flex-direction: row;
  }
  .pos-cart {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 9999;
  }

  .mobile-toggle {
    display: block;
  }

  .header-search {
    display: none;
  }

  .content-wrapper {
    padding: 1rem;
  }

  .col-span-6 {
    grid-column: span 12;
  }
  .snapshot-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .btn {
    min-height: 44px;
  }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: white;
  color: var(--clr-text-primary);
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(120%);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    opacity 0.3s ease;
  border-left: 4px solid var(--clr-primary);
  pointer-events: auto;
  font-size: 0.9rem;
  font-weight: 500;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-left-color: var(--clr-success);
}
.toast-error {
  border-left-color: var(--clr-danger);
}
.toast-info {
  border-left-color: var(--clr-info);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  color: var(--clr-success);
}
.toast-error .toast-icon {
  color: var(--clr-danger);
}
.toast-info .toast-icon {
  color: var(--clr-info);
}

/* ==========================================================================
   Mobile Floating Badge
   ========================================================================== */
.mobile-floating-badge {
  display: none; /* Hidden on desktop */
}



@media (max-width: 768px) {
  .mobile-floating-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--clr-surface);
    color: var(--clr-primary);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--clr-primary);
    z-index: 9990;
    cursor: pointer;
    /* No animation on this button */
  }
}

/* ==========================================================================
   Kitchen Confirmation Modal (Phase 4)
   ========================================================================== */
.kitchen-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.kitchen-modal-overlay.open {
  display: flex;
}
.kitchen-modal-sheet {
  background: var(--clr-surface);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: modalSlideUp 0.25s ease;
  overflow: hidden;
}
@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.kitchen-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.kitchen-modal-header .km-icon {
  width: 36px;
  height: 36px;
  background: rgba(233, 41, 14, 0.1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-primary);
  flex-shrink: 0;
}
.kitchen-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  flex: 1;
}
.kitchen-modal-header .km-close {
  color: var(--clr-text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s;
}
.kitchen-modal-header .km-close:hover {
  background: var(--clr-bg-app);
  color: var(--clr-text-primary);
}
.kitchen-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}
.km-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--clr-text-muted);
  margin-bottom: 0.6rem;
  margin-top: 1rem;
}
.km-section-title:first-child {
  margin-top: 0;
}
.km-order-info {
  background: var(--clr-bg-app);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.km-order-info span {
  color: var(--clr-text-secondary);
}
.km-order-info strong {
  color: var(--clr-text-primary);
}
.km-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.km-item-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  background: #fff;
}
.km-item-qty {
  background: rgba(233, 41, 14, 0.1);
  color: var(--clr-primary);
  font-weight: 700;
  font-size: 0.8rem;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.km-item-details {
  flex: 1;
}
.km-item-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.km-item-variant {
  font-size: 0.78rem;
  color: var(--clr-text-secondary);
  margin-top: 1px;
}
.km-item-price {
  font-weight: 700;
  color: var(--clr-text-primary);
  font-size: 0.9rem;
  white-space: nowrap;
}
.km-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0.75rem;
  border-top: 2px solid var(--clr-border);
  margin-top: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
}
.km-total-row span:last-child {
  color: var(--clr-primary);
}
.kitchen-modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--clr-border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  background: var(--clr-bg-app);
}

/* ==========================================================================
   POS — Compact Cards (Phase 4)
   ========================================================================== */
.pos-product-card.compact {
  height: 220px;
}
.pos-product-card.compact .pos-img-wrap {
  height: 90px;
  width: 90px;
}
.pos-product-card.compact .pos-content {
  padding: 0.6rem 0.75rem 0.65rem;
}
.pos-product-card.compact .pos-name {
  font-size: 0.88rem;
  -webkit-line-clamp: 1;
}
.pos-product-card.compact .pos-price {
  font-size: 0.95rem;
}
.pos-product-card.compact .pos-add-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
}

/* Send to Kitchen button */
.btn-kitchen {
  background: linear-gradient(135deg, var(--clr-primary) 0%, #C78308 100%);
  color: #1a1d20;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 8px;
  padding: 0.75rem 1.25rem;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(233, 41, 14, 0.25);
}
.btn-kitchen:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(233, 41, 14, 0.35);
}
.btn-kitchen:active {
  transform: translateY(0);
}

/* ==========================================================================
   Orders Page — no outer card wrapper (Phase 3)
   ========================================================================== */
#orders-filter-bar {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   KDS — Full View button (Phase 6)
   ========================================================================== */
.kds-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.btn-fullview {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--clr-border);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-text-secondary);
  background: var(--clr-surface);
  transition: all 0.2s;
}
.btn-fullview:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
  background: rgba(233, 41, 14, 0.04);
}

/* ==========================================================================
   Content & Media Tab (Phase 8)
   ========================================================================== */
.content-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.content-media-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
  position: relative;
}
.content-media-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.content-media-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.content-media-card-body {
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.content-media-card-body span {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--clr-text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.content-media-actions {
  display: flex;
  gap: 0.35rem;
}
.content-media-actions button {
  padding: 0.25rem 0.5rem;
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--clr-border);
  background: var(--clr-bg-app);
  color: var(--clr-text-secondary);
  transition: all 0.15s;
}
.content-media-actions button:hover {
  background: var(--clr-primary);
  color: #1a1d20;
  border-color: var(--clr-primary);
}
.content-media-actions .btn-del:hover {
  background: var(--clr-danger);
  border-color: var(--clr-danger);
}
.content-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .content-form-grid {
    grid-template-columns: 1fr;
  }
}
.content-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.content-form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--clr-text-secondary);
}
.content-form-group input,
.content-form-group textarea,
.content-form-group select {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--clr-border);
  border-radius: 7px;
  font-size: 0.875rem;
  font-family: inherit;
  background: var(--clr-bg-app);
  color: var(--clr-text-primary);
  transition: border-color 0.2s;
  outline: none;
}
.content-form-group input:focus,
.content-form-group textarea:focus,
.content-form-group select:focus {
  border-color: var(--clr-primary);
  background: #fff;
}
.content-save-bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--clr-border);
}
/* ==========================================================================
   Mobile Responsiveness Fixes
   ========================================================================== */

/* 6. Sticky Header (For both mobile and desktop) */
.app-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
}

@media (max-width: 768px) {
  /* 1. Mobile Header */
  .demo-badge {
    display: none !important;
  }

  .branch-selector {
    width: 110px !important;
    margin-right: 0 !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
  }

  .header-actions,
  .header-right {
    gap: 6px !important;
  }

  /* 2. Dashboard Tab */
  #view-dashboard .dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  #view-dashboard .dashboard-grid .kpi-card {
    grid-column: span 1 !important;
    width: 100% !important;
  }
  #view-dashboard .dashboard-grid .card:not(.kpi-card) {
    grid-column: span 2 !important;
    width: 100% !important;
  }

  /* 3. POS Tab */
  #view-pos .pos-products {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 12px !important;
    padding-bottom: 12px !important;
    -webkit-overflow-scrolling: touch;
  }
  #view-pos .pos-products::-webkit-scrollbar {
    display: none;
  }
  #view-pos .pos-products .pos-product-card {
    flex: 0 0 calc(45% - 12px) !important;
    min-width: 140px !important;
  }

  /* Ensure Current Order (cart) is completely visible */
  #view-pos .pos-layout {
    display: flex !important;
    flex-direction: column !important;
  }
  #view-pos .pos-cart {
    width: 100% !important;
    margin-top: 15px !important;
  }

  /* 4. Menu Tab (Content & Media) */
  #view-content label.btn {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.75rem !important;
    white-space: nowrap !important;
  }
  .content-media-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }
  .content-media-card img {
    height: 90px !important;
  }
  .content-media-card-body {
    padding: 0.5rem !important;
  }
  .content-media-card-body span {
    font-size: 0.75rem !important;
  }
  .content-media-actions button {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.7rem !important;
  }

  /* 5. Inventory & Supply Chain */
  .table-wrapper {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .data-table {
    min-width: 700px !important;
  }
}


/* Global Skeleton Loading for Images */
@keyframes imgSkeletonPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.3; }
}
img:not(.is-loaded) {
  background: #e5e7eb !important;
  animation: imgSkeletonPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
  color: transparent !important;
}
html.dark-mode img:not(.is-loaded) {
  background: #374151 !important;
}

/* ==========================================================================
   Sidebar Badges & Dots
   ========================================================================== */
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 12px;
  background: var(--clr-primary);
  color: #1a1d20 !important;
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(233, 41, 14, 0.25);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none !important;
  letter-spacing: -0.3px;
}
.nav-badge.hidden { display: none; }
.nav-badge.badge-blue { 
  background: var(--clr-info); 
  color: #fff !important; 
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25); 
}
.nav-badge.badge-orange { 
  background: var(--clr-warning); 
  color: #fff !important; /* using white for contrast on deep orange if warning is standard orange, else dark */
  text-shadow: 0 1px 2px rgba(0,0,0,0.2); /* Ensure readable if warning is light */
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25); 
}

.nav-dot {
  margin-left: auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--clr-warning);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.2);
  transition: all 0.2s;
}
.nav-dot.hidden { display: none; }

.nav-item:hover .nav-badge {
  transform: scale(1.1);
}

/* Collapsed sidebar — badge as absolute top-right of icon */
.app-sidebar.collapsed .nav-badge {
  position: absolute;
  top: 6px;
  right: 50%;
  transform: translateX(18px); /* Push it to the top right of the icon */
  margin: 0;
  min-width: 18px;
  height: 18px;
  font-size: 0.6rem;
  border: 2px solid var(--clr-surface, #fff); /* Cutout effect */
  padding: 0 4px;
}
.app-sidebar.collapsed .nav-item:hover .nav-badge {
  transform: translateX(18px) scale(1.1);
}
.app-sidebar.collapsed .nav-dot {
  position: absolute;
  top: 8px;
  right: 50%;
  transform: translateX(12px);
  margin: 0;
  border: 2px solid var(--clr-surface, #fff);
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   About Panel Floating Button
   ========================================================================== */
@keyframes float-ud {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-7px); }
}

.about-panel-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 950;
  background: var(--clr-primary);
  color: #1a1d20;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(251, 104, 21, 0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: float-ud 2.2s ease-in-out infinite;
  font-family: inherit;
}
.about-panel-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 30px rgba(251, 104, 21, 0.55);
  animation-play-state: paused;
}
.about-panel-btn svg { flex-shrink: 0; }

@media (max-width: 768px) {
  .about-panel-btn {
    bottom: 4.5rem;
    right: 1rem;
    padding: 0.65rem 1rem;
    font-size: 0.78rem;
  }
}

/* ==========================================================================
   About Panel Modal
   ========================================================================== */
.adm-about-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9998;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}
.adm-about-overlay.open { display: flex; }
.adm-about-modal {
  background: var(--clr-surface);
  width: min(700px, 96vw);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--border-radius-lg, 16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}
.adm-about-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--clr-surface);
  z-index: 2;
  gap: 1rem;
}
.adm-about-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--clr-text-primary);
}
.adm-about-close {
  background: var(--clr-bg-app);
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
  color: var(--clr-text-secondary);
}
.adm-about-close:hover { background: var(--clr-border); }
.adm-about-body { padding: 1.5rem 2rem 2rem; }
.adm-about-intro {
  margin-bottom: 1.75rem;
  color: var(--clr-text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
}
.adm-about-intro strong { color: var(--clr-text-primary); }
.adm-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--clr-primary);
  margin-bottom: 1rem;
}
.adm-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}
@media (max-width: 500px) {
  .adm-feature-grid { grid-template-columns: repeat(2, 1fr); }
}
.adm-feature-card {
  background: var(--clr-bg-app);
  border: 1px solid var(--clr-border);
  border-radius: var(--border-radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.2s, transform 0.2s;
}
.adm-feature-card:hover {
  border-color: var(--clr-primary);
  transform: translateY(-2px);
}
.adm-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(251,104,21,0.12);
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.adm-feature-name { font-size: 0.8rem; font-weight: 700; color: var(--clr-text-primary); }
.adm-feature-desc { font-size: 0.72rem; color: var(--clr-text-secondary); line-height: 1.45; }
.adm-custom-card {
  background: linear-gradient(135deg, rgba(251,104,21,0.08) 0%, rgba(251,104,21,0.03) 100%);
  border: 1px solid rgba(251,104,21,0.25);
  border-radius: var(--border-radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.adm-custom-card p { margin: 0 0 0.75rem; font-size: 0.88rem; color: var(--clr-text-secondary); line-height: 1.6; }
.adm-custom-card p:last-child { margin-bottom: 0; }
.adm-custom-card strong { color: var(--clr-text-primary); }
.adm-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.adm-tag {
  background: rgba(251,104,21,0.12);
  color: var(--clr-primary);
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  font-size: 0.73rem;
  font-weight: 600;
}
.adm-about-footer {
  padding: 1rem 2rem 1.5rem;
  border-top: 1px solid var(--clr-border);
  display: flex;
  justify-content: flex-end;
}

/* Branch Switch Modal */
.branch-switch-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9997;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}
.branch-switch-modal-overlay.open { display: flex; }
.branch-switch-modal {
  background: var(--clr-surface);
  width: min(400px, 95vw);
  border-radius: var(--border-radius-lg, 16px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 2rem;
}
.branch-switch-modal h3 { margin: 0 0 0.5rem; font-size: 1.1rem; font-weight: 800; }
.branch-switch-modal p { font-size: 0.88rem; color: var(--clr-text-secondary); margin: 0 0 1.25rem; line-height: 1.5; }
.branch-switch-modal select,
.branch-switch-modal input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--clr-border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--clr-bg-app);
  color: var(--clr-text-primary);
  margin-bottom: 0.75rem;
  font-family: inherit;
  box-sizing: border-box;
}
.branch-switch-modal select:focus,
.branch-switch-modal input[type="password"]:focus { border-color: var(--clr-primary); outline: none; }
#bsm-error { display: none; color: var(--clr-danger); font-size: 0.82rem; margin-bottom: 0.75rem; font-weight: 600; }

/* Active branch banner in Contact tab */
.ct-branch-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  background: rgba(251,104,21,0.08);
  border: 1px solid rgba(251,104,21,0.2);
  border-radius: 10px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.ct-branch-banner svg { color: var(--clr-primary); flex-shrink: 0; }
.ct-branch-banner span { flex: 1; font-size: 0.88rem; color: var(--clr-text-secondary); }
.ct-branch-banner strong { color: var(--clr-text-primary); }

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast-notification { background: var(--clr-surface); border: 1px solid var(--clr-border); border-left: 4px solid var(--clr-primary); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); padding: 12px 16px; width: 320px; pointer-events: auto; transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s; opacity: 0; display: flex; align-items: flex-start; gap: 12px; }
.toast-notification.show { transform: translateX(0); opacity: 1; }
.toast-notification.hide { transform: translateX(120%); opacity: 0; }
.toast-icon { flex-shrink: 0; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.toast-icon svg { width: 100%; height: 100%; }
.toast-content { flex: 1; line-height: 1.4; }
.toast-title { font-weight: 700; font-size: 0.95rem; color: var(--clr-text-primary); margin-bottom: 2px; }
.toast-message { font-size: 0.85rem; color: var(--clr-text-secondary); }
.toast-notification.info { border-left-color: var(--clr-primary); } .toast-notification.info .toast-icon { color: var(--clr-primary); }
.toast-notification.success { border-left-color: var(--clr-success); } .toast-notification.success .toast-icon { color: var(--clr-success); }
.toast-notification.warning { border-left-color: var(--clr-warning); } .toast-notification.warning .toast-icon { color: var(--clr-warning); }
.toast-notification.error { border-left-color: var(--clr-danger); } .toast-notification.error .toast-icon { color: var(--clr-danger); }

/* ==========================================================================
   DARK MODE OVERRIDES
   ========================================================================== */
html.dark-mode {
  --clr-bg-app: #121212;
  --clr-surface: #1e1e1e;
  --clr-surface-elevated: #282828;

  --clr-text-primary: #e5e7eb;
  --clr-text-secondary: #9ca3af;
  --clr-text-muted: #6b7280;

  --clr-border: #333333;

  --clr-success-bg: rgba(16, 185, 129, 0.15);
  --clr-warning-bg: rgba(245, 158, 11, 0.15);
  --clr-danger-bg: rgba(239, 68, 68, 0.15);
  --clr-info-bg: rgba(59, 130, 246, 0.15);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  
  --osc-accent: var(--clr-border); 
}

/* Base surface elements */
html.dark-mode .card,
html.dark-mode .drawer-panel,
html.dark-mode .kitchen-modal-sheet,
html.dark-mode .adm-about-modal,
html.dark-mode .branch-switch-modal,
html.dark-mode .app-header,
html.dark-mode .app-sidebar,
html.dark-mode .toast,
html.dark-mode .toast-notification,
html.dark-mode .pos-img-wrap,
html.dark-mode .km-item-row,
html.dark-mode .order-stat-card,
html.dark-mode .dropdown-menu {
  background-color: var(--clr-surface);
  border-color: var(--clr-border);
}

/* Inputs and interactive elements */
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
  background-color: var(--clr-bg-app);
  color: var(--clr-text-primary);
  border-color: var(--clr-border);
}

html.dark-mode input:focus,
html.dark-mode select:focus,
html.dark-mode textarea:focus,
html.dark-mode .header-search input:focus,
html.dark-mode .content-form-group input:focus,
html.dark-mode .content-form-group textarea:focus,
html.dark-mode .content-form-group select:focus,
html.dark-mode .branch-selector:focus,
html.dark-mode .branch-selector:hover {
  background-color: var(--clr-surface-elevated) !important;
  border-color: var(--clr-primary);
}

html.dark-mode .header-search input {
  background-color: var(--clr-bg-app);
}
html.dark-mode .branch-selector {
  background-color: var(--clr-bg-app);
}
html.dark-mode .mobile-toggle {
  color: #ffffff;
}

/* Tables */
html.dark-mode .data-table th {
  background-color: var(--clr-bg-app);
  color: var(--clr-text-secondary);
  border-bottom: 1px solid var(--clr-border);
}
html.dark-mode .data-table td {
  border-bottom: 1px solid var(--clr-border);
}
html.dark-mode .data-table tr:hover td {
  background-color: var(--clr-surface-elevated);
}

/* Fix specific hover states with white backgrounds */
html.dark-mode .snapshot-item:hover,
html.dark-mode .order-stat-card:hover,
html.dark-mode .pos-product-card:hover,
html.dark-mode .dropdown-item:hover,
html.dark-mode .inventory-stat:hover {
  background-color: var(--clr-surface-elevated) !important;
}
html.dark-mode .nav-item:hover {
  background-color: rgba(255,255,255,0.05);
}

/* Modals & Popups */
html.dark-mode .modal-header,
html.dark-mode .drawer-header,
html.dark-mode .kitchen-modal-header {
  border-bottom-color: var(--clr-border);
}
html.dark-mode .modal-footer,
html.dark-mode .drawer-footer,
html.dark-mode .kitchen-modal-footer {
  border-top-color: var(--clr-border);
  background-color: var(--clr-surface);
}
html.dark-mode .modal-close svg,
html.dark-mode .drawer-close svg,
html.dark-mode .km-close svg {
  color: var(--clr-text-secondary);
}
html.dark-mode .modal-close:hover svg,
html.dark-mode .drawer-close:hover svg,
html.dark-mode .km-close:hover svg {
  color: var(--clr-text-primary);
}

/* AI Insight */
html.dark-mode .ai-insight {
  background: linear-gradient(145deg, #2a1a10 0%, #1e1e1e 100%);
  border-color: #4a2a18;
}

/* Buttons */
html.dark-mode .btn-outline {
  border-color: var(--clr-border);
  color: var(--clr-text-primary);
}
html.dark-mode .btn-outline:hover {
  background-color: var(--clr-surface-elevated);
}

/* Checkboxes and Radios */
html.dark-mode input[type="checkbox"],
html.dark-mode input[type="radio"] {
  accent-color: var(--clr-primary);
  background-color: var(--clr-bg-app);
}

/* Fix specific items with hardcoded #fff */
html.dark-mode .km-item-row {
  background-color: var(--clr-bg-app) !important;
}
html.dark-mode .pos-img-wrap {
  background-color: var(--clr-bg-app) !important;
}
html.dark-mode .snapshot-item {
  background-color: var(--clr-bg-app);
}
html.dark-mode .kpi-icon {
  background-color: var(--clr-bg-app);
}
html.dark-mode .order-progress-box {
  background-color: var(--clr-bg-app);
}
html.dark-mode .ct-branch-banner {
  background: rgba(251,104,21,0.15);
  border-color: rgba(251,104,21,0.3);
}

/* Charts: Optional invert for dark mode if they are hardcoded bright */
html.dark-mode canvas {
  opacity: 0.9;
}

/* Disabled States */
html.dark-mode input:disabled,
html.dark-mode select:disabled,
html.dark-mode textarea:disabled,
html.dark-mode button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: rgba(255, 255, 255, 0.05);
}

/* Ensure empty state messages are visible */
html.dark-mode .empty-state,
html.dark-mode .no-data {
  color: var(--clr-text-muted);
}

/* Toggle Switch Styles */
.dark-mode-toggle:checked + span {
    background-color: var(--clr-primary) !important;
}
.dark-mode-toggle:checked + span > span {
    transform: translateX(16px);
}

html.dark-mode .kds-column {
  background-color: var(--clr-bg-app);
}

html.dark-mode .pos-type-btn {
  color: #d1d5db; /* Lighter gray for inactive */
}
html.dark-mode .pos-type-btn:hover,
html.dark-mode .pos-type-btn.active {
  color: #ffffff !important;
}

html.dark-mode .pos-category-btn {
  color: #ffffff;
}
html.dark-mode .pos-category-btn.active {
  color: var(--clr-primary) !important;
}

/* KIOSK MODE */
body.kiosk-mode .app-sidebar { display: none !important; }
body.kiosk-mode .app-header { display: none !important; }
body.kiosk-mode .app-layout { grid-template-columns: 1fr !important; }
body.kiosk-mode .app-main { padding: 1rem !important; margin: 0 !important; max-width: 100vw !important; }


/* Dashboard modification pass: compact Advanced-only interface */
:root {
  --sidebar-width: 208px;
  --dashboard-scrollbar-size: 4px;
}

.advanced-only { display: initial; }
.nav-item.advanced-only { display: flex; }
.simple-only { display: none !important; }

.sidebar-header {
  padding-left: 1rem;
}
.sidebar-brand {
  flex: 1;
  justify-content: flex-start;
}
.sidebar-brand img {
  width: auto;
  height: 52px;
  max-width: 130px;
  object-fit: contain;
  border-radius: 0;
}

.sidebar-nav,
.pos-cart-items,
.drawer-body,
.kitchen-modal-body,
.table-wrapper,
.kds-column {
  scrollbar-width: thin;
  scrollbar-color: rgba(113, 147, 151, 0.75) transparent;
}
.sidebar-nav::-webkit-scrollbar,
.pos-cart-items::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar,
.kitchen-modal-body::-webkit-scrollbar,
.table-wrapper::-webkit-scrollbar,
.kds-column::-webkit-scrollbar {
  width: var(--dashboard-scrollbar-size) !important;
  height: var(--dashboard-scrollbar-size) !important;
}
.sidebar-nav::-webkit-scrollbar-thumb,
.pos-cart-items::-webkit-scrollbar-thumb,
.drawer-body::-webkit-scrollbar-thumb,
.kitchen-modal-body::-webkit-scrollbar-thumb,
.table-wrapper::-webkit-scrollbar-thumb,
.kds-column::-webkit-scrollbar-thumb {
  background: rgba(113, 147, 151, 0.72) !important;
  border-radius: 999px;
}
.sidebar-nav::-webkit-scrollbar-button,
.pos-cart-items::-webkit-scrollbar-button,
.drawer-body::-webkit-scrollbar-button,
.kitchen-modal-body::-webkit-scrollbar-button,
.table-wrapper::-webkit-scrollbar-button,
.kds-column::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.pos-categories {
  width: 112px;
  align-items: flex-start;
}
.pos-category-btn {
  width: auto;
  max-width: 100%;
  padding: 0.55rem 0.65rem;
}
.pos-category-btn span {
  display: block;
  max-width: 10ch;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.pos-product-card,
.pos-product-card.compact {
  height: auto;
  min-height: 218px;
}
.pos-product-card.compact {
  min-height: 202px;
}
.pos-content,
.pos-product-card.compact .pos-content {
  padding: 0.65rem 0.75rem 0.75rem;
}
.pos-content-top { gap: 0.2rem; }
.pos-footer { margin-top: 0.3rem; }
.pos-status {
  top: 0.45rem;
  left: 0.45rem;
  padding: 0.14rem 0.38rem;
  font-size: 0.58rem;
  letter-spacing: 0.025em;
  box-shadow: none;
}
.pos-add-btn { display: none !important; }
.pos-cart { overflow: hidden; }
.pos-cart-items {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#full-orders-body {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0.9rem !important;
}
.order-card {
  gap: 0.65rem !important;
  padding: 0.9rem !important;
  min-width: 0;
}
.orders-stats-grid { gap: 0.65rem; }
.order-stat-card { padding: 0.8rem; min-height: 0; }
.order-stat-value { font-size: 1.35rem; }

.card { padding: 1rem; }
.kpi-card { min-height: 0; }
.snapshot-item { padding: 0.75rem; }
.dashboard-grid { gap: 1rem; }

.header-search {
  width: 42px;
  transition: width 0.25s ease;
  flex-shrink: 0;
}
.header-search:focus-within,
.header-search.is-expanded {
  width: min(280px, 30vw);
}
.header-search input {
  width: 100%;
  padding-right: 0;
  color: transparent;
  cursor: pointer;
}
.header-search input::placeholder { opacity: 0; }
.header-search:focus-within input,
.header-search.is-expanded input {
  padding-right: 1rem;
  color: var(--clr-text-primary);
  cursor: text;
}
.header-search:focus-within input::placeholder,
.header-search.is-expanded input::placeholder { opacity: 1; }

html.dark-mode .badge,
html.dark-mode .nav-badge,
html.dark-mode .pos-status,
html.dark-mode .time-elapsed-badge {
  border-color: rgba(255, 255, 255, 0.1) !important;
}
html.dark-mode .modal-close,
html.dark-mode .drawer-close,
html.dark-mode .km-close,
html.dark-mode .adm-about-close,
html.dark-mode [class*="close"] {
  color: #f3f4f6 !important;
}
html.dark-mode .modal-close svg,
html.dark-mode .drawer-close svg,
html.dark-mode .km-close svg,
html.dark-mode .adm-about-close svg {
  color: #f3f4f6 !important;
  stroke: currentColor !important;
}

@media (max-width: 1100px) {
  #full-orders-body { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 768px) {
  #full-orders-body { grid-template-columns: 1fr !important; }
  .header-search { display: block; }
  .header-search:focus-within,
  .header-search.is-expanded {
    position: absolute;
    left: 52px;
    right: 0.75rem;
    width: auto;
    z-index: 20;
  }
  .pos-categories {
    width: 100%;
    align-items: stretch;
  }
  .pos-category-btn { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .header-search { transition: none; }
}

/* Targeted dashboard layout fixes */
.app-sidebar { position: relative; }
.app-sidebar.collapsed .sidebar-header {
  position: absolute;
  top: 50%;
  right: 0;
  width: 100%;
  height: auto;
  padding: 0 5px;
  border: 0;
  transform: translateY(-50%);
  justify-content: flex-end;
  overflow: visible;
  z-index: 5;
}
.app-sidebar.collapsed .sidebar-collapse-btn {
  width: 24px;
  height: 64px;
  border-radius: 8px 0 0 8px;
}

.header-search {
  width: 176px;
  transition: width 0.18s ease;
}
.header-search:focus-within,
.header-search.is-expanded { width: min(238px, 32vw); }
.header-search input,
.header-search:focus-within input,
.header-search.is-expanded input {
  width: 100%;
  padding-right: 1rem;
  color: var(--clr-text-primary);
  cursor: text;
}
.header-search input::placeholder,
.header-search:focus-within input::placeholder,
.header-search.is-expanded input::placeholder { opacity: 1; }

.orders-stats-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.5rem;
}
.order-stat-card {
  min-width: 0;
  min-height: 0;
  padding: 0.7rem 0.6rem;
}
.order-stat-value { font-size: 1.15rem; }
.order-stat-label,
.order-stat-sub { font-size: 0.62rem; }

.pos-product-card,
.pos-product-card.compact {
  height: auto;
  min-height: 0;
}
.pos-product-card--single { align-self: start; }
.pos-product-card--deal { align-self: stretch; }
.pos-product-card--deal .pos-img-wrap {
  width: min(132px, calc(100% - 2rem));
  height: 126px;
  margin-top: 1rem;
}
.pos-product-card--deal .pos-content {
  padding: 0.9rem 1rem 1rem;
}
.pos-product-card--deal .pos-content-top { gap: 0.45rem; }
.pos-product-card--deal .pos-desc {
  -webkit-line-clamp: 4;
  line-height: 1.5;
}
.pos-product-card--deal .pos-footer { margin-top: 0.75rem; }

.pos-cart {
  height: 100%;
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}
.pos-cart .drawer-header,
.pos-cart .drawer-footer { flex: 0 0 auto; }
.pos-cart-items {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}
.pos-cart::-webkit-scrollbar { width: 2px !important; }
.pos-cart::-webkit-scrollbar-track { background: transparent; }
.pos-cart::-webkit-scrollbar-thumb {
  background: rgba(113, 147, 151, 0.72);
  border-radius: 999px;
}
.pos-cart::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

@media (max-width: 1024px) {
  .pos-cart {
    height: min(720px, calc(100vh - 1.5rem));
    max-height: min(720px, calc(100vh - 1.5rem));
  }
}

@media (max-width: 768px) {
  .header-search { width: 128px; }
}

@media (max-width: 560px) {
  .orders-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.order-detail-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--clr-border);
}
.order-detail-item img {
  width: 44px;
  height: 44px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--clr-bg-app);
}
.order-detail-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.order-detail-item-main span {
  color: var(--clr-text-secondary);
  font-size: 0.75rem;
}

/* Collapsed control belongs in the center of the upper logo area. */
.app-sidebar.collapsed .sidebar-header {
  position: relative;
  top: auto;
  right: auto;
  width: 100%;
  height: var(--header-height);
  padding: 0;
  border-bottom: 1px solid var(--clr-border);
  transform: none;
  justify-content: center;
  overflow: hidden;
}
.app-sidebar.collapsed .sidebar-brand { display: none; }
.app-sidebar.collapsed .sidebar-collapse-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  flex: 0 0 30px;
}

#view-dashboard .card.advanced-only { display: block; }
.alerts-action-card .chart-title { font-size: 0; }
.alerts-action-card .chart-title::after {
  content: "\26A0\00A0 Alerts & Action Center";
  font-size: 0.95rem;
}
#alerts-action-center > div { min-width: 0; }
#alerts-action-center > div > svg { flex: 0 0 18px; }
#alerts-action-center > div > div { min-width: 0; }
#alerts-action-center > div > .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
@media (max-width: 560px) {
  #alerts-action-center > div { flex-wrap: wrap; }
  #alerts-action-center > div > div { flex: 1 1 calc(100% - 3rem) !important; }
  #alerts-action-center > div > .btn { margin-left: 30px; }
}

/* Mobile sidebar overlays the dashboard, matching the Crust dashboard shell. */
@media (max-width: 768px) {
  .app-sidebar,
  .app-sidebar.collapsed {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    transform: translateX(-100%);
    z-index: 9999;
  }

  .app-sidebar.open,
  .app-sidebar.collapsed.open {
    transform: translateX(0);
  }

  .app-main {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }
}

/* Consistent POS tabs and single-row order statistics */
.pos-categories { align-items: stretch; }
.pos-category-btn {
  width: 100%;
  min-height: 38px;
  height: 38px;
  padding: 0.45rem 0.55rem;
  display: flex;
  align-items: center;
}
.pos-category-btn span { width: 100%; }
.pos-type-btn {
  min-width: 0;
  min-height: 34px;
  padding-inline: 0.35rem;
}
.orders-stats-grid {
  display: grid !important;
  grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  overflow: visible;
}

/* Restore the original POS product-card presentation. */
.pos-product-card,
.pos-product-card.compact,
.pos-product-card--single,
.pos-product-card--deal {
  align-self: stretch;
  min-height: 0;
}
.pos-product-card,
.pos-product-card--deal {
  height: 280px;
}
.pos-product-card.compact,
.pos-product-card--single {
  height: 220px;
}
.pos-product-card--deal .pos-img-wrap {
  width: 120px;
  height: 120px;
  margin: 10px auto 0;
}
.pos-product-card--deal .pos-content {
  padding: 1rem;
}
.pos-product-card--deal .pos-content-top { gap: 0.35rem; }
.pos-product-card--deal .pos-desc {
  -webkit-line-clamp: 2;
  line-height: 1.4;
}
.pos-product-card--deal .pos-footer { margin-top: 0.5rem; }
.pos-product-card.compact .pos-img-wrap,
.pos-product-card--single .pos-img-wrap {
  width: 90px;
  height: 90px;
}
.pos-product-card.compact .pos-content,
.pos-product-card--single .pos-content {
  padding: 0.6rem 0.75rem 0.65rem;
}

@media (max-width: 768px) {
  .pos-categories { align-items: center; }
  .pos-category-btn {
    flex: 0 0 104px;
    width: 104px;
  }
  .orders-stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.4rem;
  }
  .order-stat-card { padding: 0.55rem 0.4rem; }
  .order-stat-label,
  .order-stat-sub { font-size: 0.56rem; letter-spacing: 0; }
  .order-stat-value { font-size: 1rem; }
}
