/* ============================================
   HELPINGTOOLS — DESIGN SYSTEM v1.0
   ============================================ */

/* === STARTUP ANIMATION === */
#app { animation: appFadeIn 0.4s cubic-bezier(0.4,0,0.2,1); }
@keyframes appFadeIn { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }


/* === TOKENS & THEMES === */
:root {
  /* Common */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 999px;
  --nav-h: 64px;
  --header-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* Default: Dark (Deep Night) */
:root, .theme-dark {
  --bg-outer: #050510;
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f28;
  --bg-card: rgba(255,255,255,0.055);
  --bg-card-hover: rgba(255,255,255,0.09);
  --bg-input: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(124,58,237,0.6);
  --accent: #7c3aed;
  --accent-light: #a855f7;
  --accent-dim: rgba(124,58,237,0.25);
  --accent-glow: rgba(124,58,237,0.4);
  --accent-alpha: rgba(124,58,237,0.15);
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-dim: #475569;
  --shadow-glow: 0 0 30px rgba(124,58,237,0.2);
  --card-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

/* Black (AMOLED) */
.theme-black {
  --bg-outer: #000;
  --bg-primary: #000;
  --bg-secondary: #0a0a0a;
  --bg-card: rgba(255,255,255,0.035);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-input: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.1);
  --border-focus: #7c3aed;
  --accent: #7c3aed;
  --accent-light: #a855f7;
  --accent-dim: rgba(124,58,237,0.2);
  --accent-glow: rgba(124,58,237,0.3);
  --accent-alpha: rgba(124,58,237,0.1);
  --text-primary: #fff;
  --text-secondary: #eee;
  --text-muted: #888;
  --text-dim: #555;
  --shadow-glow: none;
  --card-shadow: none;
}

/* White (Pure Light) */
.theme-light {
  --bg-outer: #f1f5f9;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #f8fafc;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #7c3aed;
  --accent: #7c3aed;
  --accent-light: #9333ea;
  --accent-dim: rgba(124,58,237,0.1);
  --accent-glow: rgba(124,58,237,0.2);
  --accent-alpha: rgba(124,58,237,0.05);
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --shadow-glow: 0 4px 12px rgba(124,58,237,0.08);
  --card-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

/* Colorful (Vibrant) */
.theme-colorful {
  --bg-outer: #0f172a;
  --bg-primary: #1e1b4b;
  --bg-secondary: #312e81;
  --bg-card: rgba(255,255,255,0.08);
  --bg-card-hover: rgba(255,255,255,0.15);
  --bg-input: rgba(255,255,255,0.1);
  --border: rgba(255,255,255,0.15);
  --border-focus: #06b6d4;
  --accent: #f43f5e;
  --accent-light: #fb7185;
  --accent-dim: rgba(244,63,94,0.3);
  --accent-glow: rgba(6,182,212,0.5);
  --accent-alpha: rgba(244,63,94,0.2);
  --text-primary: #fff;
  --text-secondary: #fda4af;
  --text-muted: #fb7185;
  --text-dim: #e11d48;
  --shadow-glow: 0 0 40px rgba(244,63,94,0.2);
  --card-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Extra Colors */
:root {
  --cyan: #06b6d4;
  --cyan-dim: rgba(6,182,212,0.2);
  --emerald: #10b981;
  --rose: #f43f5e;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --shadow-card: 0 4px 24px rgba(0,0,0,0.3);
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; font-size: 16px; overflow: hidden; }
body {
  height: 100%;
  height: 100svh;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-outer);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; border: none; outline: none; background: none; }
select { appearance: none; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
img { max-width: 100%; }

/* === APP SHELL === */
#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Desktop: Full page view */
@media (min-width: 900px) {
  #app {
    max-width: 100%;
    margin: 0;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
    border: none;
  }
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important; gap: 20px !important; }
  
  /* Prevent tool content pages from stretching too wide */
  .tool-page { 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 32px 24px;
  }
  
  /* Tools list page desktop */
  .tools-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
  }
  
  /* Form refinements for desktop */
  #bmi-metric-panel, #bmi-imperial-panel, 
  #income-panel, #vat-panel,
  .calculator-form, .emi-form, .product-form, .tax-form {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
  }
  
  /* Ensure tab panels that should be hidden stay hidden */
  #bmi-metric-panel.hidden, #bmi-imperial-panel.hidden, 
  #income-panel.hidden, #vat-panel.hidden { 
    display: none !important; 
  }
  
  .form-group { margin-bottom: 0; }
  .tool-page .btn-primary { 
    width: auto; 
    padding: 14px 40px; 
    align-self: flex-start;
  }
  
  /* Result box centering */
  .result-box { 
    max-width: 600px; 
    margin-top: 24px;
  }
  
  /* Calculator Grid refinement */
  .sci-calc {
    max-width: 460px;
    margin: 0 auto;
  }
  .sci-calc .calc-btn {
    aspect-ratio: unset;
    height: 62px;
    font-size: 1.1rem;
  }
  .sci-calc .calc-btn.fn {
    font-size: 0.85rem;
  }
  .sci-calc .calc-grid {
    gap: 10px;
  }
  
  /* Tool specific grid refinements */
  .notes-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important; gap: 16px !important; }
  .rates-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important; gap: 12px !important; }
  
  /* Task List on desktop */
  .task-list { max-width: 800px; margin: 0 auto; width: 100%; }
  
  /* Currency Hero refinement */
  .currency-hero { max-width: 600px; margin-left: 0; }
  
  /* Fix Home Page on desktop */
  .home-page { max-width: 1200px; margin: 0 auto; padding: 40px 24px; }

  /* Tool List Grid on desktop */
  .tool-list-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}

