
.civcity-dashboard-template--workbench {
    min-height: 0;
}

.civcity-masterplan-block {
    margin: 0;
    padding: 1.25rem;
    border-radius: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid rgba(51, 65, 85, 0.1);
}

.civcity-masterplan-block__subtitle {
    font-size: 1rem;
    font-weight: 600;
}

.civcity-masterplan-block__summary {
    max-width: 76ch;
}

.civcity-masterplan-block__grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin-top: 1rem;
}

.civcity-masterplan-block__cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.civcity-workbench {
    --civcity-left-panel: 320px;
    --civcity-right-panel: 380px;
    display: grid;
    gap: 0;
    min-height: min(78vh, 980px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 22px;
    overflow: hidden;
    background: rgba(248,250,252,.6);
}

.civcity-workbench--dashboard {
    grid-template-columns: minmax(260px, var(--civcity-left-panel)) 8px minmax(0, 1fr) 8px minmax(300px, var(--civcity-right-panel));
}

.civcity-workbench--register {
    --civcity-right-panel: 360px;
    grid-template-columns: minmax(0, 1fr) 8px minmax(280px, var(--civcity-right-panel));
}

.civcity-workbench--power-user {
    grid-template-columns: minmax(0, 1fr);
}

.civcity-workbench__panel {
    min-width: 0;
    min-height: 0;
    padding: 1rem;
}


.civcity-workbench__panel .civcity-panel-stack {
    height: 100%;
}

.civcity-workbench__panel .civcity-panel__body--scrollable,
.civcity-workbench__panel .civcity-table-wrap,
.civcity-panel-stack--scrollable {
    min-height: 0;
}

.civcity-workbench__resizer {
    position: relative;
    cursor: col-resize;
    background: linear-gradient(180deg, rgba(226,232,240,0.9), rgba(203,213,225,0.9));
}

.civcity-workbench__resizer::after {
    content: '';
    position: absolute;
    inset: 50% 2px auto;
    height: 64px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.55);
}

.civcity-panel--explorer .civcity-panel__body,
.civcity-panel--document .civcity-panel__body,
.civcity-register-card .civcity-panel__body,
.civcity-panel--notes .civcity-panel__body {
    max-height: 100%;
}

.civcity-explorer-root {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.civcity-explorer-root__link,
.civcity-explorer-tree__link {
    text-decoration: none;
    color: #0f172a;
}

.civcity-explorer-tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.civcity-explorer-tree__item {
    margin: 0.1rem 0;
}

.civcity-explorer-tree__row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 34px;
    padding: 0.2rem 0.25rem;
    border-radius: 10px;
}

.civcity-explorer-tree__item.is-current > .civcity-explorer-tree__row {
    background: #eff6ff;
}

.civcity-explorer-tree__toggle,
.civcity-explorer-tree__spacer {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.civcity-explorer-tree__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 8px;
    background: #ffffff;
    padding: 0;
}

.civcity-explorer-tree__caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid #475569;
    border-bottom: 2px solid #475569;
    transform: rotate(-45deg);
    transition: transform .18s ease;
    margin-right: 2px;
}

.civcity-explorer-tree__toggle[aria-expanded="true"] .civcity-explorer-tree__caret {
    transform: rotate(45deg);
    margin-top: -2px;
}

.civcity-explorer-tree__icon {
    position: relative;
    width: 18px;
    height: 14px;
    flex: 0 0 18px;
}

.civcity-explorer-tree__icon.is-folder::before,
.civcity-explorer-tree__icon.is-root::before {
    content: '';
    position: absolute;
    inset: 2px 0 0;
    border-radius: 4px;
    background: #f8d66d;
    border: 1px solid rgba(146, 64, 14, 0.18);
}

.civcity-explorer-tree__icon.is-folder::after,
.civcity-explorer-tree__icon.is-root::after {
    content: '';
    position: absolute;
    top: 0;
    left: 1px;
    width: 8px;
    height: 5px;
    border-radius: 3px 3px 0 0;
    background: #f1c44b;
}

.civcity-explorer-tree__icon.is-file::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    background: #ffffff;
    border: 1px solid rgba(15,23,42,0.18);
}

.civcity-explorer-tree__children {
    padding-left: 1.55rem;
}

.civcity-domain-overview__hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (max-width: 1100px) {
    .civcity-workbench--dashboard {
        grid-template-columns: minmax(240px, 290px) 8px minmax(0, 1fr);
    }

    .civcity-workbench--dashboard .civcity-workbench__panel--right,
    .civcity-workbench--dashboard [data-civcity-resizer="right"] {
        display: none;
    }
}

