/* ============================================================================
 * CLACK Digital Store — Apple iOS App Store Design System
 * Zero Bootstrap | Zero AI Purple Gradients | Pure Apple Minimalism
 * Brand: CLACK | Owner: PhamTrungHieu | Telegram: @hieuphamiosvietnam
 * ============================================================================ */

:root {
  --bg: #FFFFFF;
  --surface: #F5F5F7;
  --surface-hover: #ECECEF;
  --surface-elevated: #FFFFFF;
  --ink: #1D1D1F;
  --ink-secondary: #6E6E73;
  --ink-tertiary: #86868B;
  --accent: #007AFF;
  --accent-hover: #0066D6;
  --accent-soft: rgba(0, 122, 255, 0.10);
  --green: #248A3D;
  --green-soft: rgba(52, 199, 89, 0.13);
  --orange: #C96A00;
  --orange-soft: rgba(255, 149, 0, 0.14);
  --red: #D70015;
  --red-soft: rgba(255, 59, 48, 0.12);
  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.11);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --header-h: 64px;
  --tabbar-h: 68px;
  --container-max: 1160px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

.tabular {
  font-variant-numeric: tabular-nums;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================================================
 * TOP NAVIGATION BAR (Frosted iOS Glass)
 * ============================================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.brand-squircle {
  width: 36px;
  height: 36px;
  border-radius: 22%;
  background: #FFFFFF;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.brand-squircle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink-secondary);
  border: 1px solid var(--border);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
  cursor: pointer;
  border: 0;
  background: transparent;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface);
}

.nav-link.is-active {
  color: var(--ink);
  background: var(--surface);
}

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

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.wallet-pill:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.wallet-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34C759;
  flex-shrink: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease);
}

.user-chip:hover {
  background: var(--surface);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
}

/* ============================================================================
 * BUTTONS
 * ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.14s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 6px 18px rgba(0, 122, 255, 0.25);
}

.btn-dark {
  background: var(--ink);
  color: #FFFFFF;
}

.btn-dark:hover:not(:disabled) {
  background: #000000;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
}

.btn-outline {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(255, 59, 48, 0.2);
}

.btn-get {
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.01em;
}

.btn-get:hover:not(:disabled) {
  background: var(--accent);
  color: #FFFFFF;
}

.btn-sm {
  padding: 7px 13px;
  font-size: 13px;
}

.btn-lg {
  padding: 13px 24px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

/* ============================================================================
 * ANNOUNCEMENT BAR
 * ============================================================================ */

.announcement-bar {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.announcement-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.announcement-pill {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.announcement-text {
  color: var(--ink-secondary);
  margin: 0;
}

.announcement-text strong {
  color: var(--ink);
}

/* ============================================================================
 * HERO BANNER — Apple Storefront Architecture (Pure HTML/CSS/SVG)
 * ============================================================================ */

.hero-section {
  padding: 20px 0 12px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 44px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 36px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(29, 29, 31, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(125deg, rgba(0, 0, 0, 0.55) 0%, transparent 68%);
  -webkit-mask-image: linear-gradient(125deg, rgba(0, 0, 0, 0.55) 0%, transparent 68%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  margin-bottom: 18px;
}

.hero-eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34C759;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.22);
}

.hero-title {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.7vw, 42px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.hero-title span {
  color: var(--accent);
}

.hero-subtitle {
  margin: 0 0 26px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--ink-secondary);
  max-width: 540px;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.hero-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.hero-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-metric-val {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.hero-metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-tertiary);
}

.hero-visual {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-svg-frame {
  width: 100%;
  max-width: 410px;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.08));
}

/* ============================================================================
 * VIEW SWITCHING & SECTIONS
 * ============================================================================ */

main {
  flex: 1;
  padding-bottom: 48px;
}

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: block;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 18px;
}

.section-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.section-sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-secondary);
}

/* ============================================================================
 * STORE FILTER BAR (App Store Pills + Search)
 * ============================================================================ */

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.category-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.category-pills::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s var(--ease);
}

.cat-pill:hover {
  background: var(--surface);
  color: var(--ink);
}

