/* ==========================================================================
   QURESHI MOBILES - APPLE-INSPIRED DESIGN SYSTEM & STYLESHEET
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-page: #f2f2f7;
  --bg-card-w: #ffffff;
  --bg-card-b: #1c1c1e;
  --text-main: #1c1c1e;
  --text-sub: #8e8e93;
  --text-accent: #007aff;
  --header-bg: rgba(255, 255, 255, 0.78);
  --header-bg-scrolled: rgba(255, 255, 255, 0.94);
  --header-border: rgba(255, 255, 255, 0.7);
  --header-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --header-shadow-scrolled: 0 12px 40px rgba(0, 0, 0, 0.15);
  --card-radius: 26px;
  --nav-bg: rgba(255, 255, 255, 0.88);
  --nav-border: rgba(0, 0, 0, 0.08);
  --modal-bg: #ffffff;
}

[data-theme='dark'] {
  --bg-page: #000000;
  --bg-card-w: #242426;
  --bg-card-b: #161618;
  --text-main: #f5f5f7;
  --text-sub: #98989d;
  --text-accent: #0a84ff;
  --header-bg: rgba(28, 28, 30, 0.85);
  --header-bg-scrolled: rgba(28, 28, 30, 0.94);
  --header-border: rgba(255, 255, 255, 0.12);
  --header-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --header-shadow-scrolled: 0 12px 40px rgba(0, 0, 0, 0.6);
  --nav-bg: rgba(28, 28, 30, 0.88);
  --nav-border: rgba(255, 255, 255, 0.08);
  --modal-bg: #1c1c1e;
}

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  transition: background-color 0.25s ease, color 0.25s ease;
}

#app-root {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--bg-page);
  padding-bottom: 90px;
}

/* ==================== 1. FLOATING PILL HEADER ==================== */
.header {
  padding: max(12px, env(safe-area-inset-top, 12px)) 16px 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: transparent;
  pointer-events: none;
  max-width: 600px;
  margin: 0 auto;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.header-pill {
  pointer-events: all;
  background: var(--header-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--header-border);
  border-radius: 999px;
  padding: 10px 14px 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--header-shadow);
  transition: background 0.2s ease, border-color 0.2s ease;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.header-pill.scrolled {
  background: var(--header-bg-scrolled);
  box-shadow: var(--header-shadow-scrolled);
}

/* ==================== APPLE DYNAMIC ISLAND NETWORK STATUS (In Flow) ==================== */
.network-status-wrap {
  padding: calc(max(14px, env(safe-area-inset-top, 14px)) + 92px) 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  transition: padding 0.3s ease;
}

.network-status-pill {
  pointer-events: all;
  margin: 0 auto 10px;
  width: fit-content;
  max-width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--header-border);
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 12px 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.2px;
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              margin-bottom 0.3s ease,
              max-height 0.35s ease,
              padding 0.3s ease,
              background 0.2s ease,
              border-color 0.2s ease;
  max-height: 48px;
}

[data-theme='dark'] .network-status-pill {
  background: rgba(28, 28, 30, 0.90);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.65);
}

.network-status-pill.hidden {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  transform: translateY(-8px) scale(0.95);
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}

.net-status-dot {
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Offline: Apple Amber / Orange Pulsing Dot */
.net-status-dot.is-offline {
  background-color: #ff9f0a;
  box-shadow: 0 0 0 0 rgba(255, 159, 10, 0.7);
  animation: applePulseAmber 2s infinite ease-out;
}

/* Online / Connected: Apple Green Crisp Glow */
.net-status-dot.is-online {
  background-color: #30d158;
  box-shadow: 0 0 8px rgba(48, 209, 88, 0.6);
  animation: none;
}

/* Syncing / Reconnecting: Apple Blue Pulse */
.net-status-dot.is-syncing {
  background-color: #0a84ff;
  box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.7);
  animation: applePulseBlue 1.2s infinite ease-out;
}

@keyframes applePulseAmber {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 159, 10, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(255, 159, 10, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 159, 10, 0);
  }
}

