/* ============================================================
   METAL TRACKER - style.css (v14.0.0)
   ============================================================
   Table of Contents:
     1.  CSS Variables
     2.  Reset & Base
     3.  Utility Classes
     4.  App Header
     5.  Main Content
     6.  Cards
     7.  Tracker Header
     8.  Rate Cards
     9.  Currency Badges
     10. Spot Display
     11. Tables
     12. OHLC
     13. Tabs & Toggles
     14. Inputs & Buttons
     15. Navigation (sidebar + bottom nav)
     16. Toasts & Overlays
     17. Skip Link + Noscript
     18. Live Badge / Exchange Badge
     19. Error Banner
     20. Calculator / Zakat
     21. Progress Bar
     22. Alerts
     23. Notification Status
     24. Theme Switch
     25. Settings
     26. Portfolio Cards
     27. View Sections + Guest Lock
     28. Modal
     29. Scrollbar
     30. Headings
     31. Responsive Breakpoints
     32. Refresh Button
     33. Monthly PnL Table
     34. Calculator Metal Toggle
     35. Alert Metal Selector
     36. Add Entry Button
     37. Transactions Cards
     38. PWA-specific
     39. Browser-specific
     40. Reduced Motion
     41. Focus Visible
     42. Install Prompt
     43. User Display
     44. Notification Bell + Badge
     45. Notification Dropdown
     46. Notifications View
     47. Sidebar Auth Buttons
     48. Diagnostic Section
     49. Notification Pref Rows
     50. Responsive (dropdown small screens)
     51. Test Notification Modal
     52. Alert Enhancements
   ============================================================ */

/* ============================================================
   1. CSS VARIABLES
   ============================================================ */
:root {
  --bg-color: #09090B;
  --surface-color: #18181B;
  --surface-light: #27272A;
  --surface-elevated: #27272A;

  --text-primary: #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-tertiary: #71717A;

  --border-color: #27272A;
  --border-light: #3F3F46;
  --border-gold: rgba(212, 175, 55, 0.4);
  --border-silver: rgba(226, 232, 240, 0.4);

  --shadow: rgba(0, 0, 0, 0.5);

  --gold-primary: #FFD700;
  --gold-secondary: #FFA500;
  --gold-glow: rgba(212, 175, 55, 0.3);

  --silver-primary: #E2E8F0;
  --silver-secondary: #CBD5E1;
  --silver-glow: rgba(226, 232, 240, 0.3);

  --accent-primary: var(--gold-primary);
  --accent-secondary: var(--gold-secondary);
  --accent-glow: var(--gold-glow);
  --accent-border: var(--border-gold);

  --success: #10B981;
  --error: #EF4444;
  --alert: #F97316;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --header-height: 52px;
  --toast-offset: 0px;
}

/* Silver mode — accent shifts from gold to silver */
body.silver-mode {
  --accent-primary: var(--silver-primary);
  --accent-secondary: var(--silver-secondary);
  --accent-glow: var(--silver-glow);
  --accent-border: var(--border-silver);
}

