/**
 * BrewFormul8 — bf8.css
 * Complete design system. Mobile-first.
 * Dark mode default, light mode via [data-theme="light"].
 * Cinzel + Cormorant Garamond + IBM Plex Mono + Source Sans 3
 */

/* ════════════════════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES — DESIGN TOKENS
════════════════════════════════════════════════════════════════════════════ */

:root {
    /* Brand colors */
    --amber:          #C8741A;
    --amber-light:    #E8A230;
    --amber-dark:     #8B4E0F;
    --hop-green:      #7AB84A;
    --green-ok:       #27AE60;
    --red:            #C0392B;
    --yellow:         #F39C12;

    /* Dark theme (default) */
    --bg-page:        #0E0B07;
    --bg-app:         #110D06;
    --bg-card:        #19110A;
    --bg-input:       rgba(255,255,255,0.06);
    --bg-modal:       #1C1409;
    --bg-nav:         #19110A;

    --text-primary:   #F2E8D5;
    --text-secondary: rgba(242,232,213,0.6);
    --text-muted:     rgba(242,232,213,0.38);
    --text-input:     #F2E8D5;

    --border:         rgba(200,116,26,0.18);
    --border-input:   rgba(200,116,26,0.35);
    --border-focus:   #C8741A;
    --rule:           rgba(200,116,26,0.2);

    --shadow:         0 8px 32px rgba(0,0,0,0.5);
    --shadow-sm:      0 2px 8px rgba(0,0,0,0.4);

    /* Typography */
    --font-display:   'Cinzel', serif;
    --font-body:      'Source Sans 3', sans-serif;
    --font-editorial: 'Cormorant Garamond', serif;
    --font-mono:      'IBM Plex Mono', monospace;

    /* Sizing */
    --topnav-h:       56px;
    --cardnav-h:      40px;
    --radius:         6px;
    --radius-sm:      3px;
    --radius-lg:      12px;

    /* Transitions */
    --transition:     0.2s ease;
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-page:        #EDE4D0;
    --bg-app:         #E8DCC6;
    --bg-card:        #F0E6D2;
    --bg-input:       rgba(0,0,0,0.04);
    --bg-modal:       #F0E6D2;
    --bg-nav:         #F0E6D2;

    --text-primary:   #3D2008;
    --text-secondary: rgba(61,32,8,0.65);
    --text-muted:     rgba(61,32,8,0.4);
    --text-input:     #3D2008;

    --border:         rgba(139,78,15,0.2);
    --border-input:   rgba(139,78,15,0.4);
    --border-focus:   #8B4E0F;
    --rule:           rgba(139,78,15,0.15);

    --shadow:         0 8px 32px rgba(0,0,0,0.12);
    --shadow-sm:      0 2px 8px rgba(0,0,0,0.08);
}


/* ════════════════════════════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════════════════════════════ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--bg-page);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--amber);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

button {
    cursor: pointer;
    font-family: var(--font-body);
    border: none;
    background: none;
    color: inherit;
}

input, select, textarea {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-input);
}

select option { background: var(--bg-card); color: var(--text-primary); }


/* ════════════════════════════════════════════════════════════════════════════
   TOP NAV
════════════════════════════════════════════════════════════════════════════ */

.bf8-topnav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    backdrop-filter: blur(8px);
}

.bf8-topnav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 14px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Logo */
.bf8-topnav__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.bf8-logo-flask { flex-shrink: 0; }

.bf8-logo-wordmark {
    font-family: var(--font-display);
    font-size: 18px;
    letter-spacing: 0.06em;
    line-height: 1;
}

.bf8-logo-brew   { font-weight: 400; color: var(--text-primary); }
.bf8-logo-formul8 { font-weight: 900; color: var(--amber); }

