* {
    box-sizing: border-box;
}

html {
    font-family: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
    /* Stops Android Chrome's automatic text-size "boosting" in narrow
       columns (the hamburger drawer's Tools submenu is a classic trigger
       for it) — that heuristic only runs on real mobile Chrome, never in
       desktop devtools device emulation, which is why a bug from it can
       look "PC works, phone doesn't" even with identical CSS/HTML. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: #eff6f3;
    color: #101d18;
    font-family: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    padding: 10px 16px;
    border: 1px solid #cfdad4;
    border-radius: 10px;
    background: #ffffff;
    color: #101d18;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease;
}

button:hover {
    border-color: #1fdf9c;
}

button:focus-visible {
    outline: 2px solid #1fdf9c;
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.55;
    cursor: default;
}

select {
    min-height: 44px;
    padding: 0 26px 0 10px;
    border: 1px solid #cfdad4;
    border-radius: 10px;
    background-color: #ffffff;
    color: #101d18;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2362766d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 8l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 7px center;
    background-size: 13px;
    padding-right: 26px !important;
    text-overflow: ellipsis;
}

@media (max-width: 400px) {
    select {
        font-size: 14px;
        padding-left: 8px;
    }
}

select:focus-visible {
    outline: none;
    border-color: #1fdf9c;
    box-shadow: 0 0 0 3px rgba(31, 223, 156, 0.18);
}

/* Custom-styled select: real <select> is kept off-screen as the data source */
.jx-select {
    position: relative;
    display: block;
    width: 100%;
}

.jx-select-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.jx-select-trigger {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 0 26px 0 12px;
    border: 1px solid #cfdad4;
    border-radius: 10px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2362766d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 8l5 5 5-5'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 13px;
    color: #101d18;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.jx-select-trigger span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.jx-select.is-open .jx-select-trigger {
    border-color: #1fdf9c;
    box-shadow: 0 0 0 3px rgba(31, 223, 156, 0.18);
    transform: rotate(0);
}

.jx-select.is-open .jx-select-trigger {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%231fdf9c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M15 12l-5-5-5 5'/></svg>");
}

.jx-select-trigger:focus-visible {
    outline: none;
    border-color: #1fdf9c;
    box-shadow: 0 0 0 3px rgba(31, 223, 156, 0.18);
}

.jx-select.is-disabled .jx-select-trigger {
    opacity: 0.55;
    cursor: default;
}

@media (max-width: 400px) {
    .jx-select-trigger {
        font-size: 14px;
        padding-left: 10px;
    }
}

.jx-select-list {
    position: absolute;
    z-index: 60;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 260px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    list-style: none;
    border: 1px solid #dde6e1;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 35, 24, 0.14);
}

.jx-select-option {
    padding: 10px 12px;
    border-radius: 8px;
    color: #101d18;
    font-size: 15px;
    cursor: pointer;
}

.jx-select-option:hover {
    background: #eefaf4;
}

.jx-select-option.is-selected {
    background: #0d2b21;
    color: #ffffff;
    font-weight: 700;
}

input[type="number"],
input[type="text"],
table td {
    font-family:"Inter","Segoe UI",Arial,sans-serif;font-variant-numeric:tabular-nums;
}

.mobile-shell {
    width: min(100%, 460px);
    min-height: 100vh;
    margin: 0 auto;
    background: #ffffff;
}

.topbar {
    padding: 28px 22px 26px;
    background: #17202a;
    color: white;
}

.brand-small {
    margin: 30px 0 8px;
    color: #b8c1cb;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.topbar h1 {
    margin: 0;
    font-size: 32px;
}

.tagline {
    margin: 10px 0 0;
    color: #d7dde4;
    line-height: 1.5;
}

.content {
    padding: 20px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.feature-card {
    min-height: 150px;
    padding: 18px;
    border: 1px solid #dfe4e9;
    border-radius: 18px;
    background: #f9fafb;
    text-align: left;
    cursor: pointer;
}

.feature-card:active {
    transform: scale(0.98);
}

.feature-icon {
    display: block;
    margin-bottom: 12px;
    font-size: 32px;
}

.feature-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.feature-card small {
    display: block;
    color: #66717c;
    line-height: 1.45;
}

.status-card {
    margin-top: 20px;
    padding: 18px;
    border: 1px solid #dfe4e9;
    border-radius: 18px;
    background: #ffffff;
}

.status-label {
    margin: 0;
    color: #727d87;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.status-card h2 {
    margin: 6px 0 16px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid #edf0f2;
}

@media (min-width: 700px) {
    body {
        padding: 30px 0;
    }
}

.hidden {
    display: none !important;
}

.feature-card:disabled {
    cursor: default;
    opacity: 0.55;
}

.feature-card:disabled:active {
    transform: none;
}

/* Home screen visual system � Jiangxin brand */
:root {
    --brand-ink: #071a14;
    --brand-deep: #0d2b21;
    --brand-accent: #1fdf9c;
    --brand-accent-strong: #14b57d;
    --brand-accent-soft: #dcfbef;
    --brand-line: #dde6e1;
    --brand-muted: #62766d;
    --font-heading: "Inter", "Segoe UI", Arial, sans-serif;
    --font-mono: "Inter", "Segoe UI", Arial, sans-serif;
}

#homeScreen {
    min-height: 100vh;
    background: #eff6f3;
}

#homeScreen .topbar h1,
.calculator-header h1 {
    font-family: var(--font-heading);
}

#homeScreen .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    overflow: hidden;
    padding: 30px 24px 26px;
    background: linear-gradient(160deg, var(--brand-ink) 0%, var(--brand-deep) 100%);
}

#homeScreen .topbar::after {
    position: absolute;
    right: -50px;
    bottom: -90px;
    width: 190px;
    height: 190px;
    border: 1px solid rgba(31, 223, 156, 0.16);
    border-radius: 50%;
    box-shadow: 0 0 0 24px rgba(31, 223, 156, 0.035), 0 0 0 48px rgba(31, 223, 156, 0.02);
    content: "";
}

/* Animated hero rig � slow sliding profiles/panes suggesting fabrication in progress */
#homeScreen .hero-anim {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    opacity: 0.22;
    pointer-events: none;
}

#homeScreen .hero-anim span {
    position: absolute;
    display: block;
}

#homeScreen .hero-anim .hero-bar {
    left: -40%;
    width: 45%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--brand-accent), transparent);
    animation: heroSlide 10s linear infinite;
}

#homeScreen .hero-anim .hero-bar:nth-child(1) { top: 22%; animation-duration: 9s; }
#homeScreen .hero-anim .hero-bar:nth-child(2) { top: 47%; animation-duration: 13s; animation-delay: -4s; }
#homeScreen .hero-anim .hero-bar:nth-child(3) { top: 72%; animation-duration: 11s; animation-delay: -7s; }

#homeScreen .hero-anim .hero-pane {
    top: 10%;
    left: -25%;
    width: 120px;
    height: 84px;
    border: 1px solid rgba(31, 223, 156, 0.5);
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(31, 223, 156, 0.12), transparent);
    animation: heroSlide 16s linear infinite;
    animation-delay: -3s;
}

#homeScreen .hero-anim .hero-spark {
    top: 62%;
    left: -6%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--brand-accent);
    box-shadow: 0 0 10px 2px var(--brand-accent);
    animation: heroSpark 5.5s linear infinite;
}

@keyframes heroSlide {
    from { transform: translateX(0); }
    to { transform: translateX(340%); }
}

@keyframes heroSpark {
    from { transform: translateX(0); opacity: 0; }
    8% { opacity: 1; }
    92% { opacity: 1; }
    to { transform: translateX(1700%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    #homeScreen .hero-anim span {
        animation: none !important;
    }
}

#homeScreen .brand-small {
    position: relative;
    z-index: 1;
    color: var(--brand-accent);
    font-size: 12px;
    letter-spacing: 1.4px;
}

#homeScreen .topbar h1 {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: clamp(28px, 7vw, 38px);
    letter-spacing: -0.6px;
}

#homeScreen .topbar h1 .brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid rgba(31, 223, 156, 0.4);
    border-radius: 10px;
    background: rgba(31, 223, 156, 0.12);
    color: var(--brand-accent);
    font-family: var(--font-heading);
    font-size: 15px;
    overflow: hidden;
}

#homeScreen .topbar h1 .brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#homeScreen .tagline {
    position: relative;
    z-index: 1;
    max-width: 320px;
    margin-top: 8px;
    color: #b9c9c1;
    font-size: 14px;
    line-height: 1.5;
}

#homeScreen .content {
    /* static/dashboard-video-bg.js injects the background <video> as an
       absolutely-positioned child sized width/height:100% of THIS
       element, so the video only ever covers as much height as .content
       itself has. .content previously had no height of its own, sizing
       purely to the filter bar + visible tool cards — when few tiles
       were showing, both .content and the video stopped short, exposing
       #homeScreen's own flat background-color below. min-height:100vh
       guarantees the video always covers at least a full viewport, while
       still growing taller naturally when there are many tiles (already
       the existing behaviour in that case, unchanged by this). */
    min-height: 100vh;
    padding: 18px;
    background-color: var(--brand-ink);
    background-image:
        repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 64px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 64px),
        radial-gradient(ellipse at top right, rgba(31,223,156,0.10), transparent 60%);
}

