/* Metric Prism - Mobile Web App Stylesheet */
:root {
  --bg-dark: #0a0f1d;
  --bg-card: rgba(16, 24, 48, 0.72);
  --bg-card-hover: rgba(24, 36, 70, 0.85);
  --border-glass: rgba(0, 242, 254, 0.18);
  --border-glass-light: rgba(255, 255, 255, 0.12);
  --primary-cyan: #00f2fe;
  --primary-blue: #4facfe;
  --accent-purple: #9d4edd;
  --neon-glow: rgba(0, 242, 254, 0.35);
  --text-main: #f0f4fc;
  --text-muted: #8ea1c1;
  --text-dim: #5c6c89;
  --success-color: #00f59b;
  --danger-color: #ff4d6d;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --nav-height: 64px;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-dark);
  font-family: var(--font-family);
  color: var(--text-main);
  overflow-x: hidden;
  position: relative;
}

body {
  background: #0a0f1d url('bg.jpg') center/cover no-repeat fixed;
}

/* Subtle atmospheric backdrop overlay to keep background image completely visible */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 15%, rgba(15, 23, 42, 0.35) 0%, rgba(10, 15, 29, 0.7) 100%);
  pointer-events: none;
  z-index: 0;
}

/* 100% Smartphone Mobile Container */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: rgba(10, 15, 29, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 480px) {
  .app-container {
    border-left: none;
    border-right: none;
  }
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-card {
  background: rgba(18, 28, 56, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass-light);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

/* Top App Header with Safe Area */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px 16px;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
}

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

.brand-logo-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 12px var(--neon-glow);
  background: linear-gradient(135deg, #00f2fe, #4facfe);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.logo-fallback-badge {
  display: none;
  font-weight: 800;
  font-size: 14px;
  color: #0a0f1d;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-cyan);
}

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

.header-icon-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  border: 1px solid var(--border-glass-light);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-icon-btn:active {
  transform: scale(0.94);
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--primary-cyan);
}

.icon-svg {
  width: 20px;
  height: 20px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 16px 16px calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 24px) 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Screen Views Toggle */
.screen-view {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.screen-view.active {
  display: block;
}

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

/* Helper Utilities */
.hidden {
  display: none !important;
}

.gradient-text {
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Section Headings */
.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 10px 0;
}

.section-title-wrap.between {
  justify-content: space-between;
}

.section-heading {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--primary-cyan);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}

.stat-card {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin: 4px 0 2px 0;
}

.stat-hint {
  font-size: 10px;
  color: var(--text-dim);
}

/* Live Express Converter Widget */
.widget-card {
  padding: 16px;
  margin-bottom: 6px;
}

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

.widget-title-wrap {
  display: flex;
  flex-direction: column;
}

.widget-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--primary-cyan);
}

.widget-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.widget-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(0, 242, 254, 0.12);
  color: var(--primary-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
}

.quick-input-grid {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.swap-circle-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-glass);
  background: rgba(0, 242, 254, 0.12);
  color: var(--primary-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 18px;
  transition: all 0.2s ease;
}

.swap-circle-btn svg {
  width: 18px;
  height: 18px;
}

.swap-circle-btn:active {
  transform: scale(0.9) rotate(180deg);
  background: var(--primary-cyan);
  color: #0a0f1d;
}

