/* ===========================================================================
   JALBAR Staff Tools — Combined PWA Stylesheet
   Sections:
     1. Design tokens & reset
     2. Shell layout (views, tab bar)
     3. Home view
     4. Labels view (Industrial rack — ported from soundboard-pwa)
     5. Inspect placeholder
     6. Shared: status toast, dialogs
   =========================================================================== */


/* ===========================================================================
   1. DESIGN TOKENS & RESET
   =========================================================================== */

:root {
    /* Brand tokens */
    --cream:     #faf8f5;
    --cream-mid: #d9d6d0;
    --cream-dim: #9a968d;
    --warm-deep: #8a6f4e;
    --gold:      #e8d4b5;
    --gold-soft: #d9c2a0;

    /* Industrial surfaces — dark variant */
    --metal-0:   #0a0b0e;
    --metal-1:   #14161a;
    --metal-2:   #1a1c22;
    --metal-3:   #22242c;
    --metal-4:   #2a2c33;
    --metal-5:   #353842;
    --line:      #2a2c33;

    /* LED palette */
    --led-amber: #ffb547;
    --led-cyan:  #6ad3f0;
    --led-red:   #ff4a4a;
    --led-green: #4ad33a;
    --led-off:   #2a2c33;

    --serif: "Cormorant Garamond", Georgia, serif;
    --sans:  "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono:  "JetBrains Mono", ui-monospace, Menlo, monospace;
    --tech:  "Share Tech Mono", ui-monospace, Menlo, monospace;

    --radius: 4px;

    /* Shell */
    --tabbar-height: 52px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--metal-0);
    color: var(--cream-mid);
    font-family: var(--sans);
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
}

body {
    background:
        repeating-linear-gradient(90deg,
            rgba(255, 255, 255, 0.012) 0 1px,
            transparent 1px 3px),
        linear-gradient(180deg, #22232a 0%, #16171c 100%);
}


/* ===========================================================================
   2. SHELL LAYOUT — Views + Bottom Tab Bar
   =========================================================================== */

/* Each view occupies the full viewport minus the tab bar */
.view {
    display: none;
    position: fixed;
    inset: 0 0 var(--tabbar-height) 0;
    /* Push below status-bar notch when displayed */
    padding-bottom: 0;
    overflow: hidden;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* ── Bottom tab bar ─────────────────────────────────────────────────────── */
.app-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background:
        linear-gradient(180deg, var(--metal-3) 0%, var(--metal-1) 100%);
    border-top: 1px solid #3a3c44;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 -4px 16px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: stretch;
    z-index: 100;
}

.tab-item {
    flex: 1;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0 0 2px;
    cursor: pointer;
    color: #6b685f;
    transition: color 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.tab-item.active {
    color: var(--gold);
}

.tab-item:active {
    opacity: 0.7;
}

.tab-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.tab-label {
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* Active tab gold indicator line at top */
.tab-item.active::before {
    content: "";
    display: block;
    position: absolute;
    /* We'll use a box-shadow trick on the tab bar instead */
}


/* ===========================================================================
   3. HOME VIEW
   =========================================================================== */

#view-home {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.home-page {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: env(safe-area-inset-top, 0px) 0 0;
}

/* Header block */
.home-header {
    padding: 36px 28px 28px;
    text-align: left;
}

.home-header img {
    display: block;
    height: 26px;
    width: auto;
    margin-bottom: 20px;
    opacity: 0.9;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.9));
}

.home-eyebrow {
    margin: 0 0 4px;
    font-family: var(--tech);
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.8;
}

.home-title {
    margin: 0 0 10px;
    font-family: var(--serif);
    font-size: 36px;
    font-weight: 300;
    letter-spacing: 0.02em;
    color: var(--cream);
    line-height: 1.1;
}

.home-title em {
    font-style: italic;
    color: var(--gold);
}

.home-sub {
    margin: 0;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 300;
    color: var(--cream-dim);
    letter-spacing: 0.02em;
    line-height: 1.5;
}

/* Tool cards grid */
.tool-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 0 16px 20px;
}

@media (min-width: 480px) {
    .tool-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 20px 20px 18px;
    background:
        repeating-linear-gradient(90deg,
            rgba(255, 255, 255, 0.008) 0 1px,
            transparent 1px 3px),
        linear-gradient(180deg, #2c2e35 0%, #1a1c21 100%);
    border: 1px solid #3a3c44;
    border-radius: var(--radius);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 2px 8px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: border-color 0.12s, box-shadow 0.12s, transform 0.05s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
}

.tool-card:hover {
    border-color: rgba(232, 212, 181, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 4px 16px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(232, 212, 181, 0.1);
}

.tool-card:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.5),
        0 1px 4px rgba(0, 0, 0, 0.5);
}