/* Wallet status card */
#homeScreen .fw-banner {
    position: relative;
    margin: 0 0 16px;
    padding: 18px 18px 16px;
    border: 1px solid var(--brand-line);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(15, 35, 24, 0.05);
}

#homeScreen .fw-banner strong {
    position: relative;
    display: block;
    padding-left: 16px;
    color: #142a1f;
    font-size: 15px;
}

#homeScreen .fw-banner strong::before {
    position: absolute;
    top: 4px;
    left: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-accent);
    box-shadow: 0 0 0 3px var(--brand-accent-soft);
    content: "";
}

#homeScreen .fw-banner p {
    margin: 7px 0 14px;
    color: var(--brand-muted);
    font-size: 12.5px;
    line-height: 1.5;
}

#homeScreen .fw-banner button {
    margin: 0;
    padding: 11px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--brand-accent);
    color: var(--brand-ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 140ms ease;
}

#homeScreen .fw-banner button:hover {
    filter: brightness(0.94);
}

#homeScreen .fw-banner button:focus-visible {
    outline: 2px solid var(--brand-accent-strong);
    outline-offset: 2px;
}

/* Filter pill bar. All 7 pills (All tools/Glass/Windows/Doors/Net & Mesh/
   Boards/Bars) are always in the DOM — this row just horizontally
   scrolls past the viewport on narrow/mobile widths, and with the
   scrollbar hidden (below) there was previously no visual cue that more
   pills exist past the edge, reading as if Doors/Boards/etc. were simply
   missing. The mask-image fades the last ~28px of the row to transparent
   so a partially-cut pill reads as "more to scroll" instead of a hard
   clip — fades the element's own edge regardless of scroll position, so
   no separate overlay element or background-color matching is needed. */
#homeScreen .tool-filter-bar {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
}

#homeScreen .tool-filter-bar::-webkit-scrollbar {
    display: none;
}

#homeScreen .tool-filter {
    flex: 0 0 auto;
    padding: 9px 16px;
    border: 1px solid var(--brand-line);
    border-radius: 999px;
    background: #ffffff;
    color: #33463c;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

#homeScreen .tool-filter:hover {
    border-color: var(--brand-accent-strong);
}

#homeScreen .tool-filter:focus-visible {
    outline: 2px solid var(--brand-accent-strong);
    outline-offset: 2px;
}

#homeScreen .tool-filter.is-active {
    border-color: var(--brand-ink);
    background: var(--brand-ink);
    color: #ffffff;
}

/* Tool list cards */
#homeScreen .quick-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#homeScreen .feature-card {
    position: relative;
    display: flex;
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: hidden;
    padding: 18px;
    border: 1.5px solid rgba(255,255,255,0.35);
    border-radius: 16px;
    background: linear-gradient(160deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.01) 55%, rgba(31,223,156,0.03) 100%);
    backdrop-filter: blur(4px) saturate(120%);
    -webkit-backdrop-filter: blur(4px) saturate(120%);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.12);
    text-align: left;
    opacity: 0;
    transition: box-shadow 160ms ease, transform 160ms ease;
    animation: cardFadeUp 480ms ease both;
}

#homeScreen .feature-card::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--brand-accent);
    content: "";
    transform: translateX(-3px);
    transition: transform 160ms ease;
}

#homeScreen .feature-card:hover:not(:disabled)::before,
#homeScreen .feature-card:focus-visible::before {
    transform: translateX(0);
}

#homeScreen .feature-card:hover:not(:disabled),
#homeScreen .feature-card:focus-visible {
    box-shadow: 0 8px 26px rgba(31,223,156,0.38), inset 0 1px 0 rgba(255,255,255,0.22);
    outline: none;
    transform: translateY(-1px);
}

#homeScreen .feature-card:focus-visible {
    box-shadow: 0 0 0 3px var(--brand-accent-soft), 0 8px 22px rgba(15, 35, 24, 0.09);
}

@keyframes cardFadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    #homeScreen .feature-card {
        animation: none;
        opacity: 1;
    }
}

#homeScreen .feature-card:nth-child(1) { animation-delay: 0ms; }
#homeScreen .feature-card:nth-child(2) { animation-delay: 45ms; }
#homeScreen .feature-card:nth-child(3) { animation-delay: 90ms; }
#homeScreen .feature-card:nth-child(4) { animation-delay: 135ms; }
#homeScreen .feature-card:nth-child(5) { animation-delay: 180ms; }
#homeScreen .feature-card:nth-child(6) { animation-delay: 225ms; }
#homeScreen .feature-card:nth-child(7) { animation-delay: 270ms; }
#homeScreen .feature-card:nth-child(8) { animation-delay: 315ms; }
#homeScreen .feature-card:nth-child(9) { animation-delay: 360ms; }
#homeScreen .feature-card:nth-child(10) { animation-delay: 405ms; }
#homeScreen .feature-card:nth-child(11) { animation-delay: 450ms; }
#homeScreen .feature-card:nth-child(12) { animation-delay: 495ms; }

#homeScreen .feature-icon {
    display: grid;
    width: 40px;
    height: 40px;
    margin: 0 0 12px;
    place-items: center;
    border: 1px solid #bdeed4;
    border-radius: 11px;
    background: var(--brand-accent-soft);
    color: var(--brand-ink);
}

#homeScreen .feature-icon svg {
    width: 21px;
    height: 21px;
    color: var(--brand-accent-strong);
}

#homeScreen .feature-card strong {
    max-width: none;
    margin-bottom: 5px;
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 15.5px;
    line-height: 1.25;
}

#homeScreen .feature-card small {
    color: rgba(255,255,255,0.62);
    font-size: 12.5px;
    line-height: 1.45;
}

#homeScreen .feature-card:disabled {
    border-style: dashed;
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.02);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    cursor: default;
}

#homeScreen .feature-card:disabled::before {
    display: none;
}

#homeScreen .feature-card:disabled .feature-icon {
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.35);
}

#homeScreen .feature-card:disabled .feature-icon svg {
    color: rgba(255,255,255,0.35);
}

#homeScreen .soon-tag {
    position: absolute;
    top: 14px;
    right: 14px;
    padding: 3px 9px;
    border-radius: 999px;
    background: #e7ece9;
    color: #62766d;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

#homeScreen .feature-card[hidden],
#homeScreen .feature-card.is-filtered-out {
    display: none !important;
}

@media (min-width: 700px) {
    .mobile-shell {
        width: min(100%, 900px);
        box-shadow: 0 10px 36px rgba(15, 35, 24, 0.08);
    }

    #homeScreen .content {
        padding: 26px;
    }

    #homeScreen .quick-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }
}

@media (min-width: 1040px) {
    #homeScreen .quick-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.calculator-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px;
    background: linear-gradient(160deg, #071a14 0%, #0d2b21 100%);
    color: white;
}

.calculator-header > div {
    min-width: 0;
    flex: 1 1 auto;
}

.calculator-header .brand-small,
.calculator-header h1 {
    overflow-wrap: break-word;
}

.calculator-header .brand-small {
    color: #6ee7bd;
}

.calculator-header h1 {
    margin: 3px 0 0;
    font-family: var(--font-heading, "Inter", Arial, sans-serif);
    font-size: 22px;
}

.back-button {
    position: relative;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1px solid rgba(190, 225, 213, 0.25);
    border-radius: 12px;
    background-color: rgba(7, 26, 20, 0.55);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255%2C255%2C255%2C0.92)' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E"),
        linear-gradient(145deg, rgba(255,255,255,0.10), rgba(255,255,255,0.035));
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    background-size: 17px 17px, 100% 100%;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.28),
        0 1px 2px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.10),
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.04);
    color: #ffffff;
    font-size: 0;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transform: translateY(0);
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease,
        transform 120ms ease;
    overflow: hidden;
}

.back-button::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: 60%;
    height: 55%;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.03) 60%,
        transparent 100%
    );
    border-radius: 12px 4px 0 0;
    pointer-events: none;
    transition: transform 150ms ease, opacity 150ms ease;
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .back-button:hover {
        background-color: rgba(255, 255, 255, 0.07);
        border-color: rgba(190, 225, 213, 0.38);
        box-shadow:
            0 4px 12px rgba(0, 0, 0, 0.32),
            0 1px 3px rgba(0, 0, 0, 0.20),
            inset 0 1px 0 rgba(255, 255, 255, 0.13),
            inset 0 0 0 0.5px rgba(255, 255, 255, 0.06);
        transform: translateY(-1px);
    }

    .back-button:hover::before {
        transform: translateX(3px) translateY(-1px);
        opacity: 0.85;
    }
}