.widget-footer-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Inputs & Form Controls */
.input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.app-input, .app-select, .unit-dropdown {
  width: 100%;
  height: 44px;
  background: rgba(10, 16, 32, 0.8);
  border: 1px solid var(--border-glass-light);
  border-radius: 12px;
  padding: 0 12px;
  color: #fff;
  font-size: 16px; /* Prevents auto zoom on iOS */
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.app-input:focus, .app-select:focus, .unit-dropdown:focus {
  border-color: var(--primary-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

.app-input.output-accent {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.35);
  font-weight: 700;
  color: var(--primary-cyan);
}

.app-textarea {
  width: 100%;
  background: rgba(10, 16, 32, 0.8);
  border: 1px solid var(--border-glass-light);
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-size: 16px;
  outline: none;
  font-family: inherit;
  resize: vertical;
}

.app-textarea:focus {
  border-color: var(--primary-cyan);
}

.input-with-symbol {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-symbol .app-input {
  padding-right: 36px;
}

.input-symbol {
  position: absolute;
  right: 12px;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.input-with-symbol.big-input-wrap .app-input {
  padding-left: 36px;
  padding-right: 12px;
  font-size: 24px;
  font-weight: 700;
  height: 52px;
}

.input-with-symbol.big-input-wrap .currency-sym {
  left: 14px;
  right: auto;
  font-size: 22px;
  color: var(--primary-cyan);
}

/* Buttons */
.primary-btn {
  height: 48px;
  min-height: 48px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #0a0f1d;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px var(--neon-glow);
}

.primary-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px var(--neon-glow);
}

.secondary-btn {
  height: 48px;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-glass-light);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.secondary-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary-cyan);
}

.small-btn {
  height: 38px;
  min-height: 38px;
  font-size: 13px;
  border-radius: 10px;
  padding: 0 12px;
  width: auto;
}

.danger-outline {
  border-color: rgba(255, 77, 109, 0.4);
  color: var(--danger-color);
}

.danger-outline:active {
  background: rgba(255, 77, 109, 0.15);
}

.action-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

/* Modules Grid */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.module-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  position: relative;
}

.module-card:active {
  transform: scale(0.97);
  border-color: var(--primary-cyan);
}

.module-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.module-icon-wrap svg {
  width: 20px;
  height: 20px;
}

.icon-cyan {
  background: rgba(0, 242, 254, 0.12);
  color: var(--primary-cyan);
}

.icon-blue {
  background: rgba(79, 172, 254, 0.12);
  color: var(--primary-blue);
}

.icon-purple {
  background: rgba(157, 78, 221, 0.15);
  color: #c77dff;
}

.icon-neon {
  background: rgba(0, 245, 155, 0.12);
  color: var(--success-color);
}

.module-details h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.module-details p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.module-arrow {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 14px;
  color: var(--text-dim);
}

/* Recent Activity List */
.recent-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(18, 28, 56, 0.5);
  border: 1px solid var(--border-glass-light);
  border-radius: 12px;
}

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

.recent-icon {
  font-size: 14px;
}

.recent-info h5 {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.recent-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.recent-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-cyan);
}

.empty-state-mini {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

/* Converter Screen */
.categories-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.categories-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

.categories-bar {
  display: flex;
  gap: 8px;
  padding: 2px 0;
}

.category-chip {
  padding: 8px 14px;
  min-height: 40px;
  background: rgba(18, 28, 56, 0.6);
  border: 1px solid var(--border-glass-light);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.category-chip.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(79, 172, 254, 0.2));
  border-color: var(--primary-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.converter-panel {
  padding: 16px;
}

.converter-input-card, .converter-output-card {
  background: rgba(10, 16, 32, 0.6);
  border: 1px solid var(--border-glass-light);
  border-radius: 14px;
  padding: 12px;
}

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

.field-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-action-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.value-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.big-number-input {
  flex: 1;
  background: none;
  border: none;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  outline: none;
  width: 50%;
  font-family: inherit;
}

.big-result-display {
  flex: 1;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-cyan);
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-dropdown {
  width: auto;
  max-width: 140px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 14px;
  height: 38px;
}

.converter-swap-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
  position: relative;
}

.swap-line {
  flex: 1;
  height: 1px;
  background: var(--border-glass-light);
}

.swap-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--primary-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 10px;
  transition: all 0.2s ease;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}

.swap-action-btn svg {
  width: 20px;
  height: 20px;
}

.swap-action-btn:active {
  transform: rotate(180deg) scale(0.9);
  background: var(--primary-cyan);
  color: #0a0f1d;
}

.formula-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 242, 254, 0.06);
  border: 1px dashed rgba(0, 242, 254, 0.25);
  border-radius: 10px;
  padding: 8px 12px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.formula-icon {
  font-weight: bold;
  color: var(--primary-cyan);
}

