/* ==========================================================================
   ZNS POS - Mobile-First Design System
   Typography: Sora (body) + DM Serif Display (headlines)
   Approach: Mobile-first with progressive enhancement
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Warm Light Palette */
  --bg: #faf9f7;
  --bg-warm: #f5f3ef;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-hover: #fffefa;

  /* Typography Colors */
  --text: #1a1816;
  --text-secondary: #4a4540;
  --muted: #8a847a;
  --faint: #c4bfb5;

  /* Borders & Dividers */
  --border: rgba(26, 24, 22, 0.08);
  --border-strong: rgba(26, 24, 22, 0.15);
  --border-accent: rgba(212, 160, 23, 0.3);

  /* Accent - Warm Amber Gold */
  --accent: #d4a017;
  --accent-hover: #c49315;
  --accent-soft: rgba(212, 160, 23, 0.12);
  --accent-glow: rgba(212, 160, 23, 0.25);

  /* Semantic */
  --success: #2d8a4e;
  --success-soft: rgba(45, 138, 78, 0.1);
  --danger: #c53030;
  --danger-soft: rgba(197, 48, 48, 0.1);
  --warning: #b7791f;
  --warning-soft: rgba(183, 121, 31, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(26, 24, 22, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 24, 22, 0.06), 0 1px 3px rgba(26, 24, 22, 0.04);
  --shadow-lg: 0 12px 40px rgba(26, 24, 22, 0.08), 0 4px 12px rgba(26, 24, 22, 0.04);
  --shadow-accent: 0 4px 20px rgba(212, 160, 23, 0.2);

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Sora', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Mobile-First Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  /* Touch-friendly sizing */
  --touch-target: 44px;
  --input-height: 48px;
  --btn-height: 48px;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Safe areas for notched devices */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Dark Mode */
[data-theme="dark"] {
  /* Dark Palette */
  --bg: #121212;
  --bg-warm: #1a1a1a;
  --bg-elevated: #242424;
  --card: #1e1e1e;
  --card-hover: #282828;

  /* Typography Colors */
  --text: #f5f5f5;
  --text-secondary: #c0c0c0;
  --muted: #888888;
  --faint: #555555;

  /* Borders & Dividers */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-accent: rgba(212, 160, 23, 0.4);

  /* Accent - Warm Amber Gold (slightly brighter for dark mode) */
  --accent: #e5b020;
  --accent-hover: #f0c030;
  --accent-soft: rgba(212, 160, 23, 0.2);
  --accent-glow: rgba(212, 160, 23, 0.35);

  /* Semantic */
  --success: #3cb371;
  --success-soft: rgba(60, 179, 113, 0.15);
  --danger: #e74c3c;
  --danger-soft: rgba(231, 76, 60, 0.15);
  --warning: #f0a500;
  --warning-soft: rgba(240, 165, 0, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-accent: 0 4px 20px rgba(212, 160, 23, 0.3);
}

/* Desktop spacing adjustments */
@media (min-width: 768px) {
  :root {
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
  }
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: -0.01em;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
  overflow-x: hidden;
}

/* Selection */
::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
  -webkit-touch-callout: none;
}

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

/* ==========================================================================
   Layout - Mobile First
   ========================================================================== */

.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  padding-left: calc(var(--space-lg) + var(--safe-left));
  padding-right: calc(var(--space-lg) + var(--safe-right));
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding: 0 var(--space-xl);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* ==========================================================================
   Top Navigation - Mobile Optimized
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 247, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
}

[data-theme="dark"] .topbar {
  background: rgba(18, 18, 18, 0.92);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  gap: var(--space-sm);
}

.topbar-inner .nav-desktop {
  display: flex;
  align-items: center;
  gap: 16px;
}

.currency-switcher {
  margin-left: 12px;
}

.currency-pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--accent, #f5c24b);
  background: var(--card);          /* picks correct bg in light/dark */
}

.currency-pill select {
  border: none;
  background: transparent;
  color: var(--text);               /* fixes “invisible” MYR in light mode */
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0 6px 0 0;              /* space for arrow */
  outline: none;

  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Dropdown options for dark mode */
.currency-pill select option {
  background: var(--card);
  color: var(--text);
}

.currency-pill::after {
  content: "▾";
  position: absolute;
  right: 10px;
  font-size: 10px;
  color: var(--muted);
  pointer-events: none;
}

.currency-pill select:focus {
  outline: none;
}

@media (min-width: 768px) {
  .topbar-inner {
    min-height: 64px;
  }
}

.brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}

