:root{
  /* New brand palette based on primary: #71C7EB */
  --primary: #71C7EB;
  --primary-dark: #4FAFD4;
  --primary-deep: #2C7DA0;
  --primary-light: #A9DFF5;
  --primary-soft: #E6F6FD;

  --accent: #2C7DA0;
  --teal: #5FC4D8;
  --green: #2DBE7F;
  --yellow: #F2B84B;
  --danger: #E56B6F;

  --surface: #F7FBFD;
  --surface-2: #EEF7FB;
  --card: #FFFFFF;

  --text: #1F2D3A;
  --muted: #6B7F8B;

  --radius: 16px;
  --shadow: 0 12px 34px rgba(44, 125, 160, .12);
  --shadow-sm: 0 8px 22px rgba(44, 125, 160, .08);
  --ring: 0 0 0 .22rem rgba(113, 199, 235, .24);

  --border: rgba(44, 125, 160, .12);
  --border-strong: rgba(44, 125, 160, .18);
}

html, body { background: var(--surface); color: var(--text); }
body {
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Safer default typography that feels app-like */
h1,h2,h3,h4,h5{ letter-spacing: -.02em; }

a { color: var(--primary-deep); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

.bg-surface{ background: var(--surface) !important; }

.container, .container-fluid { padding-left: 14px; padding-right: 14px; }
@media (min-width: 992px) { .container { max-width: 1024px; } }

.skip-link{
  position:absolute; left:-999px; top:10px;
  background: #fff; color: var(--primary-deep);
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 9999;
}
.skip-link:focus{ left: 14px; outline: none; box-shadow: var(--ring); }

.app-navbar{
  background: linear-gradient(135deg, var(--primary-deep), var(--primary-dark)) !important;
  box-shadow: 0 12px 30px rgba(44, 125, 160, .22);
}
.app-navbar .navbar-brand{ font-weight: 950; }

/* Icon button: premium, compact header actions */
.icon-btn{
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(255,255,255,.10);
  color: #fff;
}
.icon-btn:hover{
  background: rgba(255,255,255,.16);
  color: #fff;
}
.icon-btn:focus-visible{ outline: none; box-shadow: 0 0 0 .22rem rgba(255,255,255,.22); }
.icon-btn i{ font-size: 20px; line-height: 1; }
.icon-btn.dropdown-toggle::after{ display:none; }

.avatar{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.24);
  color: #fff;
  font-weight: 950;
  font-size: 13px;
}
.navbar .navbar-brand{
  font-weight: 900;
  letter-spacing: -.01em;
}
.brand-dot{
  width: 10px; height: 10px; border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.24);
}

.app-main{ padding-top: 16px !important; padding-bottom: 18px !important; }

/* Give mobile room for the bottom nav */
@media (max-width: 991.98px){
  .app-main{ padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important; }
}

.page-title{ font-weight: 900; letter-spacing: -.02em; margin: 0; color: var(--text); }
.page-subtitle{ color: var(--muted); margin-top: 2px; }

.card, .app-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header{
  background: transparent;
  border-bottom: 0;
  padding: 14px 14px 0 14px;
}
.card-body{ padding: 14px; }