/* Stepper Bar */
.quick-stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin-top: 12px;
}

.stepper-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.stepper-buttons {
  display: flex;
  gap: 6px;
}

.step-btn {
  padding: 6px 10px;
  min-height: 36px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass-light);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.step-btn:active {
  background: var(--primary-cyan);
  color: #0a0f1d;
}

/* Calculator & Percentage Screen */
.calc-mode-nav {
  display: flex;
  gap: 6px;
  background: rgba(10, 16, 32, 0.6);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--border-glass-light);
  margin-bottom: 12px;
}

.mode-pill {
  flex: 1;
  min-height: 42px;
  background: none;
  border: none;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  padding: 0 4px;
}

.mode-pill.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2), rgba(79, 172, 254, 0.2));
  color: #fff;
  border: 1px solid var(--primary-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.calc-mode-panel {
  padding: 16px;
}

.calc-intro {
  margin-bottom: 14px;
}

.calc-intro h4 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.calc-intro p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.calc-form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.calc-form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pct-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.pct-preset-chip {
  height: 36px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass-light);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.pct-preset-chip.active {
  background: var(--primary-cyan);
  color: #0a0f1d;
  font-weight: 800;
  border-color: var(--primary-cyan);
}

.result-showcase-box {
  background: rgba(10, 16, 32, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  margin-bottom: 14px;
}

.result-lead {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
}

.result-big-number {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-cyan);
  margin: 6px 0;
}

.result-big-number.positive {
  color: var(--success-color);
}

.result-big-number.negative {
  color: var(--danger-color);
}

.result-subtext {
  font-size: 12px;
  color: var(--text-muted);
}

.ratio-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
}

.ratio-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue), var(--primary-cyan));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Tip & Bill Screen */
.tip-panel {
  padding: 16px;
}

.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label-with-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.active-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 242, 254, 0.15);
  color: var(--primary-cyan);
  padding: 2px 8px;
  border-radius: 6px;
}

.tip-chips-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.tip-chip {
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass-light);
  border-radius: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tip-chip.active {
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #0a0f1d;
  border-color: var(--primary-cyan);
}

.custom-tip-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.custom-tip-label {
  font-size: 12px;
  color: var(--text-muted);
}

.small-input {
  width: 90px;
  height: 36px;
  font-size: 14px;
}

.stepper-counter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 16, 32, 0.6);
  border: 1px solid var(--border-glass-light);
  border-radius: 14px;
  padding: 6px;
}

.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:active {
  background: var(--primary-cyan);
  color: #0a0f1d;
}

.stepper-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#split-count-display {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.stepper-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.bill-breakdown-card {
  background: rgba(10, 16, 32, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 16px;
  margin: 14px 0;
}

.breakdown-primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hl-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
}

.hl-value {
  font-size: 34px;
  font-weight: 800;
  color: var(--primary-cyan);
  margin: 4px 0;
}

.hl-sub-label {
  font-size: 13px;
  color: var(--text-muted);
}

.breakdown-divider {
  height: 1px;
  background: var(--border-glass-light);
  margin: 14px 0;
}

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

.breakdown-detail-item {
  display: flex;
  flex-direction: column;
}

.bd-label {
  font-size: 11px;
  color: var(--text-dim);
}

.bd-val {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.bd-val.highlight {
  color: var(--success-color);
}

/* History Screen */
.analytics-card {
  padding: 16px;
  margin-bottom: 12px;
}

.canvas-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 10px 0;
}

#analytics-canvas {
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 8px;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-cyan { background: var(--primary-cyan); }
.dot-blue { background: var(--primary-blue); }
.dot-purple { background: var(--accent-purple); }

.history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.filter-pills-row {
  display: flex;
  gap: 6px;
}

.filter-pill {
  padding: 6px 10px;
  min-height: 34px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.filter-pill.active {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--primary-cyan);
  color: #fff;
}

.history-bulk-actions {
  display: flex;
  gap: 6px;
}