@media (min-width: 768px) {
  .brand-title {
    font-size: 22px;
  }
}

.brand-subtitle {
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  background: var(--accent-soft);
  border-radius: 100px;
}

@media (min-width: 768px) {
  .brand-subtitle {
    font-size: 10px;
    padding: 4px 10px;
  }
}

/* Mobile Nav - Horizontal Scroll */
.nav {
  display: flex;
  gap: 2px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 0 calc(-1 * var(--space-lg));
  padding: 0 var(--space-lg);
}

.nav::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .nav {
    overflow-x: visible;
    margin: 0;
    padding: 0;
  }
}

.nav-link {
  position: relative;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
}

@media (min-width: 768px) {
  .nav-link {
    padding: 10px 16px;
    font-size: 13px;
  }
}

.nav-link::before {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
  .nav-link::before {
    left: 16px;
    right: 16px;
  }
}

.nav-link:hover,
.nav-link:active {
  color: var(--text);
  background: var(--bg-warm);
  text-decoration: none;
}

.nav-link:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}

.nav-link.active {
  color: var(--text);
  background: var(--bg-warm);
}

.nav-link.active::before {
  transform: scaleX(1);
}

/* ==========================================================================
   Hamburger Menu - Mobile Only
   ========================================================================== */

/* Hide desktop nav on mobile, show hamburger */
.nav-desktop {
  display: none;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 1001;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger-line:nth-child(1) {
  margin-bottom: 5px;
}

.hamburger-line:nth-child(3) {
  margin-top: 5px;
}

/* Hamburger to X animation */
.hamburger.active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

/* Sun icon (shown in dark mode) */
.theme-toggle .sun-icon {
  display: none;
}

/* Moon icon (shown in light mode) */
.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

/* Mobile theme toggle */
.theme-toggle-mobile {
  cursor: pointer;
}

.theme-toggle-mobile .sun-icon {
  display: none;
}

.theme-toggle-mobile .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle-mobile .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle-mobile .moon-icon {
  display: none;
}

.theme-label {
  margin-left: var(--space-sm);
}

/* Smooth transitions for theme change */
.card,
.topbar,
.footer,
.input,
.btn,
.panel {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Mobile Menu Overlay */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-close:hover,
.mobile-menu-close:active {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--accent);
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-lg);
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  background: transparent;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
  background: var(--bg-warm);
  color: var(--accent);
  text-decoration: none;
}

.mobile-nav-link svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.2s ease;
}

.mobile-nav-link:hover svg,
.mobile-nav-link:active svg {
  color: var(--accent);
}

/* Prevent body scroll when menu is open */
body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Desktop: Show nav, hide hamburger */
@media (min-width: 768px) {
  .hamburger {
    display: none;
  }

  .nav-desktop {
    display: flex;
  }

  .mobile-menu {
    display: none;
  }
}

/* ==========================================================================
   Typography - Mobile Optimized
   ========================================================================== */

.h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: var(--space-lg) 0 var(--space-sm);
  color: var(--text);
}

@media (min-width: 768px) {
  .h1 {
    font-size: 38px;
    margin: var(--space-xl) 0 var(--space-sm);
  }
}

.h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--text);
}

@media (min-width: 768px) {
  .h2 {
    font-size: 28px;
  }
}

.h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--muted);
}

@media (min-width: 768px) {
  .h3 {
    font-size: 12px;
  }
}

.p {
  color: var(--muted);
  margin: 0 0 var(--space-lg);
  line-height: 1.6;
  font-size: 14px;
}

@media (min-width: 768px) {
  .p {
    font-size: 15px;
    max-width: 60ch;
  }
}

.muted {
  color: var(--muted);
}

/* ==========================================================================
   Grid System - Mobile First
   ========================================================================== */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-lg);
  }
}

/* Mobile: 2-column grid */
.span-3, .span-4, .span-6, .span-8, .span-12 {
  grid-column: span 1;
}

/* Tablet and up */
@media (min-width: 768px) {
  .span-3 { grid-column: span 3; }
  .span-4 { grid-column: span 4; }
  .span-6 { grid-column: span 6; }
  .span-8 { grid-column: span 8; }
  .span-12 { grid-column: span 12; }
}