.cat-pill.is-active {
  background: var(--ink);
  color: #FFFFFF;
  border-color: var(--ink);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  min-width: 240px;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-tertiary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  outline: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.search-input:focus {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.sort-select {
  padding: 9px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  cursor: pointer;
}

/* ============================================================================
 * PRODUCT GRID & APPLE APP STORE CARDS
 * ============================================================================ */

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s var(--ease);
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.product-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.squircle-icon {
  width: 58px;
  height: 58px;
  border-radius: 22%;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.squircle-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.squircle-icon--tinted {
  background: color-mix(in srgb, var(--accent, #007AFF) 12%, #FFFFFF);
  color: var(--accent, #007AFF);
}

.squircle-icon--tinted svg {
  width: 28px;
  height: 28px;
}

.product-meta {
  flex: 1;
  min-width: 0;
}

.product-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-neutral {
  background: var(--surface);
  color: var(--ink-secondary);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-green {
  background: var(--green-soft);
  color: var(--green);
}

.badge-orange {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge-red {
  background: var(--red-soft);
  color: var(--red);
}

.product-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

.product-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.price-block {
  display: flex;
  flex-direction: column;
}

.price-now {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.price-old {
  font-size: 12px;
  color: var(--ink-tertiary);
  text-decoration: line-through;
}

.stock-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-tertiary);
}

/* ============================================================================
 * FEATURE / TRUST STRIP & SUPPORT BANNER
 * ============================================================================ */

.support-card {
  margin-top: 44px;
  padding: 28px 32px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.support-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.support-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-secondary);
}

/* ============================================================================
 * PANELS (DEPOSIT / ORDERS / ACCOUNT / ADMIN CARDS)
 * ============================================================================ */

.surface-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.surface-muted {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.deposit-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 22px;
  align-items: start;
}

.qr-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: center;
}

.qr-frame {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: inline-block;
  box-shadow: var(--shadow-xs);
  margin: 10px 0 14px;
}

.qr-frame img {
  width: 240px;
  height: auto;
  border-radius: 8px;
}

.amount-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.amount-chip {
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}

.amount-chip:hover,
.amount-chip.is-active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.bank-info-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bank-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}

.bank-info-label {
  font-size: 12.5px;
  color: var(--ink-secondary);
  font-weight: 500;
}

.bank-info-value {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.memo-highlight {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 8px;
}

/* ============================================================================
 * FORMS & INPUTS
 * ============================================================================ */

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.form-control {
  min-height: 104px;
  resize: vertical;
}

.form-hint {
  margin-top: 5px;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* ============================================================================
 * ORDERS & DELIVERED KEYS VAULT
 * ============================================================================ */

.order-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.order-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.order-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.order-code {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
}

.delivery-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 10px;
}

.key-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13px;
  word-break: break-all;
}

.key-line + .key-line {
  margin-top: 8px;
}

/* ============================================================================
 * TABLES (Admin & History)
 * ============================================================================ */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
}

table.clack-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.clack-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.clack-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.clack-table tr:last-child td {
  border-bottom: 0;
}

/* ============================================================================
 * MODALS (Apple Sheet Style)
 * ============================================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.24s var(--ease);
}

.modal-dialog--lg {
  max-width: 680px;
}

.modal-backdrop.is-open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  margin-bottom: 18px;
}

.auth-tab {
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.auth-tab.is-active {
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  overflow: hidden;
}

.qty-stepper button {
  width: 36px;
  height: 34px;
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}

.qty-stepper input {
  width: 48px;
  text-align: center;
  border: 0;
  background: transparent;
  font-weight: 700;
  outline: none;
}

/* ============================================================================
 * EMPTY STATES & SKELETON LOADERS
 * ============================================================================ */

.empty-state {
  text-align: center;
  padding: 52px 24px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
}

.empty-state-icon {
  width: 52px;
  height: 52px;
  border-radius: 22%;
  background: var(--bg);
  border: 1px solid var(--border);
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  color: var(--ink-secondary);
}

.empty-state h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.empty-state p {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--ink-secondary);
}

.skeleton-card {
  height: 196px;
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, #F5F5F7 25%, #ECECEF 50%, #F5F5F7 75%);
  background-size: 200% 100%;
  animation: clackShimmer 1.35s infinite linear;
}

@keyframes clackShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================================
 * TOAST NOTIFICATIONS
 * ============================================================================ */

.toast-stack {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(29, 29, 31, 0.94);
  backdrop-filter: blur(12px);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  transform: translateY(-8px);
  opacity: 0;
  transition: all 0.24s var(--ease);
  pointer-events: auto;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast--success .toast-icon { color: #34C759; }
.toast--error .toast-icon { color: #FF453A; }
.toast--info .toast-icon { color: #0A84FF; }

/* ============================================================================
 * FOOTER
 * ============================================================================ */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.footer-links a {
  font-weight: 600;
  color: var(--ink-secondary);
}

.footer-links a:hover {
  color: var(--accent);
}

/* ============================================================================
 * MOBILE BOTTOM TAB BAR (iOS Native Feel)
 * ============================================================================ */

.mobile-tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}

.mobile-tabbar-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}

.tabbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--ink-tertiary);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}

.tabbar-btn svg {
  width: 22px;
  height: 22px;
}

.tabbar-btn.is-active {
  color: var(--accent);
}

/* ============================================================================
 * ADMIN SPECIFIC LAYOUT
 * ============================================================================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.kpi-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.kpi-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.admin-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 20px 0 24px;
}

.admin-tab {
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  border: 0;
  background: transparent;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s var(--ease);
}

.admin-tab.is-active {
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* ============================================================================
 * VIP MEMBERSHIP & DISCOUNT SYSTEM
 * ============================================================================ */

.vip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px 24px;
  margin-bottom: 22px;
}

.vip-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.vip-progress-track {
  width: 100%;
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.07);
  overflow: hidden;
  margin: 10px 0 8px;
}

.vip-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--accent);
  transition: width 0.35s var(--ease);
}

.vip-tier-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.vip-tier-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.vip-tier-item.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.vip-tier-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.vip-tier-discount {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  margin: 2px 0;
}