@keyframes applePulseBlue {
  0% {
    box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(10, 132, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(10, 132, 255, 0);
  }
}

.net-status-text {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.net-retry-btn {
  background: rgba(0, 122, 255, 0.12);
  color: var(--text-accent);
  border: none;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.net-retry-btn:hover {
  background: rgba(0, 122, 255, 0.22);
}

.net-retry-btn:active {
  transform: scale(0.92);
}

.net-retry-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.net-retry-btn .icon-retry {
  transition: transform 0.4s ease;
}

.net-retry-btn.loading .icon-retry {
  animation: appleSpin 0.9s linear infinite;
}

@keyframes appleSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

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

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.brand-img-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.lock-brand-logo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.28);
  display: block;
  margin: 0 auto;
}

.eye-icon-span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

.brand-svg-grid {
  display: block;
}

.brand-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--text-sub);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-fab {
  width: 36px;
  height: 36px;
  background: rgba(142, 142, 147, 0.15);
  border: none;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-main);
  transition: transform 0.15s ease, background 0.15s ease;
}

.filter-fab:active {
  transform: scale(0.92);
}

.add-btn {
  background: #1c1c1e;
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

[data-theme='dark'] .add-btn {
  background: #f5f5f7;
  color: #1c1c1e;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15);
}

.add-btn:active {
  transform: scale(0.96);
}

/* ==================== 2. STATS ROW (5 Cards) ==================== */
.stats-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 16px 0;
  margin-top: 0;
}

.stats-row.hidden + .search-wrap,
#statsRow.hidden ~ .search-wrap {
  margin-top: 0;
}

.stats-row::-webkit-scrollbar {
  display: none;
}

.stat-card {
  flex-shrink: 0;
  background: var(--bg-card-w);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-width: 68px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme='dark'] .stat-card {
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stat-card:active {
  transform: scale(0.96);
}

.stat-lbl {
  font-size: 10px;
  color: var(--text-sub);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-top: 2px;
}

.stat-val.blue {
  color: #007aff;
}

[data-theme='dark'] .stat-val.blue {
  color: #0a84ff;
}

/* ==================== 3. SEARCH BAR ==================== */
.search-wrap {
  padding: 12px 16px 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card-w);
  border-radius: 14px;
  padding: 11px 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

[data-theme='dark'] .search-box {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.search-input {
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text-main);
  font-family: inherit;
  width: 100%;
  background: transparent;
}

.search-input::placeholder {
  color: var(--text-sub);
}

/* ==================== 4. CONTENT & GRID ==================== */
.content {
  padding: 14px 16px 20px;
}

.list-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.list-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.stock-toggle-group {
  display: inline-flex;
  background: rgba(142, 142, 147, 0.12);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.stock-toggle-btn {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stock-toggle-btn.active {
  background: var(--bg-card-w);
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

[data-theme='dark'] .stock-toggle-btn.active {
  background: var(--bg-card-b);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.list-count {
  font-size: 13px;
  color: var(--text-sub);
  font-weight: 500;
}

/* Sold Out Date Filters Bar (Sold Section Only) */
.sold-date-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: rgba(142, 142, 147, 0.08);
  border-radius: 14px;
  border: 1px solid rgba(142, 142, 147, 0.15);
}

.sold-date-chips-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}

.sold-date-chips-wrap::-webkit-scrollbar {
  display: none;
}

.sold-date-chip {
  background: transparent;
  border: 1px solid rgba(142, 142, 147, 0.25);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sold-date-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.sold-date-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(9, 105, 218, 0.3);
}

.sold-custom-date-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card-w);
  border: 1px solid rgba(142, 142, 147, 0.25);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-main);
}

[data-theme='dark'] .sold-custom-date-box {
  background: var(--bg-card-b);
  border-color: rgba(255, 255, 255, 0.15);
}

.sold-custom-date-box svg {
  color: var(--text-sub);
  flex-shrink: 0;
}

.sold-custom-date-picker {
  background: transparent;
  border: none;
  outline: none;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-main);
  font-family: inherit;
  cursor: pointer;
  padding: 1px 0;
}