/* ==========================================================================
   Cards - Touch Optimized
   ========================================================================== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
  .card {
    padding: var(--space-xl);
    border-radius: var(--radius-xl);
  }
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-flat {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.card-flat:hover {
  box-shadow: none;
}

/* ==========================================================================
   KPI Cards - Mobile Optimized
   ========================================================================== */

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

.kpi .label {
  font-family: var(--font-body);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (min-width: 768px) {
  .kpi .label {
    font-size: 11px;
    letter-spacing: 0.08em;
  }
}

.kpi .value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

@media (min-width: 768px) {
  .kpi .value {
    font-size: 36px;
  }
}

.kpi .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ==========================================================================
   Tables - Mobile Responsive
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--space-lg));
  padding: 0 var(--space-lg);
}

@media (min-width: 768px) {
  .table-wrapper {
    margin: 0;
    padding: 0;
    overflow-x: visible;
  }
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

@media (min-width: 768px) {
  .table {
    min-width: auto;
  }
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

@media (min-width: 768px) {
  .table th,
  .table td {
    padding: 14px 16px;
  }
}

.table th {
  font-family: var(--font-body);
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-warm);
}

@media (min-width: 768px) {
  .table th {
    font-size: 10px;
    letter-spacing: 0.1em;
  }
}

.table th:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.table th:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.table td {
  font-size: 13px;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .table td {
    font-size: 14px;
  }
}

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

.table tbody tr {
  transition: background 0.15s ease;
}

.table tbody tr:active {
  background: var(--bg-warm);
}

@media (min-width: 768px) {
  .table tbody tr:hover {
    background: var(--bg-warm);
  }
}

/* ==========================================================================
   Form Elements - Touch Optimized
   ========================================================================== */

.input,
.select,
select {
  width: 100%;
  min-height: var(--input-height);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 16px; /* Prevents zoom on iOS */
  font-family: var(--font-body);
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

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

.input::placeholder {
  color: var(--faint);
  font-weight: 400;
}

textarea.input {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* Select arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238a847a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Checkbox & Radio - Touch Friendly */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  width: 22px;
  height: 22px;
  cursor: pointer;
}

/* ==========================================================================
   Buttons - Touch Optimized
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  background: var(--accent);
  color: white;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  padding: 14px 24px;
  min-height: var(--btn-height);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

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

@media (min-width: 768px) {
  .btn {
    padding: 12px 24px;
  }

  .btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-accent);
  }

  .btn:active {
    transform: translateY(0);
  }
}

.btn.secondary {
  background: var(--bg-warm);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
}

.btn.secondary:active {
  background: var(--bg-elevated);
}

@media (min-width: 768px) {
  .btn.secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--text-secondary);
    box-shadow: var(--shadow-md);
  }
}

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

.btn.success {
  background: var(--success);
}

.btn.sm {
  padding: 10px 16px;
  font-size: 13px;
  min-height: 40px;
  border-radius: var(--radius-sm);
}

.btn.lg {
  padding: 16px 32px;
  font-size: 15px;
  min-height: 56px;
  border-radius: var(--radius-lg);
}

/* Full-width buttons on mobile */
.btn-block {
  width: 100%;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (min-width: 768px) {
  .badge {
    font-size: 11px;
    padding: 6px 14px;
  }
}

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

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

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

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

/* ==========================================================================
   QR Code - Mobile Centered
   ========================================================================== */

.qr {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-lg);
  background: white;
  padding: 12px;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-md);
  margin: 0 auto;
}

@media (min-width: 768px) {
  .qr {
    width: 220px;
    height: 220px;
    padding: 16px;
  }
}

/* ==========================================================================
   Monospace & Code
   ========================================================================== */

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0;
  font-feature-settings: 'tnum' 1;
}

@media (min-width: 768px) {
  .mono {
    font-size: 13px;
  }
}

code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-warm);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  code {
    font-size: 12px;
  }
}

/* ==========================================================================
   Equivalents Box
   ========================================================================== */

.equiv-box {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-warm);
}

.equiv-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

@media (min-width: 768px) {
  .equiv-title {
    font-size: 10px;
    letter-spacing: 0.1em;
  }
}

.equiv-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.equiv-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
}

@media (min-width: 768px) {
  .equiv-row {
    font-size: 13px;
  }
}

