/* Home page: search first, the shop-floor map second. Colours come from the
   portal tokens in shell.css; the --ws-* set paints the map. */
.home {
    --home-soft: #f5f8fb;
    --home-ok-bg: #e2f3e7;
    --home-ok-ink: #1b6536;
    --home-warn-bg: #fdeee2;
    --home-warn-ink: #94440f;
    --home-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

    --ws-floor: #e4eaf0; --ws-floor-line: #d3dce5; --ws-wall-a: #dbe3ea; --ws-wall-b: #cbd5df; --ws-cap: #b3c1cf;
    --ws-edge: rgba(16, 32, 51, .30); --ws-glow: rgba(255, 204, 128, .26); --ws-glow-floor: rgba(255, 206, 136, .40);
    --ws-mark: #e0b21f;
    --ws-eq-t: #f5f7fa; --ws-eq-l: #d8e0e8; --ws-eq-r: #b9c6d3;
    --ws-cab-t: #eef1f4; --ws-cab-l: #dde3e9; --ws-cab-r: #c0cad4;
    --ws-dark-t: #43566b; --ws-dark-l: #2d3d4f; --ws-dark-r: #212e3c;
    --ws-metal-t: #c8d2dc; --ws-metal-l: #a8b5c2; --ws-metal-r: #8e9dac;
    --ws-wood-t: #e2c38e; --ws-wood-l: #cba268; --ws-wood-r: #b08850;
    --ws-box-t: #dcbd8f; --ws-box-l: #c4a06e; --ws-box-r: #a98657;
    --ws-red-t: #e45b50; --ws-red-l: #c93a30; --ws-red-r: #a52d25;
    --ws-white-t: #ffffff; --ws-white-l: #edf1f5; --ws-white-r: #d3dbe3;
    --ws-grn-t: #5fd08a; --ws-grn-l: #34b366; --ws-grn-r: #27904f;
    --ws-yel-t: #f5d24e; --ws-yel-l: #e0b21f; --ws-yel-r: #bf9512;
    --ws-pipeR-t: #e2735c; --ws-pipeR-l: #cf553d; --ws-pipeR-r: #ad4230;
    --ws-pipeB-t: #6aa0dd; --ws-pipeB-l: #3f7cc4; --ws-pipeB-r: #2f64a3;
    --ws-wallA-t: var(--ws-cap); --ws-wallA-l: var(--ws-wall-a); --ws-wallA-r: var(--ws-cap);
    --ws-wallB-t: var(--ws-cap); --ws-wallB-l: var(--ws-cap); --ws-wallB-r: var(--ws-wall-b);
    --ws-slab-t: var(--ws-floor); --ws-slab-l: #c3cfdb; --ws-slab-r: #aebdcc;
    --ws-solar: #1f4b7e; --ws-solar-line: #6f97c6; --ws-belt: #46596d; --ws-hmi: #123b66; --ws-hmi-glow: #4f9be0;
    --ws-led: #37c96a; --ws-pp: #5a6d82; --ws-peg: #c9d3dd; --ws-tool: #44566a; --ws-gnd: #9acb3c; --ws-gnd-2: #e0c21f;
    --ws-fin: rgba(16, 32, 51, .18); --ws-cbl-a: #2b3a4a; --ws-cbl-b: #3f7cc4; --ws-cbl-c: #7d8da0;
    --ws-pill-line: #bccadb; --ws-lead: #8fa2b6;
}

.home-mono { font-family: var(--home-mono); }