.vip-tier-req {
  font-size: 11.5px;
  color: var(--ink-tertiary);
}

/* ============================================================================
 * WHOLESALE TIERS, COUPONS, REFERRAL EVENT & NOTICES / CONSIGNMENT (8/2)
 * ============================================================================ */

.wholesale-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.wholesale-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.wholesale-chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.16s var(--ease);
}

.wholesale-chip:hover,
.wholesale-chip.is-active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.coupon-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.coupon-row .form-control {
  flex: 1;
  text-transform: uppercase;
  font-family: var(--mono);
  font-weight: 700;
}

.ctv-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--green-soft);
  border: 1px solid rgba(52, 199, 89, 0.25);
  color: var(--green);
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 600;
}

.notice-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.notice-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.notice-card.is-pinned {
  border-color: rgba(0, 122, 255, 0.28);
  background: linear-gradient(180deg, rgba(0, 122, 255, 0.03) 0%, #FFFFFF 100%);
}

.notice-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ink-tertiary);
}

.notice-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.notice-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-secondary);
  white-space: pre-line;
}

.split-highlight {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}

.split-pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.split-pill-num {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.split-pill-label {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.voucher-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.voucher-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px dashed rgba(0, 122, 255, 0.35);
}

@media (max-width: 720px) {
  .vip-tier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .split-highlight,
  .voucher-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
 * RESPONSIVE BREAKPOINTS
 * ============================================================================ */

@media (max-width: 1040px) {
  .brand-badge {
    display: none;
  }
  .header-inner {
    gap: 10px;
  }
  .nav-links {
    gap: 2px;
  }
  .nav-link {
    padding: 6px 8px;
    font-size: 13px;
    white-space: nowrap;
  }
  .wallet-pill {
    padding: 6px 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .user-chip {
    padding: 4px 9px 4px 4px;
    font-size: 12.5px;
    gap: 5px;
    white-space: nowrap;
  }
  .user-chip > span:nth-child(2) {
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }
}

@media (max-width: 980px) {
  .hero-card {
    grid-template-columns: 1fr;
    padding: 28px 24px;
    gap: 24px;
  }
  .hero-svg-frame {
    max-width: 340px;
  }
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .deposit-grid,
  .two-col-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .user-chip > span:nth-child(2) {
    display: none;
  }
  .nav-link {
    padding: 6px 7px;
    font-size: 12.5px;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }
  .container {
    padding: 0 14px;
  }
  .site-header {
    height: 58px;
  }
  .header-inner {
    gap: 8px;
  }
  .header-actions {
    gap: 6px;
  }
  .wallet-pill {
    padding: 5px 10px;
    font-size: 12.5px;
    gap: 6px;
  }
  .user-chip {
    padding: 4px 10px 4px 5px;
    font-size: 12.5px;
    gap: 6px;
  }
  .nav-links {
    display: none;
  }
  .mobile-tabbar {
    display: block;
  }
  .announcement-bar {
    margin-top: 12px;
    padding: 10px 12px;
    font-size: 12.5px;
    align-items: flex-start;
  }
  .announcement-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .hero-section {
    padding: 14px 0 8px;
  }
  .hero-card {
    padding: 22px 18px;
    border-radius: var(--radius-lg);
    gap: 20px;
  }
  .hero-title {
    font-size: 25px;
    line-height: 1.18;
  }
  .hero-subtitle {
    font-size: 14px;
    margin-bottom: 20px;
  }
  .hero-cta-row {
    gap: 8px;
    margin-bottom: 20px;
  }
  .hero-cta-row .btn {
    padding: 11px 16px;
    font-size: 14px;
  }
  .hero-cta-row .btn-primary,
  .hero-cta-row .btn-outline,
  .hero-cta-row .btn-secondary {
    width: 100%;
    flex: 1 1 100%;
  }
  .hero-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 12px;
    padding-top: 16px;
  }
  .section-head {
    margin: 24px 0 14px;
  }
  .section-title {
    font-size: 20px;
  }
  .product-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .product-card {
    padding: 16px;
  }
  .toolbar-controls {
    width: 100%;
    justify-content: stretch;
  }
  .search-wrap {
    max-width: none;
  }
  /* Prevent iOS Safari auto-zoom on form focus */
  .search-input,
  .form-control,
  .sort-select {
    font-size: 16px;
  }
  .form-row,
  .kpi-grid,
  .kpi-grid--3 {
    grid-template-columns: 1fr;
  }
  .vip-card {
    padding: 18px 16px;
    border-radius: var(--radius-lg);
  }
  .bank-info-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .qr-frame img {
    width: 210px;
  }
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-dialog {
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 22px 18px calc(24px + env(safe-area-inset-bottom));
  }
  .toast-stack {
    left: 14px;
    right: 14px;
    top: 66px;
    max-width: none;
  }
  .support-card {
    padding: 20px 18px;
    margin-top: 28px;
  }
  .support-card .btn {
    width: 100%;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 440px) {
  .brand-mark span:not(.brand-squircle) {
    font-size: 16px;
  }
  .user-chip > span:nth-child(2) {
    display: none;
  }
}