@media (max-width: 920px) {
    .civcity-workbench,
    .civcity-workbench--dashboard,
    .civcity-workbench--register,
    .civcity-workbench--power-user {
        display: block;
        min-height: auto;
        border: 0;
        background: transparent;
    }

    .civcity-workbench__resizer {
        display: none;
    }

    .civcity-workbench__panel {
        padding: 0;
        margin-bottom: 1rem;
    }

    .civcity-workbench__panel[data-mobile-panel] {
        display: none;
    }

    .civcity-workbench__panel[data-mobile-panel].is-mobile-active,
    .civcity-panel[data-mobile-panel].is-mobile-active {
        display: block;
    }

    .civcity-workbench__panel .civcity-panel__body--scrollable,
    .civcity-workbench__panel .civcity-table-wrap {
        max-height: none;
    }
}


.civcity-dashboard-frame .civcity-workbench {
    width: 100%;
    min-height: 0;
    height: 100%;
}

.civcity-dashboard-frame .civcity-workbench__panel,
.civcity-dashboard-frame .civcity-panel-stack,
.civcity-dashboard-frame .civcity-panel,
.civcity-dashboard-frame .civcity-register-card,
.civcity-dashboard-frame .civcity-domain-overview,
.civcity-dashboard-frame .civcity-panel--relations,
.civcity-dashboard-frame .civcity-panel--document,
.civcity-dashboard-frame .civcity-panel--explorer,
.civcity-dashboard-frame .civcity-panel--notes {
    min-height: 0;
    height: auto;
}

.civcity-dashboard-frame .civcity-panel__body--scrollable,
.civcity-dashboard-frame .civcity-workbench__panel .civcity-table-wrap,
.civcity-dashboard-frame .civcity-panel-stack--scrollable {
    height: 100%;
    max-height: 100%;
}