.back-button:active {
    transform: translateY(0) scale(0.94);
    box-shadow:
        0 1px 4px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
    transition-duration: 100ms;
}

.back-button:focus-visible {
    outline: 2px solid #1fdf9c;
    outline-offset: 2px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.28),
        0 0 0 3px rgba(31, 223, 156, 0.18);
}

@media (prefers-reduced-motion: reduce) {
    .back-button,
    .back-button::before {
        transition: none;
    }
    .back-button:active {
        transform: none;
    }
}

.form-card,
.drawing-card,
.results-card {
    position: relative;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #dde6e1;
    border-radius: 16px;
    background: white;
}

.form-card h2,
.drawing-card h2,
.results-card h2 {
    margin: 0;
    font-family: var(--font-heading, "Inter", Arial, sans-serif);
    color: #101d18;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.form-card label {
    display: block;
    color: #4b5c53;
    font-size: 13px;
    font-weight: 700;
}

.measurement-input {
    display: flex;
    align-items: center;
    margin-top: 7px;
    border: 1px solid #cfdad4;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.measurement-input:focus-within {
    border-color: #1fdf9c;
    box-shadow: 0 0 0 3px rgba(31, 223, 156, 0.18);
}

.measurement-input input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 12px;
    border: 0;
    outline: none;
    font-family:"Inter","Segoe UI",Arial,sans-serif;font-variant-numeric:tabular-nums;
    font-size: 16px;
}

.measurement-input span {
    padding-right: 12px;
    color: #6d7d74;
    font-size: 13px;
}

.full-field {
    margin-top: 15px;
}

.full-field input,
.full-field select {
    width: 100%;
    height: 48px;
    margin-top: 7px;
    padding: 0 12px;
    border: 1px solid #cfdad4;
    border-radius: 12px;
    outline: none;
    font-size: 16px;
    background-color: white;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.full-field input:focus-visible,
.full-field select:focus-visible {
    border-color: #1fdf9c;
    box-shadow: 0 0 0 3px rgba(31, 223, 156, 0.18);
}

.primary-button {
    width: 100%;
    min-height: 50px;
    margin-top: 18px;
    border: 0;
    border-radius: 12px;
    background: #1fdf9c;
    color: #071a14;
    font-weight: 700;
    cursor: pointer;
    transition: filter 140ms ease, transform 140ms ease;
}

.primary-button:hover {
    filter: brightness(0.95);
}

.primary-button:active {
    transform: scale(0.99);
}

.primary-button:focus-visible {
    outline: 2px solid #0d2b21;
    outline-offset: 2px;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-kicker {
    margin: 0 0 4px;
    color: #14b57d;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.section-heading strong {
    color: #62766d;
    font-size: 13px;
}

.window-drawing {
    display: flex;
    min-height: 210px;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: 14px;
    background: #f4f6f8;
}

.window-frame {
    display: flex;
    max-width: 100%;
    max-height: 180px;
    border: 8px solid #303a44;
    background: #dce8ee;
}

.window-panel {
    position: relative;
    flex: 1;
    min-width: 0;
    border-right: 4px solid #59636d;
    background: #edf5f8;
}

.window-panel:last-child {
    border-right: 0;
}

.window-panel span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #52606b;
    font-weight: 700;
}

.calculation-note {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 12px;
    background: #eefaf4;
    color: #3d5147;
    font-size: 13px;
    line-height: 1.6;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 7px;
    border-bottom: 1px solid #e5ece8;
    text-align: left;
    white-space: nowrap;
}

th {
    color: #62766d;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

td {
    font-size: 14px;
}

@media (max-width: 360px) {

    .input-grid {
        grid-template-columns: 1fr;
    }

}

@media (min-width: 700px) {
    .mobile-shell {
        min-height: auto;
        border-radius: 24px;
        overflow: hidden;
        /* clip keeps the rounded corners but, unlike hidden, does not stop the fixed headers from working on wide screens */
        overflow: clip;
        box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
    }
}

@media (max-width: 360px) {
    .quick-grid {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================
   MULLION POSITIONING
   ========================================================== */

.position-card {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #dfe4e9;
    border-radius: 18px;
    background: white;
}

.position-card h2 {
    margin: 0;
}

.position-help {
    margin: -4px 0 16px;
    color: #65717c;
    font-size: 13px;
    line-height: 1.5;
}

.positioning-diagram {
    width: 100%;
    margin-bottom: 18px;
    padding: 14px 14px 44px;
    overflow-x: auto;
    border-radius: 12px;
    background: #f4f6f8;
}

.position-line {
    display: flex;
    align-items: stretch;
    min-width: 390px;
    height: 90px;
    border: 2px solid #343e48;
    background: white;
}

.position-frame-block {
    display: flex;
    width: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    background: #39434d;
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.position-space-block {
    display: flex;
    flex: 1;
    min-width: 60px;
    align-items: center;
    justify-content: center;
    background: #eef5f7;
    color: #65717c;
    font-size: 11px;
    font-weight: 700;
}

.position-mullion-block {
    position: relative;
    display: flex;
    width: 46px;
    flex: 0 0 46px;
    align-items: center;
    justify-content: center;
    background: #606b75;
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.position-mullion-block small {
    position: absolute;
    bottom: -30px;
    left: 50%;
    width: 100px;
    transform: translateX(-50%);
    color: #35404a;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

.no-mullion-message {
    padding: 12px;
    color: #65717c;
    font-size: 13px;
    text-align: center;
}


/* ==========================================================
   ACCESSORIES & HARDWARE
   ========================================================== */

.accessories-card {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #dfe4e9;
    border-radius: 18px;
    background: white;
}

.accessories-card h2 {
    margin: 0;
}

.accessory-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.accessory-item {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e3e7eb;
    border-radius: 14px;
    background: #f9fafb;
}

.accessory-item > strong {
    display: block;
    margin-bottom: 10px;
    color: #18212b;
}

.accessory-item p {
    margin: 7px 0;
    color: #5d6974;
    font-size: 13px;
    line-height: 1.45;
}

.accessory-item p strong {
    color: #18212b;
}

.accessory-control {
    display: block;
    margin: 8px 0 12px;
    color: #5d6974;
    font-size: 12px;
    font-weight: 700;
}

.accessory-control select {
    width: 100%;
    min-height: 42px;
    margin-top: 6px;
    padding: 7px 9px;
    border: 1px solid #ccd4dc;
    border-radius: 9px;
    background: white;
    font-size: 14px;
}

.accessory-note {
    padding-top: 8px;
    border-top: 1px solid #e3e7eb;
    font-size: 12px !important;
}

@media (max-width: 390px) {

    .accessory-grid {
        grid-template-columns: 1fr;
    }

}


/* ==========================================================
   ACCESSORIES & HARDWARE
   ========================================================== */

.accessories-card {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #dfe4e9;
    border-radius: 18px;
    background: white;
}

.accessories-card h2 {
    margin: 0;
}

.accessory-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.accessory-item {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e3e7eb;
    border-radius: 14px;
    background: #f9fafb;
}

.accessory-item > strong {
    display: block;
    margin-bottom: 10px;
    color: #18212b;
}

.accessory-item p {
    margin: 7px 0;
    color: #5d6974;
    font-size: 13px;
    line-height: 1.45;
}

.accessory-item p strong {
    color: #18212b;
}

.accessory-control {
    display: block;
    margin: 8px 0 12px;
    color: #5d6974;
    font-size: 12px;
    font-weight: 700;
}

.accessory-control select {
    width: 100%;
    min-height: 42px;
    margin-top: 6px;
    padding: 7px 9px;
    border: 1px solid #ccd4dc;
    border-radius: 9px;
    background: white;
    font-size: 14px;
}

.accessory-note {
    padding-top: 8px;
    border-top: 1px solid #e3e7eb;
    font-size: 12px !important;
}

@media (max-width: 390px) {

    .accessory-grid {
        grid-template-columns: 1fr;
    }

}


.calculation-note {
    display: none !important;
}


/* ==========================================================
   JOB LIST
   ========================================================== */

.secondary-button {
    width: 100%;
    min-height: 48px;
    margin-top: 10px;
    border: 1px solid #0d2b21;
    border-radius: 12px;
    background: white;
    color: #0d2b21;
    font-weight: 700;
    cursor: pointer;
    transition: background 140ms ease;
}

.secondary-button:hover {
    background: #eefaf4;
}

.secondary-button:focus-visible {
    outline: 2px solid #1fdf9c;
    outline-offset: 2px;
}

.job-card {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #dfe4e9;
    border-radius: 18px;
    background: white;
}

.job-empty {
    padding: 18px;
    border-radius: 12px;
    background: #f4f6f8;
    color: #6a7580;
    font-size: 13px;
    text-align: center;
}

.job-window-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #e8ecef;
}

.job-window-info {
    min-width: 0;
}

.job-window-info p {
    margin: 4px 0;
}

.job-window-info small {
    color: #6a7580;
}

.job-window-actions {
    display: flex;
    align-items: end;
    gap: 8px;
    flex-wrap: wrap;
}

.job-window-actions label {
    color: #66717c;
    font-size: 11px;
    font-weight: 700;
}

.job-hardware-field {
    flex: 1 1 100%;
}

.job-hardware-select {
    margin-top: 4px;
}

.job-window-item--pending {
    border-left: 3px solid #e8b923;
    padding-left: 11px;
}

.job-pending-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fdf1d8;
    color: #8a5c0a;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.job-config-warning {
    display: none;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fdf1d8;
    color: #8a5c0a;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.job-config-warning.is-visible {
    display: block;
}

.job-qty-input {
    display: block;
    width: 64px;
    min-height: 40px;
    margin-top: 4px;
    padding: 6px;
    border: 1px solid #cfd6dd;
    border-radius: 9px;
    font-size: 15px;
}

.remove-window-button {
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid #cfd6dd;
    border-radius: 10px;
    background: white;
    cursor: pointer;
}

#generateJobButton:disabled {
    opacity: 0.45;
    cursor: default;
}

@media (max-width: 390px) {

    .job-window-item {
        align-items: flex-start;
        flex-direction: column;
    }

}


/* ==========================================================
   FULL JOB RESULTS
   ========================================================== */

.full-job-card {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #dfe4e9;
    border-radius: 18px;
    background: white;
}

.job-summary-grid {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.job-summary-item {
    padding: 12px;
    border-radius: 12px;
    background: #f4f6f8;
}

.job-summary-item span {
    display: block;
    margin-bottom: 6px;
    color: #6b7680;
    font-size: 11px;
}

.job-summary-item strong {
    font-size: 16px;
}

.job-subheading {
    margin: 24px 0 10px;
    font-size: 16px;
}

@media (max-width: 350px) {

    .job-summary-grid {
        grid-template-columns: 1fr;
    }

}


/* ==========================================================
   ALUMINIUM CUTTING OPTIMIZER
   ========================================================== */

.optimizer-controls {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.optimizer-controls label {
    color: #5f6a75;
    font-size: 12px;
    font-weight: 700;
}

.optimizer-controls select {
    width: 100%;
    min-height: 46px;
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid #ccd4dc;
    border-radius: 10px;
    background: white;
    font-size: 14px;
}

.optimizer-profile {
    margin: 18px 0 24px;
    padding-top: 14px;
    border-top: 1px solid #e3e7eb;
}

.optimizer-profile-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.optimizer-profile-heading strong {
    display: block;
}

.optimizer-profile-heading small {
    display: block;
    margin-top: 3px;
    color: #6c7781;
}

.stock-bar-card {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #e1e6ea;
    border-radius: 12px;
    background: #f9fafb;
}

.stock-bar-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12px;
}

.stock-bar-visual {
    display: flex;
    width: 100%;
    min-height: 42px;
    overflow: hidden;
    border: 1px solid #cfd6dc;
    border-radius: 8px;
    background: white;
}

.stock-cut-piece {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    border-right: 1px solid #9aa4ad;
    background: #dde5ea;
    font-size: 10px;
    font-weight: 700;
}

.stock-remainder {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    background: #f0f2f4;
    color: #68737d;
    font-size: 10px;
}

.stock-cut-list {
    margin-top: 8px;
    color: #68737d;
    font-size: 11px;
    line-height: 1.5;
}

.optimizer-profile-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
    background: #f4f6f8;
    font-size: 12px;
}


.optimizer-offcuts {
    width: 100%;
    margin-top: 8px;
}

.optimizer-offcut-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 7px;
}

.offcut-chip {
    display: inline-block;
    padding: 6px 9px;
    border: 1px solid #d7dde2;
    border-radius: 8px;
    background: white;
    font-size: 11px;
}


.pattern-source-list {
    margin-top: 10px;
    padding: 10px;
    border-radius: 9px;
    background: #eef2f5;
}

.pattern-source-list > strong {
    display: block;
    margin-bottom: 7px;
    font-size: 11px;
}

.pattern-source-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    padding: 5px 0;
    border-top: 1px solid #dce2e7;
    font-size: 10px;
}

.pattern-source-row:first-of-type {
    border-top: 0;
}


/* ==========================================================
   OFFCUT INVENTORY
   ========================================================== */

.offcut-entry-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid #dfe4e9;
    border-radius: 14px;
    background: #f9fafb;
}

.offcut-entry-card label {
    color: #5f6a75;
    font-size: 12px;
    font-weight: 700;
}

.offcut-entry-card select,
.offcut-entry-card input {
    width: 100%;
    min-height: 42px;
    margin-top: 6px;
    padding: 7px 9px;
    border: 1px solid #ccd4dc;
    border-radius: 9px;
    background: white;
}

.offcut-inventory-list {
    margin-bottom: 20px;
}

.offcut-inventory-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #e3e7eb;
}

