.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.badge {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #3a3b42;
    color: #aaa;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.badge .detail {
    font-weight: 400;
    opacity: 0.85;
    font-size: 0.8em;
}

.badge.mode-default {
    background: #3a3b42;
    color: #ccc;
}

.badge.mode-orchestrated {
    background: #1f6f43;
    color: #d6ffe9;
}

.badge.health-ok {
    background: #1f6f43;
    color: #d6ffe9;
}

.badge.health-fail {
    background: #6f1f1f;
    color: #ffd6d6;
}

.badge.health-unknown {
    background: #3a3b42;
    color: #888;
}

.mode-dropdown {
    position: relative;
    display: inline-flex;
}

/* The mode badge doubles as the dropdown trigger, so it is a real
   button — it keeps every .badge style and only drops the chrome a
   button would otherwise bring. */
.mode-badge-button {
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.mode-caret {
    font-size: 0.7em;
    opacity: 0.7;
}

.mode-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 13rem;
    background: #26272d;
    border: 1px solid #44454d;
    border-radius: 8px;
    padding: 0.3rem;
    z-index: 100;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.mode-menu.open {
    display: block;
}

.mode-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #ccc;
    font-family: inherit;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
}

.mode-menu-item:hover {
    background: #33343a;
}

.mode-menu-item.selected {
    color: #fff;
    font-weight: 600;
}

.mode-menu-item .check {
    width: 1em;
    flex: 0 0 1em;
    color: #7ee0a3;
}

.copyable-uuid {
    cursor: pointer;
}

.copyable-uuid:hover {
    text-decoration: underline;
}

.copy-tooltip {
    position: fixed;
    transform: translate(-50%, -100%);
    background: #2d2f36;
    color: #d6ffe9;
    border: 1px solid #1f6f43;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 1000;
    white-space: nowrap;
}

.copy-tooltip.visible {
    opacity: 1;
}

.columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.column {
    border: 1px solid #33343a;
    border-radius: 8px;
    overflow: hidden;
}

.column-header {
    padding: 0.6rem 0.9rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #999;
    background: #26272d;
    border-bottom: 1px solid #33343a;
    display: flex;
    justify-content: space-between;
}

.column-body {
    max-height: 26rem;
    overflow-y: auto;
}

.order-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid #2a2b31;
}

.order-row:last-child {
    border-bottom: none;
}

.orb {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e6e6e6;
    min-width: 2.5em;
}

.order-detail {
    font-size: 0.8rem;
    color: #888;
}

.order-uuid {
    font-family: monospace;
    font-size: 0.7rem;
    color: #556;
}

.order-score {
    margin-left: auto;
    font-weight: 600;
    color: #7ee0a3;
}

.hold-reason {
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.35;
}

.hold-CAPACITY {
    background: #4a2a1c;
    color: #ffcfae;
}

/* The "screen looks free but nothing moves" case: given its own, most
   attention-grabbing colour, because it is the one that reads as a bug
   to whoever is watching the kitchen. */
.hold-RESERVED_BY_HIGHER_RANK {
    background: #6f5a1f;
    color: #ffe9b0;
}

.hold-KDS_CLOSED {
    background: #3d3050;
    color: #ddc9ff;
}

.hold-UNSATISFIABLE {
    background: #6f1f1f;
    color: #ffd6d6;
}

/* The screen that shut the out-of-rank shortcut. Distinct from the
   reservation colour on purpose: this is the screen an operator would
   have to drain, which is often not the one holding up the queue. */
.hold-NOT_LIGHTLY_LOADED {
    background: #4a3a1c;
    color: #ffe0ae;
}

.hold-FOOTPRINT_UNKNOWN {
    background: #3a3b42;
    color: #bbb;
}

/* Every row is clickable, in all three columns: which screens an order
   will land on is worth asking about while it waits and after it has
   gone. */
.order-row {
    cursor: pointer;
}

.order-row:hover {
    background: #26272d;
}

.order-row.expanded {
    background: #24252b;
}

.footprint-toggle {
    margin-left: 0.5rem;
    font-size: 0.72rem;
    color: #7fa0c4;
    white-space: nowrap;
}

/* An order nothing gated, and an order the gate has no answer for, are
   different states and are coloured differently — neither is a fault,
   so neither is coloured like one. */
.footprint-NOT_DISPATCHED {
    color: #9a8f76;
}

.footprint-UNKNOWN {
    color: #777;
}

.footprint {
    margin-top: 0.45rem;
    padding: 0.5rem 0.65rem;
    border-left: 2px solid #3c4a5a;
    border-radius: 0 4px 4px 0;
    background: #202126;
    font-size: 0.75rem;
    color: #9aa7b4;
}

.footprint-title {
    margin-bottom: 0.35rem;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6f7d8c;
}

.footprint table {
    border-collapse: collapse;
}

.footprint td {
    padding: 0.1rem 0.7rem 0.1rem 0;
    border-bottom: none;
}

.footprint td:last-child {
    padding-right: 0;
    white-space: nowrap;
}

.footprint-kds {
    font-weight: 600;
    color: #cfe3ff;
}

.footprint-summary {
    margin-top: 0.35rem;
    color: #6f7d8c;
}

.footprint-note {
    line-height: 1.45;
    color: #8b8b8b;
}

.pressure {
    border: 1px solid #33343a;
    border-radius: 6px;
    overflow-x: auto;
}

.pressure tbody tr:last-child td {
    border-bottom: none;
}

.pressure td {
    font-variant-numeric: tabular-nums;
}

.bottleneck-row {
    background: #2d2418;
}

.bottleneck-flag {
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: #6f5a1f;
    color: #ffe9b0;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.updated {
    margin-top: 1rem;
    color: #666;
    font-size: 0.8rem;
}

.decisions {
    max-height: 22rem;
    overflow-y: auto;
    border: 1px solid #33343a;
    border-radius: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0;
}

th, td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #33343a;
}

th {
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.decisions thead th {
    position: sticky;
    top: 0;
    background: #1e1f24;
}

.uuid-short {
    font-family: monospace;
    color: #9ecbff;
    font-size: 0.85em;
}

.kind-badge {
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.kind-ADMITTED, .kind-ELIGIBLE {
    background: #274a63;
    color: #b9e2ff;
}

.kind-RELEASED, .kind-ACTIVATED {
    background: #1f6f43;
    color: #d6ffe9;
}

.kind-DROPPED, .kind-INELIGIBLE, .kind-DEACTIVATED {
    background: #6f1f1f;
    color: #ffd6d6;
}

.kind-AWAITING_RELEASE {
    background: #6f5a1f;
    color: #ffe9b0;
}

.kind-OBSERVED_IN_PRODUCTION {
    background: #2d2f63;
    color: #c9cbff;
}

/* A device ignoring the gate is the one event here that reports
   something being wrong outside the Orchestrator, so it is the only one
   given a border: it has to stand out in a scrolling list. */
.kind-GATE_BYPASSED {
    background: #7a1f1f;
    color: #ffe0e0;
    border: 1px solid #ff8080;
}

@media (max-width: 900px) {
    .columns {
        grid-template-columns: 1fr;
    }
}