.civcity-dashboard-frame .civcity-panel--document,
.civcity-dashboard-frame .civcity-register-card,
.civcity-dashboard-frame .civcity-panel--explorer,
.civcity-dashboard-frame .civcity-panel--notes,
.civcity-dashboard-frame .civcity-panel--relations {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.civcity-dashboard-frame .civcity-domain-overview {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.civcity-dashboard-frame .civcity-masterplan-block {
    overflow: auto;
}

@media (max-width: 920px) {
    .civcity-dashboard-frame .civcity-workbench,
    .civcity-dashboard-frame .civcity-workbench--dashboard,
    .civcity-dashboard-frame .civcity-workbench--register,
    .civcity-dashboard-frame .civcity-workbench--power-user {
        display: block;
        height: 100%;
        min-height: 0;
        border: 0;
        background: transparent;
    }

    .civcity-dashboard-frame .civcity-workbench__panel {
        height: 100%;
        min-height: 0;
    }

    .civcity-dashboard-frame .civcity-panel-stack,
    .civcity-dashboard-frame .civcity-panel,
    .civcity-dashboard-frame .civcity-register-card {
        height: 100%;
    }
}


/* v0.4.4 explorer panes */
.civcity-workbench {
    --civcity-left-panel: 240px;
    --civcity-right-panel: 250px;
    border-radius: 0;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #ffffff;
}

.civcity-workbench--dashboard {
    grid-template-columns: minmax(170px, var(--civcity-left-panel)) 6px minmax(0, 1fr) 6px minmax(210px, var(--civcity-right-panel));
}

.civcity-workbench--register,
.civcity-workbench--child {
    --civcity-right-panel: 260px;
    grid-template-columns: minmax(0, 1fr) 6px minmax(190px, var(--civcity-right-panel));
}

.civcity-workbench__panel {
    padding: 0;
    background: #ffffff;
}

.civcity-workbench__resizer {
    cursor: col-resize;
    background: #d7dde5;
}

.civcity-workbench__resizer::after {
    inset: 0;
    height: auto;
    transform: none;
    border-radius: 0;
    background: rgba(148, 163, 184, 0.2);
}

.civcity-masterplan-block {
    margin: 0;
    padding: 0;
    border-radius: 0;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.civcity-masterplan-strip__section {
    padding: 0.45rem 0.55rem;
}

.civcity-masterplan-strip__section + .civcity-masterplan-strip__section {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.civcity-masterplan-strip__section h2 {
    margin: 0 0 0.35rem;
    font-size: 14px;
    line-height: 1.2;
}

.civcity-masterplan-strip__section--meta .civcity-facts-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.civcity-explorer-root {
    margin-bottom: 0.2rem;
    padding: 0 0 0.2rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.civcity-explorer-tree__row {
    min-height: 22px;
    padding: 0.1rem 0.2rem;
    border-radius: 0;
}

.civcity-explorer-tree__toggle,
.civcity-explorer-tree__spacer {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.civcity-explorer-tree__toggle {
    border-radius: 2px;
}

.civcity-domain-overview__hero {
    margin-bottom: 0.45rem;
}

.civcity-domain-overview__hero h3 {
    margin: 0;
    font-size: 12px;
    line-height: 1.2;
}

.civcity-dashboard-frame {
    width: min(100%, calc((100dvh - 2rem) * 16 / 9), 1680px);
    grid-template-rows: auto minmax(0, 25%) auto minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0;
    box-shadow: none;
}

.civcity-dashboard-frame--child,
.civcity-dashboard-frame--register,
.civcity-dashboard-frame--sortable {
    gap: 0.4rem;
}

.civcity-dashboard-frame .civcity-document-meta {
    padding: 0.35rem 0.5rem;
}

@media (max-width: 1100px) {
    .civcity-workbench--dashboard {
        grid-template-columns: minmax(170px, 220px) 6px minmax(0, 1fr);
    }
}

@media (max-width: 920px) {
    .civcity-dashboard-frame {
        width: min(100%, calc((100dvh - 0.5rem) * 9 / 16), 440px);
        padding: 0.35rem;
        gap: 0.35rem;
    }

    .civcity-masterplan-strip__section--meta .civcity-facts-list {
        grid-template-columns: 1fr 1fr;
    }
}


.civcity-workbench__panel--context .civcity-panel-stack {
    grid-auto-rows: min-content;
}

.civcity-dashboard-frame--child .civcity-panel--document {
    grid-template-rows: minmax(0, 1fr);
}

.civcity-panel--meta .civcity-document-meta__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 920px) {
    .civcity-workbench__panel[data-mobile-panel] {
        display: none;
    }

    .civcity-panel[data-mobile-panel] {
        display: none;
    }

    .civcity-panel[data-mobile-panel].is-mobile-active {
        display: grid;
    }
}


/* v0.4.7 recovery viewport */
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-masterplan-block,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-panel,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-register-card,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-domain-overview {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-masterplan-block {
    padding: 0.35rem 0.45rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: #f8fafc;
}

body.civcity-theme-bridge-no-theme-chrome .civcity-workbench__panel--left,
body.civcity-theme-bridge-no-theme-chrome .civcity-workbench__panel--right,
body.civcity-theme-bridge-no-theme-chrome .civcity-workbench__panel--context {
    border-inline: 1px solid rgba(15, 23, 42, 0.08);
}

body.civcity-theme-bridge-no-theme-chrome .civcity-workbench__panel--center {
    background: #ffffff;
}

body.civcity-theme-bridge-no-theme-chrome .civcity-workbench__resizer {
    background: rgba(148, 163, 184, 0.22);
}

body.civcity-theme-bridge-no-theme-chrome .civcity-workbench__resizer::after {
    background: rgba(100, 116, 139, 0.38);
}


/* v0.4.8 recovery overrides */
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-masterplan-block,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-panel,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-register-card,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-domain-overview,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-panel--relations,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-panel--document,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-panel--explorer,
body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame .civcity-panel--notes {
    display: block;
    height: auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

body.civcity-theme-bridge-no-theme-chrome .civcity-workbench {
    --civcity-left-panel: 240px;
    --civcity-right-panel: 260px;
}

body.civcity-theme-bridge-no-theme-chrome .civcity-workbench--dashboard {
    grid-template-columns: minmax(180px, var(--civcity-left-panel)) 1px minmax(0, 1fr) 1px minmax(220px, var(--civcity-right-panel));
}

body.civcity-theme-bridge-no-theme-chrome .civcity-workbench--register,
body.civcity-theme-bridge-no-theme-chrome .civcity-workbench--child {
    grid-template-columns: minmax(0, 1fr) 1px minmax(220px, var(--civcity-right-panel));
}

body.civcity-theme-bridge-no-theme-chrome .civcity-masterplan-strip__section,
body.civcity-theme-bridge-no-theme-chrome .civcity-panel__body,
body.civcity-theme-bridge-no-theme-chrome .civcity-document-meta,
body.civcity-theme-bridge-no-theme-chrome .civcity-domain-overview__hero {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
}

body.civcity-theme-bridge-no-theme-chrome .civcity-masterplan-strip__section h2,
body.civcity-theme-bridge-no-theme-chrome .civcity-panel__header h2,
body.civcity-theme-bridge-no-theme-chrome .civcity-panel__toolbar h2 {
    font-size: 12px;
}

@media (max-width: 920px) {
    body.civcity-theme-bridge-no-theme-chrome .civcity-dashboard-frame {
        grid-template-rows: auto auto minmax(0, 1fr);
    }
}