.offcut-inventory-row div {
    display: grid;
    gap: 3px;
}

.offcut-inventory-row span {
    font-size: 13px;
}

.offcut-inventory-row small {
    color: #6a7580;
}

.remove-offcut-button {
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid #cfd6dd;
    border-radius: 9px;
    background: white;
    cursor: pointer;
}


/* ==========================================================
   WORKSHOP OFFCUT USAGE REPORT
   ========================================================== */

.workshop-usage-card {
    margin: 14px 0;
    padding: 14px;
    border: 1px solid #d6dde3;
    border-radius: 12px;
    background: #f7f9fa;
}

.workshop-usage-title {
    margin-bottom: 10px;
    font-weight: 800;
}

.workshop-usage-section {
    padding: 9px 0;
    border-top: 1px solid #e0e5e9;
    font-size: 11px;
    line-height: 1.7;
}

.workshop-usage-section > strong {
    display: block;
    margin-bottom: 4px;
}

.workshop-cut-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
}

.workshop-new-stock {
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
    background: white;
    font-size: 12px;
}


/* ==========================================================
   WORKSHOP GLASS OFFCUT INVENTORY
   ========================================================== */

.glass-offcut-entry-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    margin-bottom: 14px;
    border: 1px solid #dde6e1;
    border-radius: 14px;
    background: #f6faf8;
}

.glass-offcut-entry-card label {
    color: #4b5c53;
    font-size: 12px;
    font-weight: 700;
}

.glass-offcut-entry-card input,
.glass-offcut-entry-card textarea {
    width: 100%;
    min-height: 42px;
    margin-top: 6px;
    padding: 7px 9px;
    border: 1px solid #cfdad4;
    border-radius: 9px;
    background: white;
    font-family:"Inter","Segoe UI",Arial,sans-serif;font-variant-numeric:tabular-nums;
}

.glass-offcut-entry-card textarea {
    font-family:"Inter","Segoe UI",Arial,sans-serif;font-variant-numeric:tabular-nums;
    resize: vertical;
}

.glass-offcut-entry-card input:focus-visible,
.glass-offcut-entry-card textarea:focus-visible {
    outline: none;
    border-color: #1fdf9c;
    box-shadow: 0 0 0 3px rgba(31, 223, 156, 0.18);
}

/* Unified glass search control (merges Deep Search + Server Search visually) */
.glass-search-unified {
    margin-top: 14px;
}

.glass-search-modes {
    display: flex;
    gap: 6px;
    padding: 4px;
    margin-bottom: 12px;
    border: 1px solid #dde6e1;
    border-radius: 12px;
    background: #f2f7f4;
}

.glass-search-mode {
    flex: 1 1 0;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #4b5c53;
    font-size: 13px;
    font-weight: 700;
}

.glass-search-mode.is-active {
    background: #0d2b21;
    color: #ffffff;
}

.glass-search-status {
    margin: 10px 0 0;
    color: #4b5c53;
    font-size: 13px;
    line-height: 1.55;
}

.glass-search-progress {
    width: 100%;
    margin-top: 10px;
    accent-color: #1fdf9c;
}

.glass-offcut-inventory-list {
    margin-bottom: 20px;
}

.glass-offcut-inventory-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #e3e7eb;
}

.glass-offcut-inventory-row div {
    display: grid;
    gap: 3px;
}

.glass-offcut-inventory-row small {
    color: #6a7580;
}

.remove-glass-offcut-button {
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid #cfd6dd;
    border-radius: 9px;
    background: white;
    cursor: pointer;
}


/* ==========================================================
   GLASS SHEET OPTIMIZER
   ========================================================== */

.glass-optimizer-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0;
    padding: 12px;
    border: 1px solid #dce2e7;
    border-radius: 12px;
    background: #f8fafb;
}

.glass-optimizer-controls div {
    display: grid;
    gap: 2px;
}

.glass-optimizer-controls span {
    color: #68737d;
    font-size: 12px;
}

.glass-optimizer-report {
    margin-top: 14px;
}

.glass-optimizer-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.glass-optimizer-summary div {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid #dce2e7;
    border-radius: 10px;
    background: #f8fafb;
}