.home-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 26px;
    border: 0;
    border-radius: 6px;
    background: var(--portal-orange);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.home .home-button { color: #fff; }
.home-button:hover { background: var(--portal-orange-dark); }
.home-button:disabled { opacity: .6; cursor: progress; }
.home-button--block { width: 100%; }

/* ---------- hero: search ---------- */
.home-hero {
    padding: 44px 0 40px;
    color: #f3f7fb;
    background: linear-gradient(180deg, var(--portal-navy-dark) 0%, var(--portal-navy) 100%);
}
.home-hero__brands {
    margin: 0 0 10px;
    color: #a9bdd2;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.home-hero__brands a { color: inherit; }
.home-hero__brands a:hover { color: #fff; }
.home-hero h1 {
    max-width: 18ch;
    margin: 0;
    color: #fff;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -.02em;
    text-wrap: balance;
}
/* Counts keep the text face: a monospace font widens the narrow no-break
   space between thousands to a full cell. */
.home-hero__count {
    color: var(--portal-orange);
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
}
.home-hero__lead { max-width: 62ch; margin: 12px 0 26px; color: #a9bdd2; }

.home-tabs {
    display: inline-flex;
    gap: 2px;
    margin-bottom: 12px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
}
.home-tabs[hidden] { display: none; }
.home-tabs button {
    padding: 7px 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #a9bdd2;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.home-tabs button[aria-selected="true"] { background: #fff; color: var(--portal-ink); }
.home-tabs button:focus-visible,
.home-hero a:focus-visible { outline: 2px solid var(--portal-orange); outline-offset: 2px; }

.home-search {
    position: relative;
    display: flex;
    max-width: 860px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(3, 14, 28, .35);
}
.home-search:focus-within { box-shadow: 0 0 0 3px var(--portal-orange), 0 10px 30px rgba(3, 14, 28, .35); }
.home-search input {
    flex: 1;
    min-width: 0;
    padding: 17px 18px;
    border: 0;
    border-radius: 8px 0 0 8px;
    background: transparent;
    color: var(--portal-ink);
    font: inherit;
    font-size: 18px;
}
.home-search input:focus { outline: none; }
.home-search .home-button { min-height: 48px; margin: 6px; }

.home-examples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
    color: #a9bdd2;
    font-size: 13px;
}
.home-examples a {
    padding: 4px 9px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 5px;
    background: rgba(255, 255, 255, .07);
    color: #f3f7fb;
    font-family: var(--home-mono);
    font-size: 12.5px;
}
.home-examples a:hover { border-color: var(--portal-orange); }

.home-suggest {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    z-index: 20;
    overflow: hidden;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(3, 14, 28, .3);
    color: var(--portal-ink);
}
.home-suggest ul { margin: 0; padding: 6px; list-style: none; }
.home-suggest li a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 14px;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--portal-ink);
}
.home-suggest li a:hover,
.home-suggest li a[aria-selected="true"] { background: var(--home-soft); }
.home-suggest__art { font-family: var(--home-mono); font-size: 14px; font-weight: 600; }
.home-suggest__art mark { background: transparent; color: var(--portal-orange-dark); text-decoration: underline; text-underline-offset: 3px; }
.home-suggest__brand {
    grid-row: 1 / 3;
    grid-column: 2;
    align-self: center;
    padding: 2px 7px;
    border: 1px solid var(--portal-line);
    border-radius: 4px;
    color: var(--portal-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.home-suggest__name { overflow: hidden; color: var(--portal-muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.home .home-suggest__all {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 18px;
    border-top: 1px solid var(--portal-line);
    background: var(--home-soft);
    color: var(--portal-blue);
    font-size: 13.5px;
    font-weight: 600;
}
.home-suggest__all span { color: var(--portal-muted); font-weight: 400; }

.home-list textarea {
    display: block;
    width: 100%;
    max-width: 860px;
    min-height: 150px;
    padding: 14px 16px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(3, 14, 28, .35);
    color: var(--portal-ink);
    font: 14px/1.7 var(--home-mono);
    resize: vertical;
}
.home-list textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--portal-orange), 0 10px 30px rgba(3, 14, 28, .35); }
.home-list__row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; color: #a9bdd2; font-size: 13px; }

.home-result {
    max-width: 1000px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    color: var(--portal-ink);
}
.home-result[hidden] { display: none; }
.home-result__state { margin: 0; padding: 14px 16px; color: var(--portal-muted); font-size: 14px; }
.home-result__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--portal-line);
    font-size: 13.5px;
}
.home-result__head span { color: var(--portal-muted); }
.home-result__scroll { overflow-x: auto; }
.home-result table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.home-result th {
    padding: 9px 16px;
    border-bottom: 1px solid var(--portal-line);
    color: var(--portal-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.home-result td { padding: 10px 16px; border-bottom: 1px solid var(--portal-line); vertical-align: top; }
.home-result tr:last-child td { border-bottom: 0; }
.home-result td a { color: var(--portal-blue); }
.home-result td small { display: block; margin-bottom: 4px; color: var(--portal-muted); font-size: 12px; }
.home-result .home-mono { font-weight: 600; white-space: nowrap; }
.home-result .home-qty { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.home-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.home-pill--ok { background: var(--home-ok-bg); color: var(--home-ok-ink); }
.home-pill--warn { background: var(--home-warn-bg); color: var(--home-warn-ink); }

/* ---------- the shop-floor map ---------- */
/* The portal header stays pinned; anchors land below it. */
.home-workshop,
.home-hero { scroll-margin-top: 88px; }
.home-workshop { padding: 44px 0 56px; background: #eef2f6; }
.home-heading { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.home-heading h2 { margin: 0; font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; }
.home-heading > p { max-width: 52ch; margin: 0; color: var(--portal-muted); font-size: 14px; }
.home-stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 20px; }
.home-scene-box { overflow: hidden; border: 1px solid var(--portal-line); border-radius: 10px; background: #fff; }
.home-scene { display: block; width: 100%; height: auto; }
.home-scene-caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 10px 16px;
    border-top: 1px solid var(--portal-line);
    color: var(--portal-muted);
    font-size: 12.5px;
}

.home-scene .f { stroke: var(--ws-edge); stroke-width: .6; stroke-linejoin: round; }
.home-scene .zone { cursor: pointer; transition: opacity .18s; }
.home-scene.has-hot .zone:not(.hot),
.home-scene.has-hot .deco-zone:not(.hot) { opacity: .42; }
.home-scene .zone.hot .f,
.home-scene .zone.is-active .f { stroke: var(--portal-orange); stroke-width: 1.3; }
.home-scene .zone:focus { outline: none; }
.home-scene .zone:focus-visible .f { stroke: var(--portal-orange); stroke-width: 2.2; }
.home-scene .nohit { pointer-events: none; }
.home-scene .grid { stroke: var(--ws-floor-line); stroke-width: 1; }
.home-scene .mark { fill: none; stroke: var(--ws-mark); stroke-width: 2; stroke-dasharray: 7 5; }
.home-scene .cell { stroke: var(--ws-solar-line); stroke-width: .7; }
.home-scene .fin { stroke: var(--ws-fin); stroke-width: 1; }
.home-scene .slat { stroke: var(--ws-edge); stroke-width: .8; }
.home-scene .tool { stroke: var(--ws-tool); stroke-width: 2.4; stroke-linecap: round; }
.home-scene .rod { stroke: var(--ws-metal-r); stroke-width: 1.4; }
.home-scene .cbl { stroke-width: 2.2; stroke-linecap: round; }
.home-scene .pin { cursor: pointer; }
.home-scene .pin .lead { stroke: var(--ws-lead); stroke-width: 1; }
.home-scene .pin .dot { fill: var(--portal-orange); stroke: #fff; stroke-width: 2; }
.home-scene .pin .ring { fill: none; stroke: var(--portal-orange); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.home-scene .pin rect { fill: #fff; stroke: var(--ws-pill-line); stroke-width: 1; }
.home-scene .pin text { fill: var(--portal-ink); font: 600 12.5px Inter, "Segoe UI", Arial, sans-serif; }
.home-scene .pin text tspan { fill: var(--portal-muted); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.home-scene .pin.hot rect { stroke: var(--portal-orange); }
.home-scene .pin.hot .lead,
.home-scene .pin.is-active .lead { stroke: var(--portal-orange); }
.home-scene .pin.is-active rect { fill: var(--portal-orange); stroke: var(--portal-orange); }
.home-scene .pin.is-active text,
.home-scene .pin.is-active text tspan { fill: #fff; }
@media (prefers-reduced-motion: no-preference) {
    .home-scene .pin .ring { animation: home-ping 2.6s ease-out infinite; }
    .home-scene .pin:nth-child(3n+1) .ring { animation-delay: .9s; }
    .home-scene .pin:nth-child(3n+2) .ring { animation-delay: 1.7s; }
}
@keyframes home-ping {
    0% { opacity: .7; transform: scale(1); }
    70%, 100% { opacity: 0; transform: scale(2.6); }
}

.home-panel { position: sticky; top: 16px; padding: 20px 20px 22px; border: 1px solid var(--portal-line); border-radius: 10px; background: #fff; }
.home-panel h3 { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
.home-panel__count { margin: 8px 0 2px; color: var(--portal-muted); font-size: 14px; }
.home-panel__count b {
    margin-right: 4px;
    color: var(--portal-ink);
    font-size: 22px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    letter-spacing: -.02em;
}
.home-panel__where { margin: 0 0 14px; color: var(--portal-muted); font-size: 13px; }
.home-panel__groups { display: grid; gap: 2px; margin: 0 0 16px; padding: 0; list-style: none; }
.home-panel__groups a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    margin: 0 -10px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--portal-ink);
    font-size: 13.5px;
    line-height: 1.35;
}
.home-panel__groups a:hover { background: var(--home-soft); }
.home-panel__n { color: var(--portal-muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.home-panel__bar { grid-column: 1 / -1; height: 3px; overflow: hidden; border-radius: 2px; background: var(--portal-line); }
.home-panel__bar i { display: block; height: 100%; background: #c9d6e3; }
.home-panel__groups a:hover .home-panel__bar i { background: var(--portal-orange); }
.home-unplaced { margin: 14px 0 0; padding: 14px 16px; border: 1px dashed #c9d5e0; border-radius: 10px; background: #fff; color: var(--portal-muted); font-size: 13px; }
.home-unplaced b { color: var(--portal-ink); font-variant-numeric: tabular-nums; font-weight: 700; }
.home .home-unplaced a { color: var(--portal-blue); font-weight: 600; }

.home-zone-chips { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.home-zone-chips a {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
    background: #fff;
    color: var(--portal-ink);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
}
.home-zone-chips a span { color: var(--portal-muted); font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 400; }
.home-zone-chips a[aria-current="true"] { border-color: var(--portal-orange); box-shadow: inset 3px 0 0 var(--portal-orange); }

@media (max-width: 960px) {
    .home-stage { grid-template-columns: 1fr; }
    .home-panel { position: static; }
    .home-zone-chips { display: grid; }
    .home-scene .pin .pl { display: none; }
}

/* ---------- every section as a plain list ---------- */
.home-sections {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.home-sections a {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--portal-line);
    color: var(--portal-ink);
    font-size: 15px;
    font-weight: 600;
}
.home-sections a:hover { color: var(--portal-blue); }
.home-sections__n { color: var(--portal-muted); font-size: 14px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
