/* ╔══════════════════════════════════════════════════════════════╗
   ║                           Navbar CSS                         ║
   ╚══════════════════════════════════════════════════════════════╝ */

.custom-navbar {
  background: rgba(240,242,236,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  overflow: visible !important;
  position: relative;
  z-index: 1030 !important;
}

.custom-navbar .navbar-brand {
  color: var(--text);
  font-weight: 700;
  font-family: var(--font-display);
}

.custom-navbar .navbar-brand:hover {
  color: var(--accent);
}

.custom-navbar .nav-link {
  color: var(--text2);
  font-weight: 500;
  transition: color 0.2s;
}

.custom-navbar .nav-link:hover {
  color: var(--accent);
}

.custom-navbar .dropdown-menu {
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 1050 !important;
  position: absolute;
}

.custom-navbar .dropdown-item {
  font-size: 14px;
  color: var(--text2);
}

.custom-navbar .dropdown-item:hover {
  background: var(--accent-xlight);
  color: var(--accent-dark);
}

.navbar-collapse {
  z-index: 1030;
}

.calc-card, .card, .page > div {
  position: relative;
  z-index: 1;
}

nav, .custom-navbar, .navbar {
  z-index: 1000;
}

/* Ensure dropdown toggle button works properly */
.dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.255em;
  vertical-align: 0.255em;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
}

/* Fix toggle icon color */
.navbar-toggler {
  border: none;
}

.navbar-toggler-icon {
  filter: invert(0.4);
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                        FOOTER                               ║
   ╚══════════════════════════════════════════════════════════════╝ */

.site-footer {
  background: var(--bg);                        /* sage-green, matches page bg */
  border-top: 3px solid var(--accent-mid);      /* thicker, branded green top line */
  padding: 48px 20px 0;
  width: 100%;
  clear: both;
  margin-top: 60px;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.8fr repeat(4, 1fr);
  gap: 40px;
  padding-bottom: 40px;
}

@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;               /* brand spans full width on tablet */
  }
}

@media (max-width: 580px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 380px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

/* ── Brand column ───────────────────────────────────────────── */

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-brand .nav-logo {
  display: inline-flex !important;
  align-items: center;
  text-decoration: none;
  border-bottom: none;
  width: fit-content;
}

.footer-brand .nav-logo-text {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-left: 6px;
  letter-spacing: -0.01em;
}

.footer-tagline {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.65;
  max-width: 240px;
}

/* ── Social icons ───────────────────────────────────────────── */

.footer-socials {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.footer-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--border); /* override global link underline */
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition);
}

.footer-socials a:hover {
  background: var(--accent-xlight);
  border-color: var(--accent-mid);
  color: var(--accent-dark);
  box-shadow: var(--shadow-sm);
}

/* ── Nav columns ────────────────────────────────────────────── */

.footer-col {
  display: block;
}

.footer-col h4 {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-dark);              /* green instead of muted grey */
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border); /* subtle separator under heading */
}

.footer-links {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.footer-links li a {
  font-size: 13.5px;
  color: var(--text2);
  text-decoration: none;
  border-bottom: none;
  transition: color var(--transition), padding-left var(--transition);
  display: inline-block;
}

.footer-links li a:hover {
  color: var(--accent-dark);
  padding-left: 4px;               /* subtle slide-in on hover */
}

/* ── Bottom bar ─────────────────────────────────────────────── */

.footer-bottom {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 0 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-bottom p {
  font-size: 12px;
  color: var(--text3);
}

.footer-bottom-links {
  display: flex;
  gap: 18px;
}

.footer-bottom-links a {
  font-size: 12px;
  color: var(--text3);
  text-decoration: none;
  border-bottom: none;
  transition: color var(--transition);
}

.footer-bottom-links a:hover {
  color: var(--accent-dark);
}

/* Searchbar */
#searchResults {
  z-index: 99999 !important;
  position: absolute;
  width: 100%;
  left: 0;
  top: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

#searchResults li {
  cursor: pointer;
}

#searchResults a {
  display: block;
  width: 100px;
}