/* Light theme override */
body.light-theme {
  --bg-color: #FAF9F6;
  --surface-color: #FFFFFF;
  --surface-light: #F0EDE6;
  --surface-elevated: #FFFFFF;

  --text-primary: #18181B;
  --text-secondary: #52525B;
  --text-tertiary: #71717A;

  --border-color: #E5E2D9;
  --border-light: #D4D0C5;
  --border-gold: rgba(184, 134, 11, 0.35);
  --border-silver: rgba(112, 128, 144, 0.35);

  --shadow: rgba(0, 0, 0, 0.08);

  --gold-primary: #D4AF37;
  --gold-secondary: #F5D061;
  --gold-glow: rgba(184, 134, 11, 0.25);

  --silver-primary: #708090;
  --silver-secondary: #A9A9A9;
  --silver-glow: rgba(112, 128, 144, 0.2);

  --success: #059669;
  --error: #DC2626;
  --alert: #EA580C;
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: calc(80px + var(--safe-bottom));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

@media (min-width: 1024px) {
  body { padding-bottom: 0; font-size: 15px; }
}

body.loading-active,
body.sidebar-open { overflow: hidden; }

img, svg { max-width: 100%; height: auto; display: block; }

/* ============================================================
   3. UTILITY CLASSES
   ============================================================ */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none !important; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.contents { display: contents; }

.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-grow { flex-grow: 1; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-around { justify-content: space-around; }

.self-center { align-self: center; }

.gap-0-5 { gap: 2px; }
.gap-1 { gap: 4px; }
.gap-1-5 { gap: 6px; }
.gap-2 { gap: 8px; }
.gap-2-5 { gap: 10px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-x-3 { column-gap: 12px; }
.gap-y-1 { row-gap: 4px; }
.gap-x-1-5 { column-gap: 6px; }
.gap-y-0-5 { row-gap: 2px; }

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.space-y-0 > * + * { margin-top: 0; }
.space-y-0-5 > * + * { margin-top: 2px; }
.space-y-1 > * + * { margin-top: 4px; }
.space-y-1-5 > * + * { margin-top: 6px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.w-auto { width: auto; }
.min-w-0 { min-width: 0; }
.max-w-2xl { max-width: 42rem; }
.max-w-7xl { max-width: 80rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.w-2-5 { width: 10px; }
.h-2-5 { height: 10px; }
.w-3 { width: 12px; }
.h-3 { height: 12px; }
.w-3-5 { width: 14px; }
.h-3-5 { height: 14px; }
.w-4 { width: 16px; }
.h-4 { height: 16px; }
.w-5 { width: 20px; }
.h-5 { height: 20px; }
.w-6 { width: 24px; }
.h-6 { height: 24px; }
.h-1-5 { height: 6px; }

.mb-0-5 { margin-bottom: 2px; }
.mb-1 { margin-bottom: 4px; }
.mb-1-5 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.mt-0-5 { margin-top: 2px; }
.mt-1 { margin-top: 4px; }
.mt-1-5 { margin-top: 6px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }

.ml-1 { margin-left: 4px; }
.mr-0-5 { margin-right: 2px; }
.mr-1 { margin-right: 4px; }
.-mt-5 { margin-top: -20px; }

.p-0-5 { padding: 2px; }
.p-1 { padding: 4px; }
.p-1-5 { padding: 6px; }
.p-2 { padding: 8px; }
.p-2-5 { padding: 10px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

.px-1 { padding-left: 4px; padding-right: 4px; }
.px-1-5 { padding-left: 6px; padding-right: 6px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }

.py-0-5 { padding-top: 2px; padding-bottom: 2px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-1-5 { padding-top: 6px; padding-bottom: 6px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }

.pl-1 { padding-left: 4px; }
.pl-2 { padding-left: 8px; }
.pr-1 { padding-right: 4px; }
.pr-2 { padding-right: 8px; }
.pt-1 { padding-top: 4px; }
.pt-2 { padding-top: 8px; }
.pt-3 { padding-top: 12px; }
.pb-2 { padding-bottom: 8px; }
.pb-20 { padding-bottom: 80px; }
.pt-14 { padding-top: 56px; }

.text-9 { font-size: 9px; line-height: 1.3; }
.text-10 { font-size: 10px; line-height: 1.4; }
.text-11 { font-size: 11px; line-height: 1.4; }
.text-\[9px\] { font-size: 9px; line-height: 1.3; }
.text-\[10px\] { font-size: 10px; line-height: 1.4; }
.text-\[11px\] { font-size: 11px; line-height: 1.4; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.italic { font-style: italic; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whitespace-nowrap { white-space: nowrap; }
.tabular-nums { font-variant-numeric: tabular-nums !important; }
.leading-tight { line-height: 1.25; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-success { color: var(--success) !important; }
.text-error { color: var(--error) !important; }
.text-alert { color: var(--alert) !important; }
.text-gold { color: var(--gold-primary) !important; }
.text-silver { color: var(--silver-primary) !important; }
.text-white { color: #FFFFFF; }
.text-black { color: #000000; }

.rounded { border-radius: 4px; }
.rounded-md { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 12px; }
.rounded-2xl { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }

.border { border-width: 1px; border-style: solid; border-color: var(--border-color); }
.border-0 { border: none; }
.border-2 { border-width: 2px; border-style: solid; }
.border-4 { border-width: 4px; border-style: solid; }
.border-t { border-top-width: 1px; border-top-style: solid; border-top-color: var(--border-color); }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: var(--border-color); }
.border-l { border-left-width: 1px; border-left-style: solid; border-left-color: var(--border-color); }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.overflow-y-auto { overflow-y: auto; }

.relative { position: relative; }
.fixed { position: fixed; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }

.z-10 { z-index: 10; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.pointer-events-none { pointer-events: none; }

.transition-all { transition: all 0.2s; }
.transition { transition: all 0.15s; }

.opacity-0 { opacity: 0; }
.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

.hover\:opacity-70:hover { opacity: 0.7; }
.hover\:opacity-100:hover { opacity: 1; }

.shadow-sm { box-shadow: 0 1px 2px var(--shadow); }
.shadow { box-shadow: 0 2px 4px var(--shadow); }
.shadow-lg { box-shadow: 0 8px 16px var(--shadow); }
.shadow-xl { box-shadow: 0 12px 24px var(--shadow); }

.animate-spin { animation: spin 1s linear infinite; }

/* ─── Keyframes ─── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes pulseIcon {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.75; }
}

@keyframes spinRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes notifDropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes diagSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   4. APP HEADER
   ============================================================ */
.app-header {
  position: fixed;
  top: var(--toast-offset);
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: calc(8px + var(--safe-top));
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  min-height: var(--header-height);
  transition: top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--accent-primary);
  flex: 1;
  min-width: 0;
  margin: 0;
  letter-spacing: 0.3px;
  transition: color 0.3s ease;
}

@media (min-width: 1024px) {
  .header-title { font-size: 1.05rem; }
}

.header-title > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hide-mobile { display: inline; }
.hide-tablet { display: inline; }

@media (max-width: 639px) {
  .hide-mobile { display: none !important; }
}

@media (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 11px 8px;
  z-index: 60;
  margin-right: 4px;
  flex-shrink: 0;
}

.hamburger-line {
  width: 100%;
  height: 2.5px;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-radius: 2px;
  transition: all 0.3s ease;
  box-shadow: 0 0 4px var(--accent-glow);
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
  transform: translateY(8.75px) rotate(45deg);
}
.hamburger-btn.active .hamburger-line:nth-child(2) { opacity: 0; }
.hamburger-btn.active .hamburger-line:nth-child(3) {
  transform: translateY(-8.75px) rotate(-45deg);
}

.icon-btn {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: opacity 0.2s, background-color 0.2s;
  flex-shrink: 0;
}

.icon-btn:hover { opacity: 0.7; }
.icon-btn:active { transform: scale(0.95); }

.settings-btn { color: var(--text-primary); }

.user-profile {
  display: none;
  align-items: center;
  gap: 6px;
}

.user-profile.flex { display: flex; }

.user-photo {
  height: 24px;
  width: 24px;
  border-radius: 9999px;
  border: 2px solid var(--accent-primary);
  object-fit: cover;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ============================================================
   5. MAIN CONTENT
   ============================================================ */
.app-main {
  padding-top: calc(60px + var(--toast-offset));
  padding-left: 8px;
  padding-right: 8px;
  padding-bottom: calc(80px + var(--safe-bottom));
  max-width: 80rem;
  margin: 0 auto;
  min-height: 100vh;
  transition: padding-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1024px) {
  .app-main {
    padding-top: calc(68px + var(--toast-offset));
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 24px;
  }
}

/* ============================================================
   6. CARDS
   ============================================================ */
.card {
  background-color: var(--surface-color);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 2px 8px var(--shadow);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
  .card { padding: 16px; border-radius: 18px; }
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: 0 4px 12px var(--shadow);
}

.card-compact {
  background-color: var(--surface-light);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--border-color);
}

.live-card {
  background: linear-gradient(135deg, var(--surface-color) 0%, #1A1608 100%);
  border: 1px solid var(--accent-border);
  box-shadow: 0 4px 16px var(--shadow), 0 0 20px var(--accent-glow);
  transition: all 0.3s ease;
}

body.light-theme .live-card {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid var(--accent-border);
  box-shadow: 0 4px 16px var(--shadow), 0 0 20px var(--accent-glow);
}

body.silver-mode .live-card {
  background: linear-gradient(135deg, var(--surface-color) 0%, #1A1A1E 100%) !important;
}
body.light-theme.silver-mode .live-card {
  background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%) !important;
}

.live-card.silver-mode {
  background: linear-gradient(135deg, var(--surface-color) 0%, #1A1A1E 100%) !important;
  border: 1px solid var(--border-silver) !important;
  box-shadow: 0 4px 16px var(--shadow), 0 0 20px var(--silver-glow) !important;
}

body.light-theme .live-card.silver-mode {
  background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%) !important;
  border: 1px solid var(--border-silver) !important;
  box-shadow: 0 4px 16px var(--shadow), 0 0 20px var(--silver-glow) !important;
}

/* ============================================================
   7. TRACKER HEADER
   ============================================================ */
.tracker-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

@media (min-width: 1024px) {
  .tracker-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
}

.tracker-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
}

@media (min-width: 1024px) {
  .tracker-title-row {
    justify-content: flex-start;
    gap: 10px;
  }
}

.tracker-title-text {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  min-width: 0;
}

@media (min-width: 1024px) {
  .tracker-title-text { font-size: 1rem; }
}

.tracker-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  flex-wrap: nowrap;
  min-width: 0;
}

.tracker-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.metal-toggle {
  flex-shrink: 0;
}

.source-select {
  flex: 1;
  min-width: 0;
  text-overflow: ellipsis;
}

.refresh-btn {
  flex-shrink: 0;
}

@media (max-width: 1023px) {
  .tracker-controls { gap: 5px; }

  .metal-toggle {
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
  }
  .metal-btn {
    padding: 5px 8px;
    font-size: 0.64rem;
    min-height: 30px;
    letter-spacing: 0;
  }

  .tracker-actions {
    gap: 5px;
    flex: 1;
    min-width: 0;
  }

  .source-select {
    padding: 6px 22px 6px 8px;
    font-size: 0.7rem;
    min-height: 32px;
    background-size: 11px;
    background-position: right 6px center;
    flex: 1;
    min-width: 0;
  }

  .refresh-btn {
    padding: 6px 10px !important;
    font-size: 0.7rem !important;
    min-height: 32px !important;
    gap: 4px !important;
    flex-shrink: 0;
  }
  .refresh-btn svg {
    width: 12px;
    height: 12px;
  }
}

@media (min-width: 1024px) {
  .tracker-controls {
    width: auto;
    justify-content: flex-end;
    gap: 8px;
  }
  .tracker-actions {
    flex: 0 0 auto;
  }
}

.metal-toggle {
  display: flex;
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  background-color: var(--surface-light);
  border: 1px solid var(--border-color);
}

.metal-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  min-height: 32px;
  white-space: nowrap;
}

.metal-btn:hover { color: var(--text-primary); }

#toggle-gold.active {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 6px var(--gold-glow);
}

#toggle-silver.active {
  background: linear-gradient(135deg, var(--silver-primary) 0%, var(--silver-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 6px var(--silver-glow);
}

.metal-btn.active {
  color: #000000;
}

.source-select {
  background-color: var(--surface-light);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  outline: none;
  min-height: 34px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.source-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.refresh-btn {
  padding: 6px 10px !important;
  font-size: 0.72rem !important;
  min-height: 34px !important;
  gap: 4px;
}

/* ============================================================
   8. RATE CARDS
   ============================================================ */
.rate-card {
  background: linear-gradient(135deg, var(--surface-light) 0%, var(--surface-color) 100%);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 12px;
  transition: all 0.3s;
}

@media (min-width: 768px) {
  .rate-card { padding: 14px; border-radius: 16px; }
}

.rate-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow), 0 0 12px var(--accent-glow);
}

.rate-card.highlight {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(245, 208, 97, 0.05) 100%);
  border: 1px solid var(--accent-border);
  box-shadow: 0 0 16px var(--accent-glow);
}

body.light-theme .rate-card.highlight {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.12) 0%, rgba(218, 165, 32, 0.04) 100%);
}

body.silver-mode .rate-card.highlight {
  background: linear-gradient(135deg, rgba(226,232,240,0.15) 0%, rgba(203,213,225,0.05) 100%);
}
body.light-theme.silver-mode .rate-card.highlight {
  background: linear-gradient(135deg, rgba(112,128,144,0.12) 0%, rgba(169,169,169,0.04) 100%);
}

.rate-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 0;
  flex-wrap: nowrap;
  margin: 0;
  overflow: hidden;
}

.rate-card-title .truncate {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rate-card-title .flex-shrink-0,
.rate-card-title > span:first-child {
  flex-shrink: 0;
}

.rate-card-title .last-update-text {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}

@media (max-width: 1023px) {
  .rate-card-title {
    flex-wrap: wrap;
    row-gap: 2px;
  }
  .rate-card-title .last-update-text {
    flex-basis: 100%;
    margin-left: 0;
    margin-top: 2px;
    text-align: left;
    opacity: 0.85;
  }
}

/* ============================================================
   9. CURRENCY BADGES
   ============================================================ */
.currency-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-usd {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-pkr {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid var(--accent-border);
}

/* ============================================================
   10. SPOT DISPLAY
   ============================================================ */
.spot-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  gap: 8px;
}

.spot-usd {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.03) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.spot-pkr {
  background: linear-gradient(135deg, var(--accent-glow) 0%, rgba(212, 175, 55, 0.03) 100%);
  border: 1px solid var(--accent-border);
}

.spot-value {
  color: var(--success);
  font-weight: 800;
  font-size: 1.15rem;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.spot-value.pkr-spot {
  color: var(--accent-primary);
  text-shadow: 0 0 10px var(--accent-glow);
}

.spot-value.na-value {
  color: var(--text-tertiary);
  font-size: 0.95rem;
  text-shadow: none;
  font-style: italic;
}

@media (min-width: 768px) {
  .spot-value { font-size: 1.35rem; }
}

/* ============================================================
   11. TABLES
   ============================================================ */
table {
  font-size: 0.8rem;
  border-collapse: collapse;
  width: 100%;
}

.rate-table {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}

.rate-table th,
.rate-table td { padding: 8px 6px; }

@media (min-width: 768px) {
  table { font-size: 0.85rem; }
  table th, table td { padding: 10px 8px; }
}

/* ============================================================
   12. OHLC
   ============================================================ */
.ohlc-horizontal {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
}

.ohlc-item {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 8px 4px;
  border-radius: 8px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.ohlc-item p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  line-height: 1.4;
}

.ohlc-item.high {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.08) 100%);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: inset 0 0 12px rgba(16, 185, 129, 0.15), 0 0 8px rgba(16, 185, 129, 0.2);
}
.ohlc-item.high p:last-child {
  color: var(--success) !important;
  opacity: 1;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
  font-weight: 800;
}

.ohlc-item.low {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.25) 0%, rgba(239, 68, 68, 0.08) 100%);
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.15), 0 0 8px rgba(239, 68, 68, 0.2);
}
.ohlc-item.low p:last-child {
  color: var(--error) !important;
  opacity: 1;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  font-weight: 800;
}

/* ============================================================
   13. TABS & TOGGLES
   ============================================================ */
.tab-container {
  display: flex;
  background-color: var(--surface-light);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: transparent;
  min-height: 40px;
  font-family: inherit;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.toggle-btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s;
  font-size: 0.8rem;
  min-height: 42px;
  font-family: inherit;
  background: transparent;
  color: var(--text-secondary);
}

.toggle-btn.active-pkr,
.toggle-btn.active-usd {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000000;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.toggle-btn.inactive {
  background-color: var(--surface-light);
  color: var(--text-secondary);
}

.toggle-btn.active-drops {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #FFF;
  border-color: #DC2626;
}

.toggle-btn.active-rises {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #FFF;
  border-color: #059669;
}

/* ============================================================
   14. INPUTS & BUTTONS
   ============================================================ */
.input, .select {
  background-color: var(--surface-light);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: all 0.2s;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
}

.input:focus, .select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background-color: var(--surface-elevated);
}

select.select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23A1A1AA'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 36px;
}