.tool-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 14px;
    color: var(--gold);
    opacity: 0.85;
}

.tool-icon svg {
    width: 100%;
    height: 100%;
}

.tool-label-text {
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.7;
    margin-bottom: 4px;
}

.tool-name {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cream);
    margin-bottom: 8px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.tool-desc {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 300;
    line-height: 1.55;
    color: var(--cream-dim);
    letter-spacing: 0.01em;
    margin-bottom: 14px;
    flex: 1;
}

.tool-cta {
    font-family: var(--tech);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
    opacity: 0.65;
    transition: opacity 0.1s;
}

.tool-card:hover .tool-cta {
    opacity: 1;
}

/* Divider + footer */
.home-divider {
    margin: 4px 16px 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.home-footer {
    padding: 0 28px 20px;
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #4a4840;
    line-height: 2;
}

.home-footer p {
    margin: 0;
}

.home-footer a {
    color: #6b6860;
    text-decoration: none;
}

.home-footer a:hover {
    color: var(--gold);
}


/* ===========================================================================
   4. LABELS VIEW — Industrial rack UI
      Ported verbatim from soundboard-pwa/public/style.css.
      Only .screen min-height is overridden to work inside the fixed view.
   =========================================================================== */

#view-labels {
    overflow: hidden;
}

/* Override: inside the fixed view, .screen should fill the view, not vh */
#view-labels .screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding-top: env(safe-area-inset-top, 0px);
    overflow: hidden;
}

/* Speaker grill — 12 tiny pinholes above the nameplate. Decorative. */
.grill {
    margin: 14px auto 0;
    width: 110px;
    height: 10px;
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
}
.grill span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 30%, #0a0a0b 0%, #050505 80%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.03);
}

/* Riveted nameplate */
.nameplate {
    margin: 14px 14px 10px;
    padding: 12px 16px;
    background:
        repeating-linear-gradient(90deg,
            rgba(255, 255, 255, 0.012) 0 1px,
            rgba(0, 0, 0, 0.03) 1px 3px),
        linear-gradient(180deg, #2c2e35 0%, #1a1c21 100%);
    border: 1px solid #3a3c44;
    border-radius: var(--radius);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 1px 0 rgba(0, 0, 0, 0.4);
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.rivet {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            #cfcbc3 0%, #8a8883 30%, #3a3a3a 70%, #1a1a1a 100%);
    box-shadow:
        inset 0 -1px 1px rgba(0, 0, 0, 0.6),
        0 1px 1px rgba(0, 0, 0, 0.7);
}
.rivet-tl { top: 4px; left: 4px; }
.rivet-tr { top: 4px; right: 4px; }
.rivet-bl { bottom: 4px; left: 4px; }
.rivet-br { bottom: 4px; right: 4px; }

.nameplate-left { padding-left: 8px; }

.nameplate-logo {
    display: block;
    height: 22px;
    width: auto;
    margin-bottom: 4px;
    opacity: 0.92;
    filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.9));
}

.nameplate-model {
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.22em;
    color: var(--gold);
    text-transform: uppercase;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.nameplate-name {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.14em;
    color: var(--cream);
    text-transform: uppercase;
    margin-top: 2px;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.9),
        0 -1px 0 rgba(255, 255, 255, 0.04);
}

.admin-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 1px 6px;
    font-family: var(--tech);
    font-size: 8px;
    letter-spacing: 0.25em;
    color: var(--metal-0);
    background: var(--gold);
    border-radius: 2px;
    vertical-align: 3px;
    text-shadow: none;
}