#searchResults li:hover {
  background-color: #f1f1f1;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║             DESIGN TOKENS (CSS VARIABLES)                   ║
   ╚══════════════════════════════════════════════════════════════╝ */
:root {
  /* ── Backgrounds ─────────────────────────────────────────── */
  --bg:              #f0f2ec;   /* sage-green page background   */
  --white:           #ffffff;   /* pure white                   */
  --surface:         #ffffff;   /* card surface                 */
  --surface-alt:     #f8f9f6;   /* slightly off-white (inputs)  */

  /* ── Borders ─────────────────────────────────────────────── */
  --border:          #dde0d8;   /* default border               */
  --border-light:    #eaece6;   /* subtle inner border          */

  /* ── Accent / Brand — Forest Green ──────────────────────── */
  --accent:          #4a7c3f;   /* primary green                */
  --accent-dark:     #345c2c;   /* darker green (hover, text)   */
  --accent-light:    #e8f0e4;   /* light green tint (table hdr) */
  --accent-xlight:   #f2f7ef;   /* very light green (hover row) */
  --accent-mid:      #c8dbc2;   /* mid green (borders on light) */

  /* ── Typography ──────────────────────────────────────────── */
  --text:            #1a1f14;   /* primary text — near black     */
  --text2:           #44503c;   /* secondary text — dark green   */
  --text3:           #7a8870;   /* muted text — sage             */
  --link:            #2e6da4;   /* hyperlink blue                */
  --link-hover:      #1a4f82;   /* hyperlink hover               */

  /* ── Semantic result colors ──────────────────────────────── */
  --result-bg:       #fffef5;   /* warm cream (hero result box)  */
  --result-border:   #c8b84a;   /* golden border (result box)    */
  --green-txt:       #2d6a20;   /* positive values (green)       */
  --red-txt:         #b91c1c;   /* negative / inflation (red)    */

  /* ── Radius ──────────────────────────────────────────────── */
  --radius:          10px;      /* card border radius            */
  --radius-sm:        6px;      /* input / badge / inner radius  */

  /* ── Shadows ─────────────────────────────────────────────── */
  --shadow:          0 2px 16px rgba(50,70,40,0.09),
                     0 1px  4px rgba(0,0,0,0.05);
  --shadow-sm:       0 1px  6px rgba(50,70,40,0.07);

  /* ── Fonts ───────────────────────────────────────────────── */
  --font-display:    'Playfair Display', Georgia, serif;
  --font-body:       'Source Sans 3', system-ui, sans-serif;
  --font-mono:       'Source Code Pro', 'Courier New', monospace;

  /* ── Spacing scale ───────────────────────────────────────── */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;

  /* ── Transition ──────────────────────────────────────────── */
  --transition: 0.18s ease;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   BASE / RESET                              ║
   ╚══════════════════════════════════════════════════════════════╝ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* subtle grid texture on body */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(74,124,63,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74,124,63,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px 70px;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   TYPOGRAPHY                                ║
   ╚══════════════════════════════════════════════════════════════╝ */

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
  display: block;
}

h1.display {
  font-family: var(--font-display);
  font-size: clamp(34px, 5.5vw, 54px);
  font-weight: 400;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

h1.display em {
  font-style: normal;
  color: var(--accent);
  font-weight: 700;
}

h2.card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--link);
  margin-bottom: 7px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
  display: block;
}

.body-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
}

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(46,109,164,0.3);
  transition: color var(--transition), border-color var(--transition);
}

a:hover {
  color: var(--link-hover);
  border-color: var(--link-hover);
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
}

.result-big {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  color: var(--accent-dark);
  line-height: 1;
  letter-spacing: -0.01em;
}

@media (max-width: 580px) {
  .result-big { font-size: 32px; }
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   LAYOUT & CARDS                            ║
   ╚══════════════════════════════════════════════════════════════╝ */

.card, .calc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 28px;
}

.card::before, .calc-card::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-mid) 100%);
}

.card-inner {
  padding: 26px 30px 28px;
}

