/* WorkBench: readable at arm's length, usable with gloves. State is always icon + text + colour. */
:root
{
    --wb-ink: #16202c;
    --wb-soft: #5a6676;
    --wb-line: #d9e0e8;
    --wb-canvas: #f2f4f7;
    --wb-panel: #ffffff;
    --wb-accent: #1b4e8c;
    --wb-accent-dim: #e6eef8;

    --wb-grey: #7b8594;
    --wb-grey-bg: #eef0f3;
    --wb-blue: #1d64c4;
    --wb-blue-bg: #e5effc;
    --wb-orange: #c96a00;
    --wb-orange-bg: #fff1df;
    --wb-green: #1b7f45;
    --wb-green-bg: #e3f4ea;
    --wb-red: #c0262d;
    --wb-red-bg: #fde8e8;
}

body { background: var(--wb-canvas); color: var(--wb-ink); }
button, a, summary, label[for], .wb-click, [role="button"] { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.btn { min-height: 44px; }
.btn-sm { min-height: 36px; }
.wb-big { min-height: 64px; font-size: 1.15rem; font-weight: 600; }

.wb-navbar { background: var(--wb-ink); }
.wb-navbar .nav-link { color: #c9d3df; }
.wb-navbar .nav-link.active, .wb-navbar .nav-link:hover { color: #fff; }
.wb-main { padding-top: 1rem; padding-bottom: 3rem; }
.wb-card { background: var(--wb-panel); border: 1px solid var(--wb-line); border-radius: .6rem; padding: 1rem; margin-bottom: .75rem; }
.wb-muted { color: var(--wb-soft); font-size: .875rem; }
.wb-section { margin: 1.25rem 0 .6rem; font-size: 1.05rem; font-weight: 600; }
.wb-empty { text-align: center; padding: 2rem 1rem; color: var(--wb-soft); }
.wb-toasts { position: fixed; right: 1rem; bottom: 1rem; left: 1rem; z-index: 1090; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; pointer-events: none; }
.wb-toasts .alert { pointer-events: auto; max-width: 32rem; margin: 0; }
.wb-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 7px; background: #f0a500; color: var(--wb-ink); font-weight: 800; }

/* State pills and phase cards */
.wb-state { display: inline-flex; align-items: center; gap: .4rem; padding: .15rem .6rem; border-radius: 1rem; font-size: .85rem; font-weight: 600; }
.wb-GREY { --c: var(--wb-grey); --bg: var(--wb-grey-bg); }
.wb-BLUE { --c: var(--wb-blue); --bg: var(--wb-blue-bg); }
.wb-ORANGE { --c: var(--wb-orange); --bg: var(--wb-orange-bg); }
.wb-GREEN { --c: var(--wb-green); --bg: var(--wb-green-bg); }
.wb-RED { --c: var(--wb-red); --bg: var(--wb-red-bg); }
.wb-state { color: var(--c); background: var(--bg); }

.wb-phases { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: .75rem; }
.wb-phase { display: flex; gap: .9rem; align-items: stretch; text-align: left; width: 100%; background: var(--wb-panel); border: 2px solid var(--wb-line);
    border-left: 10px solid var(--c); border-radius: .7rem; padding: .9rem 1rem; min-height: 92px; color: var(--wb-ink); }
.wb-phase:hover { border-color: var(--c); }
.wb-phase[aria-disabled="true"] { opacity: .85; }
.wb-phase-num { font-size: 1.6rem; font-weight: 800; color: var(--c); min-width: 2.2rem; }
.wb-phase-body { flex: 1 1 auto; min-width: 0; }
.wb-phase-title { font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.wb-phase-meta { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.wb-pulse { animation: wb-pulse 1.6s ease-in-out infinite; }
@keyframes wb-pulse { 50% { box-shadow: 0 0 0 6px var(--wb-orange-bg); } }

.wb-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-top: 1rem; }
.wb-data { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.wb-data dt { font-weight: 600; color: var(--wb-soft); }
.wb-data dd { margin: 0; overflow-wrap: anywhere; }
.wb-instructions { white-space: pre-wrap; overflow-wrap: anywhere; }
.wb-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; }
.wb-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: .4rem; border: 1px solid var(--wb-line); }

/* Sign-in pages (tablet, phone, PC) */
.wb-login { max-width: 860px; margin: 2rem auto; }
.wb-login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.wb-scanner { background: #000; border-radius: .6rem; overflow: hidden; min-height: 240px; position: relative; color: #fff; }
.wb-scanner-msg { padding: 1rem; color: #fff; }
@media (max-width: 700px)
{
    .wb-login-grid { grid-template-columns: 1fr; }
    .wb-login { margin: 1rem auto; }
}

/* Banners */
.wb-banner { position: sticky; top: 0; z-index: 1030; padding: .9rem 1rem; font-weight: 600; display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.wb-banner-msg { background: #fff3c4; color: #5a4300; border-bottom: 1px solid #e8d37e; }
.wb-banner-idle { background: var(--wb-orange); color: #fff; }

/* Live map */
.wb-live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; }
@media (max-width: 1199px) { .wb-live-grid { grid-template-columns: 1fr; } }
.wb-map { width: 100%; height: auto; background: #fff; border: 1px solid var(--wb-line); border-radius: .6rem; touch-action: none; }
.wb-station rect.box { stroke-width: .12; }
.wb-station text { font-family: system-ui, sans-serif; pointer-events: none; }
.wb-feed { max-height: 360px; overflow: auto; }
.wb-feed-row { padding: .45rem 0; border-top: 1px solid var(--wb-line); font-size: .9rem; }
.wb-feed-row:first-child { border-top: 0; }
.wb-live-status { font-size: .8rem; }
.wb-station-cards { display: grid; gap: .6rem; }

/* Tables become cards on a phone (C12) */
@media (max-width: 600px)
{
    table.wb-rowcards thead { display: none; }
    table.wb-rowcards, table.wb-rowcards tbody, table.wb-rowcards tr, table.wb-rowcards td { display: block; width: 100%; }
    table.wb-rowcards tr { background: #fff; border: 1px solid var(--wb-line); border-radius: .5rem; margin-bottom: .6rem; padding: .5rem .75rem; }
    table.wb-rowcards td { border: 0; padding: .2rem 0; }
    table.wb-rowcards td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--wb-soft); }
}

/* Modals full screen on a phone */
@media (max-width: 600px)
{
    .modal-dialog { margin: 0; max-width: none; min-height: 100%; }
    .modal-content { min-height: 100vh; border-radius: 0; }
}