.glass-optimizer-summary strong {
    font-size: 20px;
}

.glass-optimizer-summary span {
    color: #68737d;
    font-size: 11px;
}

.glass-plan-card {
    margin: 10px 0;
    padding: 12px;
    border: 1px solid #dde3e8;
    border-radius: 11px;
    background: white;
}

.glass-cut-list {
    margin-top: 8px;
    color: #66717b;
    font-size: 11px;
    line-height: 1.6;
}


/* ==========================================================
   GLASS CUTTING DRAWINGS
   ========================================================== */

.glass-plan-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.glass-plan-heading span {
    font-size: 11px;
    color: #68737d;
}

.glass-sheet-drawing {
    position: relative;
    width: 100%;
    max-width: 760px;
    margin: 30px auto 18px;
    border: 2px solid #303841;
    background: #ffffff;
    overflow: visible;
}

.glass-cut-piece {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px solid #56616b;
    background: #e9eef2;
    overflow: hidden;
    text-align: center;
    font-size: 9px;
    line-height: 1.15;
}

.glass-cut-piece strong {
    padding: 2px;
    font-size: 9px;
}

.glass-cut-piece small {
    font-size: 7px;
}

.glass-unused-area {
    position: absolute;
    box-sizing: border-box;
    border: 1px dashed #a8b0b7;
    background: #fafafa;
    overflow: hidden;
}

.glass-unused-area span {
    position: absolute;
    top: 3px;
    left: 3px;
    font-size: 7px;
    color: #89939c;
}

.glass-sheet-width-label {
    position: absolute;
    left: 50%;
    top: -22px;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
}

.glass-sheet-height-label {
    position: absolute;
    top: 50%;
    left: -42px;
    transform:
        translateY(-50%)
        rotate(-90deg);
    font-size: 10px;
    font-weight: 700;
}


.glass-source-window {
    display: block;
    margin-top: 2px;
    font-size: 8px;
    font-weight: 800;
}

.glass-source-measurement {
    display: block;
    margin-top: 1px;
    font-size: 7px;
    line-height: 1.1;
}


.glass-strip-badge span {
    display: block;
    font-size: 7px;
    line-height: 1;
}

.glass-strip-badge strong {
    display: block;
    font-size: 8px;
    line-height: 1.05;
}


.material-price-card {
    margin: 18px 0 24px;
    padding: 16px;
    border: 1px solid #d8dee4;
    border-radius: 12px;
    background: #fafbfc;
}

.material-price-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.material-price-grid label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 13px;
    font-weight: 700;
}

.material-price-grid label span {
    font-size: 11px;
    font-weight: 400;
    color: #68737d;
}

.material-price-grid input {
    width: 100%;
    box-sizing: border-box;
}


.quotation-card {
    margin: 18px 0 24px;
    padding: 16px;
    border: 1px solid #d8dee4;
    border-radius: 12px;
    background: #ffffff;
}

.quotation-results {
    margin-top: 16px;
}

.quotation-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
}

.quotation-row span {
    display: flex;
    flex-direction: column;
}

.quotation-row small {
    margin-top: 2px;
    font-size: 11px;
    color: #6b7280;
}

.quotation-row strong {
    white-space: nowrap;
}

.quotation-grand-total {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
    padding: 14px;
    border-radius: 10px;
    background: #f3f4f6;
    font-size: 16px;
    font-weight: 800;
}



/* EBM UI REFRESH V1 */
#ebmScreen,
#ebmScreen * {
    box-sizing: border-box;
}
#ebmScreen {
    font-family: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
    color: #192b3a;
    background: #f3f6f9;
    line-height: 1.5;
}
#ebmScreen.hidden,
#ebmScreen .hidden,
#ebmScreen [hidden] {
    display: none !important;
}
#ebmScreen .content {
    padding: 16px;
}
#ebmScreen .calculator-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 20px;
    background: #142b3b;
    color: white;
}
#ebmScreen .calculator-header h1 {
    margin: 4px 0 0;
    font-size: 24px;
    line-height: 1.2;
}
#ebmScreen .brand-small {
    font-size: 10px;
    letter-spacing: 1px;
    color: #bfd2df;
}
#ebmScreen 
#ebmScreen .content > section {
    min-width: 0;
    margin: 0 0 18px;
    padding: 20px;
    border: 1px solid #dce4eb;
    border-radius: 16px;
    background: white;
    box-shadow: 0 3px 12px rgba(20,43,59,.035);
}
#ebmScreen h2 {
    font-size: 20px;
    line-height: 1.3;
}
#ebmScreen h3 {
    margin: 22px 0 12px;
    font-size: 16px;
}
#ebmScreen .section-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}
#ebmScreen .section-heading h2 {
    margin: 0;
}
#ebmScreen .section-kicker {
    margin: 0 0 6px;
    color: #557184;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}
#ebmScreen label {
    display: block;
    min-width: 0;
    margin-bottom: 12px;
    color: #42586a;
    font-size: 13px;
    font-weight: 600;
}
#ebmScreen input,
#ebmScreen select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    margin-top: 7px;
    padding: 10px 12px;
    border: 1px solid #becdd9;
    border-radius: 10px;
    background: #fff;
    color: #192b3a;
    font: inherit;
    font-size: 16px;
}
#ebmScreen input:focus-visible,
#ebmScreen select:focus-visible,
#ebmScreen button:focus-visible {
    outline: 3px solid #8cc6e5;
    outline-offset: 2px;
}
#ebmScreen .input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 14px;
    margin-top: 16px;
}
#ebmScreen .measurement-input {
    display: flex;
    align-items: center;
    margin-top: 7px;
    border: 1px solid #becdd9;
    border-radius: 10px;
    background: white;
    overflow: hidden;
}
#ebmScreen .measurement-input input {
    margin: 0;
    border: 0;
    border-radius: 0;
}
#ebmScreen .measurement-input:focus-within {
    outline: 3px solid #8cc6e5;
    outline-offset: 2px;
}
#ebmScreen .measurement-input input:focus-visible {
    outline: none;
}
#ebmScreen .measurement-input span {
    padding-right: 12px;
    font-size: 12px;
    color: #63788a;
}
#ebmScreen .primary-button,
#ebmScreen .secondary-button {
    width: 100%;
    min-height: 50px;
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
}
#ebmScreen .primary-button {
    border: 1px solid #165779;
    background: #165779;
    color: white;
}
#ebmScreen .secondary-button {
    border: 1px solid #aac4d4;
    background: #f0f7fb;
    color: #164b68;
}
#ebmScreen button:disabled {
    opacity: .45;
    cursor: default;
}
#ebmScreen .accessory-grid,
#ebmScreen .job-summary-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
}
#ebmScreen .accessory-item,
#ebmScreen .job-summary-item {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e0e8ef;
    border-radius: 12px;
    background: #f7fafc;
}
#ebmScreen .accessory-item > strong {
    font-size: 13px;
}
#ebmScreen .accessory-item p {
    color: #3b6078;
    font-size: 13px;
}
#ebmScreen .job-window-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 12px 0;
    padding: 16px;
    border: 1px solid #dce6ed;
    border-radius: 12px;
    background: #f7fafc;
}
#ebmScreen .job-window-info p {
    margin: 4px 0;
    font-size: 14px;
}
#ebmScreen .job-window-info .job-config-summary {
    display: block;
    margin-top: 4px;
}
/* Download PDF button — amber, distinct from the green primary action,
   matching the established Jiangxin export-button convention
   (#glassOnlyResultsDownloadBtn). */
#ebmScreen #ebmPdfDownloadBtn {
    margin-top: 14px;
    background: linear-gradient(180deg, #e8a53d, #c9861f);
    color: #ffffff;
    border: 0;
    box-shadow: 0 6px 16px rgba(201, 134, 31, 0.32);
}
#ebmScreen #ebmPdfDownloadBtn:disabled {
    opacity: 0.5;
    box-shadow: none;
    cursor: default;
}
#ebmScreen .job-window-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
#ebmScreen .job-window-actions label {
    margin: 0;
}
#ebmScreen .job-qty-input {
    width: 80px;
}
#ebmScreen .remove-window-button {
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid #d8c2c2;
    border-radius: 10px;
    background: white;
    color: #893e3e;
}
#ebmScreen #ebmOwnJobCount {
    padding: 6px 10px;
    border-radius: 8px;
    background: #edf5fa;
    color: #24536f;
    font-size: 12px;
}
#ebmScreen #ebmOwnResults > h2 {
    margin: 28px 0 12px;
    padding-top: 20px;
    border-top: 1px solid #e2e9ef;
}
#ebmScreen .table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e0e7ee;
    border-radius: 10px;
}
#ebmScreen table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}
#ebmScreen th,
#ebmScreen td {
    padding: 12px 9px;
    border-bottom: 1px solid #e7edf2;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
    font-size: 12px;
}
#ebmScreen th {
    background: #edf3f7;
    color: #486174;
    font-size: 11px;
}
#ebmScreen tbody tr:nth-child(even) {
    background: #f8fafc;
}
#ebmScreen tbody tr:last-child td {
    border-bottom: 0;
}
#ebmScreen .ebm-offcut-inventory,
#ebmScreen .ebm-aluminium-optimizer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #dce6ed;
}
#ebmScreen .optimizer-profile {
    margin: 18px 0;
    padding: 16px 0;
    border-top: 2px solid #dce8f0;
}
#ebmScreen .optimizer-profile p,
#ebmScreen .ebm-aluminium-optimizer > p,
#ebmScreen .ebm-offcut-inventory > p {
    color: #526c7e;
    font-size: 13px;
}
#ebmScreen #ebmAluminiumOptimizerResults > p {
    padding: 14px;
    border-radius: 10px;
    background: #edf6fa;
    color: #234f69;
}
@media (max-width: 380px) {
    #ebmScreen .content {
        padding: 10px;
    }
    #ebmScreen .content > section {
        padding: 14px;
    }
    #ebmScreen .input-grid,
    #ebmScreen .accessory-grid {
        grid-template-columns: 1fr;
    }
    #ebmScreen .job-window-item {
        align-items: flex-start;
        flex-direction: column;
    }
}
/* END EBM UI REFRESH V1 */