/* Live readout grid (right side of nameplate) */
.readout {
    display: grid;
    grid-template-columns: auto auto;
    gap: 3px 12px;
    align-content: start;
    padding-right: 10px;
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.readout-row { display: contents; }
.readout-key { color: var(--cream-dim); }
.readout-val {
    color: var(--cream-mid);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.readout-val.ok   { color: var(--led-green); }
.readout-val.warn { color: var(--led-amber); }
.readout-val.err  { color: var(--led-red); }

.pwr-cluster {
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    justify-self: end;
}

.power-led {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    --led-color: var(--led-green);
    background:
        radial-gradient(circle at 35% 30%,
            rgba(255, 255, 255, 0.7) 0%,
            var(--led-color) 35%,
            #2aa028 100%);
    box-shadow:
        0 0 12px rgba(74, 211, 58, 0.6),
        inset 0 -1px 2px rgba(0, 0, 0, 0.6);
}

.power-label {
    font-family: var(--tech);
    font-size: 7px;
    letter-spacing: 0.25em;
    color: var(--cream-dim);
    text-transform: uppercase;
}

@keyframes led-breathe {
    0%, 100% { filter: brightness(0.78); }
    50%      { filter: brightness(1.18); }
}
@keyframes led-pulse {
    0%, 100% { filter: brightness(0.65); }
    50%      { filter: brightness(1.5); }
}
.power-led.breathing,
.pad-led.breathing {
    animation: led-breathe 3.2s ease-in-out infinite;
}
.pad-led.pulsing {
    animation: led-pulse 0.5s ease-in-out infinite;
}
.pad.printing {
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--metal-5) 80%, var(--gold)) 0%,
            var(--metal-3) 55%,
            var(--metal-2) 100%);
}

@keyframes long-press-grow {
    from { box-shadow: inset 0 0 0 0px rgba(232, 212, 181, 0); }
    to   { box-shadow: inset 0 0 0 3px rgba(232, 212, 181, 0.7); }
}
.pad.long-pressing {
    animation: long-press-grow 0.55s ease-out forwards;
}

/* Channels — top-level section nav */
.channels {
    margin: 0 14px 8px;
    padding: 6px;
    background: var(--metal-0);
    border: 1px solid var(--line);
    border-radius: 3px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
}
.channels::-webkit-scrollbar { display: none; }

.section {
    flex: 1 0 auto;
    min-width: 0;
    text-align: center;
    padding: 7px 10px 6px;
    font-family: var(--tech);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: #555;
    background: linear-gradient(180deg, var(--metal-3) 0%, var(--metal-1) 100%);
    border-radius: 2px;
    border: 1px solid var(--metal-4);
    text-transform: uppercase;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4);
    transition: color 0.1s, background 0.1s;
}

.section.active {
    color: var(--metal-0);
    background: linear-gradient(180deg, #f4e1be 0%, var(--gold-soft) 100%);
    border-color: var(--gold);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 -1px 0 rgba(140, 100, 50, 0.6),
        0 0 12px rgba(232, 212, 181, 0.4);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.section.disabled {
    color: #3a3a3a;
    cursor: default;
}

/* Subchannels — tab strip below channels */
.subchannels {
    margin: 0 14px 10px;
    padding: 4px 8px;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.subchannels::-webkit-scrollbar { display: none; }

.tab {
    background: transparent;
    border: 0;
    color: #6b685f;
    padding: 6px 0 8px;
    font-family: var(--tech);
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    flex: 0 0 auto;
}

.tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

/* Rack — pad grid backplane */
.rack {
    flex: 1;
    margin: 0 14px 12px;
    padding: 12px 10px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        repeating-linear-gradient(135deg,
            transparent 0 60px,
            rgba(255, 255, 255, 0.02) 60px 61px,
            transparent 61px 120px),
        linear-gradient(180deg, var(--metal-2) 0%, var(--metal-0) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow:
        inset 0 3px 6px rgba(0, 0, 0, 0.7),
        inset 0 -1px 0 rgba(255, 255, 255, 0.03);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
    gap: 7px;
    align-content: start;
    overflow-y: auto;
    min-height: 0;
}

/* Pads — moulded brushed-steel tiles */
.pad {
    --led: var(--led-off);
    aspect-ratio: 1 / 1;
    background:
        linear-gradient(180deg, var(--metal-5) 0%, var(--metal-3) 55%, var(--metal-2) 100%);
    border: 1px solid var(--metal-0);
    border-radius: 5px;
    padding: 8px 8px 7px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    text-align: left;
    color: inherit;
    font: inherit;
    cursor: pointer;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.10),
        inset 0 -2px 0 rgba(0, 0, 0, 0.4),
        0 1px 0 rgba(0, 0, 0, 0.7);
    transition: transform 0.05s, box-shadow 0.1s;
}
.pad:active {
    transform: translateY(1px);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.6),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.pad::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 6px;
    right: 6px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
    pointer-events: none;
}

.pad-led {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            rgba(255, 255, 255, 0.7) 0%,
            var(--led) 40%,
            color-mix(in srgb, var(--led) 70%, black) 100%);
    box-shadow:
        0 0 6px var(--led),
        inset 0 0 1px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 0, 0, 0.5);
}