textarea.input { resize: vertical; min-height: 60px; font-family: inherit; }

.btn {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000000;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.85rem;
  box-shadow: 0 2px 8px var(--accent-glow);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

.btn:active { transform: scale(0.97); }

.btn:disabled {
  background: var(--surface-light);
  color: var(--text-tertiary);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.75rem;
  border-radius: 10px;
  min-height: 38px;
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 12px var(--accent-glow);
}

.btn-danger {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #FFF;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* ============================================================
   15. NAVIGATION
   ============================================================ */
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 12px;
  color: var(--text-secondary);
  transition: all 0.2s;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  gap: 4px;
  min-height: 48px;
  min-width: 48px;
  position: relative;
}

.nav-item.active {
  color: var(--accent-primary);
  background-color: var(--accent-glow);
  box-shadow: 0 0 12px var(--accent-glow);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Guest lock icon on nav items */
.nav-lock-icon {
  display: none;
}

.nav-item[data-guest-locked="true"] .nav-lock-icon {
  display: inline-block;
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.6rem;
  opacity: 0.85;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
}

.sidebar .nav-item[data-guest-locked="true"] .nav-lock-icon {
  position: static;
  margin-left: auto;
  font-size: 0.75rem;
}

.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--surface-color);
  border-top: 1px solid var(--border-color);
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-bottom));
  z-index: 50;
  box-shadow: 0 -4px 16px var(--shadow);
}