.kpi{
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

/* KPI tiles inspired by mobile dashboards */
.kpi-tile{
  border-radius: 18px;
  padding: 14px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi-tile::after{
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(600px 220px at 0% 0%, rgba(255,255,255,.16), transparent 55%);
  pointer-events: none;
}
.kpi-tile .kpi-icon{
  width: 38px; height: 38px; border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.22);
}
.kpi-tile .kpi-label{
  color: rgba(255,255,255,.82);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 10px;
}
.kpi-tile .kpi-value{
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -.02em;
  line-height: 1.0;
  margin-top: 2px;
}

.kpi-tile--blue{ background: linear-gradient(135deg, var(--primary-dark), var(--primary)); }
.kpi-tile--purple{ background: linear-gradient(135deg, #5E81AC, #81C8E8); }
.kpi-tile--teal{ background: linear-gradient(135deg, var(--accent), var(--teal)); }
.kpi-tile--orange{ background: linear-gradient(135deg, #E8A63A, #F2C15E); }

.kpi .kpi-label{
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.kpi .kpi-value{
  font-size: 28px;
  font-weight: 950;
  letter-spacing: -.02em;
  line-height: 1.0;
  margin-top: 4px;
  color: var(--text);
}
.kpi .kpi-help{ color: var(--muted); font-size: 12px; margin-top: 6px; }

.btn{
  border-radius: 12px;
  font-weight: 800;
  padding: .58rem .9rem;
}
.btn-sm{
  padding: .42rem .7rem;
  border-radius: 12px;
  font-weight: 800;
}

.btn-primary{
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-color: var(--primary-dark);
  color: #fff;
}
.btn-primary:hover{
  background: linear-gradient(135deg, var(--primary-deep), var(--primary-dark));
  border-color: var(--primary-deep);
  color: #fff;
}

.btn-outline-primary{
  border-color: rgba(113, 199, 235, .48);
  color: var(--primary-deep);
  background: rgba(230, 246, 253, .55);
}
.btn-outline-primary:hover{
  background: var(--primary-soft);
  border-color: rgba(79, 175, 212, .55);
  color: var(--primary-deep);
}

.btn-outline-light{ border-color: rgba(255,255,255,.38) !important; }
.btn:focus-visible{ box-shadow: var(--ring); outline: none; }

.form-control, .form-select{
  border-radius: 12px;
  border-color: var(--border);
  padding: .62rem .78rem;
  background: #fff;
  color: var(--text);
}
.form-control:focus, .form-select:focus{
  border-color: rgba(113, 199, 235, .58);
  box-shadow: var(--ring);
}
label.form-label{
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.table-wrap{ overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table{ min-width: 560px; }
.table{ margin-bottom: 0; }
.table thead th{
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-top: 0;
}
.table td, .table th{ padding: .75rem .6rem; vertical-align: middle; }

.chip{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 6px 10px; border-radius: 999px;
  font-weight: 900; font-size: 12px;
  border: 1px solid var(--border);
}
.chip .dot{ width: 8px; height: 8px; border-radius: 50%; }

.chip-assigned{ background: rgba(113, 199, 235, .14); color: var(--primary-deep); }
.chip-assigned .dot{ background: var(--primary); }

.chip-sold{ background: rgba(242, 184, 75, .16); color: #9A6A12; }
.chip-sold .dot{ background: var(--yellow); }

.chip-lost{ background: rgba(229, 107, 111, .12); color: #B54B50; }
.chip-lost .dot{ background: var(--danger); }

.chip-planned{ background: rgba(95, 196, 216, .12); color: var(--accent); }
.chip-planned .dot{ background: var(--teal); }

/* Status pill (scan/search results) */
.status-pill{
  display:inline-flex; align-items:center; gap:8px;
  padding: 6px 10px; border-radius: 999px;
  font-weight: 900; font-size: 12px;
  border: 1px solid var(--border);
}
.status-pill::before{
  content:'';
  width:8px; height:8px; border-radius:50%;
  background: rgba(44, 125, 160, .35);
}

.status-in-stock{ background: rgba(45, 190, 127, .12); color: #217A56; }
.status-in-stock::before{ background: var(--green); }

.status-assigned{ background: rgba(113, 199, 235, .14); color: var(--primary-deep); }
.status-assigned::before{ background: var(--primary); }

.status-sold{ background: rgba(242, 184, 75, .16); color: #9A6A12; }
.status-sold::before{ background: var(--yellow); }

.status-lost{ background: rgba(229, 107, 111, .12); color: #B54B50; }
.status-lost::before{ background: var(--danger); }

.overdue-badge{
  display:inline-flex; align-items:center;
  padding: 4px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 900;
  background: rgba(242, 184, 75, .20);
  color: #8A6114;
}

/* Insight card inspired by the warehouse analytics screens */
.insight-card{
  border-radius: 22px;
  padding: 18px;
  color: #fff;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.18);
  background:
    radial-gradient(1200px 480px at 10% 10%, rgba(255,255,255,.24), transparent 60%),
    linear-gradient(135deg, var(--primary-deep), var(--primary-dark), var(--primary), #9EDCF4);
}
.insight-card .tag{
  display:inline-flex; gap:8px; align-items:center;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(0,0,0,.16);
  border: 1px solid rgba(255,255,255,.18);
  font-weight: 900; font-size: 12px;
}
.insight-card .title{
  font-weight: 950;
  font-size: 22px;
  line-height: 1.15;
  margin-top: 12px;
}
.insight-card .subtitle{ color: rgba(255,255,255,.84); margin-top: 8px; }

/* Bottom navigation */
.bottom-nav{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  height: 66px;
  padding: 10px 12px;
  display:flex;
  justify-content: space-between;
  gap: 8px;
  border-radius: 22px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: 0 14px 40px rgba(44, 125, 160, .14);
  z-index: 10000;
}
.bottom-nav__item{
  flex:1;
  min-width: 0;
  display:flex;
  flex-direction: column;
  align-items:center;
  justify-content:center;
  gap: 4px;
  color: var(--muted);
  font-weight: 900;
  font-size: 11px;
  border-radius: 16px;
}
.bottom-nav__item i{ font-size: 18px; line-height: 1; }
.bottom-nav__item.is-active{
  color: var(--primary-deep);
  background: rgba(113, 199, 235, .16);
  border: 1px solid rgba(113, 199, 235, .24);
}
.bottom-nav__item:focus-visible{ outline:none; box-shadow: var(--ring); }

/* Scan screen frame */
.scan-frame{
  position: relative;
  height: 220px;
  border-radius: 22px;
  background:
    radial-gradient(900px 260px at 20% 0%, rgba(113, 199, 235, .22), transparent 55%),
    radial-gradient(900px 260px at 80% 100%, rgba(44, 125, 160, .12), transparent 55%),
    rgba(44, 125, 160, .03);
  border: 1px dashed rgba(44, 125, 160, .24);
  overflow: hidden;
}

.scan-video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.06) saturate(1.02);
}
.scan-frame__target{
  position:absolute;
  left: 16px; right: 16px; top: 34px; bottom: 46px;
  border-radius: 22px;
  border: 2px solid rgba(44, 125, 160, .22);
}
.scan-frame__target:before{
  content:'';
  position:absolute;
  left: 12%; right: 12%; top: 50%;
  height: 2px;
  background: rgba(113, 199, 235, .72);
  box-shadow: 0 0 0 6px rgba(113, 199, 235, .12);
}
.scan-frame__hint{
  position:absolute;
  left: 0; right: 0; bottom: 14px;
  text-align:center;
  font-weight: 900;
  color: var(--muted);
  font-size: 12px;
}

.row-overdue{
  background: rgba(242, 184, 75, .18) !important;
  border-left: 4px solid var(--yellow);
}

.sale-details summary{ list-style:none; cursor:pointer; }
.sale-details summary::-webkit-details-marker{ display:none; }
.sale-details[open] summary{ background: rgba(113, 199, 235, .10); }

.mini-meta{ color: var(--muted); font-size: 12px; }
.section-title{ font-weight: 900; letter-spacing: -.01em; margin-bottom: 8px; }

@media (max-width: 576px){
  .table-wrap table{ min-width: 520px; }
}

/* Header action buttons (nice on mobile): keep a single row, allow horizontal scroll */
.action-grid{ display:flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 575.98px){
  .action-grid{
    flex-wrap: nowrap;
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .action-grid .btn{ white-space: nowrap; }
}

/* Recent sales mobile cards */
.sale-card{
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  background: #fff;
}
.sale-card__top{ display:flex; align-items:flex-start; justify-content:space-between; gap: 10px; }
.sale-card__device{ font-weight: 950; letter-spacing: -.01em; color: var(--text); }
.sale-card__meta{ color: var(--muted); font-size: 12px; }
.sale-card__amount{ font-weight: 950; color: var(--primary-deep); }
.sale-card__actions{ display:flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* Leaderboard list */
.leaderboard{
  list-style: none;
  padding-left: 0;
  margin: 0;
  display:flex;
  flex-direction: column;
  gap: 8px;
}
.leaderboard__item{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.72);
}
.leaderboard__rank{
  width: 28px; height: 28px;
  border-radius: 12px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(113, 199, 235, .16);
  border: 1px solid rgba(113, 199, 235, .24);
  color: var(--primary-deep);
  font-weight: 950;
}

/* Offcanvas + modal refinements */
.offcanvas{
  border-top-right-radius: 22px;
  border-bottom-right-radius: 22px;
  border-right: 1px solid var(--border);
}
.offcanvas-header{
  border-bottom: 1px solid rgba(44, 125, 160, .08);
}
.app-navlink{
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 900;
  color: var(--text);
}
.app-navlink:hover{
  background: rgba(113, 199, 235, .12);
  text-decoration:none;
}
.app-modal{
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Backwards compatibility */
.overdue{
  background: rgba(242, 184, 75, .18) !important;
  border-left: 4px solid var(--yellow);
}

/* ===== Premium horizontal pill strip (no wrap + scroll) ===== */
.pill-strip-container {
  position: relative;
}

.pill-strip {
  display: flex;
  flex-wrap: nowrap !important;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.25rem 0.25rem 0.35rem;
  scrollbar-width: none;
  white-space: nowrap;
}

.pill-strip::-webkit-scrollbar {
  display: none;
}

/* each pill should never shrink or wrap */
.pill-strip .pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  background: transparent;
  color: var(--primary-deep);
  border: 1px solid rgba(113, 199, 235, .38);
}

/* active state */
.pill-strip .pill--active {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-color: var(--primary-dark);
  color: #fff;
}

/* danger (Lost) */
.pill-strip .pill--danger {
  color: #B54B50;
  border-color: rgba(229, 107, 111, .35);
}
.pill-strip .pill--danger.pill--active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* subtle fades to hint scroll */
.pill-strip-container::after,
.pill-strip-container::before {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.pill-strip-container::after {
  right: 0;
  background: linear-gradient(to right, rgba(255,255,255,0), var(--surface));
}

.pill-strip-container::before {
  left: 0;
  background: linear-gradient(to left, rgba(255,255,255,0), var(--surface));
}

/* Overdue pill — matches row highlight color */
.pill--overdue {
  border-color: var(--yellow);
  color: #9A6A12;
}

.pill--overdue.pill--active {
  background-color: var(--yellow);
  border-color: var(--yellow);
  color: #fff;
}

/* Top navbar should always be above sticky table headers */
.navbar,
.top-nav,
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1050;
}

/* Bottom nav (if you have one) */
.bottom-nav,
.app-bottom-nav,
.mobile-nav {
  position: fixed;
  bottom: 0;
  z-index: 1050;
}

.navbar.fixed-top,
.navbar.fixed-bottom { z-index: 1050; }