.branch-display {
    --bd-bg: #071a10;
    --bd-bg-soft: #0c2416;
    --bd-surface: #12301f;
    --bd-surface-raised: #183c28;
    --bd-border: #245537;
    --bd-border-strong: #2f6b45;
    --bd-text: #f3faf5;
    --bd-muted: #9bc4a8;
    --bd-muted-strong: #c5e0cf;
    --bd-accent: #f0d060;
    --bd-accent-bright: #ffe566;
    --bd-accent-deep: #d4a017;
    --bd-green: #3ecf7a;
    --bd-error-bg: #5c1a1a;
    --bd-error-text: #fecaca;

    /* Fluid root: scales 720p → 4K; descendants use em so they follow */
    font-size: clamp(12px, 0.75vw + 0.55vh, 28px);

    position: relative;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    box-sizing: border-box;
    padding: 0.75em 1em;
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, rgba(62, 207, 122, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 40% at 95% 5%, rgba(240, 208, 96, 0.1), transparent 50%),
        linear-gradient(165deg, var(--bd-bg-soft) 0%, var(--bd-bg) 55%, #05140c 100%);
    color: var(--bd-text);
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.6em;
    overflow: hidden;
}

.branch-display__header {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
}

.branch-display__brand {
    display: flex;
    align-items: center;
    gap: 0.85em;
    min-width: 0;
}

.branch-display__logo {
    height: clamp(2em, 1.8em + 1vw, 4em);
    width: auto;
    flex-shrink: 0;
    border-radius: 0.35em;
    object-fit: contain;
    background: #fff;
}

.branch-display__eyebrow {
    margin: 0;
    font-size: 0.75em;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bd-accent);
    flex-shrink: 0;
}

.branch-display__title {
    margin: 0;
    font-size: clamp(1.25em, 2vw, 1.75em);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--bd-text);
    line-height: 1.2;
}

.branch-display__error {
    margin: 0;
    padding: 0.5em 0.75em;
    border-radius: 0.4em;
    background: var(--bd-error-bg);
    color: var(--bd-error-text);
    font-size: 0.9em;
}

.branch-display__main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    gap: 0.85em;
    min-height: 0;
    overflow: hidden;
}

@media (max-width: 960px) {
    .branch-display {
        height: auto;
        min-height: 100dvh;
        min-height: 100vh;
        overflow: auto;
        grid-template-rows: auto;
    }

    .branch-display__main {
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .branch-display__section--waiting {
        max-height: none;
    }

    .branch-display__section--gold {
        flex: none;
        min-height: 16em;
    }
}

.branch-display__queue-column {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75em;
    overflow: hidden;
}

.branch-display__section {
    margin: 0;
    min-height: 0;
}

/* Serving block must keep its content height — otherwise cards spill into Giliran */
.branch-display__queue-column > .branch-display__section:first-of-type {
    flex: 0 0 auto;
    min-height: auto;
    overflow: hidden;
}

.branch-display__section--waiting {
    flex: 0 1 auto;
    max-height: 28%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
    background: transparent;
}

.branch-display__section--gold {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.branch-display__section-title {
    margin: 0 0 0.45em;
    font-size: 1.05em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bd-muted-strong);
}

.branch-display__stations {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10em), 1fr));
    gap: 0.7em;
}

.branch-display__station-card {
    display: flex;
    flex-direction: column;
    gap: 0.35em;
    padding: 0.9em 0.65em;
    border-radius: 0.5em;
    background: linear-gradient(160deg, var(--bd-surface-raised) 0%, var(--bd-surface) 100%);
    border: 1px solid var(--bd-border);
    box-shadow: inset 0 1px 0 rgba(62, 207, 122, 0.08);
    text-align: center;
}

.branch-display__station-name {
    margin: 0;
    padding: 0.2em 0.45em;
    font-size: clamp(1.35em, min(3.2vw, 5.5vh), 2.75em);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--bd-text);
    background: rgba(7, 26, 16, 0.45);
    border-radius: 0.25em;
    border: 1px solid var(--bd-border-strong);
}