@media (min-width: 1024px) {
  .bottom-nav { display: none; }
}

.sidebar-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(9, 9, 11, 0.75);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.sidebar {
  position: fixed;
  left: -280px;
  top: 0; bottom: 0;
  width: 270px;
  background-color: var(--surface-color);
  border-right: 1px solid var(--border-color);
  padding: 18px 14px;
  padding-top: calc(18px + var(--safe-top) + var(--toast-offset));
  padding-bottom: calc(18px + var(--safe-bottom));
  z-index: 50;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding-top 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: 4px 0 20px var(--shadow);
}

.sidebar.active { left: 0; }

.sidebar .nav-item {
  flex-direction: row;
  padding: 14px 18px;
  font-size: 0.95rem;
  gap: 14px;
  justify-content: flex-start;
  margin-bottom: 6px;
  min-height: 50px;
}

.sidebar .nav-item:hover {
  background-color: var(--accent-glow);
  border-left: 3px solid var(--accent-primary);
  padding-left: 15px;
}

/* ============================================================
   16. TOASTS & OVERLAYS
   ============================================================ */
.toast {
  position: fixed;
  bottom: calc(90px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--surface-elevated);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  font-size: 0.85rem;
  font-weight: 600;
  max-width: 90%;
  border: 1px solid var(--border-light);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.alert { border-left: 4px solid var(--alert); }

/* Connection toast (top bar) */
.connection-toast {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  padding-top: calc(10px + var(--safe-top));
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.connection-toast.show {
  transform: translateY(0);
}

.connection-toast.online {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.connection-toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.connection-toast.online .connection-toast-icon {
  display: none;
}

/* Loading overlay (first load only) */
.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 9, 11, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.show {
  display: flex;
  opacity: 1;
  pointer-events: all;
}

.loading-content {
  text-align: center;
  padding: 24px 32px;
  background: linear-gradient(135deg, var(--surface-color) 0%, #1A1608 100%);
  border: 1.5px solid var(--accent-border);
  border-radius: 20px;
  box-shadow: 0 12px 48px var(--shadow), 0 0 32px var(--accent-glow);
  min-width: 220px;
  max-width: 280px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

body.light-theme .loading-content {
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
}

body.silver-mode .loading-content {
  background: linear-gradient(135deg, var(--surface-color) 0%, #1A1A1E 100%);
}
body.light-theme.silver-mode .loading-content {
  background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
}

.loading-overlay.show .loading-content {
  transform: scale(1);
  animation: slideUpFade 0.4s ease;
}

.loading-spinner {
  position: relative;
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-ring {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 3px solid transparent;
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-secondary);
  border-radius: 50%;
  animation: spinRing 1s linear infinite;
  box-shadow: 0 0 16px var(--accent-glow);
}

.loading-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
  animation: pulseIcon 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.loading-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-primary);
  margin: 0 0 6px 0;
  text-shadow: 0 0 12px var(--accent-glow);
}

.loading-subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin: 0;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
}

/* ============================================================
   17. SKIP LINK + NOSCRIPT BANNER
   ============================================================ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 8px;
  background: var(--accent-primary);
  color: #000000;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 10000;
  transition: top 0.2s ease;
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
  outline: 3px solid #000000;
  outline-offset: 2px;
}

.noscript-banner {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 100%);
  color: #FFFFFF;
  padding: 16px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  border-bottom: 3px solid #7F1D1D;
}

.noscript-banner strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.noscript-banner p {
  font-size: 0.9rem;
  margin: 0;
  opacity: 0.95;
}

/* ============================================================
   18. LIVE BADGE / EXCHANGE BADGE
   ============================================================ */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(16, 185, 129, 0.1) 100%);
  color: var(--success);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 6px var(--success);
}

.exchange-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.08) 100%);
  color: var(--success);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.15);
  white-space: nowrap;
  flex-shrink: 0;
}