@media (min-width: 1400px) {
  .tools-grid { grid-template-columns: repeat(5, 1fr) !important; }
  .tool-page { max-width: 1100px; }
  .notes-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* === HEADER === */
.app-header {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  padding-top: var(--safe-top);
  background: rgba(10,10,26,0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative; z-index: 20;
}
.header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-actions { display: flex; align-items: center; gap: 4px; }

.header-brand { display: flex; align-items: baseline; gap: 0; }
.brand-h { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }
.brand-t { font-size: 1.25rem; font-weight: 800; background: linear-gradient(135deg, var(--accent-light), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; letter-spacing: -0.5px; }

.header-page-title {
  font-size: 1.05rem; font-weight: 700; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.back-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-primary); transition: var(--transition);
  flex-shrink: 0;
}
.back-btn:active { background: var(--bg-card-hover); transform: scale(0.92); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: var(--transition);
}
.icon-btn:active { background: var(--bg-card); color: var(--text-primary); transform: scale(0.92); }

/* === SEARCH PANEL === */
.search-panel {
  position: absolute; top: var(--header-h); left: 0; right: 0; bottom: 0;
  z-index: 50; background: var(--bg-primary);
  display: flex; flex-direction: column; padding: 12px 16px;
  animation: slideDown 0.22s ease;
}
@keyframes slideDown { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:none; } }

.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 10px 16px; margin-bottom: 16px;
}
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar input { flex: 1; font-size: 0.95rem; color: var(--text-primary); }
.search-bar input::placeholder { color: var(--text-dim); }
#search-close { color: var(--text-muted); font-size: 1rem; padding: 4px; transition: var(--transition); }
#search-close:active { color: var(--text-primary); }