/* Hamburger */
.bf8-topnav__hamburger,
.bf8-topnav__hamburger-placeholder {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.bf8-topnav__hamburger:hover { color: var(--amber); background: var(--bg-input); }

/* Right side */
.bf8-topnav__right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Brew button */
.bf8-brew-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: color var(--transition), background var(--transition);
}
.bf8-brew-btn:hover { color: var(--amber); background: var(--bg-input); }
.bf8-brew-btn__label {
    font-family: var(--font-display);
    font-size: 8px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* Theme toggle + gear */
.bf8-topnav__theme-toggle,
.bf8-topnav__gear {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
    position: relative;
}
.bf8-topnav__theme-toggle:hover,
.bf8-topnav__gear:hover { color: var(--amber); background: var(--bg-input); }

/* Gear dropdown */
.bf8-gear-menu {
    display: none;
    position: absolute;
    top: calc(var(--topnav-h) - 4px);
    right: 10px;
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}
.bf8-gear-menu.is-open { display: block; }
.bf8-gear-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    transition: background var(--transition);
    text-decoration: none;
}
.bf8-gear-menu a:hover { background: var(--bg-input); color: var(--amber); }
.bf8-gear-menu a i { width: 16px; opacity: 0.6; }

/* Sign up link (pre-login) */
.bf8-topnav__signup-link {
    font-size: 13px;
    color: var(--amber);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.bf8-topnav__signup-link:hover { background: var(--bg-input); text-decoration: none; }


/* ════════════════════════════════════════════════════════════════════════════
   SIDE NAV (hamburger menu)
════════════════════════════════════════════════════════════════════════════ */

.bf8-sidenav {
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100vh;
    background: var(--bg-modal);
    border-right: 1px solid var(--border);
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.bf8-sidenav.is-open { transform: translateX(0); }

.bf8-sidenav__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 299;
}
.bf8-sidenav__overlay.is-visible { display: block; }

.bf8-sidenav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--rule);
    min-height: var(--topnav-h);
}
.bf8-sidenav__user {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.bf8-sidenav__close {
    color: var(--text-muted);
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
}
.bf8-sidenav__close:hover { color: var(--amber); }

.bf8-sidenav__links {
    list-style: none;
    padding: 8px 0;
    flex: 1;
}
.bf8-sidenav__links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    font-size: 15px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition), background var(--transition);
}
.bf8-sidenav__links li a:hover { color: var(--amber); background: var(--bg-input); }
.bf8-sidenav__links li a i { width: 18px; opacity: 0.55; }
.bf8-sidenav__divider {
    height: 1px;
    background: var(--rule);
    margin: 8px 0;
}

/* Tier badge */
.bf8-tier-badge {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 20px;
    border: 1px solid currentColor;
}
.bf8-tier-badge--guest   { color: var(--text-muted); }
.bf8-tier-badge--member  { color: var(--amber); }
.bf8-tier-badge--premier { color: var(--hop-green); }


/* ════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
════════════════════════════════════════════════════════════════════════════ */

.bf8-main {
    padding-top: calc(var(--topnav-h) + var(--cardnav-h));
    min-height: 100vh;
    background: var(--bg-app);
}


/* ════════════════════════════════════════════════════════════════════════════
   CARD NAV (Settings / Mash / Kettle / Ferment / Target)
════════════════════════════════════════════════════════════════════════════ */

.bf8-card-nav {
    position: fixed;
    top: var(--topnav-h);
    left: 0; right: 0;
    height: var(--cardnav-h);
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 90;
    overflow-x: auto;
    scrollbar-width: none;
    max-width: 100%;
}
.bf8-card-nav::-webkit-scrollbar { display: none; }

.bf8-card-nav__link {
    flex: 1;
    min-width: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    padding: 0 8px;
    user-select: none;
}
.bf8-card-nav__link:hover { color: var(--text-secondary); }
.bf8-card-nav__link.active {
    color: var(--amber);
    border-bottom-color: var(--amber);
    font-weight: 700;
}


/* ════════════════════════════════════════════════════════════════════════════
   CARDS — animated show/hide system, no Swiper
   All cards are always in the DOM at full width so Raphael/JustGage
   can always measure gauge dimensions. One card visible at a time,
   with CSS slide transition matching Swiper's feel.
════════════════════════════════════════════════════════════════════════════ */