.exchange-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.last-update-text {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-primary);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

/* ============================================================
   19. ERROR BANNER
   ============================================================ */
.error-banner {
  padding: 12px;
  border-radius: 10px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid var(--error);
  color: var(--error);
  margin-bottom: 12px;
}

.error-banner-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.error-banner-content svg { flex-shrink: 0; }

/* ============================================================
   20. CALCULATOR / ZAKAT
   ============================================================ */
.auto-total-display {
  background-color: var(--bg-color);
  border: 2px dashed var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
  transition: all 0.2s;
  gap: 8px;
}

.auto-total-display .total-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 5px;
}

.auto-total-display .total-value {
  color: var(--accent-primary);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
  text-shadow: 0 0 8px var(--accent-glow);
}

.calc-input {
  background-color: var(--bg-color);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 4px 14px;
  width: 100%;
  outline: none;
  font-size: 1.3rem;
  font-weight: 700;
  transition: all 0.2s;
  min-height: 48px;
  font-family: inherit;
}

.calc-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.karat-tab {
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: transparent;
  min-height: 38px;
  font-family: inherit;
}

.karat-tab.active {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000000;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.unit-toggle {
  display: flex;
  background-color: var(--surface-light);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--border-color);
}

.unit-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: transparent;
  min-height: 38px;
  font-family: inherit;
}

.unit-btn.active {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 6px var(--accent-glow);
}

.zakat-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.zakat-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.zakat-badge.reached {
  background: rgba(16, 185, 129, 0.25);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.zakat-badge.below {
  background: rgba(113, 113, 122, 0.2);
  color: var(--text-secondary);
  border: 1px solid rgba(113, 113, 122, 0.4);
}

/* ============================================================
   21. PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 8px;
  background-color: var(--surface-light);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--border-color);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  transition: width 0.5s ease;
  box-shadow: 0 0 8px var(--accent-glow);
}

.progress-fill.silver {
  background: linear-gradient(90deg, var(--silver-primary) 0%, var(--silver-secondary) 100%);
  box-shadow: 0 0 8px var(--silver-glow);
}

/* ============================================================
   22. ALERTS
   ============================================================ */
.alert-card {
  background: linear-gradient(135deg, var(--surface-light) 0%, var(--surface-color) 100%);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  transition: all 0.3s;
}

.alert-card:hover {
  border-color: var(--accent-primary);
  transform: translateX(4px);
  box-shadow: 0 4px 12px var(--shadow);
}

.alert-card.triggered {
  border-color: var(--error);
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.15) 0%, rgba(153, 27, 27, 0.05) 100%);
  box-shadow: 0 0 12px rgba(220, 38, 38, 0.3);
}

.alert-form-container {
  background-color: var(--surface-light);
  border-color: var(--border-color);
}

/* ============================================================
   23. NOTIFICATION STATUS BADGE
   ============================================================ */
.notif-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

.notif-status.granted {
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.notif-status.denied {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.notif-status.default {
  background-color: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid var(--accent-border);
}

/* ============================================================
   24. THEME SWITCH
   ============================================================ */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--surface-light);
  transition: 0.3s;
  border-radius: 28px;
  border: 1.5px solid var(--border-light);
}

.theme-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 6px var(--accent-glow);
}

.theme-switch input:checked + .theme-slider {
  background-color: var(--accent-glow);
  border-color: var(--accent-primary);
}

.theme-switch input:checked + .theme-slider:before {
  transform: translateX(24px);
  background: #000000;
}

/* ============================================================
   25. SETTINGS
   ============================================================ */
.settings-item {
  background-color: var(--surface-light);
  border-color: var(--border-color);
}

.settings-icon {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-radius: 8px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.settings-icon svg {
  color: #000000;
}

/* ============================================================
   26. PORTFOLIO CARDS
   ============================================================ */
.invested-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05)) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.current-card {
  background: linear-gradient(135deg, var(--accent-glow), rgba(212, 175, 55, 0.05)) !important;
  border-color: var(--accent-border) !important;
}

.pl-card {
  background-color: var(--surface-light);
  border-color: var(--border-color);
}

.month-badge {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border: 1px solid var(--accent-border);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ============================================================
   27. VIEW SECTIONS
   ============================================================ */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

/* Guest lock UI */
.guest-lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
  gap: 10px;
}

.guest-lock.hidden {
  display: none !important;
}

.guest-lock-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 6px;
  opacity: 0.7;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.guest-lock-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.guest-lock-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 340px;
  line-height: 1.5;
  margin: 0 0 8px 0;
}

.guest-lock-btn {
  min-width: 220px;
  max-width: 100%;
  padding: 12px 20px;
}