.branch-display__ticket-number {
    margin: 0;
    font-size: clamp(1.75em, min(4.2vw, 8vh), 5.5em);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--bd-accent-bright);
    text-shadow: 0 0 1.5em rgba(255, 229, 102, 0.25);
}

/* Short TVs (e.g. 720p): tighten serving cards so sections don't collide */
@media (max-height: 800px) {
    .branch-display__station-card {
        padding: 0.55em 0.5em;
        gap: 0.2em;
    }

    .branch-display__station-name {
        font-size: clamp(1.15em, min(2.6vw, 4.5vh), 2em);
        padding: 0.15em 0.35em;
    }

    .branch-display__ticket-number {
        font-size: clamp(1.5em, min(3.6vw, 7vh), 3.25em);
    }

    .branch-display__section-title {
        margin-bottom: 0.3em;
    }

    .branch-display__section--waiting {
        max-height: 24%;
    }
}

.branch-display__ticket-number--idle {
    color: #4a7a5c;
    text-shadow: none;
}

.branch-display__station-service {
    margin: 0;
    font-size: 1em;
    color: var(--bd-muted-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.branch-display__waiting-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75em;
    margin-bottom: 0.4em;
    flex-shrink: 0;
}

.branch-display__waiting-header .branch-display__section-title {
    margin-bottom: 0;
}

.branch-display__waiting-count {
    margin: 0;
    font-size: 1.05em;
    color: var(--bd-accent);
}

.branch-display__empty {
    margin: 0;
    color: var(--bd-muted);
    font-size: 1.05em;
}

.branch-display__waiting-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45em;
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.branch-display__waiting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75em;
    padding: 0.55em 0.85em;
    border-radius: 0.4em;
    background: var(--bd-surface);
    border: 1px solid var(--bd-border);
    border-left: 0.2em solid var(--bd-green);
    flex-shrink: 0;
}

.branch-display__waiting-number {
    font-size: clamp(1.35em, 2.4vw, 2.5em);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--bd-accent);
}

.branch-display__waiting-service {
    font-size: 0.85em;
    color: var(--bd-muted-strong);
}

.branch-display__ad-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: 0.65em;
    border-radius: 0.6em;
    background: linear-gradient(160deg, var(--bd-surface-raised) 0%, var(--bd-surface) 100%);
    border: 1px solid var(--bd-border);
    box-shadow: inset 0 1px 0 rgba(240, 208, 96, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.branch-display__ad-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75em;
    margin-bottom: 0.4em;
    flex-shrink: 0;
}

.branch-display__ad-header .branch-display__section-title {
    margin-bottom: 0;
}

.branch-display__ad-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    border-radius: 0.4em;
    overflow: hidden;
    background: var(--bd-bg);
    border: 1px solid var(--bd-border);
}

.branch-display__ad-media {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--bd-bg);
}

.branch-display__ad-caption {
    margin: 0.35em 0 0;
    font-size: 0.8em;
    color: var(--bd-muted-strong);
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.branch-display__section--gold .branch-display__waiting-header {
    margin-bottom: 0.35em;
}

.branch-display__gold-table-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 0.5em;
    border: 1px solid var(--bd-border);
    background: var(--bd-surface);
    scrollbar-width: none;
}

.branch-display__gold-table-wrap::-webkit-scrollbar {
    display: none;
}

.branch-display__gold-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.25em;
}

.branch-display__gold-table th,
.branch-display__gold-table td {
    padding: 0.55em 0.75em;
    text-align: left;
    border-bottom: 1px solid var(--bd-border);
    line-height: 1.3;
}

.branch-display__gold-table th {
    font-size: 0.72em;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bd-accent);
    font-weight: 600;
    background: var(--bd-bg-soft);
    position: sticky;
    top: 0;
    z-index: 1;
}

.branch-display__gold-table td:nth-child(3) {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--bd-accent-bright);
    white-space: nowrap;
}

.branch-display__gold-table tbody tr:last-child td {
    border-bottom: none;
}

.branch-display__gold-table tbody tr:hover td {
    background: rgba(62, 207, 122, 0.06);
}