.pad-ch {
    font-family: var(--tech);
    font-size: 8px;
    letter-spacing: 0.22em;
    color: var(--cream-dim);
    text-transform: uppercase;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
    opacity: 0.7;
}

.pad-title {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--cream);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.9),
        0 -1px 0 rgba(255, 255, 255, 0.03);
    word-break: break-word;
}

.pad-sub {
    font-family: var(--tech);
    font-size: 8px;
    letter-spacing: 0.2em;
    color: var(--cream-dim);
    text-transform: uppercase;
    margin-top: 2px;
    opacity: 0.8;
}

.pad-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-family: var(--tech);
    font-size: 7px;
    letter-spacing: 0.2em;
    color: var(--gold);
    text-transform: uppercase;
}
.pad-badge.admin { color: var(--gold); }

.pad[data-led="red"]   { --led: var(--led-red); }
.pad[data-led="amber"] { --led: var(--led-amber); }
.pad[data-led="cyan"]  { --led: var(--led-cyan); }
.pad[data-led="green"] { --led: var(--led-green); }
.pad[data-led="off"]   { --led: var(--led-off); }

.pad[data-led="red"]   .pad-title { color: #ffb5b5; }
.pad[data-led="amber"] .pad-title { color: #ffcb78; }
.pad[data-led="cyan"]  .pad-title { color: #a8e3f5; }
.pad[data-led="green"] .pad-title { color: #a8e39a; }

.pad.style-hazard::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 5px;
    padding: 2px;
    background: repeating-linear-gradient(-45deg,
        #1a1a1a 0 4px,
        var(--led-amber) 4px 8px);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

.pad.pad-add {
    background:
        linear-gradient(180deg, var(--metal-3) 0%, var(--metal-1) 100%);
    color: var(--gold);
    align-items: center;
    justify-content: center;
    text-align: center;
    border-style: dashed;
    border-color: rgba(232, 212, 181, 0.4);
}
.pad.pad-add .pad-title { color: var(--gold); font-size: 11px; }
.pad.pad-add .pad-sub { color: var(--gold-soft); }
.pad.pad-add::after { display: none; }

.user-pad.role-admin { box-shadow: inset 0 0 0 1px var(--gold), inset 0 1px 0 rgba(255,255,255,0.10), 0 1px 0 rgba(0,0,0,0.7); }

.empty {
    grid-column: 1 / -1;
    color: var(--cream-dim);
    text-align: center;
    padding: 2rem 0;
    font-family: var(--tech);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

/* Toolbar — bottom strip */
.toolbar {
    margin: 0 14px 14px;
    padding: 10px 12px;
    background:
        linear-gradient(180deg, var(--metal-3) 0%, var(--metal-1) 100%);
    border: 1px solid var(--line);
    border-radius: 3px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        inset 0 -2px 3px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.18em;
    color: var(--cream-dim);
    text-transform: uppercase;
    position: relative;
    flex-shrink: 0;
}

.toolbar-screw {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #bcb7ad 0%, #7a7870 40%, #2a2a2a 90%);
    box-shadow:
        inset 0 -1px 1px rgba(0, 0, 0, 0.6),
        0 1px 1px rgba(0, 0, 0, 0.6);
}
.toolbar-screw::after {
    content: "";
    position: absolute;
    inset: 1px;
    background: linear-gradient(45deg,
        transparent 45%, rgba(0, 0, 0, 0.5) 47% 53%, transparent 55%);
    border-radius: 50%;
}
.toolbar-screw-tl { top: 4px; left: 4px; }
.toolbar-screw-tr { top: 4px; right: 4px; }

.toolbar-info {
    padding-left: 14px;
}
.toolbar-me {
    color: var(--gold);
    padding-left: 0;
}

.toolbar-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
    color: var(--gold);
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.toolbar-progress.ok    { color: var(--led-green); }
.toolbar-progress.error { color: var(--led-red); }

.progress-bar {
    width: 96px;
    height: 4px;
    border-radius: 2px;
    background: var(--metal-0);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    position: relative;
}
.progress-bar-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-soft) 100%);
    box-shadow: 0 0 8px rgba(232, 212, 181, 0.5);
    transition: width 0.08s linear;
}
.toolbar-progress.ok .progress-bar-fill {
    background: linear-gradient(180deg, var(--led-green) 0%, #2aa028 100%);
    box-shadow: 0 0 8px rgba(74, 211, 58, 0.5);
}

.toolbar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    padding-right: 14px;
}

.toolbar-btn {
    padding: 5px 10px;
    background: linear-gradient(180deg, var(--metal-4) 0%, var(--metal-1) 100%);
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.22em;
    color: var(--gold);
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}
.toolbar-btn:active {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

body.admin-mode .toolbar-btn[href*="?admin"],
body.admin-mode #admin-toggle {
    color: var(--metal-0);
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-soft) 100%);
    border-color: var(--gold);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}


