.orders-dialog.tactical-popup {
    position: fixed;
    inset: 0;
    margin: auto;
    font-family: var(--font-body);
    width: min(900px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
}

.orders-dialog:not([open]) { display: none; }

.orders-dialog[open] {
    display: flex;
    flex-direction: column;
}

.orders-dialog::backdrop { background: #0009; }

.orders-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem 1rem;
    background: #252c2e;
}

.orders-dialog header, .orders-dialog footer { flex-shrink: 0; }
.orders-dialog footer {
    align-items: center;
    margin: 0 8px 8px;
    padding: .7rem 1rem;
    border-top: 1px solid var(--border-bright);
}
.orders-dialog footer [role=status] { margin-right: auto; }
.orders-dialog .orders-control { margin-block: .75rem; }
.orders-control-list { max-height: min(15rem, 30dvh); overflow-y: auto; }
.orders-control-list label { flex-wrap: wrap; }
.orders-rank-icon { width: 1.4rem; height: 1.4rem; flex: none; }
.orders-body aside .orders-rank-icon { vertical-align: middle; margin-inline-end: .4rem; }
.orders-rank-caption { color: var(--text-heading); font-size: .9em; }
.orders-dialog summary { cursor: pointer; }
.orders-dialog aside details:not([open]) > :not(summary) { display: none; }
.orders-dialog summary[aria-current=true] { color: var(--text-heading); font-weight: 700; }

.orders-body {
    display: grid;
    grid-template-columns: minmax(12rem, 32%) 1fr;
    min-height: 0;
    overflow: auto;
    margin: 0 8px;
    padding: 0;
}

.orders-body aside,
.orders-body section { padding: .75rem; }

.orders-body aside {
    border-right: 1px solid var(--border-bright);
    overflow: auto;
}

.orders-body aside button,
.orders-body small {
    display: block;
    text-align: left;
    width: 100%;
}

.orders-body aside details { padding-left: .4rem; }
.orders-body aside summary { padding-block: .35rem; }
.orders-body aside small { font-weight: normal; }
.orders-body aside input[type=search] { width: 100%; }

.orders-body label {
    display: flex;
    gap: .75rem;
    align-items: center;
    margin: .65rem 0;
}

.orders-body input[type=number] { width: 6rem; }
.orders-body section { min-width: 0; overflow: auto; }

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

.orders-dialog button[aria-pressed=true] { outline: 2px solid #dcb15e; }
.orders-selector { display: none; }

.orders-strip {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    color: white;
}

.orders-strip[hidden] { display: none; }

.hex.orders-area-hex::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(245,191,75,.38);
    pointer-events: none;
    clip-path: inherit;
}

@media (max-width: 900px) {
    .orders-body { display: block; }
    .orders-body section { overflow: visible; }
    .orders-body aside[data-expanded=false] { display: none; }
    .orders-selector { display: block; }
    .orders-dialog footer { flex-wrap: wrap; }
    .orders-dialog footer button { margin-left: auto; }
}

@media (max-width: 560px) {
    .orders-tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

#battle-ai-orders[hidden],
#standing-orders[hidden] { display: none; }

@media (max-width: 767px), (orientation: landscape) and (max-width: 940px) and (max-height: 500px) {
    #battle-ai-orders, #land-war-orders { display: none; }
}