.search-results { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border); cursor: pointer;
  transition: var(--transition);
}
.search-item:active { background: var(--bg-card-hover); transform: scale(0.98); }
.search-item-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.search-item-info h4 { font-size: 0.9rem; font-weight: 600; }
.search-item-info p { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* === MAIN CONTENT === */
.main-content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  position: relative; scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.main-content::-webkit-scrollbar { width: 3px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 99px; }

/* Page transitions */
.page-enter { animation: pageIn 0.25s cubic-bezier(0.4,0,0.2,1); }
.page-exit { animation: pageOut 0.15s cubic-bezier(0.4,0,0.2,1) forwards; }
@keyframes pageIn { from { opacity:0; transform:translateX(18px); } to { opacity:1; transform:none; } }
@keyframes pageOut { to { opacity:0; transform:translateX(-18px); } }

/* === BOTTOM NAV === */
.bottom-nav {
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  display: flex; align-items: stretch;
  background: rgba(10,10,26,0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  flex-shrink: 0; position: relative; z-index: 20;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 0.65rem; font-weight: 500;
  color: var(--text-dim); transition: var(--transition); position: relative;
  padding: 6px 4px;
}
.nav-btn:active { transform: scale(0.92); }
.nav-btn .nav-icon { width: 22px; height: 22px; transition: var(--transition); }
.nav-btn.active { color: var(--accent-light); }
.nav-btn.active .nav-icon { filter: drop-shadow(0 0 6px var(--accent-glow)); }
.nav-btn::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 0 0 4px 4px; transition: width 0.25s ease;
}
.nav-btn.active::before { width: 40px; }

.nav-badge {
  position: absolute; top: 6px; right: calc(50% - 14px);
  background: var(--rose); color: white;
  font-size: 0.55rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--bg-primary);
}

/* === UTILITY === */
.hidden { display: none !important; }
.page-padding { padding: 16px; }

/* === HOME PAGE === */
.home-page { padding: 20px 16px 24px; }
.home-greeting { margin-bottom: 4px; font-size: 0.85rem; color: var(--text-muted); font-weight: 400; }
.home-title { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); margin-bottom: 20px; letter-spacing: -0.5px; }
.home-title span { background: linear-gradient(135deg, var(--accent-light), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

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

.tools-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }

.tool-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 16px; cursor: pointer; transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative; overflow: hidden;
}
.tool-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(135deg, var(--accent-alpha), rgba(6,182,212,0.06));
  transition: opacity 0.3s; border-radius: inherit;
}
.tool-card::after {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255,255,255,0.07), transparent 70%);
  transition: opacity 0.3s;
}
.tool-card:hover::before { opacity: 1; }
.tool-card:hover { border-color: var(--accent-dim); box-shadow: var(--shadow-glow); transform: translateY(-2px); }
.tool-card:active { transform: scale(0.96) translateY(0); background: var(--bg-card-hover); }
.tool-card:active::after { opacity: 1; }

.tool-card-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.tool-card-name { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.tool-card-desc { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }

/* Quick-access row */
.quick-row { display: flex; gap: 10px; margin-bottom: 24px; overflow-x: auto; padding-bottom: 4px; }
.quick-row::-webkit-scrollbar { display: none; }
.quick-chip {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 10px 16px; cursor: pointer; transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
  white-space: nowrap;
}
.quick-chip:hover { border-color: var(--accent-dim); background: var(--accent-alpha); color: var(--accent-light); }
.quick-chip:active { transform: scale(0.93); }
.quick-chip-icon { font-size: 1.1rem; }

/* === ALL TOOLS PAGE === */
.tools-page { padding: 20px 16px 24px; }
.tool-list-grid { display: flex; flex-direction: column; gap: 8px; }

.tool-list-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; cursor: pointer; transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}
.tool-list-item:hover { border-color: var(--accent-dim); background: var(--accent-alpha); }
.tool-list-item:active { background: var(--bg-card-hover); transform: scale(0.98); }
.tool-list-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.tool-list-info { flex: 1; min-width: 0; }
.tool-list-info h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.tool-list-info p { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.tool-list-arrow { color: var(--text-dim); }

.category-header { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin: 20px 0 10px; }
.category-header:first-child { margin-top: 0; }

/* === CALCULATOR HUB === */
.calc-hub { padding: 20px 16px; }
.calc-sub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-sub-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 16px; cursor: pointer; transition: var(--transition); text-align: center;
}
.calc-sub-card:active { transform: scale(0.95); background: var(--bg-card-hover); }
.calc-sub-icon { font-size: 2rem; margin-bottom: 10px; }
.calc-sub-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.calc-sub-desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* === TOOL PAGE WRAPPER === */
.tool-page { padding: 16px; padding-bottom: 24px; }