/* ===========================================================================
   5. INSPECT PLACEHOLDER
   =========================================================================== */

#view-inspect {
    overflow: hidden;
}

#view-inspect .screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding-top: env(safe-area-inset-top, 0px);
    overflow: hidden;
}

/* Override rack grid for the placeholder layout */
.inspect-placeholder-rack {
    grid-template-columns: repeat(auto-fill, minmax(98px, 1fr));
    grid-template-rows: auto;
    align-content: start;
}

/* Hero panel spans full width */
.inspect-placeholder-hero {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 12px 20px;
    margin-bottom: 4px;
    background:
        linear-gradient(180deg, var(--metal-3) 0%, var(--metal-2) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    text-align: center;
}

.inspect-placeholder-icon {
    width: 40px;
    height: 40px;
    color: var(--led-amber);
    opacity: 0.7;
    margin-bottom: 12px;
}

.inspect-placeholder-icon svg {
    width: 100%;
    height: 100%;
}

.inspect-placeholder-title {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cream);
    margin-bottom: 6px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.inspect-placeholder-status {
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--led-amber);
    margin-bottom: 10px;
    opacity: 0.85;
}

.inspect-placeholder-desc {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 300;
    line-height: 1.6;
    color: var(--cream-dim);
    max-width: 320px;
}

/* Coming-soon tiles — styled like pads but inactive/dimmed */
.coming-pad {
    --led: var(--led-amber);
    aspect-ratio: 1 / 1;
    background:
        linear-gradient(180deg, var(--metal-4) 0%, var(--metal-2) 55%, var(--metal-1) 100%);
    border: 1px solid var(--metal-3);
    border-radius: 5px;
    padding: 8px 8px 7px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    position: relative;
    opacity: 0.5;
    pointer-events: none;
}

.coming-pad .pad-led {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%,
            rgba(255, 255, 255, 0.4) 0%,
            var(--led) 40%,
            color-mix(in srgb, var(--led) 70%, black) 100%);
    box-shadow:
        0 0 4px var(--led),
        inset 0 0 1px rgba(0, 0, 0, 0.4);
}

.coming-pad .pad-ch {
    font-family: var(--tech);
    font-size: 8px;
    letter-spacing: 0.22em;
    color: var(--cream-dim);
    text-transform: uppercase;
    opacity: 0.6;
}

.coming-pad .pad-title {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--cream-mid);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.coming-pad .pad-sub {
    font-family: var(--tech);
    font-size: 8px;
    letter-spacing: 0.2em;
    color: var(--cream-dim);
    text-transform: uppercase;
    opacity: 0.7;
}


/* ===========================================================================
   6. STATUS TOAST — floats above tab bar
   =========================================================================== */

.status {
    position: fixed;
    left: 50%;
    /* Clear: tab bar height + safe-area + breathing room */
    bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px) + 12px);
    transform: translateX(-50%);
    background: var(--metal-1);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 0.55rem 1rem;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 4px 16px rgba(0, 0, 0, 0.7);
    font-family: var(--tech);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cream-mid);
    min-width: 200px;
    text-align: center;
    z-index: 200;
}

.status.success { color: #a8e39a; border-color: #2c4825; }
.status.error   { color: #ff9a9a; border-color: #4a2222; }


/* ===========================================================================
   DIALOGS — same dark-machinery vocabulary
   =========================================================================== */

dialog {
    background:
        linear-gradient(180deg, var(--metal-3) 0%, var(--metal-1) 100%);
    color: var(--cream-mid);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    min-width: 300px;
    max-width: 92vw;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 20px 50px rgba(0, 0, 0, 0.7);
    z-index: 300;
}
dialog::backdrop {
    background: rgba(10, 11, 14, 0.85);
}

dialog h2 {
    margin: 0 0 0.4rem;
    font-family: var(--mono);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cream);
}

dialog p {
    margin: 0 0 0.85rem;
    font-family: var(--tech);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cream-dim);
}

