#workspace .map-layout > aside.terracap-active { display: flex; }
#workspace aside.terracap-active > :not(.terracap-panel) { display: none; }
.terracap-panel[hidden] { display: none; }

.terracap-layer-controls {
    display: flex;
    gap: 0.6rem 1rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.75rem 0.7rem;
    margin: 0 0 0.55rem;
    border: 1px solid #d7e1eb;
    border-radius: 0.45rem;
}

.terracap-layer-controls legend {
    font-weight: 600;
}

.terracap-layer-controls label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.88rem;
}

.terracap-layer-controls input {
    width: 1rem;
    height: 1rem;
    accent-color: #0d5f4d;
}

.terracap-swatch {
    width: 0.68rem;
    height: 0.68rem;
    border-radius: 2px;
}

.terracap-header, .terracap-tabs, .terracap-search {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.terracap-panel .terracap-header {
    justify-content: space-between;
    margin: 0 0 1rem;
    padding: 0 0 0.8rem;
    min-height: auto;
    box-shadow: none;
}

.terracap-header h2 {
    margin: 0;
}

.terracap-tabs {
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.terracap-panel .terracap-header button,
.terracap-panel .terracap-tabs button,
.terracap-panel .terracap-content > button,
.terracap-panel .terracap-search button {
    width: auto;
    min-height: 2.5rem;
    margin: 0;
    font-size: 0.875rem;
    text-align: center;
}

.terracap-panel .terracap-content > button + button {
    margin-left: 0.4rem;
}

.terracap-tabs button[aria-pressed="true"] {
    background: #0d5f4d;
    border-color: #0d5f4d;
    color: #fff;
}

.terracap-search input {
    flex: 1;
    min-width: 0;
}

.terracap-search[hidden], .terracap-source[hidden] {
    display: none;
}

.terracap-live, .terracap-source, .terracap-note, .terracap-map-status {
    color: #43546a;
    font-size: 0.84rem;
}

.terracap-source {
    padding-top: 0.75rem;
    margin-top: 1rem;
    border-top: 1px solid #d7e1eb;
    overflow-wrap: anywhere;
}

.terracap-map-status {
    margin: 0.5rem 0.75rem;
}

.terracap-live:empty, .terracap-map-status:empty {
    display: none;
}

.terracap-results {
    list-style: none;
    margin: 0.5rem 0 0.9rem;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.terracap-panel .terracap-results button {
    width: 100%;
    text-align: left;
    overflow-wrap: anywhere;
    font-size: 0.875rem;
}

.terracap-results small {
    display: block;
    font-weight: normal;
    margin-top: 0.15rem;
}

.terracap-content h3, .terracap-content h4 {
    margin: 0.8rem 0 0.35rem;
    overflow-wrap: anywhere;
}

.terracap-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 0.5rem 0.8rem;
    overflow-wrap: anywhere;
}

.terracap-fields dt {
    font-weight: 600;
}

.terracap-fields dd {
    margin: 0;
}



.terracap-panel {
    width: 100%;
    min-width: 0;
}

@media (max-width: 900px) {
    #workspace .map-layout > aside.terracap-active {
        max-height: 45dvh;
    }
}