@media (max-width: 580px) {
  .card-inner { padding: 20px 16px 22px; }
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .info-grid { grid-template-columns: 1fr; }
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-top: none;
}

.stat-cell {
  flex: 1;
  min-width: 100px;
  padding: 12px 16px;
  border-right: 1px solid var(--border-light);
}

.stat-cell:last-child { border-right: none; }

.stat-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 4px;
  white-space: nowrap;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.stat-val.red  { color: var(--red-txt); font-weight: 700; }
.stat-val.grn  { color: var(--green-txt); font-weight: 700; }
.stat-val.acc  { color: var(--accent-dark); font-weight: 700; }

@media (max-width: 580px) {
  .stat-cell { min-width: 90px; padding: 10px 12px; }
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   FORM ELEMENTS                             ║
   ╚══════════════════════════════════════════════════════════════╝ */

.input-row-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.sep {
  font-size: 14px;
  color: var(--text3);
  font-weight: 500;
  white-space: nowrap;
}

.eq-sign {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text3);
  padding: 0 4px;
  font-weight: 500;
}

.qmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px dashed var(--accent);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-xlight);
  flex-shrink: 0;
  animation: qmark-pulse 3s ease-in-out infinite;
}

@keyframes qmark-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,124,63,0); }
  50% { box-shadow: 0 0 0 5px rgba(74,124,63,0.12); }
}

input[type="number"],
input[type="text"],
select {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(74,124,63,0.13);
}

.w-number { width: 100px; }
.w-amt { width: 100px; font-size: 15px; }
.w-pct { width: 60px; text-align: center; }
.w-years { width: 70px; text-align: center; }
.w-yrs { width: 70px; text-align: center; }
.w-mon { width: 120px; font-family: var(--font-body); font-size: 14px; }
.w-yr  { width: 82px; font-family: var(--font-body); font-size: 14px; }

.unit-lbl {
  font-size: 13px;
  color: var(--text3);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   BUTTONS                                   ║
   ╚══════════════════════════════════════════════════════════════╝ */

.btn-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn-primary, .btn-calc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 10px rgba(74,124,63,0.32);
  transition: transform var(--transition), box-shadow var(--transition);
}

.btn-primary:hover, .btn-calc:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(74,124,63,0.42);
}

.btn-primary:active, .btn-calc:active {
  transform: translateY(0);
}

.btn-secondary, .btn-clear {
  padding: 10px 18px;
  background: #ececea;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.btn-secondary:hover, .btn-clear:hover {
  background: #dededc;
  color: var(--text);
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   RESULT COMPONENTS                         ║
   ╚══════════════════════════════════════════════════════════════╝ */

.result-hero {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 20px 24px 18px;
}

.result-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
}

.result-sentence {
  font-size: 13.5px;
  color: var(--text2);
  margin-top: 10px;
  line-height: 1.65;
}

.result-sentence strong {
  color: var(--text);
  font-weight: 700;
}

.result-block {
  margin-top: 20px;
  animation: fadeSlideUp 0.38s ease both;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║              BODY FAT GAUGE (BAR VISUALIZATION)             ║
   ╚══════════════════════════════════════════════════════════════╝ */

.bf-gauge-container {
  margin: 16px 0 24px 0;
  background: var(--accent-xlight);
  border-radius: var(--radius);
  padding: 16px 20px 20px;
  border: 1px solid var(--border-light);
}

.bf-gauge-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
  text-align: center;
}

.bf-meter {
  position: relative;
  width: 100%;
  height: 50px;
  margin: 10px 0 5px;
}

.bf-meter-track {
  position: absolute;
  width: 100%;
  height: 28px;
  border-radius: 40px;
  background: linear-gradient(90deg,
    #3b82f6 0%,      /* Essential */
    #10b981 12%,     /* Athletes */
    #10b981 28%,     /* Fitness */
    #f59e0b 36%,     /* Average */
    #ef4444 50%,     /* Obese start */
    #b91c1c 100%
  );
  top: 11px;
  left: 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.bf-meter-marker {
  position: absolute;
  width: 4px;
  height: 38px;
  background: #1f2937;
  top: 6px;
  transform: translateX(-50%);
  border-radius: 4px;
  box-shadow: 0 0 0 2px white, 0 2px 8px rgba(0,0,0,0.2);
  transition: left 0.45s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  z-index: 5;
}

.bf-meter-marker::after {
  content: "▼";
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: #1f2937;
  text-shadow: 0 1px 1px white;
}

.bf-meter-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text2);
  padding: 0 2px;
}