/* ============================================================
   28. MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(9, 9, 11, 0.75);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--surface-color);
  border: 1.5px solid var(--accent-border);
  border-radius: 18px;
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 24px var(--accent-glow);
  text-align: center;
}

.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.modal-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ============================================================
   29. SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track { background: var(--bg-color); }

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover { background: var(--accent-secondary); }

/* ============================================================
   30. HEADINGS
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  letter-spacing: 0.3px;
  font-weight: 800;
  color: var(--text-primary);
}

/* ============================================================
   31. RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (min-width: 640px) {
  .sm\:inline { display: inline !important; }
  .sm\:hidden { display: none !important; }
  .sm\:block { display: block !important; }
  .sm\:flex-row { flex-direction: row; }
}

@media (min-width: 768px) {
  .md\:block { display: block !important; }
  .md\:flex { display: flex !important; }
  .md\:hidden { display: none !important; }
}

@media (min-width: 1024px) {
  .lg\:hidden { display: none !important; }
  .lg\:block { display: block !important; }
  .lg\:inline { display: inline !important; }
  .lg\:flex { display: flex !important; }
  .lg\:flex-row { flex-direction: row; }
  .lg\:flex-col { flex-direction: column; }

  .lg\:items-center { align-items: center; }
  .lg\:items-start { align-items: flex-start; }
  .lg\:justify-between { justify-content: space-between; }
  .lg\:justify-start { justify-content: flex-start; }
  .lg\:justify-end { justify-content: flex-end; }

  .lg\:text-lg { font-size: 1.125rem; }
  .lg\:text-base { font-size: 1rem; }
  .lg\:text-sm { font-size: 0.875rem; }
  .lg\:text-xs { font-size: 0.75rem; }
  .lg\:text-\[10px\] { font-size: 10px; }
  .lg\:text-\[11px\] { font-size: 11px; }

  .lg\:h-6 { height: 1.5rem; }
  .lg\:w-6 { width: 1.5rem; }
  .lg\:w-3 { width: 12px; }
  .lg\:h-3 { height: 12px; }
  .lg\:w-32 { width: 8rem; }
  .lg\:w-auto { width: auto; }

  .lg\:px-2 { padding-left: 8px; padding-right: 8px; }
  .lg\:px-4 { padding-left: 16px; padding-right: 16px; }
  .lg\:pt-16 { padding-top: 64px; }
  .lg\:p-3 { padding: 12px; }
  .lg\:gap-2 { gap: 8px; }
  .lg\:gap-2-5 { gap: 10px; }

  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

/* ============================================================
   32. REFRESH BUTTON
   ============================================================ */
.refresh-btn:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.refresh-btn:not(:disabled):hover {
  box-shadow: 0 6px 16px var(--accent-glow);
  transform: translateY(-2px);
}

.refresh-btn:not(:disabled):active {
  transform: scale(0.97);
}

.refresh-btn:disabled {
  background: var(--surface-light);
  color: var(--text-tertiary);
  box-shadow: none;
}

/* ============================================================
   33. MONTHLY PNL TABLE
   ============================================================ */
#view-monthly-pnl .overflow-x-auto {
  overflow-x: hidden;
}

#view-monthly-pnl table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
}

#view-monthly-pnl th:nth-child(1),
#view-monthly-pnl td:nth-child(1) { width: 25%; }

#view-monthly-pnl th:nth-child(2),
#view-monthly-pnl td:nth-child(2) { width: 25%; }

#view-monthly-pnl th:nth-child(3),
#view-monthly-pnl td:nth-child(3) { width: 25%; }

#view-monthly-pnl th:nth-child(4),
#view-monthly-pnl td:nth-child(4) { width: 25%; }

#view-monthly-pnl th,
#view-monthly-pnl td {
  padding: 10px 4px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}

#view-monthly-pnl thead th {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
  vertical-align: middle;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

#view-monthly-pnl tbody td {
  font-size: 0.7rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--border-color);
}

#view-monthly-pnl td:first-child {
  text-align: center;
  padding-left: 4px;
  font-weight: 600;
  color: var(--text-primary);
}

#view-monthly-pnl th:last-child,
#view-monthly-pnl td:last-child {
  padding-right: 4px;
}

#view-monthly-pnl tbody tr:last-child td {
  border-bottom: none;
}

#view-monthly-pnl .monthly-cell {
  vertical-align: top;
}

#view-monthly-pnl .monthly-cell .rs-line {
  display: block;
  text-align: left;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  line-height: 1;
  margin-bottom: 3px;
}

#view-monthly-pnl .monthly-cell .amount-line {
  display: block;
  text-align: right;
  font-weight: 700;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

#view-monthly-pnl table th:not(:last-child),
#view-monthly-pnl table td:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

#view-monthly-pnl table thead th:not(:last-child) {
  border-right: 1px solid var(--border-light);
}

#view-monthly-pnl tbody td:nth-child(3) {
  color: var(--accent-primary) !important;
}

.current-card > p:nth-of-type(2) {
  color: var(--accent-primary) !important;
}

/* ============================================================
   34. CALCULATOR METAL TOGGLE
   ============================================================ */
.calc-metal-toggle {
  display: flex;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  background-color: var(--surface-light);
  border: 1px solid var(--border-color);
}

.calc-metal-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  min-height: 26px;
  white-space: nowrap;
}

.calc-metal-btn:hover {
  color: var(--text-primary);
}

#calc-metal-gold.active {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 4px var(--gold-glow);
}

#calc-metal-silver.active {
  background: linear-gradient(135deg, var(--silver-primary) 0%, var(--silver-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 4px var(--silver-glow);
}

.calc-metal-btn.active {
  color: #000000;
}

.calc-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  flex-wrap: nowrap;
  min-width: 0;
}

@media (min-width: 1024px) {
  .calc-controls-row {
    width: auto;
    min-width: 320px;
    gap: 24px;
  }
}

@media (max-width: 400px) {
  .calc-metal-btn {
    padding: 4px 8px;
    font-size: 0.62rem;
    min-height: 24px;
  }
  .karat-tab {
    padding: 5px 8px;
    font-size: 0.7rem;
    min-height: 32px;
  }
}

#calc-purity-tabs.silver-active .karat-tab.active {
  background: linear-gradient(135deg, var(--silver-primary) 0%, var(--silver-secondary) 100%);
  color: #000000;
  border-color: var(--silver-primary);
  box-shadow: 0 2px 8px var(--silver-glow);
}

.unit-toggle.silver-active .unit-btn.active {
  background: linear-gradient(135deg, var(--silver-primary) 0%, var(--silver-secondary) 100%);
  color: #000000;
  box-shadow: 0 2px 6px var(--silver-glow);
}

/* ============================================================
   35. ALERT METAL SELECTOR
   ============================================================ */
#alert-metal-gold.active,
#alert-metal-silver.active {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  color: #000000;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ============================================================
   36. ADD ENTRY BUTTON (Bottom Nav)
   ============================================================ */
.add-entry-btn {
  border-radius: 9999px;
  padding: 8px;
  margin-top: -20px;
  border: 4px solid var(--bg-color);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* ============================================================
   37. TRANSACTIONS — Card Layout
   ============================================================ */
#transactions-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 768px) {
  #transactions-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  #transactions-container {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.txn-card {
  background: linear-gradient(135deg, var(--surface-light) 0%, var(--surface-color) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
  transition: all 0.2s ease;
}

.txn-card:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px var(--shadow), 0 0 12px var(--accent-glow);
}

