/* ─── Google Font (Inter) ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --surface2:    #f8fafc;
  --surface3:    #f1f5f9;
  --border:      #e2e8f0;
  --text:        #0f172a;
  --text2:       #475569;
  --text3:       #94a3b8;

  --accent:      #6366f1;
  --accent-dk:   #4f46e5;
  --accent-bg:   #eef2ff;
  --accent-bd:   #c7d2fe;

  --cat-calc:    #6366f1;
  --cat-conv:    #0891b2;
  --cat-fin:     #059669;
  --cat-health:  #e11d48;
  --cat-time:    #d97706;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 3px rgba(0,0,0,.1),  0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,.1),0 10px 10px rgba(0,0,0,.04);

  --nav-h:  56px;
  --tabs-h: 44px;
  --hdr-h:  calc(var(--nav-h) + var(--tabs-h));
  --sb-w:   220px;
  --radius: 10px;
  --radius-lg: 16px;
  --transition: .15s ease;
}
[data-theme="dark"] {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --surface2:    #273348;
  --surface3:    #334155;
  --border:      #334155;
  --text:        #f1f5f9;
  --text2:       #94a3b8;
  --text3:       #475569;
  --accent:      #818cf8;
  --accent-dk:   #6366f1;
  --accent-bg:   rgba(99,102,241,.12);
  --accent-bd:   rgba(99,102,241,.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 6px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 20px rgba(0,0,0,.6),0 4px 6px rgba(0,0,0,.4);
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ─── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
.topbar-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: -.3px;
}
.topbar-brand svg { width: 28px; height: 28px; flex-shrink: 0; }
.topbar-brand span { display: none; }
@media (min-width: 500px) { .topbar-brand span { display: inline; } }
.sidebar-toggle {
  background: none; border: none;
  color: var(--text2); padding: 6px; border-radius: 8px;
  display: none;
}
.sidebar-toggle:hover { background: var(--surface3); }

/* Search */
.search-wrap {
  flex: 1; max-width: 420px; position: relative;
}
.search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text3); pointer-events: none; width: 16px; height: 16px;
}
.search-input {
  width: 100%; height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  background: var(--surface);
}
.search-input::placeholder { color: var(--text3); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 320px; overflow-y: auto;
  z-index: 300;
  display: none;
}
.search-results.open { display: block; }
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--surface2); }
.search-result-cat {
  font-size: 11px; font-weight: 500; padding: 2px 7px;
  border-radius: 20px; flex-shrink: 0;
  background: var(--accent-bg); color: var(--accent);
}
.search-result-label { font-size: 13px; font-weight: 500; }
.search-empty {
  padding: 20px; text-align: center;
  color: var(--text3); font-size: 13px;
}

/* Topbar actions */
.topbar-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.icon-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); width: 34px; height: 34px;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* ─── Category Tabs Bar ─────────────────────────────────────────────────── */
#cat-tabs {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  height: var(--tabs-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0;
  z-index: 99;
  overflow-x: auto;
  scrollbar-width: none;
  box-shadow: var(--shadow-sm);
}
#cat-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  display: inline-flex; align-items: center; gap: 7px;
  height: 100%;
  padding: 0 18px;
  border: none; border-bottom: 3px solid transparent;
  background: none;
  color: var(--text2);
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: color .12s, background .12s, border-color .12s;
  outline: none;
  position: relative;
}
.cat-tab:hover { color: var(--text); background: var(--surface2); }
.cat-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cat-tab[aria-selected="true"] { color: var(--text); font-weight: 600; }
.cat-tab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; opacity: .5; transition: opacity .12s;
}
.cat-tab[aria-selected="true"] .cat-tab-dot { opacity: 1; }

/* ─── App Layout ─────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  margin-top: var(--hdr-h);
  min-height: calc(100vh - var(--hdr-h));
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky; top: var(--hdr-h);
  height: calc(100vh - var(--hdr-h));
  overflow-y: auto; overflow-x: hidden;
  padding: 12px 0 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Sidebar category header label */