.bf-meter-labels span {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
}

/* Category tags for body fat */
.badge-essential { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
.badge-athletes   { background: #d1fae5; color: #065f46; border-left: 3px solid #10b981; }
.badge-fitness    { background: #cffafe; color: #0e4f6e; border-left: 3px solid #06b6d4; }
.badge-average    { background: #fed7aa; color: #9a3412; border-left: 3px solid #f59e0b; }
.badge-obese-bf   { background: #fee2e2; color: #b91c1c; border-left: 3px solid #ef4444; }

/* Unit toggle tabs */
.unit-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}
.unit-tab {
  cursor: pointer;
  font-weight: 700;
  color: var(--text3);
  padding: 6px 16px;
  border-radius: 40px;
  transition: all 0.2s;
  font-size: 13px;
}
.unit-tab.active {
  background: var(--accent-light);
  color: var(--accent-dark);
}
.unit-panel { display: none; }
.unit-panel.active-panel { display: block; }

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   TABLE STYLES                              ║
   ╚══════════════════════════════════════════════════════════════╝ */

.table-section {
  margin-top: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.data-table thead th {
  background: var(--surface-alt);
  padding: 10px 12px;
  font-weight: 700;
  color: var(--text2);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.data-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-mono);
  color: var(--text2);
}
.data-table tbody td:first-child {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   INFO BOX & FORMULA BAR                    ║
   ╚══════════════════════════════════════════════════════════════╝ */

.info-box {
  background: var(--accent-xlight);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 12px;
}

.info-box h4 {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.info-box p {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}

.formula-bar {
  margin-top: 14px;
  background: #1c201a;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #7ec86a;
  letter-spacing: 0.03em;
  border: 1px solid #2a3028;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   FOOTER & RESPONSIVE                       ║
   ╚══════════════════════════════════════════════════════════════╝ */

footer {
  text-align: center;
  color: var(--text3);
  font-size: 12.5px;
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--border-light);
  line-height: 1.8;
}

@media (max-width: 580px) {
  .input-row-box {
    padding: 12px 14px;
    flex-direction: column;
    align-items: stretch;
  }
  .result-hero { padding: 16px; }
  .data-table thead th,
  .data-table tbody td { padding: 8px 10px; font-size: 12px; }
  .bf-meter-labels { font-size: 7px; }
  .bf-gauge-container { padding: 12px; }
  .stats-row { flex-direction: column; }
  .stat-cell { border-right: none; border-bottom: 1px solid var(--border-light); }
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   Calories Calculator                        ║
   ╚══════════════════════════════════════════════════════════════╝ */

.goal-table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.goal-table th {
  background: var(--accent-light);
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  text-align: left;
  border-bottom: 1px solid var(--accent-mid);
}
.goal-table td {
  padding: 10px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text2);
}
.goal-table td:first-child {
  font-weight: 700;
  color: var(--text);
}
.goal-table td:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-dark);
}
.goal-table tr:last-child td {
  border-bottom: none;
}
.goal-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-xlight);
  color: var(--accent-dark);
}
.warning-note {
  background: #fff8e7;
  border-left: 3px solid #f5a623;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #856404;
  margin: 12px 0;
}
.toggle-info {
  color: var(--link);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin: 8px 0;
  display: inline-block;
  border-bottom: 1px dashed var(--link);
}
.result-highlight-card {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 16px 0;
  text-align: center;
}
.result-highlight-number {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 700;
  color: var(--accent-dark);
  line-height: 1;
}
.macro-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.macro-card {
  flex: 1;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  border: 1px solid var(--border-light);
}
.macro-number {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-dark);
}
.macro-label-sm {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text3);
  letter-spacing: 0.05em;
}
.zigzag-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.zigzag-day {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  text-align: center;
  min-width: 65px;
  border: 1px solid var(--border-light);
}
.zigzag-day span {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-dark);
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                   Estate Tax Calculator                      ║
   ╚══════════════════════════════════════════════════════════════╝ */