.txn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.txn-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.txn-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.txn-badge-buy {
  background: rgba(5, 150, 105, 0.2);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, 0.4);
}

.txn-badge-sell {
  background: rgba(220, 38, 38, 0.2);
  color: var(--error);
  border: 1px solid rgba(220, 38, 38, 0.4);
}

.txn-badge-gold {
  background: var(--gold-glow);
  color: var(--gold-primary);
  border: 1px solid var(--border-gold);
  font-weight: 700;
}

.txn-badge-silver {
  background: rgba(226, 232, 240, 0.15);
  color: var(--silver-primary);
  border: 1px solid var(--border-silver);
  font-weight: 700;
}

.txn-date {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.txn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.txn-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.txn-label {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.txn-value {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-notes {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-style: italic;
  padding: 4px 0;
  border-top: 1px dashed var(--border-color);
  margin-top: 3px;
  word-break: break-word;
}

.txn-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.txn-pl-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.txn-pl {
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.txn-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.txn-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 28px;
  font-family: inherit;
}

.txn-action-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.txn-action-btn.delete:hover {
  border-color: var(--error);
  color: var(--error);
}

/* Transaction card separator */
#transactions-container .txn-card {
  border-bottom: 2px solid var(--border-light) !important;
  border-radius: 12px 12px 0 0;
}

#transactions-container .txn-card:last-child {
  border-bottom-width: 1px !important;
}

#transactions-container .txn-card:hover {
  border-bottom-color: var(--accent-primary) !important;
}

/* ============================================================
   38. PWA-SPECIFIC STYLES
   ============================================================ */
@media (display-mode: standalone) {
  #install-app-btn,
  .settings-item .install-section {
    display: none !important;
  }

  .app-header,
  .bottom-nav,
  .sidebar,
  .tracker-controls,
  .tab-container,
  .metal-toggle,
  .calc-metal-toggle,
  .unit-toggle,
  .karat-tab,
  .nav-item,
  .btn,
  .toggle-btn {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }

  .app-header, .bottom-nav, .sidebar {
    -webkit-touch-callout: none;
  }
}

/* ============================================================
   39. BROWSER-SPECIFIC STYLES
   ============================================================ */
@media (display-mode: browser) {
  #install-app-btn {
    display: inline-flex;
  }
}

/* ============================================================
   40. REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   41. FOCUS-VISIBLE (a11y)
   ============================================================ */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.nav-item:focus-visible,
.tab-btn:focus-visible,
.toggle-btn:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   42. INSTALL PROMPT — Bottom Sheet
   ============================================================ */
.install-prompt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(9, 9, 11, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9997;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.install-prompt-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.install-prompt-overlay.hidden {
  display: none !important;
}

.install-prompt-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface-color);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 12px 20px calc(24px + var(--safe-bottom));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-top: 1.5px solid var(--accent-border);
  max-width: 560px;
  margin: 0 auto;
}

.install-prompt-overlay.show .install-prompt-sheet {
  transform: translateY(0);
}

.install-prompt-drag {
  width: 40px;
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin: 0 auto 16px;
  opacity: 0.6;
}

.install-prompt-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.install-prompt-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--accent-border);
  box-shadow: 0 0 16px var(--accent-glow);
}

.install-prompt-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.install-prompt-info {
  min-width: 0;
  flex: 1;
}

.install-prompt-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 2px;
  letter-spacing: 0.2px;
}

.install-prompt-subtitle {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.3;
}

.install-prompt-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 18px;
  text-align: center;
}

.install-prompt-actions {
  display: flex;
  gap: 10px;
}

/* Hide install prompt in PWA mode (fallback safety) */
@media (display-mode: standalone) {
  .install-prompt-overlay {
    display: none !important;
  }
}

/* Small phones */
@media (max-width: 380px) {
  .install-prompt-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }
  .install-prompt-title {
    font-size: 0.92rem;
  }
  .install-prompt-subtitle {
    font-size: 0.68rem;
  }
  .install-prompt-desc {
    font-size: 0.75rem;
  }
}

/* ============================================================
   43. USER DISPLAY (Header — Guest / User)
   ============================================================ */
.user-display {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  max-width: 130px;
  margin-right: 2px;
}

.user-display-guest,
.user-display-user {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.user-display-photo {
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1.5px solid var(--accent-primary);
  flex-shrink: 0;
}

.user-display-guest svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.user-display-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

@media (max-width: 480px) {
  .header-actions {
    gap: 8px;
  }
  .icon-btn {
    padding: 7px;
  }
  .user-display-name { max-width: 60px; font-size: 0.68rem; }
  .user-display { padding: 3px 6px; max-width: 100px; }
}

@media (max-width: 380px) {
  .user-display-name { display: none; }
  .user-display { padding: 3px 5px; }
}

/* ============================================================
   44. NOTIFICATION BELL + BADGE
   ============================================================ */
.notif-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--error);
  color: #FFFFFF;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface-color);
  line-height: 1;
  pointer-events: none;
}

/* ============================================================
   45. NOTIFICATION DROPDOWN
   ============================================================ */
.notif-dropdown-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: transparent;
  z-index: 55;
  cursor: pointer;
}

.notif-dropdown {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top) + var(--toast-offset) + 6px);
  right: 8px;
  width: 340px;
  max-width: calc(100vw - 16px);
  background: var(--surface-color);
  border: 1.5px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 24px var(--accent-glow);
  z-index: 60;
  overflow: hidden;
  animation: notifDropIn 0.2s ease;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.notif-dropdown-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.notif-dropdown-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 0;
}

.notif-dropdown-empty {
  text-align: center;
  padding: 24px 12px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
}

.notif-dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.notif-dropdown-item:hover {
  background: var(--surface-light);
}

.notif-dropdown-item.unread {
  border-left-color: var(--accent-primary);
  background: rgba(212, 175, 55, 0.05);
}

.notif-dropdown-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-dropdown-item-content {
  flex: 1;
  min-width: 0;
}

.notif-dropdown-item-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-dropdown-item-body {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-dropdown-item-time {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-tertiary);
  flex-shrink: 0;
  margin-top: 2px;
}

.notif-dropdown-footer {
  display: flex;
  border-top: 1px solid var(--border-color);
}

