:root {
  --bg-primary: #0a0a0c;
  --bg-secondary: #141418;
  --bg-tertiary: #1e1e24;
  --accent-color: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --border-color: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(20, 20, 24, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  /* Detailed Banknote Primary Colors */
  --color-usd: #2d6139;
  --color-eur-5: #4b6584;
  --color-eur-10: #a55eea;
  --color-eur-20: #2d98da;
  --color-eur-50: #fd9644;
  --color-eur-100: #2bcbba;
  
  --color-uzs-1000: #7d6b58;
  --color-uzs-2000: #b05b5b;
  --color-uzs-5000: #427e5d;
  --color-uzs-10000: #386796;
  --color-uzs-20000: #4a3e8f;
  --color-uzs-50000: #733c94;
  --color-uzs-100000: #b59238;
  --color-uzs-200000: #2c8282;
}

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

body {
  background-color: #030303;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* App shell to fit mobile screens perfectly */
#app {
  background-color: var(--bg-primary);
  width: 100%;
  height: 100vh;
  max-width: 480px;
  max-height: 920px;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

@media (min-width: 480px) {
  #app {
    border-radius: 40px;
    height: 95vh;
  }
}

/* Header styling */
.app-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(10, 10, 12, 0.8);
  backdrop-filter: blur(10px);
  z-index: 10;
}

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

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.logo span {
  color: var(--success-color);
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* Language selector */
.lang-selector {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px;
  margin-right: 8px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.currency-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Screen Viewport & Transitions */
.app-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.app-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px;
  z-index: 1;
}

.app-screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
  z-index: 2;
}

/* --- KEYPAD INPUT SCREEN --- */
.input-display-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  min-height: 80px;
}

.input-currency-symbol {
  font-size: 24px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 8px;
  order: 2; /* UZS displays after amount (e.g. 5000 so'm) */
}

.input-amount {
  font-size: 52px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -2px;
  line-height: 1;
  order: 1;
}

.input-cursor {
  width: 3px;
  height: 44px;
  background-color: var(--success-color);
  margin-left: 6px;
  animation: blink 1s infinite alternate;
  box-shadow: 0 0 8px var(--success-color);
  order: 3;
}

@keyframes blink {
  0%, 40% { opacity: 1; }
  60%, 100% { opacity: 0; }
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.category-selector-wrapper {
  margin-bottom: 20px;
}

.category-grid {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px 0;
  scrollbar-width: none;
}

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

.category-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 10px 16px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent-color);
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

.keypad-container {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.keypad-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 500;
  padding: 14px 0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.keypad-btn:active {
  background: var(--bg-tertiary);
  transform: scale(0.95);
}

.backspace-btn, .decimal-btn {
  font-size: 20px;
  color: var(--text-secondary);
}

.action-btn-primary {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 16px;
  border-radius: 16px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
  transition: all 0.2s ease;
}

.action-btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.15);
}

/* --- SCREEN 2: SWIPE SCREEN --- */
#screen-swipe {
  padding: 16px;
  background: radial-gradient(circle at center, #16161b 0%, var(--bg-primary) 100%);
}

.swipe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.swipe-remaining {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.swipe-remaining span {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.swipe-instruction {
  text-align: center;
  margin-bottom: 16px;
}

.instruction-main {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  animation: pulse-down 1.5s infinite ease-in-out;
}

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

@keyframes pulse-down {
  0%, 100% { transform: translateY(0); opacity: 0.8; }
  50% { transform: translateY(-3px); opacity: 1; }
}

.bill-stack-container {
  flex: 1;
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
  margin-bottom: 15px;
}

/* REALISTIC BANKNOTE STYLING */
.banknote {
  position: absolute;
  width: 270px;
  height: 128px;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 3px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  will-change: transform;
}

.banknote:active {
  cursor: grabbing;
}

/* Banknote BG wave patterns & texture */
.banknote-bg-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.45;
  z-index: 0;
}

/* Shimmering Holographic Security Thread */
.banknote-security-thread {
  position: absolute;
  top: 0;
  right: 55px;
  width: 11px;
  height: 100%;
  background: linear-gradient(
    90deg, 
    rgba(212, 175, 55, 0.3) 0%, 
    rgba(255, 255, 255, 0.9) 35%, 
    rgba(180, 180, 180, 0.9) 50%, 
    rgba(255, 255, 255, 0.9) 65%, 
    rgba(212, 175, 55, 0.3) 100%
  );
  background-size: 200% 100%;
  opacity: 0.7;
  z-index: 1;
  animation: thread-shimmer 4s infinite linear;
  mix-blend-mode: overlay;
}

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

.banknote-border-frame {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  pointer-events: none;
  z-index: 1;
}

.banknote-header {
  display: flex;
  justify-content: space-between;
  z-index: 2;
}

.banknote-label {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.75;
}

.banknote-serial-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  font-weight: 700;
  color: #ff3333; /* Typical red serial numbers */
  letter-spacing: 0.5px;
  opacity: 0.85;
}

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