.section-header {
  background: var(--accent-light);
  padding: 12px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  margin-top: 20px;
  margin-bottom: 0;
  border: 1px solid var(--accent-mid);
  border-bottom: none;
}
.input-group {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.input-row-custom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
}
.input-row-custom:last-child {
  border-bottom: none;
}
.input-row-custom label {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  flex: 2;
  min-width: 180px;
}
.input-row-custom input {
  width: 160px;
  font-family: var(--font-mono);
  text-align: right;
  padding: 8px 12px;
}
.input-row-custom .currency-symbol {
  font-family: var(--font-mono);
  color: var(--text3);
  font-size: 14px;
}
.result-summary {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 20px 0;
}
.result-summary h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--text);
}
.tax-due-positive {
  color: var(--red-txt);
  font-weight: 800;
}
.tax-due-zero {
  color: var(--green-txt);
  font-weight: 800;
}
.exemption-table {
  width: 100%;
  font-size: 12px;
  margin-top: 16px;
}
.exemption-table th, .exemption-table td {
  padding: 6px 8px;
  text-align: left;
}
.exemption-table th {
  background: var(--surface-alt);
  font-weight: 700;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                    Currency Calculator                       ║
   ╚══════════════════════════════════════════════════════════════╝ */

.rate-source {
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  margin-top: 8px;
  margin-bottom: 16px;
}
.custom-rate-box {
  background: var(--accent-xlight);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 20px 0;
}
.custom-rate-box h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 12px;
}
.rate-input-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.rate-input-row .sep {
  font-size: 13px;
}
.market-table-container {
  max-height: 400px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.market-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.market-table th {
  background: var(--accent-light);
  padding: 10px 12px;
  position: sticky;
  top: 0;
  font-weight: 700;
  color: var(--accent-dark);
  text-align: center;
}
.market-table td {
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-mono);
}
.market-table tr:hover {
  background: var(--accent-xlight);
}
.currency-select {
  min-width: 140px;
}
.last-updated {
  font-size: 11px;
  color: var(--text3);
  margin-top: 8px;
  text-align: right;
}
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}
.howto-step {
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    margin-bottom: 12px;
    border-left: 3px solid var(--accent);
  }
  .howto-step strong {
    color: var(--accent-dark);
    font-size: 15px;
  }
  .formula-box {
    background: var(--accent-xlight);
    border-radius: var(--radius-sm);
    padding: 20px;
    margin: 16px 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-dark);
    border: 1px solid var(--border-light);
  }
  .example-box {
    background: #fffef5;
    border: 1px solid var(--result-border);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin: 16px 0;
  }
  .example-box .currency-result .result-highlight {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-dark);
  }
  .internal-links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 20px 0;
  }
  .internal-link-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--link);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .internal-link-card:hover {
    background: var(--accent-xlight);
    border-color: var(--accent-mid);
    transform: translateY(-2px);
  }
  .faq-modern {
    margin-top: 20px;
  }
  .faq-modern-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
  }
  .faq-modern-question {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    background: var(--surface);
    transition: background 0.2s;
  }
  .faq-modern-question:hover {
    background: var(--accent-xlight);
  }
  .faq-modern-question .chevron {
    transition: transform 0.25s ease;
    color: var(--accent);
    font-size: 18px;
  }
  .faq-modern-item.active .faq-modern-question .chevron{
    transform: rotate(180deg);
  }
  .faq-modern-answer {
    max-height: 0;
    padding: 0 20px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.2s;
    border-top: 1px solid transparent;
    color: var(--text2);
    font-size: 14px;
    line-height: 1.6;
  }
  .faq-modern-item.active .faq-modern-answer {
    max-height: 300px;
    padding: 0 20px 18px;
    border-top-color: var(--border-light);
  }
  .section-divider {
    margin: 32px 0 24px;
    border-top: 2px solid var(--border-light);
  }
  .lead-text {
    font-size: 16px;
    color: var(--text2);
    margin-bottom: 24px;
    line-height: 1.65;
  }
  
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                    Discount Calculator                       ║
   ╚══════════════════════════════════════════════════════════════╝ */