/* ============================================================
   Jiangxin � global consistency pass (appended, does not edit
   any existing rule above; CSS cascade lets these override
   only the specific properties listed).
   ============================================================ */

/* 1. Apply the heading font site-wide instead of the Arial
      fallback at the top of the file. Numbers/mono inputs keep
      IBM Plex Mono from the existing rule further up. */
html,
body {
    font-family: var(--font-heading);
}

/* 2. Give every card real depth to match the home screen and
      the 1125/26 mockup, instead of a flat thin border. */
.form-card,
.drawing-card,
.results-card {
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(15, 35, 24, 0.04), 0 4px 16px rgba(15, 35, 24, 0.06);
}

/* 3. Reusable icon + title + subtitle header for the inside of
      any card � matches the pattern used on the 1125/26 page.
      Not yet used anywhere; we'll add it to each calculator's
      markup one screen at a time. */
.card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.card-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    background: var(--brand-accent-soft);
    color: var(--brand-accent-strong);
}

.card-icon svg {
    width: 18px;
    height: 18px;
}

.card-head h2 {
    margin: 0;
    font-size: 16.5px;
}

.card-sub {
    margin: 2px 0 0;
    color: var(--brand-muted);
    font-size: 13px;
}

/* ============================================================
   Home screen depth pass � closing the gap with the Net page
   ============================================================ */

/* Bigger, bolder icon badges � border + shadow give them the
   same "designed" weight as the Net page's card icons. */
#homeScreen .feature-icon {
    width: 46px;
    height: 46px;
    border: 1px solid #bdeed4;
    border-radius: 13px;
    box-shadow: 0 2px 6px rgba(20, 181, 125, 0.15);
}

#homeScreen .feature-icon svg {
    width: 23px;
    height: 23px;
}

/* Stronger hover lift to feel more tactile */
#homeScreen .feature-card:hover:not(:disabled),
#homeScreen .feature-card:focus-visible {
    box-shadow: 0 12px 38px rgba(31,223,156,0.45), inset 0 1px 0 rgba(255,255,255,0.22);
    transform: translateY(-3px);
}

/* Credit banner: give it the same "info card with accent
   left border" treatment as the Net page's caution box,
   instead of a plain white card with just a dot. */
#homeScreen .fw-banner {
    padding: 18px 18px 16px 20px;
    border: 1px solid var(--brand-line);
    border-left: 4px solid var(--brand-accent);
    border-radius: 14px;
    background: linear-gradient(180deg, var(--brand-accent-soft) 0%, #ffffff 55%);
}

#homeScreen .fw-banner strong {
    padding-left: 0;
}

#homeScreen .fw-banner strong::before {
    display: none;
}

/* Section label above the tool grid, so the grid doesn't just
   start abruptly after the filter pills */
#homeScreen .tool-filter-bar::before {
    display: block;
    width: 100%;
    margin-bottom: 2px;
    color: var(--brand-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    content: "Choose a tool";
}

/* ============================================================
   Glass Cutting Calculator � fix flat/blended entry cards
   ============================================================ */

/* Stronger contrast so the grey box actually reads as a box */
.glass-offcut-entry-card {
    border: 1px solid #cfe0d8;
    background: #eef6f2;
    box-shadow: inset 0 1px 2px rgba(15, 35, 24, 0.03);
}

/* Style the bare <h3> ("Paste Glass Sizes") to match the heading font */
.glass-offcut-entry-card h3 {
    margin: 0 0 2px;
    color: #101d18;
    font-family: var(--font-heading);
    font-size: 15px;
}

.glass-offcut-entry-card > label,
.glass-offcut-entry-card > p {
    margin: 0;
}