.bf8-cards-wrap {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    overflow: hidden; /* clip cards sliding out of view */
    position: relative;
}

.bf8-card {
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    min-height: calc(100vh - var(--topnav-h) - var(--cardnav-h));
    padding: 20px 16px 80px;
    width: 100%;
    box-sizing: border-box;
    /* Slide transition */
    transition: transform 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.32s ease;
}

/* Hidden cards are moved off-screen — direction set by JS */
.bf8-card--hidden {
    display: none !important;
}

/* Slide-in from right (going forward) */
.bf8-card--enter-right {
    display: block !important;
    position: absolute !important;
    top: 0; left: 0; right: 0;
    transform: translateX(100%);
    opacity: 0;
}
.bf8-card--enter-right.bf8-card--animating {
    transform: translateX(0);
    opacity: 1;
}

/* Slide-in from left (going back) */
.bf8-card--enter-left {
    display: block !important;
    position: absolute !important;
    top: 0; left: 0; right: 0;
    transform: translateX(-100%);
    opacity: 0;
}
.bf8-card--enter-left.bf8-card--animating {
    transform: translateX(0);
    opacity: 1;
}

/* Outgoing card slides away */
.bf8-card--exit-left {
    transform: translateX(-100%);
    opacity: 0;
}
.bf8-card--exit-right {
    transform: translateX(100%);
    opacity: 0;
}

@media (min-width: 640px) {
    .bf8-card { padding: 28px 28px 80px; }
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .bf8-card { transition: none; }
}


/* ════════════════════════════════════════════════════════════════════════════
   FORM ELEMENTS — INPUTS, SELECTS, SPINNERS
════════════════════════════════════════════════════════════════════════════ */

/* Base input */
.bf8-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-input);
    font-size: 15px;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}
.bf8-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(200,116,26,0.15);
}
.bf8-input--error { border-color: var(--red) !important; }
.bf8-input--sm    { padding: 6px 10px; font-size: 14px; width: auto; }
.bf8-input--num   { width: 72px; text-align: center; }
.bf8-input--wide  { width: 180px; }

/* Select */
.bf8-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 9px 32px 9px 12px;
    color: var(--text-input);
    font-size: 15px;
    cursor: pointer;
    -webkit-appearance: none;
    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 d='M1 1l5 5 5-5' stroke='%23C8741A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color var(--transition);
}
.bf8-select:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* Number spinner group */
.bf8-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-input);
}
.bf8-spinner input {
    width: 60px;
    text-align: center;
    background: transparent;
    border: none;
    padding: 7px 6px;
    color: var(--text-input);
    font-size: 15px;
}
.bf8-spinner input:focus { outline: none; }
.bf8-spinner__btn {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-input);
}
.bf8-spinner__up,
.bf8-spinner__down {
    width: 24px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 9px;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}
.bf8-spinner__up   { border-bottom: 1px solid var(--border-input); }
.bf8-spinner__up:hover,
.bf8-spinner__down:hover { color: var(--amber); background: var(--bg-input); }

/* Field group (label + input stacked) */
.bf8-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.bf8-field__label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.bf8-field__label i { margin-right: 4px; opacity: 0.7; }

/* Inline field row */
.bf8-field-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
}

/* Textarea */
.bf8-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text-input);
    font-size: 14px;
    resize: vertical;
    min-height: 64px;
}
.bf8-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* Section divider within a card */
.bf8-card-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rule);
}
.bf8-card-section:last-child { border-bottom: none; }

.bf8-card-section__heading {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--amber);
    margin-bottom: 14px;
}

/* Description text under ingredient dropdowns */
.bf8-ingredient-desc {
    font-family: var(--font-editorial);
    font-style: italic;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
    min-height: 20px;
}


/* ════════════════════════════════════════════════════════════════════════════
   INGREDIENT ROWS (Grain / Hop)
════════════════════════════════════════════════════════════════════════════ */

