/*
 * Styling for the Barony Management layer.
 * All rules are scoped to .barony-scope so existing pages remain unaffected.
 * Palette is muted: parchment / slate / subdued golden accent.
 */

.barony-scope {
    --barony-bg: #f4efe3;
    --barony-surface: #fbf8f1;
    --barony-surface-2: #f0ead9;
    --barony-ink: #2f2a24;
    --barony-muted: #6f6656;
    --barony-border: #d9cfb8;
    --barony-border-strong: #c3b696;
    --barony-accent: #9c7a33;
    --barony-accent-soft: #ece0c4;
    --barony-pos: #4f7a4d;
    --barony-neg: #a5503f;
    --php-prestige: #b08a2e;
    --php-honor: #3a5f8a;
    --php-fear: #7a3030;

    /* Letter handwriting (baron vs correspondent) */
    --baron-letter-font-baron: 'Caveat', 'Segoe Script', 'Bradley Hand', cursive;
    --baron-letter-font-correspondent: 'Pinyon Script', 'Segoe Script', 'Brush Script MT', cursive;

    color: var(--barony-ink);
    background: var(--barony-bg);
    min-height: calc(100vh - 64px);
    padding: 12px 12px 96px 12px;
    font-family: 'Open Sans', sans-serif;
}

/* The Barony layer is desktop-only for now: hide it on medium-and-smaller screens. */
.barony-mobile-block {
    display: none;
}

@media (max-width: 1279.98px) {
    .barony-scope {
        display: none !important;
    }

    /* Audience Hall is the one Barony page allowed on mobile/tablet. */
    .barony-scope--audience-hall {
        display: block !important;
    }

    /* No other Barony page can be reached on mobile anyway — hide the tab bar entirely
       so there is nothing to tap into a blocked page with. */
    .barony-scope--audience-hall .barony-tabbar {
        display: none !important;
    }

    .barony-mobile-block {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: calc(100vh - 64px);
        padding: 24px;
        background: #f4efe3;
    }

    .barony-mobile-block--hidden {
        display: none;
    }

    .barony-mobile-block__card {
        display: flex;
        flex-direction: column;
        gap: .5rem;
        max-width: 22rem;
        padding: 1.5rem 1.75rem;
        text-align: center;
        background: #fbf8f1;
        border: 1px solid #d9cfb8;
        border-radius: .6rem;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    }

    .barony-mobile-block__title {
        font-family: 'Eagle Lake', serif;
        font-size: 1.15rem;
        color: #2f2a24;
    }

    .barony-mobile-block__hint {
        font-size: .85rem;
        color: #6f6656;
    }
}

/* Audience Hall: single fixed screen, no whole-page scroll. .barony-scope's own
   min-height + padding (content-box) are taller than the viewport by design for
   normal scrolling pages — override both here, same pattern as march-map/battle-map. */
.mud-main-content:has(.barony-scope--audience-hall) {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
}

.barony-scope--audience-hall {
    box-sizing: border-box;
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.barony-scope h1,
.barony-scope h2,
.barony-scope h3,
.barony-scope .barony-title {
    font-family: 'Eagle Lake', serif;
    color: var(--barony-ink);
    letter-spacing: 0.3px;
}

.barony-scope .barony-page-title {
    font-size: 1.6rem;
    margin: 4px 0 16px 0;
    border-bottom: 2px solid var(--barony-border-strong);
    padding-bottom: 8px;
}

.barony-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 16px 0;
    border-bottom: 2px solid var(--barony-border-strong);
    padding-bottom: 8px;
}

.barony-page-header .barony-page-title {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.barony-page-header__lead {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
}

.barony-page-header__title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.barony-page-header__help-btn.mud-icon-button {
    color: var(--barony-muted);
    padding: 4px;
}

.barony-page-header__help-btn.mud-icon-button:hover {
    color: var(--barony-accent);
    background: var(--barony-accent-soft);
}

.barony-help-dialog__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.barony-help-dialog__short {
    margin: 0 0 12px 0;
    color: var(--barony-ink);
    line-height: 1.5;
}

.barony-help-dialog__details.mud-expansion-panels {
    background: transparent;
}

.barony-help-dialog__list {
    margin: 0;
    padding-left: 18px;
    line-height: 1.55;
}

.barony-help-dialog__list li {
    margin-bottom: 4px;
}

.barony-help-dialog__para {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.barony-help-dialog__gm {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--barony-border-strong);
}

.barony-help-dialog__gm-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-accent);
    margin-bottom: 8px;
}

.march-map-legend-help {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2px;
}

.barony-page-header__trailing {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-left: auto;
}

.barony-page-header__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.barony-turn-ready-chip {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--barony-accent);
    padding: 2px 8px;
    border: 1px solid var(--barony-border-strong);
    border-radius: 4px;
    background: var(--barony-accent-soft);
}

.barony-turn-btn.mud-button-root {
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 600;
}

.barony-turn-btn--solid.mud-button-filled {
    background: var(--barony-accent) !important;
    color: var(--barony-surface) !important;
    box-shadow: none !important;
}

.barony-turn-btn--solid.mud-button-filled:hover:not(:disabled) {
    background: #866828 !important;
}

.barony-turn-btn--solid.mud-button-filled:disabled {
    background: color-mix(in srgb, var(--barony-accent) 45%, var(--barony-border)) !important;
    color: color-mix(in srgb, var(--barony-surface) 70%, transparent) !important;
}

.barony-turn-btn--ghost.mud-button-outlined {
    color: var(--barony-ink) !important;
    border-color: var(--barony-border-strong) !important;
    background: var(--barony-surface) !important;
}

.unit-generator__row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: flex-start;
    margin-top: 8px;
}

.unit-generator__row > * {
    flex: 1 1 200px;
    min-width: 180px;
}

/* Excel-like unit workshop: cost bar + selectors (left) + live card (right) */
.unit-gear-pay {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}

.unit-gear-pay__row {
    display: grid;
    grid-template-columns: 1.8rem minmax(0, 1fr) auto;
    gap: 2px 6px;
    align-items: center;
    padding: 2px 6px;
    background: var(--barony-surface);
    border: 1px solid var(--barony-border);
    border-radius: 3px;
    font-size: 0.68rem;
}

.unit-gear-pay__row--craft {
    border-color: color-mix(in srgb, var(--barony-border) 80%, var(--barony-ink));
}

.unit-gear-pay__row--buy {
    border-color: color-mix(in srgb, #c9a227 50%, var(--barony-border));
    background: color-mix(in srgb, #c9a227 10%, var(--barony-surface));
}

.unit-gear-pay__row--defense {
    border-color: color-mix(in srgb, var(--barony-accent) 45%, var(--barony-border));
    background: color-mix(in srgb, var(--barony-accent) 8%, var(--barony-surface));
}

.unit-gear-pay__slot {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--barony-muted);
}

.unit-gear-pay__name {
    font-weight: 600;
    color: var(--barony-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.68rem;
}

.unit-gear-pay__modes {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 0;
    margin: 0 !important;
    justify-self: end;
}

.unit-gear-pay__modes .mud-radio {
    margin: 0 !important;
}

.unit-gear-pay__mode {
    margin: 0 !important;
}

.unit-gear-pay__mode .mud-button-root,
.unit-gear-pay__mode .mud-radio-content {
    padding: 0 2px !important;
}

.unit-gear-pay__cost {
    display: none; /* keep panel tight; full cost is in Total cost bar */
}

.unit-gear-pay__cost--empty {
    display: none;
}

.unit-gear-pay__check {
    margin: 0 !important;
    justify-self: end;
}

.unit-gear-pay__check .mud-button-root,
.unit-gear-pay__check .mud-checkbox {
    padding: 0 !important;
}

.unit-gear-pay__check .mud-typography {
    font-size: 0.62rem !important;
}

.unit-workshop {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.unit-equip-catalog {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.unit-equip-catalog__intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.unit-equip-catalog__split {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch;
    gap: 10px;
    width: 100%;
}

.unit-equip-catalog__split > .unit-equip-tile {
    flex: 1 1 0 !important;
    width: 0; /* equal halves; table scrolls inside */
    min-width: 0 !important;
    max-width: none;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .unit-equip-catalog__split {
        flex-direction: column !important;
    }

    .unit-equip-catalog__split > .unit-equip-tile {
        flex: 1 1 auto !important;
        width: 100%;
    }
}

.unit-equip-tile {
    padding: 6px 8px 8px;
    background: var(--barony-surface-2);
    border: 1px solid var(--barony-border);
    border-radius: 4px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.unit-equip-tile__title {
    margin-bottom: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--barony-ink);
}

.unit-equip-tile__scroll {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.unit-equip-table {
    width: max-content;
    font-size: 0.62rem;
    border-collapse: collapse;
}

.unit-equip-table th,
.unit-equip-table td {
    white-space: nowrap;
    padding: 2px 3px !important;
    text-align: right;
    line-height: 1.2;
}

.unit-equip-table th.ppb-row-label,
.unit-equip-table td.ppb-row-label {
    text-align: left;
    min-width: 0 !important;
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    position: static;
}

.unit-equip-table th:nth-child(4),
.unit-equip-table td:nth-child(4) {
    text-align: left;
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unit-equip-table__pick {
    width: 1.25rem;
    text-align: center !important;
    padding-left: 1px !important;
    padding-right: 1px !important;
}

.unit-equip-table__th {
    cursor: help;
    border-bottom: 1px dotted color-mix(in srgb, var(--barony-muted) 50%, transparent);
}

.unit-equip-table__group td,
.unit-equip-table__subgroup td {
    text-align: left !important;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-muted);
    background: color-mix(in srgb, var(--barony-surface) 70%, var(--barony-border));
    padding-top: 5px !important;
}

.unit-equip-table__subgroup td {
    font-weight: 600;
    letter-spacing: 0.02em;
    background: color-mix(in srgb, var(--barony-surface) 88%, var(--barony-border));
    padding-top: 3px !important;
}

.unit-equip-table__row--active td {
    background: color-mix(in srgb, var(--barony-accent) 14%, var(--barony-surface)) !important;
}

.unit-equip-table__row--locked td {
    opacity: 0.55;
}

.unit-equip-table__req--fail {
    color: var(--mud-palette-error, #c62828);
    font-weight: 600;
}

.unit-equip-pick {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--barony-muted);
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1;
    padding: 1px 2px;
}

.unit-equip-pick:disabled {
    cursor: default;
    opacity: 0.5;
}

.unit-equip-pick--on {
    color: var(--barony-accent);
    font-weight: 700;
}

.unit-equip-pick:hover:not(:disabled) {
    color: var(--barony-ink);
}

.unit-workshop__costs {
    padding: 7px 8px 8px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--barony-accent) 8%, var(--barony-surface-2)), var(--barony-surface-2));
    border: 1px solid var(--barony-border-strong);
    border-radius: 4px;
}

.unit-workshop__costs-title {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--barony-muted);
    margin-bottom: 5px;
}

.unit-workshop__cost-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}

.unit-workshop__cost-grid > .barony-tip-anchor {
    display: block;
    min-width: 0;
}

.unit-workshop__cost {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 0;
    height: 100%;
    padding: 4px 5px;
    background: var(--barony-surface);
    border: 1px solid var(--barony-border);
    border-radius: 3px;
}

.unit-workshop__cost-label {
    font-size: 0.58rem;
    font-weight: 600;
    color: var(--barony-muted);
    text-transform: none;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.unit-workshop__cost-label--res {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    text-transform: none;
    letter-spacing: 0;
    min-height: 0.85rem;
}

.unit-workshop__cost-label-suffix {
    font-size: 0.54rem;
    font-weight: 600;
    color: var(--barony-muted);
    text-transform: lowercase;
    letter-spacing: 0.02em;
}

.unit-workshop__cost-value {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--barony-ink);
    line-height: 1.1;
}

.unit-workshop__cost-value .barony-res-icon {
    opacity: 0.95;
}

.unit-workshop__cost-value--production { color: #e07a8a; }
.unit-workshop__cost-value--gold { color: #c9a83a; }
.unit-workshop__cost-value--defense { color: #7a818c; }

.unit-workshop__cost-sub {
    font-size: 0.55rem;
    color: var(--barony-muted);
    line-height: 1.2;
}

/* Compact HUD resource icons (Production / Gold / Defense …) */
.barony-res-icon {
    display: inline-block;
    flex-shrink: 0;
    vertical-align: middle;
    background-color: var(--resource-color, #888);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.4));
}

.barony-res-icon--xs {
    width: 0.78rem;
    height: 0.78rem;
}

.barony-res-icon--sm {
    width: 0.95rem;
    height: 0.95rem;
}

.barony-res-icon--md {
    width: 1.15rem;
    height: 1.15rem;
}

.unit-workshop__th-res,
.unit-equip-table__th-res {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}


.unit-workshop__howto {
    display: block;
    margin-top: 6px;
    color: var(--barony-muted);
    font-size: 0.68rem !important;
    line-height: 1.3;
}

.unit-workshop__body {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 12px;
    align-items: start;
}

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

    .unit-workshop__right {
        position: static;
    }
}

.unit-workshop__left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.unit-workshop__identity {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.unit-workshop__name-field {
    flex: 1 1 auto;
    min-width: 0;
}

.unit-workshop__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    margin-top: 4px;
    padding: 0;
    border: 1px solid var(--barony-border);
    border-radius: 4px;
    background: var(--barony-surface);
    cursor: pointer;
}

.unit-workshop__icon-btn:hover:not(:disabled) {
    background: var(--barony-accent-soft);
    border-color: var(--barony-border-strong);
}

.unit-workshop__icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.unit-workshop__icon-btn img {
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
}

.unit-draft-card__unit-icon {
    display: block;
    width: 1.3rem;
    height: 1.3rem;
    object-fit: contain;
    flex: 0 0 auto;
}

.unit-workshop__pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 8px;
    align-items: start;
}

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

.unit-workshop__right {
    position: sticky;
    top: 12px;
    min-width: 0;
}

.unit-workshop__block {
    padding: 10px 12px 12px;
    background: var(--barony-surface-2);
    border: 1px solid var(--barony-border);
    border-radius: 4px;
}

.unit-workshop__block--compact {
    padding: 6px 8px 8px;
}

.unit-workshop__heading {
    margin: 0 0 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-ink);
}

.unit-workshop__table {
    width: 100%;
}

.unit-workshop__table--compact {
    font-size: 0.68rem !important;
}

.unit-workshop__table--compact th,
.unit-workshop__table--compact td {
    padding: 2px 4px !important;
}

.unit-workshop__table--compact th.ppb-row-label,
.unit-workshop__table--compact td.ppb-row-label {
    min-width: 0 !important;
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: static;
}

.unit-workshop__table--compact .mud-radio {
    margin: 0 !important;
}

.unit-workshop__table--compact .mud-button-root {
    padding: 0 !important;
}

.unit-workshop__table tbody tr {
    cursor: pointer;
}

.unit-workshop__table tbody tr:hover td {
    background: color-mix(in srgb, var(--barony-accent) 10%, transparent);
}

.unit-workshop__row--active td {
    background: color-mix(in srgb, var(--barony-accent) 16%, var(--barony-surface)) !important;
}

.unit-workshop__notes-cell {
    font-size: 0.75rem;
    color: var(--barony-muted);
    max-width: 180px;
}

.unit-workshop__note {
    display: block;
    margin-top: 8px;
    color: var(--barony-muted);
}

.unit-workshop__note--tight {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 0.68rem;
}

.unit-workshop__accel {
    margin-top: 6px;
    max-width: 12.5rem;
}

.unit-workshop__race-picks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

@media (max-width: 640px) {
    .unit-workshop__race-picks {
        grid-template-columns: 1fr;
    }
}

.unit-workshop__accel-field {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.unit-workshop__accel-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 0.55rem; /* align with outlined field input, below label */
}

.unit-workshop__accel-field .mud-input-control {
    flex: 1;
    min-width: 0;
}

.unit-workshop__gear-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.unit-workshop__gear-head .unit-workshop__heading {
    margin: 0;
}

.unit-workshop__quality {
    max-width: 8.5rem;
    flex: 0 0 auto;
}

.unit-draft-card {
    padding: 12px 14px 14px;
    background:
        linear-gradient(165deg, color-mix(in srgb, var(--barony-surface) 88%, #c9b896), var(--barony-surface));
    border: 1px solid var(--barony-border-strong);
    border-radius: 4px;
    box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 35%, transparent);
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
}

.unit-draft-card--broken {
    opacity: 0.52;
    filter: grayscale(0.8);
}

.unit-draft-card--collapsed {
    height: auto;
    padding-bottom: 10px;
}

.unit-draft-card--collapsed .unit-draft-card__title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.unit-draft-card__title--toggle {
    cursor: pointer;
    user-select: none;
}

.unit-draft-card__title--toggle:hover {
    color: var(--barony-ink);
}

.unit-roster {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.army-roster-summary {
    margin: 0 0 12px;
    padding: 8px 10px 10px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--barony-accent) 8%, var(--barony-surface-2)), var(--barony-surface-2));
    border: 1px solid var(--barony-border);
    border-radius: 4px;
}

.army-roster-summary__title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-muted);
    margin-bottom: 6px;
}

.army-roster-summary__grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px 8px;
}

@media (max-width: 900px) {
    .army-roster-summary__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.army-roster-summary__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.army-roster-summary__label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--barony-muted);
}

.army-roster-summary__value {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--barony-ink);
}

.army-roster-summary__value--gold {
    color: #b8922e;
}

.army-roster-summary__value--food {
    color: #3d7a45;
}

.army-roster-summary__value--defense {
    color: #7a818c;
}

.army-roster-summary__note {
    margin-top: 6px !important;
    color: var(--barony-muted) !important;
}

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

.unit-roster-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.unit-roster-card--dirty .unit-draft-card {
    border-color: color-mix(in srgb, var(--barony-accent) 55%, var(--barony-border-strong));
}

.unit-roster-card__banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    margin-bottom: 6px;
    padding: 6px 8px;
    font-size: 0.72rem;
    color: var(--barony-ink);
    background: color-mix(in srgb, var(--barony-accent) 10%, var(--barony-surface-2));
    border: 1px solid color-mix(in srgb, var(--barony-accent) 35%, var(--barony-border));
    border-radius: 4px;
}

.unit-roster-card .unit-xp-bar {
    margin-bottom: 6px;
}

.unit-draft-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.unit-draft-card__def-skill {
    max-width: 220px;
    flex: 1 1 160px;
}

.unit-draft-card__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--barony-border);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--barony-muted);
}

.unit-draft-card__title-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-width: 0;
}

.unit-draft-card__title-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.unit-draft-card__title-status {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: var(--barony-muted);
    white-space: nowrap;
}

.unit-draft-card__title-status a {
    color: var(--barony-ink);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.unit-draft-card__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    padding: 0;
    border: 1px solid var(--barony-border);
    border-radius: 4px;
    background: var(--barony-surface);
    cursor: pointer;
    color: var(--barony-ink);
}

.unit-draft-card__icon-btn:hover:not(:disabled) {
    background: var(--barony-accent-soft);
    border-color: var(--barony-border-strong);
}

.unit-draft-card__icon-btn--danger {
    color: #8b3a3a;
}

.unit-draft-card__icon-btn--danger:hover:not(:disabled) {
    background: color-mix(in srgb, #8b3a3a 12%, var(--barony-surface));
    border-color: #8b3a3a;
    color: #6e2e2e;
}

.unit-draft-card__icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.unit-draft-card__icon-btn-img {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
}

.unit-draft-card__title b {
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--barony-ink);
}

.unit-draft-card__name-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
    color: inherit;
    font: inherit;
}

.unit-draft-card__name-btn:hover b {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.unit-draft-card__captain {
    font-size: 0.88rem;
    font-weight: 600;
    color: #7a6020;
    white-space: nowrap;
}

.unit-draft-card__captain-tip {
    min-width: 0;
}

.unit-draft-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-bottom: 12px;
    font-size: 0.8rem;
}

.unit-draft-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.unit-draft-card__meta em {
    font-style: normal;
    color: var(--barony-muted);
}

.unit-draft-card__meta b {
    font-variant-numeric: tabular-nums;
}

.unit-draft-card__meta-val {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-variant-numeric: tabular-nums;
}

.unit-draft-card__meta-val--gold { color: #c9a83a; }
.unit-draft-card__meta-val--food { color: #6bcf75; }
.unit-draft-card__meta-val--defense { color: #7a818c; }
.unit-draft-card__meta-val--loss { color: #b54a3c; }

.unit-draft-card__meta-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0 2px;
    margin: 0;
    font: inherit;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    border-radius: 2px;
    font-variant-numeric: tabular-nums;
}

.unit-draft-card__meta-btn:hover {
    background: color-mix(in srgb, var(--barony-accent) 14%, transparent);
}

.unit-draft-card__meta-btn--loss {
    color: #b54a3c;
}

.unit-draft-card__meta-val .barony-res-icon {
    opacity: 0.95;
}

.unit-draft-card__combat {
    margin-bottom: 8px;
}

.unit-combat-break {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: stretch;
    width: 100%;
    overflow-x: auto;
}

.unit-combat-break__block {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Grow with cell count (set via --combat-cols on each block). */
    flex: var(--combat-cols, 4) 1 0;
    min-width: calc(var(--combat-cols, 4) * 1.05rem);
    padding: 4px 4px 5px;
    background: color-mix(in srgb, var(--barony-surface-2) 70%, #d8c9a8);
    border: 1px solid var(--barony-border);
    border-radius: 3px;
}

/* Title sits full-width above the columns (Excel ATAK / OBRONA header). */
.unit-combat-break__block > .barony-tip-anchor {
    display: block;
    width: 100%;
}

.unit-combat-break__title {
    display: block;
    width: 100%;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-ink);
    text-align: center;
    line-height: 1.15;
    margin: 0 0 3px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--barony-border);
    cursor: default;
    white-space: nowrap;
}

.unit-combat-break__cols {
    display: flex;
    flex-wrap: nowrap;
    gap: 1px;
    justify-content: center;
    width: 100%;
}

.unit-combat-break__cols > .barony-tip-anchor {
    display: block;
    flex: 1 1 0;
    min-width: 0;
}

.unit-combat-break__col {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 1px 2px;
    text-align: center;
    cursor: default;
}

.unit-combat-break__col--zero .unit-combat-break__val {
    color: color-mix(in srgb, var(--barony-muted) 70%, transparent);
}

.unit-combat-break__col--loss .unit-combat-break__val {
    color: #b54a3c;
}

.unit-combat-break__col--tot {
    background: color-mix(in srgb, var(--barony-accent) 14%, transparent);
    border-radius: 2px;
}

.unit-combat-break__lab {
    font-size: 0.48rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--barony-muted);
    line-height: 1.05;
    white-space: nowrap;
}

.unit-combat-break__val {
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--barony-ink);
    line-height: 1.15;
}

.unit-combat-break__col--btn {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
    border-radius: 2px;
}

.unit-combat-break__col--btn:hover {
    background: color-mix(in srgb, var(--barony-accent) 18%, transparent);
}

.unit-combat-break__col--btn:focus-visible {
    outline: 1px solid var(--barony-accent);
    outline-offset: 1px;
}

.unit-card__combat-break {
    max-width: 100%;
}

.unit-draft-stat {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 2px;
    background: color-mix(in srgb, var(--barony-surface-2) 70%, #d8c9a8);
    border: 1px solid var(--barony-border);
    border-radius: 3px;
    text-align: center;
}

.unit-draft-stat__label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-muted);
    line-height: 1;
}

.unit-draft-stat__value {
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--barony-ink);
    line-height: 1.1;
}

.unit-draft-card__section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--barony-border);
}

.unit-draft-card__section--tight {
    margin-top: 6px;
    padding-top: 6px;
}

.unit-draft-card__section-title {
    margin-bottom: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--barony-muted);
}

.unit-draft-card__section-hint {
    margin-left: 8px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    font-size: 0.65rem;
    color: color-mix(in srgb, var(--barony-muted) 80%, transparent);
}

.unit-draft-skills__legend {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26px 32px 32px 32px 36px;
    gap: 2px 4px;
    margin-bottom: 4px;
    padding: 0 5px;
}

.unit-draft-skills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    align-items: start;
}

.unit-draft-skills__col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.unit-draft-skills__solo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
}

.unit-draft-skill-tile {
    padding: 4px 5px 3px;
    background: var(--barony-surface);
    border: 1px solid var(--barony-border);
    border-radius: 3px;
    min-width: 0;
}

.unit-draft-skill-tile--hot {
    border-color: color-mix(in srgb, var(--barony-accent) 55%, var(--barony-border));
    background: color-mix(in srgb, var(--barony-accent) 8%, var(--barony-surface));
}

.unit-draft-skill-tile--solo {
    padding: 4px 6px;
}

.unit-draft-skill-tile__cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 26px 32px 32px 32px 36px;
    gap: 2px 4px;
    align-items: center;
}

.unit-draft-skill-tile__cols--legend {
    margin-bottom: 2px;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--barony-muted);
    text-align: right;
}

.unit-draft-skill-tile__cols--legend span:first-child {
    text-align: left;
}

.unit-draft-skill-tile__cols > *:not(:first-child) {
    justify-self: stretch;
    text-align: right;
}

.unit-draft-skill-tile__cols--head {
    padding-bottom: 2px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--barony-border);
}

.unit-draft-skill-tile__name {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--barony-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unit-draft-skill-tile__name-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.unit-draft-skill-tile__name-row .unit-draft-skill-tile__name,
.unit-draft-skill-tile__name-row .unit-draft-skill-tile__child {
    min-width: 0;
}

.unit-xp-plus {
    appearance: none;
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    margin: 0;
    border: 1px solid var(--barony-border-strong);
    border-radius: 2px;
    background: var(--barony-surface);
    color: var(--barony-ink);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.unit-xp-plus:hover {
    border-color: var(--barony-accent);
    background: color-mix(in srgb, var(--barony-accent) 12%, var(--barony-surface));
}

.unit-xp-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--barony-accent) 10%, var(--barony-surface-2));
    border: 1px solid color-mix(in srgb, var(--barony-accent) 40%, var(--barony-border));
    border-radius: 4px;
}

.unit-xp-bar__text {
    font-size: 0.78rem;
    color: var(--barony-ink);
}

.unit-xp-bar__actions {
    display: inline-flex;
    gap: 6px;
}

.baron-php-chip--accent {
    color: var(--barony-accent, #8b6914);
    font-weight: 700;
}

.unit-draft-skill-tile__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.unit-draft-skill-tile__list li {
    padding: 1px 0;
}

.unit-draft-skill-tile__list li:hover {
    background: color-mix(in srgb, var(--barony-accent) 6%, transparent);
}

.unit-draft-skill-tile__row--hot .unit-draft-skill-tile__child,
.unit-draft-skill-tile__row--hot .unit-draft-skill-tile__total {
    color: color-mix(in srgb, var(--barony-accent) 70%, var(--barony-ink));
    font-weight: 600;
}

.unit-draft-skill-tile__child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 4px;
    font-size: 0.68rem;
    color: var(--barony-ink);
}

.unit-draft-skill-tile__col {
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--barony-ink);
}

.unit-draft-skill-tile__col--muted {
    color: var(--barony-muted);
}

.unit-draft-skill-tile__col--btn {
    appearance: none;
    border: 1px solid transparent;
    background: color-mix(in srgb, var(--barony-accent) 10%, var(--barony-surface-2));
    border-radius: 2px;
    padding: 1px 3px;
    cursor: pointer;
    font: inherit;
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: right;
    color: var(--barony-ink);
    line-height: 1.2;
}

.unit-draft-skill-tile__col--btn:hover {
    border-color: var(--barony-accent);
    color: var(--barony-accent);
}

.unit-draft-skill-tile__total {
    font-size: 0.72rem;
    font-weight: 700;
}

.unit-skill-edit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;
    background: var(--barony-surface-2);
    border: 1px solid var(--barony-border-strong);
    border-radius: 3px;
}

.unit-skill-edit__label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--barony-ink);
}

.unit-skill-edit__field {
    max-width: 100px;
}

.unit-card__attrs--compact {
    gap: 6px 10px;
}

.unit-card__attrs--compact .unit-card__attr {
    padding: 2px 6px;
    font-size: 0.78rem;
    gap: 5px;
}

.unit-card__attr-note {
    color: var(--barony-muted);
    font-size: 0.7rem;
}

.unit-draft-equip {
    width: 100%;
}

.unit-draft-equip--cols {
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.unit-draft-equip--cols th,
.unit-draft-equip--cols td {
    width: 25%;
    padding: 3px 6px;
    vertical-align: top;
    border: 1px solid var(--barony-border);
    text-align: left;
    word-break: break-word;
}

.unit-draft-equip--cols thead th {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-muted);
    background: var(--barony-surface-2);
}

.unit-draft-equip__names td {
    font-weight: 600;
    color: var(--barony-ink);
    line-height: 1.25;
}

.unit-draft-equip__qual {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--barony-accent);
}

.unit-draft-equip__stats td {
    font-size: 0.68rem;
    color: var(--barony-muted);
    line-height: 1.3;
}

.unit-card__attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
}

.unit-card__attr {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--barony-surface-2);
    border: 1px solid var(--barony-border);
    border-radius: 4px;
}

.unit-card__attr-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.unit-card__attr-val {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.unit-card__attr-val--btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0 2px;
    margin: 0;
    font: inherit;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
    border-radius: 2px;
}

.unit-card__attr-val--btn:hover {
    background: color-mix(in srgb, var(--barony-accent) 14%, transparent);
}