.glass-offcut-entry-card p {
    color: var(--brand-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

/* "OR" divider between the two glass-offcut-entry-cards that sit
   back to back inside the Add Glass Size card */
.glass-offcut-entry-card + .glass-offcut-entry-card {
    position: relative;
    margin-top: 22px;
}

.glass-offcut-entry-card + .glass-offcut-entry-card::before {
    position: absolute;
    top: -22px;
    left: 50%;
    padding: 2px 10px;
    transform: translateX(-50%);
    border: 1px solid #dde6e1;
    border-radius: 999px;
    background: #ffffff;
    color: var(--brand-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    content: "or paste multiple";
}

/* ============================================================
   Global button unification � matches the 1125/26 Net page's
   gradient primary button and header subtitle style, applied
   app-wide via the shared .primary-button/.secondary-button
   classes so every calculator benefits at once.
   ============================================================ */

.header-subtitle {
    margin: 4px 0 0;
    color: #b9c9c1;
    font-size: 12.5px;
    line-height: 1.4;
}

.primary-button {
    background: linear-gradient(180deg, var(--brand-accent), var(--brand-accent-strong));
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(20, 181, 125, 0.32);
}

.primary-button:hover {
    filter: brightness(1.03);
    box-shadow: 0 8px 20px rgba(20, 181, 125, 0.4);
}

.secondary-button {
    border: 1.5px solid #cfe0d8;
    background: #ffffff;
    color: var(--brand-ink);
    box-shadow: none;
}

.secondary-button:hover {
    border-color: var(--brand-accent-strong);
    background: var(--brand-accent-soft);
}

/* ============================================================
   Back button icon � swap to plain chevron matching the
   1125/26 Net page (was: arrow-with-line, heavier weight)
   ============================================================ */


/* Home page "Open test wallet" � match Net's gradient + white text */
#homeScreen .fw-banner button {
    background: linear-gradient(180deg, var(--brand-accent), var(--brand-accent-strong));
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(20, 181, 125, 0.32);
}

/* ============================================================
   Glass results area � brand consistency + mobile overflow fix
   ============================================================ */

.glass-optimizer-summary div {
    border: 1px solid var(--brand-line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 35, 24, 0.04), 0 4px 16px rgba(15, 35, 24, 0.06);
}

.glass-optimizer-summary strong {
    color: var(--brand-ink);
    font-family: var(--font-heading);
}

.glass-optimizer-summary span,
.glass-plan-heading span,
.glass-cut-list {
    color: var(--brand-muted);
}

.glass-plan-card {
    border: 1px solid var(--brand-line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(15, 35, 24, 0.04), 0 4px 16px rgba(15, 35, 24, 0.06);
}

/* Fix: drawing was capped at 760px but the app shell is only
   460px wide on mobile, causing the sheet layout to overflow
   and clip text on the right edge. */
.glass-sheet-drawing {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* Download PDF button � only relevant once results exist */
#glassOnlyResultsDownloadBtn {
    margin-top: 14px;
}

/* Download PDF button � amber, distinct from the green primary
   action, ties into the optimizer's own cut-piece color coding */
#glassOnlyResultsDownloadBtn {
    background: linear-gradient(180deg, #e8a53d, #c9861f);
    color: #ffffff;
    border: 0;
    box-shadow: 0 6px 16px rgba(201, 134, 31, 0.32);
}

#glassOnlyResultsDownloadBtn:hover {
    filter: brightness(1.03);
    box-shadow: 0 8px 20px rgba(201, 134, 31, 0.4);
}

/* ============================================================
   Glass sheet pieces � color-coded by finished size so
   identical cuts are visually grouped across the sheet
   ============================================================ */
.glass-color-0 { background: #d6f0e6; border-color: #14b57d; }
.glass-color-1 { background: #dceafd; border-color: #3b7fd6; }
.glass-color-2 { background: #fde8d6; border-color: #d67f2f; }
.glass-color-3 { background: #f3dcfa; border-color: #a24fc9; }
.glass-color-4 { background: #fde0e3; border-color: #d64b5c; }
.glass-color-5 { background: #fdf3c9; border-color: #c9a11f; }
.glass-color-6 { background: #d6f4f0; border-color: #1fa89c; }
.glass-color-7 { background: #e3e0fd; border-color: #6a5fd6; }
.glass-color-8 { background: #ffe6f0; border-color: #d64f96; }
.glass-color-9 { background: #eaf5d6; border-color: #7fa82f; }

/* ============================================================
   PDF export contrast boost � only active during capture
   (body.jx-pdf-capture), makes pastel sheet colors read
   punchier on paper without changing the live on-screen look
   ============================================================ */
body.jx-pdf-capture .glass-color-0 { background: #a8e6cd; border-width: 2px; }
body.jx-pdf-capture .glass-color-1 { background: #aecbf5; border-width: 2px; }
body.jx-pdf-capture .glass-color-2 { background: #f7c99a; border-width: 2px; }
body.jx-pdf-capture .glass-color-3 { background: #e0b0f0; border-width: 2px; }
body.jx-pdf-capture .glass-color-4 { background: #f5aeb6; border-width: 2px; }
body.jx-pdf-capture .glass-color-5 { background: #f0dd85; border-width: 2px; }
body.jx-pdf-capture .glass-color-6 { background: #9ee6dc; border-width: 2px; }
body.jx-pdf-capture .glass-color-7 { background: #c2b8f5; border-width: 2px; }
body.jx-pdf-capture .glass-color-8 { background: #f5aed1; border-width: 2px; }
body.jx-pdf-capture .glass-color-9 { background: #d1e69e; border-width: 2px; }
body.jx-pdf-capture .glass-cut-piece strong,
body.jx-pdf-capture .glass-cut-piece span {
    color: #101d18;
    font-weight: 700;
}

/* ============================================================
   Disabled primary buttons � keep them recognizably green
   instead of washing out to near-invisible grey at 0.55 opacity
   ============================================================ */
.primary-button:disabled {
    opacity: 1;
    background: #a8ecd4;
    color: #4f8a72;
    box-shadow: none;
    cursor: default;
}

/* Style the "Cost selected sheets' offcuts" button as primary,
   without needing to touch its JS click-handler insertion point */
#glassOnlyResults > div > button[type="button"]:not(.primary-button):not(.remove-window-button):not(.secondary-button) {
    display: inline-block;
    width: auto;
    min-height: 44px;
    margin-top: 12px;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--brand-ink);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(7, 26, 20, 0.25);
}

/* ============================================================
   Glass Offcut Costing � two-column diagram+table layout,
   stat cards, and Customer/Seller toggle buttons
   ============================================================ */
.jx-cost-stats {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: none !important;
    border: none !important;
    padding: 0 !important;
}

@media (min-width: 700px) {
    .jx-cost-stats { grid-template-columns: repeat(4, 1fr); }
}

.jx-stat-card {
    display: flex !important;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #cfe0d8 !important;
    border-radius: 14px !important;
    background: #ffffff !important;
    padding: 14px !important;
    box-shadow: 0 1px 2px rgba(15, 35, 24, 0.04), 0 4px 16px rgba(15, 35, 24, 0.06);
}

.jx-stat-card span {
    order: 2;
    color: #62766d;
    font-size: 11.5px;
    font-weight: 600;
}

.jx-stat-card strong {
    order: 1;
    color: #101d18;
    font-size: 17px;
    font-family: "Inter", Arial, sans-serif;
}

.jx-sheet-card {
    border: 1px solid #cfe0d8 !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 2px rgba(15, 35, 24, 0.04), 0 4px 16px rgba(15, 35, 24, 0.06);
}

.jx-sheet-badge {
    display: inline-block;
    background: linear-gradient(180deg, #1fdf9c, #14b57d);
    color: #071a14;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
    padding: 4px 12px;
    border-radius: 999px;
    text-transform: uppercase;
    margin-right: 10px;
    box-shadow: 0 2px 8px rgba(20, 181, 125, 0.28);
}

.jx-sheet-dims {
    color: #ffffff;
}

.cost-dialog .jx-sheet-dims {
    color: #101d18;
}

.jx-goto-sheet {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: #eef6f3;
    border: 1px solid #cfe0d8;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 16px 0;
}

.jx-goto-sheet-label {
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #0d2b21;
}

.jx-goto-sheet-input {
    width: 90px !important;
    margin: 0 !important;
    min-height: 40px !important;
}

.jx-goto-sheet-btn {
    background: linear-gradient(180deg, #1fdf9c, #14b57d) !important;
    color: #071a14 !important;
    border: 0 !important;
    font-weight: 700 !important;
    min-height: 40px !important;
    margin: 0 !important;
}

.jx-goto-sheet-status {
    width: 100%;
    margin: 4px 0 0 !important;
    font-size: 13px;
}

#offcutCostScreen .jx-goto-sheet-status {
    color: #b23b3b;
}

.jx-cost-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 10px;
}

@media (min-width: 760px) {
    .jx-cost-layout { flex-direction: row; align-items: flex-start; }
    .jx-cost-diagram { flex: 0 0 auto; }
    .jx-cost-table { flex: 1 1 auto; min-width: 0; }
}

.jx-cost-table-heading {
    font-family: "Inter", Arial, sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: #ffffff;
}

.jx-cost-table-sub {
    margin: 2px 0 12px !important;
    color: #a9c8bc;
    font-size: 12.5px;
}

.jx-offcut-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1.3fr) 70px 100px 150px;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #eef0f4;
}

.jx-offcut-header {
    border-top: none;
    border-bottom: 2px solid #cfe0d8;
    padding-bottom: 8px;
    color: #a9c8bc;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.jx-offcut-num {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #eef6f3;
    color: #0d2b21;
    font-size: 11px;
    font-weight: 700;
}

.jx-offcut-header .jx-offcut-num,
.jx-offcut-header span:first-child {
    background: none;
    width: auto;
    height: auto;
}

.jx-offcut-size {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.jx-offcut-fit,
.jx-offcut-credit {
    font-size: 13px;
    color: #d7ece3;
    font-weight: 600;
    cursor: help;
}

.jx-offcut-toggles {
    display: flex;
    gap: 6px;
}

.jx-offcut-toggles button {
    min-height: 0 !important;
    margin: 0 !important;
    padding: 7px 12px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    border: 1.5px solid #cfe0d8 !important;
    background: #ffffff !important;
    color: #4b5c53 !important;
}

.jx-offcut-toggles button.is-active {
    background: #0d2b21 !important;
    border-color: #0d2b21 !important;
    color: #ffffff !important;
}

.cost-dialog {
    background: #ffffff;
    color: #101d18;
    color-scheme: light;
}
/* Full-sheet popup dialog � force stacked layout regardless of
   viewport width, since the dialog is narrower than a full page
   and the diagram needs its own full-width row to stay readable */
.cost-dialog .jx-cost-layout {
    flex-direction: column !important;
}

.cost-dialog .jx-cost-diagram,
.cost-dialog .jx-cost-table {
    flex: 1 1 auto !important;
    width: 100%;
}

.cost-dialog .jx-offcut-info strong,
.cost-dialog .jx-offcut-fit,
.cost-dialog .jx-offcut-credit {
    white-space: normal;
}

.cost-dialog .jx-offcut-row {
    align-items: flex-start;
}

/* Inside the light full-sheet dialog, the reusable-offcuts table
   is the same DOM moved from the dark card, so its light-on-dark
   text colors need dark counterparts here instead. */
.cost-dialog .jx-cost-table-heading {
    color: #101d18;
}

.cost-dialog .jx-cost-table-sub {
    color: #62766d;
}

.cost-dialog .jx-offcut-header {
    color: #62766d;
}

.cost-dialog .jx-offcut-size {
    color: #101d18;
}

.cost-dialog .jx-offcut-fit,
.cost-dialog .jx-offcut-credit {
    color: #4b5c53;
}

/* ============================================================
   Glass Offcut Costing � utilisation badge, info banner, navbar
   ============================================================ */
.jx-util-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.jx-full-badge {
    padding: 3px 10px;
    border-radius: 999px;
    background: #dcfbef;
    color: #0d6b4a;
    font-size: 11px;
    font-weight: 700;
}

.jx-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid #bcd9ff;
    border-radius: 12px;
    background: #eef5ff;
    color: #2a4d80 !important;
    padding: 12px 14px !important;
}

.jx-info-banner::before {
    content: "i";
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #2a6fd6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    font-style: italic;
}

.jx-price-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 600px) {
    .jx-price-row {
        flex-direction: row;
    }
    .jx-price-row > label {
        flex: 1 1 0;
        min-width: 0;
    }
}

.jx-stat-icon {
    order: 0;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    margin-bottom: 6px;
}

.jx-stat-icon svg {
    width: 18px;
    height: 18px;
}

.jx-sheet-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.jx-sheet-chevron {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    color: #62766d;
    transition: transform 0.2s ease;
}

.jx-sheet-chevron.is-open {
    transform: rotate(180deg);
}

.jx-sheet-body.is-collapsed {
    display: none;
}

/* Glass Offcut Costing — premium header (scoped to #offcutCostScreen so
   other screens' .calculator-header/.back-button are unaffected) */
#offcutCostScreen .jx-costing-header {
    flex-wrap: wrap;
    row-gap: 16px;
}

/* .calculator-header button (job-wallet.css) and #offcutCostScreen button
   (glass-offcut-costing.js inline theme) both carry higher-precedence rules
   that strip the reused .back-button's chevron background-image and colors;
   restate them explicitly, scoped to just this header, so the shared
   .back-button component still renders correctly here. */
#offcutCostScreen .jx-costing-header .back-button {
    background-color: rgba(7, 26, 20, 0.55) !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255%2C255%2C255%2C0.92)' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'/%3E%3C/svg%3E"),
        linear-gradient(145deg, rgba(255,255,255,0.10), rgba(255,255,255,0.035)) !important;
    background-repeat: no-repeat, no-repeat !important;
    background-position: center, center !important;
    background-size: 17px 17px, 100% 100% !important;
    border: 1px solid rgba(190, 225, 213, 0.25) !important;
    padding: 0 !important;
}

#offcutCostScreen .jx-costing-identity-text {
    flex: 1 1 260px;
    min-width: 0;
}

#offcutCostScreen .calculator-header h2 {
    margin: 3px 0 0;
    font-family: "Inter", Arial, sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    overflow-wrap: break-word;
}

#offcutCostScreen .jx-cost-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    justify-content: flex-end;
}

#offcutCostScreen .jx-nav-back,
#offcutCostScreen .jx-nav-home,
#offcutCostScreen .jx-nav-print {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px !important;
    margin: 0 !important;
    min-height: 44px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
    white-space: normal;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    transition: transform 120ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

#offcutCostScreen .jx-nav-btn-icon {
    flex: 0 0 auto;
    display: inline-flex;
    width: 20px;
    height: 20px;
}

#offcutCostScreen .jx-nav-btn-icon svg {
    width: 100%;
    height: 100%;
}

#offcutCostScreen .jx-nav-back {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(150, 255, 220, 0.30) !important;
    color: #ffffff !important;
}

#offcutCostScreen .jx-nav-home {
    background: linear-gradient(180deg, #34e0ac, #10bd89) !important;
    border: 0 !important;
    color: #ffffff !important;
}

#offcutCostScreen .jx-nav-print {
    background: linear-gradient(180deg, #f2aa32, #d4860d) !important;
    border: 0 !important;
    color: #ffffff !important;
}

@media (hover: hover) and (pointer: fine) {
    #offcutCostScreen .jx-nav-back:hover,
    #offcutCostScreen .jx-nav-home:hover,
    #offcutCostScreen .jx-nav-print:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24);
    }
}

#offcutCostScreen .jx-nav-back:focus-visible,
#offcutCostScreen .jx-nav-home:focus-visible,
#offcutCostScreen .jx-nav-print:focus-visible {
    outline: 2px solid #1fdf9c;
    outline-offset: 2px;
}

@media (max-width: 680px) {
    #offcutCostScreen .jx-cost-header-actions {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
    #offcutCostScreen .jx-nav-back,
    #offcutCostScreen .jx-nav-home {
        flex: 1 1 auto;
    }
    #offcutCostScreen .jx-nav-print {
        flex: 1 1 100%;
    }
}


/* Card-head sections that appear mid-card (not as the card's
   first element) need breathing room + a divider from whatever
   came before them - e.g. Door Size / Frame Setup sharing one card */
.card-head:not(:first-child) {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid #eef0f4;
}


/* ============================================================
   Home screen: compact notice cards so the tools start higher
   up the screen (wallet + profile banners were taking a full
   screen of space before the first tool).
   ============================================================ */
#homeScreen .fw-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
    row-gap: 4px;
    padding: 12px 14px 12px 16px;
    margin: 10px 0;
}
#homeScreen .fw-banner strong { flex: 1 1 100%; font-size: 14px; }
#homeScreen .fw-banner p { flex: 1 1 60%; margin: 0; font-size: 12.5px; line-height: 1.4; }
#homeScreen .fw-banner button { flex: 0 0 auto; margin: 4px 0 0 auto; padding: 9px 14px; font-size: 13px; }
/* "Choose a tool" label above the filter pills: the home background is dark,
   so the muted grey was unreadable. */
#homeScreen .tool-filter-bar::before {
    color: #ffffff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
/* ============================================================
   Readability pass (found by an automated contrast audit)
   ============================================================ */

/* "Start a Project" screens: field labels were mid-grey on a very dark
   background. */
section[id$="ProjectGateScreen"] label,
section[id^="doorGate"] label,
#localToolGateScreen label {
    color: #d3e8de !important;
}

/* Glass Offcut Costing: the explanation inside the white card was white on
   near-white (invisible). */
#offcutCostScreen .cost-empty,
#offcutCostScreen .cost-empty p {
    color: #27392f !important;
}

/* EBM: white text on mid-green buttons was hard to read; use the same dark
   ink the other primary buttons use. */
#ebmScreen .primary-button,
#ebmIndependentJob .primary-button {
    color: #071a14 !important;
}

