/* The page frame: the left section rail, the main area, and how panels show and hide.
   Part of dashboard.html; loaded in number order (01 first). See server/public/dashboard/README.md. */
/* Ecosystem dashboard shell: a left-side section rail that stays put,
   with the content panel filling the rest of the screen beside it.
   This is the skeleton every ecosystem module (calculator/report,
   livestock, field data, marketplace, and future GIS/IoT/SME
   analytics) plugs into -- account/billing is just one section among
   them now, not the whole page. */
/* Full-bleed shell -- overrides the shared .container/.dashboard__body
   centering just for this page, so the rail can dock against the true
   left edge of the screen instead of the edge of a centered 1100px
   column, with the freed-up space going to the content on the right. */
/* Whole-page shell fixed to the viewport, with the rail and main
   content each scrolling independently inside it. This replaces an
   earlier design that measured the header's pixel height in JS and
   fed it into calc(100vh - var(--header-h)) for the iframe panels --
   fragile (one layout tick where the measurement ran before fonts/
   content settled, and every panel below it was the wrong height for
   the rest of the session) and the actual bug behind the embedded
   calculator/livestock/field-data panels rendering short, leaving a
   blank gap of unpainted page below them instead of filling the
   screen. Percentage-of-parent sizing inside a fixed-height flex
   column cannot drift the same way: .dash-main is exactly "the rest
   of the viewport below the header" by construction, every time. */
html,
body.dashboard {
    height: 100%;
}
body.dashboard {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dashboard__header {
    flex: 0 0 auto;
}
.dashboard__body {
    padding: 0;
    flex: 1 1 auto;
    min-height: 0;
}
.dash-shell {
    display: flex;
    align-items: stretch;
    height: 100%;
}
.dash-main {
    flex: 1;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    padding: 2rem clamp(20px, 3vw, 2.5rem) 3rem;
    box-sizing: border-box;
}
.dash-rail {
    width: 280px; /* Afrikaans labels are longer ("Gesondheidsgeskiedenis", "Plaasintelligensie") */
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden; /* a long label wraps; the rail itself never scrolls sideways */
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
    background: var(--surface);
    border-right: 1px solid var(--border);
}
.dash-rail__group-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
    margin: 0.9rem 0 0.3rem;
    padding: 0 0.6rem;
}
.dash-rail__group-label:first-child {
    margin-top: 0;
}
.dash-rail__item {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: none;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
}
.dash-rail__item:hover:not([disabled]) {
    background: var(--surface);
    color: var(--text);
}
.dash-rail__item.active {
    background: var(--card);
    border-color: var(--border);
    color: var(--text);
    font-weight: 600;
}
/* Folding groups (2026-11-19): one heading per part of the farm; only the open one shows its items. */
.dash-rail__group-btn {
    min-height: 44px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.dash-rail__group-btn::after {
    content: '▸';
    margin-left: auto;
    color: var(--dim);
    transition: transform 0.15s;
}
.dash-rail__group-btn[aria-expanded='true']::after {
    transform: rotate(90deg);
}
.dash-rail__group-btn:hover {
    background: var(--card);
}
/* Every label starts with an emoji. If a long label has to wrap, the second line lines up under the words
   (hanging indent) and a very long word breaks, instead of jumping down and leaving the emoji on its own. */
.dash-rail__item,
.dash-rail__group-btn {
    line-height: 1.3;
    overflow-wrap: anywhere;
    text-indent: -1.7em;
    padding-left: calc(0.7rem + 1.7em);
}
.dash-rail__items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-left: 0.6rem;
}
.dash-rail__items[hidden] {
    display: none;
}
.dash-rail-menu {
    display: none;
}
.dash-rail__item[disabled] {
    opacity: 0.5;
    cursor: default;
}