/* Form groups */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
  width: 100%; padding: 13px 16px; border-radius: var(--radius-md);
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 0.95rem; transition: var(--transition);
}
.form-input:focus { border-color: var(--border-focus); background: var(--accent-alpha); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-input::placeholder { color: var(--text-dim); }
.form-select {
  width: 100%; padding: 13px 16px; border-radius: var(--radius-md);
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 0.95rem; transition: var(--transition);
  cursor: pointer;
}
.form-select:focus { border-color: var(--border-focus); }
.form-select option { background: #1e1040; color: var(--text-primary); }

.btn-primary {
  width: 100%; padding: 14px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white; font-size: 0.95rem; font-weight: 700;
  transition: var(--transition); letter-spacing: 0.2px;
  box-shadow: 0 4px 20px var(--accent-dim);
}
.btn-primary:active { transform: scale(0.97); box-shadow: none; }

.btn-secondary {
  padding: 12px 20px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 0.9rem; font-weight: 600;
  transition: var(--transition);
}
.btn-secondary:active { background: var(--bg-card-hover); transform: scale(0.97); }

.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn-primary { flex: 1; }

/* Result box */
.result-box {
  background: var(--accent-dim); border: 1px solid var(--accent-alpha);
  border-radius: var(--radius-md); padding: 18px 16px; margin-top: 16px;
  display: none;
}
.result-box.show { display: block; animation: fadeUp 0.3s ease; }
.result-box h3 { font-size: 0.72rem; color: var(--accent-light); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.result-value { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.result-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; }
.result-item { }
.result-item-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 2px; }
.result-item-value { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

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

/* === SCIENTIFIC CALCULATOR === */
.sci-calc { max-width: 100%; }
.calc-display {
  background: rgba(0,0,0,0.35); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 18px;
  margin-bottom: 16px; text-align: right; min-height: 90px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.calc-expr { font-size: 0.85rem; color: var(--text-muted); min-height: 20px; word-break: break-all; }
.calc-result { font-size: 2.2rem; font-weight: 300; color: var(--text-primary); word-break: break-all; }

.calc-mode-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.calc-mode-btn {
  flex: 1; padding: 8px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  transition: var(--transition);
}
.calc-mode-btn.active { background: var(--accent-dim); border-color: var(--accent-alpha); color: var(--accent-light); }

.calc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.calc-grid.sci-mode { grid-template-columns: repeat(5, 1fr); }

.calc-btn {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 1rem; font-weight: 600; color: var(--text-secondary);
  transition: var(--transition); display: flex; align-items: center; justify-content: center;
  min-height: 52px; max-height: 80px; font-family: inherit;
}
.calc-btn:active { transform: scale(0.9); filter: brightness(1.3); }
.calc-btn.op { background: var(--accent-alpha); border-color: var(--accent-dim); color: var(--accent-light); }
.calc-btn.fn { background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.2); color: var(--cyan); font-size: 0.75rem; }
.calc-btn.eq { background: linear-gradient(135deg, var(--accent), var(--accent-light)); border-color: transparent; color: white; box-shadow: 0 4px 16px var(--accent-dim); }
.calc-btn.clr { background: rgba(244,63,94,0.15); border-color: rgba(244,63,94,0.2); color: var(--rose); }
.calc-btn.zero { grid-column: span 2; aspect-ratio: auto; padding: 0 20px; justify-content: flex-start; }

/* === TASK MANAGER === */
.tasks-page { display: flex; flex-direction: column; height: 100%; }
.tasks-header-bar { padding: 16px 16px 0; }
.tasks-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 14px; }
.tasks-title span { background: linear-gradient(135deg, var(--emerald), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.filter-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: var(--radius-full);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
  transition: var(--transition); cursor: pointer;
}
.filter-chip.active { background: var(--accent-dim); border-color: var(--accent-alpha); color: var(--accent-light); }

.task-list { padding: 8px 16px 80px; overflow-y: auto; flex: 1; }
.task-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.task-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.task-empty-text { font-size: 0.9rem; }

.task-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; margin-bottom: 10px; transition: var(--transition);
  display: flex; align-items: flex-start; gap: 12px; position: relative;
}
.task-card.done { opacity: 0.5; }
.task-card.done .task-title { text-decoration: line-through; }
.task-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; margin-top: 1px; transition: var(--transition);
}
.task-check.checked { background: var(--emerald); border-color: var(--emerald); }
.task-check svg { width: 12px; height: 12px; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-due { font-size: 0.72rem; color: var(--text-muted); }
.task-due.overdue { color: var(--rose); }
.priority-badge {
  font-size: 0.65rem; font-weight: 700; padding: 2px 8px;
  border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.5px;
}
.priority-badge.high { background: rgba(244,63,94,0.18); color: var(--rose); }
.priority-badge.medium { background: rgba(245,158,11,0.18); color: var(--amber); }
.priority-badge.low { background: rgba(16,185,129,0.18); color: var(--emerald); }
.status-badge {
  font-size: 0.65rem; font-weight: 700; padding: 2px 8px;
  border-radius: var(--radius-full); text-transform: uppercase; letter-spacing: 0.5px;
}
.status-badge.todo { background: var(--accent-alpha); color: var(--accent-light); }
.status-badge.pending { background: rgba(245,158,11,0.18); color: var(--amber); }
.status-badge.upcoming { background: rgba(6,182,212,0.18); color: var(--cyan); }
.status-badge.done { background: rgba(16,185,129,0.18); color: var(--emerald); }

.task-actions { display: flex; align-items: center; gap: 4px; }
.task-action-btn { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-dim); transition: var(--transition); }
.task-action-btn:active { background: var(--bg-card-hover); color: var(--text-primary); }

.fab {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px); right: calc((100vw - min(430px, 100vw)) / 2 + 20px);
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  color: white; box-shadow: 0 6px 24px var(--accent-dim), 0 0 40px var(--accent-glow);
  transition: var(--transition); z-index: 30;
  animation: fabPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.fab:hover { transform: scale(1.08); box-shadow: 0 8px 32px var(--accent-dim), 0 0 60px var(--accent-glow); }
.fab:active { transform: scale(0.9); }
.fab svg { width: 24px; height: 24px; }
@keyframes fabPop { from { opacity:0; transform:scale(0.5); } to { opacity:1; transform:scale(1); } }

/* === NOTES === */
.notes-page { padding: 16px; }
.notes-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 14px; }
.notes-search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-full);
  padding: 10px 16px; margin-bottom: 16px;
}
.notes-search-bar input { flex: 1; font-size: 0.9rem; }
.notes-search-bar svg { color: var(--text-dim); }

.notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; cursor: pointer; transition: var(--transition); position: relative; min-height: 120px;
}
.note-card:active { transform: scale(0.96); }
.note-card.pinned { border-top: 2px solid var(--amber); }
.note-pin { position: absolute; top: 10px; right: 10px; font-size: 0.8rem; }
.note-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; line-height: 1.3; }
.note-body { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note-date { font-size: 0.65rem; color: var(--text-dim); margin-top: 8px; }
.note-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.note-tag { font-size: 0.62rem; padding: 2px 7px; border-radius: 99px; background: var(--accent-dim); color: var(--accent-light); font-weight: 600; }

.notes-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); grid-column: span 2; }

/* === TEXT CONVERTER === */
.text-area {
  width: 100%; min-height: 120px; padding: 14px 16px;
  border-radius: var(--radius-md); background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text-primary); font-size: 0.9rem; line-height: 1.6;
  resize: vertical; transition: var(--transition);
}
.text-area:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-dim); }
.text-area::placeholder { color: var(--text-dim); }
.converter-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.conv-btn {
  padding: 11px 8px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
  transition: var(--transition); text-align: center;
}
.conv-btn:active { background: var(--accent-dim); color: var(--accent-light); transform: scale(0.96); }
.copy-result-btn {
  padding: 10px 20px; border-radius: var(--radius-sm);
  background: var(--emerald); color: white; font-size: 0.82rem; font-weight: 700;
  transition: var(--transition);
}
.copy-result-btn:active { transform: scale(0.95); }
.char-count { font-size: 0.72rem; color: var(--text-dim); text-align: right; margin-top: 4px; }