.sb-cat-hdr {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 16px 10px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text3);
}
.sb-cat-hdr-icon {
  width: 22px; height: 22px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sb-cat-hdr-icon svg { width: 12px; height: 12px; }

/* Sidebar empty state */
.sb-empty {
  padding: 32px 16px; text-align: center;
  color: var(--text3); font-size: 13px; line-height: 1.6;
}
.sb-empty svg { width: 32px; height: 32px; margin: 0 auto 10px; display: block; opacity: .4; }

/* Subcategory items */
.nav-sub {
  display: block; width: 100%;
  padding: 9px 14px 9px 16px;
  border: none; border-left: 3px solid transparent;
  background: none; text-align: left;
  font-size: 13px; font-weight: 500; font-family: inherit;
  color: var(--text2); cursor: pointer;
  transition: all var(--transition);
  outline: none;
}
.nav-sub:hover { color: var(--text); background: var(--surface2); }
.nav-sub:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nav-sub.active {
  color: var(--accent); font-weight: 600;
  background: var(--accent-bg);
  /* border-left color set inline per category */
}

/* ─── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1; min-width: 0;
  padding: 32px 36px;
  overflow-y: auto;
}

/* ─── Home Page ──────────────────────────────────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, var(--accent-dk) 0%, var(--accent) 50%, #8b5cf6 100%);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  margin-bottom: 36px;
  color: white;
  position: relative;
  overflow: hidden;
}
.home-hero::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Ccircle cx='20' cy='20' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.home-hero-content { position: relative; z-index: 1; }
.home-hero h1 {
  font-size: 32px; font-weight: 700;
  line-height: 1.2; margin-bottom: 10px;
  letter-spacing: -.5px;
}
.home-hero p {
  font-size: 16px; opacity: .85; margin-bottom: 24px; max-width: 500px;
}
.home-stats {
  display: flex; gap: 20px; flex-wrap: wrap;
}
.home-stat {
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}
.home-stat svg { width: 14px; height: 14px; opacity: .8; }

/* Section headers */
.section-hdr {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; margin-top: 8px;
}
.section-title {
  font-size: 16px; font-weight: 600; color: var(--text);
  flex: 1;
}
.section-title span { color: var(--text3); font-weight: 400; font-size: 13px; }

/* Category cards grid */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
  box-shadow: var(--shadow-sm);
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.cat-card-header {
  padding: 22px 22px 18px;
  position: relative;
}
.cat-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  background: rgba(255,255,255,.18);
}
.cat-card-icon svg { width: 24px; height: 24px; color: white; }
.cat-card-name { font-size: 17px; font-weight: 700; color: white; margin-bottom: 4px; }
.cat-card-count { font-size: 12px; color: rgba(255,255,255,.75); }
.cat-card-body { padding: 16px 22px 20px; }
.cat-card-desc { font-size: 13px; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }
.cat-card-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-tool-tag {
  font-size: 11px; font-weight: 500; padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text2); background: var(--surface2);
  white-space: nowrap;
}

/* Popular tools */
.popular-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 40px;
}
.pop-card {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 16px;
  cursor: pointer; transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.pop-card:hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.pop-card-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pop-card-label { font-size: 13px; font-weight: 500; color: var(--text); }
.pop-card-cat { font-size: 11px; color: var(--text3); }

/* ─── Tool Page ──────────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text3);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text3); cursor: pointer; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text3); }

.tool-page {}
.tool-hdr {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 28px; padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.tool-hdr-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tool-hdr-icon svg { width: 26px; height: 26px; color: white; }
.tool-hdr-info {}
.tool-hdr-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -.3px; }
.tool-hdr-desc { font-size: 13px; color: var(--text2); line-height: 1.6; }

/* Tool body - 2 column on desktop */
.tool-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.tool-body.single-col { grid-template-columns: 1fr; }
.tool-body.three-col  { grid-template-columns: 1fr 1fr 1fr; }

/* ─── Panels (inputs / results) ──────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.panel-hdr {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text3);
  display: flex; align-items: center; gap: 8px;
}
.panel-hdr svg { width: 13px; height: 13px; }
.panel-body { padding: 20px; }

/* ─── Form elements ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text2); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.form-input, .form-select {
  width: 100%; height: 42px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-size: 15px; font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-appearance: none; appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  background: var(--surface);
}
.form-input::placeholder { color: var(--text3); }
.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

/* Slider */
.form-slider { width: 100%; margin-top: 4px; accent-color: var(--accent); }
.slider-labels {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text3); margin-top: 4px;
}

/* ─── Result Panel ────────────────────────────────────────────────────────── */
.result-primary-wrap {
  text-align: center; padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}
.result-primary-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text3); margin-bottom: 8px;
}
.result-primary-value {
  font-size: 40px; font-weight: 700; color: var(--accent);
  letter-spacing: -1.5px; line-height: 1;
  transition: transform .2s ease;
}
.result-primary-value.pulse { animation: vpulse .3s ease; }
@keyframes vpulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
.result-rows { padding: 8px 0; }
.result-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px;
  transition: background var(--transition);
}
.result-row:hover { background: var(--surface2); }
.result-row + .result-row { border-top: 1px solid var(--border); }
.result-row-label { font-size: 13px; color: var(--text2); }
.result-row-value { font-size: 14px; font-weight: 600; color: var(--text); }
.result-copy-btn {
  background: none; border: none;
  color: var(--text3); padding: 3px 6px; border-radius: 5px;
  opacity: 0; transition: opacity var(--transition);
  font-size: 11px; margin-left: 8px; cursor: pointer;
}
.result-row:hover .result-copy-btn { opacity: 1; }
.result-copy-btn:hover { color: var(--accent); background: var(--accent-bg); }

