/* ============================
   AppCafe Tools — shared styles
   theme: emerald green
   ============================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:        #10b981;
  --accent-hover:  #059669;
  --accent-light:  rgba(16,185,129,0.12);
  --accent-glow:   rgba(16,185,129,0.2);
  --bg:            #0f172a;
  --surface:       #1e293b;
  --border:        #334155;
  --text:          #f1f5f9;
  --muted:         #94a3b8;
  --danger:        #f87171;
  --warn:          #fbbf24;
  --radius:        14px;
  --shadow:        0 2px 16px rgba(0,0,0,0.3), 0 1px 4px rgba(0,0,0,0.2);
  --shadow-hover:  0 6px 28px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
}

/* ── Light theme ──────────────────── */
[data-theme="light"] {
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --muted:        #64748b;
  --shadow:       0 2px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.05);
  --shadow-hover: 0 6px 28px rgba(0,0,0,0.13), 0 2px 8px rgba(0,0,0,0.07);
}
[data-theme="light"],
[data-theme="light"] body { background: #f8fafc; color: #0f172a; }

/* header in light */
[data-theme="light"] header {
  background: #059669;
  border-bottom-color: #047857;
}
/* nav dropdowns in light — green to match header */
[data-theme="light"] .nav-cat-menu {
  background: #059669;
  border-color: #047857;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
[data-theme="light"] .nav-cat-item { color: #ffffff; }
[data-theme="light"] .nav-cat-item:hover { background: #047857; color: #ffffff; }
/* bottom sheet in light */
[data-theme="light"] .nav-mobile { background: #ffffff; border-top-color: #d1fae5; }
[data-theme="light"] .mob-handle { background: #a7f3d0; }
[data-theme="light"] .mob-search-wrap { background: #ffffff; }
[data-theme="light"] .mob-search { background: #f0fdf4; border-color: #a7f3d0; color: #0f172a; }
[data-theme="light"] .mob-item { color: #1e293b; }
[data-theme="light"] .mob-item:active { background: #ecfdf5; }
[data-theme="light"] .mob-divider { background: #d1fae5; }
[data-theme="light"] .mob-plain { color: #64748b; }
/* powered bar in light — matches green header */
[data-theme="light"] .powered-bar {
  background: #059669;
  border-top-color: #047857;
}
[data-theme="light"] .powered-pages a { color: rgba(255,255,255,0.7); }
[data-theme="light"] .powered-pages a:hover { color: #ffffff; }
[data-theme="light"] .powered-label { color: rgba(255,255,255,0.6); }
[data-theme="light"] .powered-brand { color: #ffffff; }
[data-theme="light"] .powered-link:hover .powered-brand { color: #d1fae5; }
/* note callout in light */
[data-theme="light"] .note { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.4); }
/* result box in light */
[data-theme="light"] .result-box { background: rgba(16,185,129,0.06); }
/* table rows in light */
[data-theme="light"] tr:nth-child(even) { background: #f8fafc; }

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────── */
header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center;
  padding: 0 1.5rem;
  height: 56px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}
.logo { display: flex; align-items: center; gap: .5rem; text-decoration: none; flex-shrink: 0; }
.logo-icon { display: block; }
.logo-word { font-size: 1.15rem; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.logo-app  { color: #10b981; }
.logo-cafe { color: #fff; font-size: 1.15rem; font-weight: 700; letter-spacing: -.3px; }

/* ── Desktop nav ──────────────────── */
.nav-desktop {
  display: flex; align-items: center; gap: .25rem;
  flex: 1; margin-left: 1.5rem;
}
.nav-desktop .nav-plain {
  font-size: .875rem; font-weight: 600;
  color: #cbd5e1; text-decoration: none; opacity: .9;
  padding: .3rem .65rem; border-radius: 6px;
  transition: opacity .15s, background .15s;
}
.nav-desktop .nav-plain:hover { opacity: 1; background: rgba(255,255,255,0.07); color: #f1f5f9; }

/* category dropdown */
.nav-cat { position: relative; }
.nav-cat-btn {
  display: flex; align-items: center; gap: .25rem;
  background: none; border: none; cursor: pointer;
  font-size: .875rem; font-weight: 600;
  color: #cbd5e1; opacity: .9; padding: .3rem .65rem;
  border-radius: 6px; transition: opacity .15s, background .15s;
}
.nav-cat-btn:hover,
.nav-cat.open .nav-cat-btn { opacity: 1; background: rgba(255,255,255,0.07); color: #f1f5f9; }
.nav-chevron { width: 13px; height: 13px; flex-shrink: 0; transition: transform .2s; }
.nav-cat.open .nav-chevron { transform: rotate(180deg); }

.nav-cat-menu {
  display: none;
  position: absolute; top: calc(100% + 10px); left: 0;
  background: #1e293b; border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
  min-width: 210px; padding: .4rem 0;
  z-index: 200; border: 1px solid #334155;
}
.nav-cat.open .nav-cat-menu { display: block; }

.nav-cat-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .45rem 1rem;
  font-size: .875rem; color: #cbd5e1; text-decoration: none;
  transition: background .12s; white-space: nowrap;
}
.nav-cat-item:hover { background: #334155; color: #f1f5f9; }
.nav-divider { height: 1px; background: var(--border); margin: .3rem 0; }

/* ── Theme toggle button ──────────── */
.theme-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  cursor: pointer;
  padding: .25rem .5rem;
  font-size: .85rem;
  line-height: 1;
  transition: background .2s;
  display: flex; align-items: center;
}
.theme-toggle:hover { background: rgba(255,255,255,0.18); }
.theme-icon-dark  { display: block; }
.theme-icon-light { display: none;  }
[data-theme="light"] .theme-icon-dark  { display: none;  }
[data-theme="light"] .theme-icon-light { display: block; }

/* ── Hamburger (mobile only) ──────── */
.nav-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: .3rem; color: #cbd5e1; margin-left: auto;
}
.nav-hamburger svg { display: block; width: 24px; height: 24px; }

/* ── Bottom sheet backdrop ────────── */
.nav-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,0);
  transition: background .25s;
}
.nav-backdrop.open { display: block; background: rgba(0,0,0,.55); }

/* ── Bottom sheet ─────────────────── */
.nav-mobile {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: #1e293b;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid #334155;
  max-height: 82vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.32,1,.36,1);
  padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
}
.nav-mobile.open { transform: translateY(0); }

/* drag handle */
.mob-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: #475569; margin: .75rem auto .25rem; pointer-events: none;
}

/* search box */
.mob-search-wrap {
  padding: .5rem 1rem .75rem;
  position: sticky; top: 0; background: #1e293b; z-index: 1;
}
.mob-search {
  width: 100%; box-sizing: border-box;
  background: #0f172a; border: 1.5px solid #334155; border-radius: 10px;
  padding: .55rem .85rem .55rem 2.25rem;
  font-size: .9rem; color: #f1f5f9; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='6.5' cy='6.5' r='4'/%3E%3Cpath d='M11 11l2.5 2.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: .65rem center;
}
.mob-search:focus { border-color: #10b981; }
.mob-search::placeholder { color: #64748b; }

.mob-section-label {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: #10b981;
  padding: .65rem 1rem .2rem;
}
.mob-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem 1rem;
  font-size: .9375rem; font-weight: 500;
  color: #cbd5e1; text-decoration: none;
  border-radius: 10px; margin: 0 .5rem;
  transition: background .12s;
}
.mob-item:active { background: #0f172a; }
.mob-item.hidden { display: none; }
.mob-divider { height: 1px; background: #334155; margin: .4rem 1rem; }
.mob-plain {
  display: block; padding: .65rem 1rem;
  font-size: .9rem; font-weight: 600;
  color: #64748b; text-decoration: none;
  margin: 0 .5rem; border-radius: 10px;
}
.mob-plain:active { background: #0f172a; }
.mob-no-results {
  display: none; text-align: center;
  padding: 2rem 1rem; color: #475569; font-size: .9rem;
}

/* ── Back link ────────────────────── */
.header-back {
  display: flex; align-items: center; gap: .4rem;
  font-size: .875rem; font-weight: 600;
  color: #fff; opacity: 0.9; text-decoration: none;
  transition: opacity .15s;
}
.header-back:hover { opacity: 1; }
.header-back svg { width:16px; height:16px; }

/* ── Responsive breakpoint ────────── */
@media (max-width: 768px) {
  .nav-desktop { display: none; }
  .nav-hamburger { display: block; }
}

/* ── Main ─────────────────────────── */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 2rem 2rem 5rem; }

/* ── Hero (index) ─────────────────── */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero-eyebrow {
  display: inline-block; margin-bottom: .75rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; line-height: 1.15; margin-bottom: .75rem; }
.hero p { color: var(--muted); font-size: 1.05rem; max-width: 560px; margin: 0 auto 2rem; }

/* ── Search ───────────────────────── */
.search-wrap { max-width: 480px; margin: 0 auto 2rem; position: relative; }
.search-box {
  display: flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 0 .75rem; gap: .5rem;
  transition: border-color .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-icon { color: var(--muted); font-size: 1rem; flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: .9375rem; padding: .65rem 0; color: var(--text);
}
.search-input::placeholder { color: #9ca3af; }
.search-kbd {
  font-size: .7rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 5px; font-family: monospace;
  flex-shrink: 0;
}
.search-clear {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1rem; padding: 0; line-height: 1;
}
.search-clear.visible { display: block; }
.no-results { display: none; text-align: center; font-size: .875rem; color: var(--muted); margin-top: .75rem; }
.no-results.visible { display: block; }

/* ── Category sections ────────────── */
.section { margin-bottom: 2.5rem; }
.section.empty { display: none; }
.section-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1rem; padding-bottom: .4rem;
  border-bottom: 1.5px solid var(--accent-light);
}

/* ── Cards grid ───────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex; flex-direction: column; gap: .5rem;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .22s ease, border-color .22s ease;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
/* shimmer sweep on hover */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(16,185,129,0.12) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform .5s ease;
  pointer-events: none;
}
.card:hover::before { transform: translateX(100%); }
.card:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 12px 36px rgba(16,185,129,0.18), 0 4px 12px rgba(0,0,0,0.08);
  border-color: var(--accent);
}
.card.hidden { display: none; }
.card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; margin-bottom: .25rem;
  flex-shrink: 0;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.card:hover .card-icon { transform: scale(1.18) rotate(-4deg); }
.card h3 { font-size: .9375rem; font-weight: 700; }
.card p { font-size: .8125rem; color: var(--muted); line-height: 1.5; flex: 1; }
.card-arrow {
  font-size: .75rem; color: var(--accent); font-weight: 600; margin-top: auto;
  display: inline-flex; align-items: center; gap: .25rem;
  transition: gap .2s ease, opacity .2s ease;
}
.card:hover .card-arrow { gap: .5rem; opacity: 1; }

/* ── Tool page wrapper ────────────── */
.tool-wrap { max-width: 100%; margin: 0 auto; }
.tool-wrap .tool-header { max-width: 560px; }
.input-panel { max-width: 560px; }
.tool-header { margin-bottom: 1.75rem; }
.tool-header h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: .35rem; }
.tool-header p { color: var(--muted); font-size: .9375rem; }

/* ── Panel ────────────────────────── */
.panel {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

/* ── Form elements ────────────────── */
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
label {
  display: block; font-size: .8125rem; font-weight: 600;
  color: var(--muted); margin-bottom: .35rem;
}
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%; border: 2px solid #475569; border-radius: 8px;
  padding: .6rem .75rem; font-size: .9375rem; color: var(--text);
  background: var(--bg); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 0 12px rgba(16,185,129,0.15);
}
.input-group {
  display: flex; align-items: center;
  border: 2px solid #475569; border-radius: 8px;
  background: var(--bg); overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow), 0 0 12px rgba(16,185,129,0.15); }
.input-group input {
  border: none; border-radius: 0; flex: 1; background: transparent;
  box-shadow: none !important;
}
.input-group .affix {
  padding: 0 .75rem; font-size: .8125rem; font-weight: 600;
  color: var(--muted); white-space: nowrap; background: var(--accent-light);
  border: none; border-radius: 0;
  align-self: stretch; display: flex; align-items: center;
}
.affix-left { border-right: 1.5px solid var(--border); }
.affix-right { border-left: 1.5px solid var(--border); }

/* ── Buttons ──────────────────────── */
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.25rem; border-radius: 8px;
  font-size: .9375rem; font-weight: 600; cursor: pointer;
  border: none; transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover { background: var(--accent-light); }
.btn-ghost { background: var(--accent-light); color: var(--accent); }
.btn-ghost:hover { background: rgba(16,185,129,0.22); }

/* ── Result box ───────────────────── */
.result-box {
  background: var(--accent-light); border: 1.5px solid rgba(16,185,129,0.35);
  border-radius: 10px; padding: 1.25rem 1.5rem;
  margin-top: 1.25rem;
}
.result-box.hidden { display: none; }
.result-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .25rem; }
.result-value { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.result-sub { font-size: .8125rem; color: var(--muted); margin-top: .25rem; }
.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem;
  margin-top: 1.25rem;
}
.result-cell {
  background: var(--accent-light); border: 1.5px solid rgba(16,185,129,0.35);
  border-radius: 10px; padding: 1rem;
}
.result-cell .result-label { margin-bottom: .15rem; }
.result-cell .result-value { font-size: 1.35rem; }

/* ── Note / disclaimer ────────────── */
.note {
  font-size: .8rem; color: var(--muted); line-height: 1.6;
  background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.25); border-radius: 8px;
  padding: .75rem 1rem; margin-top: 1rem;
}
.note strong { color: var(--warn); }

/* ── Calculator display ───────────── */
.calc-display {
  background: #022c22; border-radius: 10px;
  padding: 1rem 1.25rem; margin-bottom: 1rem; text-align: right;
  min-height: 80px; display: flex; flex-direction: column; justify-content: flex-end;
}
.calc-expr { font-size: .8125rem; color: #6ee7b7; min-height: 1.2em; word-break: break-all; }
.calc-num { font-size: 2.25rem; font-weight: 700; color: #fff; word-break: break-all; letter-spacing: -.5px; }
.calc-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem;
}
.calc-btn {
  padding: .9rem .5rem; border-radius: 9px; border: none; cursor: pointer;
  font-size: 1.05rem; font-weight: 600;
  transition: filter .12s, transform .1s;
}
.calc-btn:active { transform: scale(.94); filter: brightness(.88); }
.calc-btn-num { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.calc-btn-num:hover { background: #2d3f55; }
.calc-btn-op  { background: var(--accent-light); color: var(--accent); }
.calc-btn-op:hover { background: rgba(16,185,129,0.22); }
.calc-btn-eq  { background: var(--accent); color: #fff; }
.calc-btn-eq:hover { background: var(--accent-hover); }
.calc-btn-clear { background: rgba(248,113,113,0.12); color: var(--danger); }
.calc-btn-clear:hover { background: rgba(248,113,113,0.22); }
.calc-btn-fn  { background: rgba(99,102,241,0.12); color: #a5b4fc; font-size: .85rem; }
.calc-btn-fn:hover { background: rgba(99,102,241,0.22); }
.calc-btn-wide { grid-column: span 2; }

/* ── Calculator light theme ──────────── */
[data-theme="light"] .calc-display { background: #e8f5f0; }
[data-theme="light"] .calc-expr { color: #059669; }
[data-theme="light"] .calc-num { color: #0f172a; }
[data-theme="light"] .calc-btn-num { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
[data-theme="light"] .calc-btn-num:hover { background: #e2e8f0; }
[data-theme="light"] .calc-btn-fn { background: rgba(99,102,241,0.1); color: #4f46e5; }
[data-theme="light"] .calc-btn-fn:hover { background: rgba(99,102,241,0.2); }
[data-theme="light"] .calc-btn-op { background: var(--accent-light); color: #059669; }
[data-theme="light"] .calc-btn-op:hover { background: rgba(16,185,129,0.2); }
[data-theme="light"] .calc-btn-clear { background: rgba(239,68,68,0.1); color: #dc2626; }
[data-theme="light"] .calc-btn-clear:hover { background: rgba(239,68,68,0.2); }

/* ── Tip splitter layout ──────────── */
.tip-layout {
  display: flex; gap: 1.5rem; align-items: flex-start;
}
.tip-results-col {
  flex: 1; min-width: 0;
  position: sticky; top: 72px;
}
@media (max-width: 640px) {
  .tip-layout { flex-direction: column; }
  .tip-results-col { position: static; width: 100%; }
}

/* ── Tip splitter specifics ───────── */
.people-row { display: flex; align-items: center; gap: .75rem; }
.people-row input { flex: 1; }
.stepper { display: flex; }
.stepper button {
  width: 36px; height: 36px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1.1rem;
  cursor: pointer; transition: background .12s;
  display: flex; align-items: center; justify-content: center;
}
.stepper button:first-child { border-radius: 8px 0 0 8px; border-right: none; }
.stepper button:last-child  { border-radius: 0 8px 8px 0; border-left: none; }
.stepper button:hover { background: var(--accent-light); }
.stepper .stepper-val {
  width: 44px; text-align: center; border: 1.5px solid var(--border);
  font-size: .9375rem; font-weight: 700; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.tip-presets { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.tip-preset-btn {
  padding: .3rem .75rem; border-radius: 20px;
  border: 1.5px solid var(--border); background: var(--surface);
  font-size: .8125rem; font-weight: 600; cursor: pointer; color: var(--muted);
  transition: all .15s;
}
.tip-preset-btn.active,
.tip-preset-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Unit converter tabs ──────────── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-btn {
  padding: .45rem 1rem; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--surface); font-size: .8125rem; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.tab-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-btn:hover:not(.active) { background: var(--accent-light); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── BMI meter ────────────────────── */
.bmi-bar-wrap { margin: 1rem 0; }
.bmi-bar {
  height: 12px; border-radius: 6px; position: relative;
  background: linear-gradient(to right, #60a5fa 0%, #34d399 18.5%, #fbbf24 25%, #f97316 30%, #ef4444 40%, #ef4444 100%);
}
.bmi-marker {
  position: absolute; top: -5px;
  width: 4px; height: 22px; background: #111;
  border-radius: 2px; transform: translateX(-50%);
  transition: left .4s cubic-bezier(.4,0,.2,1);
}
.bmi-labels { display: flex; justify-content: space-between; margin-top: .4rem; font-size: .7rem; color: var(--muted); }

/* ── Amortisation table ───────────── */
.amort-table-wrap { overflow-x: auto; margin-top: 1rem; max-height: 320px; overflow-y: auto; border-radius: 8px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
th, td { padding: .5rem .75rem; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--accent-light); font-weight: 700; color: var(--accent); position: sticky; top: 0; text-align: right; }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: none; }


/* ── Powered bar ──────────────────── */
.trust-strip {
  background: rgba(16,185,129,0.06);
  border-top: 1px solid rgba(16,185,129,0.15);
  border-bottom: 1px solid rgba(16,185,129,0.15);
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
}
.trust-strip-inner {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
  max-width: 860px;
  margin: 0 auto;
}
.trust-pill {
  font-size: .78rem;
  font-weight: 600;
  color: #10b981;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 999px;
  padding: .3rem .85rem;
  white-space: nowrap;
  letter-spacing: .01em;
}
[data-theme="light"] .trust-strip {
  background: rgba(5,150,105,0.06);
  border-color: rgba(5,150,105,0.2);
}
[data-theme="light"] .trust-pill {
  color: #047857;
  background: rgba(5,150,105,0.08);
  border-color: rgba(5,150,105,0.2);
}

.powered-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 999;
  background: rgba(15,23,42,0.92);
  border-top: 1px solid #1e293b;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .4rem 1rem;
  gap: 1rem;
}
.powered-pages {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.powered-pages a {
  font-size: .75rem;
  color: #475569;
  text-decoration: none;
  transition: color .15s;
}
.powered-pages a:hover { color: #94a3b8; }
.powered-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.powered-icon {
  border-radius: 4px;
  display: block;
}
.powered-label {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #475569;
}
.powered-brand {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: #10b981;
  transition: color .2s;
}
.powered-link:hover .powered-brand { color: #34d399; }

/* ── Responsive ───────────────────── */
@media (max-width: 600px) {
  main { padding: 1.25rem .75rem 2.5rem; }
  .input-panel, .panel { width: 100%; max-width: 100%; }
  .calc-grid { gap: .35rem; }
  .calc-btn { padding: .75rem .4rem; font-size: .95rem; }
  .result-value { font-size: 1.5rem; }
}