dialog input,
dialog select,
dialog textarea {
    width: 100%;
    background: var(--metal-0);
    color: var(--cream);
    border: 1px solid var(--line);
    border-radius: 2px;
    padding: 0.55rem;
    font-family: var(--mono);
    font-size: 14px;
    margin-bottom: 0.75rem;
}

dialog textarea {
    resize: vertical;
    min-height: 64px;
}

#login-dialog { text-align: center; padding: 1.75rem 1.5rem; }

/* Quantity stepper */
#qty-dialog {
    text-align: center;
    padding: 1.5rem 1rem;
    min-width: 280px;
    max-width: min(96vw, 420px);
    width: 100%;
}

.qty-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    margin: 0.6rem 0 1rem;
}
.qty-step {
    width: 56px; height: 56px;
    border-radius: 4px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--metal-4) 0%, var(--metal-1) 100%);
    color: var(--gold);
    font-family: var(--mono);
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}
.qty-step:active {
    background: var(--metal-1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.qty-value {
    font-family: var(--mono);
    font-size: 56px;
    font-weight: 700;
    color: var(--gold);
    min-width: 80px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 12px rgba(232, 212, 181, 0.3);
}

.qty-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 1rem;
}
.qty-preset {
    flex: 0 0 38px;
    height: 32px;
    border-radius: 3px;
    border: 1px solid var(--line);
    background: var(--metal-1);
    color: var(--cream-mid);
    font-family: var(--tech);
    font-size: 12px;
    letter-spacing: 0.18em;
    cursor: pointer;
    padding: 0;
}
.qty-preset:active,
.qty-preset.active {
    color: var(--metal-0);
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-soft) 100%);
    border-color: var(--gold);
}

.qty-bulk-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0.6rem 0 0.4rem;
    padding: 0.5rem 0.7rem;
    background: var(--metal-0);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--cream-mid);
    font-family: var(--sans);
    text-align: left;
}
.qty-bulk-toggle > input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: var(--gold);
}
.qty-bulk-text {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    word-break: break-word;
}
.qty-bulk-title {
    color: var(--cream);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.qty-bulk-sub {
    color: var(--cream-dim);
    font-family: var(--tech);
    font-size: 9px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

#pin-input {
    width: 180px;
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.6rem;
    padding: 0.6rem 0.4rem;
    margin: 0 auto 1rem;
    font-family: var(--mono);
    background: var(--metal-0);
    color: var(--gold);
    border: 1px solid var(--gold);
    box-shadow: inset 0 0 12px rgba(232, 212, 181, 0.18);
    border-radius: 4px;
    display: block;
}

.pin-error {
    color: #ff9a9a;
    font-size: 11px !important;
    margin-top: -0.4rem !important;
    margin-bottom: 0.8rem !important;
}

/* Form rows in edit dialogs */
#edit-form .field,
#edit-form .field-check,
#user-form .field,
#prompt-fields .field {
    display: block;
    margin-bottom: 0.75rem;
}

#edit-form .field > span,
#edit-form .field-check > span,
#user-form .field > span,
#prompt-fields .field span {
    display: block;
    font-family: var(--tech);
    font-size: 9px;
    color: var(--gold);
    margin-bottom: 0.3rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

#edit-form .field > span .hint {
    text-transform: none;
    color: var(--cream-dim);
    font-size: 9px;
    letter-spacing: 0.06em;
    margin-left: 0.5rem;
}

#edit-form .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

#edit-form .field-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--cream-mid);
    font-size: 12px;
}

#edit-form .field-check > span {
    display: inline;
    text-transform: none;
    color: var(--cream-mid);
    font-family: var(--sans);
    letter-spacing: 0.04em;
    font-size: 12px;
    margin: 0;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.6rem;
}
.dialog-actions.edit-actions {
    flex-wrap: wrap;
}
.dialog-actions.edit-actions .btn-danger {
    margin-right: auto;
}

dialog button.btn-primary,
dialog button.btn-secondary,
dialog button.btn-danger,
dialog button[type="submit"] {
    padding: 0.55rem 1.25rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: var(--tech);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer;
}

.btn-primary,
dialog button[type="submit"] {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-soft) 100%);
    border-color: var(--gold);
    color: var(--metal-0);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-secondary {
    background: linear-gradient(180deg, var(--metal-4) 0%, var(--metal-1) 100%);
    color: var(--cream-mid);
}

.btn-danger {
    background: linear-gradient(180deg, #6a1f1f 0%, #2c0d0d 100%);
    color: #ffd2d2;
    border-color: #4a2222;
}