/* ─── Simple Calculator ───────────────────────────────────────────────────── */
.calc-wrap { max-width: 320px; }
.calc-display {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  margin-bottom: 12px; text-align: right;
}
.calc-expr {
  font-size: 13px; color: var(--text3); min-height: 20px;
  margin-bottom: 4px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.calc-val {
  font-size: 40px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: -1px; line-height: 1.1;
}
.calc-mode-tabs {
  display: flex; margin-bottom: 10px; gap: 6px;
}
.calc-mode-tab {
  flex: 1; padding: 6px; font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 7px;
  background: none; color: var(--text2);
  cursor: pointer; transition: all var(--transition);
}
.calc-mode-tab.active {
  border-color: var(--accent); background: var(--accent-bg); color: var(--accent);
}
.calc-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.calc-grid.sci { grid-template-columns: repeat(4,1fr); }
.calc-sci-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 8px; }
.cb {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 10px; height: 56px;
  font-size: 17px; font-weight: 500;
  color: var(--text); font-family: inherit;
  transition: all .08s ease; outline: none;
  display: flex; align-items: center; justify-content: center;
}
.cb:hover { background: var(--border); }
.cb:active { transform: scale(.93); }
.cb:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cb.op  { color: var(--accent); background: var(--accent-bg); border-color: var(--accent-bd); }
.cb.clr { color: #ef4444; }
.cb.eq  { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.cb.eq:hover { background: var(--accent-dk); }
.cb.sp2 { grid-column: span 2; }
.cb.sci-fn { font-size: 13px; height: 44px; }

/* ─── Converter ───────────────────────────────────────────────────────────── */
.conv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
@media (max-width: 500px) { .conv-grid { grid-template-columns: 1fr; } }

/* ─── Tags / Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px; white-space: nowrap;
}
.badge-indigo  { background: #eef2ff; color: #4f46e5; }
.badge-cyan    { background: #e0f7fa; color: #0277bd; }
.badge-emerald { background: #ecfdf5; color: #065f46; }
.badge-rose    { background: #fff1f2; color: #be123c; }
.badge-amber   { background: #fffbeb; color: #92400e; }
[data-theme="dark"] .badge-indigo  { background: rgba(99,102,241,.15); color: #818cf8; }
[data-theme="dark"] .badge-cyan    { background: rgba(8,145,178,.15);  color: #38bdf8; }
[data-theme="dark"] .badge-emerald { background: rgba(5,150,105,.15);  color: #34d399; }
[data-theme="dark"] .badge-rose    { background: rgba(225,29,72,.15);  color: #fb7185; }
[data-theme="dark"] .badge-amber   { background: rgba(217,119,6,.15);  color: #fbbf24; }

/* ─── Info box ───────────────────────────────────────────────────────────── */
.info-box {
  background: var(--accent-bg); border: 1px solid var(--accent-bd);
  border-radius: 8px; padding: 12px 16px;
  font-size: 13px; color: var(--text2);
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 16px;
}
.info-box svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; margin-top: 1px; }

/* ─── Amortization Table ─────────────────────────────────────────────────── */
.amort-toggle-btn {
  width: 100%; padding: 10px; margin-top: 16px;
  background: none; border: 1px dashed var(--border);
  border-radius: 8px; color: var(--text2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.amort-toggle-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.amort-wrap { overflow-x: auto; margin-top: 12px; display: none; }
.amort-wrap.open { display: block; }
.amort-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.amort-table th {
  padding: 8px 10px; text-align: left; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text3); border-bottom: 2px solid var(--border);
  background: var(--surface2);
}
.amort-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text2); }
.amort-table tr:hover td { background: var(--surface2); }

/* ─── Tip Calculator ─────────────────────────────────────────────────────── */
.tip-presets { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tip-preset {
  padding: 5px 14px; border: 1.5px solid var(--border);
  border-radius: 20px; background: none; font-size: 13px; font-weight: 500;
  color: var(--text2); cursor: pointer; transition: all var(--transition);
}
.tip-preset.active, .tip-preset:hover {
  border-color: var(--accent); background: var(--accent-bg); color: var(--accent);
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
.fade-in { animation: fadeIn .18s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.slide-down { animation: slideDown .2s ease both; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.open {
    display: block; position: fixed;
    top: var(--hdr-h); left: 0; bottom: 0;
    z-index: 150; box-shadow: var(--shadow-xl);
  }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 140;
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: flex; }
  #cat-tabs { padding: 0 4px; }
  .cat-tab  { padding: 0 12px; font-size: 12px; }
  .main-content { padding: 20px 16px 40px; }
  .tool-body { grid-template-columns: 1fr; }
  .tool-body.three-col { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .cats-grid { grid-template-columns: 1fr; }
  .home-hero { padding: 32px 24px; }
  .home-hero h1 { font-size: 24px; }
  .home-hero p { font-size: 14px; }
  .calc-wrap { max-width: 100%; }
  .cb { height: 50px; font-size: 16px; }
  .result-primary-value { font-size: 32px; }
}
@media (max-width: 400px) {
  .home-stats { flex-direction: column; gap: 10px; }
  .cb { height: 44px; font-size: 14px; }
}

/* ─── Scrollbar styling ──────────────────────────────────────────────────── */
.main-content {
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .topbar, .sidebar, .sidebar-overlay { display: none; }
  .app-layout { margin-top: 0; }
  .main-content { overflow: visible; }
}
