/*
 * GM roster, inspector, and bottom toolbar layout. Loaded after the base styles.
 */

/* GM layout: roster, board, independent details, and an expandable tool tray. */
.workspace {
    --roster-width: 240px;
    position: relative;
    grid-template-columns: var(--roster-width) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
}
.workspace.details-open {
    grid-template-columns: var(--roster-width) minmax(0, 1fr) 310px;
}
.workspace.roster-collapsed {
    --roster-width: 0px;
}
.workspace > .board-panel {
    grid-column: 2;
    grid-row: 1;
    height: auto;
    min-height: 0;
}
.workspace > .units-panel {
    grid-column: 1;
    grid-row: 1;
    border-left: 0;
    border-right: 1px solid var(--line);
    min-width: 0;
    max-height: none;
}
.workspace .panel-heading {
    padding: 15px 15px 12px;
}
.workspace #unit-list {
    min-height: 0;
    max-height: none;
    padding: 0 10px 12px;
}
.workspace .unit-row {
    padding: 9px 8px;
}
.workspace .unit-row .roster-label {
    font-size: 12px;
}
.workspace .unit-row svg,
.workspace .unit-row img {
    width: 34px;
    height: 34px;
}
.roster-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--line);
}
.roster-footer #manage-group {
    margin: 0;
    text-align: left;
    padding: 9px 10px;
    font-size: 12px;
}
.roster-footer #group-summary {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-top: 2px;
}
.roster-footer #blackout {
    font-size: 11px;
    padding: 6px 10px;
}
.roster-footer #bring-party-here {
    margin: 0;
}
.workspace > .details-panel {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-left: 1px solid #485746;
    background: #202820;
}
.workspace #inspector {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    border-top: 0;
    padding: 16px;
    scrollbar-width: thin;
}
.inspector-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: -16px;
    z-index: 1;
    background: #202820;
    margin: -4px 0 16px;
    padding: 8px 0;
}
.workspace .inspector-heading h2 {
    margin: 0;
    font-size: 15px;
}
.inspector-heading button {
    border-color: transparent;
    background: transparent;
    padding: 5px 8px;
}
.workspace #inspector label:not(.check) {
    font-size: 11px;
    gap: 6px;
}
.workspace #inspector input:not([type='checkbox']),
.workspace #inspector select {
    font-size: 13px;
    padding: 8px;
}
.workspace #inspector .health-fields {
    gap: 8px;
    margin-top: 18px;
}
.workspace #inspector .health-adjust button {
    font-size: 11px;
}
.workspace #inspector .status-heading {
    margin-top: 18px;
}
.workspace #inspector .check,
.workspace #unit-appearance summary {
    font-size: 11px;
}
.workspace #inspector .inspector-hint {
    font-size: 10px;
}
.workspace #inspector .inspector-actions {
    margin-top: 22px;
}
.effect-delete {
    cursor: pointer;
    outline: none;
}
.effect-delete:hover .effect-delete-disc {
    fill: #68352b;
    stroke: #ffe0d2;
}
.effect-delete:focus-visible .effect-delete-disc {
    fill: #68352b;
    stroke: #fff3ca;
    stroke-width: 3;
}
.unit-badge {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    border-radius: 50%;
}
.unit-badge > img,
.unit-badge > svg {
    width: 100%;
    height: 100%;
}
.unit-badge.is-wounded {
    box-shadow: 0 0 0 2px #df6c65;
}
.unit-badge .health-skull {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 5px;
    border-radius: 50%;
    background: #121b16ba;
    color: #f0cebb;
    box-sizing: border-box;
}
.off-map {
    color: #dcc48f;
}
.health-label {
    color: #e7baab;
}
#health-indicators {
    margin-top: 14px;
}
#health-summary {
    font-size: 11px;
    color: #e7c9ad;
    margin: 8px 0;
}
#health-summary:empty {
    display: none;
}
#death-saves {
    border: 1px solid #5d6250;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    background: #19221c;
}
.death-save-heading {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 12px;
}
.death-save-heading span {
    color: var(--muted);
    font-size: 9px;
    align-self: center;
}
#death-save-dots {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.save-dots {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}
.save-dots.successes {
    color: #9ce2b2;
}
.save-dots.failures {
    color: #ff9c99;
}
.save-dots i {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 1px solid currentColor;
    border-radius: 50%;
}
.save-dots i.filled {
    background: currentColor;
}
.death-counts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.death-roll-controls {
    display: flex;
    gap: 5px;
    margin: 12px 0 8px;
}
.death-roll-controls button {
    font-size: 11px;
    padding: 6px;
    flex-shrink: 0;
}
#manual-death-roll {
    min-width: 0;
    width: 65px;
}
#inspector .inspector-actions {
    flex-wrap: wrap;
}
#delete-party-member {
    flex-basis: 100%;
    font-size: 11px;
}
.health-legend::before {
    content: '';
    width: 8px;
    height: 8px;
    border: 2px solid var(--health-color);
    border-radius: 50%;
}
.action-dock {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 18px;
    flex-shrink: 0;
    padding: 9px 12px;
    border-top: 1px solid var(--line);
    background: #1b231d;
}
.dock-add {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
}
.dock-add > button {
    font-size: 12px;
    padding: 7px 10px;
}
.dock-add > button[aria-expanded='true'] {
    background: #384a3d;
    border-color: #90b497;
}
.dock-add #browse-portraits {
    color: #f1dba9;
    border-color: #766d4c;
}
.dock-divider {
    height: 23px;
    border-left: 1px solid #465347;
    margin: 0 3px;
}
.action-dock > .board-navigation {
    position: static;
    transform: none;
    margin: 0;
    padding: 0;
    max-width: 100%;
    width: auto;
    border: 0;
    background: transparent;
    box-shadow: none;
}
.action-dock .board-navigation button {
    font-size: 12px;
    padding: 5px 8px;
}
.navigation-movement {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 2px;
    flex-shrink: 0;
}
.action-dock .view-target {
    width: auto;
    font-size: 10px;
    padding: 2px 5px;
    gap: 5px;
}
.action-dock .view-target select {
    font-size: 11px;
    padding: 5px 6px;
    max-width: 116px;
}
.action-dock .frame-shape {
    border-left: 1px solid #465347;
}
#tool-tray {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    z-index: 6;
    transform: translateX(-50%);
    width: min(460px, calc(100% - 24px));
    max-height: min(420px, 55dvh);
    border: 1px solid #64735e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 40px #0008;
    background: #1c251e;
}
#tool-tray .panel-heading {
    padding: 12px 14px 8px;
    flex-shrink: 0;
}
#tool-tray .panel-heading h2 {
    font-size: 15px;
}
#tool-tray .panel-heading > span {
    display: block;
    margin-left: auto;
    font-size: 10px;
}
#tool-tray .search {
    margin: 0 14px 8px;
}
#tool-tray #unit-library {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 14px 14px;
    gap: 8px;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
}
#tool-tray .library-token {
    min-height: 84px;
    padding: 9px 4px 8px;
    font-size: 11px;
    gap: 5px;
}
#tool-tray .library-token svg {
    width: 43px;
    height: 43px;
}
#tool-tray .library-explanation {
    font-size: 11px;
}
#tool-tray .library-section {
    margin-top: 7px;
    font-size: 11px;
}
#gm.split-view {
    grid-template-columns: minmax(540px, 1.3fr) minmax(300px, 1fr);
}
.split-view > .workspace {
    --roster-width: 200px;
    grid-template-columns: var(--roster-width) minmax(0, 1fr);
}
.split-view > .workspace.roster-collapsed {
    --roster-width: 0px;
}
.split-view .workspace > .details-panel {
    grid-area: auto;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(310px, 90%);
    z-index: 8;
    box-shadow: -12px 0 35px #0006;
}
.split-view .action-dock {
    gap: 6px;
}
@media (max-width: 1200px) {
    .workspace {
        --roster-width: 210px;
    }
    .workspace.details-open {
        grid-template-columns: var(--roster-width) minmax(0, 1fr);
    }
    .workspace > .details-panel {
        grid-area: auto;
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 310px;
        max-width: 90%;
        z-index: 8;
        box-shadow: -12px 0 35px #0006;
    }
    .workspace .board-toolbar {
        padding: 0 14px;
    }
}
@media (max-width: 980px) {
    #gm.split-view {
        min-height: 900px;
    }
    .split-view > .workspace {
        height: 600px;
        grid-template-rows: minmax(0, 1fr);
    }
}
@media (max-width: 900px) {
    .workspace,
    .workspace.details-open {
        grid-template-columns: 0 minmax(0, 1fr);
    }
    .workspace > .units-panel {
        grid-area: auto;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(270px, 85%);
        z-index: 7;
        box-shadow: 12px 0 35px #0006;
    }
    .workspace .board-toolbar {
        height: 68px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .workspace .map-button {
        flex-direction: column;
        align-items: start;
        gap: 0;
    }
}
@media (max-width: 680px) {
    #gm {
        height: 100dvh;
        min-height: 500px;
    }
    #gm:not(.split-view) > .workspace {
        flex: 1;
    }
    .workspace {
        grid-template-rows: minmax(0, 1fr);
    }
    .workspace > .board-panel {
        min-height: 0;
        height: auto;
    }
    .workspace .board-toolbar {
        height: 78px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 6px;
        padding: 8px 12px;
    }
    .workspace .map-button {
        flex-direction: row;
        gap: 7px;
    }
    .workspace .board-options {
        gap: 10px;
    }
    .action-dock {
        padding: 7px;
        gap: 6px;
    }
    .dock-add > button {
        font-size: 11px;
        padding: 6px 8px;
    }
    .action-dock .view-target {
        font-size: 9px;
    }
    .action-dock .board-navigation {
        gap: 1px;
    }
    .action-dock .board-navigation button {
        padding: 5px 7px;
    }
    .workspace #inspector {
        overflow-y: auto;
    }
    #tool-tray {
        width: calc(100% - 14px);
    }
    #tool-tray #unit-library {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .split-view > .workspace {
        grid-template-columns: 0 minmax(0, 1fr);
        height: 600px;
    }
}