.discount-type-selector {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 8px 0;
}
.discount-type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
}
.discount-type-option input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
}
.savings-highlight {
  background: linear-gradient(135deg, var(--accent-xlight) 0%, var(--surface-alt) 100%);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  margin: 20px 0;
}
.savings-amount {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  color: var(--green-txt);
  line-height: 1;
}
.savings-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 8px;
}
.result-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
.result-card-small {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  border: 1px solid var(--border-light);
}
.result-card-small .label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text3);
  letter-spacing: 0.08em;
}
.result-card-small .value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-dark);
}
.formula-demo {
  background: #1c201a;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #7ec86a;
  margin: 16px 0;
}
@media (max-width: 580px) {
  .result-comparison {
    grid-template-columns: 1fr;
  }
  .savings-amount {
    font-size: 32px;
  }
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                      Margin Calculator                       ║
   ╚══════════════════════════════════════════════════════════════╝ */
   .margin-visual {
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  border: 1px solid var(--border-light);
}
.meter-bar {
  background: #e5e7eb;
  border-radius: 20px;
  height: 32px;
  overflow: hidden;
  margin: 12px 0;
  position: relative;
}
.meter-fill {
  background: linear-gradient(90deg, var(--accent) 0%, var(--green-txt) 100%);
  width: 0%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  transition: width 0.4s ease;
}
.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 4px;
}
.result-panel {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin: 16px 0;
}
.result-panel .row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-light);
}
.result-panel .row:last-child {
  border-bottom: none;
}
.result-panel .label {
  font-weight: 700;
  color: var(--text2);
}
.result-panel .value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-dark);
}
.tab-buttons {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.tab-btn {
  padding: 8px 20px;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-sm);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeSlideUp 0.3s ease;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                     Log Calculator                           ║
   ╚══════════════════════════════════════════════════════════════╝ */

.log-base-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.log-base-input .base-prefix {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-dark);
}
.formula-display {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-dark);
  border: 1px solid var(--border-light);
}
.rule-card {
  background: var(--accent-xlight);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  border-left: 3px solid var(--accent);
}
.rule-card .rule-formula {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 6px;
}
.rule-card .rule-desc {
  font-size: 12px;
  color: var(--text2);
}
.value-badge {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: inline-block;
  margin: 4px;
}.log-base-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.log-base-input .base-prefix {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-dark);
}
.formula-display {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 16px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent-dark);
  border: 1px solid var(--border-light);
}
.rule-card {
  background: var(--accent-xlight);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  border-left: 3px solid var(--accent);
}
.rule-card .rule-formula {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
  margin-bottom: 6px;
}
.rule-card .rule-desc {
  font-size: 12px;
  color: var(--text2);
}
.value-badge {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: inline-block;
  margin: 4px;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║                    Quardatic Calculator                      ║
   ╚══════════════════════════════════════════════════════════════╝ */

   .quadratic-display {
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}
.quadratic-equation {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--accent-dark);
}
.result-card {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 16px 0;
}
.result-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}
.solution-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--accent-dark);
  margin: 8px 0;
}
.steps-container {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.8;
  border: 1px solid var(--border-light);
}
.step-line {
  font-family: 'Source Code Pro', monospace;
  margin: 8px 0;
}
.step-fraction {
  display: inline-block;
  text-align: center;
  vertical-align: middle;
}
.fraction-line {
  display: block;
  border-top: 1px solid var(--text);
  margin: 2px 0;
}
.solution-or {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text2);
  margin: 8px 0;
}
.discriminant-positive { color: var(--green-txt); }
.discriminant-zero { color: var(--accent-dark); }
.discriminant-negative { color: var(--red-txt); }