/* AKM POS - Modern UI Layout & Component Styles */

/* App Shell Desktop */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background-color: var(--bg);
}

.app aside {
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 50;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 24px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 14px;
}
.brand div b {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  display: block;
}
.brand div small {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Nav Menu */
nav#nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
nav#nav::-webkit-scrollbar { width: 4px; }
nav#nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  color: #475467;
  transition: all 0.15s ease;
  text-align: left;
  border: 1px solid transparent;
}
.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.nav-item:hover {
  background: #f1f5f9;
  color: var(--text);
}
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: rgba(15, 118, 110, 0.2);
}
.nav-item.active .nav-icon {
  color: var(--primary);
}

.aside-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #f8fafc;
  border: 1px solid var(--border);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-info b {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-info small {
  font-size: 11px;
  color: var(--text-muted);
}

/* Header */
header.top-header {
  height: 68px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-store-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px 10px 4px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}
.header-store-pill select {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.header-store-pill select:focus {
  box-shadow: none;
}
.header-spacer { flex: 1; }
.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}
.live-clock {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

/* Main Content Area */
main.main-viewport {
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}
#content {
  padding: 28px;
  max-width: 1600px;
  margin: 0 auto;
}

/* Page Headings */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head-title h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-head-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  margin-bottom: 18px;
}
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}
.search-box svg {
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-box input {
  flex: 1;
  border: 0;
  padding: 12px 0;
  font-size: 14px;
  background: transparent;
}
.search-box input:focus { box-shadow: none; border-color: transparent; }
.search-box kbd {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Category Pills Bar */
.category-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding-bottom: 12px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }
.category-pill {
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
}
.category-pill:hover {
  background: #f8fafc;
  color: var(--text);
}
.category-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

/* POS Layout */
.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.95fr);
  gap: 24px;
  align-items: start;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.product-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  position: relative;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  user-select: none;
  text-align: left;
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.product-card:active { transform: scale(0.98); }
.product-card.out-of-stock {
  opacity: 0.6;
  filter: grayscale(0.7);
  cursor: not-allowed;
}
.product-card-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: #f1f5f9;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-light);
}
.product-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.product-card-sku {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.product-card-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}
.product-card-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}
.product-stock-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.stock-in { background: var(--success-light); color: var(--success-text); }
.stock-low { background: var(--warning-light); color: var(--warning-text); }
.stock-out { background: var(--danger-light); color: var(--danger-text); }

/* Cart Desktop Panel */
.cart-panel {
  position: sticky;
  top: 88px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.cart-header h3 {
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count-badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}
.cart-list::-webkit-scrollbar { width: 4px; }
.cart-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.cart-item-info b {
  font-size: 13.5px;
  font-weight: 700;
  display: block;
  line-height: 1.3;
}
.cart-item-info small {
  font-size: 11px;
  color: var(--text-muted);
}
.cart-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  overflow: hidden;
}
.cart-stepper button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text);
  transition: background 0.1s;
}
.cart-stepper button:hover { background: #e2e8f0; }
.cart-stepper input {
  width: 42px;
  height: 28px;
  padding: 0;
  text-align: center;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 13px;
  box-shadow: none !important;
}
.cart-item-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  min-width: 80px;
  text-align: right;
}
.cart-item-rm {
  color: var(--text-light);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  transition: all 0.15s;
}
.cart-item-rm:hover { background: var(--danger-light); color: var(--danger-text); }

/* Cart Calculation Breakdown */
.cart-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}
.summary-row.total {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.summary-row.total span:last-child {
  color: var(--primary);
  font-size: 22px;
}

/* Payment Selector Tabs */
.payment-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.payment-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  background: #ffffff;
  transition: all 0.15s ease;
}
.payment-tab:hover { background: #f8fafc; color: var(--text); }
.payment-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Cash Shortcuts */
.cash-shortcuts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.cash-chip {
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  color: #475467;
  cursor: pointer;
  border: 1px solid var(--border);
}
.cash-chip:hover { background: #e2e8f0; color: var(--text); }

.change-due-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 10px 14px;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #065f46;
  font-weight: 700;
  margin-top: 8px;
}

/* Modern Dashboard Grid */
.grid-kpi.modern {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent, var(--primary));
}
.kpi-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--accent-light, #ecfdf5);
  color: var(--accent, var(--primary));
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.kpi-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.kpi-data small {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.kpi-data strong {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-top: 2px;
}
.kpi-data em {
  font-size: 11px;
  font-style: normal;
  color: var(--text-muted);
  margin-top: 4px;
}
.accent-teal { --accent: #0f766e; --accent-light: #ccfbf1; }
.accent-blue { --accent: #2563eb; --accent-light: #dbeafe; }
.accent-violet { --accent: #7c3aed; --accent-light: #ede9fe; }
.accent-orange { --accent: #ea580c; --accent-light: #ffedd5; }

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

/* Charts */
.chart-container {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.line-chart-svg {
  width: 100%;
  min-width: 580px;
  height: auto;
  display: block;
}
.chart-dates {
  min-width: 580px;
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

/* Donut & Legends */
.donut-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  min-height: 200px;
}
.donut-pie {
  width: 140px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.donut-pie::after {
  content: "";
  width: 86px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffffff;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475467;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Ranked Bars */
.rank-bars-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rank-bar-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.rank-num {
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
}
.rank-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.rank-track {
  height: 7px;
  background: #f1f5f9;
  border-radius: 99px;
  overflow: hidden;
}
.rank-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), #3b82f6);
}

/* Thermal Receipt Preview */
.receipt-paper {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  background: #ffffff;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  font-family: 'Courier New', Courier, monospace;
  font-size: 12.5px;
  color: #1e293b;
}
.receipt-header {
  text-align: center;
  border-bottom: 1px dashed #cbd5e1;
  padding-bottom: 14px;
  margin-bottom: 14px;
}
.receipt-header h2 {
  font-size: 18px;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
}
.receipt-meta {
  margin-bottom: 12px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.receipt-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.receipt-table th {
  background: transparent;
  border-bottom: 1px solid #cbd5e1;
  font-size: 11px;
  padding: 4px 2px;
}
.receipt-table td {
  padding: 6px 2px;
  border-bottom: 1px dashed #f1f5f9;
  font-size: 12px;
}
.receipt-totals {
  border-top: 1px dashed #cbd5e1;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.receipt-totals .row {
  display: flex;
  justify-content: space-between;
}
.receipt-totals .grand-total {
  font-size: 16px;
  font-weight: 800;
  font-family: 'Inter', sans-serif;
  border-top: 1px solid #94a3b8;
  padding-top: 6px;
  margin-top: 4px;
}
.receipt-footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
}

/* Repair Detail & Gallery */
.repair-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.repair-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: #f8fafc;
}
.repair-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.repair-thumb:hover img { transform: scale(1.06); }

.upload-box-tile {
  width: 100%;
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}
.upload-box-tile:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.status-timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  margin-bottom: 16px;
}
.timeline-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-muted);
  white-space: nowrap;
}
.timeline-step.active {
  background: var(--primary);
  color: #ffffff;
}