.banknote-seal {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px double rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 22px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.banknote-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 2;
}

.banknote-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  font-weight: 700;
}

/* Realistic Colors (UZS, USD, EUR) */
.banknote.uzs-1000 { background: linear-gradient(135deg, var(--color-uzs-1000) 0%, #473a2e 100%); color: #faf0e6; }
.banknote.uzs-2000 { background: linear-gradient(135deg, var(--color-uzs-2000) 0%, #613333 100%); color: #ffe6e6; }
.banknote.uzs-5000 { background: linear-gradient(135deg, var(--color-uzs-5000) 0%, #244b36 100%); color: #e6f7ec; }
.banknote.uzs-10000 { background: linear-gradient(135deg, var(--color-uzs-10000) 0%, #1d3a59 100%); color: #eaf2fb; }
.banknote.uzs-20000 { background: linear-gradient(135deg, var(--color-uzs-20000) 0%, #292157 100%); color: #ece6ff; }
.banknote.uzs-50000 { background: linear-gradient(135deg, var(--color-uzs-50000) 0%, #441f5a 100%); color: #fae6ff; }
.banknote.uzs-100000 { background: linear-gradient(135deg, var(--color-uzs-100000) 0%, #6e5518 100%); color: #fffbeb; }
.banknote.uzs-200000 { background: linear-gradient(135deg, var(--color-uzs-200000) 0%, #154c4c 100%); color: #e6ffff; }

.banknote.usd {
  background: linear-gradient(135deg, var(--color-usd) 0%, #18331e 100%);
  color: #daf5e1;
}

.banknote.eur-5 { background: linear-gradient(135deg, var(--color-eur-5) 0%, #2c3a4c 100%); color: #eef3f8; }
.banknote.eur-10 { background: linear-gradient(135deg, var(--color-eur-10) 0%, #5d3687 100%); color: #f6eeff; }
.banknote.eur-20 { background: linear-gradient(135deg, var(--color-eur-20) 0%, #165b85 100%); color: #eef9ff; }
.banknote.eur-50 { background: linear-gradient(135deg, var(--color-eur-50) 0%, #995520 100%); color: #fff7ee; }
.banknote.eur-100 { background: linear-gradient(135deg, var(--color-eur-100) 0%, #157368 100%); color: #eefdfb; }

/* --- SPEND HURT METER --- */
.hurt-meter-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 10px 14px;
  margin: 10px auto;
  width: 100%;
  max-width: 290px;
  z-index: 5;
}

.hurt-meter-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#hurt-meter-value {
  color: var(--success-color);
  font-weight: 700;
  transition: color 0.3s;
}

.hurt-meter-bar {
  background: var(--bg-tertiary);
  height: 6px;
  border-radius: 3px;
  width: 100%;
  overflow: hidden;
}

.hurt-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--success-color), #d97706, var(--danger-color));
  transition: width 0.4s ease;
}

.success-pain-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

#success-pain-level {
  font-weight: 700;
  color: var(--danger-color);
}

.swipe-footer {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.swipe-progress-bar {
  background: var(--bg-secondary);
  height: 6px;
  border-radius: 3px;
  width: 100%;
  overflow: hidden;
}

.swipe-progress-fill {
  background: var(--success-color);
  height: 100%;
  transition: width 0.3s ease;
}

#swipe-stats {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* --- SCREEN 3: HISTORY SCREEN --- */
.history-hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: 20px;
  text-align: center;
  margin-bottom: 20px;
}

.hero-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 6px 0;
  letter-spacing: -1px;
}

.hero-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}

.hero-sub span {
  color: var(--success-color);
  font-weight: 600;
}

.history-list-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.history-list-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--danger-color);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.text-link-btn:hover {
  opacity: 1;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  scrollbar-width: none;
}

.history-list::-webkit-scrollbar {
  display: none;
}

.history-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s;
}

.history-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-item-icon {
  background: var(--bg-tertiary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 16px;
}

.history-item-title {
  font-weight: 600;
  font-size: 13px;
}

.history-item-meta {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.history-item-right {
  text-align: right;
}

.history-item-amount {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 14px;
  color: var(--success-color);
}

.history-item-bills {
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 0;
  color: var(--text-tertiary);
  gap: 10px;
}

.empty-icon {
  font-size: 36px;
}

/* --- SETTINGS SCREEN --- */
#screen-settings {
  overflow-y: auto;
  padding-bottom: 24px;
  scrollbar-width: none;
}

#screen-settings::-webkit-scrollbar {
  display: none;
}

.settings-section {
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.settings-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
}

.currency-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-radio-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.settings-radio-card input {
  position: absolute;
  opacity: 0;
}

.settings-radio-card.active {
  border-color: var(--accent-color);
  background: var(--accent-glow);
}

.radio-card-content {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.currency-flag {
  font-size: 22px;
}

.currency-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.currency-denom {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.settings-row {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 14px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.setting-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.setting-subtitle {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 2px;
  max-width: 250px;
  line-height: 1.3;
}

.about-section {
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  margin-top: 20px;
}

/* iOS Toggle Switch styles */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  transition: .2s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-primary);
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--success-color);
  border-color: var(--success-color);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* --- BOTTOM NAVIGATION --- */
.app-nav {
  display: flex;
  background-color: rgba(20, 20, 24, 0.85);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)) 0;
  z-index: 10;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-tertiary);
  cursor: pointer;
  gap: 4px;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--success-color);
}

.nav-icon {
  font-size: 18px;
}

.nav-label {
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
}

/* --- SUCCESS TRANSITION OVERLAY --- */
.success-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(10, 10, 12, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.success-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.success-content {
  text-align: center;
  padding: 30px;
  transform: scale(0.9);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-overlay.active .success-content {
  transform: scale(1);
}

.success-checkmark {
  font-size: 64px;
  margin-bottom: 16px;
  display: inline-block;
  animation: bounce-in 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce-in {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.success-content h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Realistic Banknote Image Background Custom Styling */
.banknote.uzs-image-bg {
  background-size: 104% 104% !important; /* Slightly zoomed to trim any edge white margins */
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 1px solid rgba(0, 0, 0, 0.4) !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 3px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Diagonal Specimen / Namuna Watermark Stamp */
.banknote-namuna-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-size: 26px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.12); /* Subtle watermark */
  letter-spacing: 5px;
  pointer-events: none;
  z-index: 5;
  font-family: 'Outfit', sans-serif;
  border: 3px double rgba(255, 255, 255, 0.12);
  padding: 2px 14px;
  border-radius: 6px;
  text-transform: uppercase;
}

/* History Dashboard Tabs Sub-Navigation */
.history-sub-tabs {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 16px;
  width: 100%;
}

.sub-tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sub-tab-btn.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Subviews toggling */
.subview {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}

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

.subview.active {
  display: flex;
}

/* Period Summary Cards */
.stats-period-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stats-card {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(20, 20, 24, 0.4) 100%);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-card-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Section Wrappers for Statistics elements */
.stats-section-wrapper {
  margin-bottom: 20px;
}

.stats-section-wrapper h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Dynamic Horizontal Category Charts */
.category-bars-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-bar-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stats-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.stats-bar-track {
  background: var(--bg-secondary);
  height: 6px;
  border-radius: 3px;
  width: 100%;
  overflow: hidden;
}

.stats-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pain Index distribution grids */
.pain-tally-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stats-pain-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stats-pain-details {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stats-pain-emoji {
  font-size: 13px;
}

.stats-pain-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stats-pain-count {
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
}