.unit-card__attr-val--mod {
    color: var(--barony-accent, #8b6914);
}

.unit-card__training-alert {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
}


.offices-cost-total {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 12px;
    background: var(--barony-surface-2);
    border: 1px solid var(--barony-border-strong);
    border-radius: 4px;
    font-size: 0.85rem;
}

.offices-cost-total__label {
    color: var(--barony-muted);
    font-weight: 600;
}

.offices-cost-total__value {
    color: var(--barony-neg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.offices-cost-total__value::after {
    content: " gold / turn";
    color: var(--barony-muted);
    font-weight: 500;
    font-size: 0.78rem;
}

/* ---- Domain Panel meta bar (calendar + status; stocks live in HUD) ---- */
.barony-meta-bar {
    position: fixed;
    top: 70px;
    left: 12px;
    z-index: 1050; /* below MudAppBar / MudMenu popovers (login & character selector) */
    display: inline-flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 2px;
    width: max-content;
    max-width: calc(100vw - min(540px, 48vw) - 24px);
    padding: 4px 6px;
    border-radius: 10px;
    overflow: visible;
    background: linear-gradient(180deg, rgba(36, 30, 24, 0.94), rgba(22, 18, 14, 0.96));
    border: 1px solid rgba(212, 180, 100, 0.28);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.barony-meta-bar__name {
    font-family: 'Eagle Lake', serif;
    font-size: 1rem;
    font-weight: 400;
    color: #f7f1e4;
    padding: 0.2rem 0.5rem 0.2rem 0.3rem;
    margin-right: 0.05rem;
    border-right: 1px solid rgba(212, 180, 100, 0.28);
    white-space: nowrap;
    line-height: 1.15;
    align-self: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

button.barony-meta-bar__name--switch {
    display: block;
    margin: 0;
    border: none;
    border-right: 1px solid rgba(212, 180, 100, 0.28);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-family: 'Eagle Lake', serif;
    font-size: 1rem;
    font-weight: 400;
    color: #f7f1e4;
    padding: 0.2rem 0.5rem 0.2rem 0.3rem;
    margin-right: 0.05rem;
    white-space: nowrap;
    line-height: 1.15;
    align-self: center;
    text-align: left;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

button.barony-meta-bar__name--switch:hover {
    color: #fff8ea;
}

button.barony-meta-bar__name--switch:focus-visible {
    outline: 2px solid rgba(212, 180, 100, 0.65);
    outline-offset: 2px;
}

.barony-meta-bar__stats {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 2px;
}

.barony-meta-bar__stat {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.06rem;
    line-height: 1.1;
    min-width: 0;
    padding: 0.2rem 0.32rem 0.22rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
}

.barony-meta-bar__stat--centered {
    align-items: center;
    text-align: center;
    min-width: 2.4rem;
}

button.barony-meta-bar__stat--clickable {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
    font-family: inherit;
}

button.barony-meta-bar__stat--clickable:hover {
    background: rgba(255, 255, 255, 0.08);
}

button.barony-meta-bar__stat--clickable:focus-visible {
    outline: 1px solid rgba(247, 241, 228, 0.45);
    outline-offset: 1px;
}

.barony-meta-bar__label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(247, 241, 228, 0.55);
    width: 100%;
}

.barony-meta-bar__stat--centered .barony-meta-bar__label {
    text-align: center;
}

.barony-meta-bar__value {
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #f7f1e4;
    white-space: nowrap;
    line-height: 1.15;
    padding: 3px 0;
}

.barony-meta-bar__stat--centered .barony-meta-bar__value {
    width: 100%;
    text-align: center;
}

.barony-meta-bar__value--pos { color: #8fd48a; }
.barony-meta-bar__value--neg { color: #e08a78; }

/* CSS hover tooltips for fixed HUD chrome (uses barony-tip__box styling). */
.barony-hud-tip {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.barony-hud-tip__popup {
    position: absolute;
    top: calc(100% + 6px);
    z-index: 1060; /* above HUD chips, still below MudMenu popovers */
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease, visibility 0.12s ease;
    width: max-content;
    max-width: min(22rem, calc(100vw - 2rem));
}

.barony-hud-tip__popup .barony-tip__box {
    display: block;
}

.barony-hud-tip__popup .barony-tip__title,
.barony-hud-tip__popup .barony-tip__body {
    display: block;
}

/* Hover, or keyboard focus — not mouse-click :focus-within (keeps tip stuck over dialogs). */
.barony-hud-tip:hover .barony-hud-tip__popup,
.barony-hud-tip:has(:focus-visible) .barony-hud-tip__popup {
    visibility: visible;
    opacity: 1;
}

/* Hide on pointerdown until leave — avoids stuck :hover when a dialog opens. */
.barony-hud-tip--suppressed .barony-hud-tip__popup {
    visibility: hidden !important;
    opacity: 0 !important;
}

.barony-hud-tip--center .barony-hud-tip__popup {
    left: 50%;
    transform: translateX(-50%);
}

.barony-hud-tip--start .barony-hud-tip__popup {
    left: 0;
    transform: none;
}

.barony-hud-tip--end .barony-hud-tip__popup {
    left: auto;
    right: 0;
    transform: none;
}

.barony-meta-bar > .barony-hud-tip {
    align-self: center;
}

.barony-meta-bar__stats > .barony-hud-tip {
    align-items: flex-start;
}

.barony-meta-bar__stats > .barony-hud-tip:has(.barony-meta-bar__stat--centered) {
    align-items: center;
}

.barony-resource-hud > .barony-hud-tip {
    flex: 0 0 auto;
    align-items: stretch;
}

.barony-resource-hud .barony-hud-tip > .barony-resource-hud__item {
    flex: 1 1 auto;
}


.barony-scope--domain-panel .barony-page-header {
    margin-top: 58px;
}

@media (max-width: 720px) {
    .barony-meta-bar {
        position: static;
        max-width: none;
        margin-bottom: 0.75rem;
    }

    .barony-scope--domain-panel .barony-page-header {
        margin-top: 0;
    }
}

/* ---- Global cumulative resource HUD (game-style, top-right) ---- */
.barony-resource-hud {
    --res-food: #6bcf75;
    --res-economy: #a67c52;
    --res-production: #e07a8a;
    --res-loyalty: #d63b3b;
    --res-stability: #4f9a5a;
    --res-law: #000000;
    --res-corruption: #6a7a32;
    --res-science: #6aa8f0;
    --res-magic: #b07aef;
    --res-culture: #f0a45a;
    --res-intelligence: #c4b8d8;
    --res-defense: #a8b0bc;
    --res-gold: #f0d060;
    position: fixed;
    top: 70px;
    right: 12px;
    z-index: 1051; /* below MudAppBar / MudMenu popovers (login & character selector) */
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: stretch;
    gap: 2px;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 4px 6px;
    border-radius: 10px;
    overflow: visible;
    background: linear-gradient(180deg, rgba(36, 30, 24, 0.94), rgba(22, 18, 14, 0.96));
    border: 1px solid rgba(212, 180, 100, 0.28);
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* display:contents on desktop = a transparent pass-through, items lay out directly in the
   flex row above exactly as before; mobile turns this into a real collapsible dropdown. */
.barony-resource-hud__list {
    display: contents;
}

.barony-resource-hud__toggle {
    display: none;
}

.barony-page-header__sections-switch {
    flex: 0 1 auto;
    max-width: min(16rem, 100%);
}

.barony-resource-hud__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.1rem;
    flex: 0 0 auto;
    min-width: 2.75rem;
    width: max-content;
    padding: 0.25rem 0.35rem 0.28rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 2px solid var(--res-accent, rgba(212, 180, 100, 0.45));
}

.barony-resource-hud__main {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    min-height: 1.25rem;
}

.barony-resource-hud__stock {
    font-family: 'Eagle Lake', serif;
    font-size: 0.9rem;
    font-weight: 400;
    color: #f7f1e4;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    line-height: 1;
    position: relative;
    top: 0px; /* Eagle Lake sits optically low vs the mask icon */
    margin-bottom: -1px;
}

.barony-resource-hud__delta {
    font-size: 0.62rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    opacity: 0.78;
    line-height: 1;
    text-align: center;
    width: 100%;
    min-height: 0.85em;
    white-space: nowrap;
}

.barony-resource-hud__delta--pos { color: #8fd48a; }
.barony-resource-hud__delta--neg { color: #e08a78; }
.barony-resource-hud__delta--zero { color: rgba(247, 241, 228, 0.45); }

.barony-resource-hud__item--food { --res-accent: var(--res-food); }
.barony-resource-hud__item--economy { --res-accent: var(--res-economy); }
.barony-resource-hud__item--production { --res-accent: var(--res-production); }
.barony-resource-hud__item--loyalty { --res-accent: var(--res-loyalty); }
.barony-resource-hud__item--stability { --res-accent: var(--res-stability); }
.barony-resource-hud__item--law { --res-accent: var(--res-law); }
.barony-resource-hud__item--corruption { --res-accent: var(--res-corruption); }
.barony-resource-hud__item--science { --res-accent: var(--res-science); }
.barony-resource-hud__item--magic { --res-accent: var(--res-magic); }
.barony-resource-hud__item--culture { --res-accent: var(--res-culture); }
.barony-resource-hud__item--intelligence { --res-accent: var(--res-intelligence); }
.barony-resource-hud__item--defense { --res-accent: var(--res-defense); }
.barony-resource-hud__item--gold { --res-accent: var(--res-gold); }

@media (max-width: 1279.98px) {
    /* Collapsed to a small round toggle; tapping it drops down a vertical resource list
       instead of the desktop's always-visible horizontal row. */
    .barony-resource-hud {
        top: auto;
        bottom: 72px;
        right: 8px;
        left: auto;
        width: auto;
        max-width: calc(100vw - 16px);
        flex-direction: column;
        align-items: flex-end;
        gap: 0;
        padding: 0;
        background: none;
        border: none;
        box-shadow: none;
        overflow: visible;
    }

    .barony-resource-hud__toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.6rem;
        height: 2.6rem;
        padding: 0;
        border-radius: 999px;
        background: linear-gradient(180deg, rgba(36, 30, 24, 0.94), rgba(22, 18, 14, 0.96));
        border: 1px solid rgba(212, 180, 100, 0.28);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
        cursor: pointer;
    }

    .barony-resource-hud__toggle img {
        width: 1.4rem;
        height: 1.4rem;
        object-fit: contain;
    }

    .barony-resource-hud__list {
        display: none;
        flex-direction: column;
        gap: 2px;
        margin-top: 6px;
        padding: 6px;
        border-radius: 10px;
        max-height: 55vh;
        overflow-y: auto;
        background: linear-gradient(180deg, rgba(36, 30, 24, 0.94), rgba(22, 18, 14, 0.96));
        border: 1px solid rgba(212, 180, 100, 0.28);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    }

    .barony-resource-hud--open .barony-resource-hud__list {
        display: flex;
    }

    .barony-resource-hud__item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.6rem;
        width: 100%;
        min-width: 0;
        border-bottom: none;
        border-left: 3px solid var(--res-accent, rgba(212, 180, 100, 0.45));
        padding: 0.3rem 0.5rem;
    }

    .barony-resource-hud__delta {
        width: auto;
        min-height: 0;
    }
}

.ppb-table--advisors,
.ppb-table--city-buildings {
    --barony-pre-ppb-width: 350px;
    --barony-pop-width: 48px;
    --barony-advisor-role-width: 160px;
    --barony-advisor-name-width: calc(var(--barony-pre-ppb-width) - var(--barony-advisor-role-width));
    --barony-pinned-label-width: calc(var(--barony-pre-ppb-width) - var(--barony-pop-width));
    --barony-ppb-subcol-width: 34px;
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.ppb-table--advisors col.advisor-col-role {
    width: var(--barony-advisor-role-width);
}

.ppb-table--advisors col.advisor-col-name {
    width: var(--barony-advisor-name-width);
}

.ppb-table--city-buildings col.city-building-col-name {
    width: var(--barony-pinned-label-width);
}

.ppb-table--city-buildings col.city-building-col-pop {
    width: var(--barony-pop-width);
}

.ppb-table--advisors col.ppb-pair-col,
.ppb-table--city-buildings col.ppb-pair-col,
.ppb-table--social-groups col.ppb-pair-col,
.ppb-table--terrain-improvements col.ppb-pair-col,
.ppb-table--decrees col.ppb-pair-col,
.ppb-table--events col.ppb-pair-col,
.ppb-table--community col.ppb-pair-col {
    width: var(--barony-ppb-subcol-width);
    max-width: var(--barony-ppb-subcol-width);
}

/*
 * Clamp PPB +/% values so large numbers (esp. Gold %) don't grow the table
 * and force a horizontal scrollbar on the section.
 * Exclude non-pair columns that also use polarity classes (Pop, Infl., Tax, …).
 */
.ppb-table td.ppb-cell-pos:not(.city-building-col-pop):not(.social-group-col-influence):not(.social-group-col-tax):not(.social-group-col-relation),
.ppb-table td.ppb-cell-neg:not(.city-building-col-pop):not(.social-group-col-influence):not(.social-group-col-tax):not(.social-group-col-relation),
.ppb-table td.ppb-cell-zero:not(.city-building-col-pop):not(.social-group-col-influence):not(.social-group-col-tax):not(.social-group-col-relation) {
    max-width: var(--barony-ppb-subcol-width, 34px);
    width: var(--barony-ppb-subcol-width, 34px);
    overflow: hidden;
    text-overflow: clip;
    box-sizing: border-box;
    padding-left: 2px;
    padding-right: 2px;
}

.ppb-table td.ppb-cell-pos:not(.city-building-col-pop):not(.social-group-col-influence):not(.social-group-col-tax):not(.social-group-col-relation) > *,
.ppb-table td.ppb-cell-neg:not(.city-building-col-pop):not(.social-group-col-influence):not(.social-group-col-tax):not(.social-group-col-relation) > *,
.ppb-table td.ppb-cell-zero:not(.city-building-col-pop):not(.social-group-col-influence):not(.social-group-col-tax):not(.social-group-col-relation) > * {
    display: block;
    overflow: hidden;
    text-overflow: clip;
    max-width: 100%;
}

.ppb-table--advisors .advisor-col-role {
    min-width: var(--barony-advisor-role-width);
    width: var(--barony-advisor-role-width);
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--barony-surface);
    box-sizing: border-box;
}

.ppb-table--advisors .advisor-col-name {
    min-width: var(--barony-advisor-name-width);
    width: var(--barony-advisor-name-width);
    text-align: left;
    font-weight: 600;
    color: var(--barony-ink);
    position: sticky;
    left: var(--barony-advisor-role-width);
    z-index: 2;
    background: var(--barony-surface);
    box-sizing: border-box;
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
}

.ppb-table--advisors thead .advisor-col-role,
.ppb-table--advisors thead .advisor-col-name {
    z-index: 4;
}

.ppb-table--advisors th.ppb-row-label.advisor-col-role,
.ppb-table--advisors td.advisor-col-role {
    left: 0;
    min-width: var(--barony-advisor-role-width);
}

.ppb-table--advisors th.ppb-row-label.advisor-col-name,
.ppb-table--advisors td.advisor-col-name {
    left: var(--barony-advisor-role-width);
    min-width: var(--barony-advisor-name-width);
}

.ppb-table--advisors tbody tr:hover .advisor-col-role,
.ppb-table--advisors tbody tr:hover .advisor-col-name {
    background: var(--barony-accent-soft);
}

.ppb-table--advisors .ppb-subcol {
    font-size: 0.68rem;
    color: var(--barony-muted);
    font-weight: 700;
    padding: 2px 5px;
    min-width: var(--barony-ppb-subcol-width);
    width: var(--barony-ppb-subcol-width);
    max-width: var(--barony-ppb-subcol-width);
    box-sizing: border-box;
}

.ppb-table--advisors .ppb-subcol--add {
    background: rgba(79, 122, 77, 0.08);
}

.ppb-table--advisors .ppb-subcol--pct {
    background: rgba(156, 122, 51, 0.12);
}

.ppb-table--advisors .advisor-row--baron .advisor-col-role {
    color: var(--barony-accent);
    font-weight: 700;
}

.ppb-table--city-buildings .city-building-col-name {
    min-width: var(--barony-pinned-label-width);
    width: var(--barony-pinned-label-width);
    max-width: var(--barony-pinned-label-width);
    text-align: left;
    font-weight: 600;
    color: var(--barony-ink);
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--barony-surface);
    box-sizing: border-box;
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
}

.ppb-table--city-buildings th.ppb-row-label.city-building-col-name,
.ppb-table--city-buildings td.city-building-col-name {
    min-width: var(--barony-pinned-label-width);
    width: var(--barony-pinned-label-width);
    max-width: var(--barony-pinned-label-width);
    left: 0;
}

.ppb-table--city-buildings .city-building-col-pop {
    min-width: var(--barony-pop-width);
    width: var(--barony-pop-width);
    max-width: var(--barony-pop-width);
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    font-size: inherit;
    font-weight: 600;
    color: var(--barony-ink);
    box-sizing: border-box;
    padding-left: 2px;
    padding-right: 2px;
}

.ppb-table--city-buildings thead .city-building-col-name {
    z-index: 3;
}

.ppb-table--city-buildings thead .city-building-col-pop.ppb-subcol--add {
    background: rgba(79, 122, 77, 0.08);
}

.ppb-table--city-buildings .city-building-col-pop--editable {
    cursor: pointer;
}

.ppb-table--city-buildings .city-building-col-owner {
    min-width: 2rem;
    width: 2rem;
    padding-left: 2px;
    padding-right: 2px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    font-size: 0.7rem;
    cursor: default;
}

/* Name + Owner + Pop = 350px before PPB (Name/Owner sticky; Pop scrolls). */
.ppb-table--terrain-improvements {
    --terrain-imp-owner-width: 3rem;
    --terrain-imp-pop-width: var(--barony-pop-width);
    --terrain-imp-name-width: calc(var(--barony-pre-ppb-width) - var(--terrain-imp-owner-width) - var(--terrain-imp-pop-width));
}

.ppb-table--terrain-improvements col.city-building-col-name {
    width: var(--terrain-imp-name-width);
}

.ppb-table--terrain-improvements col.city-building-col-owner {
    width: var(--terrain-imp-owner-width);
}

.ppb-table--terrain-improvements col.city-building-col-pop {
    width: var(--terrain-imp-pop-width);
}

.ppb-table--terrain-improvements .city-building-col-name {
    min-width: var(--terrain-imp-name-width);
    width: var(--terrain-imp-name-width);
    max-width: var(--terrain-imp-name-width);
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--barony-surface);
    box-sizing: border-box;
}

.ppb-table--terrain-improvements th.ppb-row-label.city-building-col-name,
.ppb-table--terrain-improvements td.city-building-col-name {
    min-width: var(--terrain-imp-name-width);
    width: var(--terrain-imp-name-width);
    max-width: var(--terrain-imp-name-width);
    left: 0;
}

.ppb-table--terrain-improvements .city-building-col-owner {
    min-width: var(--terrain-imp-owner-width);
    width: var(--terrain-imp-owner-width);
    max-width: var(--terrain-imp-owner-width);
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    font-size: inherit;
    font-weight: 600;
    color: var(--barony-ink);
    box-sizing: border-box;
    position: sticky;
    left: var(--terrain-imp-name-width);
    z-index: 2;
    background: var(--barony-surface);
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
}

.ppb-table--terrain-improvements .city-building-col-pop {
    min-width: var(--terrain-imp-pop-width);
    width: var(--terrain-imp-pop-width);
    max-width: var(--terrain-imp-pop-width);
}

.ppb-table--terrain-improvements thead .city-building-col-name,
.ppb-table--terrain-improvements thead .city-building-col-owner {
    z-index: 4;
}

.ppb-table--terrain-improvements tbody tr:hover .city-building-col-name,
.ppb-table--terrain-improvements tbody tr:hover .city-building-col-owner {
    background: var(--barony-accent-soft);
}

/* Decrees: Name + Active = 350px before PPB (Active scrolls; Name sticky). */
.ppb-table--decrees {
    --decree-active-width: 3.25rem;
    --decree-name-width: calc(var(--barony-pre-ppb-width) - var(--decree-active-width));
}

.ppb-table--decrees col.city-building-col-name {
    width: var(--decree-name-width);
}

.ppb-table--decrees col.decree-col-active {
    width: var(--decree-active-width);
}

.ppb-table--decrees .city-building-col-name {
    min-width: var(--decree-name-width);
    width: var(--decree-name-width);
    max-width: var(--decree-name-width);
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
}

.ppb-table--decrees th.ppb-row-label.city-building-col-name,
.ppb-table--decrees td.city-building-col-name {
    min-width: var(--decree-name-width);
    width: var(--decree-name-width);
    max-width: var(--decree-name-width);
    left: 0;
}

.ppb-table--decrees .decree-col-active {
    min-width: var(--decree-active-width);
    width: var(--decree-active-width);
    max-width: var(--decree-active-width);
    text-align: center;
    vertical-align: middle;
    font-size: inherit;
    font-weight: 600;
    color: var(--barony-ink);
    white-space: nowrap;
    box-sizing: border-box;
}

.ppb-table--decrees thead .city-building-col-name {
    z-index: 3;
}

.ppb-table--decrees tbody tr:hover .city-building-col-name {
    background: var(--barony-accent-soft);
}

.ppb-table--decrees td.decree-col-active {
    padding-left: 2px;
    padding-right: 2px;
}

.ppb-table--decrees .decree-active-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 1.5rem;
}

.ppb-table--decrees .decree-active-checkbox {
    margin: 0;
    padding: 0;
}

.ppb-table--decrees .decree-active-checkbox .mud-checkbox-root,
.ppb-table--decrees .decree-active-checkbox.mud-checkbox {
    margin: 0;
    padding: 0;
}

.ppb-table--decrees .ppb-summary-row .city-building-col-name,
.ppb-table--decrees .ppb-summary-row td.decree-col-active {
    background: var(--barony-surface);
}

.ppb-table--decrees .ppb-summary-row td.decree-col-active--summary {
    border-bottom: 1px solid var(--barony-border);
}

.ppb-table--decrees .ppb-summary-row td.ppb-cell-zero {
    font-weight: 400;
}

.ppb-table--decrees .decree-row--inactive td {
    opacity: 0.42;
}

.ppb-table--decrees .decree-row--inactive .city-building-col-name {
    color: var(--barony-muted);
}

.ppb-table--decrees .decree-row--inactive .ppb-cell-struck {
    text-decoration: line-through;
}

/* Events: Name + Turns = 350px before PPB (Turns scrolls; Name sticky). */
.ppb-table--events {
    --event-turns-width: 5.5rem;
    --event-name-width: calc(var(--barony-pre-ppb-width) - var(--event-turns-width));
}

.ppb-table--events col.city-building-col-name {
    width: var(--event-name-width);
}

.ppb-table--events col.event-col-turns {
    width: var(--event-turns-width);
}

.ppb-table--events .city-building-col-name {
    min-width: var(--event-name-width);
    width: var(--event-name-width);
    max-width: var(--event-name-width);
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
}

.ppb-table--events th.ppb-row-label.city-building-col-name,
.ppb-table--events td.city-building-col-name {
    min-width: var(--event-name-width);
    width: var(--event-name-width);
    max-width: var(--event-name-width);
    left: 0;
}

.ppb-table--events .event-col-turns {
    min-width: var(--event-turns-width);
    width: var(--event-turns-width);
    max-width: var(--event-turns-width);
    text-align: center;
    vertical-align: middle;
    font-size: inherit;
    font-weight: 600;
    color: var(--barony-ink);
    white-space: nowrap;
    box-sizing: border-box;
}

.ppb-table--events thead .city-building-col-name {
    z-index: 3;
}

.ppb-table--events tbody tr:hover .city-building-col-name {
    background: var(--barony-accent-soft);
}

.ppb-table--events .event-row--inactive td {
    opacity: 0.42;
}

.ppb-table--events .event-row--inactive .city-building-col-name {
    color: var(--barony-muted);
}

.ppb-table--events .event-row--inactive .ppb-cell-struck {
    text-decoration: line-through;
}

/* Community: Source = 350px before PPB. */
.ppb-table--community {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.ppb-table--community col.community-col-source {
    width: var(--barony-pre-ppb-width);
}

.ppb-table--community th.ppb-row-label.community-col-source,
.ppb-table--community td.ppb-row-label.community-col-source {
    min-width: var(--barony-pre-ppb-width);
    width: var(--barony-pre-ppb-width);
    max-width: var(--barony-pre-ppb-width);
    left: 0;
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
    box-sizing: border-box;
}

.ppb-table--community thead .community-col-source {
    z-index: 3;
}

.ppb-table--community tbody tr:hover .community-col-source {
    background: var(--barony-accent-soft);
}

/* Barony Summary: one column per PPB (no +/% split). */
.ppb-table--summary {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.ppb-table--summary col.summary-col-component {
    width: var(--barony-pre-ppb-width);
}

.ppb-table--summary col.summary-col-ppb {
    width: 4.75rem;
}

.ppb-table--summary th:not(.summary-col-component),
.ppb-table--summary td:not(.summary-col-component) {
    min-width: 4.75rem;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
    box-sizing: border-box;
}

.ppb-table--summary th.ppb-row-label.summary-col-component,
.ppb-table--summary td.ppb-row-label.summary-col-component {
    min-width: var(--barony-pre-ppb-width);
    width: var(--barony-pre-ppb-width);
    max-width: var(--barony-pre-ppb-width);
    left: 0;
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
    box-sizing: border-box;
}

.ppb-table--summary thead .summary-col-component {
    z-index: 3;
}

.ppb-table--summary tbody tr:hover .summary-col-component {
    background: var(--barony-accent-soft);
}

/* Resources tab: Name sticky + 8 cumulative resource columns. */
.ppb-table--resources {
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.ppb-table--resources col.resource-col-name {
    width: var(--barony-pre-ppb-width);
}

.ppb-table--resources col.resource-col-ppb {
    width: 3.5rem;
}

.ppb-table--resources th.ppb-row-label.resource-col-name,
.ppb-table--resources td.ppb-row-label.resource-col-name {
    min-width: var(--barony-pre-ppb-width);
    width: var(--barony-pre-ppb-width);
    max-width: var(--barony-pre-ppb-width);
    left: 0;
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
    box-sizing: border-box;
}

.ppb-table--resources thead .resource-col-name {
    z-index: 3;
}

.ppb-table--resources tbody tr:hover .resource-col-name {
    background: var(--barony-accent-soft);
}

/* Projects tab — full-width card grid + per-project tables. */
.project-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

.project-card {
    scroll-margin-top: 5.5rem;
    background: var(--barony-surface);
    border: 1px solid var(--barony-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(47, 42, 36, 0.06);
    overflow: hidden;
}

.project-card--active {
    border-color: var(--barony-border-strong);
    box-shadow: 0 1px 4px rgba(47, 42, 36, 0.1);
}

.project-card--allocating {
    border-color: #c4a35a;
}

.project-card--inactive {
    opacity: 0.72;
}

.project-card__header {
    padding: 0.85rem 1rem 0.75rem;
    border-bottom: 1px solid var(--barony-border);
    background: linear-gradient(180deg, var(--barony-surface) 0%, var(--barony-surface-2, #f5f0e4) 100%);
}

.project-card__header[role="button"] {
    cursor: pointer;
    user-select: none;
}

.project-card--collapsed .project-card__header {
    border-bottom: none;
    padding-bottom: 0.85rem;
}

.project-card__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    cursor: pointer;
    user-select: none;
}

.project-card__title {
    margin: 0;
    font-family: 'Eagle Lake', serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--barony-ink);
    line-height: 1.25;
}

.project-card__description {
    margin: 0.45rem 0 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--barony-muted);
}

.project-card__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.project-card__status {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.12rem 0.35rem;
    border-radius: 3px;
    background: rgba(47, 42, 36, 0.06);
    color: var(--barony-muted);
}

.project-card__status--progress {
    background: rgba(156, 122, 51, 0.14);
    color: #7a6020;
}

.project-card__status--allocate {
    background: rgba(196, 163, 90, 0.2);
    color: #6e5520;
}

.project-card__status--done {
    background: rgba(61, 122, 69, 0.12);
    color: #3d7a45;
}

.project-card__status--cancelled {
    background: rgba(122, 46, 58, 0.1);
    color: #7a2e3a;
}

.project-card__turns {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--barony-muted);
}

.project-card__output-summary {
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--barony-muted);
}

.project-card__progress {
    position: relative;
    margin-top: 0.65rem;
    height: 0.45rem;
    border-radius: 999px;
    background: rgba(47, 42, 36, 0.08);
    overflow: hidden;
}

.project-card__progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b8922e, #d4b464);
    transition: width 0.2s ease;
}

.project-card__progress-label {
    display: block;
    margin-top: 0.28rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--barony-muted);
}

.project-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.project-card__panels {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
}

.project-card__panel {
    padding: 0.75rem 1rem 0.85rem;
    min-width: 0;
}

.project-card__panel--cost {
    flex: 0 0 auto;
    width: max-content;
    max-width: min(24rem, 34%);
    border-right: 1px solid var(--barony-border);
}

.project-card__panel--output {
    flex: 1 1 0;
    min-width: 0;
}

.project-card__panel-title {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7a6020;
}

.project-card__panel--cost .project-card__panel-title,
.project-card__panel--output .project-card__panel-title {
    color: #7a6020;
}

.project-card__panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.65rem;
    margin-bottom: 0.5rem;
}

.project-card__panel-head .project-card__panel-title {
    margin-bottom: 0;
}

.project-cost-mode-switch {
    display: inline-flex;
    border: 1px solid var(--barony-border);
    border-radius: 5px;
    overflow: hidden;
    background: rgba(47, 42, 36, 0.04);
}

.project-cost-mode-switch__btn {
    border: 0;
    background: transparent;
    color: var(--barony-muted);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
    line-height: 1.2;
}

.project-cost-mode-switch__btn + .project-cost-mode-switch__btn {
    border-left: 1px solid var(--barony-border);
}

.project-cost-mode-switch__btn--active {
    background: rgba(156, 122, 51, 0.16);
    color: #7a6020;
}

.project-cost-mode-switch__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.project-cost-mode-badge {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #7a6020;
    padding: 0.12rem 0.35rem;
    border-radius: 3px;
    background: rgba(156, 122, 51, 0.12);
}

.project-card__table-wrap {
    overflow-x: auto;
}

.project-card__panel--output .project-card__table-wrap {
    width: 100%;
}

.ppb-table--project-cost {
    --project-cost-name-width: 5.25rem;
    --project-cost-value-width: 4.75rem;
    table-layout: fixed;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    font-size: 0.82rem;
}

.ppb-table--project-cost col.resource-col-name {
    width: var(--project-cost-name-width);
}

.ppb-table--project-cost col.project-cost-col-value {
    width: var(--project-cost-value-width);
}

.ppb-table--project-cost th.ppb-row-label.resource-col-name,
.ppb-table--project-cost td.ppb-row-label.resource-col-name {
    min-width: var(--project-cost-name-width);
    width: var(--project-cost-name-width);
    max-width: var(--project-cost-name-width);
    position: static;
    left: auto;
    box-shadow: none;
}

.ppb-table--project-cost th,
.ppb-table--project-cost td {
    padding: 4px 6px;
}

.ppb-table--project-allocate {
    width: 100%;
    min-width: 0;
}

.ppb-table--project-output {
    width: max-content;
    min-width: 100%;
}

.ppb-table--project-output th,
.ppb-table--project-output td {
    text-align: center;
}

.project-allocate-dialog__input {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    white-space: nowrap;
}

.project-allocate-dialog__fill {
    min-width: 0;
    padding: 0 0.25rem;
    font-size: 0.72rem;
}

/* Projects — Summary: one wide row per project (cost | expected output). */
.projects-balance-table-wrap {
    overflow-x: auto;
}

.ppb-table--projects-balance {
    width: max-content;
    min-width: 100%;
}

.ppb-table--projects-balance col.projects-balance-col-name {
    width: 9rem;
}

.ppb-table--projects-balance col.projects-balance-col-ready {
    width: 2.75rem;
}

.ppb-table--projects-balance col.projects-balance-col-allocated {
    width: 10rem;
    min-width: 8rem;
}

.ppb-table--projects-balance th.projects-balance-col-name,
.ppb-table--projects-balance td.projects-balance-col-name {
    min-width: 9rem;
    width: 9rem;
    max-width: 12rem;
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--barony-surface);
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
    box-sizing: border-box;
    z-index: 2;
}

.ppb-table--projects-balance thead th.projects-balance-col-name {
    z-index: 4;
}

.ppb-table--projects-balance tbody tr:hover td.projects-balance-col-name {
    background: var(--barony-accent-soft);
}

.ppb-table--projects-balance .ppb-summary-row td.projects-balance-col-name {
    background: var(--barony-surface);
}

.ppb-table--projects-balance .ppb-summary-row td.projects-balance-col-allocated,
.ppb-table--projects-balance .ppb-summary-row td.projects-balance-col-allocated--summary-span {
    background: var(--barony-surface);
}

.ppb-table--projects-balance .ppb-summary-row td.projects-balance-col-allocated--summary-span {
    text-align: left;
    vertical-align: middle;
    padding: 0.3rem 0.5rem;
}

.ppb-table--projects-balance .projects-balance-split-start {
    border-left: 1px solid var(--barony-border-strong);
}

.ppb-table--projects-balance .projects-balance-zone-title {
    margin: 0;
    padding: 0.45rem 0.5rem 0.35rem;
    text-align: left;
    vertical-align: bottom;
    border-bottom: none;
    background: var(--barony-surface);
    font-weight: 700;
}

.ppb-table--projects-balance .projects-balance-subhead {
    font-weight: 600;
    background: var(--barony-surface);
}

.ppb-table--projects-balance .projects-balance-zone--cost,
.ppb-table--projects-balance .projects-balance-output-cell {
    text-align: center;
}

.ppb-table--projects-balance td.projects-balance-col-allocated {
    text-align: left;
    vertical-align: middle;
    padding: 0.3rem 0.5rem;
}

.ppb-table--projects-balance td.projects-balance-col-ready {
    vertical-align: middle;
    padding: 0.2rem 0.35rem;
}

.projects-balance-ready-cell {
    display: flex;
    justify-content: center;
    align-items: center;
}

.projects-balance-empty {
    color: var(--barony-muted);
}

.ppb-table--projects-balance thead th.projects-balance-output-head.ppb-subcol {
    font-size: 0.68rem;
    font-weight: 700;
}

.projects-balance-tr--active td.projects-balance-col-name {
    font-weight: 600;
}

.projects-balance-tr--inactive {
    opacity: 0.72;
}

.projects-balance-project-link {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.projects-balance-project-link:hover,
.projects-balance-project-link:focus {
    color: inherit;
    text-decoration: none;
    outline: none;
}

.project-output-badge {
    display: inline-block;
    max-width: 100%;
    padding: 0.12rem 0.28rem;
    border-radius: 3px;
    background: var(--barony-accent-soft);
    color: var(--barony-ink);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: normal;
    text-align: center;
}

.projects-summary {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    font-size: 0.82rem;
    color: var(--barony-muted);
}

.projects-summary__item--active {
    color: var(--barony-accent);
    font-weight: 600;
}

.project-edit-dialog .ppb-editor + .ppb-editor {
    margin-top: 0.75rem;
}

/* Current stocks — large colored readouts (not a table). */
.resource-stocks-hero {
    --res-food: #3d7a45;
    --res-production: #7a2e3a;
    --res-science: #2f5f9e;
    --res-magic: #6b3d9e;
    --res-culture: #c46a1a;
    --res-intelligence: #2a2622;
    --res-defense: #7a818c;
    --res-gold: #b8922e;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 0.35rem 0.4rem;
}

@media (max-width: 1100px) {
    .resource-stocks-hero {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .resource-stocks-hero {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.resource-stocks-hero > .mud-tooltip-root,
.resource-stocks-hero__tip {
    min-width: 0;
    display: block;
}

.resource-stocks-hero > .mud-tooltip-root {
    width: 100%;
}

.resource-stocks-hero__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.3rem 0.45rem 0.35rem;
    border-radius: 2px;
    background: var(--barony-surface);
    border: 1px solid var(--barony-border);
    border-left: 3px solid var(--res-accent, var(--barony-accent));
    min-width: 0;
}

.resource-stocks-hero__label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--res-accent, var(--barony-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.resource-stocks-hero__value {
    font-family: 'Eagle Lake', serif;
    font-size: 1.05rem;
    line-height: 1.15;
    font-weight: 400;
    color: var(--res-accent, var(--barony-ink));
    font-variant-numeric: tabular-nums;
}

.resource-stocks-hero__item--food { --res-accent: var(--res-food); }
.resource-stocks-hero__item--production { --res-accent: var(--res-production); }
.resource-stocks-hero__item--science { --res-accent: var(--res-science); }
.resource-stocks-hero__item--magic { --res-accent: var(--res-magic); }
.resource-stocks-hero__item--culture { --res-accent: var(--res-culture); }
.resource-stocks-hero__item--intelligence { --res-accent: var(--res-intelligence); }
.resource-stocks-hero__item--defense { --res-accent: var(--res-defense); }
.resource-stocks-hero__item--gold { --res-accent: var(--res-gold); }

/* Colored headers on resource tables (same order / palette). */
.ppb-table--resources thead th:nth-child(2) { color: #3d7a45; }
.ppb-table--resources thead th:nth-child(3) { color: #7a2e3a; }
.ppb-table--resources thead th:nth-child(4) { color: #2f5f9e; }
.ppb-table--resources thead th:nth-child(5) { color: #6b3d9e; }
.ppb-table--resources thead th:nth-child(6) { color: #c46a1a; }
.ppb-table--resources thead th:nth-child(7) { color: #2a2622; }
.ppb-table--resources thead th:nth-child(8) { color: #7a818c; }
.ppb-table--resources thead th:nth-child(9) { color: #b8922e; }

/* Project Summary — neutral headers; zone titles gold; value cells keep +/- colors. */
.ppb-table--projects-balance.ppb-table--resources thead th {
    color: var(--barony-muted);
}

.ppb-table--projects-balance thead th.projects-balance-zone-title,
.ppb-table--projects-balance thead th.project-card__panel-title {
    color: #7a6020;
}

.ppb-table--projects-balance thead th.projects-balance-output-head,
.ppb-table--projects-balance thead th.projects-balance-subhead {
    color: var(--barony-muted);
    background: var(--barony-surface);
}

.ppb-table--projects-balance thead th.ppb-subcol--add {
    background: rgba(79, 122, 77, 0.08);
    color: var(--barony-muted);
}

.ppb-table--projects-balance thead th.ppb-subcol--pct {
    background: rgba(156, 122, 51, 0.12);
    color: var(--barony-muted);
}

.budget-overview-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.1rem;
    align-items: baseline;
    font-size: 0.82rem;
    color: var(--barony-muted);
}

.budget-overview-chips b {
    color: var(--barony-ink);
    font-weight: 700;
}

.event-turn-fields {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.ppb-table--city-buildings .terrain-improvement-row--inactive td {
    opacity: 0.42;
}

.ppb-table--city-buildings .terrain-improvement-row--inactive .city-building-col-name {
    color: var(--barony-muted);
}

.ppb-table--city-buildings .terrain-improvement-row--inactive .ppb-cell-struck {
    text-decoration: line-through;
}

.terrain-improvement-owner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    cursor: default;
}

.terrain-improvement-owner--vassal {
    color: var(--barony-muted);
    /* Match MudIcon Size.Small (~1.25rem / 20px) */
    font-size: 1.25rem !important;
    width: 1.25rem;
    height: 1.25rem;
}

/* Match MudIcon Size.Small (~20px). */
.ppb-table--city-buildings .terrain-improvement-owner__crown {
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    display: inline-block;
    object-fit: contain;
    opacity: 0.95;
    vertical-align: middle;
}

.city-building-name-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.city-building-name-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.city-building-name-text--link {
    color: var(--barony-accent);
    text-decoration: none;
    font: inherit;
    font-weight: inherit;
}

a.city-building-name-text--link:hover {
    text-decoration: underline;
}

.city-building-name-actions {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
}

.city-building-name-actions .mud-icon-button {
    padding: 2px;
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
}

.city-building-name-actions .mud-icon-button .mud-icon-root {
    font-size: 1rem;
}

.ppb-table--city-buildings thead .city-building-col-name {
    z-index: 3;
}

.ppb-table--city-buildings tbody tr:hover .city-building-col-name {
    background: var(--barony-accent-soft);
}

.ppb-table--city-buildings .city-building-row--core .city-building-col-name {
    color: var(--barony-accent);
}

/* ---- Social group relations (sticky/hover — widths defined after ppb-row-label) ---- */
.ppb-table--social-groups thead .social-group-col-name,
.ppb-table--social-groups thead .social-group-col-influence,
.ppb-table--social-groups thead .social-group-col-tax,
.ppb-table--social-groups thead .social-group-col-relation {
    z-index: 3;
}

.ppb-table--social-groups tbody tr:hover .social-group-col-name,
.ppb-table--social-groups tbody tr:hover .social-group-col-influence,
.ppb-table--social-groups tbody tr:hover .social-group-col-tax,
.ppb-table--social-groups tbody tr:hover .social-group-col-relation {
    background: var(--barony-accent-soft);
}

.ppb-table--social-groups .social-group-col-name .city-building-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.social-group-relation-score {
    display: inline-block;
    min-width: 2ch;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--barony-ink);
    margin-right: 4px;
}

.social-group-relation-label {
    color: var(--barony-muted);
    font-size: 0.72rem;
}

.ppb-table--social-groups .social-group-row--inactive td {
    opacity: 0.42;
}

.ppb-table--social-groups .social-group-row--inactive .social-group-col-name,
.ppb-table--social-groups .social-group-row--inactive .social-group-col-relation .social-group-relation-score {
    color: var(--barony-muted);
    font-weight: 600;
}

.city-building-edit-dialog .mud-tabs-panel {
    padding-top: 8px;
}

.city-building-fields--readonly {
    opacity: 0.72;
}

.ppb-editor--readonly .mud-input-control {
    pointer-events: none;
}

.ppb-table--source .source-col {
    min-width: 200px;
}

/* Offices page: aligned PPB grids across office sections and available-advisor pool. */
.ppb-table--office,
.ppb-table--available-advisors {
    --offices-label-width: 350px;
    --offices-ppb-width: 46px;
    --offices-trailing-width: 56px;
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.ppb-table--office col.offices-label-col,
.ppb-table--available-advisors col.offices-label-col {
    width: var(--offices-label-width);
}

.ppb-table--office col.offices-ppb-col,
.ppb-table--available-advisors col.offices-ppb-col {
    width: var(--offices-ppb-width);
}

.ppb-table--office col.offices-trailing-col,
.ppb-table--available-advisors col.offices-trailing-col {
    width: var(--offices-trailing-width);
}

.ppb-table--office .source-col,
.ppb-table--available-advisors .source-col {
    min-width: var(--offices-label-width);
    width: var(--offices-label-width);
    max-width: var(--offices-label-width);
    box-sizing: border-box;
}

.ppb-table--source .source-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: space-between;
}

.ppb-table--source .source-cell__actions {
    display: inline-flex;
    gap: 0;
    opacity: 0.7;
}

.ppb-table--source tbody tr:hover .source-cell__actions {
    opacity: 1;
}

.ppb-table--source .source-row--system .source-col {
    color: var(--barony-muted);
    font-style: italic;
}

.baron-php-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.65rem;
    align-items: center;
}

.baron-php-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: var(--barony-ink, #3a2e1f);
    opacity: 0.95;
}

.baron-php-chip--neutral {
    color: var(--barony-muted, #6a5a45);
}

.baron-php-chip__label {
    opacity: 0.92;
}

.baron-php-chip__value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* --- PHP metric colors (Prestige / Honor / Fear) --- */
.php-metric--prestige,
.php-col--prestige .php-metric-heading,
.baron-php-chip.php-metric--prestige {
    color: var(--php-prestige);
}

.php-metric--honor,
.php-col--honor .php-metric-heading,
.baron-php-chip.php-metric--honor {
    color: var(--php-honor);
}

.php-metric--fear,
.php-col--fear .php-metric-heading,
.baron-php-chip.php-metric--fear {
    color: var(--php-fear);
}

.php-metric-icon {
    display: inline-block;
    flex-shrink: 0;
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.15em;
    background-color: currentColor;
    -webkit-mask: var(--php-icon-url) center / contain no-repeat;
    mask: var(--php-icon-url) center / contain no-repeat;
}

.php-metric-icon-cluster {
    display: inline-flex;
    align-items: center;
    gap: 0.12rem;
    margin-right: 0.15rem;
}

.php-metric-icon-cluster .php-metric-icon {
    width: 0.95em;
    height: 0.95em;
}

.php-metric-heading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    white-space: nowrap;
    font-weight: 600;
}

.php-metric-heading__text {
    letter-spacing: 0.02em;
}

.baron-php-table th:not(.source-col),
.baron-php-table td:not(.source-col) {
    text-align: center;
    min-width: 3.2rem;
}

.baron-artifacts-table {
    table-layout: fixed;
    width: 100%;
}

.baron-artifacts-table col.artifact-col-name { width: 12%; }
.baron-artifacts-table col.artifact-col-type { width: 8%; }
.baron-artifacts-table col.artifact-col-origin { width: 7%; }
.baron-artifacts-table col.artifact-col-php { width: 4.5rem; }
.baron-artifacts-table col.artifact-col-location { width: 14%; }
.baron-artifacts-table col.artifact-col-desc { width: auto; }

.baron-artifacts-table th.artifact-col-php,
.baron-artifacts-table td.artifact-col-php,
.baron-artifacts-table th.php-col,
.baron-artifacts-table td.php-cell {
    min-width: 3.6rem;
    width: 4.5rem;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.baron-artifacts-table td.php-cell .artifact-php-base {
    color: var(--barony-muted, #6f6656);
    opacity: 0.8;
    font-weight: 400;
    font-size: 0.85em;
}

.baron-artifacts-table th.artifact-col-name,
.baron-artifacts-table td.artifact-col-name,
.baron-artifacts-table th.artifact-col-type,
.baron-artifacts-table td.artifact-col-type,
.baron-artifacts-table th.artifact-col-origin,
.baron-artifacts-table td.artifact-col-origin,
.baron-artifacts-table th.artifact-col-location,
.baron-artifacts-table td.artifact-col-location {
    text-align: left;
}

.baron-artifacts-table td.artifact-col-name {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
}

.baron-artifacts-table td.artifact-col-name .source-cell {
    align-items: flex-start;
    gap: 0.35rem;
}

.baron-artifacts-table td.artifact-col-name .source-cell__name {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}

.baron-artifacts-table td.artifact-col-name .source-cell__actions {
    flex: 0 0 auto;
}

.baron-artifacts-table th.artifact-col-desc,
.baron-artifacts-table td.artifact-col-desc {
    text-align: left;
    min-width: 14rem;
    white-space: normal;
    word-break: break-word;
    color: var(--barony-ink, #3a2e1f);
    opacity: 0.9;
    font-size: 0.9em;
    line-height: 1.35;
}

.baron-artifacts-table td.artifact-col-location {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: top;
    line-height: 1.3;
}

.baron-artifacts-table td.artifact-col-location .artifact-location-btn,
.baron-artifacts-table td.artifact-col-location .mud-tooltip-root,
.baron-artifacts-table td.artifact-col-location .mud-tooltip-inline,
.baron-artifacts-table td.artifact-col-location .barony-tip-anchor {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: left;
}

/* --- Baron's Time (JC) --- */
.baron-time-chip--warn {
    color: var(--barony-neg, #a5503f);
    font-weight: 600;
}

.baron-time-budget {
    margin-bottom: 1.1rem;
}

.baron-time-budget__formula {
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 0.92rem;
    margin-bottom: 0.75rem;
    color: var(--barony-ink, #3a2e1f);
}

.baron-time-bars {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.baron-time-bar__label {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: var(--barony-muted, #6f6656);
    margin-bottom: 0.22rem;
}

.baron-time-bar__track {
    position: relative;
    height: 0.55rem;
    border-radius: 999px;
    background: rgba(47, 42, 36, 0.1);
    overflow: hidden;
}

.baron-time-bar__fill {
    height: 100%;
    border-radius: inherit;
    transition: width 0.2s ease;
}

.baron-time-bar__fill--ok {
    background: linear-gradient(90deg, #6a86a8, #8aa4c0);
}

.baron-time-bar__fill--full {
    background: linear-gradient(90deg, #b08a2e, #d4b464);
}

.baron-time-bar__fill--over {
    background: linear-gradient(90deg, #8b2e2e, #c45a4a);
}

.baron-time-bar__fill--mgmt {
    background: linear-gradient(90deg, #3d6e4a, #6a9a74);
}

.baron-time-bar__fill--short {
    background: linear-gradient(90deg, #a56b2a, #d4a05a);
}

.baron-time-bar__marker {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    margin-left: -1px;
    background: var(--barony-ink, #3a2e1f);
    opacity: 0.35;
}

.baron-time-warnings {
    margin-top: 0.35rem;
}

.baron-time-block {
    margin-top: 1rem;
}

.baron-time-block__title {
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 0.95rem;
    margin-bottom: 0.45rem;
    color: var(--barony-ink, #3a2e1f);
}

.baron-time-table {
    width: 100%;
    table-layout: auto;
}

.baron-time-table th:not(.source-col):not(.baron-time-col-desc),
.baron-time-table td:not(.source-col):not(.baron-time-col-desc) {
    text-align: center;
    min-width: 4rem;
    white-space: nowrap;
    width: 1%;
}

.ppb-table.baron-time-table th.baron-time-col-desc,
.ppb-table.baron-time-table td.baron-time-col-desc {
    width: 99%;
    min-width: 14rem;
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    vertical-align: top;
    font-weight: 400;
    color: var(--barony-ink, #3a2e1f);
}

.ppb-table.baron-time-table th.baron-time-col-desc {
    vertical-align: middle;
    font-weight: 600;
}

.baron-time-cost {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* --- Baron Letters --- */
.baron-letter-group {
    margin-bottom: 1rem;
}

.baron-letter-group__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 14%, transparent);
}

.baron-letter-group__name {
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 1rem;
    color: var(--barony-ink, #3a2e1f);
}

.baron-letter-group__meta {
    font-size: 0.75rem;
    color: var(--barony-muted, #6f6656);
}

.baron-letter-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.baron-letter-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 12%, transparent);
    background: color-mix(in srgb, var(--barony-parchment, #f3e6c8) 70%, white);
}

.baron-letter-row--draft {
    border-style: dashed;
    opacity: 0.95;
}

.baron-letter-row--inbound {
    border-left: 3px solid var(--php-honor, #3a5f8a);
}

.baron-letter-row__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.55rem;
}

.baron-letter-row__status {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--barony-muted, #6f6656);
}

.baron-letter-row__subject {
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 0.95rem;
}

.baron-letter-row__reply {
    font-size: 0.72rem;
    color: var(--php-honor, #3a5f8a);
    font-weight: 600;
}

.baron-letter-row__reply--new {
    color: #a94442;
}

.baron-letter-row__meta {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--barony-muted, #6f6656);
}

.baron-letter-row__actions {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
}

.baron-letter-edit__meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 0.75rem;
    margin-bottom: 0.65rem;
}

@media (max-width: 720px) {
    .baron-letter-edit__meta {
        grid-template-columns: 1fr;
    }
}

.baron-letter-edit__when {
    font-size: 0.78rem;
    color: var(--barony-muted, #6f6656);
    margin-bottom: 0.55rem;
}

.baron-letter-edit__save-hint {
    color: var(--php-honor, #3a5f8a);
}

.baron-letter-editor {
    min-height: 280px;
    background: #fff;
    border: 1px solid var(--barony-border, #d9cfb8);
}

.baron-letter-editor .ql-toolbar.ql-snow,
.baron-letter-editor .ql-container.ql-snow {
    border-color: var(--barony-border, #d9cfb8);
}

.baron-letter-editor .ql-container {
    min-height: 240px;
}

.baron-letter-preview {
    min-height: 200px;
    background: #fff;
    border: 1px solid var(--barony-border, #d9cfb8);
    padding: 0.25rem;
}

.baron-letter-dialog-content {
    max-height: min(80vh, 900px);
    overflow-y: auto;
}

.baron-letter-thread-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.baron-letter-thread-nav__label {
    flex: 1;
    text-align: center;
    font-size: 0.9rem;
    color: var(--barony-muted, #6a5a45);
}

.baron-letter-thread-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    max-height: 5.5rem;
    overflow-y: auto;
}

.baron-letter-thread-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 14rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--barony-border, #d9cfb8);
    background: #faf7f0;
    color: inherit;
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
}

.baron-letter-thread-chip:hover:not(:disabled) {
    border-color: var(--barony-accent, #8a6a3a);
}

.baron-letter-thread-chip--active {
    border-color: var(--barony-accent, #8a6a3a);
    background: #efe4cf;
}

.baron-letter-thread-chip--draft {
    font-style: italic;
}

.baron-letter-thread-chip--inbound {
    border-color: var(--php-honor, #3a5f8a);
}

.baron-letter-thread-chip--outbound {
    border-color: var(--barony-accent, #8a6a3a);
}

.baron-letter-thread-chip__dir {
    flex-shrink: 0;
    font-size: 0.7rem;
    opacity: 0.75;
    text-transform: lowercase;
}

.baron-letter-thread-chip__subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.baron-letter-panel {
    margin-top: 0.85rem;
}

.baron-letter-panel__title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 0.4rem;
    color: var(--barony-muted, #6a5a45);
}

.baron-letter-panel__subtitle {
    font-weight: 400;
    opacity: 0.85;
}

.baron-letter-panel--reply {
    padding-top: 0.75rem;
    border-top: 1px dashed var(--barony-border, #d9cfb8);
}

.baron-letter-preview--reply {
    background: #f7f3ea;
}

.baron-letter-inbox-fab {
    position: fixed;
    right: 1.25rem;
    bottom: 5.5rem;
    /* Below MudDialog overlay (~1300) so the FAB never steals clicks from letter dialogs. */
    z-index: 1050;
}

.baron-letter-dialog .ql-tooltip {
    z-index: 1;
}

.baron-letter-inbox-fab__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 22%, transparent);
    border-radius: 50%;
    background: linear-gradient(180deg, #f7f1e4, #e8dfc8);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(40, 28, 12, 0.28);
}

.baron-letter-inbox-fab__btn:hover {
    background: linear-gradient(180deg, #fff8ea, #efe4c8);
}

.baron-letter-inbox-fab__icon {
    width: 1.65rem;
    height: 1.65rem;
    display: block;
    pointer-events: none;
}

.barony-tabbar__svg-icon {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    display: block;
    opacity: 0.9;
}

.barony-tabbar__svg-icon--lg {
    width: 1.35rem;
    height: 1.35rem;
}

/* --- Letters mailbox (Gmail-like) --- */
.baron-mail {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 0;
    min-height: min(70vh, 820px);
    border: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 16%, transparent);
    background: color-mix(in srgb, var(--barony-paper, #f7f1e4) 88%, white);
    overflow: hidden;
}

.baron-mail__sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 14%, transparent);
    background: color-mix(in srgb, var(--barony-paper, #f7f1e4) 70%, #ebe3d2);
    min-height: 0;
}

.baron-mail__sidebar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 12%, transparent);
}

.baron-mail__empty {
    padding: 1rem 0.75rem;
    color: var(--barony-muted, #6f6656);
}

.baron-mail__thread-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.baron-mail__folder {
    border-bottom: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 10%, transparent);
}

.baron-mail__folder-summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    border: 0;
    background: color-mix(in srgb, var(--barony-ink, #3a2e1f) 4%, transparent);
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
}

.baron-mail__folder--current > .baron-mail__folder-summary {
    background: color-mix(in srgb, var(--barony-accent, #8b5a2b) 12%, transparent);
    font-weight: 600;
}

.baron-mail__folder-chevron {
    width: 0.9rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.baron-mail__folder-title {
    flex: 1;
    font-size: 0.82rem;
    color: var(--barony-ink, #3a2e1f);
}

.baron-mail__folder-count {
    font-size: 0.72rem;
    color: var(--barony-muted, #6f6656);
    min-width: 1.25rem;
    text-align: right;
}

.baron-mail__folder-body {
    display: flex;
    flex-direction: column;
}

.baron-mail__thread {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 10%, transparent);
    background: transparent;
    padding: 0.7rem 0.85rem 0.7rem 1.35rem;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.baron-mail__thread:hover {
    background: color-mix(in srgb, var(--barony-ink, #3a2e1f) 5%, transparent);
}

.baron-mail__thread--active {
    background: color-mix(in srgb, var(--barony-accent, #8b5a2b) 14%, transparent);
}

.baron-mail__thread--unread .baron-mail__thread-title {
    font-weight: 700;
}

.baron-mail__thread-num {
    font-family: var(--barony-font-body, Georgia, serif);
    font-size: 0.82em;
    font-weight: 600;
    opacity: 0.7;
    flex-shrink: 0;
}

.baron-mail__thread-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 0.98rem;
    color: var(--barony-ink, #3a2e1f);
}

.baron-mail__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #b33a2b;
    flex-shrink: 0;
}

.baron-mail__thread-meta {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--barony-muted, #6f6656);
}

.baron-mail__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--barony-paper, #f7f1e4);
}

.baron-mail__placeholder {
    margin: auto;
    padding: 2rem;
    text-align: center;
    max-width: 28rem;
}

.baron-mail__header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 12%, transparent);
}

.baron-mail__title {
    margin: 0;
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--barony-ink, #3a2e1f);
    cursor: text;
}

.baron-mail__title-field {
    max-width: 28rem;
}

.baron-mail__header-meta {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--barony-muted, #6f6656);
}

.baron-mail__header-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.15rem;
}

.baron-mail__posts {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 12rem;
}

.baron-mail__post {
    border: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 12%, transparent);
    padding: 0.65rem 0.8rem 0.75rem;
    background: color-mix(in srgb, white 55%, var(--barony-paper, #f7f1e4));
}

.baron-mail__post--inbound {
    border-left: 3px solid color-mix(in srgb, #5a6e4a 70%, transparent);
}

.baron-mail__post--outbound {
    border-left: 3px solid color-mix(in srgb, var(--barony-accent, #8b5a2b) 70%, transparent);
}

.baron-mail__post--draft {
    opacity: 0.85;
    border-style: dashed;
}

.baron-mail__post-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    color: var(--barony-muted, #6f6656);
}

.baron-mail__post-dir {
    font-weight: 600;
    color: var(--barony-ink, #3a2e1f);
}

.baron-mail__post-body .ql-editor {
    padding: 0;
    min-height: 0;
}

/* Baron’s hand — clear, brisk script */
.baron-mail__post--outbound .baron-mail__post-body .ql-editor,
.baron-mail__hand--baron .ql-editor {
    font-family: var(--baron-letter-font-baron);
    font-size: 1.28rem;
    line-height: 1.42;
    letter-spacing: 0.01em;
}

/* Correspondent’s hand — more formal, flowing script */
.baron-mail__post--inbound .baron-mail__post-body .ql-editor,
.baron-mail__hand--correspondent .ql-editor {
    font-family: var(--baron-letter-font-correspondent);
    font-size: 1.22rem;
    line-height: 1.48;
    letter-spacing: 0.02em;
}

.baron-mail__composer {
    border-top: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 14%, transparent);
    padding: 0.75rem 1rem 1rem;
    background: color-mix(in srgb, var(--barony-paper, #f7f1e4) 75%, #ebe3d2);
}

.baron-mail__composer--waiting {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.85rem 1rem;
    color: var(--barony-muted, #6f6656);
}

.baron-mail__composer-label {
    font-size: 0.8rem;
    color: var(--barony-muted, #6f6656);
    margin-bottom: 0.4rem;
}

.baron-mail__save-hint {
    opacity: 0.8;
}

.baron-mail__editor.baron-letter-editor {
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.baron-mail__editor .ql-toolbar.ql-snow {
    flex-shrink: 0;
}

.baron-mail__editor .ql-container {
    flex: 1 1 auto;
    min-height: 220px;
    height: auto !important;
}

.baron-mail__editor .ql-editor {
    min-height: 220px;
}

.baron-mail__composer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.6rem;
}

@media (max-width: 900px) {
    .baron-mail {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .baron-mail__sidebar {
        border-right: 0;
        border-bottom: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 14%, transparent);
        max-height: 40vh;
    }
}

.baron-php-table th.php-col {
    color: inherit;
}

.baron-php-table .php-cell.php-metric--prestige {
    color: var(--php-prestige);
}

.baron-php-table .php-cell.php-metric--honor {
    color: var(--php-honor);
}

.baron-php-table .php-cell.php-metric--fear {
    color: var(--php-fear);
}

.baron-php-table .php-cell.php-cell--neg {
    opacity: 0.85;
    filter: saturate(1.15);
}

.baron-php-table .php-cell:not(.php-cell--pos):not(.php-cell--neg) {
    opacity: 0.55;
}

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

@media (max-width: 560px) {
    .baron-php-edit-fields {
        grid-template-columns: 1fr;
    }
}

.php-field--prestige .mud-input-label,
.php-field--prestige .mud-input-slot {
    color: var(--php-prestige) !important;
}

.php-field--honor .mud-input-label,
.php-field--honor .mud-input-slot {
    color: var(--php-honor) !important;
}

.php-field--fear .mud-input-label,
.php-field--fear .mud-input-slot {
    color: var(--php-fear) !important;
}

.baron-reputation-summary-hint {
    font-size: 0.85rem;
    opacity: 0.85;
    color: var(--barony-muted, #6a5a45);
}

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

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

.baron-reputation-track {
    border: 1px solid color-mix(in srgb, var(--barony-ink, #3a2e1f) 18%, transparent);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--barony-parchment, #f3e6c8) 88%, white), var(--barony-parchment, #f3e6c8));
    padding: 0.85rem 0.95rem 1rem;
    border-radius: 2px;
}

.baron-reputation-track.php-metric--prestige,
.baron-reputation-track--prestige {
    box-shadow: inset 3px 0 0 var(--php-prestige, #b08a2e);
}

.baron-reputation-track.php-metric--honor,
.baron-reputation-track--honor {
    box-shadow: inset 3px 0 0 var(--php-honor, #3a5f8a);
}

.baron-reputation-track.php-metric--fear,
.baron-reputation-track--fear {
    box-shadow: inset 3px 0 0 var(--php-fear, #7a3030);
}

.baron-reputation-track__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.baron-reputation-track__title {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.baron-reputation-track__title .php-metric-heading {
    font-size: inherit;
    letter-spacing: inherit;
    text-transform: uppercase;
    font-weight: 600;
}

.baron-reputation-track__title .php-metric-heading__text {
    opacity: 0.85;
}

.baron-reputation-track__tier {
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 1.15rem;
    line-height: 1.2;
    color: var(--barony-ink, #3a2e1f);
}

.baron-reputation-track__score {
    font-family: var(--barony-font-display, Georgia, serif);
    font-size: 1.35rem;
    font-weight: 600;
    min-width: 3rem;
    text-align: right;
}

.baron-reputation-steps {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    margin-bottom: 0.85rem;
}

.baron-reputation-step {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.28rem 0.45rem;
    border-radius: 2px;
    font-size: 0.78rem;
    opacity: 0.55;
    border: 1px solid transparent;
}

.baron-reputation-step--reached {
    opacity: 0.8;
}

.baron-reputation-step--current {
    opacity: 1;
    background: color-mix(in srgb, var(--barony-ink, #3a2e1f) 8%, transparent);
    border-color: color-mix(in srgb, var(--barony-ink, #3a2e1f) 22%, transparent);
    font-weight: 600;
}

.baron-reputation-step__name {
    line-height: 1.25;
}

.baron-reputation-step__req {
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
    white-space: nowrap;
}

.baron-reputation-bonuses__label {
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.65;
    margin-bottom: 0.2rem;
}

.baron-reputation-bonuses__text {
    font-size: 0.84rem;
    line-height: 1.35;
    margin-bottom: 0.55rem;
}

.baron-reputation-bonuses__skills {
    font-size: 0.8rem;
    line-height: 1.35;
    opacity: 0.9;
}

.baron-reputation-bonuses__note {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    opacity: 0.65;
    font-style: italic;
}

.barony-tooltip {
    max-width: 360px;
    line-height: 1.35;
}

.barony-tooltip__title {
    font-weight: 700;
    margin-bottom: 4px;
}

.barony-tooltip__text {
    white-space: pre-wrap;
}

.barony-tip-anchor {
    display: inline;
}

/* Generic Domain Panel tooltip: kill Mud chrome; parchment lives on .barony-tip__box. */
.mud-tooltip.barony-tip-popover,
.mud-tooltip.mud-tooltip-default.barony-tip-popover,
.mud-tooltip.mud-theme-transparent.barony-tip-popover {
    background: transparent !important;
    background-color: transparent !important;
    color: inherit !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    font-weight: 400 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-align: left !important;
}

.mud-tooltip.barony-tip-popover > .d-block,
.mud-tooltip.barony-tip-popover .d-block {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    white-space: normal !important;
}

.barony-tip__box {
    max-width: min(22rem, calc(100vw - 2rem));
    min-width: 10rem;
    padding: 10px 12px;
    background: linear-gradient(180deg, #fbf8f1 0%, #f0ead9 100%);
    color: #2f2a24;
    border: 1px solid #c3b696;
    border-radius: 4px;
    box-shadow:
        0 2px 10px rgba(47, 42, 36, 0.2),
        inset 0 1px 0 rgba(251, 248, 241, 0.75);
    font-family: 'Open Sans', sans-serif;
    text-align: left;
}

.barony-tip__title {
    font-family: 'Eagle Lake', serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #9c7a33;
    margin: 0 0 6px 0;
    padding: 0 0 5px 0;
    border-bottom: 1px solid #d9cfb8;
    letter-spacing: 0.02em;
}

.barony-tip__body {
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
    color: #2f2a24;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.barony-section {
    background: var(--barony-surface);
    border: 1px solid var(--barony-border);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(47, 42, 36, 0.06);
}

.barony-section__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(180deg, var(--barony-surface) 0%, var(--barony-surface-2) 100%);
    border-bottom: 1px solid transparent;
}

.barony-section--open .barony-section__header {
    border-bottom: 1px solid var(--barony-border);
}

.barony-section__header:hover {
    background: var(--barony-accent-soft);
}

.barony-section__title {
    font-family: 'Eagle Lake', serif;
    font-size: 1.02rem;
    flex: 0 0 auto;
    margin-right: 8px;
}

.barony-section__title-icon {
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
    flex: 0 0 auto;
    margin-right: 2px;
}

.barony-section__summary {
    flex: 1 1 auto;
    overflow-x: auto;
}

.barony-section__chevron {
    transition: transform 0.15s ease;
    color: var(--barony-muted);
}

.barony-section--open .barony-section__chevron {
    transform: rotate(180deg);
}

.barony-section__body {
    padding: 8px 14px 14px 14px;
    overflow-x: auto;
}

/* ---- PPB tables ---- */
.ppb-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.82rem;
}

.ppb-table th,
.ppb-table td {
    padding: 4px 8px;
    text-align: center;
    white-space: nowrap;
}

/* Baron's Time: Description must wrap and take remaining width. */
.ppb-table.baron-time-table td.baron-time-col-desc,
.ppb-table.baron-time-table th.baron-time-col-desc {
    white-space: pre-wrap;
    text-align: left;
}

.ppb-table thead th {
    color: var(--barony-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--barony-border-strong);
    position: sticky;
    top: 0;
    background: var(--barony-surface);
}

.ppb-table td.ppb-row-label,
.ppb-table th.ppb-row-label {
    text-align: left;
    font-weight: 600;
    color: var(--barony-ink);
    position: sticky;
    left: 0;
    background: var(--barony-surface);
    min-width: 160px;
}

/* Social groups: Group + Infl. + Tax + Relation = 350px before PPB. */
.ppb-table--social-groups {
    --social-group-name-width: 125px;
    --social-group-influence-width: 52px;
    --social-group-tax-width: 44px;
    --social-group-relation-width: 129px;
    --social-group-pinned-width: 350px;
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.ppb-table--social-groups col.social-group-col-name {
    width: var(--social-group-name-width);
}

.ppb-table--social-groups col.social-group-col-influence {
    width: var(--social-group-influence-width);
}

.ppb-table--social-groups col.social-group-col-tax {
    width: var(--social-group-tax-width);
}

.ppb-table--social-groups col.social-group-col-relation {
    width: var(--social-group-relation-width);
}

.ppb-table--social-groups th.ppb-row-label.social-group-col-name,
.ppb-table--social-groups td.ppb-row-label.social-group-col-name,
.ppb-table--social-groups th.social-group-col-name,
.ppb-table--social-groups td.social-group-col-name {
    min-width: var(--social-group-name-width) !important;
    width: var(--social-group-name-width) !important;
    max-width: var(--social-group-name-width) !important;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--barony-surface);
    box-sizing: border-box;
}

.ppb-table--social-groups tbody td.social-group-col-name {
    padding-top: 2px;
    padding-bottom: 2px;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--barony-accent);
    line-height: 1.2;
}

.ppb-table--social-groups tbody td.social-group-col-name .city-building-name-text {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.ppb-table--social-groups th.social-group-col-influence,
.ppb-table--social-groups td.social-group-col-influence {
    min-width: var(--social-group-influence-width) !important;
    width: var(--social-group-influence-width) !important;
    max-width: var(--social-group-influence-width) !important;
    text-align: center;
    font-variant-numeric: tabular-nums;
    position: sticky;
    left: var(--social-group-name-width);
    z-index: 2;
    background: var(--barony-surface);
    box-sizing: border-box;
}

.ppb-table--social-groups th.social-group-col-tax,
.ppb-table--social-groups td.social-group-col-tax {
    min-width: var(--social-group-tax-width) !important;
    width: var(--social-group-tax-width) !important;
    max-width: var(--social-group-tax-width) !important;
    text-align: center;
    font-variant-numeric: tabular-nums;
    position: sticky;
    left: calc(var(--social-group-name-width) + var(--social-group-influence-width));
    z-index: 2;
    background: var(--barony-surface);
    box-sizing: border-box;
}

.ppb-table--social-groups th.social-group-col-relation,
.ppb-table--social-groups td.social-group-col-relation {
    min-width: var(--social-group-relation-width) !important;
    width: var(--social-group-relation-width) !important;
    max-width: var(--social-group-relation-width) !important;
    text-align: left;
    white-space: nowrap;
    position: sticky;
    left: calc(var(--social-group-name-width) + var(--social-group-influence-width) + var(--social-group-tax-width));
    z-index: 2;
    background: var(--barony-surface);
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
    box-sizing: border-box;
}

.ppb-cell-pos { color: var(--barony-pos); }
.ppb-cell-neg { color: var(--barony-neg); }
.ppb-cell-zero { color: #b8ae98; }
.ppb-cell-inactive,
.ppb-col-inactive {
    opacity: 0.38;
}
.ppb-col-inactive {
    font-weight: normal;
}
.significant-skills-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 1rem;
    margin-top: 0.5rem;
}
.baron-ppb-focus-head {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-width: 0;
}
.baron-ppb-focus-check {
    margin: 0 !important;
    padding: 0 !important;
}
.baron-ppb-focus-check .mud-button-root,
.baron-ppb-focus-check .mud-icon-button {
    padding: 0 !important;
    width: 1.1rem;
    height: 1.1rem;
}
.baron-ppb-focus-check .mud-icon-root {
    font-size: 1rem !important;
}
.baron-ppb-focus-label--on {
    font-weight: 700;
}
.significant-skill--active {
    font-weight: 600;
}
.significant-skill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}
.significant-skill-row > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}
.significant-skill-stepper {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    flex: 0 0 auto;
}
.significant-skill-stepper__count {
    min-width: 1.25rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.significant-skill-stepper__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid var(--barony-border, #c3b696);
    border-radius: 3px;
    background: var(--barony-surface, #f7f1e4);
    color: var(--barony-ink, #2f2a24);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}
.significant-skill-stepper__btn:hover:not(:disabled) {
    border-color: var(--barony-accent, #9c7a33);
    background: var(--barony-accent-soft, #f0e6d0);
}
.significant-skill-stepper__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Barony-themed checkbox: amber/gold instead of MudBlazor blue */
.barony-checkbox .mud-checkbox-icons .mud-icon-root {
    color: rgba(47, 42, 36, 0.35);
}
.barony-checkbox.mud-checkbox-true .mud-checkbox-icons .mud-icon-root,
.barony-checkbox .mud-checkbox-true .mud-checkbox-icons .mud-icon-root {
    color: #9c7a33;
}
.barony-checkbox:not(.mud-disabled):hover .mud-checkbox-icons .mud-icon-root {
    color: #c3a050;
}
.barony-checkbox.mud-checkbox-true:hover .mud-checkbox-icons .mud-icon-root {
    color: #7a5e1e;
}
.barony-checkbox .mud-primary-text {
    color: inherit;
}

/* Barony-themed switch (dialogs / relations / seat templates). */
.barony-switch.mud-switch .mud-switch-track {
    background-color: rgba(47, 42, 36, 0.12);
    border: 1px solid var(--barony-border, #c3b696);
    opacity: 1;
}
.barony-switch.mud-switch.mud-checked .mud-switch-track {
    background-color: color-mix(in srgb, var(--barony-accent, #9c7a33) 40%, transparent);
    border-color: var(--barony-accent, #9c7a33);
}
.barony-switch.mud-switch .mud-switch-thumb {
    background-color: var(--barony-surface, #f7f1e4);
    border: 1px solid var(--barony-border, #c3b696);
    box-shadow: none;
}
.barony-switch.mud-switch.mud-checked .mud-switch-thumb {
    background-color: var(--barony-accent, #9c7a33);
    border-color: var(--barony-accent, #9c7a33);
}
.barony-switch .mud-primary-text {
    color: inherit;
}

/* Add Office dialog — compact icon picker row */
.add-office-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin: 4px 0 14px;
}

.add-office-icon-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--barony-ink);
    font: inherit;
    flex: 0 0 auto;
}

.add-office-icon-row__tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    padding: 5px;
    border: 1px solid var(--barony-border);
    border-radius: 4px;
    background: var(--barony-surface);
    flex: 0 0 auto;
}

.add-office-icon-row:hover .add-office-icon-row__tile {
    border-color: var(--barony-accent, #9c7a33);
    background: var(--barony-accent-soft);
}

.add-office-icon-row__tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.add-office-icon-row__label {
    font-size: 0.92rem;
    color: var(--barony-ink);
}

.add-office-upkeep {
    flex: 1 1 12rem;
    min-width: 10rem;
    max-width: 18rem;
}

.add-office-level {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
}

.add-office-level .mud-radio {
    margin-inline-end: 0;
}

/* Add Office: fixed width so focus warnings only grow height. */
.mud-dialog-container .mud-dialog.baron-influence-dialog.add-office-dialog:not(.mud-dialog-fullscreen):has(.baron-influence-dialog-content) {
    width: min(96vw, 28rem) !important;
    min-width: min(96vw, 22rem) !important;
    max-width: min(96vw, 28rem) !important;
}

.add-office-dialog .baron-influence-edit-dialog {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.add-office-focus-notes {
    margin-top: 0.75rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.add-office-focus-notes__alert,
.add-office-focus-notes .mud-alert {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.add-office-focus-notes .mud-alert-message {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    max-width: 100%;
}

/* Barony-themed radio (luxury goods access tiers / office level). */
.barony-radio .mud-icon-root {
    color: rgba(47, 42, 36, 0.35);
}
.barony-radio.mud-checked .mud-icon-root {
    color: var(--barony-accent, #9c7a33) !important;
}
.barony-radio .mud-primary-text {
    color: inherit;
}

.ppb-summary-row td {
    border-top: 2px solid var(--barony-border-strong);
    font-weight: 700;
}

/* Style A: zebra */
.ppb-table--zebra tbody tr:nth-child(odd) { background: var(--barony-surface); }
.ppb-table--zebra tbody tr:nth-child(even) { background: var(--barony-surface-2); }

/* Style B: lines */
.ppb-table--lined tbody td { border-bottom: 1px solid var(--barony-border); }
.ppb-table--lined tbody tr:hover { background: var(--barony-accent-soft); }

/* Style C: compact */
.ppb-table--compact th,
.ppb-table--compact td { padding: 2px 6px; font-size: 0.78rem; }
.ppb-table--compact tbody tr { border-bottom: 1px dashed var(--barony-border); }

/* Compact PPB summary chips in section headers */
.ppb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.ppb-chips > .barony-tip-anchor,
.baron-php-summary > .barony-tip-anchor,
.baron-audience__ppb-glance .barony-tip-anchor,
.baron-audience-summary-table th .barony-tip-anchor {
    display: inline-flex;
    align-items: center;
}

.ppb-chip {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--barony-surface-2, rgba(255, 255, 255, 0.12));
    border: 1px solid color-mix(in srgb, var(--ppb-accent, var(--barony-border, #c3b696)) 55%, transparent);
    font-size: 0.72rem;
    line-height: 1.4;
}

.ppb-chip__label { color: var(--ppb-accent, var(--barony-muted, #6f6656)); }
.ppb-chip__value { font-weight: 700; }
.ppb-chip--pos .ppb-chip__value { color: var(--barony-pos, #4f7a4d); }
.ppb-chip--neg .ppb-chip__value { color: var(--barony-neg, #a5503f); }

/* Campaign chapter tiles (outside .barony-scope): PHP + PPB accents still readable on dark overlay */
.chapter-resource-summary {
    --php-prestige: #d4b45a;
    --php-honor: #7aa5d4;
    --php-fear: #d07070;
    --barony-surface-2: rgba(255, 255, 255, 0.12);
    --barony-border: rgba(255, 255, 255, 0.22);
    --barony-muted: rgba(255, 255, 255, 0.78);
    --barony-pos: #8fd49a;
    --barony-neg: #f0a090;
}

.chapter-resource-summary .ppb-chip {
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
}

.chapter-resource-summary .baron-php-chip {
    padding: 1px 7px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ---- Barony Card (generic container) ---- */
.barony-card {
    background: var(--barony-surface);
    border: 1px solid var(--barony-border-strong);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 2px 6px rgba(47, 42, 36, 0.08);
}

.barony-card__title {
    font-family: 'Eagle Lake', serif;
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: var(--barony-accent);
    border-bottom: 1px solid var(--barony-border);
    padding-bottom: 6px;
}

.barony-stat {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px dotted var(--barony-border);
}

.barony-stat__label { color: var(--barony-muted); }
.barony-stat__value { font-weight: 700; }

.barony-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2px 24px;
}

.ppb-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 4px 10px;
}

.ppb-editor-grid--compact {
    display: grid;
    grid-template-columns: repeat(13, 45px);
    gap: 12px 16px;
    width: max-content;
    max-width: 100%;
}

.ppb-editor-grid--compact-12 {
    display: grid;
    grid-template-columns: repeat(12, 45px);
    gap: 12px 16px;
    width: max-content;
    max-width: 100%;
}

.ppb-editor-grid--compact-resources {
    display: grid;
    grid-template-columns: repeat(8, 45px);
    gap: 12px 16px;
    width: max-content;
    max-width: 100%;
}

/* ---- Baron influence edit dialog (rendered outside .barony-scope) ---- */

.barony-dialog-theme {
    --barony-bg: #f4efe3;
    --barony-surface: #fbf8f1;
    --barony-surface-2: #f0ead9;
    --barony-ink: #2f2a24;
    --barony-muted: #6f6656;
    --barony-border: #d9cfb8;
    --barony-border-strong: #c3b696;
    --barony-accent: #9c7a33;
    --barony-accent-soft: #ece0c4;

    color: var(--barony-ink);
    font-family: 'Open Sans', sans-serif;
}

/* Generic barony dialog chrome — title bar, content bg, footer */
.mud-dialog.barony-dialog {
    border: 1px solid #c3b696;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(47, 42, 36, 0.18);
}

.mud-dialog.barony-dialog .mud-dialog-title {
    background: linear-gradient(180deg, #fbf8f1 0%, #f0ead9 100%);
    border-bottom: 1px solid #d9cfb8;
    color: #2f2a24;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    padding: 12px 16px;
}

.mud-dialog.barony-dialog .mud-dialog-content {
    background: #fbf8f1;
    color: #2f2a24;
    padding: 16px !important;
}

.mud-dialog.barony-dialog .mud-dialog-actions {
    background: #f0ead9;
    border-top: 1px solid #d9cfb8;
    padding: 10px 16px !important;
    gap: 8px;
}

.mud-dialog-container .mud-dialog.baron-influence-dialog:not(.mud-dialog-fullscreen):has(.baron-influence-dialog-content) {
    width: fit-content !important;
    max-width: min(96vw, 860px) !important;
    border: 1px solid var(--barony-border-strong);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 28px rgba(47, 42, 36, 0.18);
}

.mud-dialog-container .mud-dialog.baron-influence-dialog.advisor-profile-dialog:not(.mud-dialog-fullscreen):has(.baron-influence-dialog-content) {
    width: min(96vw, 28rem) !important;
    min-width: min(96vw, 22rem) !important;
    max-width: min(96vw, 28rem) !important;
}

.mud-dialog.baron-influence-dialog .mud-dialog-title {
    background: linear-gradient(180deg, #fbf8f1 0%, #f0ead9 100%);
    border-bottom: 1px solid #d9cfb8;
    color: #2f2a24;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    padding: 12px 16px;
}

.mud-dialog.baron-influence-dialog .mud-dialog-content.baron-influence-dialog-content {
    background: #fbf8f1;
    color: #2f2a24;
    padding: 16px !important;
}

.mud-dialog.baron-influence-dialog .mud-dialog-actions.baron-influence-dialog-actions {
    background: #f0ead9;
    border-top: 1px solid #d9cfb8;
    padding: 10px 16px !important;
    gap: 8px;
}

.baron-influence-dialog .ppb-editor .mud-typography {
    color: #6f6656;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}

.baron-influence-edit-dialog {
    width: max-content;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.baron-influence-field {
    width: 100%;
}

.baron-influence-dialog .baron-influence-field .mud-input-label {
    color: #6f6656;
}

.baron-influence-dialog .baron-influence-field .mud-input-outlined-border {
    border-color: #d9cfb8 !important;
}

.baron-influence-dialog .baron-influence-field .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: #c3b696 !important;
}

.baron-influence-dialog .baron-influence-field.mud-input-control:focus-within .mud-input-outlined-border {
    border-color: #9c7a33 !important;
}

.baron-influence-dialog .baron-influence-field input,
.baron-influence-dialog .baron-influence-field textarea {
    color: #2f2a24;
}

/* Align MudSelect value left like MudTextField (Mud defaults to centered). */
.baron-influence-dialog .baron-influence-field.mud-select .mud-input-slot,
.baron-influence-dialog .baron-influence-field.mud-select .mud-select-input,
.baron-influence-dialog .baron-influence-field.mud-select input {
    text-align: left !important;
    justify-content: flex-start !important;
}
.baron-influence-dialog .baron-influence-field.mud-select .mud-input-slot {
    padding-inline-start: 0;
}
.baron-influence-dialog .baron-influence-field.mud-select .mud-select-input {
    padding-left: 6px;
    margin-top: 0;
}

.baron-influence-dialog .mud-input-helper-text {
    color: #6f6656;
}

.baron-influence-dialog .ppb-compact-numeric .mud-input-label {
    color: #6f6656;
}

.baron-influence-dialog .ppb-compact-numeric .mud-input-root {
    color: #2f2a24;
}

.baron-influence-dialog .ppb-compact-numeric .mud-input-underline:before {
    border-bottom-color: #d9cfb8;
}

.baron-influence-dialog .ppb-compact-numeric.mud-input-control:focus-within .mud-input-underline:after {
    border-bottom-color: #9c7a33;
}

.baron-influence-dialog .mud-button-outlined {
    border-color: #c3b696 !important;
    color: #2f2a24 !important;
}

.baron-influence-dialog .mud-button-outlined:hover {
    background: #ece0c4 !important;
}

/* Gold primary action — works on pages and in dialogs (not only inside .baron-influence-dialog). */
.baron-influence-save-btn.mud-button-filled,
.barony-scope .mud-button-filled.mud-button-filled-primary,
.mud-dialog.baron-influence-dialog .mud-button-filled.mud-button-filled-primary,
.mud-dialog.barony-dialog .mud-button-filled.mud-button-filled-primary {
    background: var(--barony-accent, #9c7a33) !important;
    color: var(--barony-surface, #fbf8f1) !important;
    box-shadow: none !important;
}

.baron-influence-save-btn.mud-button-filled:hover:not(:disabled),
.barony-scope .mud-button-filled.mud-button-filled-primary:hover:not(:disabled),
.mud-dialog.baron-influence-dialog .mud-button-filled.mud-button-filled-primary:hover:not(:disabled),
.mud-dialog.barony-dialog .mud-button-filled.mud-button-filled-primary:hover:not(:disabled) {
    background: #866828 !important;
}

.baron-influence-save-btn.mud-button-filled:disabled,
.barony-scope .mud-button-filled.mud-button-filled-primary:disabled,
.mud-dialog.baron-influence-dialog .mud-button-filled.mud-button-filled-primary:disabled,
.mud-dialog.barony-dialog .mud-button-filled.mud-button-filled-primary:disabled {
    background: color-mix(in srgb, var(--barony-accent, #9c7a33) 45%, var(--barony-border, #c3b696)) !important;
    color: color-mix(in srgb, var(--barony-surface, #fbf8f1) 70%, transparent) !important;
}

/* Battle XP summary needs room for all columns at once. */
.mud-dialog-container .mud-dialog.baron-influence-dialog.battle-xp-summary-mud-dialog:not(.mud-dialog-fullscreen):has(.baron-influence-dialog-content) {
    width: min(98vw, 1480px) !important;
    max-width: min(98vw, 1480px) !important;
    min-width: min(96vw, 1100px) !important;
}

.battle-xp-summary-dialog {
    width: 100%;
    min-width: 0;
}

.battle-xp-summary-dialog__table {
    width: 100%;
    table-layout: fixed;
}

.battle-xp-summary-dialog__table .mud-table-cell {
    padding-left: 4px !important;
    padding-right: 4px !important;
    vertical-align: middle;
}

.battle-xp-summary-dialog__table thead .mud-table-cell {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: normal;
    word-break: normal;
    hyphens: none;
}

.battle-xp-summary-dialog__unit-col {
    width: 18%;
    text-align: left !important;
}

.battle-xp-summary-dialog__num-col {
    width: 7%;
    text-align: center !important;
    white-space: nowrap;
}

.battle-xp-summary-dialog__bonus-col {
    width: 9%;
    text-align: center !important;
}

.battle-xp-summary-dialog__note-col {
    width: 16%;
    text-align: center !important;
    white-space: nowrap;
}

.battle-xp-summary-dialog__bonus-col .mud-input-control {
    margin: 0 auto;
}

.battle-xp-summary-dialog__bonus-input {
    width: 100%;
    max-width: 100%;
}

.battle-xp-summary-dialog__bonus-input .mud-input-slot,
.battle-xp-summary-dialog__bonus-input .mud-input-root {
    padding-inline: 2px !important;
}

.battle-xp-summary-dialog__bonus-input input {
    text-align: center;
}

.battle-xp-summary-dialog__note-input {
    width: 100%;
    min-width: 0;
}

.battle-xp-summary-dialog__note-input .mud-input-root {
    padding-inline: 6px !important;
}

.unit-log-dialog {
    min-width: min(94vw, 760px);
    width: 100%;
}

.unit-log-dialog__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.unit-log-dialog__item {
    border: 1px solid #d9cfb8;
    border-radius: 8px;
    padding: 7px 9px;
    background: #fbf8f1;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.unit-log-dialog__row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: baseline;
    font-size: 0.76rem;
    line-height: 1.2;
    color: #6f6656;
}

.unit-log-dialog__kind {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 700;
}

.unit-log-dialog__xp {
    margin-left: 0;
    font-weight: 700;
    color: #9c7a33;
}

.unit-log-dialog__text {
    margin-top: 3px;
    color: #2f2a24;
    line-height: 1.25;
}

.unit-log-dialog__note {
    margin-top: 3px;
    color: #6f6656;
    font-size: 0.78rem;
    line-height: 1.2;
}

.ppb-compact-numeric.mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
    max-width: 45px;
    width: 45px;
}

.ppb-compact-numeric .mud-input-label {
    font-size: 0.62rem;
    max-width: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ppb-compact-numeric .mud-input-root {
    font-size: 0.78rem;
    padding-top: 0;
    padding-bottom: 0;
}

.ppb-compact-numeric input {
    text-align: center;
    padding: 2px 0;
    min-width: 0;
}

.ppb-compact-numeric .mud-input-control-input-container {
    max-width: 45px;
}

/* ---- Offices tab ---- */
.advisor-office-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--barony-border);
}

.advisor-office-header__row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.advisor-office-name {
    font-weight: 700;
    color: var(--barony-ink);
}

.advisor-office-description,
.advisor-person-description,
.advisor-profile-description {
    margin-top: 4px;
    color: var(--barony-muted);
    white-space: pre-wrap;
}

.advisor-office-description {
    opacity: 0.92;
    line-height: 1.45;
}

.ppb-table--office .office-cost-col {
    text-align: center;
    min-width: var(--offices-trailing-width, 56px);
    width: var(--offices-trailing-width, 56px);
    max-width: var(--offices-trailing-width, 56px);
    font-variant-numeric: tabular-nums;
    box-sizing: border-box;
}

.ppb-table--available-advisors .available-advisor-actions-col {
    white-space: nowrap;
    min-width: var(--offices-trailing-width, 56px);
    width: var(--offices-trailing-width, 56px);
    max-width: var(--offices-trailing-width, 56px);
    box-sizing: border-box;
}

.barony-scope .court-person-card .project-card__title-row {
    align-items: center;
}

.barony-scope .court-person-card {
    cursor: pointer;
}

.barony-scope .court-person-card.project-card--open .project-card__panels {
    cursor: default;
}

.barony-scope .court-person-card__title-actions {
    margin-top: 0;
    margin-left: auto;
    flex: 0 0 auto;
}

.barony-scope .court-person-card__ppb-glance {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0.25rem;
}

.barony-scope .court-person-card__ppb-glance .ppb-chips {
    margin: 0;
    flex-wrap: wrap;
}

.barony-scope .court-person-card__panels {
    flex-direction: row;
    align-items: stretch;
}

.barony-scope .court-person-card__panel--skills {
    flex: 1 1 0;
    min-width: 0;
    border-right: 1px solid var(--barony-border);
}

.barony-scope .court-person-card__panel--ppb {
    flex: 1 1 0;
    min-width: 0;
}

.court-duty-table-wrap {
    overflow-x: auto;
}

.court-duty-table {
    width: 100%;
}

.court-duty-table__salary {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.court-duty-table__sum td {
    font-weight: 700;
    border-top: 1px solid var(--barony-border);
}

.court-duty-name {
    display: block;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.court-duty-name--empty {
    color: var(--barony-muted);
    font-weight: 500;
}

button.court-duty-name--editable {
    appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    text-decoration: underline dotted color-mix(in srgb, var(--barony-accent, #9c7a33) 55%, transparent);
    text-underline-offset: 0.15em;
}

button.court-duty-name--editable:hover {
    color: var(--barony-accent, #9c7a33);
}

.court-duty-wage {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.55rem;
}

.court-duty-wage__label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--barony-muted);
}

.court-duty-wage__value {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.court-duty-wage__period {
    color: var(--barony-muted);
    font-size: 0.75rem;
}

.barony-scope .court-commander-chips {
    margin: 0;
}

.barony-scope .court-commander-xp-field {
    max-width: 8rem;
}

.court-commander-panel__cx {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.45rem;
}

.court-commander-panel__cx-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--barony-muted, #6f6656);
}

.court-commander-panel__cx-meta {
    font-size: 0.68rem;
    color: var(--barony-muted, #6f6656);
}

.court-commander-panel__cx-value {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #7a6020;
    background: rgba(156, 122, 51, 0.1);
    border: 1px solid rgba(156, 122, 51, 0.35);
    border-radius: 4px;
    padding: 0.1rem 0.45rem;
    font-family: inherit;
    cursor: default;
}

.court-commander-panel__cx-value--editable {
    cursor: pointer;
}

.court-commander-panel__cx-value--editable:hover {
    background: rgba(156, 122, 51, 0.2);
    border-color: #9c7a33;
    color: #5c4710;
}

.court-commander-panel__abilities {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

/* Commander skill tree dialog (MudBlazor portal — outside .barony-scope). */
.mud-dialog.court-commander-tree-dialog {
    width: fit-content !important;
    max-width: min(96vw, 1400px) !important;
}

.mud-dialog.court-commander-tree-dialog .court-commander-tree-dialog__content {
    max-height: min(85vh, 60rem);
    overflow: auto;
    width: fit-content;
}

.court-commander-tree {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: fit-content;
}

/* shared fit-content column: trunk stretches to branches width */
.court-commander-tree__body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: fit-content;
}

.court-commander-tree__header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem 1rem;
}

.court-commander-tree__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.court-commander-tree__trunk {
    border: 1px solid rgba(47, 42, 36, 0.14);
    border-radius: 6px;
    padding: 0.65rem 0.75rem 0.75rem;
    background: rgba(251, 248, 241, 0.55);
    width: fit-content;
    align-self: center;
}

.court-commander-tree__branch {
    border: 1px solid rgba(47, 42, 36, 0.14);
    border-radius: 6px;
    padding: 0.65rem 0.75rem 0.75rem;
    background: rgba(251, 248, 241, 0.55);
    width: fit-content;
}

.court-commander-tree__branch-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #7a6020;
}

.court-commander-tree__branch-icon {
    color: #9c7a33;
}

/* branches row: shrink-wrap each branch to its content */
.court-commander-tree__branches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-start;
}

.court-commander-tree__tiers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
    align-items: flex-start;
}

/* trunk tiers side by side */
.court-commander-tree__trunk .court-commander-tree__tiers {
    flex-wrap: nowrap;
}

.court-commander-tree__tiers--vertical {
    flex-direction: column;
    flex-wrap: nowrap;
}

.court-commander-tree__tier {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: fit-content;
}

.court-commander-tree__tier-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: rgba(47, 42, 36, 0.55);
}

/* exactly 2 columns of tiles per tier */
.court-commander-tree__nodes {
    display: grid;
    grid-template-columns: repeat(2, 100px);
    gap: 0.4rem;
}

.court-commander-tree__tiers--vertical .court-commander-tree__nodes {
    display: grid;
    grid-template-columns: repeat(2, 100px);
    gap: 0.4rem;
}

.court-commander-node {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    text-align: left;
    border: 1px solid rgba(47, 42, 36, 0.18);
    border-radius: 5px;
    padding: 0.4rem 0.5rem;
    width: 100px;
    flex: 0 0 100px;
    /* 2 lines of text at 0.78rem×1.3 + padding top+bottom */
    height: calc(2 * 0.78rem * 1.3 + 0.8rem);
    overflow: hidden;
    cursor: pointer;
    background: #fbf8f1;
    color: var(--barony-ink, #2f2a24);
    font: inherit;
    line-height: 1.2;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.court-commander-node__name {
    font-size: 0.78rem;
    font-weight: 650;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

.court-commander-node__meta {
    display: none;
}

.court-commander-node--unlocked {
    border-color: rgba(61, 122, 69, 0.45);
    background: rgba(61, 122, 69, 0.1);
}

.court-commander-node--ready {
    border-color: rgba(156, 122, 51, 0.55);
    background: rgba(196, 163, 90, 0.16);
    box-shadow: inset 0 0 0 1px rgba(156, 122, 51, 0.12);
}

.court-commander-node--locked {
    opacity: 0.62;
    background: rgba(47, 42, 36, 0.04);
}

.court-commander-node--selected {
    border-color: #7a6020;
    box-shadow: 0 0 0 2px rgba(156, 122, 51, 0.28);
}

.court-commander-node--legend {
    cursor: default;
    width: 80px;
    flex: 0 0 80px;
    padding: 0.2rem 0.35rem;
    font-size: 0.66rem;
    pointer-events: none;
    justify-content: center;
    text-align: center;
    height: auto;
}

.court-commander-node--legend .court-commander-node__meta {
    display: none;
}

.court-commander-tree__detail {
    border-top: 1px solid rgba(47, 42, 36, 0.12);
    padding-top: 0.75rem;
}

.court-commander-tree__detail-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.35rem;
}

.court-commander-tree__unlock-btn {
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.court-commander-tree__detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.court-commander-tree__detail-meta {
    font-size: 0.72rem;
    color: rgba(47, 42, 36, 0.55);
}

.court-commander-tree__detail p {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
    line-height: 1.4;
}

.court-commander-tree__req {
    color: rgba(47, 42, 36, 0.65);
    font-size: 0.78rem !important;
}

.court-commander-tree__effects {
    color: rgba(47, 42, 36, 0.72);
    font-size: 0.78rem !important;
    font-style: italic;
}

.court-commander-status {
    display: inline-block;
    margin: 0.15rem 0 0.1rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.court-commander-status--in-code {
    color: #2f5d3a;
    background: rgba(92, 140, 92, 0.18);
    border-color: rgba(92, 140, 92, 0.5);
}

.court-commander-status--proposal {
    color: #7a5a17;
    background: rgba(156, 122, 51, 0.16);
    border-color: rgba(156, 122, 51, 0.5);
}

.court-commander-status--draft {
    color: rgba(47, 42, 36, 0.6);
    background: rgba(47, 42, 36, 0.08);
    border-color: rgba(47, 42, 36, 0.28);
}

.court-commander-tree__branch--shock {
    border-top: 3px solid rgba(139, 58, 58, 0.55);
}

.court-commander-tree__branch--line {
    border-top: 3px solid rgba(107, 140, 174, 0.65);
}

.court-commander-tree__branch--skirmish {
    border-top: 3px solid rgba(92, 107, 74, 0.65);
}

.court-commander-tree__branch--cunning {
    border-top: 3px solid rgba(156, 122, 51, 0.7);
}

.court-commander-tree__branch--general {
    border-top: 3px solid rgba(90, 74, 120, 0.7);
}

.unit-draft-card__icon-btn--captain {
    border-color: color-mix(in srgb, #7a6020 45%, var(--barony-border));
    background: color-mix(in srgb, #c7901a 12%, var(--barony-surface));
}

.unit-draft-card__icon-btn--captain:hover:not(:disabled) {
    background: color-mix(in srgb, #c7901a 22%, var(--barony-surface));
    border-color: #7a6020;
}

.unit-captain-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.45rem 0.75rem 0.65rem;
    border-top: 1px solid var(--barony-border);
}

.unit-captain-row__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7a6020;
}

.unit-captain-row__name {
    font-size: 0.9rem;
    font-weight: 600;
}

.unit-captain-row__clear {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0.1rem 0.35rem;
    margin: 0;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--barony-muted);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.unit-captain-row__clear:hover:not(:disabled) {
    color: #8b3a3a;
}

.unit-captain-row__clear:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.unit-captain-option__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #7a6020;
}

.unit-captain-abilities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0 0.75rem 0.6rem;
}

.unit-captain-abilities__chip {
    font-size: 0.72rem;
}

.unit-captain-pick__list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: min(50vh, 22rem);
    overflow: auto;
    margin-top: 0.35rem;
}

.unit-captain-pick__option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--barony-border);
    border-radius: 4px;
    background: var(--barony-surface);
    color: var(--barony-ink);
    cursor: pointer;
    font: inherit;
}

.unit-captain-pick__option:hover {
    border-color: var(--barony-border-strong);
    background: color-mix(in srgb, var(--barony-accent) 10%, var(--barony-surface));
}

.unit-captain-pick__option--picked {
    border-color: #7a6020;
    background: color-mix(in srgb, #c7901a 14%, var(--barony-surface));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #7a6020 35%, transparent);
}

.unit-captain-pick__name {
    font-weight: 700;
    font-size: 0.92rem;
}

.unit-captain-pick__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.65rem;
}

.unit-captain-pick__hint {
    font-size: 0.75rem;
    color: var(--barony-muted);
}

.barony-scope .court-combat-table th:not(.source-col),
.barony-scope .court-combat-table td.court-skill-table__val {
    min-width: 4.5rem;
    width: 4.5rem;
}

.barony-scope .court-person-card__subpanel-title {
    margin-top: 0.85rem;
}

.barony-scope .court-person-card__ppb-table-wrap {
    overflow-x: auto;
}

@media (max-width: 900px) {
    .barony-scope .court-person-card__panels {
        flex-direction: column;
    }

    .barony-scope .court-person-card__panel--skills {
        border-right: none;
        border-bottom: 1px solid var(--barony-border);
    }
}

.barony-scope .court-skill-table--with-source {
    table-layout: fixed;
    width: 100%;
}

.barony-scope .court-skill-table--with-source .source-col {
    width: 6.25rem;
    min-width: 6.25rem;
    max-width: 6.25rem;
    white-space: nowrap;
    text-align: left;
    box-sizing: border-box;
}

.barony-scope .court-skill-table--with-source .source-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: space-between;
}

.barony-scope .court-skill-table--with-source .source-cell__actions {
    display: inline-flex;
    opacity: 0.7;
}

.barony-scope .court-skill-table--with-source tbody tr:hover .source-cell__actions {
    opacity: 1;
}

/* Domain Skills: same compact look as Main skills (narrow Source, dense headers). */
.barony-scope .ppb-table--court-domain {
    --offices-label-width: 6.25rem;
    --offices-ppb-width: auto;
    table-layout: fixed;
    width: 100%;
    min-width: 0;
    max-width: none;
}

.barony-scope .ppb-table--court-domain col.offices-label-col,
.barony-scope .ppb-table--court-domain .source-col {
    width: var(--offices-label-width);
    min-width: var(--offices-label-width);
    max-width: var(--offices-label-width);
}

.barony-scope .ppb-table--court-domain th {
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    padding: 0.25rem 0.15rem;
    line-height: 1.15;
    white-space: normal;
    word-break: break-word;
}

.barony-scope .ppb-table--court-domain th.source-col {
    text-align: left;
    white-space: nowrap;
    word-break: normal;
}

.barony-scope .ppb-table--court-domain td:not(.source-col) {
    text-align: center;
    font-weight: 700;
    padding: 0.35rem 0.15rem;
}

.barony-scope .ppb-table--court-domain td.source-col {
    padding: 0.35rem 0.25rem;
    font-size: 0.78rem;
}

.barony-scope .ppb-table--court-domain .source-cell__name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.court-other-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.court-other-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.45rem;
}

.court-other-row__name {
    flex: 1 1 10rem;
    min-width: 8rem;
}

.court-other-row__skill {
    flex: 1 1 9rem;
    min-width: 8rem;
}

.court-other-row__value {
    flex: 0 0 6rem;
    max-width: 6.5rem;
}

.court-domain-other-block {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--barony-border, rgba(0, 0, 0, 0.12));
}

.court-domain-other-block:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.barony-scope .court-skill-table {
    width: 100%;
    max-width: none;
}

.barony-scope .court-skill-table--main-row {
    max-width: none;
    width: 100%;
    table-layout: fixed;
}

.barony-scope .court-skill-table--main-row th {
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    padding: 0.25rem 0.15rem;
    line-height: 1.15;
    white-space: normal;
    word-break: break-word;
}

.barony-scope .court-skill-table--main-row td.court-skill-table__val {
    width: auto;
    text-align: center;
    font-weight: 700;
    padding: 0.35rem 0.15rem;
}

.barony-scope .court-skill-table__val {
    width: 5.5rem;
    text-align: center;
}

.barony-scope .court-skill-table--edit .court-skill-num,
.barony-scope .court-secondary-row .court-skill-num,
.barony-scope .court-secondary-add .court-skill-num {
    max-width: 5.5rem;
}

.barony-scope .court-skill-table--main-row.court-skill-table--edit .court-skill-num {
    max-width: none;
}

.barony-scope .court-secondary-add {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.barony-scope .court-secondary-add__select {
    min-width: 14rem;
    flex: 1 1 12rem;
}

.barony-scope .court-secondary-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.barony-scope .court-secondary-row {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}

.barony-scope .court-secondary-row__name {
    flex: 1 1 auto;
    min-width: 8rem;
    font-size: 0.85rem;
}

/* Court edit dialog renders outside .barony-scope (MudBlazor portal). */
.mud-dialog.court-person-dialog .court-skill-table-wrap {
    overflow-x: auto;
}

.mud-dialog.court-person-dialog .court-skill-table--main-row {
    width: 100%;
    max-width: none;
    table-layout: fixed;
}

.mud-dialog.court-person-dialog .court-skill-table--main-row th {
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    padding: 0.25rem 0.15rem;
    line-height: 1.15;
    white-space: normal;
    word-break: break-word;
}

.mud-dialog.court-person-dialog .court-skill-table--main-row td {
    padding: 0.2rem 0.1rem;
    vertical-align: middle;
    text-align: center;
}

.mud-dialog.court-person-dialog .court-skill-table--main-row .court-skill-num {
    width: 100%;
    max-width: none;
}

.mud-dialog.court-person-dialog .court-skill-table--main-row .court-skill-num .mud-input-control {
    margin: 0;
}

.mud-dialog.court-person-dialog .court-secondary-add {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.mud-dialog.court-person-dialog .court-secondary-add__select {
    min-width: 14rem;
    flex: 1 1 12rem;
}

.mud-dialog.court-person-dialog .court-secondary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.65rem;
    align-items: center;
}

.mud-dialog.court-person-dialog .court-secondary-row {
    display: inline-flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
    align-items: center;
    max-width: 100%;
}

.mud-dialog.court-person-dialog .court-secondary-row__name {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 11rem;
    font-size: 0.8rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mud-dialog.court-person-dialog .court-secondary-row--add .court-secondary-add__select {
    min-width: 11rem;
    flex: 0 1 14rem;
}

.mud-dialog.court-person-dialog .court-secondary-row .court-skill-num,
.mud-dialog.court-person-dialog .court-secondary-add .court-skill-num {
    max-width: 4.5rem;
    flex: 0 0 4.5rem;
}

.mud-dialog.court-person-dialog .court-skill-num--bare .mud-input-control {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.mud-dialog.court-person-dialog .court-skill-num--bare .mud-input-control-helper-container {
    display: none;
}

.mud-dialog.court-person-dialog .court-skill-num--bare .mud-input > input {
    text-align: center;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* ---- Bottom "Barony Tabs" bar (Excel-like tabs) ---- */
.barony-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 0 8px;
    height: 40px;
    background: var(--barony-surface-2);
    border-top: 2px solid var(--barony-border-strong);
    overflow-x: auto;
    box-shadow: 0 -2px 6px rgba(47, 42, 36, 0.12);
}

/* Above fixed barony tab bar (z-index 1500) and clear of its height. */
.mud-snackbar-location-bottom-right,
.mud-snackbar-location-bottom-left,
.mud-snackbar-location-bottom-center {
    z-index: 2000 !important;
    bottom: 3.25rem !important;
}

.barony-tabbar__tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    margin-top: 4px;
    border: 1px solid var(--barony-border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: var(--barony-surface);
    color: var(--barony-ink);
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: grab;
    text-decoration: none;
    user-select: none;
}

/* Keep DnD hit-testing on the tab itself (MudIcon otherwise steals drag/drop). */
.barony-tabbar__tab > * {
    pointer-events: none;
}

.barony-tabbar__tab:hover {
    background: var(--barony-accent-soft);
    color: var(--barony-ink);
    text-decoration: none;
}

.barony-tabbar__tab--dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.barony-tabbar__tab--drop-target {
    box-shadow: inset 0 0 0 2px var(--barony-accent, #c4a35a);
    background: var(--barony-accent-soft);
}

.barony-tabbar__tab--active {
    background: var(--barony-surface);
    border-color: var(--barony-border-strong);
    border-bottom: 3px solid var(--barony-accent);
    font-weight: 700;
    margin-top: 0;
}

.barony-terrain-grid-wrap {
    position: relative;
    width: max-content;
}

.barony-terrain-grid {
    display: grid;
    gap: 1px;
    background: color-mix(in srgb, var(--barony-border) 55%, transparent);
    /* column count is set inline (repeat() count cannot be a CSS variable) */
    width: max-content;
    box-sizing: border-box;
}

/* Fill remaining viewport so map scrollbars sit at the bottom of the visible page
   (above the fixed tabbar), instead of only at the far bottom of a tall grid. */
.terrain-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 64px - 12px - 96px);
}

.terrain-page > .barony-terrain-map {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

.barony-terrain-map__scroll {
    flex: 1 1 auto;
    min-height: 12rem;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    padding: 4px 0 8px 0;
}

.barony-terrain-map {
    width: 100%;
    max-width: 100%;
}

.barony-terrain-cell {
    position: relative;
    width: var(--terrain-cell-size, 90px);
    height: var(--terrain-cell-size, 90px);
    box-sizing: border-box;
    padding: 0;
    border: none;
    border-radius: 0;
    cursor: pointer;
    overflow: hidden;
    background: var(--barony-surface);
}

.barony-terrain-cell__layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.barony-terrain-cell__fertility {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    z-index: 1;
}

.barony-terrain-cell__fertility-value {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--barony-ink);
    text-shadow: 0 0 2px rgba(251, 248, 241, 0.9);
    padding-left: 3px;
}

.barony-terrain-cell__terrain-type {
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.barony-terrain-cell__base-icon {
    opacity: 0.32;
    color: var(--barony-ink);
    font-size: 2.325rem !important;
    width: 2.325rem !important;
    height: 2.325rem !important;
}

.barony-terrain-cell__base-icon--water {
    color: #1f6f98;
    opacity: 0.38;
}

.barony-terrain-cell__base-icon--hills {
    color: #6b8f4e;
    opacity: 0.34;
}

.barony-terrain-cell__base-icon--img {
    width: 2.55rem;
    height: 1.275rem;
    object-fit: contain;
    opacity: 0.34;
}

.barony-terrain-cell__base-icon--img.barony-terrain-cell__base-icon--hills {
    opacity: 0.38;
}

.barony-terrain-cell__base-icon--mountains {
    color: #5c5650;
    opacity: 0.36;
}

.barony-terrain-cell__base-icon--plains {
    color: #7a9a4a;
    opacity: 0.28;
    font-size: 1.55rem !important;
    width: 1.55rem !important;
    height: 1.55rem !important;
}

.barony-terrain-cell__feature-icon {
    position: absolute;
    opacity: 0.55;
    width: 1.275rem;
    height: 1.275rem;
    font-size: 1.275rem !important;
    object-fit: contain;
}

.barony-terrain-cell__feature-icon--forest {
    right: 2px;
    top: 2px;
    width: 1.575rem;
    height: 1.575rem;
    opacity: 0.5;
}

.barony-terrain-cell__feature-row--dense-forest {
    position: absolute;
    left: 50%;
    top: 2px;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    pointer-events: none;
}

.barony-terrain-cell__feature-icon--dense-forest {
    position: relative;
    width: 1.425rem;
    height: 1.425rem;
    opacity: 0.5;
    margin-left: -0.42rem;
}

.barony-terrain-cell__feature-icon--dense-forest:first-child {
    margin-left: 0;
}

.barony-terrain-cell__feature-icon--swamp {
    right: 2px;
    top: 2px;
    opacity: 0.55;
}

.barony-terrain-cell__feature-icon--river {
    left: 2px;
    bottom: 2px;
    color: #1f6f98;
    opacity: 0.7;
}

.barony-terrain-cell__feature-icon--coast {
    left: 2px;
    top: 2px;
    color: #1f6f98;
    opacity: 0.7;
}

.barony-terrain-cell__domain {
    z-index: 7;
}

.barony-terrain-cell__fief {
    z-index: 4;
    box-shadow: inset 0 0 0 2px rgba(47, 42, 36, 0.15);
}

.barony-terrain-cell__resource {
    z-index: 8;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 3px;
    pointer-events: none;
}

.barony-terrain-cell__resource-icon,
.terrain-resource-option__icon,
.barony-resource-hud__icon {
    display: inline-block;
    flex-shrink: 0;
    background-color: var(--resource-color, #888);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    opacity: 1;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55));
}

.barony-terrain-cell__resource-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.barony-terrain-cell__resource-icon--img,
.terrain-resource-option__icon--img,
.trade-good-icon--img {
    display: block;
    object-fit: contain;
    background: none;
    -webkit-mask-image: none;
    mask-image: none;
    filter: none;
}

.terrain-resource-option__icon,
.barony-resource-hud__icon {
    width: 1.25rem;
    height: 1.25rem;
}

.terrain-resource-option__icon--img {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.barony-terrain-cell__improvement {
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    pointer-events: none;
    isolation: isolate;
}

.barony-terrain-cell__improvement-icon {
    width: 1.69rem;
    height: 1.69rem;
    object-fit: contain;
    opacity: 0.95;
    filter: drop-shadow(0 0 1.5px rgba(251, 248, 241, 0.95))
            drop-shadow(0 1px 2px rgba(47, 42, 36, 0.35));
}

.barony-terrain-cell__improvement-icon--town {
    width: 2.7rem;
    height: 2.7rem;
    /* Warm copper / roof-tile — stands out from black resource icons */
    filter: invert(28%) sepia(55%) saturate(1200%) hue-rotate(345deg) brightness(0.95)
            drop-shadow(0 0 1.5px rgba(251, 248, 241, 0.95))
            drop-shadow(0 1px 2px rgba(47, 42, 36, 0.4));
}

.barony-terrain-cell__improvement-icon--village {
    width: 2rem;
    height: 2rem;
    /* Forest green cabin — quieter than towns, distinct from farms/mines */
    filter: invert(32%) sepia(28%) saturate(900%) hue-rotate(55deg) brightness(0.9)
            drop-shadow(0 0 1.5px rgba(251, 248, 241, 0.95))
            drop-shadow(0 1px 2px rgba(47, 42, 36, 0.35));
}

.barony-terrain-cell__improvement-icon--construction {
    width: 1.69rem;
    height: 1.69rem;
}

.barony-terrain-cell__build-hint {
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.barony-terrain-cell__build-hint-icon {
    width: 2.1rem;
    height: 2.1rem;
    object-fit: contain;
    opacity: 0.42;
    filter: drop-shadow(0 0 1.5px rgba(251, 248, 241, 0.85));
}

.barony-terrain-cell--clickable {
    cursor: pointer;
}

.terrain-build-project-cost {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.9rem;
    color: var(--barony-ink);
}

.barony-terrain-cell__improvement-name {
    max-width: calc(100% - 4px);
    padding: 0 2px;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--barony-ink);
    text-align: center;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
    word-break: break-word;
    text-shadow:
        0 0 2px rgba(251, 248, 241, 0.95),
        0 0 3px rgba(251, 248, 241, 0.9);
}

.barony-terrain-cell__improvement-name--town {
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.05;
    color: #6b2a12;
    letter-spacing: 0.01em;
    text-shadow:
        0 0 2px rgba(251, 248, 241, 1),
        0 0 4px rgba(251, 248, 241, 0.95),
        0 1px 1px rgba(251, 248, 241, 0.9);
}

.barony-terrain-cell__improvement-name--village {
    font-size: 0.64rem;
    font-weight: 700;
    line-height: 1.1;
    color: #2f4a22;
    text-shadow:
        0 0 2px rgba(251, 248, 241, 0.98),
        0 0 3px rgba(251, 248, 241, 0.9);
}

.terrain-improvement-option__icon {
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
    flex-shrink: 0;
}

.custom-improvement-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.custom-improvement-icon-picker__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0.25rem;
    border: 1px solid var(--barony-border);
    border-radius: 4px;
    background: var(--barony-surface);
    cursor: pointer;
}

.custom-improvement-icon-picker__btn--selected {
    border-color: var(--barony-accent, #8b6914);
    box-shadow: 0 0 0 2px var(--barony-accent-soft, rgba(139, 105, 20, 0.35));
}

.custom-improvement-icon-picker__img {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

.barony-terrain-map--hide-terrain-type .barony-terrain-cell__terrain-type {
    display: none;
}

.barony-terrain-map--hide-domain .barony-terrain-cell__domain {
    display: none;
}

.barony-terrain-map--hide-fief .barony-terrain-cell__fief {
    display: none;
}

.barony-terrain-map--hide-resources .barony-terrain-cell__resource {
    display: none;
}

.barony-terrain-map--hide-improvements .barony-terrain-cell__improvement {
    display: none;
}

.terrain-page__mg-editor .terrain-page__brushes {
    margin-bottom: 0;
}

.terrain-page__mg-editor .terrain-page__layers {
    margin-top: 12px;
    margin-bottom: 0;
}

.terrain-page__brushes {
    margin-bottom: 12px;
}

.terrain-brush-tabs {
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--barony-ink);
}

.terrain-brush-tabs.mud-tabs-rounded,
.terrain-brush-tabs.mud-tabs-border-bottom {
    border-radius: 0;
    border: none;
}

.terrain-brush-tabs .mud-tabs-tabbar {
    background: var(--barony-surface-2);
    border: 1px solid var(--barony-border-strong);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    min-height: 40px;
    height: 40px;
    box-shadow: none;
}

.terrain-brush-tabs .mud-tabs-tabbar-inner,
.terrain-brush-tabs .mud-tabs-tabbar-wrapper,
.terrain-brush-tabs .mud-tabs-tabbar-content {
    min-height: 40px;
    height: 40px;
    background: transparent;
    align-items: stretch;
}

.terrain-brush-tabs .mud-tab {
    min-width: 0;
    min-height: 40px;
    height: 40px;
    padding: 0 14px;
    margin: 0;
    color: var(--barony-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.01em;
    opacity: 1;
    border: 1px solid transparent;
    border-bottom: 3px solid transparent;
    border-radius: 6px 6px 0 0;
    background: transparent;
    box-sizing: border-box;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.terrain-brush-tabs .mud-tab:hover {
    background: var(--barony-accent-soft);
    color: var(--barony-ink);
}

.terrain-brush-tabs .mud-tab.mud-tab-active {
    color: var(--barony-ink);
    font-weight: 700;
    background: var(--barony-surface);
    border-color: var(--barony-border-strong);
    border-bottom-color: var(--barony-accent);
}

.terrain-brush-tabs .mud-tab-slider {
    display: none;
}

.terrain-brush-tabs .mud-tabs-panels {
    background: var(--barony-surface);
    border: 1px solid var(--barony-border-strong);
    border-radius: 0 0 6px 6px;
    padding: 10px 12px 12px;
    box-shadow: 0 1px 2px rgba(47, 42, 36, 0.06);
}

.terrain-page__layers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.terrain-page__layers .terrain-layer-chip.mud-chip {
    text-transform: none;
    letter-spacing: 0.01em;
    font-weight: 600;
    border-color: var(--barony-border-strong) !important;
    color: var(--barony-ink) !important;
    background: var(--barony-surface) !important;
}

.terrain-page__layers .terrain-layer-chip--on.mud-chip {
    background: var(--barony-accent) !important;
    border-color: var(--barony-accent) !important;
    color: var(--barony-surface, #fbf8f1) !important;
}

.terrain-page__layers .terrain-layer-chip.mud-chip:hover:not(.mud-disabled) {
    background: var(--barony-accent-soft) !important;
}

.terrain-page__layers .terrain-layer-chip--on.mud-chip:hover:not(.mud-disabled) {
    background: #866828 !important;
    border-color: #866828 !important;
    color: var(--barony-surface, #fbf8f1) !important;
}

.terrain-page__selection {
    margin-bottom: 10px;
}

.terrain-page__tile-info {
    min-height: 38px;
    margin-bottom: 10px;
}

.terrain-page__tile-info-alert {
    margin: 0 !important;
}

.terrain-page__summary {
    font-size: 0.85rem;
    color: var(--barony-muted);
}

.terrain-brush {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
}

.terrain-brush__hint {
    color: var(--barony-muted) !important;
    margin: 0 !important;
}

.terrain-brush__body {
    display: flex;
    flex: 1 1 auto;
    align-items: flex-start;
    min-height: 64px;
}

.terrain-map-size {
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.terrain-map-size__current {
    font-size: 0.9rem;
    color: var(--barony-ink, #1c1a16);
}

.terrain-map-size__limits {
    margin-left: 6px;
    color: var(--barony-muted);
    font-size: 0.8rem;
}

.terrain-map-size__amount {
    max-width: 160px;
}

.terrain-map-size__amount-field {
    margin: 0 !important;
}

.terrain-map-size__pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px;
}

.terrain-map-size__middle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.terrain-map-size__edge {
    display: flex;
    align-items: center;
    gap: 2px;
}

.terrain-map-size__edge--top,
.terrain-map-size__edge--bottom {
    flex-direction: row;
}

.terrain-map-size__edge--left,
.terrain-map-size__edge--right {
    flex-direction: column;
}

.terrain-map-size__edge-label {
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-muted);
    margin-right: 4px;
}

.terrain-map-size__edge--left .terrain-map-size__edge-label,
.terrain-map-size__edge--right .terrain-map-size__edge-label {
    margin-right: 0;
    margin-bottom: 2px;
}

.terrain-map-size__preview {
    min-width: 88px;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed color-mix(in srgb, var(--barony-muted) 55%, transparent);
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--barony-ink, #1c1a16);
    background: color-mix(in srgb, var(--barony-panel, #f3efe6) 80%, transparent);
}

.terrain-brush__body--split {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    align-items: flex-start;
}

.terrain-brush__group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.terrain-brush__label {
    color: var(--barony-muted) !important;
    margin: 0 !important;
}

.terrain-brush__options {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
}

.terrain-type-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    box-sizing: border-box;
    padding: 6px 10px;
    border: 2px solid var(--barony-border-strong);
    border-radius: 6px;
    background: var(--barony-surface-2);
    color: var(--barony-ink);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.1;
}

.terrain-type-option--selected {
    border-color: var(--barony-accent);
    outline: 2px solid var(--barony-accent);
    outline-offset: 1px;
}

.terrain-resource-option {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    width: 5.75rem;
    max-width: 5.75rem;
    height: auto;
    min-height: 3.25rem;
    padding: 6px 6px;
    text-align: center;
    white-space: normal;
    overflow: visible;
}

.terrain-resource-option__label {
    display: block;
    width: 100%;
    min-width: 0;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.15;
}

.terrain-type-option .mud-icon-root {
    width: 1.25rem !important;
    height: 1.25rem !important;
    font-size: 1.25rem !important;
    flex-shrink: 0;
}

.terrain-type-option__icon {
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
    opacity: 0.7;
    flex-shrink: 0;
}

.terrain-type-option__icon-cluster {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    height: 1.25rem;
}

.terrain-type-option__icon-cluster--dense-forest .terrain-type-option__icon--clustered {
    width: 1.1rem;
    height: 1.1rem;
    margin-left: -0.38rem;
    opacity: 0.75;
}

.terrain-type-option__icon-cluster--dense-forest .terrain-type-option__icon--clustered:first-child {
    margin-left: 0;
}

.terrain-fertility-swatch {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid var(--barony-border-strong);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--barony-ink);
    text-shadow: 0 0 2px rgba(251, 248, 241, 0.9);
    box-shadow: inset 0 0 0 1px rgba(47, 42, 36, 0.12);
}

.terrain-fertility-swatch--unknown {
    font-size: 1.1rem;
    line-height: 1;
}

.terrain-fertility-swatch--selected {
    border-color: var(--barony-accent);
    outline: 2px solid var(--barony-accent);
    outline-offset: 1px;
    transform: scale(1.06);
}

.barony-terrain-map--paint .barony-terrain-cell {
    cursor: crosshair;
    user-select: none;
    touch-action: none;
}

.terrain-domain-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 2px solid var(--barony-border-strong);
    border-radius: 6px;
    background: var(--barony-surface-2);
    cursor: pointer;
    max-width: 220px;
}

.terrain-domain-chip-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.terrain-domain-chip--selected {
    border-color: var(--barony-accent);
    outline: 2px solid var(--barony-accent);
    outline-offset: 1px;
}

.terrain-domain-chip__swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(47, 42, 36, 0.15);
}

.terrain-domain-chip__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.15;
}

.terrain-domain-chip__name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--barony-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.terrain-domain-chip__lord {
    font-size: 0.68rem;
    color: var(--barony-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.terrain-domain-chip__color-input {
    width: 30px;
    height: 30px;
    border: 2px solid var(--barony-border-strong);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.terrain-domain-chip__color-input:hover {
    border-color: var(--barony-accent);
}

.terrain-domain-color-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.terrain-domain-custom-color {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 2px dashed var(--barony-border-strong);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

.terrain-domain-color-input {
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.barony-terrain-cell--hovered {
    outline: 2px solid var(--barony-accent);
    outline-offset: -2px;
    z-index: 1;
}

.barony-terrain-tooltip {
    --tooltip-gap: 1px;
    position: absolute;
    z-index: 30;
    left: calc(var(--tooltip-x) * (var(--terrain-cell-size) + var(--tooltip-gap)) + var(--terrain-cell-size) / 2);
    top: calc(var(--tooltip-y) * (var(--terrain-cell-size) + var(--tooltip-gap)));
    transform: translate(-50%, calc(-100% - 8px));
    min-width: 9rem;
    max-width: 16rem;
    padding: 8px 10px;
    background: linear-gradient(180deg, var(--barony-surface) 0%, var(--barony-surface-2) 100%);
    border: 1px solid var(--barony-border-strong);
    border-radius: 6px;
    box-shadow:
        0 2px 8px rgba(47, 42, 36, 0.18),
        inset 0 1px 0 rgba(251, 248, 241, 0.7);
    color: var(--barony-ink);
    pointer-events: none;
    white-space: normal;
}

.barony-terrain-tooltip--below {
    transform: translate(-50%, calc(var(--terrain-cell-size) + 8px));
}

.barony-terrain-tooltip--start {
    left: calc(var(--tooltip-x) * (var(--terrain-cell-size) + var(--tooltip-gap)));
    transform: translate(0, calc(-100% - 8px));
}

.barony-terrain-tooltip--start.barony-terrain-tooltip--below {
    transform: translate(0, calc(var(--terrain-cell-size) + 8px));
}

.barony-terrain-tooltip--end {
    left: calc(var(--tooltip-x) * (var(--terrain-cell-size) + var(--tooltip-gap)) + var(--terrain-cell-size));
    transform: translate(-100%, calc(-100% - 8px));
}

.barony-terrain-tooltip--end.barony-terrain-tooltip--below {
    transform: translate(-100%, calc(var(--terrain-cell-size) + 8px));
}

.barony-terrain-tooltip__title {
    font-family: 'Eagle Lake', serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--barony-accent);
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--barony-border);
}

.barony-terrain-tooltip__line {
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--barony-ink);
}

.barony-terrain-tooltip__line + .barony-terrain-tooltip__line {
    margin-top: 2px;
}

/* ---- Buildings catalog ---- */
.mud-main-content:has(.barony-scope--buildings-catalog) {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
}

.barony-scope--buildings-catalog {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    min-height: 0;
    overflow: hidden;
    padding: 8px 12px 48px 12px;
}

.buildings-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.buildings-page__intro {
    flex-shrink: 0;
    margin-bottom: 8px !important;
}

.barony-scope--buildings-catalog .barony-page-header {
    flex-shrink: 0;
    margin: 0 0 8px 0;
    padding-bottom: 6px;
}

.buildings-page__table-area {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.buildings-catalog-count {
    font-size: 0.85rem;
    color: var(--barony-muted);
}

.buildings-catalog-scroll {
    flex: 1 1 auto;
    min-height: 0;
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: auto;
    scrollbar-gutter: stable;
    border: 1px solid var(--barony-border);
    border-radius: 8px;
    background: var(--barony-surface);
    overscroll-behavior: contain;
}

.ppb-table--catalog {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

/* Vertical stick: whole thead moves as one block (fixes rowspan "Name" corner). */
.ppb-table--catalog thead {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--barony-surface);
}

.ppb-table--catalog thead th {
    position: static;
    top: auto;
    border-bottom: none;
    box-shadow: none;
}

.ppb-table--catalog thead tr:first-child th:not([rowspan]) {
    box-shadow: inset 0 -1px 0 var(--barony-border);
}

.ppb-table--catalog thead tr:first-child th[rowspan="2"] {
    vertical-align: middle;
    box-shadow: inset 0 -2px 0 var(--barony-border-strong);
}

.ppb-table--catalog thead tr:nth-child(2) th {
    box-shadow: inset 0 -2px 0 var(--barony-border-strong);
}

.ppb-table--catalog .catalog-col-name,
.ppb-table--catalog .catalog-cell-name {
    min-width: 140px;
    width: 140px;
    max-width: 160px;
    text-align: left;
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
}

.ppb-table--catalog .catalog-cell-name {
    font-weight: 600;
}

.catalog-name-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    min-height: 1.5rem;
}

.catalog-name-cell__text {
    flex: 1 1 auto;
    min-width: 0;
}

.catalog-name-cell__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.catalog-name-cell__build {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: transparent;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.12s ease, background 0.12s ease;
}

.catalog-name-cell__build:hover {
    opacity: 1;
    background: rgba(47, 42, 36, 0.08);
}

.catalog-name-cell__build--edit {
    color: #7a6020;
}

.catalog-name-cell__build--delete {
    color: #8c3434;
}

.catalog-name-cell__build-icon {
    width: 0.95rem;
    height: 0.95rem;
    display: block;
    object-fit: contain;
}

.ppb-table--catalog .catalog-col-lordship {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
}

.ppb-table--catalog .catalog-col-kind {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

.ppb-table--catalog .catalog-col-cost {
    width: 55px;
    min-width: 55px;
    max-width: 55px;
}

.ppb-table--catalog .catalog-col-desc {
    min-width: 320px;
    width: 360px;
    max-width: 480px;
    white-space: normal;
    word-break: break-word;
    text-align: left;
    vertical-align: top;
}

.ppb-table--catalog .catalog-desc__body {
    margin-bottom: 0.35em;
    line-height: 1.35;
}

.ppb-table--catalog .catalog-desc__produces {
    margin-top: 0.15em;
    line-height: 1.3;
    color: var(--barony-ink, #2f2a24);
}

.ppb-table--catalog .catalog-desc__requires {
    margin-top: 0.15em;
    line-height: 1.3;
    color: var(--barony-muted, #6b635a);
}

.ppb-table--catalog thead th.catalog-col-name {
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--barony-surface);
    box-shadow:
        2px 0 4px rgba(47, 42, 36, 0.06),
        inset 0 -2px 0 var(--barony-border-strong);
}

.ppb-table--catalog tbody td.catalog-col-name {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--barony-surface);
    box-shadow: 2px 0 4px rgba(47, 42, 36, 0.06);
}

.ppb-table--catalog tbody tr:hover td.catalog-col-name {
    background: var(--barony-accent-soft);
}

.buildings-catalog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
    margin-bottom: 8px;
}

.buildings-catalog-filters__name {
    flex: 1 1 220px;
    max-width: 360px;
}

.buildings-catalog-filters__kind {
    flex: 0 1 180px;
    min-width: 160px;
}

.buildings-catalog-filters__add {
    flex-shrink: 0;
    margin-bottom: 2px;
}

.building-template-dialog__row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.building-template-dialog__lordship {
    flex: 0 1 120px;
    min-width: 100px;
}

.building-template-dialog__kind {
    flex: 1 1 160px;
    min-width: 140px;
}

.building-template-dialog__cost {
    flex: 1 1 140px;
    min-width: 120px;
}

.ppb-table--catalog .catalog-th--sortable {
    cursor: pointer;
    user-select: none;
}

.ppb-table--catalog .catalog-th--sortable:hover {
    background: var(--barony-accent-soft);
}

/* ---- Relations tab ---- */
.relations-table {
    min-width: 900px;
    width: 100%;
    table-layout: fixed;
}

.relations-table th,
.relations-table td {
    vertical-align: middle;
}

.relations-table col.relations-col-group { width: 150px; }
.relations-table col.relations-col-name { width: 170px; }
.relations-table col.relations-col-title { width: 130px; }
.relations-table col.relations-col-age { width: 48px; }
.relations-table col.relations-col-desc { width: 320px; }
.relations-table col.relations-col-troops { width: 64px; }
.relations-table col.relations-col-attitude { width: 88px; }
.relations-table col.relations-col-mods { width: 88px; }

/* Override .ppb-table nowrap so text columns can clamp instead of spilling. */
.relations-table th.relations-col-group,
.relations-table td.relations-col-group,
.relations-table th.relations-col-name,
.relations-table td.relations-col-name,
.relations-table th.relations-col-title,
.relations-table td.relations-col-title,
.relations-table th.relations-col-desc,
.relations-table td.relations-col-desc {
    text-align: left;
    white-space: normal;
    overflow: hidden;
    /* Forces fixed-layout columns to honor <col> widths with long content. */
    max-width: 0;
}

.relations-col-age { text-align: center; white-space: nowrap; }
.relations-col-troops { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.relations-col-attitude { white-space: nowrap; }
.relations-col-mods {
    white-space: nowrap;
    text-align: center;
}

.relations-group-cell {
    font-weight: 600;
    color: var(--barony-ink);
    border-right: 1px solid var(--barony-line, rgba(0, 0, 0, 0.12));
    background: color-mix(in srgb, var(--barony-surface, transparent) 88%, var(--barony-accent-soft, transparent));
}

.relations-ellipsis {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.35;
}

.relations-table td.relations-col-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.relations-col-desc .barony-tip-anchor {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.relations-col-desc > .mud-tooltip-root {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.relations-attitude {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.relations-attitude-score {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.relations-attitude-label {
    font-size: 0.78em;
    color: var(--barony-muted);
}

.relations-attitude--pos .relations-attitude-score,
.relations-attitude--pos {
    color: var(--barony-pos);
}

.relations-attitude--neg .relations-attitude-score,
.relations-attitude--neg {
    color: var(--barony-neg);
}

.relations-mods-cell {
    display: flex;
    align-items: center;
    gap: 2px;
    justify-content: center;
}

.relations-mods-count {
    font-variant-numeric: tabular-nums;
    min-width: 1.25ch;
    text-align: center;
}

.relation-notes-dialog .relation-notes-field textarea {
    min-height: 280px;
}

.relation-edit-dialog .relation-modifiers {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--barony-line, rgba(0, 0, 0, 0.12));
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.relation-modifiers__header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.relation-modifiers__title {
    font-weight: 600;
}

.relation-modifiers__sum {
    font-variant-numeric: tabular-nums;
    font-size: 0.9em;
}

.relation-modifiers__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

.relation-modifiers__desc {
    flex: 1 1 220px;
}

.relation-modifiers__value {
    flex: 0 0 110px;
}


.ppb-table--catalog .catalog-th--sorted {
    color: var(--barony-accent);
}

.ppb-table--catalog .catalog-sort-indicator {
    font-size: 0.65rem;
    opacity: 0.85;
}

/* ---- Lord's Seat tab ---- */
.lords-seat-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.lords-seat-levelbar,
.lords-seat-paintbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.lords-seat-levelbar__label {
    font-size: 0.78rem;
    color: var(--barony-muted);
    margin-right: 4px;
}

.lords-seat-levelbar__label--add {
    margin-left: 6px;
}

.lords-seat-levelchip,
.lords-seat-paintchip {
    border: 1px solid var(--barony-border);
    background: var(--barony-surface);
    color: var(--barony-ink);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.78rem;
    line-height: 1.4;
    cursor: pointer;
}

.lords-seat-levelchip--add {
    color: var(--barony-muted);
    border-style: dashed;
}

.lords-seat-levelchip--active,
.lords-seat-paintchip--active {
    border-color: var(--barony-border-strong);
    box-shadow: inset 0 0 0 1px var(--barony-border-strong);
    font-weight: 600;
}

.lords-seat-paintchip--wall {
    background: #5c5852;
    color: #f4f1ea;
}

.lords-seat-paintchip--ground {
    background: #8a6a45;
    color: #f7f1e4;
}

.lords-seat-paintchip--water {
    background: #3a7ca5;
    color: #eaf4fa;
}

.lords-seat-plan__paint {
    z-index: 0;
    width: var(--seat-tile);
    height: var(--seat-tile);
    border-radius: 0;
    pointer-events: none;
    box-sizing: border-box;
}

.lords-seat-plan__paint--wall {
    background: #4a4742 !important;
}

.lords-seat-plan__paint--ground {
    background: #9a7344 !important;
}

.lords-seat-plan__paint--water {
    background:
        repeating-linear-gradient(
            135deg,
            #4a90b8,
            #4a90b8 5px,
            #3a7ca5 5px,
            #3a7ca5 10px
        ) !important;
}

.lords-seat-plan--painting .lords-seat-plan__cell {
    cursor: crosshair;
    position: relative;
    z-index: 4;
}

.lords-seat-plan--painting .lords-seat-plan__room,
.lords-seat-plan--painting .lords-seat-plan__room-slot {
    pointer-events: none;
    opacity: 0.55;
}

.lords-seat-plan-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}

.lords-seat-plan {
    --seat-tile: 32px;
    display: grid;
    grid-template-columns: repeat(var(--seat-cols, 12), var(--seat-tile));
    grid-template-rows: repeat(var(--seat-rows, 8), var(--seat-tile));
    gap: 0;
    width: max-content;
    max-width: 100%;
    padding: 8px;
    background: var(--barony-surface-2);
    border: 1px solid var(--barony-border);
    border-radius: 6px;
    position: relative;
}

.lords-seat-plan--editable {
    user-select: none;
}

.lords-seat-plan--dragging .lords-seat-plan__room,
.lords-seat-plan--dragging .lords-seat-plan__room-slot {
    pointer-events: none;
}

.lords-seat-placement-hint {
    margin-bottom: 8px;
    color: var(--barony-muted);
}

.lords-seat-plan__cell {
    z-index: 1;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    background: transparent;
}

.lords-seat-plan__cell-slot {
    z-index: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.lords-seat-plan__cell-slot .mud-tooltip-root,
.lords-seat-plan__cell-slot .barony-tip-anchor {
    display: block;
    width: 100%;
    height: 100%;
}

.lords-seat-plan__cell--placement {
    cursor: crosshair;
}

.lords-seat-plan__cell--placement:hover {
    background: color-mix(in srgb, var(--barony-accent-soft) 45%, transparent);
}

.lords-seat-plan__cell--drop-target {
    background: transparent;
}

.lords-seat-plan__ghost {
    z-index: 2;
    pointer-events: none;
    border-radius: 4px;
    border: 2px dashed transparent;
    box-sizing: border-box;
}

.lords-seat-plan__ghost--valid {
    background: color-mix(in srgb, #2a8 22%, transparent);
    border-color: color-mix(in srgb, #2a8 70%, transparent);
}

.lords-seat-plan__ghost--invalid {
    background: color-mix(in srgb, #c44 22%, transparent);
    border-color: #b33;
}

.lords-seat-plan__ghost--overlap {
    background: repeating-linear-gradient(
        -45deg,
        color-mix(in srgb, #c44 18%, transparent),
        color-mix(in srgb, #c44 18%, transparent) 5px,
        color-mix(in srgb, #a22 28%, transparent) 5px,
        color-mix(in srgb, #a22 28%, transparent) 10px
    );
    border-color: #a22;
}

.lords-seat-plan__room-slot {
    z-index: 2;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.lords-seat-plan__room-slot .mud-tooltip-root {
    display: block;
    width: 100%;
    height: 100%;
}

.lords-seat-plan__room-tip.barony-tip-anchor {
    display: block;
    width: 100%;
    height: 100%;
}

.lords-seat-plan__room {
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 2px 4px;
    overflow: hidden;
    border: 1px solid var(--barony-border-strong);
    border-radius: 4px;
    background: var(--barony-accent-soft);
    color: var(--barony-ink);
    font-size: 0.72rem;
    line-height: 1.2;
    text-align: center;
}

.lords-seat-plan--editable .lords-seat-plan__room {
    cursor: grab;
}

.lords-seat-plan__room--clickable {
    cursor: pointer;
}

.lords-seat-plan--editable .lords-seat-plan__room--clickable {
    cursor: grab;
}

.lords-seat-plan--editable .lords-seat-plan__room:active {
    cursor: grabbing;
}

.lords-seat-plan__room--dragging {
    opacity: 0.55;
}

.lords-seat-plan__room-purpose {
    font-weight: 700;
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.15;
}

.lords-seat-plan__room-name {
    font-weight: 500;
    font-size: 0.68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    opacity: 0.9;
}

.lords-seat-plan__room-meta {
    font-size: 0.6rem;
    color: var(--barony-muted);
}

.lords-seat-plan__room--layout-valid {
    border-color: color-mix(in srgb, var(--barony-ink) 25%, var(--barony-border-strong));
}

.lords-seat-plan__room--layout-invalid {
    background: color-mix(in srgb, #c44 18%, var(--barony-accent-soft));
    border-color: #b33;
    color: color-mix(in srgb, #822 70%, var(--barony-ink));
}

.lords-seat-plan__room--layout-overlap {
    background: repeating-linear-gradient(
        -45deg,
        color-mix(in srgb, #c44 14%, var(--barony-accent-soft)),
        color-mix(in srgb, #c44 14%, var(--barony-accent-soft)) 5px,
        color-mix(in srgb, #a22 24%, var(--barony-accent-soft)) 5px,
        color-mix(in srgb, #a22 24%, var(--barony-accent-soft)) 10px
    );
    border-color: #a22;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #c44 35%, transparent);
}

.lords-seat-plan__room--ruin {
    background: repeating-linear-gradient(
        -45deg,
        color-mix(in srgb, var(--barony-muted) 12%, transparent),
        color-mix(in srgb, var(--barony-muted) 12%, transparent) 6px,
        color-mix(in srgb, var(--barony-muted) 22%, transparent) 6px,
        color-mix(in srgb, var(--barony-muted) 22%, transparent) 12px
    );
    border-style: dashed;
    opacity: 0.85;
}

.lords-seat-table-wrap {
    overflow-x: auto;
}

/* Lord's Seat tables: shared pre-PPB width so PPB columns start aligned (Domain Panel pattern). */
.lords-seat-table,
.lords-seat-templates-table {
    --barony-pre-ppb-width: 550px;
    --barony-ppb-subcol-width: 28px;
    --lords-seat-size-width: 44px;
    --lords-seat-prestige-width: 88px;
    table-layout: fixed;
    width: max-content;
    min-width: 100%;
}

.lords-seat-table {
    --lords-seat-name-width: 140px;
    --lords-seat-purpose-width: 128px;
    --lords-seat-level-width: 40px;
    --lords-seat-size-width: 44px;
    --lords-seat-occupant-width: calc(
        var(--barony-pre-ppb-width)
        - var(--lords-seat-name-width)
        - var(--lords-seat-purpose-width)
        - var(--lords-seat-level-width)
        - var(--lords-seat-size-width)
        - var(--lords-seat-prestige-width)
    );
}

.lords-seat-templates-table {
    --lords-seat-name-width: 168px;
    --lords-seat-desc-width: calc(
        var(--barony-pre-ppb-width)
        - var(--lords-seat-name-width)
        - var(--lords-seat-size-width)
        - var(--lords-seat-prestige-width)
    );
}

.lords-seat-table th,
.lords-seat-table td,
.lords-seat-templates-table th,
.lords-seat-templates-table td {
    vertical-align: middle;
    box-sizing: border-box;
}

.lords-seat-table col.lords-seat-col-name,
.lords-seat-templates-table col.lords-seat-templates-col-name {
    width: var(--lords-seat-name-width);
}

.lords-seat-table col.lords-seat-col-purpose {
    width: var(--lords-seat-purpose-width);
}

.lords-seat-table col.lords-seat-col-level {
    width: var(--lords-seat-level-width);
}

.lords-seat-table col.lords-seat-col-size,
.lords-seat-templates-table col.lords-seat-templates-col-size {
    width: var(--lords-seat-size-width);
}

.lords-seat-table col.lords-seat-col-occupant {
    width: var(--lords-seat-occupant-width);
}

.lords-seat-templates-table col.lords-seat-templates-col-desc {
    width: var(--lords-seat-desc-width);
}

.lords-seat-table col.lords-seat-col-prestige,
.lords-seat-templates-table col.lords-seat-templates-col-prestige {
    width: var(--lords-seat-prestige-width);
}

.lords-seat-table col.ppb-pair-col,
.lords-seat-templates-table col.ppb-pair-col {
    width: var(--barony-ppb-subcol-width);
}

.lords-seat-table th.lords-seat-col-name,
.lords-seat-table td.lords-seat-col-name,
.lords-seat-templates-table th.lords-seat-templates-col-name,
.lords-seat-templates-table td.lords-seat-templates-col-name {
    min-width: var(--lords-seat-name-width);
    width: var(--lords-seat-name-width);
    max-width: var(--lords-seat-name-width);
    text-align: left;
    overflow: hidden;
    white-space: normal;
    vertical-align: middle;
}

.lords-seat-table th.lords-seat-col-purpose,
.lords-seat-table td.lords-seat-col-purpose {
    min-width: var(--lords-seat-purpose-width);
    width: var(--lords-seat-purpose-width);
    max-width: var(--lords-seat-purpose-width);
    text-align: left;
    overflow: hidden;
    white-space: normal;
    vertical-align: middle;
}

.lords-seat-table th.lords-seat-col-level,
.lords-seat-table td.lords-seat-col-level {
    min-width: var(--lords-seat-level-width);
    width: var(--lords-seat-level-width);
    max-width: var(--lords-seat-level-width);
    white-space: nowrap;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.lords-seat-table th.lords-seat-col-size,
.lords-seat-table td.lords-seat-col-size,
.lords-seat-templates-table th.lords-seat-templates-col-size,
.lords-seat-templates-table td.lords-seat-templates-col-size {
    min-width: var(--lords-seat-size-width);
    width: var(--lords-seat-size-width);
    max-width: var(--lords-seat-size-width);
    white-space: nowrap;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.lords-seat-table td.lords-seat-col-occupant--clickable,
.lords-seat-table td.lords-seat-col-occupant--clickable * {
    cursor: pointer !important;
}

.lords-seat-table td.lords-seat-col-occupant--clickable:hover {
    background: var(--barony-accent-soft);
}

.lords-seat-table th.lords-seat-col-occupant,
.lords-seat-table td.lords-seat-col-occupant {
    width: var(--lords-seat-occupant-width);
    min-width: 0;
    /* Forces fixed-layout tables to wrap instead of growing to the unwrapped text. */
    max-width: 0;
    text-align: center;
    white-space: normal !important;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: middle;
    line-height: 1.25;
}

.lords-seat-occupant-name {
    display: block;
    white-space: normal !important;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.25;
    text-align: center;
}

.lords-seat-table td.lords-seat-col-occupant .mud-tooltip-root,
.lords-seat-table th.lords-seat-col-occupant .mud-tooltip-root,
.lords-seat-table td.lords-seat-col-occupant .mud-tooltip-inline,
.lords-seat-table th.lords-seat-col-occupant .mud-tooltip-inline,
.lords-seat-table td.lords-seat-col-occupant .barony-tip-anchor,
.lords-seat-table th.lords-seat-col-occupant .barony-tip-anchor,
.lords-seat-table td.lords-seat-col-occupant .lords-seat-occupant-tip {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    overflow: visible;
}

.lords-seat-table td.lords-seat-col-occupant,
.lords-seat-table td.lords-seat-col-occupant * {
    white-space: normal !important;
}

.lords-seat-occupant-assign {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.lords-seat-table td.lords-seat-col-occupant.lords-seat-col-occupant--empty .mud-tooltip-root,
.lords-seat-table td.lords-seat-col-occupant.lords-seat-col-occupant--empty .mud-tooltip-inline,
.lords-seat-table td.lords-seat-col-occupant.lords-seat-col-occupant--empty .barony-tip-anchor {
    display: flex !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
}

.lords-seat-templates-table th.lords-seat-templates-col-desc,
.lords-seat-templates-table td.lords-seat-templates-col-desc {
    min-width: var(--lords-seat-desc-width);
    width: var(--lords-seat-desc-width);
    max-width: var(--lords-seat-desc-width);
    text-align: left;
    white-space: normal;
    overflow: hidden;
}

.lords-seat-table th.lords-seat-col-prestige,
.lords-seat-table td.lords-seat-col-prestige,
.lords-seat-templates-table th.lords-seat-templates-col-prestige,
.lords-seat-templates-table td.lords-seat-templates-col-prestige {
    min-width: var(--lords-seat-prestige-width);
    width: var(--lords-seat-prestige-width);
    max-width: var(--lords-seat-prestige-width);
    white-space: nowrap;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Prestige stacked grid may paint past the cell; don't let it widen the column / shift PPB. */
.lords-seat-table td.lords-seat-col-prestige {
    overflow: visible;
    position: relative;
    z-index: 1;
}

.lords-seat-table td.lords-seat-col-prestige:hover {
    z-index: 2;
}

.lords-seat-table td.lords-seat-col-prestige > .mud-tooltip-root {
    display: block;
    width: 0;
    min-width: 100%;
    max-width: none;
    overflow: visible;
    box-sizing: border-box;
}

.lords-seat-table td.lords-seat-col-prestige .seat-php-values--stacked {
    overflow: visible;
    max-width: none;
}

.lords-seat-table .ppb-subcol,
.lords-seat-templates-table .ppb-subcol,
.lords-seat-table tbody td:nth-child(n+7),
.lords-seat-templates-table tbody td:nth-child(n+5) {
    width: var(--barony-ppb-subcol-width);
    min-width: var(--barony-ppb-subcol-width);
    max-width: var(--barony-ppb-subcol-width);
    white-space: nowrap;
    text-align: center;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
}

.lords-seat-ellipsis {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    line-height: 1.35;
}

.lords-seat-templates-col-desc > .mud-tooltip-root {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.lords-seat-col-name .city-building-name-cell,
.lords-seat-col-purpose .city-building-name-cell,
.lords-seat-templates-col-name .city-building-name-cell {
    width: 100%;
    justify-content: flex-start;
    align-items: center;
}

.lords-seat-col-name .city-building-name-cell > .mud-tooltip-root,
.lords-seat-col-purpose .city-building-name-cell > .mud-tooltip-root,
.lords-seat-templates-col-name .city-building-name-cell > .mud-tooltip-root {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    text-align: left;
}

.lords-seat-col-name .city-building-name-text,
.lords-seat-col-purpose .city-building-name-text {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
}

.lords-seat-room-items {
    flex: 0 0 auto;
    margin-left: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--barony-muted);
    white-space: nowrap;
    cursor: default;
}

.lords-seat-occupant-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    text-align: center;
}

.lords-seat-occupant-items {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    font-size: 0.72rem;
    line-height: 1.25;
    color: var(--barony-muted);
    min-width: 0;
    max-width: 100%;
    width: 100%;
    text-align: center;
}

.lords-seat-occupant-item {
    display: block;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: center;
}

.lords-seat-occupant-item-name {
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
    text-align: center;
    text-decoration: underline dotted color-mix(in srgb, var(--barony-muted) 55%, transparent);
    text-underline-offset: 0.12em;
}

button.artifact-location-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.lords-seat-occupant-items-sep {
    color: var(--barony-muted);
}

.seat-occupant-treasures-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin: 0.75rem 0 0.25rem;
}

.seat-occupant-treasures-list {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.seat-occupant-treasure-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    min-width: 0;
}

.seat-occupant-treasure-row .mud-input-control,
.seat-occupant-treasure-row .mud-input-control-boolean-input,
.seat-occupant-treasure-row .mud-checkbox,
.seat-occupant-treasure-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    max-width: 100%;
    margin: 0;
}

.seat-occupant-treasure-row .mud-checkbox,
.seat-occupant-treasure-check .mud-checkbox {
    gap: 0.35rem;
}

.seat-occupant-treasure-copy {
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    min-width: 0;
}

.seat-occupant-treasure-name {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.seat-occupant-treasure-meta {
    color: var(--barony-muted);
    font-size: 0.85em;
}

.seat-occupant-treasure-row--on .seat-occupant-treasure-name {
    font-weight: 600;
}

.seat-occupant-treasure-row--disabled {
    opacity: 0.55;
}

.lords-seat-templates-col-name .city-building-name-text {
    text-align: left;
}

.lords-seat-row--ruin {
    color: var(--barony-muted);
}

.lords-seat-row--layout-invalid {
    background: color-mix(in srgb, #c44 6%, transparent);
}

.lords-seat-row--layout-overlap {
    background: color-mix(in srgb, #c44 10%, transparent);
}

.lords-seat-row--ruin .city-building-name-text {
    font-style: italic;
}

.lords-seat-table .lords-seat-row--ruin .ppb-cell-struck {
    text-decoration: line-through;
}

.lords-seat-status--ruin {
    color: var(--barony-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.lords-seat-tiles {
    color: var(--barony-muted);
    font-size: 0.78em;
}

.lords-seat-prestige-mult {
    color: var(--barony-muted);
    font-weight: 500;
    margin-left: 2px;
}

.lords-seat-actions {
    display: inline-flex;
    align-items: center;
    gap: 0;
    justify-content: flex-end;
}

.lords-seat-ppb-summary {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--barony-line, rgba(0, 0, 0, 0.12));
}

.seat-room-edit-dialog__grid-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.seat-room-prestige-hint {
    color: var(--barony-muted);
    margin: 0 0 8px;
    line-height: 1.45;
}

@media (max-width: 700px) {
    .seat-room-edit-dialog__grid-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.seat-room-traits {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--barony-line, rgba(0, 0, 0, 0.12));
}

.seat-room-traits__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 600;
}

.seat-room-traits__row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}

.seat-room-traits__kind {
    flex: 0 0 140px;
}

.seat-room-traits__text {
    flex: 1 1 auto;
}

.lords-seat-templates-wrap {
    overflow-x: auto;
}

/* ---- Known lords tab ---- */
.known-lords-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.known-lords-filters__search {
    flex: 1 1 260px;
    max-width: 420px;
}

.known-lords-mark-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    flex: 1 1 320px;
}

.known-lords-mark-filters__label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-muted);
}

.known-lords-mark-filters__icons,
.known-lords-mark-filters__colors {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
}

.known-lords-mark-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--barony-muted) 22%, transparent);
    background: rgba(0, 0, 0, 0.02);
    cursor: pointer;
    padding: 0;
}

.known-lords-mark-filter-btn--icon {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 4px;
    color: var(--barony-muted);
}

.known-lords-mark-filter-btn--color {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    background: var(--mark-color);
}

.known-lords-mark-filter-btn:hover {
    border-color: color-mix(in srgb, var(--barony-accent, #c4a35a) 45%, transparent);
}

.known-lords-mark-filter-btn--active.known-lords-mark-filter-btn--icon {
    border-color: var(--barony-accent, #c4a35a);
    background: color-mix(in srgb, var(--barony-accent, #c4a35a) 12%, transparent);
    color: var(--barony-ink);
}

.known-lords-mark-filter-btn--active.known-lords-mark-filter-btn--color {
    border-color: var(--barony-ink, #2a2418);
    box-shadow: 0 0 0 1px #fff inset;
}

.known-lords-mark-filters__clear {
    min-height: 28px;
    color: var(--barony-muted);
    margin-left: 0.15rem;
}

.known-lords-table {
    min-width: 980px;
    width: 100%;
    table-layout: fixed;
}

.known-lords-table th,
.known-lords-table td {
    vertical-align: middle;
}

.known-lords-table col.known-lords-col-name { width: 88px; }
.known-lords-table col.known-lords-col-house { width: 84px; }
.known-lords-table col.known-lords-col-title { width: 96px; }
.known-lords-table col.known-lords-col-holdings { width: 96px; }
.known-lords-table col.known-lords-col-wealth { width: 64px; }
.known-lords-table col.known-lords-col-desc { width: 394px; }
.known-lords-table col.known-lords-col-goods { width: 160px; }

.known-lords-table th.known-lords-col-name,
.known-lords-table td.known-lords-col-name,
.known-lords-table th.known-lords-col-house,
.known-lords-table td.known-lords-col-house,
.known-lords-table th.known-lords-col-title,
.known-lords-table td.known-lords-col-title,
.known-lords-table th.known-lords-col-holdings,
.known-lords-table td.known-lords-col-holdings,
.known-lords-table th.known-lords-col-wealth,
.known-lords-table td.known-lords-col-wealth,
.known-lords-table th.known-lords-col-desc,
.known-lords-table td.known-lords-col-desc,
.known-lords-table th.known-lords-col-goods,
.known-lords-table td.known-lords-col-goods {
    text-align: left;
    white-space: normal;
    overflow: hidden;
    max-width: 0;
}

.known-lords-table td.known-lords-col-name {
    font-weight: 600;
    color: var(--barony-ink);
}

.known-lords-name-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.known-lords-name-text {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.35;
}

.known-lords-wrap {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.35;
}

.known-lords-desc-text {
    display: block;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.4;
    max-width: 100%;
}

.known-lords-notes-btn--filled {
    color: var(--barony-accent, #c4a35a);
}

.known-lords-notes-icon {
    opacity: 0.45;
}

.known-lords-notes-icon--filled {
    opacity: 1;
    color: var(--barony-accent, #c4a35a);
}

/* ---- Character marks (Relations + Lords) ---- */
.character-mark-badge {
    flex-shrink: 0;
    font-size: 0.85rem;
}

.character-mark-badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
    max-width: 3.25rem;
}

.character-mark-picker-btn--filled {
    color: var(--barony-accent, #c4a35a);
}

.character-mark-menu {
    padding: 0.45rem 0.55rem 0.35rem;
    min-width: 168px;
}

.character-mark-menu__active {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid color-mix(in srgb, var(--barony-muted) 18%, transparent);
}

.character-mark-menu__active-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border: 1px solid color-mix(in srgb, var(--barony-muted) 22%, transparent);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.02);
    cursor: pointer;
    padding: 0;
}

.character-mark-menu__active-item:hover {
    background: color-mix(in srgb, var(--barony-neg, #b54a4a) 10%, transparent);
    border-color: color-mix(in srgb, var(--barony-neg, #b54a4a) 35%, transparent);
}

.character-mark-menu__section + .character-mark-menu__section {
    margin-top: 0.35rem;
}

.character-mark-menu__label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--barony-muted);
    margin-bottom: 0.25rem;
}

.character-mark-menu__icons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

.character-mark-menu__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid color-mix(in srgb, var(--barony-muted) 25%, transparent);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.02);
    cursor: pointer;
    padding: 0;
}

.character-mark-menu__icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.character-mark-menu__icon-btn--selected {
    border-color: var(--barony-accent, #c4a35a);
    background: color-mix(in srgb, var(--barony-accent, #c4a35a) 12%, transparent);
}

.character-mark-menu__colors {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.character-mark-menu__color-btn {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--mark-color);
    cursor: pointer;
    padding: 0;
}

.character-mark-menu__color-btn--selected {
    border-color: var(--barony-ink, #2a2418);
    box-shadow: 0 0 0 1px #fff inset;
}

.character-mark-menu__clear {
    margin-top: 0.15rem;
    min-height: 28px;
    color: var(--barony-muted);
}

.known-lords-table th.known-lords-col-wealth,
.known-lords-table td.known-lords-col-wealth {
    text-align: center;
    max-width: none;
    font-variant-numeric: tabular-nums;
}

.known-lords-col-desc .barony-tip-anchor,
.known-lords-col-goods .barony-tip-anchor {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.known-lords-col-desc > .mud-tooltip-root,
.known-lords-col-goods > .mud-tooltip-root {
    display: block;
    max-width: 100%;
    overflow: hidden;
}

/* ---- Trade goods tab ---- */
.trade-goods-table {
    min-width: 1100px;
    width: 100%;
    table-layout: fixed;
}

.trade-goods-table col.trade-goods-col-check { width: 72px; }
.trade-goods-table col.trade-goods-col-name { width: 150px; }
.trade-goods-table col.trade-goods-col-source { width: 120px; }
.trade-goods-table col.trade-goods-col-desc { width: 200px; }
.trade-goods-table col.trade-goods-col-bonus { width: 130px; }
.trade-goods-table col.trade-goods-col-unlock { width: 150px; }
.trade-goods-table col.trade-goods-col-building { width: 150px; }
.trade-goods-table col.trade-goods-col-req { width: 140px; }
.trade-goods-table col.trade-goods-col-override { width: 88px; }

.trade-goods-table th,
.trade-goods-table td {
    vertical-align: middle;
}

.trade-goods-col-check {
    text-align: center;
}

.trade-goods-table th.trade-goods-col-name,
.trade-goods-table td.trade-goods-col-name,
.trade-goods-table th.trade-goods-col-desc,
.trade-goods-table td.trade-goods-col-desc {
    text-align: left;
}

.trade-goods-table th.trade-goods-col-desc,
.trade-goods-table td.trade-goods-col-desc,
.trade-goods-table th.trade-goods-col-unlock,
.trade-goods-table td.trade-goods-col-unlock,
.trade-goods-table th.trade-goods-col-req,
.trade-goods-table td.trade-goods-col-req {
    white-space: normal;
    overflow: hidden;
    max-width: 0;
}

.trade-goods-col-name {
    font-weight: 600;
    color: var(--barony-ink);
}

.trade-good-name {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.trade-good-icon {
    display: inline-block;
    flex-shrink: 0;
    width: 1.15rem;
    height: 1.15rem;
    background-color: var(--resource-color, #888);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.45));
}

.trade-good-icon--img {
    background: none;
    -webkit-mask-image: none;
    mask-image: none;
    filter: none;
    object-fit: contain;
}

/* Near-white mask fills (stone, salt, silver, …) on pale backgrounds */
.resource-icon--dark-outline {
    filter:
        drop-shadow(1px 0 0 #000)
        drop-shadow(-1px 0 0 #000)
        drop-shadow(0 1px 0 #000)
        drop-shadow(0 -1px 0 #000)
        drop-shadow(0 0 0.75px #000)
        drop-shadow(0 0 1.25px rgba(0, 0, 0, 0.9));
}

/* Beat the default resource-icon drop-shadow on the terrain map / brush */
.barony-terrain-cell__resource-icon.resource-icon--dark-outline,
.terrain-resource-option__icon.resource-icon--dark-outline {
    filter:
        drop-shadow(1px 0 0 #000)
        drop-shadow(-1px 0 0 #000)
        drop-shadow(0 1px 0 #000)
        drop-shadow(0 -1px 0 #000)
        drop-shadow(0 0 0.75px #000)
        drop-shadow(0 0 1.25px rgba(0, 0, 0, 0.9));
}

.trade-good-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.45rem;
    align-items: center;
}

.trade-good-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.78rem;
    line-height: 1.2;
    color: var(--barony-ink);
}

.trade-good-chip-row--tip .trade-good-chip {
    color: inherit;
}

.trade-goods-row--available td.trade-goods-col-name {
    color: var(--barony-accent, #6b4423);
}

.trade-goods-source-hint {
    margin-top: 0.15rem;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--barony-muted);
}

/* ---- Luxury goods access ---- */
.luxury-goods-access-table {
    min-width: 720px;
    width: 100%;
    table-layout: fixed;
}

.luxury-goods-access-table col.luxury-goods-col-radio { width: 64px; }
.luxury-goods-access-table col.luxury-goods-col-name { width: 180px; }
.luxury-goods-access-table col.luxury-goods-col-bonus { width: 220px; }
.luxury-goods-access-table col.luxury-goods-col-desc { width: auto; }

.luxury-goods-access-table th.luxury-goods-col-radio,
.luxury-goods-access-table td.luxury-goods-col-radio {
    text-align: center;
}

.luxury-goods-access-table th.luxury-goods-col-name,
.luxury-goods-access-table td.luxury-goods-col-name,
.luxury-goods-access-table th.luxury-goods-col-bonus,
.luxury-goods-access-table td.luxury-goods-col-bonus,
.luxury-goods-access-table th.luxury-goods-col-desc,
.luxury-goods-access-table td.luxury-goods-col-desc {
    text-align: left;
    white-space: normal;
}

.luxury-goods-col-name {
    font-weight: 600;
    color: var(--barony-ink);
}

.luxury-goods-row--active td.luxury-goods-col-name {
    color: var(--barony-accent, #6b4423);
}

/* Trade goods / luxury: barony-accent radios & checkboxes (not MudBlazor blue). */
.trade-goods-table .mud-checkbox,
.trade-goods-table .mud-radio,
.luxury-goods-access .mud-checkbox,
.luxury-goods-access .mud-radio {
    color: var(--barony-ink);
}

.trade-goods-table .mud-checkbox .mud-icon-root,
.trade-goods-table .mud-radio .mud-icon-root,
.luxury-goods-access .mud-checkbox .mud-icon-root,
.luxury-goods-access .mud-radio .mud-icon-root {
    color: inherit;
}

.trade-goods-table .mud-checked .mud-icon-root,
.trade-goods-table .mud-checkbox-true,
.luxury-goods-access .mud-checked .mud-icon-root,
.luxury-goods-access .mud-checkbox-true {
    color: var(--barony-accent, #9c7a33) !important;
}

.trade-goods-table .mud-primary-text,
.luxury-goods-access .mud-primary-text {
    color: var(--barony-accent, #9c7a33) !important;
}

.trade-goods-table .mud-radio,
.luxury-goods-access .mud-radio {
    margin: 0 !important;
}

.trade-goods-table .mud-button-root,
.luxury-goods-access .mud-button-root {
    padding: 0 !important;
}

.trade-goods-ppb-summary {
    overflow-x: auto;
    margin-bottom: 8px;
}

.trade-goods-ppb-table {
    min-width: 360px;
    max-width: 520px;
}

.trade-goods-ppb-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.trade-treaty-card {
    padding: 0.75rem 1rem;
    border: 1px solid var(--barony-border, rgba(255, 255, 255, 0.12));
    border-radius: 6px;
}

.trade-treaty-card--pending {
    border-style: dashed;
    opacity: 0.92;
}

.trade-treaty-pending-chip {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

.trade-treaty-pending-summary {
    color: var(--barony-muted);
    font-style: italic;
}

.trade-treaty-paragraph {
    padding-left: 0.5rem;
    border-left: 3px solid var(--barony-accent, #c9a227);
}

.trade-treaty-edit-paragraph {
    padding: 0.75rem;
}

.mud-dialog-container .mud-dialog.baron-influence-dialog.trade-treaty-dialog:not(.mud-dialog-fullscreen):has(.baron-influence-dialog-content) {
    max-width: min(96vw, 56rem) !important;
    min-width: min(96vw, 38rem) !important;
}

.trade-treaty-edit-dialog {
    min-width: min(96vw, 36rem);
}

.trade-treaty-validation-slot {
    min-height: 4.75rem;
    box-sizing: border-box;
}

.trade-treaty-validation-slot .mud-alert {
    max-height: 8.5rem;
    overflow-y: auto;
}

/* ---- Eastern March map (full viewport) ---- */
.mud-main-content:has(.barony-scope--march-map) {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
}

.barony-scope--march-map {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    min-height: 0;
    overflow: hidden;
    padding: 0 0 44px 0;
}

.barony-scope--march-map .barony-resource-hud {
    display: none;
}

.march-map-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.march-map-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.march-map-frame > .march-map-canvas {
    position: absolute;
    inset: 0;
}

/* Floating overlays on the map — frosted parchment */
.march-map-legend-panel,
.march-map-edit-panel,
.march-map-inspector {
    background: color-mix(in srgb, var(--barony-surface) 90%, rgba(47, 42, 36, 0.06));
    backdrop-filter: blur(12px) saturate(1.1);
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    border: 1px solid color-mix(in srgb, var(--barony-border-strong) 70%, transparent);
    border-radius: 10px;
    box-shadow:
        0 4px 20px rgba(47, 42, 36, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.35) inset;
    color: var(--barony-ink);
}

.march-map-legend-panel .march-map-legend,
.march-map-edit-panel,
.march-map-inspector {
    color: var(--barony-ink);
}

.march-map-legend-panel {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    padding: 8px 10px;
    max-width: min(280px, 42vw);
    max-height: calc(100% - 16px);
    overflow-y: auto;
    pointer-events: auto;
}

.march-map-edit-panel {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 6px 8px;
    width: fit-content;
    max-width: min(320px, 42vw);
    max-height: calc(100% - 16px);
    overflow-y: auto;
    pointer-events: auto;
    box-sizing: border-box;
}

.march-map-edit-panel--expanded {
    width: min(320px, 42vw);
    align-items: stretch;
}

.march-map-edit-panel__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.march-map-edit-panel__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid color-mix(in srgb, var(--barony-border-strong) 55%, transparent);
    box-sizing: border-box;
}

.march-map-edit-panel:not(.march-map-edit-panel--expanded) .march-map-edit-panel__body {
    display: none;
}

.march-map-edit-panel__tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.march-map-toolbar {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    margin-bottom: 6px;
}

.march-map-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.march-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--barony-ink);
}

.march-map-legend-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.march-map-legend--routes {
    padding-top: 2px;
    border-top: 1px solid color-mix(in srgb, var(--barony-border, rgba(255,255,255,0.12)) 80%, transparent);
}

.march-map-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 0 8px color-mix(in srgb, var(--barony-surface) 80%, transparent);
}

.march-map-legend__swatch {
    display: inline-block;
    width: 22px;
    height: 0;
    border-top: 3px solid #c4a574;
}

.march-map-legend__swatch--river {
    border-top-style: dashed;
    border-top-color: #4a90c2;
}

.march-map-legend__dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid #1a1510;
    flex-shrink: 0;
}

.march-map-legend__dot--capital {
    width: 12px;
    height: 12px;
    background: #e8c547;
}

.march-map-legend__dot--large-city {
    width: 11px;
    height: 11px;
    background: #c49a3a;
}

.march-map-legend__dot--city {
    background: #9c7a33;
}

.march-map-legend__dot--village {
    width: 8px;
    height: 8px;
    background: #6d8f6a;
}

.march-map-legend__dot--player-seat {
    width: 12px;
    height: 12px;
    background: #5a9fd4;
}

.march-map-legend__dot--blocked {
    width: 10px;
    height: 10px;
    background: #6a6060;
    opacity: 0.85;
}

.march-map-legend__lock-icon.mud-icon-root {
    width: 12px !important;
    height: 12px !important;
    font-size: 12px !important;
    color: #5a4545;
    flex-shrink: 0;
}

.march-map-legend--toggles {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid color-mix(in srgb, var(--barony-border-strong) 45%, transparent);
}

.march-map-legend__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--barony-ink);
    cursor: pointer;
    user-select: none;
}

.march-map-legend__toggle input {
    accent-color: var(--barony-accent, #6b4423);
    margin: 0;
    cursor: pointer;
}

.march-map-marker__goods-fo {
    overflow: visible;
}

.march-map-marker__goods {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    pointer-events: none;
}

.march-map-marker__good-icon.trade-good-icon {
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.85))
            drop-shadow(0 0 1px rgba(255, 255, 255, 0.5));
}

.march-map-marker__lock-fo {
    overflow: visible;
}

.march-map-marker__lock {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.march-map-marker__lock-icon.mud-icon-root {
    width: 18px !important;
    height: 18px !important;
    font-size: 18px !important;
    color: #5a3030;
    filter: drop-shadow(0 0 0.6px rgba(255, 255, 255, 0.95))
            drop-shadow(0 0 1px rgba(0, 0, 0, 0.7));
}

.march-map-canvas {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    overflow: hidden;
}

.march-map-viewport {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: auto;
    display: block;
    cursor: grab;
    background: color-mix(in srgb, var(--barony-surface-2) 85%, #0e0c0a);
    border: 1px solid var(--barony-border, rgba(255, 255, 255, 0.12));
    border-radius: 6px;
}

.march-map-viewport.march-map-viewport--grabbing {
    cursor: grabbing;
}

.march-map-viewport .march-map-marker {
    cursor: pointer;
}

.march-map-scrollpad {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 100%;
    min-height: 100%;
}

.march-map-stage {
    position: relative;
    flex: none;
    box-sizing: border-box;
}

.march-map-media {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.march-map-route-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 24;
    pointer-events: stroke;
    cursor: pointer;
}

.march-map-hover-tip {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    max-width: min(380px, 92vw);
}

.march-map-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
}

.march-map-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.march-map-route {
    fill: none;
    stroke-width: 4;
    pointer-events: none;
}

.march-map-route--road {
    stroke: #c4a574;
}

.march-map-route--river {
    stroke: #4a90c2;
    stroke-dasharray: 10 8;
}

.march-map-route--active {
    stroke-width: 6;
    filter: drop-shadow(0 0 4px rgba(255, 220, 140, 0.8));
}

.march-map-route--design {
    stroke: #8a8680 !important;
    stroke-width: 6;
    filter: drop-shadow(0 0 3px rgba(40, 38, 34, 0.55));
}

.march-map-trade-overlay {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    opacity: 0.92;
}

.march-map-design-banner {
    margin: 0 0 8px;
    padding: 8px 12px;
}

.march-map-design-banner__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.march-map-marker--design .march-map-marker__dot {
    stroke: #8a8680;
    stroke-width: 1.5;
}

.march-map-marker {
    cursor: pointer;
    pointer-events: all;
}

.march-map-marker__hit {
    fill: transparent;
    stroke: none;
}

.march-map-marker__dot {
    fill: var(--barony-accent, #9c7a33);
    stroke: #1a1510;
    stroke-width: 1;
}

.march-map-marker--capital .march-map-marker__dot {
    fill: #e8c547;
    stroke: #4a3818;
}

.march-map-marker--large-city .march-map-marker__dot {
    fill: #c49a3a;
    stroke: #3d2e14;
}

.march-map-marker--city .march-map-marker__dot {
    fill: #9c7a33;
    stroke: #1a1510;
}

.march-map-marker--village .march-map-marker__dot {
    fill: #6d8f6a;
    stroke: #1a2820;
}

.march-map-marker--selected .march-map-marker__dot {
    fill: #fff3c4;
    stroke: var(--barony-accent, #9c7a33);
    stroke-width: 1.5;
}

.march-map-marker--selected.march-map-marker--capital .march-map-marker__dot {
    fill: #fff8dc;
    stroke: #e8c547;
}

.march-map-marker--selected.march-map-marker--large-city .march-map-marker__dot {
    fill: #fff0d0;
    stroke: #c49a3a;
}

.march-map-marker--selected.march-map-marker--village .march-map-marker__dot {
    fill: #e8f4e6;
    stroke: #6d8f6a;
}

.march-map-marker--connect .march-map-marker__dot {
    fill: #8fd4ff;
}

.march-map-marker--player-seat .march-map-marker__dot {
    fill: #5a9fd4;
    stroke: #1a2838;
}

.march-map-marker--selected.march-map-marker--player-seat .march-map-marker__dot {
    fill: #c8e4f8;
    stroke: #5a9fd4;
}

.march-map-marker__label {
    fill: #f5ecd8;
    font-size: 8px;
    font-weight: 500;
    font-family: var(--barony-font, inherit);
    paint-order: stroke;
    stroke: #1a1510;
    stroke-width: 1px;
    pointer-events: none;
}

/* Toolbar — barony accent (no default Mud blue) */
.march-map-toolbar--barony .march-map-toolbar__btn.mud-button-outlined {
    border-color: color-mix(in srgb, var(--barony-accent) 45%, var(--barony-border)) !important;
    color: var(--barony-ink) !important;
}

.march-map-toolbar--barony .march-map-tool-toggle .mud-button-root.mud-button-filled {
    background: color-mix(in srgb, var(--barony-accent) 22%, var(--barony-surface)) !important;
    color: var(--barony-ink) !important;
    border-color: var(--barony-accent) !important;
}

.march-map-toolbar--barony .march-map-tool-toggle .mud-button-root.mud-button-outlined {
    border-color: var(--barony-border) !important;
    color: var(--barony-ink) !important;
}

.march-map-toolbar--barony .march-map-link-kind-group .mud-button-root {
    border-color: color-mix(in srgb, var(--barony-accent) 35%, var(--barony-border)) !important;
    color: var(--barony-ink) !important;
}

.march-map-route-type-buttons__active,
.march-map-route-type-buttons__active.mud-button-root {
    background: color-mix(in srgb, var(--barony-accent) 22%, var(--barony-surface)) !important;
    border-color: var(--barony-accent) !important;
    color: var(--barony-ink) !important;
}

.march-map-lord-tip {
    max-width: min(360px, 88vw);
}

.march-map-lord-tip__meta {
    font-size: 0.8rem;
    color: var(--barony-muted);
    margin-bottom: 8px;
}

.march-map-lord-tip__you {
    font-size: 0.85em;
    font-weight: 500;
    color: #6ec8ff;
    margin-left: 4px;
}

.march-map-lord-tip__section + .march-map-lord-tip__section {
    margin-top: 8px;
}

.march-map-lord-tip__label {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
}

.march-map-lord-tip-anchor {
    display: inline-flex;
}

.march-map-toolbar__link-kind {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.march-map-inspector {
    position: absolute;
    top: 8px;
    left: 8px;
    width: min(320px, 42vw);
    padding: 10px 12px;
    z-index: 4;
    max-height: calc(100% - 16px);
    overflow-y: auto;
}

.march-map-frame:has(.march-map-edit-panel) .march-map-inspector {
    top: auto;
    bottom: 12px;
    max-height: min(50%, 440px);
}

.march-map-missing-image {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 2;
    max-width: min(480px, 90vw);
}

/* ---- Audiences ---- */
.baron-audience__toolbar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.baron-audience__section-title {
    margin: 0 0 0.55rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--barony-ink);
}

.baron-audience__empty {
    color: var(--barony-muted);
}

.baron-audience__panels {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.baron-audience__body {
    padding: 0.75rem 1rem 0.95rem;
}

.baron-audience__summary-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.75rem;
}

.baron-audience-summary-table th.php-col {
    width: 2.4rem;
    min-width: 2.4rem;
    padding-left: 4px;
    padding-right: 4px;
}

.baron-audience-summary-table th.php-col .php-metric-icon {
    margin: 0 auto;
}

.project-card__title-row:has(.baron-audience__ppb-glance) {
    align-items: center;
}

.baron-audience__ppb-glance {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.75rem;
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 0.25rem;
}

.project-card__title-row .project-card__badges {
    margin-left: auto;
}

.baron-audience__panel-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.65rem;
    width: 100%;
    padding-right: 0.5rem;
}

.baron-audience__petitioner {
    color: var(--barony-muted);
    font-size: 0.9em;
}

.baron-audience__petitioner-icon {
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
    flex-shrink: 0;
}

/* Hall header portrait — sized to roughly match the petitioner name + title block. */
.audience-scroll__petitioner-icon {
    width: 3.4rem;
    height: 3.4rem;
    object-fit: contain;
    flex-shrink: 0;
    align-self: center;
}

.audience-scroll__meta {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.new-audience-icon-row {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: .75rem;
}

.new-audience-icon-row__pick {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    width: 5.4rem;
    min-height: 5.4rem;
    padding: .35rem .3rem;
    flex-shrink: 0;
    background: var(--barony-surface, #fbf8f1);
    border: 1px solid var(--barony-border, #d9cfb8);
    border-radius: 8px;
    cursor: pointer;
    color: var(--barony-ink);
    font-family: inherit;
    font-size: .68rem;
    line-height: 1.15;
    text-align: center;
}

.new-audience-icon-row__pick:hover {
    border-color: var(--barony-accent, #9c7a33);
}

.new-audience-icon-row__pick img {
    width: 2.4rem;
    height: 2.4rem;
    object-fit: contain;
}

.baron-audience__meta {
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--barony-muted);
}

.baron-audience__continued {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7f9a;
    border: 1px solid rgba(107, 127, 154, 0.45);
    border-radius: 3px;
    padding: 0 0.35rem;
}

.baron-audience__status {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    background: rgba(0, 0, 0, 0.06);
    color: var(--barony-muted);
}

.baron-audience__status--scheduled { background: rgba(90, 130, 180, 0.15); color: #3a5a7a; }
.baron-audience__status--inprogress { background: rgba(180, 130, 50, 0.18); color: #7a5520; }
.baron-audience__status--deferred { background: rgba(120, 100, 160, 0.15); color: #5a4a7a; }
.baron-audience__status--resolved { background: rgba(70, 130, 80, 0.16); color: #2f5a38; }
.baron-audience__status--dismissed { background: rgba(140, 70, 70, 0.14); color: #6a3030; }

.baron-audience__exchanges {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.baron-audience__exchange {
    border-left: 3px solid transparent;
    padding: 0.45rem 0.65rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 0 4px 4px 0;
}

.baron-audience__exchange--gm {
    border-left-color: #8b4518;
    background: rgba(139, 69, 24, 0.09);
}

.baron-audience__exchange--baron {
    border-left-color: #2f5d8a;
    background: rgba(47, 93, 138, 0.10);
}

.baron-audience__exchange--resource {
    border-left-color: #9c7a33;
    background: rgba(156, 122, 51, 0.08);
}

.baron-audience__exchange--question {
    border-left-color: color-mix(in srgb, var(--barony-muted) 28%, transparent);
    background: rgba(0, 0, 0, 0.018);
    color: color-mix(in srgb, var(--barony-muted) 82%, #888);
}

.baron-audience__exchange--question .baron-audience__exchange-head {
    color: color-mix(in srgb, var(--barony-muted) 68%, #999);
    font-weight: 600;
}

.baron-audience__exchange--question .baron-audience__exchange-body {
    color: color-mix(in srgb, var(--barony-muted) 78%, #888);
    font-size: 0.88rem;
}

.baron-audience__exchange--gm-master {
    border-left-color: #4a6741;
    background: rgba(74, 103, 65, 0.10);
}

.baron-audience__composer--gm {
    border-left: 3px solid #8b4518;
    padding-left: 0.55rem;
}

.baron-audience__composer--baron {
    border-left: 3px solid #2f5d8a;
    padding-left: 0.55rem;
}

.baron-audience__speaker-row {
    display: grid;
    grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr);
    gap: 0.5rem;
    margin-bottom: 0;
}

.baron-audience__speaker-row .mud-input-control {
    margin-top: 0;
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .baron-audience__speaker-row {
        grid-template-columns: 1fr;
    }
}

.baron-audience__ppb-delta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.55rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.baron-audience__ppb-delta-item {
    white-space: nowrap;
}

.baron-audience__exchange-head {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--barony-muted);
    margin-bottom: 0.2rem;
}

.baron-audience__exchange-body {
    white-space: pre-wrap;
    line-height: 1.45;
    font-size: 0.92rem;
}

.baron-audience__summary {
    margin: 0.5rem 0 0.75rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.baron-audience__summary-label {
    font-weight: 700;
    margin-right: 0.35rem;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--barony-muted);
}

.baron-audience__composer {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.baron-audience__composer > .mud-input-control {
    margin-top: 0;
    margin-bottom: 0.15rem;
}

.baron-audience__composer-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.baron-audience__composer-actions .barony-turn-btn {
    text-transform: none;
}

.baron-audience__folder {
    margin-bottom: 0.45rem;
}

.baron-audience__folder .project-card-grid {
    margin-top: 0.35rem;
}

.baron-audience__folder-summary {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.35rem 0.15rem;
    color: var(--barony-ink);
    font: inherit;
    font-weight: 600;
}

.baron-audience__folder-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--barony-muted);
}


/* ===== Battle Map ===== */
.mud-main-content:has(.barony-scope--battle-map) {
    overflow: hidden;
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
}

.barony-scope--battle-map {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    min-height: 0;
    overflow: hidden;
    padding: 0 0 44px 0;
}

.barony-scope--battle-map .barony-resource-hud {
    display: none;
}

.barony-scope--march-map .barony-scope-body--fill,
.barony-scope--battle-map .barony-scope-body--fill {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.barony-scope .bbm-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    padding: 0.5rem 0.75rem 0;
    box-sizing: border-box;
}

.barony-scope .bbm-page .barony-page-header {
    flex: 0 0 auto;
    margin-bottom: 0.5rem;
}

.barony-scope .bbm-phase-chip,
.barony-scope .bbm-turn-chip {
    display: inline-block;
    margin-right: 0.75rem;
    font-size: 0.8rem;
    color: var(--barony-muted);
}

.barony-scope .bbm-turn-chip--ally {
    color: #2f6b4f;
    font-weight: 600;
}

.barony-scope .bbm-turn-chip--enemy {
    color: #8b3a3a;
    font-weight: 600;
}

.barony-scope .bbm-map-overlay-status {
    position: absolute;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    gap: 0.45rem;
    align-items: center;
    justify-content: center;
    max-width: calc(100% - 1.5rem);
    pointer-events: none;
}

.barony-scope .bbm-map-overlay-actions {
    position: absolute;
    left: 50%;
    bottom: 46px;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    gap: 0.45rem;
    align-items: center;
    flex-wrap: nowrap;
    pointer-events: none;
}

.barony-scope .bbm-map-overlay-actions .bbm-map-btn {
    pointer-events: auto;
    min-width: 7.5rem;
    text-align: center;
    white-space: nowrap;
}

.barony-scope .bbm-map-general-aura {
    pointer-events: none;
    align-self: center;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: color-mix(in srgb, #5a4a78 70%, var(--barony-ink, #2f2a24));
    opacity: 0.92;
    max-width: 18rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.barony-scope .bbm-general-pick {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.barony-scope .bbm-general-pick__label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
}

.barony-scope .bbm-general-pick__label select {
    width: 100%;
}

.barony-scope .bbm-general-pick__meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8rem;
    opacity: 0.9;
}

.barony-scope .bbm-general-pick__hint {
    opacity: 0.7;
    font-style: italic;
}

.barony-scope .bbm-general-pick .bbm-map-general-aura {
    max-width: none;
    white-space: normal;
}

.barony-scope .bbm-map-overlay-actions .bbm-map-btn--compact {
    min-width: 0;
    height: 1.85rem;
    padding: 0 0.7rem;
    font-size: 0.72rem;
    letter-spacing: 0.01em;
    line-height: 1;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.barony-scope .bbm-map-wait,
.barony-scope .bbm-map-ready {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.barony-scope .bbm-map-wait {
    border: 1.5px solid color-mix(in srgb, var(--barony-neg, #a5503f) 55%, transparent);
    border-radius: 4px;
    background: color-mix(in srgb, var(--barony-surface) 88%, var(--barony-neg, #a5503f));
    color: var(--barony-ink);
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

.barony-scope .bbm-map-ready {
    border: 1.5px solid color-mix(in srgb, var(--barony-pos, #4f7a4d) 55%, transparent);
    border-radius: 4px;
    background: color-mix(in srgb, var(--barony-surface) 88%, var(--barony-pos, #4f7a4d));
    color: var(--barony-ink);
    padding: 0.35rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

.barony-scope .bbm-map-btn {
    appearance: none;
    border-radius: 4px;
    padding: 0.4rem 0.95rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.barony-scope .bbm-map-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.barony-scope .bbm-map-btn--ghost {
    border: 1.5px solid var(--barony-border-strong);
    background: var(--barony-surface);
    color: var(--barony-ink);
}

.barony-scope .bbm-map-btn--ghost:hover:not(:disabled) {
    background: color-mix(in srgb, var(--barony-accent) 12%, var(--barony-surface));
    border-color: var(--barony-accent);
}

.barony-scope .bbm-map-btn--solid {
    border: 1.5px solid var(--barony-accent);
    background: var(--barony-accent);
    color: var(--barony-surface);
}

.barony-scope .bbm-map-btn--solid:hover:not(:disabled) {
    background: #866828;
    border-color: #866828;
}

.barony-scope .bbm-map-btn--end-battle {
    border: 1.5px solid #8b3a3a;
    background: #8b3a3a;
    color: #f5f0e6;
}

.barony-scope .bbm-map-btn--end-battle:hover:not(:disabled) {
    background: #6e2e2e;
    border-color: #6e2e2e;
}

.barony-scope .bbm-init-side {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    margin-right: 0.25rem;
    border-radius: 2px;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
}

.barony-scope .bbm-init-side.ally {
    color: #2f6b4f;
    background: color-mix(in srgb, #2f6b4f 14%, transparent);
}

.barony-scope .bbm-init-side.enemy {
    color: #8b3a3a;
    background: color-mix(in srgb, #8b3a3a 14%, transparent);
}

.barony-scope .bbm-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 0.75rem;
    flex: 1 1 auto;
    min-height: 420px;
    height: 100%;
    overflow: hidden;
}

.barony-scope .bbm-map-pane {
    position: relative;
    min-width: 0;
    min-height: 420px;
    height: 100%;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
}

.barony-scope .bbm-map-pane > .bbm-grid-root {
    flex: 1 1 auto;
    min-height: 0;
}

.barony-scope .bbm-edit-panel {
    top: 0;
    left: 0;
    border-top-left-radius: 0;
    z-index: 6;
}

.barony-scope .bbm-edit-panel .bbm-toggle-twoline {
    display: inline-block;
    line-height: 1.1;
    text-align: center;
    font-size: 0.75rem;
}

.barony-scope .bbm-edit-panel .bbm-tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.barony-scope .bbm-edit-panel .mud-button-root {
    text-transform: none;
}

.barony-scope .bbm-side-pane {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
    padding: 2px;
}

.barony-scope .bbm-side-pane > .barony-section {
    margin-bottom: 0;
    flex: 0 0 auto;
}

.barony-scope .bbm-map-log {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 18;
    width: min(320px, calc(100% - 24px));
    max-height: min(42%, 280px);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.45rem 0.55rem 0.5rem;
    border: 1px solid color-mix(in srgb, var(--barony-border-strong) 55%, transparent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--barony-surface) 28%, transparent);
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 10px rgba(47, 42, 36, 0.12);
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    pointer-events: auto;
}

.barony-scope .bbm-map-log:hover {
    background: color-mix(in srgb, var(--barony-surface) 82%, transparent);
    border-color: var(--barony-border-strong);
    box-shadow: 0 3px 14px rgba(47, 42, 36, 0.2);
}

.barony-scope .bbm-map-log__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    flex: 0 0 auto;
}

.barony-scope .bbm-map-log__title {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--barony-muted);
}

.barony-scope .bbm-map-log__hide {
    appearance: none;
    border: 1px solid var(--barony-border);
    border-radius: 3px;
    background: color-mix(in srgb, var(--barony-surface) 70%, transparent);
    color: var(--barony-ink);
    width: 1.35rem;
    height: 1.15rem;
    padding: 0;
    line-height: 1;
    font-size: 0.75rem;
    cursor: pointer;
}

.barony-scope .bbm-map-log__hide:hover {
    border-color: var(--barony-accent);
    background: var(--barony-surface);
}

.barony-scope .bbm-map-log__entries {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.72rem;
    line-height: 1.25;
}

.barony-scope .bbm-map-log__entry {
    color: var(--barony-ink);
}

.barony-scope .bbm-map-log__entry--auto .bbm-map-log__text {
    color: var(--barony-muted);
    font-style: italic;
}

.barony-scope .bbm-map-log__entry--chat .bbm-map-log__text {
    color: var(--barony-ink);
    font-style: normal;
}

.barony-scope .bbm-map-log__entry--system .bbm-map-log__text {
    color: var(--barony-muted);
    font-style: italic;
}

.barony-scope .bbm-map-log__entry--combat .bbm-map-log__text {
    color: #5a4a3a;
    font-style: italic;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap;
}

.barony-scope .bbm-map-log__entry--collision .bbm-map-log__text {
    color: #c62828;
    font-weight: 700;
    font-style: italic;
}

.barony-scope .bbm-map-log__entry--phase .bbm-map-log__text {
    color: var(--barony-ink);
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-style: italic;
    letter-spacing: 0.01em;
    white-space: pre-wrap;
}

.barony-scope .bbm-map-log__author {
    font-weight: 700;
    margin-right: 0.3rem;
    color: var(--barony-accent);
}

.barony-scope .bbm-map-log__empty {
    color: var(--barony-muted);
    font-size: 0.7rem;
    font-style: italic;
}

.barony-scope .bbm-map-log__chat {
    flex: 0 0 auto;
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.barony-scope .bbm-map-log__input {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.72rem !important;
    padding: 0.25rem 0.4rem !important;
}

.barony-scope .bbm-map-log__send {
    min-width: 0;
    padding: 0.28rem 0.55rem;
    font-size: 0.7rem;
}

.barony-scope .bbm-map-log-toggle {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 18;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--barony-border-strong);
    border-radius: 6px;
    background: color-mix(in srgb, var(--barony-surface) 78%, transparent);
    color: var(--barony-ink);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(47, 42, 36, 0.15);
    transition: background 0.15s ease;
}

.barony-scope .bbm-map-log-toggle:hover {
    background: var(--barony-surface);
}

.barony-scope .bbm-map-log-toggle__icon {
    display: block;
    width: 0.7rem;
    height: 0.7rem;
    border: 1.5px solid var(--barony-accent);
    border-radius: 2px;
    box-shadow: inset 0 -0.22rem 0 color-mix(in srgb, var(--barony-accent) 35%, transparent);
    box-sizing: border-box;
}

.barony-scope .bbm-map-log-toggle__label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.barony-scope .bbm-force-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.barony-scope .bbm-force-card {
    border: 1px solid var(--barony-border);
    border-radius: 6px;
    background: var(--barony-surface);
    padding: 0.45rem 0.55rem;
    cursor: default;
}

.barony-scope .bbm-force-card.picked {
    border-color: var(--barony-accent);
    box-shadow: inset 0 0 0 1px var(--barony-accent);
}

.barony-scope .bbm-force-card.on-map {
    background: color-mix(in srgb, var(--barony-accent-soft) 55%, var(--barony-surface));
}

.barony-scope .bbm-force-card.broken {
    opacity: 0.48;
    filter: grayscale(0.85);
    background: color-mix(in srgb, #6b6b6b 18%, var(--barony-surface));
}

.barony-scope .bbm-force-card.broken .bbm-force-card__hp {
    color: #8a4a42;
}

.barony-scope .bbm-force-card.enemy {
    cursor: pointer;
}

.barony-scope .bbm-force-card__top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.barony-scope .bbm-force-icon-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 4px;
    border: 1px solid var(--barony-border-strong);
    border-radius: 6px;
    background: var(--barony-bg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.barony-scope .bbm-force-icon-btn:hover:not(:disabled) {
    border-color: var(--barony-accent);
    background: var(--barony-accent-soft);
}

.barony-scope .bbm-force-icon-btn:disabled {
    cursor: default;
    opacity: 1;
}

.barony-scope .bbm-force-icon-btn:disabled:hover {
    border-color: var(--barony-border-strong);
    background: var(--barony-bg);
}

.barony-scope .bbm-force-icon-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.barony-scope .bbm-force-card__identity {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.barony-scope .bbm-force-card__name {
    font-size: 0.9rem;
    line-height: 1.2;
    color: var(--barony-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.barony-scope .bbm-name--ally {
    color: var(--barony-accent);
    font-weight: 700;
}

.barony-scope .bbm-name--enemy {
    color: #8b3a3a;
    font-weight: 700;
}

.barony-scope .bbm-map-log__text .bbm-name--ally,
.barony-scope .bbm-map-log__text .bbm-name--enemy {
    font-style: normal;
}

.barony-scope .bbm-force-card__hp {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--barony-accent);
}

.barony-scope .bbm-force-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

.barony-scope .bbm-force-status__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.12rem 0.4rem 0.12rem 0.25rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.1;
    color: #f5f0e6;
    box-shadow: 0 0 0 1px rgba(245, 240, 230, 0.35);
}

.barony-scope .bbm-force-status__badge img {
    width: 0.85rem;
    height: 0.85rem;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
}

.barony-scope .bbm-force-status__badge em {
    font-style: normal;
    font-variant-numeric: tabular-nums;
}

.barony-scope .bbm-force-status__badge--full-def {
    background: rgba(36, 99, 178, 0.94);
}

.barony-scope .bbm-force-status__badge--ironclad {
    background: rgba(90, 78, 120, 0.94);
}

.barony-scope .bbm-force-card__actions {
    flex: 0 0 auto;
}

.barony-scope .bbm-force-card__stats {
    margin-top: 0.3rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--barony-muted);
}

.barony-scope .bbm-force-stat--boost {
    color: #2463b2;
    font-weight: 700;
}

.barony-scope .bbm-force-stat--down {
    color: #8b3a3a;
    font-weight: 700;
}

.barony-scope .bbm-force-meta {
    font-size: 0.72rem;
    color: var(--barony-muted);
}

.barony-scope .bbm-empty,
.barony-scope .bbm-hint {
    font-size: 0.8rem;
    color: var(--barony-muted);
    margin: 0.25rem 0;
}

.barony-scope .bbm-mini-btn {
    font-size: 0.72rem !important;
    padding: 0.15rem 0.45rem !important;
    min-height: 0 !important;
}

.barony-scope .bbm-input {
    font: inherit;
    font-size: 0.78rem;
    color: var(--barony-ink);
    background: var(--barony-bg);
    border: 1px solid var(--barony-border);
    padding: 0.2rem 0.35rem;
    max-width: 100%;
}

.barony-scope .bbm-enemy-name {
    flex: 1 1 auto;
    min-width: 0;
}

.bbm-icon-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, 88px);
    justify-content: start;
    gap: 0.5rem;
    max-height: min(60vh, 420px);
    overflow: auto;
    padding: 0.25rem;
}

/* Tooltip wrapper (MudTooltip root) — fixed grid cell */
.bbm-icon-picker > * {
    display: block;
    width: 88px;
    height: 88px;
}

.bbm-icon-picker .barony-tip-anchor {
    display: block;
    width: 100%;
    height: 100%;
}

.bbm-icon-picker__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 0.35rem 0.25rem;
    border: 1px solid var(--barony-border, #d9cfb8);
    border-radius: 8px;
    background: var(--barony-surface, #fbf8f1);
    cursor: pointer;
    color: var(--barony-ink, #2f2a24);
}

.bbm-icon-picker__item:hover,
.bbm-icon-picker__item.selected {
    border-color: var(--barony-accent, #9c7a33);
    background: var(--barony-accent-soft, #ece0c4);
}

.bbm-icon-picker__item img {
    display: block;
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.bbm-icon-picker__item span {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    flex: 0 0 auto;
    width: 100%;
    min-height: 2.3em;
    max-height: 2.3em;
    font-size: 0.68rem;
    text-align: center;
    line-height: 1.15;
}

.barony-scope .bbm-enemy-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--barony-border);
}

.barony-scope .bbm-enemy-form--editing {
    border-top-color: color-mix(in srgb, #8b3a3a 45%, var(--barony-border));
    background: color-mix(in srgb, #8b3a3a 6%, transparent);
    padding: 0.45rem 0.4rem 0.4rem;
    border-radius: 4px;
}

.barony-scope .bbm-force-card.enemy.editing {
    outline: 1px solid color-mix(in srgb, #8b3a3a 55%, transparent);
}

.barony-scope .bbm-enemy-form__top {
    align-items: center;
}

.barony-scope .bbm-enemy-add-btn {
    flex-shrink: 0;
    align-self: stretch;
    min-width: 3.5rem;
    font-size: 0.75rem !important;
    padding: 0.2rem 0.6rem !important;
}

.barony-scope .bbm-enemy-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.25rem;
    font-size: 0.72rem;
}

.barony-scope .bbm-enemy-stats label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    color: var(--barony-muted);
}

.barony-scope .bbm-enemy-stats input {
    width: 100%;
    font: inherit;
    font-size: 0.75rem;
    border: 1px solid var(--barony-border);
    background: var(--barony-bg);
    color: var(--barony-ink);
    padding: 0.15rem;
}

.barony-scope .bbm-enemy-abilities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.barony-scope .bbm-enemy-ability-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--barony-border) 72%, #2f2a24);
    background: color-mix(in srgb, var(--barony-bg) 88%, #ffffff);
    font-size: 0.72rem;
    color: var(--barony-ink);
}

.barony-scope .bbm-enemy-ability-chip button {
    border: 0;
    background: transparent;
    color: var(--barony-muted);
    cursor: pointer;
    line-height: 1;
    font-size: 0.88rem;
    padding: 0;
}

.barony-scope .bbm-force-abilities {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

.barony-scope .bbm-force-abilities__label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--barony-muted);
}

.barony-scope .bbm-force-ability-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--barony-accent) 45%, var(--barony-border));
    background: color-mix(in srgb, var(--barony-accent) 14%, var(--barony-bg));
    font-size: 0.68rem;
    color: var(--barony-ink);
    cursor: help;
}

.barony-scope .bbm-log-entry {
    font-size: 0.75rem;
    line-height: 1.25;
}

.barony-scope .bbm-log-entry--system .bbm-log-text {
    color: var(--barony-muted);
    font-style: italic;
}

.barony-scope .bbm-log-author {
    font-weight: 700;
    margin-right: 0.35rem;
    color: var(--barony-accent);
}

.barony-scope .bbm-chat-row {
    display: flex;
    gap: 0.35rem;
}

.barony-scope .bbm-chat-row .bbm-input {
    flex: 1 1 auto;
}

.barony-scope .bbm-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.barony-scope .bbm-tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.barony-scope .bbm-tool-label {
    font-size: 0.75rem;
    color: var(--barony-muted);
    margin-right: 0.15rem;
}

.barony-scope .bbm-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.barony-scope .bbm-swatch {
    width: 18px;
    height: 18px;
    border: 1px solid var(--barony-border);
    cursor: pointer;
    padding: 0;
}

.barony-scope .bbm-swatch.selected {
    outline: 2px solid var(--barony-accent);
    outline-offset: 1px;
}

.barony-scope .bbm-initiative {
    margin: 0.5rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.78rem;
}

.barony-scope .bbm-initiative .current {
    font-weight: 700;
    color: var(--barony-accent);
}

/* Grid (kept global so cells keep size even if scoped CSS is stale) */
.barony-scope .bbm-grid-root {
    --bbm-cell: 64px;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.barony-scope .bbm-scroll {
    position: relative;
    width: 100%;
    flex: 1 1 auto;
    min-height: 360px;
    max-height: none;
    overflow: auto;
    border: 1px solid var(--barony-border);
    background: var(--barony-surface);
}

.barony-scope .bbm-cursor-pos {
    position: absolute;
    right: 6px;
    top: 6px;
    z-index: 5;
    pointer-events: none;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    background: rgba(47, 42, 36, 0.75);
    color: #fbf8f1;
    font-family: monospace;
}

.barony-scope .bbm-labeled-grid {
    display: grid;
    grid-template-areas:
        "corner cols"
        "rows map";
    /* First column width is also set inline; keep a safe fallback here. */
    grid-template-columns: 32px max-content;
    width: fit-content;
    padding: 4px 4px 4px 0;
}

.barony-scope .bbm-corner {
    grid-area: corner;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 4;
    background: var(--barony-surface);
}

.barony-scope .bbm-col-labels {
    grid-area: cols;
    display: grid;
    gap: 1px;
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--barony-surface);
    padding-bottom: 2px;
}

.barony-scope .bbm-row-labels {
    grid-area: rows;
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    box-sizing: border-box;
    align-items: stretch;
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--barony-surface);
    overflow: visible;
}

.barony-scope .bbm-axis-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--barony-muted);
    user-select: none;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
    /* Avoid Bootstrap .row / .col class names — they break axis layout. */
}

.barony-scope .bbm-axis-label--col {
    width: var(--bbm-cell);
    text-align: center;
}

.barony-scope .bbm-axis-label--row {
    flex: 0 0 var(--bbm-cell);
    height: var(--bbm-cell);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 6px 0 0;
    text-align: right;
    line-height: var(--bbm-cell);
    overflow: hidden;
}

.barony-scope .bbm-grid {
    grid-area: map;
    display: grid;
    gap: 1px;
    background: var(--barony-border);
    box-shadow: inset 0 0 0 1px var(--barony-border);
    width: max-content;
}

.barony-scope .bbm-cell {
    position: relative;
    width: var(--bbm-cell, 64px);
    height: var(--bbm-cell, 64px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3eee2;
    overflow: hidden;
    user-select: none;
}

.barony-scope .bbm-cell.interactive {
    cursor: pointer;
}

.barony-scope .bbm-cell.interactive:hover {
    outline: 2px solid var(--barony-accent);
    outline-offset: -2px;
}

.barony-scope .bbm-cell.selected {
    outline: 2px solid #c45c26;
    outline-offset: -2px;
}

.barony-scope .bbm-cell.has-large-token {
    overflow: visible;
    z-index: 3;
}

.barony-scope .bbm-range {
    position: absolute;
    inset: 0;
    background: rgba(156, 122, 51, 0.28);
    box-shadow: inset 0 0 0 1px rgba(156, 122, 51, 0.55);
    pointer-events: none;
    z-index: 0;
}

.barony-scope .bbm-terrain {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 0;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(47, 42, 36, 0.4);
}

.barony-scope .bbm-terrain--deploy {
    background: rgba(70, 130, 80, 0.22);
    box-shadow: inset 0 0 0 1px rgba(70, 130, 80, 0.35);
}

.barony-scope .bbm-terrain--difficult {
    background: rgba(139, 110, 60, 0.12);
}

.barony-scope .bbm-terrain--impassable {
    background: rgba(60, 50, 40, 0.28);
}

.barony-scope .bbm-cell-text {
    position: relative;
    z-index: 2;
    font-size: 0.55rem;
    font-weight: 700;
    text-align: center;
    line-height: 1;
    pointer-events: none;
}

.barony-scope .bbm-token-slot {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.barony-scope .bbm-token-slot.large {
    inset: auto;
    top: 0;
    left: 0;
    width: var(--bbm-footprint);
    height: var(--bbm-footprint);
}

.barony-scope .bbm-token-slot--ghost {
    z-index: 3;
}

.barony-scope .bbm-token-slot--facing-ghost {
    z-index: 6;
    pointer-events: none;
    transform: translate(7px, -7px);
}

.barony-scope .bbm-token-slot--facing-ghost .bbm-token-label,
.barony-scope .bbm-token-slot--facing-ghost .bbm-move-badge,
.barony-scope .bbm-token-slot--facing-ghost .bbm-lock-badge {
    display: none;
}

.barony-scope .bbm-token-rect {
    width: 100%;
    height: 46%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    border: 2px solid var(--barony-accent);
    background: var(--barony-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    transform: rotate(var(--bbm-facing, 0deg));
    transform-origin: center center;
    box-sizing: border-box;
}

.barony-scope .bbm-token-rect.enemy {
    border-color: #8b3a3a;
}

.barony-scope .bbm-token-rect.selected {
    box-shadow: 0 0 0 2px #c45c26;
}

.barony-scope .bbm-cell.active-order {
    overflow: visible;
    z-index: 4;
}

.barony-scope .bbm-token-slot.active-order {
    z-index: 5;
}

.barony-scope .bbm-token-rect.active-turn {
    animation: bbm-active-token-pulse 1.1s ease-in-out infinite;
}

.barony-scope .bbm-token-rect.enemy.active-turn {
    animation-name: bbm-active-token-pulse-enemy;
}

@keyframes bbm-active-token-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 2px #c9a227,
            0 0 8px rgba(201, 162, 39, 0.35);
    }
    50% {
        box-shadow:
            0 0 0 3px #f0d060,
            0 0 0 7px rgba(201, 162, 39, 0.45),
            0 0 16px rgba(201, 162, 39, 0.7);
    }
}

@keyframes bbm-active-token-pulse-enemy {
    0%, 100% {
        box-shadow:
            0 0 0 2px #c45c26,
            0 0 8px rgba(196, 92, 38, 0.35);
    }
    50% {
        box-shadow:
            0 0 0 3px #e07040,
            0 0 0 7px rgba(196, 92, 38, 0.4),
            0 0 16px rgba(139, 58, 58, 0.65);
    }
}

.barony-scope .bbm-token-rect--ghost {
    opacity: 0.5;
    border-style: dashed;
    box-shadow: none;
    background: color-mix(in srgb, var(--barony-surface) 70%, transparent);
}

.barony-scope .bbm-token-rect--ghost.locked {
    opacity: 0.78;
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(47, 107, 79, 0.65);
}

.barony-scope .bbm-token-slot--anim {
    position: absolute;
    inset: auto;
    z-index: 9;
    pointer-events: none;
}

.barony-scope .bbm-token-slot--anim.bbm-token-slot--anim-run {
    /* left/top transition is driven per-frame via inline style */
}

.barony-scope .bbm-token-slot--anim.bbm-token-slot--anim-run .bbm-token-rect {
    transition: transform 1s ease-in-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.barony-scope .bbm-token-slot--anim .bbm-token-rect {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.barony-scope .bbm-facing-btn {
    position: absolute;
    right: -3px;
    top: -3px;
    z-index: 7;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 1.5px solid #2f6b4f;
    border-radius: 3px;
    background: rgba(245, 240, 230, 0.95);
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.barony-scope .bbm-facing-btn:hover {
    background: #e8f2ec;
}

.barony-scope .bbm-facing-btn__icon {
    display: block;
    width: 0.72rem;
    height: 0.72rem;
    object-fit: contain;
    pointer-events: none;
}

.barony-scope .bbm-facing-only-badge {
    position: absolute;
    left: -3px;
    top: -3px;
    z-index: 7;
    width: 1.15rem;
    height: 1.15rem;
    border: 1.5px solid color-mix(in srgb, var(--barony-neg, #a5503f) 70%, #2f2a24);
    border-radius: 3px;
    background: rgba(245, 240, 230, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.barony-scope .bbm-facing-only-badge__icon {
    display: block;
    width: 0.72rem;
    height: 0.72rem;
    object-fit: contain;
    opacity: 0.9;
}

.barony-scope .bbm-charge-btn {
    position: absolute;
    left: -3px;
    top: -3px;
    z-index: 7;
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 1.5px solid #8a5a2b;
    border-radius: 3px;
    background: rgba(245, 240, 230, 0.95);
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.barony-scope .bbm-charge-btn:hover {
    background: #f3e6d4;
}

.barony-scope .bbm-charge-btn__icon {
    display: block;
    width: 0.72rem;
    height: 0.72rem;
    object-fit: contain;
    pointer-events: none;
}

.barony-scope .bbm-abilities-anchor {
    position: absolute;
    left: -3px;
    bottom: -3px;
    z-index: 8;
    pointer-events: auto;
}

.barony-scope .bbm-abilities-btn {
    width: 1.15rem;
    height: 1.15rem;
    padding: 0;
    border: 1.5px solid #6b4f8a;
    border-radius: 3px;
    background: rgba(245, 240, 230, 0.95);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.barony-scope .bbm-abilities-btn:hover {
    background: #efe8f5;
}

.barony-scope .bbm-abilities-btn.active {
    border-color: #2f6b4f;
    background: #e8f2ec;
    box-shadow: 0 0 0 1px rgba(47, 107, 79, 0.45), 0 0 9px rgba(47, 107, 79, 0.55);
}

.barony-scope .bbm-abilities-btn.active .bbm-abilities-btn__icon {
    filter: hue-rotate(70deg) saturate(1.3) brightness(0.95);
}

.barony-scope .bbm-abilities-btn__icon {
    display: block;
    width: 0.72rem;
    height: 0.72rem;
    object-fit: contain;
    pointer-events: none;
}

.barony-scope .bbm-charge-preview {
    position: absolute;
    inset: 1px;
    border-radius: 2px;
    background: rgba(138, 90, 43, 0.28);
    box-shadow: inset 0 0 0 1.5px rgba(138, 90, 43, 0.65);
    pointer-events: none;
    z-index: 2;
}

.barony-scope .bbm-facing-overlay {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 12;
    cursor: crosshair;
    background: rgba(47, 42, 36, 0.06);
}

.barony-scope .bbm-facing-overlay--charge {
    background: rgba(138, 90, 43, 0.1);
}

.barony-scope .bbm-move-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 1.1rem;
    padding: 0 3px;
    border-radius: 3px;
    background: rgba(47, 42, 36, 0.82);
    color: #f5f0e6;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    z-index: 4;
}

.barony-scope .bbm-token-slot--ghost .bbm-move-badge {
    top: 2px;
    left: 2px;
    right: auto;
}

.barony-scope .bbm-lock-badge {
    position: absolute;
    bottom: 3px;
    left: 3px;
    width: 0.55rem;
    height: 0.4rem;
    border: 1.5px solid #2f6b4f;
    border-radius: 1px;
    background: rgba(245, 240, 230, 0.85);
    z-index: 4;
    box-sizing: border-box;
}

.barony-scope .bbm-lock-badge::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -0.28rem;
    width: 0.32rem;
    height: 0.28rem;
    margin-left: -0.16rem;
    border: 1.5px solid #2f6b4f;
    border-bottom: none;
    border-radius: 0.2rem 0.2rem 0 0;
    box-sizing: border-box;
}

.barony-scope .bbm-engage-badge {
    position: absolute;
    left: 2px;
    top: 2px;
    min-width: 1rem;
    height: 1rem;
    padding: 0 2px;
    border-radius: 999px;
    background: rgba(168, 52, 52, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    z-index: 6;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(245, 240, 230, 0.6);
}

.barony-scope .bbm-full-defense-badge {
    position: absolute;
    right: 1px;
    top: 8px;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    background: rgba(36, 99, 178, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 7;
    pointer-events: none;
    box-shadow:
        0 0 0 1.5px rgba(245, 240, 230, 0.75),
        0 0 10px rgba(36, 99, 178, 0.55);
}

.barony-scope .bbm-token-slot.large .bbm-full-defense-badge {
    width: 2.05rem;
    height: 2.05rem;
    top: 10px;
    right: 2px;
}

.barony-scope .bbm-full-defense-badge__icon {
    width: 1.05rem;
    height: 1.05rem;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
}

.barony-scope .bbm-token-slot.large .bbm-full-defense-badge__icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Clears the charge button, which owns the same corner while a unit is still taking orders. */
.barony-scope .bbm-engage-badge.shifted {
    top: 1.2rem;
}

.barony-scope .bbm-engage-badge__icon {
    width: 0.68rem;
    height: 0.68rem;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
}

.barony-scope .bbm-engage-badge__count {
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    padding-right: 1px;
}

.barony-scope .bbm-ranged-badge {
    position: absolute;
    right: 2px;
    bottom: 2px;
    min-width: 1rem;
    height: 1rem;
    padding: 0 2px;
    border-radius: 999px;
    background: rgba(72, 110, 62, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    z-index: 6;
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(245, 240, 230, 0.6);
}

.barony-scope .bbm-ranged-badge__icon {
    width: 0.68rem;
    height: 0.68rem;
    object-fit: contain;
    display: block;
    filter: brightness(0) invert(1);
}

.barony-scope .bbm-ranged-badge__count {
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 1;
    padding-right: 1px;
}

.barony-scope .bbm-combat-clash--shot {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45))
            drop-shadow(0 0 6px rgba(72, 110, 62, 0.55));
}

.barony-scope .bbm-grid-stack {
    position: relative;
    display: inline-block;
}

.barony-scope .bbm-path-overlay {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none !important;
    z-index: 5;
    overflow: visible;
}

.barony-scope .bbm-anim-layer {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8;
    overflow: visible;
}

/* Threat ring that rides along with an animated token (follows via the slot transition). */
.barony-scope .bbm-threat-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1.5px dashed transparent;
    pointer-events: none;
    z-index: 1;
}

.barony-scope .bbm-threat-ring.ally {
    border-color: rgba(60, 110, 210, 0.70);
    background: rgba(60, 110, 210, 0.15);
}

.barony-scope .bbm-threat-ring.enemy {
    border-color: rgba(210, 60, 60, 0.70);
    background: rgba(210, 60, 60, 0.15);
}

.barony-scope .bbm-path-arrow {
    stroke-width: 3;
    fill: none;
}

.barony-scope .bbm-path-arrow--ally {
    stroke: rgba(47, 107, 79, 0.5);
}

.barony-scope .bbm-path-arrow--enemy {
    stroke: rgba(168, 52, 52, 0.5);
}

.barony-scope .bbm-attack-plan-overlay {
    z-index: 7;
}

.barony-scope .bbm-attack-plan-arrow {
    fill: none;
    stroke-width: 16;
    stroke-linecap: square;
    stroke-linejoin: square;
    stroke-opacity: 0.58;
}

.barony-scope .bbm-attack-plan-arrow--ally {
    stroke: rgb(199, 144, 26);
}

.barony-scope .bbm-attack-plan-arrow--enemy {
    stroke: rgb(183, 56, 56);
}

.barony-scope .bbm-attack-plan-arrow--focus {
    stroke-opacity: 0.9;
}

.barony-scope .bbm-combat-fx-layer {
    position: absolute;
    inset: 0;
    z-index: 12;
    pointer-events: none;
    overflow: visible;
}

.barony-scope .bbm-combat-clash {
    position: absolute;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    animation: bbm-combat-clash-in 0.35s ease-out both;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.barony-scope .bbm-combat-clash img {
    width: 40px;
    height: 40px;
    display: block;
}

.barony-scope .bbm-combat-float {
    position: absolute;
    transform: translate(-50%, -30%);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 800;
    font-size: 1.25rem;
    line-height: 1;
    letter-spacing: 0.02em;
    text-shadow:
        0 1px 0 rgba(255, 248, 235, 0.9),
        0 2px 4px rgba(0, 0, 0, 0.45);
    animation: bbm-combat-float 3s ease-out both;
    white-space: nowrap;
}

.barony-scope .bbm-combat-float--hit {
    color: #9b1c1c;
}

.barony-scope .bbm-combat-float--riposte {
    color: #7a3e12;
    animation-delay: 0.12s;
}

@keyframes bbm-combat-clash-in {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-18deg); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

@keyframes bbm-combat-float {
    0% { opacity: 0; transform: translate(-50%, 10%) scale(0.75); }
    18% { opacity: 1; transform: translate(-50%, -40%) scale(1.12); }
    72% { opacity: 1; transform: translate(-50%, -90%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(0.95); }
}

.barony-scope .bbm-hp-bar {
    position: absolute;
    top: 2px;
    left: 10%;
    width: 80%;
    height: 5px;
    z-index: 6;
    border-radius: 2px;
    background: #8b2a2a;
    box-shadow: 0 0 0 1px rgba(20, 16, 12, 0.55);
    overflow: hidden;
    pointer-events: none;
}

.barony-scope .bbm-hp-bar__fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(180deg, #7dcf6b 0%, #3f9a45 100%);
    transition: width 0.35s ease-out;
}

.barony-scope .bbm-token-slot.large .bbm-hp-bar {
    height: 6px;
    top: 3px;
}

.barony-scope .bbm-token-icon {
    width: 70%;
    height: 78%;
    object-fit: contain;
    pointer-events: none;
}

.barony-scope .bbm-token-fallback {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--barony-ink);
}

.barony-scope .bbm-token-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 1px;
    display: block !important;
    max-width: 100%;
    padding: 0 1px;
    font-size: 0.78rem !important;
    line-height: 1;
    font-weight: 700;
    text-align: center;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    hyphens: auto;
    color: var(--barony-ink);
    text-shadow: 0 0 3px #f5f0e6, 0 0 3px #f5f0e6, 0 0 3px #f5f0e6;
    pointer-events: none;
    z-index: 4;
}

.barony-scope .bbm-token-label.bbm-name--ally {
    color: var(--barony-accent);
}

.barony-scope .bbm-token-label.bbm-name--enemy {
    color: #8b3a3a;
}

.barony-scope .bbm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--barony-muted);
}

.barony-scope .bbm-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.barony-scope .bbm-legend__swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

.barony-scope .bbm-legend__swatch--range {
    background: rgba(156, 122, 51, 0.35);
    box-shadow: inset 0 0 0 1px rgba(156, 122, 51, 0.55);
}

.barony-scope .bbm-legend__swatch--ghost {
    background: rgba(47, 107, 79, 0.25);
    border: 1px dashed rgba(47, 107, 79, 0.7);
    box-sizing: border-box;
}

.barony-scope .bbm-legend__swatch--locked {
    background: rgba(47, 107, 79, 0.45);
    box-shadow: inset 0 0 0 2px rgba(47, 107, 79, 0.85);
}

.barony-scope .bbm-legend__swatch--deploy {
    background: rgba(70, 130, 80, 0.35);
}

.barony-scope .bbm-legend__swatch--difficult {
    background: rgba(139, 110, 60, 0.35);
}

.barony-scope .bbm-legend__swatch--impassable {
    background: rgba(60, 50, 40, 0.4);
}

@media (max-width: 700px) {
    .barony-scope .bbm-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(360px, 55vh) auto;
        overflow: auto;
    }
}

/* --- Seat P/H/F cell (Chambers + Purpose Templates tables) --- */
.seat-php-header {
    text-align: center;
}

.seat-php-header__icons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.seat-php-header__icons .php-metric-icon {
    width: 1em;
    height: 1em;
}

.seat-php-cell {
    text-align: right;
    white-space: nowrap;
}

.seat-php-values {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
    font-variant-numeric: tabular-nums;
}

.seat-php-value {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.seat-php-value .php-metric-icon {
    width: 0.95em;
    height: 0.95em;
}

.seat-php-value__num {
    font-weight: 700;
}

.seat-php-values--stacked {
    display: inline-grid;
    grid-template-columns: 2.6rem 2.2rem;
    grid-auto-rows: 1.15rem;
    align-items: center;
    justify-items: start;
    column-gap: 0.35rem;
    row-gap: 0.12rem;
}

.seat-php-values--stacked .seat-php-value {
    grid-column: 1;
    width: 2.6rem;
    height: 1.15rem;
    min-width: 2.6rem;
    max-width: 2.6rem;
    box-sizing: border-box;
    overflow: hidden;
}

.seat-php-values--stacked .seat-php-value__num {
    display: inline-block;
    min-width: 1.35em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.seat-php-values--stacked .lords-seat-prestige-mult {
    grid-column: 2;
    grid-row: 2;
    width: 2.2rem;
    min-width: 2.2rem;
    max-width: 2.2rem;
    height: 1.15rem;
    margin-top: 0;
    margin-left: 0;
    white-space: nowrap;
    overflow: hidden;
    text-align: left;
    line-height: 1.15rem;
    box-sizing: border-box;
}

.seat-php-values--stacked-singlecol {
    grid-template-columns: 2.6rem;
}

.seat-php-values--empty .seat-php-value {
    opacity: 0.55;
}

/* ---- Audience Hall parchment ---- */
.audience-hall__ink-btn {
    appearance: none;
    background: transparent;
    border: none;
    padding: .15rem .35rem;
    color: var(--barony-ink);
    font-family: 'IM Fell English', 'Times New Roman', serif;
    font-size: .95rem;
    letter-spacing: .02em;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: .18em;
    text-decoration-color: color-mix(in srgb, var(--barony-accent) 55%, transparent);
    transition: color .15s ease, opacity .15s ease;
}

.audience-hall__ink-btn:hover:not(:disabled) {
    color: var(--barony-accent);
}

.audience-hall__ink-btn:disabled {
    opacity: .4;
    cursor: default;
    text-decoration: none;
}

.audience-hall__ink-btn.is-on,
.audience-hall__ink-btn--strong {
    text-decoration-thickness: 2px;
    font-weight: 600;
}

.audience-scroll {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    animation: audience-scroll-in 1.1s ease-out both;
}

/* Each newly-opened audience/topic (fresh DOM via @key) fades in from fully invisible —
   slower and simpler (opacity only) than the other hub entrance animations. */
@keyframes audience-scroll-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Header (icon + petitioner/council label + title) stays put; only the passages below scroll. */
.audience-scroll__sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 1.35rem 1.4rem 1.5rem;
    color: #3a2c18;
    text-align: left;
    font-family: 'IM Fell English', 'Times New Roman', serif;
    font-size: 1.08rem;
    line-height: 1.55;
    background-color: #ead7ad;
    background-image:
        radial-gradient(ellipse at 18% 8%, rgba(255, 248, 230, .55), transparent 42%),
        radial-gradient(ellipse at 88% 92%, rgba(90, 60, 20, .28), transparent 48%),
        url('/images/parchment.jpg');
    background-size: auto, auto, cover;
    background-position: center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat;
    border: 1px solid #c4a46a;
    box-shadow:
        0 8px 22px rgba(60, 42, 18, .22),
        inset 0 0 48px rgba(120, 80, 30, .12);
}

.audience-scroll__header {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
    gap: .75rem;
    margin-bottom: .7rem;
}

.audience-scroll__header-text {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 0;
}

/* Only this region scrolls — the header above keeps a fixed footprint. */
.audience-scroll__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.audience-scroll__sheet::before,
.audience-scroll__sheet::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    height: 10px;
    pointer-events: none;
    opacity: .45;
    background: repeating-linear-gradient(
        90deg,
        transparent 0 10px,
        rgba(90, 60, 20, .12) 10px 11px);
}

.audience-scroll__sheet::before { top: 7px; }
.audience-scroll__sheet::after { bottom: 7px; }

.audience-scroll__sheet--empty {
    text-align: center;
    color: #6a5636;
    font-style: italic;
}

.audience-scroll__sheet--empty p {
    margin: .35rem 0 0;
}

.audience-scroll__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    margin: 0;
    font-size: .82rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #7a6238;
}

/* .barony-scope h2 (Eagle Lake) is more specific than a bare class — qualify with
   .barony-scope so this wins and the title matches the petitioner name's font. */
.barony-scope .audience-scroll__title {
    margin: 0;
    font-family: 'IM Fell English', 'Times New Roman', serif;
    font-weight: 400;
    font-size: 1.28rem;
    color: #2c2114;
}

.audience-scroll__passage {
    margin: 0 0 .85rem;
}

.audience-scroll__passage:last-child {
    margin-bottom: 0;
}

.audience-scroll__speaker {
    display: block;
    margin-bottom: .15rem;
    font-style: italic;
    font-size: .92rem;
    color: #6b542e;
}

.audience-scroll__body {
    white-space: pre-wrap;
}

.audience-scroll__delta {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .7rem;
    margin-top: .35rem;
    font-size: .85rem;
    color: #6b542e;
}

/* Docked reply composer — collapsed pill by default, expands on click,
   collapses again on an outside click (mirrors the chapter thread post-dock). */
.audience-scroll__dock {
    flex: 0 0 auto;
    width: 100%;
    border: 1px solid #c4a46a;
    background: color-mix(in srgb, #f7ecd0 92%, white);
    box-shadow: 0 4px 14px rgba(60, 42, 18, .18);
}

/* Animated in lock-step with .audience-scroll__dock-expanded below (same durations) so the
   collapsed pill fades/shrinks out WHILE the expanded panel grows in, instead of vanishing
   instantly via display:none — that instant snap is what made the whole area "jump". */
.audience-scroll__dock-collapsed {
    max-height: 3rem;
    opacity: 1;
    overflow: hidden;
    padding: .6rem .9rem;
    cursor: text;
    user-select: none;
    color: #6b542e;
    font-family: 'IM Fell English', 'Times New Roman', serif;
    font-size: .98rem;
    transition: max-height .25s ease, opacity .2s ease, padding .25s ease;
}

.audience-scroll__dock--expanded .audience-scroll__dock-collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
}

.audience-scroll__dock-expanded {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    padding: 0 .75rem;
    transition: max-height .25s ease, opacity .2s ease, padding .25s ease;
}

.audience-scroll__dock--expanded .audience-scroll__dock-expanded {
    max-height: 22rem;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    padding: .75rem;
}

.audience-scroll__modes,
.audience-scroll__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .55rem;
}

.audience-scroll__modes--gm {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

.audience-scroll__gm-select {
    width: 100%;
}

.audience-scroll__dock--expanded .audience-scroll__dock-expanded:has(.audience-scroll__actions--gm) {
    max-height: 30rem;
}

.audience-hall__mg-bar {
    padding: 0 .5rem;
}

.audience-scroll__draft {
    width: 100%;
    min-height: 4.4rem;
    resize: vertical;
    padding: .55rem .7rem;
    border: 1px solid #c4a46a;
    background: color-mix(in srgb, #f7ecd0 88%, white);
    color: #3a2c18;
    font-family: 'IM Fell English', 'Times New Roman', serif;
    font-size: 1.02rem;
    line-height: 1.45;
    box-shadow: inset 0 1px 4px rgba(80, 55, 20, .12);
}

.audience-scroll__draft:focus {
    outline: 1px solid color-mix(in srgb, var(--barony-accent) 55%, #c4a46a);
}

.audience-scroll__draft:disabled {
    opacity: .65;
}