/* === IMAGE RESIZER === */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: var(--transition); margin-bottom: 16px;
}
.upload-zone.drag-over { border-color: var(--accent-light); background: var(--accent-dim); }
.upload-zone-icon { font-size: 2.5rem; margin-bottom: 12px; }
.upload-zone-text { font-size: 0.9rem; color: var(--text-muted); }
.upload-zone-sub { font-size: 0.78rem; color: var(--text-dim); margin-top: 6px; }
#img-preview-wrap { display: none; margin-bottom: 16px; }
#img-preview { max-width: 100%; border-radius: var(--radius-md); display: block; }
.img-info { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
.resize-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 12px; }
.resize-sep { color: var(--text-dim); font-size: 1.2rem; text-align: center; }
.lock-ratio-btn { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); transition: var(--transition); }
.lock-ratio-btn.locked { color: var(--accent-light); border-color: var(--accent-dim); background: var(--accent-dim); }

/* === EPOCH === */
.epoch-display {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; text-align: center; margin-bottom: 20px;
}
.epoch-current { font-size: 2.2rem; font-weight: 300; color: var(--cyan); letter-spacing: 2px; }
.epoch-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.epoch-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.epoch-tab {
  flex: 1; padding: 10px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); transition: var(--transition);
}
.epoch-tab.active { background: var(--accent-dim); border-color: var(--accent-alpha); color: var(--accent-light); }

/* === CURRENCY === */
.currency-hero {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(6,182,212,0.1));
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 24px; margin-bottom: 20px; text-align: center;
}
.currency-amount-big { font-size: 2.5rem; font-weight: 800; color: var(--text-primary); }
.currency-from { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.currency-swap-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--accent-dim);
  border: 1px solid var(--accent-alpha); display: flex; align-items: center; justify-content: center;
  margin: 16px auto; color: var(--accent-light); transition: var(--transition);
}
.currency-swap-btn:active { transform: rotate(180deg) scale(0.9); }
.rates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rate-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 12px;
}
.rate-flag { font-size: 1.4rem; margin-bottom: 4px; }
.rate-code { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.rate-value { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-top: 2px; }
.rate-name { font-size: 0.68rem; color: var(--text-dim); }

/* === SETTINGS === */
.settings-page { padding: 16px; }
.settings-section { margin-bottom: 24px; }
.settings-section-title { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 8px;
}
.settings-item-info { }
.settings-item-label { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.settings-item-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.toggle {
  width: 46px; height: 26px; border-radius: 999px; background: var(--bg-input);
  border: 1px solid var(--border); position: relative; cursor: pointer; transition: var(--transition);
  flex-shrink: 0;
}
.toggle::after {
  content: ''; width: 20px; height: 20px; border-radius: 50%; background: var(--text-dim);
  position: absolute; top: 2px; left: 2px; transition: var(--transition);
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { transform: translateX(20px); background: white; }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.modal-box {
  width: 100%; max-width: 430px; background: var(--bg-secondary);
  border-radius: 24px 24px 0 0; border: 1px solid var(--border);
  border-bottom: none; padding: 24px 20px 32px; max-height: 88vh; overflow-y: auto;
  animation: slideUp 0.28s cubic-bezier(0.4,0,0.2,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 4px; background: var(--border); border-radius: 99px; margin: 0 auto 20px; }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; color: var(--text-primary); }

/* === TOAST === */
.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 14px 18px; border-radius: var(--radius-md);
  background: #1e1040; border: 1px solid var(--border);
  color: var(--text-primary); font-size: 0.85rem; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5); pointer-events: all;
  animation: toastIn 0.3s ease; display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 3px solid var(--emerald); }
.toast.error { border-left: 3px solid var(--rose); }
.toast.info { border-left: 3px solid var(--cyan); }
@keyframes toastIn { from { opacity:0; transform:translateY(-12px) scale(0.95); } to { opacity:1; transform:none; } }
@keyframes toastOut { to { opacity:0; transform:translateY(-8px) scale(0.95); } }

/* === BMI GAUGE === */
.bmi-gauge { text-align: center; padding: 16px; }
.bmi-number { font-size: 3rem; font-weight: 800; color: var(--text-primary); }
.bmi-category { font-size: 1rem; font-weight: 600; margin: 4px 0; }
.bmi-bar { height: 8px; border-radius: 99px; background: linear-gradient(90deg, #3b82f6 0%, #22c55e 25%, #f59e0b 60%, #ef4444 100%); position: relative; margin: 16px 0; }
.bmi-indicator { position: absolute; top: -4px; width: 16px; height: 16px; border-radius: 50%; background: white; border: 2px solid #0a0a1a; transform: translateX(-50%); box-shadow: 0 2px 8px rgba(0,0,0,0.5); transition: left 0.5s ease; }

/* === LAND CALC === */
.land-units-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.land-result-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.land-result-row:last-child { border-bottom: none; }
.land-result-label { font-size: 0.82rem; color: var(--text-muted); }
.land-result-val { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }

/* === INFO CARDS === */
.info-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-full);
  font-size: 0.75rem; color: var(--text-muted);
}

/* Divider */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Animated pulse */
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.5;} }
.pulse { animation: pulse 2s infinite; }