[data-theme='dark'] .sold-custom-date-picker {
  color: #fff;
  color-scheme: dark;
}

.sold-date-clear-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 12px;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
}

.sold-date-clear-btn:hover {
  color: #ff3b30;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ==================== 5. PHONE CARDS (Checkerboard) ==================== */
.phone-card {
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.phone-card:active {
  transform: scale(0.97);
}

.card-white {
  background: var(--bg-card-w);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.card-black {
  background: var(--bg-card-b);
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme='dark'] .card-white {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme='dark'] .card-black {
  background: #121214;
  border-color: rgba(255, 255, 255, 0.04);
}

.card-img {
  width: 100%;
  aspect-ratio: 4/5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.phone-card:hover .card-img img {
  transform: scale(1.03);
}

.img-light {
  background: #f5f5f7;
}

.img-dark {
  background: #1c1c1e;
}

.card-img-placeholder {
  font-size: 44px;
  opacity: 0.15;
}

.card-body {
  padding: 12px 12px 6px;
  flex: 1;
}

.card-name-w {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}

.card-name-b {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
  line-height: 1.3;
  margin-bottom: 4px;
  word-break: break-word;
}

.card-price-w {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.card-price-b {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.card-spec-w {
  font-size: 12px;
  color: #6e6e73;
  margin-top: 3px;
  font-weight: 500;
}

.card-spec-b {
  font-size: 12px;
  color: #98989d;
  margin-top: 3px;
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

/* White Card Tags */
.tw-pta { background: #d1fae5; color: #065f46; }
.tw-jv { background: #dbeafe; color: #1e40af; }
.tw-nonpta { background: #fce7f3; color: #9d174d; }
.tw-full { background: #f3f4f6; color: #374151; }
.tw-charger { background: #dcfce7; color: #15803d; }
.tw-nothing { background: #ffedd5; color: #c2410c; }
.tw-onlybox { background: #ede9fe; color: #6d28d9; }

/* Black Card Tags */
.tb-pta { background: rgba(52, 199, 89, 0.18); color: #34c759; }
.tb-jv { background: rgba(0, 122, 255, 0.18); color: #0a84ff; }
.tb-nonpta { background: rgba(255, 45, 85, 0.18); color: #ff2d55; }
.tb-full { background: rgba(255, 255, 255, 0.12); color: #d1d1d6; }
.tb-charger { background: rgba(52, 199, 89, 0.14); color: #30d158; }
.tb-nothing { background: rgba(255, 149, 0, 0.18); color: #ff9500; }
.tb-onlybox { background: rgba(191, 90, 242, 0.18); color: #bf5af2; }

.divider-w {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 8px 11px 0;
}

.divider-b {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 8px 11px 0;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px 11px;
}

.days-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}

.days-fresh { background: #d1fae5; color: #065f46; }
.days-mid { background: #fef9c3; color: #854d0e; }
.days-old { background: #fee2e2; color: #991b1b; }
.days-sold { background: rgba(255, 59, 48, 0.14); color: #ff3b30; font-size: 8px; }

.dots-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  flex-shrink: 0;
  transition: transform 0.12s ease;
}

.dots-btn:active {
  transform: scale(0.92);
}

.dots-w { background: #f2f2f7; color: #8e8e93; }
.dots-b { background: #2c2c2e; color: #8e8e93; }

[data-theme='dark'] .dots-w { background: #2f2f32; color: #a1a1a6; }
[data-theme='dark'] .dots-b { background: #222225; color: #a1a1a6; }

/* ==================== SOLD PHONE CARDS & STAMP ==================== */
.phone-card.is-sold {
  opacity: 0.88;
  border-color: rgba(255, 59, 48, 0.25) !important;
}

.phone-card.is-sold .card-img img {
  filter: grayscale(85%) brightness(0.88);
  transition: filter 0.2s ease, transform 0.3s ease;
}

.phone-card.is-sold:hover {
  opacity: 1;
}

.phone-card.is-sold:hover .card-img img {
  filter: grayscale(30%) brightness(0.96);
}

/* Sold Stamp Overlay - Centered over Phone Photo only */
.card-sold-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
  background: rgba(0, 0, 0, 0.22);
}

.sold-stamp {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.16em;
  color: #ff3b30;
  border: 2.5px solid #ff3b30;
  padding: 4px 15px;
  border-radius: 8px;
  transform: rotate(-12deg);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
  pointer-events: none;
}

[data-theme='dark'] .sold-stamp {
  background: rgba(26, 26, 30, 0.94);
  color: #ff453a;
  border-color: #ff453a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.sold-card-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.sold-card-price .orig-price-strike {
  font-size: 11px;
  color: var(--text-sub);
  text-decoration: line-through;
  font-weight: 500;
}

.sold-card-price .sold-price-val {
  color: #ff3b30;
  font-weight: 800;
}

[data-theme='dark'] .sold-card-price .sold-price-val {
  color: #ff453a;
}

/* Sold Details Box - Multi-row, never truncates */
.sold-details-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 59, 48, 0.08);
  border: 1px solid rgba(255, 59, 48, 0.22);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

[data-theme='dark'] .sold-details-box {
  background: rgba(255, 69, 58, 0.12);
  border-color: rgba(255, 69, 58, 0.3);
}

.sold-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(255, 59, 48, 0.25);
}

.sold-val-badge {
  font-weight: 800;
  color: #ff3b30;
  font-size: 12px;
  letter-spacing: -0.2px;
}

[data-theme='dark'] .sold-val-badge {
  color: #ff453a;
}

.sold-detail-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}

.sold-label {
  color: var(--text-sub);
  font-weight: 700;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sold-val-text {
  font-weight: 600;
  color: var(--text-main);
  font-size: 11px;
  word-break: break-word;
  white-space: normal;
}

.sold-val-link {
  color: #007aff !important;
  text-decoration: underline;
}

.sold-edit-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 59, 48, 0.2);
}

.sold-edit-pill {
  font-size: 10px;
  font-weight: 700;
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.12);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 59, 48, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sold-details-box:hover .sold-edit-pill {
  background: #ff3b30;
  color: #ffffff;
}

[data-theme='dark'] .sold-edit-pill {
  color: #ff453a;
  background: rgba(255, 69, 58, 0.18);
  border-color: rgba(255, 69, 58, 0.35);
}

[data-theme='dark'] .sold-details-box:hover .sold-edit-pill {
  background: #ff453a;
  color: #ffffff;
}

/* ==================== 6. 3-DOT POPUP MENU ==================== */
.popup-menu {
  position: fixed;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 38px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  min-width: 185px;
  z-index: 500;
  display: none;
  animation: popIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.popup-menu.dark-menu {
  background: #2c2c2e;
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.popup-menu.show {
  display: block;
}

.popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  background: transparent;
  font-family: inherit;
  color: #1c1c1e;
  transition: background 0.1s ease;
}

.popup-item:not(:last-child) {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.popup-item.dark-item {
  color: #ffffff;
}

.popup-item.dark-item:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.popup-item:active {
  background: rgba(0, 0, 0, 0.05);
}

.popup-item.dark-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.popup-item.red {
  color: #ff3b30;
}

.popup-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

/* ==================== 7. FROSTED BOTTOM DOCK BAR ==================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  z-index: 150;
  background: var(--nav-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-top: 1px solid var(--nav-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 4px 10px calc(env(safe-area-inset-bottom, 0px) + 4px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

.bottom-nav-item {
  flex: 1 1 0;
  min-width: 0;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-sub);
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 12px;
  transition: all 0.15s ease;
  font-family: inherit;
}

.bottom-nav-item svg {
  width: 19px;
  height: 19px;
  display: block;
}

.bottom-nav-item.active {
  color: var(--text-accent);
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== 8. ACCESSORIES VIEW (3-Column Grid) ==================== */
.accessories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 380px) {
  .accessories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

.accessory-card {
  background: var(--bg-card-w);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

[data-theme='dark'] .accessory-card {
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.accessory-card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(142, 142, 147, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.accessory-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.accessory-icon-box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.accessory-icon-box svg {
  width: 30px;
  height: 30px;
}

.accessory-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.accessory-brand-tag {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accessory-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.accessory-price-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
}

.accessory-price {
  font-size: 12px;
  font-weight: 800;
  color: #007aff;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

[data-theme='dark'] .accessory-price {
  color: #0a84ff;
}

.accessory-qty-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  display: inline-block;
  width: fit-content;
  white-space: nowrap;
}

.qty-ok {
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
}

.qty-low {
  background: rgba(255, 149, 0, 0.15);
  color: #ff9500;
}

.qty-zero {
  background: rgba(255, 59, 48, 0.15);
  color: #ff3b30;
}

.accessory-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 4px;
}

.btn-quick-sell {
  flex: 1;
  background: #34c759;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 5px 6px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-quick-sell:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-quick-sell:active:not(:disabled) {
  transform: scale(0.95);
}

.btn-icon-sm {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: rgba(142, 142, 147, 0.12);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-icon-sm svg {
  width: 12px;
  height: 12px;
}

.btn-icon-sm:hover {
  color: var(--text-main);
}

.btn-icon-sm.text-danger:hover {
  color: #ff3b30;
}

.status-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
}

.status-chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--bg-card-w);
  color: var(--text-sub);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.chip.active {
  background: var(--text-main);
  color: var(--bg-page);
  font-weight: 600;
}

/* ==================== 9. KHATA LEDGER VIEW ==================== */
.khata-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.khata-summary-card {
  background: var(--bg-card-w);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

[data-theme='dark'] .khata-summary-card {
  border-color: rgba(255, 255, 255, 0.06);
}

.khata-summary-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.khata-summary-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.khata-party-card {
  background: var(--bg-card-w);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

/* Khata Ledger Table Design */
.khata-table-wrap {
  background: var(--bg-card-w);
  border-radius: 20px;
  overflow-x: auto;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  margin-top: 14px;
  -webkit-overflow-scrolling: touch;
}

[data-theme='dark'] .khata-table-wrap {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.khata-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  min-width: 440px;
}

.khata-table th {
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sub);
  background: rgba(142, 142, 147, 0.07);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme='dark'] .khata-table th {
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.khata-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}

[data-theme='dark'] .khata-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.khata-table tr:last-child td {
  border-bottom: none;
}

.khata-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.khata-table tbody tr:hover {
  background: rgba(142, 142, 147, 0.08);
}

.khata-party-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
}

.khata-party-sub {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 2px;
}

.party-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.party-badge.receivable {
  background: rgba(52, 199, 89, 0.14);
  color: #34c759;
}

.party-badge.payable {
  background: rgba(255, 59, 48, 0.14);
  color: #ff3b30;
}

.party-badge.settled {
  background: rgba(142, 142, 147, 0.14);
  color: var(--text-sub);
}

.khata-action-btn {
  background: rgba(142, 142, 147, 0.12);
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-accent);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.khata-action-btn:hover {
  background: var(--text-accent);
  color: #fff;
}

/* ==================== 10. MODALS & BOTTOM SHEETS ==================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  position: relative;
  z-index: 10;
  background: var(--modal-bg);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 580px;
  max-height: 94vh;
  overflow-y: auto;
  padding: 20px 20px 50px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  width: 32px;
  height: 32px;
  background: rgba(142, 142, 147, 0.15);
  border: none;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-sub);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.field input, .field textarea {
  width: 100%;
  background: rgba(142, 142, 147, 0.1);
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text-main);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus, .field textarea:focus {
  border-color: #007aff;
  background: var(--bg-card-w);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opt-btn {
  border: 1.5px solid rgba(142, 142, 147, 0.25);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  background: var(--bg-card-w);
  color: var(--text-sub);
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
}

.opt-btn.active {
  background: #1c1c1e;
  color: #ffffff;
  border-color: #1c1c1e;
  font-weight: 600;
}

[data-theme='dark'] .opt-btn.active {
  background: #f5f5f7;
  color: #1c1c1e;
  border-color: #f5f5f7;
}

.photo-area {
  width: 100%;
  height: 130px;
  background: rgba(142, 142, 147, 0.08);
  border: 2px dashed rgba(142, 142, 147, 0.25);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-sub);
  font-size: 13px;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.photo-area img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-area .photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  color: #fff;
}

.photo-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.photo-btn {
  flex: 1;
  background: rgba(142, 142, 147, 0.1);
  border: 1.5px solid rgba(142, 142, 147, 0.2);
  border-radius: 12px;
  padding: 10px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
}

.photo-btn.cam {
  border-color: #007aff;
  color: #007aff;
  background: rgba(0, 122, 255, 0.08);
}

.save-btn {
  width: 100%;
  background: #1c1c1e;
  border: none;
  border-radius: 14px;
  padding: 16px;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  letter-spacing: -0.2px;
  transition: transform 0.15s ease;
}

[data-theme='dark'] .save-btn {
  background: #f5f5f7;
  color: #1c1c1e;
}

.save-btn:active {
  transform: scale(0.98);
}

.save-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sold-out-btn {
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  border: 1.5px solid rgba(142, 142, 147, 0.25);
  background: var(--bg-card-w);
  color: var(--text-sub);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 4px;
}

.sold-out-btn.active {
  background: rgba(255, 59, 48, 0.08);
  border-color: rgba(255, 59, 48, 0.3);
  color: #ff3b30;
  font-weight: 600;
}

/* ==================== 11. FILTER BOTTOM SHEET ==================== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet {
  width: 100%;
  max-width: 580px;
  background: var(--modal-bg);
  border-radius: 24px 24px 0 0;
  padding: 20px 20px 44px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: rgba(142, 142, 147, 0.3);
  border-radius: 2px;
  margin: 0 auto 18px;
}

.sheet-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.sheet-section {
  margin-bottom: 18px;
}

.sheet-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sc {
  border: 1.5px solid rgba(142, 142, 147, 0.25);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  background: var(--bg-card-w);
  color: var(--text-sub);
  cursor: pointer;
  transition: all 0.15s;
}

.sc.on {
  background: #1c1c1e;
  color: #fff;
  border-color: #1c1c1e;
  font-weight: 600;
}

[data-theme='dark'] .sc.on {
  background: #f5f5f7;
  color: #1c1c1e;
  border-color: #f5f5f7;
}

.sc.red {
  color: #ff3b30;
  border-color: rgba(255, 59, 48, 0.25);
}

.sc.red.on {
  background: #ff3b30;
  border-color: #ff3b30;
  color: #fff;
}

.sheet-apply {
  width: 100%;
  background: #1c1c1e;
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 4px;
  letter-spacing: -0.2px;
}

[data-theme='dark'] .sheet-apply {
  background: #f5f5f7;
  color: #1c1c1e;
}

/* ==================== 12. CONFIRM DELETE & DIALOGS ==================== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.confirm-box {
  background: var(--modal-bg);
  border-radius: 20px;
  padding: 24px 20px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  animation: popIn 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-box p {
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 20px;
  line-height: 1.5;
  font-weight: 500;
}

.confirm-btns {
  display: flex;
  gap: 10px;
}

.btn-cancel {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: rgba(142, 142, 147, 0.15);
  color: var(--text-main);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-delete {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  border: none;
  background: #ff3b30;
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* ==================== 13. TOAST NOTIFICATIONS ==================== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c1c1e;
  border-radius: 12px;
  padding: 11px 20px;
  font-size: 13px;
  z-index: 999;
  white-space: nowrap;
  color: #fff;
  font-family: inherit;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.toast.ok { background: #1c1c1e; }
.toast.err { background: #ff3b30; }

/* ==================== 14. LOCK SCREEN ==================== */
.lock-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-page);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.lock-icon {
  width: 80px;
  height: 80px;
  background: #1c1c1e;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.lock-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  text-align: center;
  margin-bottom: 4px;
}

.lock-title span {
  font-weight: 900;
}

.lock-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 36px;
  font-weight: 500;
}

.lock-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lock-field {
  width: 100%;
  margin-bottom: 12px;
  position: relative;
}

.lock-input {
  width: 100%;
  background: var(--bg-card-w);
  border: 1.5px solid rgba(142, 142, 147, 0.25);
  border-radius: 14px;
  padding: 15px 46px 15px 18px;
  color: var(--text-main);
  font-size: 17px;
  font-family: inherit;
  outline: none;
  text-align: center;
  letter-spacing: 0.08em;
  transition: border-color 0.2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.lock-input:focus {
  border-color: #007aff;
}

.lock-input.shake {
  animation: shake 0.4s ease;
  border-color: #ff3b30;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.eye-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-sub);
}

.lock-btn {
  width: 100%;
  background: #1c1c1e;
  border: none;
  border-radius: 14px;
  padding: 16px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

[data-theme='dark'] .lock-btn {
  background: #f5f5f7;
  color: #1c1c1e;
}

.lock-btn:active {
  transform: scale(0.98);
}

.lock-error {
  font-size: 12px;
  color: #ff3b30;
  margin-top: 8px;
  min-height: 18px;
  font-weight: 500;
  text-align: center;
}

.lock-footer {
  position: absolute;
  bottom: 24px;
  font-size: 11px;
  color: rgba(142, 142, 147, 0.5);
  font-weight: 500;
}

/* ==================== 15. CAMERA MODAL ==================== */
.camera-box {
  width: 95%;
  max-width: 480px;
  padding: 12px;
  background: #000;
  border-radius: 24px;
}

.camera-preview-container {
  width: 100%;
  aspect-ratio: 3/4;
  background: #111;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}

.camera-preview-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 16px 8px 6px;
}

.camera-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-btn.snap-cam {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #ffffff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.4);
}

.camera-btn.snap-cam:active {
  transform: scale(0.92);
}

/* ==================== 16. LOADERS & UTILITIES ==================== */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-sub);
  grid-column: 1 / -1;
  font-size: 14px;
  font-weight: 500;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(142, 142, 147, 0.2);
  border-top-color: #007aff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-sub);
  grid-column: 1 / -1;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.35;
}

.empty-text {
  font-size: 14px;
  font-weight: 500;
}

.hidden {
  display: none !important;
}

.text-success { color: #34c759 !important; }
.text-danger { color: #ff3b30 !important; }
.text-accent { color: #007aff !important; }
input[type="file"] { display: none; }

/* ==================== ROLE-BASED ACCESS CONTROL ==================== */
body:not([data-role="admin"]) .admin-only {
  display: none !important;
}
body[data-role="admin"] .admin-only {
  display: flex !important;
}
body[data-role="user"] .admin-only {
  display: none !important;
}
body[data-role="guest"] .user-or-admin-only,
body[data-role="guest"] .admin-only,
body[data-role="guest"] #statsRow,
body[data-role="guest"] .bottom-nav,
body[data-role="guest"] .dots-btn,
body[data-role="guest"] #filterSoldOutBtn {
  display: none !important;
}

/* ==================== MODAL STACKING Z-INDEXES ==================== */
#khata-tx-modal {
  z-index: 500 !important;
}
#security-modal {
  z-index: 600 !important;
}

/* ==================== KHATA TYPE TOGGLE (GREEN/RED ARROWS) ==================== */
.khata-type-toggle {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 6px;
}
.khata-type-toggle .type-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid rgba(142, 142, 147, 0.2);
  background: var(--bg-card);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.khata-type-toggle .type-btn svg {
  flex-shrink: 0;
}
.khata-type-toggle .type-btn.active {
  background: rgba(0, 122, 255, 0.15) !important;
  border-color: #007aff !important;
  color: #007aff !important;
}
.khata-type-toggle .type-btn.active.text-success {
  background: rgba(52, 199, 89, 0.15) !important;
  border-color: #34c759 !important;
  color: #34c759 !important;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.2);
}
.khata-type-toggle .type-btn.active.text-danger {
  background: rgba(255, 59, 48, 0.15) !important;
  border-color: #ff3b30 !important;
  color: #ff3b30 !important;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.2);
}

