#civilWorksHub {
    position: fixed;
    top: max(58px, calc(96px * var(--ui-scale)));
    right: max(env(safe-area-inset-right), calc(14px * var(--ui-scale)));
    bottom: calc(var(--civil-toolbar-height, 76px) + env(safe-area-inset-bottom) + var(--civil-fab-size, 66px) + 24px);
    display: flex; flex-direction: row; align-items: flex-start; justify-content: flex-end;
    gap: calc(8px * var(--ui-scale));
    z-index: 560; pointer-events: none;
    color: var(--lp-dialog-title);
    font-size: max(var(--font-md), calc(11px * var(--font-scale, 1)));
    line-height: 1.4;
}
#civilWorksHub > * { pointer-events: auto; }
#civilWorksDock, #civilFleetBox, #civilReserveBox {
    --works-padding: var(--spacing-md);
    box-sizing: border-box;
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: linear-gradient(243deg, var(--lp-dialog-facet) 0 19%, transparent 19.3%),
                linear-gradient(180deg, var(--lp-dialog-hi), var(--lp-dialog-lo));
    border: max(1px, calc(2px * var(--ui-scale))) solid var(--lp-dialog-frame);
    border-radius: var(--border-radius);
    box-shadow: 0 calc(3px * var(--ui-scale)) 0 var(--lp-dialog-edge),
                0 calc(8px * var(--ui-scale)) calc(18px * var(--ui-scale)) var(--lp-panel-shadow);
    scrollbar-width: thin;
    scrollbar-color: var(--lp-tile-line) var(--lp-dialog-lo);
}
#civilWorksDock {
    width: min(max(250px, calc(340px * var(--ui-scale))), calc(100vw - 18px));
    padding: 0 var(--works-padding) var(--works-padding);
    display: flex; flex-direction: column; gap: calc(7px * var(--ui-scale));
}
#civilSideColumn {
    display: flex; flex-direction: column; gap: calc(8px * var(--ui-scale)); max-height: 100%; min-height: 0;
}
#civilFleetBox, #civilReserveBox {
    width: min(max(210px, calc(290px * var(--ui-scale))), calc(100vw - 18px));
    padding: calc(4px * var(--ui-scale));
}
#civilFleetBox { flex: 0 1 auto; min-height: calc(44px * var(--ui-scale)); }
#civilReserveBox { flex: 0 0 auto; max-height: 60%; }
#civilReserveBox h2 {
    display: flex; align-items: center; gap: calc(6px * var(--ui-scale)); font-size: inherit; font-weight: 700;
    margin: 0; padding: calc(3px * var(--ui-scale)) var(--spacing-sm);
}
#civilReserveBox h2 b { margin-inline-start: auto; }
#civilReserveList { display: flex; flex-direction: column; gap: calc(4px * var(--ui-scale)); padding: calc(4px * var(--ui-scale)); }
.civil-slot-empty {
    padding: calc(7px * var(--ui-scale)) var(--spacing-sm); text-align: center; color: var(--lp-dialog-msg);
    border: 1px dashed var(--lp-tile-line); border-radius: var(--border-radius); font-variant-numeric: tabular-nums;
}
#civilFleetBox.civil-attention { animation: civil-attention .5s ease-in-out 3; }
@keyframes civil-attention { 50% { box-shadow: 0 0 0 calc(4px * var(--ui-scale)) var(--lp-warm-lip); } }
#civilWorksHub #civilFleetToggle { width: 100%; display: flex; align-items: center; gap: calc(6px * var(--ui-scale)); font-weight: 700; }
#civilFleetToggle .civil-caret { margin-inline-start: auto; }
#civilFleetToggle[aria-expanded="true"] .civil-caret { transform: rotate(180deg); }
.civil-count { font-variant-numeric: tabular-nums; }
#civilFleetBody { padding: calc(4px * var(--ui-scale)); }
body.hide-ui #civilWorksHub, .showcase-mode #civilWorksHub, #civilWorksHub[hidden],
#civilWorksHub [hidden], #civilUpgradePopupAction[hidden] { display: none !important; }
/* Round construction-team button at the bottom right: teams at work / all teams. */
:root { --civil-fab-size: max(66px, calc(104px * var(--ui-scale))); }
.civil-upgrade-btn {
    position: fixed; z-index: 561; box-sizing: border-box;
    right: calc(env(safe-area-inset-right) + max(8px, calc(14px * var(--ui-scale))));
    bottom: calc(var(--civil-toolbar-height, 76px) + env(safe-area-inset-bottom) + 12px);
    width: var(--civil-fab-size); height: var(--civil-fab-size); padding: 0; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.15;
    font: inherit; cursor: pointer; color: #3b2200;
    background: linear-gradient(243deg, rgba(255,255,255,.3) 0 28%, transparent 28.4%),
                linear-gradient(180deg, var(--lp-yellow-hi), var(--lp-yellow-lo));
    border: max(2px, calc(3px * var(--ui-scale))) solid var(--lp-yellow-lip);
    box-shadow: 0 calc(5px * var(--ui-scale)) 0 var(--lp-yellow-lip), 0 8px 18px rgba(0,0,0,.35);
}
.civil-upgrade-btn:hover { filter: brightness(1.06); }
.civil-upgrade-btn:active, .civil-upgrade-btn.active { transform: translateY(2px); box-shadow: 0 2px 0 var(--lp-yellow-lip), 0 4px 10px rgba(0,0,0,.35); }
.civil-upgrade-btn.active { outline: 3px solid #fff; outline-offset: -7px; }
.civil-upgrade-btn:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; }
.civil-fab-icon { font-size: calc(var(--civil-fab-size) * .24); line-height: 1; }
.civil-fab-count { font-size: calc(var(--civil-fab-size) * .17); font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.civil-upgrade-btn small { max-width: 92%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900;
    font-size: max(10px, calc(var(--civil-fab-size) * .14)); }
.civil-upgrade-btn.all-busy { color: #fff; border-color: #9a3412; background: linear-gradient(180deg, #fb923c, #ea580c);
    box-shadow: 0 calc(5px * var(--ui-scale)) 0 #9a3412, 0 8px 18px rgba(0,0,0,.35); }
body.hide-ui .civil-upgrade-btn, .showcase-mode .civil-upgrade-btn { display: none !important; }
/* "Upgrade ready" label over the button while a team is idle; it grows away from the screen edge. */
.civil-fab-badge {
    position: absolute; bottom: calc(100% - 4px); right: -4px; white-space: nowrap; pointer-events: none; padding: 2px .6em; box-sizing: border-box;
    font-size: max(11px, calc(var(--civil-fab-size) * .15)); font-weight: 900; line-height: 1.5; text-align: center;
    color: #fff; background: #15803d; border: 2px solid #fff; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.civil-fab-badge[hidden] { display: none; }
.civil-upgrade-btn.civil-fab-ready { animation: civil-fab-call 1.6s ease-in-out infinite; }
.civil-upgrade-btn.civil-fab-shake { animation: civil-fab-shake .45s ease-in-out 2; }
@keyframes civil-fab-shake { 25% { transform: translateX(-5px) rotate(-6deg); } 75% { transform: translateX(5px) rotate(6deg); } }
@keyframes civil-fab-call {
    50% { box-shadow: 0 calc(5px * var(--ui-scale)) 0 var(--lp-yellow-lip), 0 0 0 6px rgba(34,197,94,.55), 0 0 22px 8px rgba(34,197,94,.6); }
}
@media (prefers-reduced-motion: reduce) {
    .civil-upgrade-btn.civil-fab-ready { animation: none; outline: 3px solid #22c55e; outline-offset: 3px; }
}
/* Save notices and mode hints keep clear of the round button. */
body:has(#constructionVehicleBtn) :is(#autoSaveStatus, #saveIndicator) { right: calc(var(--civil-fab-size) + 28px); }
body:has(#constructionVehicleBtn) :is(#zoneModeHint, #placementModeHint, #demolishModeHint) {
    bottom: calc(var(--civil-toolbar-height, 76px) + var(--civil-fab-size) + 28px);
}
.civil-steps { display: flex; flex-wrap: wrap; gap: calc(5px * var(--ui-scale)); }
#civilWorksDock .civil-steps button { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: .35em; white-space: nowrap; }
#civilWorksDock .civil-sizes button { flex: 0 1 auto; min-width: 3.2em; }
#civilWorksDock #civilZones { flex-wrap: nowrap; }
#civilWorksDock #civilZones button { flex-wrap: wrap; min-width: 0; padding-inline: calc(3px * var(--ui-scale)); white-space: normal; line-height: 1.2; }
.civil-chip-count {
    min-width: 1.5em; padding-inline: .3em; border-radius: 999px; font-variant-numeric: tabular-nums;
    background: var(--lp-dialog-facet); border: 1px solid currentColor; font-size: .85em; line-height: 1.35;
}
#civilWorksDock .civil-steps button.civil-empty { opacity: .62; }
#civilWorksDock #civilZones button[data-zone="residential"] { border-bottom: calc(3px * var(--ui-scale)) solid #4ade80; }
#civilWorksDock #civilZones button[data-zone="commercial"] { border-bottom: calc(3px * var(--ui-scale)) solid #60a5fa; }
#civilWorksDock #civilZones button[data-zone="industrial"] { border-bottom: calc(3px * var(--ui-scale)) solid #fbbf24; }
.civil-idle { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: max(var(--font-sm), 11px); font-weight: 700; color: var(--sc5-title, #1478b3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.civil-idle.civil-warn { color: #d9480f; }
#civilReasonTip {
    position: fixed; left: 0; top: 0; z-index: 900; pointer-events: none;
    max-width: min(280px, calc(100vw - 12px)); padding: 4px 9px;
    font-size: max(12px, var(--font-sm)); font-weight: 700; line-height: 1.4; color: #fff;
    background: #7f1d1d; border: 1px solid #fca5a5; border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
#civilReasonTip[hidden], body.hide-ui #civilReasonTip { display: none; }
/* Final confirmation of automatic upgrades. The map stays visible so the ghost buildings can be checked. */
#civilAutoDialog {
    position: fixed; inset: 0; z-index: 800; display: flex; align-items: center; justify-content: flex-start;
    padding: 12px max(12px, 5vw); box-sizing: border-box; background: rgba(8,12,24,.22);
}
.civil-auto-box {
    display: flex; flex-direction: column; gap: calc(8px * var(--ui-scale));
    width: min(max(280px, calc(380px * var(--ui-scale))), 100%); max-height: 100%; box-sizing: border-box;
    padding: var(--spacing-md); color: var(--lp-dialog-title); font-size: max(var(--font-md), 12px); line-height: 1.4;
    background: linear-gradient(243deg, var(--lp-dialog-facet) 0 19%, transparent 19.3%),
                linear-gradient(180deg, var(--lp-dialog-hi), var(--lp-dialog-lo));
    border: max(1px, calc(2px * var(--ui-scale))) solid var(--lp-dialog-frame); border-radius: var(--border-radius);
    box-shadow: 0 calc(3px * var(--ui-scale)) 0 var(--lp-dialog-edge), 0 8px 24px var(--lp-panel-shadow);
}
.civil-auto-box h2 { margin: 0; font-size: max(var(--font-lg), 15px); }
.civil-auto-box p { margin: 0; }
.civil-auto-summary { font-weight: 800; }
.civil-auto-more { color: var(--lp-dialog-msg); font-size: max(var(--font-sm), 11px); }
.civil-auto-list {
    display: flex; flex-direction: column; gap: calc(4px * var(--ui-scale)); overflow-y: auto; min-height: 0;
    overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--lp-tile-line) var(--lp-dialog-lo);
}
#civilAutoDialog .civil-auto-row {
    display: flex; flex: none; align-items: center; gap: calc(8px * var(--ui-scale)); text-align: start; cursor: pointer;
    padding: calc(4px * var(--ui-scale)) var(--spacing-sm); font: inherit; color: inherit; background: var(--lp-dialog-facet);
    border: 1px solid var(--lp-divider); border-radius: var(--border-radius);
}
.civil-auto-row small { display: block; color: var(--lp-dialog-msg); font-variant-numeric: tabular-nums; }
.civil-auto-row strong { display: block; }
.civil-auto-truck {
    flex: none; padding: 2px 7px; border-radius: 4px; white-space: nowrap; font-size: max(var(--font-sm), 11px);
    color: #fff0d1; background: #2b2318; border: 2px solid #ffc55d; font-variant-numeric: tabular-nums;
}
.civil-auto-actions { display: flex; gap: calc(8px * var(--ui-scale)); }
#civilAutoDialog .civil-auto-actions button {
    flex: 1; min-height: max(34px, calc(38px * var(--ui-scale))); font: inherit; font-weight: 800; cursor: pointer;
    color: var(--lp-text); background: linear-gradient(180deg, var(--lp-tile-hi), var(--lp-tile-lo));
    border: 1px solid var(--lp-tile-line); border-radius: calc(4px * var(--ui-scale));
    box-shadow: inset 0 calc(-2px * var(--ui-scale)) 0 var(--lp-tile-lip);
}
#civilAutoDialog .civil-auto-actions .civil-auto-start {
    flex: 2; color: #3b2200; background: linear-gradient(180deg, var(--lp-yellow-hi), var(--lp-yellow-lo));
    border-color: var(--lp-yellow-lip); box-shadow: inset 0 calc(-2px * var(--ui-scale)) 0 var(--lp-yellow-lip);
}
#civilAutoDialog button:disabled { opacity: .58; cursor: default; }
@media (max-width: 640px) { #civilAutoDialog { justify-content: center; align-items: flex-end; } .civil-auto-box { max-height: 60dvh; } }
#civilWorksDock #civilSelectionStatus.civil-warn { color: var(--lp-warm-label); background: var(--lp-warm-hi); border-inline-start: 3px solid var(--lp-warm-lip); padding: var(--spacing-xs) var(--spacing-sm); }
#civilWorksDock kbd { font: inherit; font-size: .8em; padding: 0 .4em; border: 1px solid currentColor; border-radius: .3em; opacity: .75; }
.civil-thumb { flex: none; width: calc(40px * var(--ui-scale)); height: calc(40px * var(--ui-scale)); min-width: 30px; min-height: 30px; object-fit: contain; text-align: center; font-size: 1.5em; line-height: 1.4; }
.civil-row-text { flex: 1; min-width: 0; display: block; }
.civil-row-text progress { display: block; width: 100%; height: calc(5px * var(--ui-scale)); min-height: 4px; border: 0; border-radius: var(--border-radius); overflow: hidden; background: var(--lp-rci-track); accent-color: var(--lp-yellow-lo); }
.civil-row-text progress::-webkit-progress-bar { background: var(--lp-rci-track); }
.civil-row-text progress::-webkit-progress-value { background: linear-gradient(90deg,var(--lp-yellow-hi),var(--lp-yellow-lo)); }
.civil-row-text progress::-moz-progress-bar { background: linear-gradient(90deg,var(--lp-yellow-hi),var(--lp-yellow-lo)); }
.civil-row-actions { display: flex; flex-direction: column; gap: calc(3px * var(--ui-scale)); }
#civilWorksHub .civil-row .civil-locate { display: flex; align-items: center; gap: calc(6px * var(--ui-scale)); }
.civil-row.civil-focus { background: var(--lp-dialog-facet); outline: 2px solid var(--lp-yellow-lo); outline-offset: -2px; border-radius: var(--border-radius); }
#civilWorksHub .civil-cancel { min-width: max(26px, calc(28px * var(--ui-scale))); padding: 0;
    --face-hi: var(--lp-cancel-hi); --face-lo: var(--lp-cancel-lo); --face-edge: var(--lp-cancel-lip); --face-lip: var(--lp-cancel-lip); --face-text: var(--lp-cancel-text); }
#civilFleetList p { margin: calc(6px * var(--ui-scale)); color: var(--lp-dialog-msg); }
#civilWorksDock header, .civil-row, .civil-actions, .civil-tabs, .civil-anchor, .civil-placement, .civil-plot-tools, .civil-progress, #civilFleetPages {
    display: flex; align-items: center; gap: calc(6px * var(--ui-scale));
}
#civilWorksDock header, .civil-row, .civil-anchor, .civil-placement { justify-content: space-between; }
#civilWorksDock header strong { font-size: max(var(--font-lg), calc(14px * var(--font-scale, 1))); }
#civilWorksDock p { margin: 0; }
#civilWorksHub button, #civilUpgradePopupAction, #civilSitePopupAction {
    font: inherit;
    padding: calc(5px * var(--ui-scale)) var(--spacing-sm);
    min-height: calc(30px * var(--ui-scale));
}
:is(#civilWorksHub button, #civilUpgradePopupAction, #civilSitePopupAction):where(:not(.civil-model-card, .civil-locate)) {
    --face-hi: var(--lp-tile-hi);
    --face-lo: var(--lp-tile-lo);
    --face-edge: var(--lp-tile-line);
    --face-lip: var(--lp-tile-lip);
    --face-text: var(--lp-text);
    color: var(--face-text);
    background: linear-gradient(300deg, var(--lp-tile-facet) 0 30%, transparent 30.5%),
                linear-gradient(180deg, var(--face-hi), var(--face-lo));
    border: 1px solid var(--face-edge);
    border-radius: calc(4px * var(--ui-scale));
    box-shadow: inset 0 calc(-2px * var(--ui-scale)) 0 var(--face-lip);
    cursor: pointer;
}
:is(#civilWorksHub button, #civilUpgradePopupAction, #civilSitePopupAction):where(:not(.civil-model-card, .civil-locate):hover:enabled) {
    --face-hi: var(--lp-tile-hover-hi);
    --face-lo: var(--lp-tile-hover-lo);
}
:is(#civilWorksHub [aria-pressed="true"], #civilWorksHub .civil-action:enabled,
    #civilUpgradePopupAction, #civilSitePopupAction):where(:not(.civil-model-card, .civil-locate)) {
    --face-hi: var(--lp-yellow-hi);
    --face-lo: var(--lp-yellow-lo);
    --face-edge: var(--lp-yellow-lip);
    --face-lip: var(--lp-yellow-lip);
    --face-text: #3b2200;
    font-weight: 700;
}
:is(#civilWorksHub button, #civilUpgradePopupAction, #civilSitePopupAction):focus-visible {
    outline: 2px solid var(--lp-tile-line);
    outline-offset: -2px;
}
#civilWorksHub button:disabled { opacity: .58; cursor: default; }
#civilWorksDock .civil-heading {
    margin-inline: calc(-1 * var(--works-padding));
    padding: var(--spacing-sm) var(--works-padding);
    color: #f1f5f9;
    background: linear-gradient(118deg, var(--lp-dialog-facet) 0 28%, transparent 28.4%),
                linear-gradient(180deg, var(--lp-dhead-hi), var(--lp-dhead-lo));
    border-bottom: max(2px, calc(3px * var(--ui-scale))) solid var(--lp-yellow-lo);
}
#civilWorksDock #civilCloseHub { min-width: max(28px, calc(30px * var(--ui-scale))); padding: 0; font-size: max(16px, var(--font-lg)); }
.civil-actions, .civil-placement, .civil-plot-tools { flex-wrap: wrap; }
.civil-placement { padding-top: var(--spacing-sm); border-top: 1px solid var(--lp-divider); }
#civilPlacementControls { position: sticky; bottom: 0; z-index: 1; background: var(--lp-dialog-lo); }
#civilWorksDock #civilApprove { flex: 1; }
.civil-proposal { display: flex; align-items: center; gap: var(--spacing-sm); margin-block: var(--spacing-xs); }
.civil-proposal img {
    width: min(32%, calc(120px * var(--ui-scale))); height: clamp(65px, 12dvh, 104px); object-fit: contain;
    filter: drop-shadow(0 2px 3px #000a) drop-shadow(0 0 5px #0006);
}
.civil-proposal strong { display: block; font-size: max(var(--font-lg), 14px); overflow-wrap: anywhere; }
.civil-proposal small { color: var(--lp-dialog-msg); }
#civilBackToProposal { margin-bottom: var(--spacing-xs); }
.civil-sizes { display: flex; gap: calc(4px * var(--ui-scale)); flex-wrap: wrap; margin-block-end: calc(5px * var(--ui-scale)); }
#civilWorksDock .civil-sizes button { padding: calc(2px * var(--ui-scale)) calc(7px * var(--ui-scale)); }
.civil-models {
    display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: calc(4px * var(--ui-scale));
    overflow-y: auto; flex: 1 1 auto; min-height: calc(96px * var(--ui-scale)); overscroll-behavior: contain;
    margin-block: calc(4px * var(--ui-scale)); scrollbar-width: thin;
    scrollbar-color: var(--lp-tile-line) var(--lp-dialog-lo);
}
#civilWorksHub button.civil-model-card {
    position: relative; display: grid; grid-template: minmax(0,1fr) / minmax(0,1fr); place-items: center;
    min-width: 0; height: clamp(72px,calc(112px * var(--ui-scale)),130px); padding: calc(6px * var(--ui-scale));
    border: 0; background: transparent; box-shadow: none; color: var(--lp-dialog-title); cursor: pointer;
}
.civil-model-card img {
    display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain;
    filter: drop-shadow(0 calc(2px * var(--ui-scale)) calc(3px * var(--ui-scale)) rgba(0,0,0,.85))
            drop-shadow(0 0 calc(10px * var(--ui-scale)) rgba(0,0,0,.65));
}
.civil-model-card:is(:focus-visible,[aria-pressed="true"]) img {
    filter: drop-shadow(0 0 calc(3px * var(--ui-scale)) var(--lp-yellow-hi)) drop-shadow(0 2px 5px #000a);
}
.civil-size-heading {
    grid-column: 1 / -1; margin: calc(4px * var(--ui-scale)) 0 0; padding-block-end: 2px;
    font-size: max(var(--font-sm), 11px); font-weight: 800; color: var(--lp-dialog-msg);
    border-bottom: 1px solid var(--lp-divider); font-variant-numeric: tabular-nums;
}
.civil-legend {
    display: flex; flex-wrap: wrap; gap: 2px calc(10px * var(--ui-scale)); margin: 0;
    font-size: max(var(--font-sm), 11px); color: var(--lp-dialog-msg);
}
.civil-legend b {
    display: inline-block; min-width: 1.5em; padding-inline: .2em; text-align: center; color: #fff;
    border-radius: 4px; border: 1px solid #fff; background: #0f172a; line-height: 1.35;
}
.civil-legend .civil-legend-up { background: #15803d; }
.civil-legend .civil-legend-rebuild { background: #1d4ed8; }
#civilReasonTip.civil-tip-info { background: #1e3a8a; border-color: #93c5fd; }
.civil-reserve-hint { margin: 0; padding-inline: var(--spacing-sm); font-size: max(var(--font-sm), 11px); color: var(--lp-dialog-msg); }
.civil-fleet-metrics { color: var(--lp-dialog-msg); margin-block: var(--spacing-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.civil-tabs { border-bottom: 1px solid var(--lp-divider); padding-bottom: var(--spacing-sm); }
.civil-tabs button { flex: 1; }
.civil-row { border-bottom: 1px solid var(--lp-divider); padding-block: var(--spacing-xs); }
.civil-row:last-child { border-bottom: 0; }
#civilWorksHub .civil-locate { background: transparent; color: inherit; border: 0; text-align: start; flex: 1; min-width: 0; cursor: pointer; }
#civilWorksHub .civil-locate:hover { background: var(--lp-dialog-facet); border-radius: var(--border-radius); }
#civilWorksHub .civil-locate strong, #civilWorksHub .civil-locate small { display: block; }
.civil-locate small, #civilSelectionStatus { color: var(--lp-dialog-msg); }
#civilWorksHub small { font-size: max(var(--font-sm), calc(10px * var(--font-scale, 1))); }
#civilSiteName { display: block; margin-block-start: var(--spacing-sm); font-size: max(1em, var(--font-md)); }
#civilSiteTruck { color: var(--lp-dialog-msg); }
.civil-progress progress { flex: 1; min-width: 0; height: var(--spacing-sm); border: 0; border-radius: var(--border-radius); overflow: hidden; background: var(--lp-rci-track); accent-color: var(--lp-yellow-lo); }
.civil-progress progress::-webkit-progress-bar { background: var(--lp-rci-track); }
.civil-progress progress::-webkit-progress-value { background: linear-gradient(90deg,var(--lp-yellow-hi),var(--lp-yellow-lo)); }
.civil-progress progress::-moz-progress-bar { background: linear-gradient(90deg,var(--lp-yellow-hi),var(--lp-yellow-lo)); }
.civil-progress output, .civil-timing dd { font-variant-numeric: tabular-nums; }
.civil-timing {
    display: grid; grid-template-columns: auto 1fr; gap: calc(3px * var(--ui-scale)) calc(9px * var(--ui-scale));
    margin-block: var(--spacing-sm); padding: var(--spacing-sm); background: var(--lp-dialog-facet); border-radius: var(--border-radius);
}
.civil-timing dt { color: var(--lp-dialog-msg); }
.civil-timing dd { margin: 0; text-align: end; }
#civilWorksHub .civil-cancel-confirm {
    --face-hi: var(--lp-cancel-hi); --face-lo: var(--lp-cancel-lo);
    --face-edge: var(--lp-cancel-lip); --face-lip: var(--lp-cancel-lip); --face-text: var(--lp-cancel-text);
}
#civilFleetPages { justify-content: center; margin-top: calc(6px * var(--ui-scale)); }
#civilFleetStatus { color: var(--lp-warm-label); background: var(--lp-warm-hi); border-inline-start: 3px solid var(--lp-warm-lip); padding: var(--spacing-xs) var(--spacing-sm); }
@media (max-width: 640px) and (orientation: portrait) {
    #civilWorksHub { top: auto; left: 6px; right: 6px; flex-direction: column; align-items: stretch; justify-content: flex-end; max-height: 52dvh; }
    #civilWorksDock, #civilFleetBox, #civilReserveBox { width: auto; }
    #civilSideColumn { max-height: 24dvh; flex: none; overflow-y: auto; }
    #civilFleetBox, #civilReserveBox { flex: none; max-height: none; }
    #civilWorksDock { max-height: none; min-height: 0; flex: 0 1 auto; }
    #civilWorksHub button { min-height: 34px; }
    .civil-models { max-height: 17dvh; grid-template-columns: repeat(3,minmax(0,1fr)); }
    #civilWorksHub button.civil-model-card { height: clamp(70px,13dvh,110px); }
    #civilWorksHub .civil-auto-card { padding: 1px 3px; }
    #civilWorksHub#civilWorksHub#civilWorksHub .civil-auto-card button { min-height: 30px; padding-block: 0; }
    #civilAutoToggle .civil-auto-text { line-height: 1.15; }
}
@media (max-height: 560px) and (orientation: landscape) {
    #civilWorksHub { top: 6px; }
    #civilWorksDock { width: min(40vw, 300px); }
    #civilFleetBox, #civilReserveBox { width: min(34vw, 250px); }
    #civilWorksHub button.civil-model-card { height: clamp(60px,22dvh,100px); }
}

/* Keep quests and requests alive while their city-map overlays are out of view. */
body.civil-works-active :is(.citizen-request-bubble-html, .civil-mood-bubble-html,
    .building-status-icon-container, #crTrackerContainer, #questContainer, #questOverlay,
    #tradeGiftBubble, #buildingPopup, #constructionPopup,
    #upgradePopup, #citizenPopup, #vehiclePopup) {
    display: none !important;
}
/* Other advisor talks wait while the panel is open; the construction-team guides stay. */
body.civil-works-active:not(.civil-guide) #advisorStepOverlay { display: none !important; }
/* Auto upgrade: one sky-blue button (title + how many can level up) with the detail button inside it */
#civilWorksHub .civil-auto-card {
    display: flex; align-items: stretch; flex: none; gap: calc(6px * var(--ui-scale)); padding: calc(5px * var(--ui-scale));
    border-radius: calc(14px * var(--ui-scale)); background: linear-gradient(180deg, #2aa6e6, #157fc0); border: 1px solid #12699f;
    box-shadow: 0 calc(2px * var(--ui-scale)) calc(5px * var(--ui-scale)) rgba(15, 60, 95, .3);
}
#civilWorksHub .civil-auto-card.civil-auto-on { background: linear-gradient(180deg, #1f9e55, #13773c); border-color: #0f5e30; }
#civilWorksHub#civilWorksHub#civilWorksHub .civil-auto-card #civilAutoToggle {
    display: flex; align-items: center; gap: calc(6px * var(--ui-scale)); flex: 1; min-width: 0; text-align: start;
    padding: calc(2px * var(--ui-scale)) calc(4px * var(--ui-scale)); background: transparent !important; border: 0 !important; box-shadow: none !important; color: #fff;
}
#civilAutoToggle .civil-auto-icon { font-size: calc(22px * var(--ui-scale)); }
#civilAutoToggle .civil-auto-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
#civilWorksHub#civilWorksHub#civilWorksHub #civilAutoToggle .civil-auto-text :is(strong, small) { color: #fff !important; text-shadow: none; }
#civilAutoToggle .civil-auto-text strong { font-size: max(var(--font-md), 12px); font-weight: 800; }
#civilAutoToggle .civil-auto-text small { font-size: max(var(--font-sm), 11px); font-weight: 600; font-variant-numeric: tabular-nums; }
#civilWorksHub#civilWorksHub#civilWorksHub .civil-auto-card #civilReadyDetails {
    flex: none; align-self: center; padding: calc(5px * var(--ui-scale)) calc(10px * var(--ui-scale)); border-radius: 999px !important;
    background: #fff !important; border: 0 !important; color: #14557f !important; font-weight: 800; font-size: max(var(--font-sm), 11px); white-space: nowrap;
}
#civilWorksHub#civilWorksHub#civilWorksHub .civil-auto-card #civilReadyDetails:disabled { opacity: .6; }
#civilReadyList { display: flex; flex-direction: column; gap: calc(3px * var(--ui-scale)); flex: 0 1 auto; max-height: min(30dvh, calc(260px * var(--ui-scale))); min-height: calc(60px * var(--ui-scale)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin-top: calc(4px * var(--ui-scale)); }
#civilReadyList[hidden] { display: none; }
#civilReadyList p { margin: 0; text-align: center; font-size: max(var(--font-sm), 11px); color: var(--lp-dialog-msg); }
#civilWorksHub#civilWorksHub#civilWorksHub button.civil-ready-row {
    display: flex; align-items: center; flex: none; gap: calc(6px * var(--ui-scale)); width: 100%; text-align: start;
    padding: calc(3px * var(--ui-scale)) calc(6px * var(--ui-scale)); background: var(--lp-tile-lo); border: 1px solid var(--lp-tile-line); color: var(--lp-dialog-title);
}
#civilWorksHub#civilWorksHub#civilWorksHub button.civil-ready-row:is(:hover, .civil-focus) { border-color: #29a9eb; box-shadow: 0 0 0 1px #29a9eb; }
.civil-ready-row .civil-thumb { width: calc(34px * var(--ui-scale)); height: calc(34px * var(--ui-scale)); object-fit: contain; flex: none; }
.civil-ready-row .civil-row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.civil-ready-row .civil-row-text :is(strong, small) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.civil-ready-go { flex: none; }
/* Building information card (replaces the text under the pictures and the browser tooltip) */
#civilModelCard {
    position: fixed; left: 0; top: 0; z-index: 12000; pointer-events: none; width: max-content; min-width: calc(190px * var(--ui-scale)); max-width: min(280px, calc(100vw - 12px));
    padding: calc(10px * var(--ui-scale)); border-radius: calc(14px * var(--ui-scale)); background: var(--sc-surface, #fff); color: var(--sc-text, #1f2d3d);
    border: 1px solid var(--sc-line, #d3dde8); border-top: calc(4px * var(--ui-scale)) solid #29a9eb; box-shadow: 0 8px 24px rgba(15, 28, 44, .28);
    font-size: max(var(--font-sm), 11px);
}
#civilModelCard[hidden] { display: none; }
#civilModelCard header { display: flex; align-items: center; gap: calc(8px * var(--ui-scale)); padding-bottom: calc(6px * var(--ui-scale)); border-bottom: 1px solid var(--sc-line, #d3dde8); }
#civilModelCard header img { width: calc(52px * var(--ui-scale)); height: calc(52px * var(--ui-scale)); object-fit: contain; }
#civilModelCard header div { display: flex; flex-direction: column; min-width: 0; }
#civilModelCard header strong { font-size: max(var(--font-md), 13px); font-weight: 800; }
#civilModelCard header small { color: var(--sc-sub, #5d6b7c); }
#civilModelCard dl { display: grid; grid-template-columns: 1fr auto; gap: calc(4px * var(--ui-scale)) calc(12px * var(--ui-scale)); margin: calc(7px * var(--ui-scale)) 0; }
#civilModelCard dt { display: flex; gap: calc(5px * var(--ui-scale)); color: var(--sc-sub, #5d6b7c); }
#civilModelCard dt span:first-child { width: 1.4em; text-align: center; }
#civilModelCard dd { margin: 0; text-align: end; font-weight: 800; font-variant-numeric: tabular-nums; }
#civilModelCard p { margin: 0; padding: calc(4px * var(--ui-scale)) calc(8px * var(--ui-scale)); border-radius: 999px; text-align: center; font-weight: 700; background: rgba(41, 169, 235, .14); color: var(--sc5-title, #1478b3); }
#civilModelCard p.civil-card-none { background: var(--sc-surface-2, #eef2f6); color: var(--sc-sub, #5d6b7c); }
.civil-row.civil-reservation { border-inline-start: calc(3px * var(--ui-scale)) solid var(--lp-yellow-lo); padding-inline-start: calc(4px * var(--ui-scale)); }

/* Blue "i" beside the online queue and the offline reservation slots */
#civilFleetBox { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; column-gap: calc(6px * var(--ui-scale)); }
#civilFleetBox { grid-template-rows: auto minmax(0,1fr); overflow: hidden; }
#civilFleetBox > #civilFleetBody { grid-column: 1 / -1; align-self: stretch; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
#civilReserveTitle { display: flex; align-items: center; gap: calc(5px * var(--ui-scale)); }
#civilReserveTitle .civil-count { margin-inline-start: auto; order: 3; }
#civilWorksHub#civilWorksHub#civilWorksHub#civilWorksHub button.civil-info {
    display: inline-grid; place-items: center; flex: none; padding: 0; box-sizing: border-box;
    width: calc(22px * var(--ui-scale)); height: calc(22px * var(--ui-scale)); min-width: 18px; min-height: 18px; border-radius: 50% !important;
    background: linear-gradient(180deg, #34b4f2, #1b8fd0) !important; border: 1px solid #157bb5 !important; color: #fff !important;
    font: italic 800 max(var(--font-sm), 12px) Georgia, 'Times New Roman', serif; text-shadow: none; cursor: help;
}
#civilInfoTip {
    position: fixed; left: 0; top: 0; z-index: 12000; max-width: min(260px, calc(100vw - 12px)); padding: calc(8px * var(--ui-scale)) calc(10px * var(--ui-scale));
    border-radius: calc(12px * var(--ui-scale)); background: var(--sc-surface, #fff); color: var(--sc-text, #1f2d3d);
    border: 1px solid var(--sc-line, #d3dde8); border-top: calc(4px * var(--ui-scale)) solid #29a9eb; box-shadow: 0 8px 24px rgba(15, 28, 44, .28);
    font-size: max(var(--font-sm), 12px); font-weight: 600; line-height: 1.45; white-space: pre-line;
}
#civilInfoTip[hidden] { display: none; }
/* Waiting jobs can be dragged; tapping one offers "to top / to bottom" */
#civilWorksHub .civil-row.civil-queued { flex-wrap: wrap; cursor: grab; user-select: none; touch-action: none; border-inline-start: calc(3px * var(--ui-scale)) solid #29a9eb; padding-inline-start: calc(4px * var(--ui-scale)); }
#civilWorksHub .civil-row.civil-queued .civil-locate { cursor: grab; }
#civilWorksHub .civil-row.civil-queued progress { display: none; }
/* Held row: follows the cursor above the others, which glide out of its way */
#civilWorksHub .civil-row.civil-queued { transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .15s ease; }
#civilWorksHub .civil-row.civil-dragging { position: relative; z-index: 6; transition: box-shadow .15s ease; will-change: transform; cursor: grabbing; border-radius: calc(10px * var(--ui-scale)); background: var(--sc-surface, #fff); box-shadow: 0 0 0 2px #29a9eb, 0 10px 22px rgba(15, 28, 44, .35); }
#civilWorksHub .civil-row.civil-dragging.civil-dropping { transition: transform .16s ease, box-shadow .16s ease; box-shadow: 0 0 0 2px #29a9eb, 0 2px 6px rgba(15, 28, 44, .2); }
body.civil-sorting, body.civil-sorting * { cursor: grabbing !important; user-select: none !important; }
@media (prefers-reduced-motion: reduce) { #civilWorksHub .civil-row.civil-queued, #civilWorksHub .civil-row.civil-dragging.civil-dropping { transition: none; } }
.civil-queue-menu { display: flex; flex-basis: 100%; gap: calc(5px * var(--ui-scale)); padding-block: calc(3px * var(--ui-scale)); }
.civil-queue-menu[hidden] { display: none; }
#civilWorksHub#civilWorksHub .civil-queue-menu button { flex: 1; font-weight: 700; cursor: pointer; }
#civilWorksHub#civilWorksHub .civil-queue-menu button:disabled { opacity: .45; cursor: default; }
/* Numbered rows (working, waiting, reserved) */
.civil-row > .civil-index {
    display: inline-grid; place-items: center; flex: none; align-self: center; min-width: calc(20px * var(--ui-scale)); height: calc(20px * var(--ui-scale));
    padding-inline: 3px; border-radius: 999px; background: #1b8fd0; color: #fff; font-size: max(var(--font-sm), 11px); font-weight: 800; font-variant-numeric: tabular-nums;
}
#civilWorksHub#civilWorksHub .civil-queue-menu button.civil-to-reserve { flex-basis: 100%; }
#civilWorksHub .civil-queue-menu { flex-wrap: wrap; }
#civilFleetStatus .civil-add-slot {
    display: block; margin-top: calc(5px * var(--ui-scale)); padding: calc(6px * var(--ui-scale)) calc(10px * var(--ui-scale)); border-radius: 999px;
    background: linear-gradient(180deg, #34b4f2, #1b8fd0); color: #fff; font-weight: 800; text-align: center; text-decoration: none;
}
/* "+" beside the team and slot counts: opens that shop card */
#civilWorksHub#civilWorksHub a.civil-plus {
    display: inline-grid; place-items: center; flex: none; order: 4; box-sizing: border-box;
    width: calc(26px * var(--ui-scale)); height: calc(26px * var(--ui-scale)); min-width: 22px; min-height: 22px; border-radius: 50%;
    background: linear-gradient(180deg, #34b4f2, #1b8fd0); border: 1px solid #157bb5; color: #fff;
    font-size: max(var(--font-md), 16px); font-weight: 900; line-height: 1; text-decoration: none; cursor: pointer;
}
#civilWorksHub#civilWorksHub a.civil-plus:hover { filter: brightness(1.08); }
#civilWorksHub#civilWorksHub a.civil-plus[hidden] { display: none; }