.text-action-btn {
  background: none;
  border: none;
  color: var(--primary-cyan);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 8px;
}

.text-action-btn.danger {
  color: var(--danger-color);
}

.history-feed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: rgba(18, 28, 56, 0.6);
  border: 1px solid var(--border-glass-light);
  border-radius: 12px;
  position: relative;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.history-badge.unit { background: rgba(0, 242, 254, 0.15); color: var(--primary-cyan); }
.history-badge.percentage { background: rgba(79, 172, 254, 0.15); color: var(--primary-blue); }
.history-badge.tip { background: rgba(157, 78, 221, 0.2); color: #c77dff; }

.history-time {
  font-size: 10px;
  color: var(--text-dim);
}

.history-expression {
  font-size: 13px;
  color: var(--text-muted);
}

.history-result-val {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.history-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
}

.history-delete-btn:active {
  color: var(--danger-color);
}

/* Settings Screen */
.settings-group {
  padding: 16px;
  margin-bottom: 12px;
}

.settings-group-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-cyan);
  margin-bottom: 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-meta {
  display: flex;
  flex-direction: column;
}

.settings-label {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.settings-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.inline-select {
  width: auto;
  height: 38px;
  font-size: 13px;
}

.version-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-cyan);
  background: rgba(0, 242, 254, 0.12);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0, 242, 254, 0.25);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-cyan);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: #0a0f1d;
}

/* Fixed Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-item {
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
}

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

.nav-item.active .nav-icon {
  transform: translateY(-2px);
  stroke: var(--primary-cyan);
  filter: drop-shadow(0 0 6px rgba(0, 242, 254, 0.6));
}

.nav-item:active {
  transform: scale(0.92);
}

/* Welcome Onboarding Screen */
#screen-welcome {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 29, 0.95);
  backdrop-filter: blur(20px);
  padding: 20px;
}

.welcome-card {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.welcome-prism-icon {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glow-orb {
  position: absolute;
  width: 70px;
  height: 70px;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.6) 0%, rgba(79, 172, 254, 0) 70%);
  filter: blur(8px);
}

.prism-symbol {
  font-size: 44px;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  z-index: 1;
}

.welcome-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.welcome-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0 20px 0;
  line-height: 1.4;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  text-align: left;
  margin-bottom: 24px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.feature-icon {
  font-size: 20px;
  line-height: 1;
}

.feature-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.feature-info p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.3;
}

.glow-btn {
  box-shadow: 0 0 20px var(--neon-glow);
}

.btn-arrow {
  width: 18px;
  height: 18px;
}

/* Modals & Bottom Sheets */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 150;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}

.modal-sheet-tall {
  max-height: 88vh;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-glass-light);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

.scrollable-legal {
  padding: 16px;
  line-height: 1.5;
  font-size: 13px;
  color: var(--text-muted);
}

.scrollable-legal h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 14px 0 6px 0;
}

.scrollable-legal h4:first-child {
  margin-top: 0;
}

.legal-update-date {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 18px;
}

/* Rating Stars */
.rate-stars-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 36px;
  color: rgba(255, 255, 255, 0.2);
  margin-bottom: 10px;
  cursor: pointer;
}

.star-item.active {
  color: #ffb703;
  text-shadow: 0 0 10px rgba(255, 183, 3, 0.5);
}

.rate-status-text {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 14px;
}

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

/* Share Preview */
.share-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.share-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-cyan), var(--primary-blue));
  color: #0a0f1d;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.share-meta {
  display: flex;
  flex-direction: column;
}

.share-meta strong {
  font-size: 14px;
  color: #fff;
}

.share-meta span {
  font-size: 11px;
  color: var(--text-muted);
}

.input-with-action {
  display: flex;
  gap: 8px;
}

/* Global Toast Notification */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 16, 32, 0.95);
  border: 1px solid var(--primary-cyan);
  box-shadow: 0 4px 20px var(--neon-glow);
  padding: 10px 18px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 300;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast-icon {
  color: var(--primary-cyan);
  font-weight: bold;
}

.toast-message {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