.bf8-ingredient-row {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    transition: border-color var(--transition);
}
.bf8-ingredient-row:hover { border-color: var(--border-input); }
.bf8-ingredient-row.bf8-hidden { display: none; }

.bf8-ingredient-row__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.bf8-ingredient-row__label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--amber);
}

/* Add ingredient button */
.bf8-add-row-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px dashed var(--border-input);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    transition: color var(--transition), border-color var(--transition);
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}
.bf8-add-row-btn:hover { color: var(--amber); border-color: var(--amber); }


/* ════════════════════════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════════════════════════ */

.bf8-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    border: 1px solid transparent;
    text-decoration: none;
}

.bf8-btn--primary {
    background: var(--bg-input);
    border-color: var(--border-input);
    color: var(--text-primary);
}
.bf8-btn--primary:hover { border-color: var(--amber); color: var(--amber); }

.bf8-btn--amber {
    background: var(--amber);
    color: #0E0B07;
    border-color: var(--amber);
}
.bf8-btn--amber:hover { background: var(--amber-light); border-color: var(--amber-light); }

.bf8-btn--outline {
    background: transparent;
    border-color: var(--border-input);
    color: var(--text-secondary);
}
.bf8-btn--outline:hover { border-color: var(--amber); color: var(--amber); }

.bf8-btn--fb {
    background: #1877F2;
    color: #fff;
    border-color: #1877F2;
}
.bf8-btn--fb:hover { background: #0e5fc3; }

.bf8-btn--copy {
    background: var(--bg-input);
    border-color: var(--border-input);
    color: var(--text-secondary);
}
.bf8-btn--copy:hover { border-color: var(--amber); color: var(--amber); }

.bf8-btn--email {
    background: var(--bg-input);
    border-color: var(--border-input);
    color: var(--text-secondary);
}
.bf8-btn--email:hover { border-color: var(--amber); color: var(--amber); }

.bf8-btn--sm { padding: 6px 12px; font-size: 11px; }
.bf8-btn--full { width: 100%; justify-content: center; }
.bf8-btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Link-style button */
.bf8-btn-link {
    color: var(--amber);
    font-size: 13px;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}


/* ════════════════════════════════════════════════════════════════════════════
   MODALS
════════════════════════════════════════════════════════════════════════════ */

.bf8-modal-wrap {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.bf8-modal-box {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.bf8-modal-box--brew { max-width: 360px; }

.bf8-modal-box__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--amber);
    position: sticky;
    top: 0;
    background: var(--bg-modal);
    z-index: 1;
}
.bf8-modal-box__header button {
    color: var(--text-muted);
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.bf8-modal-box__header button:hover { color: var(--amber); background: var(--bg-input); }

.bf8-modal-box__body {
    padding: 18px;
    flex: 1;
}

/* Save / success / warning feedback modals */
.bf8-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bf8-modal {
    border-radius: var(--radius-lg);
    padding: 8px;
    width: 260px;
    box-shadow: var(--shadow);
}
.bf8-modal--success { background: #00B75B; }
.bf8-modal--warning { background: #C8741A; }
.bf8-modal--error   { background: #C0392B; }

.bf8-modal__inner {
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    color: #fff;
    font-size: 15px;
    line-height: 1.5;
}


/* ════════════════════════════════════════════════════════════════════════════
   BREW MODAL LAYOUT
════════════════════════════════════════════════════════════════════════════ */

.bf8-brew-modal__layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.bf8-brew-modal__flask-wrap {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bf8-brew-modal__name {
    font-family: var(--font-editorial);
    font-style: italic;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    max-width: 100px;
    word-break: break-word;
}

.bf8-brew-modal__stats {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bf8-brew-modal__stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 14px;
    padding: 4px 0;
    border-bottom: 1px solid var(--rule);
}
.bf8-brew-modal__stat:last-of-type { border-bottom: none; }
.bf8-brew-modal__stat span { color: var(--text-muted); font-size: 12px; }
.bf8-brew-modal__stat strong { color: var(--text-primary); font-size: 16px; }

.bf8-brew-modal__bvscore {
    font-size: 13px;
    font-family: var(--font-mono);
    margin-top: 4px;
}

.bf8-brew-modal__cost {
    font-size: 20px;
    font-weight: 700;
    color: var(--amber);
    margin-top: 8px;
}
.bf8-brew-modal__cost small { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.bf8-brew-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.bf8-brew-modal__share {
    border-top: 1px solid var(--rule);
    padding-top: 14px;
    margin-top: 4px;
}

.bf8-brew-modal__share-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.bf8-brew-modal__share-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

/* Share toggle */
.bf8-brew-modal__share-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}
.bf8-brew-modal__share-toggle input { display: none; }
.bf8-toggle-slider {
    width: 40px; height: 22px;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 11px;
    position: relative;
    transition: background var(--transition);
}
.bf8-toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 14px; height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform var(--transition), background var(--transition);
}
.bf8-brew-modal__share-toggle input:checked + .bf8-toggle-slider {
    background: var(--amber);
    border-color: var(--amber);
}
.bf8-brew-modal__share-toggle input:checked + .bf8-toggle-slider::after {
    transform: translateX(18px);
    background: #fff;
}


/* ════════════════════════════════════════════════════════════════════════════
   TARGET CARD — GAUGES
════════════════════════════════════════════════════════════════════════════ */

.bf8-gauge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.bf8-gauge-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    /* Explicit min-height so Raphael can measure on init */
    min-height: 130px;
}
.bf8-gauge-card:hover {
    border-color: var(--border-input);
    background: var(--bg-input);
}

.bf8-gauge-card__label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

/* Main balance gauge (full width) */
.bf8-gauge-card--main {
    grid-column: 1 / -1;
    padding: 16px;
    min-height: 220px;
}

/* Ensure gauge SVGs fill their containers */
.bf8-gauge-card > div > svg,
.bf8-gauge-card > div canvas {
    width: 100% !important;
}

.bf8-bjcp-description {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 14px;
    font-family: var(--font-editorial);
    font-size: 14px;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-top: 12px;
}


/* ════════════════════════════════════════════════════════════════════════════
   SIGN IN PAGE
════════════════════════════════════════════════════════════════════════════ */

.bf8-signin-page {
    max-width: 440px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

.bf8-signin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.bf8-signin-card__title {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--amber);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* OAuth buttons */
.bf8-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    transition: opacity var(--transition);
    border: 1px solid var(--border-input);
}
.bf8-oauth-btn:hover { opacity: 0.85; text-decoration: none; }
.bf8-oauth-btn--google { background: #fff; color: #444; }
.bf8-oauth-btn--facebook { background: #1877F2; color: #fff; border-color: #1877F2; }

.bf8-signin-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 12px;
}
.bf8-signin-divider::before,
.bf8-signin-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--rule);
}


/* ════════════════════════════════════════════════════════════════════════════
   FOOTER
════════════════════════════════════════════════════════════════════════════ */

.bf8-footer {
    background: var(--bg-nav);
    border-top: 1px solid var(--border);
    padding: 14px 16px;
    text-align: center;
}

.bf8-footer__links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.bf8-footer__links a { color: var(--text-muted); }
.bf8-footer__links a:hover { color: var(--amber); text-decoration: none; }
.bf8-footer__links span { opacity: 0.3; }


/* ════════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
════════════════════════════════════════════════════════════════════════════ */

.bf8-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    z-index: 600;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    pointer-events: none;
}
.bf8-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ════════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
════════════════════════════════════════════════════════════════════════════ */

.bf8-hidden  { display: none !important; }
.bf8-sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

.bf8-text-amber   { color: var(--amber); }
.bf8-text-muted   { color: var(--text-muted); }
.bf8-text-center  { text-align: center; }
.bf8-text-mono    { font-family: var(--font-mono); }
.bf8-text-display { font-family: var(--font-display); }

.bf8-mt-sm  { margin-top: 8px; }
.bf8-mt-md  { margin-top: 16px; }
.bf8-mt-lg  { margin-top: 24px; }
.bf8-mb-sm  { margin-bottom: 8px; }
.bf8-mb-md  { margin-bottom: 16px; }
.bf8-mb-lg  { margin-bottom: 24px; }

.bf8-flex        { display: flex; }
.bf8-flex-center { display: flex; align-items: center; justify-content: center; }
.bf8-gap-sm      { gap: 8px; }
.bf8-gap-md      { gap: 16px; }

/* Default settings link */
.bf8-defaults-link {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.bf8-defaults-link:hover { color: var(--amber); }


/* ════════════════════════════════════════════════════════════════════════════
   LEGACY COMPATIBILITY — classes from original that still appear in includes
════════════════════════════════════════════════════════════════════════════ */

/* These map old class names to new design system values */
.saveButton, .formulateButton, .buyButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    background: var(--amber);
    color: #0E0B07;
    border: none;
    transition: background var(--transition);
}
.saveButton:hover, .formulateButton:hover, .buyButton:hover {
    background: var(--amber-light);
}

.backButton, .printButton {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-secondary);
    transition: border-color var(--transition), color var(--transition);
}
.backButton:hover, .printButton:hover { border-color: var(--amber); color: var(--amber); }

.hopBox {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}

.popupMessage {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    max-width: 280px;
    box-shadow: var(--shadow);
}

.greyOverLayShown {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settingsInput {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-input);
    font-size: 15px;
    text-align: center;
    width: 70px;
}
.settingsInput:focus {
    outline: none;
    border-color: var(--border-focus);
}

.linkText1 { color: var(--amber); text-decoration: underline; }
.carbon-text { color: var(--text-secondary); }

.fTableCell {
    padding: 8px 12px;
    border-bottom: 1px solid var(--rule);
    font-size: 13px;
    color: var(--text-secondary);
}

/* Active menu items in SignInMenu */
.activeMenu   { background: rgba(200,116,26,0.15); }
.inactiveMenu { background: transparent; }
.inactiveMenu:hover { background: var(--bg-input); }

/* MyAccountDiv / MyPrefDiv text boxes */
.textBox50, .textBox60, .textBox70, .textBox80,
.textBox120, .textBox150, .textBox170 {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    color: var(--text-input);
    font-size: 14px;
    text-align: center;
}
.textBox50  { width: 50px; }
.textBox60  { width: 60px; }
.textBox70  { width: 70px; }
.textBox80  { width: 80px; }
.textBox120 { width: 120px; }
.textBox150 { width: 150px; }
.textBox170 { width: 170px; }

.textBox50:focus, .textBox60:focus, .textBox70:focus,
.textBox80:focus, .textBox120:focus, .textBox150:focus,
.textBox170:focus {
    outline: none;
    border-color: var(--border-focus);
}

.boxBorder {
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
}

.fColorRed   { color: var(--red); }
.fColorBlue  { color: var(--amber-light); }
.fSize12     { font-size: 12px; }
.txtSz12     { font-size: 12px; }
.txtSz14     { font-size: 14px; }
.txtSz16     { font-size: 16px; }
.txtSz18     { font-size: 18px; }
.txtSz20     { font-size: 20px; }
.prefRowHt   { height: 60px; padding-top: 8px; vertical-align: middle; }


/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════════════════ */

@media (min-width: 640px) {
    .bf8-gauge-grid { grid-template-columns: repeat(3, 1fr); }
    .bf8-brew-modal__actions { grid-template-columns: repeat(4, 1fr); }
    .bf8-logo-wordmark { font-size: 20px; }
}

@media (max-width: 380px) {
    .bf8-card-nav__link { font-size: 9px; padding: 0 5px; }
    .bf8-logo-wordmark  { font-size: 16px; }
}

@media print {
    .bf8-topnav,
    .bf8-card-nav,
    .bf8-sidenav,
    .bf8-footer,
    .bf8-brew-btn { display: none !important; }
    .bf8-main { padding-top: 0 !important; }
    body { background: #fff; color: #000; }
}