/* Green text on white / light green was too faint. */
#ebmScreen .secondary-button,
#ebmIndependentJob .secondary-button,
#ebmIndependentJob .section-heading strong,
#sqmScreen .sqm-btn.secondary,
.section-kicker {
    color: #0b6b4a !important;
}

/* Bar Cutting helper notes. */
#barCuttingScreen .bc-kerf-note,
#barCuttingScreen .bc-example {
    color: #62766d !important;
}

/* Glass Offcut Costing on a phone: the five columns (number, size, fit count, credit, Me/Seller) do not fit in one line,
   so each offcut takes two lines: number, size and the Me/Seller buttons first, then the fit count and the credit. */
@media (max-width: 600px) {
    .jx-offcut-header { display: none; }
    .jx-offcut-row:not(.jx-offcut-header) {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        grid-template-areas: "num size toggles" ". fit credit";
        row-gap: 6px;
        align-items: center;
    }
    .jx-offcut-row:not(.jx-offcut-header) > .jx-offcut-num { grid-area: num; }
    .jx-offcut-row:not(.jx-offcut-header) > .jx-offcut-size { grid-area: size; overflow-wrap: anywhere; }
    .jx-offcut-row:not(.jx-offcut-header) > .jx-offcut-toggles { grid-area: toggles; }
    .jx-offcut-row:not(.jx-offcut-header) > .jx-offcut-fit { grid-area: fit; }
    .jx-offcut-row:not(.jx-offcut-header) > .jx-offcut-credit { grid-area: credit; text-align: right; }
    .jx-offcut-row:not(.jx-offcut-header) > .jx-offcut-fit::before { content: "Fit count: "; font-weight: 400; opacity: 0.75; }
    .jx-offcut-row:not(.jx-offcut-header) > .jx-offcut-credit::before { content: "Credit: "; font-weight: 400; opacity: 0.75; }

    /* the costing screen's header on a phone: back arrow + title on one line, the three buttons in one row under it,
       so the offcuts start near the top of the screen (same compact header the step-by-step tools use) */
    #offcutCostScreen .jx-costing-header { row-gap: 8px; padding-top: 10px; padding-bottom: 10px; }
    #offcutCostScreen .jx-costing-header .brand-small,
    #offcutCostScreen .jx-costing-header .header-subtitle { display: none; }
    #offcutCostScreen .jx-costing-identity-text { flex: 1 1 0; }
    #offcutCostScreen .calculator-header h2 { font-size: 17px; margin: 0; }
    #offcutCostScreen .jx-cost-header-actions { flex: 1 1 100%; display: flex; gap: 6px; flex-wrap: nowrap; }
    #offcutCostScreen .jx-cost-header-actions > button { flex: 1 1 0; min-width: 0; padding: 7px 6px; font-size: 11px; line-height: 1.2; gap: 5px; }
    #offcutCostScreen .jx-cost-header-actions .jx-nav-btn-icon { display: none; }}
/* Window drawings (static/jx-window-drawing.js): the Transom-style drawing shown in the WH, EBM and door tools */
.jx-window-svg { max-width: 600px; margin: 0 auto; }
.jx-window-svg svg { display: block; width: 100%; height: auto; }
.jx-window-note { margin: 6px 0 0; text-align: center; font-size: 12px; opacity: 0.8; }
.jx-job-thumb { width: 190px; max-width: 100%; margin: 0; flex: 0 0 auto; }
.jx-job-drawing { margin: 0 0 18px; padding: 12px; border: 1px solid #dce6ed; border-radius: 12px; background: #f8fbfa; }
.jx-job-drawing > strong { display: block; margin-bottom: 8px; font-size: 14px; }

/* Page headers stay fixed at the top while the page scrolls (home, Admin and the tool screens). */
.topbar,
header.calculator-header {
    position: sticky;
    top: 0;
    z-index: 40;
}