.notif-footer-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.3px;
}

.notif-footer-btn:hover {
  background: var(--accent-glow);
}

.notif-footer-btn:first-child {
  border-right: 1px solid var(--border-color);
}

.notif-footer-clear {
  color: var(--error);
}

.notif-footer-clear:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ============================================================
   46. NOTIFICATIONS VIEW (All)
   ============================================================ */
.notif-view-group {
  margin-bottom: 20px;
}

.notif-view-group-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 0 8px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.notif-view-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-light);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.notif-view-item:hover {
  border-color: var(--accent-primary);
  transform: translateX(2px);
}

.notif-view-item-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.notif-view-item-content {
  flex: 1;
  min-width: 0;
}

.notif-view-item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.notif-view-item-body {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.notif-view-item-time {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  font-weight: 600;
}

/* ============================================================
   47. SIDEBAR AUTH — Login/Logout (nav-item style)
   ============================================================ */
.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0 12px;
  opacity: 0.6;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  margin-bottom: 6px;
  min-height: 50px;
}

.sidebar-nav-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  stroke-width: 2;
}

.sidebar-nav-login {
  color: var(--accent-primary);
}

.sidebar-nav-login svg {
  color: var(--accent-primary);
}

.sidebar-nav-login:hover {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent-primary);
  padding-left: 15px;
  color: var(--accent-primary);
}

.sidebar-nav-logout {
  color: var(--error);
}

.sidebar-nav-logout svg {
  color: var(--error);
}

.sidebar-nav-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  border-left: 3px solid var(--error);
  padding-left: 15px;
  color: var(--error);
}

/* ============================================================
   48. DIAGNOSTIC SECTION
   ============================================================ */
.diagnostic-section {
  margin-top: 14px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
}

.diagnostic-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 4px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-primary);
  cursor: pointer;
  transition: opacity 0.2s;
}

.diagnostic-toggle:hover { opacity: 0.75; }

.diagnostic-chevron {
  transition: transform 0.25s ease;
}

.diagnostic-toggle[aria-expanded="true"] .diagnostic-chevron {
  transform: rotate(180deg);
}

.diagnostic-content {
  padding: 8px 0 4px;
  animation: diagSlideIn 0.2s ease;
}

.diagnostic-results {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  min-height: 50px;
}

.diag-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  font-size: 0.72rem;
  border-bottom: 1px dashed var(--border-color);
}

.diag-row:last-child { border-bottom: none; }

.diag-icon { font-size: 0.9rem; text-align: center; }

.diag-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.diag-value {
  color: var(--text-primary);
  font-weight: 700;
  text-align: right;
  font-size: 0.7rem;
}

.diagnostic-actions {
  display: flex;
  gap: 8px;
}

/* ============================================================
   49. NOTIFICATION PREF ROWS (vertical spacing)
   ============================================================ */
#notif-row-daily-rates,
#notif-row-pnl-snapshot,
#notif-row-price-alerts {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.notif-pref-hint {
  font-size: 0.62rem !important;
  line-height: 1.35;
}

/* Guest-locked notification rows */
.notif-lock-icon {
  display: none;
  font-size: 0.75rem;
  margin-left: 4px;
  opacity: 0.85;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
  vertical-align: middle;
}

[data-guest-locked="true"] .notif-lock-icon {
  display: inline-block;
}

[data-guest-locked="true"] .theme-switch {
  opacity: 0.5;
  cursor: not-allowed;
}

[data-guest-locked="true"] .theme-slider {
  background-color: var(--surface-light);
  cursor: not-allowed;
}

[data-guest-locked="true"] .notif-pref-hint {
  opacity: 0.7;
  font-style: italic;
}

/* ============================================================
   50. RESPONSIVE — Notification Dropdown (small screens)
   ============================================================ */
@media (max-width: 480px) {
  .notif-dropdown {
    right: 8px;
    left: 8px;
    width: auto;
    max-width: none;
  }
  .notif-dropdown-item {
    padding: 10px 12px;
  }
}

@media (max-width: 360px) {
  .header-title > span {
    font-size: 0.85rem;
  }
}

/* ============================================================
   51. TEST NOTIFICATION MODAL (radio option cards)
   ============================================================ */
.test-modal-content {
  max-width: 340px;
  text-align: left;
  padding: 18px 16px;
}

.test-modal-content .modal-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
  text-align: center;
}

.test-modal-content .modal-title {
  font-size: 0.92rem;
  text-align: center;
  margin-bottom: 6px;
}

.test-modal-content .modal-desc {
  text-align: center;
  margin-bottom: 16px;
}

.test-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.test-option {
  position: relative;
  cursor: pointer;
  display: block;
}

.test-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.test-option-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-light);
  border: 1.5px solid var(--border-color);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.test-option-box:hover {
  border-color: var(--border-light);
  background: var(--surface-elevated);
}

.test-option-emoji {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
}

.test-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.test-option-text strong {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.test-option-text small {
  font-size: 0.63rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
}

.test-option-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.15s;
}

.test-option-check::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-primary);
  transition: transform 0.15s ease;
}

.test-option input[type="radio"]:checked + .test-option-box {
  border-color: var(--accent-primary);
  background: var(--accent-glow);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.test-option input[type="radio"]:checked + .test-option-box .test-option-check {
  border-color: var(--accent-primary);
}

.test-option input[type="radio"]:checked + .test-option-box .test-option-check::after {
  transform: translate(-50%, -50%) scale(1);
}

.test-option input[type="radio"]:focus-visible + .test-option-box {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ============================================================
   52. ALERT ENHANCEMENTS
   (Status badge + Active border + Reset button)
   ============================================================ */
.alert-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.alert-status-badge.status-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.alert-status-badge.status-used {
  background: rgba(113, 113, 122, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(113, 113, 122, 0.4);
}

.alert-card.active {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.15);
}

.alert-card.triggered {
  opacity: 0.75;
}

.alert-reset-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--accent-primary);
  background: transparent;
  color: var(--accent-primary);
  font-size: 0.65rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  margin-right: 4px;
}

.alert-reset-btn:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 8px var(--accent-glow);
}

.alert-triggered-info {
  color: var(--text-tertiary);
  font-style: italic;
}

.alert-form-container.limit-reached {
  opacity: 0.6;
  pointer-events: none;
}