/* ============================================================
   PASSWORD MANAGER
   ============================================================ */

/* PIN input row (OTP-style boxes) */
.pin-input-row {
  display: flex; gap: 10px; justify-content: center; margin: 16px 0;
}
.pin-digit {
  width: 48px; height: 58px; border-radius: 14px; text-align: center;
  font-size: 1.5rem; font-weight: 700; color: var(--text-primary);
  background: var(--bg-input); border: 2px solid var(--border);
  transition: all 0.2s; caret-color: var(--accent-light);
  -webkit-text-security: disc;
}
.pin-digit:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--accent-alpha);
  outline: none;
}
.pin-digit:not(:placeholder-shown) {
  border-color: var(--accent-dim);
  background: var(--accent-alpha);
}

/* PIN shake animation for wrong PIN */
@keyframes pinShake {
  0%,100% { transform: translateX(0); }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(6px); }
  75%      { transform: translateX(-4px); }
  90%      { transform: translateX(4px); }
}

/* Password vault card */
.pw-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 12px 14px 14px;
  margin-bottom: 10px; transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  position: relative; overflow: hidden;
}
.pw-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(135deg,#7c3aed,#06b6d4); opacity: 0;
  transition: opacity 0.25s;
}
.pw-card:hover::before { opacity: 1; }
.pw-card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 4px 24px var(--accent-alpha);
}

.pw-card-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.pw-card-body { flex: 1; min-width: 0; }
.pw-card-name {
  font-size: 0.95rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pw-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.pw-meta-item {
  font-size: 0.72rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}

.pw-category-badge {
  display: inline-block; font-size: 0.62rem; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-full);
  color: white; letter-spacing: 0.3px;
}

/* Revealed password row */
.pw-reveal-row {
  margin-top: 8px; padding: 8px 12px;
  background: rgba(0,0,0,0.35); border: 1px solid var(--accent-alpha);
  border-radius: var(--radius-sm); animation: fadeUp 0.2s ease;
}
.pw-revealed-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem; color: var(--cyan); word-break: break-all;
  letter-spacing: 1px;
}

/* Password card action buttons */
.pw-card-actions {
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0;
}
.pw-action-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); transition: var(--transition);
}
.pw-action-btn:hover { color: var(--text-secondary); background: var(--bg-card-hover); }
.pw-action-btn:active { background: var(--accent-dim); color: var(--accent-light); transform: scale(0.9); }

/* Password strength bar */
#pme-str-bar { transition: width 0.4s ease, background 0.4s ease; }

/* Generator panel */
#pme-gen-panel label { color: var(--text-muted); cursor: pointer; }
#pme-gen-panel input[type="checkbox"] { accent-color: var(--accent); }

/* Lock icon animation (image resizer) */
.lock-ratio-btn svg { transition: transform 0.3s ease; }
.lock-ratio-btn:not(.locked) svg { transform: rotate(10deg); }