.equiv-symbol {
  font-weight: 600;
  color: var(--muted);
}

.equiv-amount {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  border-top: 1px solid var(--border);
  margin-top: var(--space-2xl);
  padding: var(--space-lg) 0;
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
  color: var(--muted);
  font-size: 12px;
  background: var(--bg-elevated);
}

@media (min-width: 768px) {
  .footer {
    font-size: 13px;
    padding: var(--space-xl) 0;
  }
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: center;
  text-align: center;
}

@media (min-width: 768px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ==========================================================================
   Stat Grid - Mobile Optimized
   ========================================================================== */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

@media (min-width: 480px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
  }
}

.stat-item {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-warm);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.stat-item:active {
  border-color: var(--border-accent);
}

@media (min-width: 768px) {
  .stat-item:hover {
    border-color: var(--border-accent);
  }
}

.stat-label {
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

@media (min-width: 768px) {
  .stat-label {
    font-size: 10px;
    letter-spacing: 0.08em;
  }
}

.stat-value {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
}

@media (min-width: 768px) {
  .stat-value {
    font-size: 22px;
  }
}

/* ==========================================================================
   Crypto Grid - Mobile Optimized
   ========================================================================== */

.crypto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}

@media (min-width: 768px) {
  .crypto-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

.crypto-item {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-warm);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.crypto-item:active {
  border-color: var(--border-accent);
  background: var(--bg-elevated);
}

@media (min-width: 768px) {
  .crypto-item:hover {
    border-color: var(--border-accent);
    background: var(--bg-elevated);
  }
}

.crypto-sym {
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

@media (min-width: 768px) {
  .crypto-sym {
    font-size: 10px;
    margin-bottom: 4px;
  }
}

.crypto-val {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
}

@media (min-width: 768px) {
  .crypto-val {
    font-size: 12px;
  }
}

/* ==========================================================================
   Divider
   ========================================================================== */

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

@media (min-width: 768px) {
  .divider {
    margin: var(--space-xl) 0;
  }
}

/* ==========================================================================
   Form Layout
   ========================================================================== */

.form-group {
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .form-group {
    margin-bottom: var(--space-xl);
  }
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (min-width: 768px) {
  .form-label {
    font-size: 12px;
    letter-spacing: 0.05em;
  }
}

.form-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: var(--space-sm);
  line-height: 1.5;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

@media (min-width: 640px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }
}

/* ==========================================================================
   Alert/Notice
   ========================================================================== */

.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: var(--space-lg);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

@media (min-width: 768px) {
  .alert {
    font-size: 14px;
  }
}

.alert::before {
  font-size: 16px;
  flex-shrink: 0;
}

.alert.success {
  background: var(--success-soft);
  border: 1px solid rgba(45, 138, 78, 0.2);
  color: var(--success);
}

.alert.success::before {
  content: '✓';
}

.alert.error {
  background: var(--danger-soft);
  border: 1px solid rgba(197, 48, 48, 0.2);
  color: var(--danger);
}

.alert.error::before {
  content: '!';
}

.alert.info {
  background: var(--accent-soft);
  border: 1px solid var(--border-accent);
  color: var(--accent-hover);
}

.alert.info::before {
  content: 'i';
}

/* ==========================================================================
   Currency Select
   ========================================================================== */

#fiatSelect {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  max-width: 100px;
  font-weight: 500;
  min-height: 40px;
}

@media (min-width: 768px) {
  #fiatSelect {
    max-width: 110px;
  }
}

#fiatSelect option {
  background: var(--bg-elevated);
  color: var(--text);
}

/* ==========================================================================
   Scrollbar - Hidden on Mobile, Minimal on Desktop
   ========================================================================== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--faint);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ==========================================================================
   Animations - Reduced Motion Support
   ========================================================================== */

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

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

/* Staggered children animation */
.stagger-in > * {
  opacity: 0;
  animation: fadeIn 0.3s ease-out forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.03s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.06s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.09s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.12s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.18s; }

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-center {
  text-align: center;
}

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

/* Hide on mobile, show on desktop */
.desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .desktop-only {
    display: block;
  }
}

/* Show on mobile, hide on desktop */
.mobile-only {
  display: block;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
}

/* Stack elements on mobile */
.stack-mobile {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

@media (min-width: 768px) {
  .stack-mobile {
    flex-direction: row;
    align-items: center;
  }
}
