/* The environment workspace (envsuite.js): a centre view like the board designer. */

body.ws-env .centre-body > :not(#ews-view) { display: none !important; }
body.ws-env .rail-left .insert { display: none; }

.ews-view { flex: 1 1 auto; min-height: 0; display: flex; background: var(--panel); }
.ews-shell { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }

.ews-head {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 18px 10px; border-bottom: 1px solid var(--rule);
}
.ews-title { flex: 1 1 auto; min-width: 0; }
.ews-title h2 { margin: 0; font-family: var(--display); font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.ews-title p { margin: 3px 0 0; font-size: 12px; color: var(--ink-mid); max-width: 120ch; line-height: 1.4; }
.ews-target { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-mid); white-space: nowrap; }
.ews-target select { min-width: 190px; }

/* The setting: three cards and "none" */
.ews-kinds {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(120px, .55fr); gap: 10px;
    padding: 12px 18px; border-bottom: 1px solid var(--rule); background: var(--field);
}
.ews-kind {
    display: flex; gap: 11px; align-items: flex-start; text-align: left;
    padding: 10px 12px; border: 1px solid var(--rule-firm); border-radius: 8px;
    background: var(--panel); color: var(--ink); cursor: pointer; font: inherit;
    transition: border-color .12s, box-shadow .12s;
}
.ews-kind:hover { border-color: var(--brand); }
.ews-kind.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: var(--brand-pale); }
.ews-kind svg { flex: 0 0 26px; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5;
    stroke-linecap: round; stroke-linejoin: round; color: var(--ink-mid); margin-top: 1px; }
.ews-kind svg .fill { fill: currentColor; stroke: none; }
.ews-kind.on svg { color: var(--brand-deep); }
.ews-kind > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ews-kind strong { font-size: 13px; font-weight: 650; }
.ews-kind > span > span { font-size: 11.5px; color: var(--ink-mid); line-height: 1.35; }
.ews-kind-none { align-items: center; }
.ews-inherit { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.ews-inherit p { margin: 0; flex: 1 1 auto; color: var(--ink-mid); }

/* Body: sections, form, preview */
.ews-body {
    flex: 1 1 auto; min-height: 0;
    display: grid; grid-template-columns: 190px minmax(340px, 1fr) minmax(360px, 1.05fr);
}
.ews-nav { border-right: 1px solid var(--rule); padding: 10px 8px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.ews-nav-item {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
    padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink);
    text-align: left; font: inherit; font-size: 13px; cursor: pointer;
}
.ews-nav-item:hover { background: var(--field); }
.ews-nav-item.on { background: var(--brand-pale); color: var(--brand-deep); font-weight: 600; }
.ews-nav-item .meta { font-size: 11px; color: var(--ink-mid); font-weight: 400; }

.ews-form { overflow: auto; padding: 14px 20px 28px; border-right: 1px solid var(--rule); }
.ews-form .field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.ews-form .field-row > .field { flex: 1 1 140px; min-width: 120px; }
.ews-intro { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-mid); line-height: 1.5; max-width: 70ch; }
.ews-problems { margin-bottom: 12px; }
.ews-switch { margin: 0 0 14px; font-weight: 600; }
.ews-readout { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 4px; font-size: 12.5px; color: var(--ink); }
.ews-readout.muted, .ews-readout .u { color: var(--ink-mid); }
.ews-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 12px; margin: 4px 0 8px; }
.ews-check { display: flex; align-items: baseline; gap: 7px; font-size: 13px; padding: 3px 0; cursor: pointer; }
.ews-check .nm { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ews-check .meta { font-size: 11px; color: var(--ink-mid); white-space: nowrap; }
.ews-fill { padding: 8px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--field); }
.ews-profile { padding: 2px 0; }

.ews-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ews-table th { text-align: left; font-weight: 600; color: var(--ink-mid); font-size: 11.5px; padding: 5px 8px; border-bottom: 1px solid var(--rule-firm); }
.ews-table td { padding: 5px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.ews-table td.nm { font-weight: 550; }
.ews-table th.num, .ews-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ews-table tr.on td { background: var(--brand-pale); }
.ews-table input[type="number"] { width: 90px; }
.ews-table select { max-width: 230px; }
.muted-table td { color: var(--ink-mid); }
.ews-form .rt-wrap { overflow-x: auto; }

/* Preview */
.ews-preview { overflow: auto; padding: 14px 18px 28px; background: var(--panel); transition: opacity .15s; }
.ews-preview.busy { opacity: .72; }
.ews-empty h3 { margin: 4px 0 6px; font-size: 14px; }
.ews-empty p { margin: 0; font-size: 12.5px; color: var(--ink-mid); line-height: 1.5; max-width: 52ch; }
.ews-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin-bottom: 14px; }
.ews-tile { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border: 1px solid var(--rule); border-radius: 8px; background: var(--field); }
.ews-tile .k { font-size: 11px; color: var(--ink-mid); }
.ews-tile .v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); }
.ews-tile .v .u { font-size: 11px; font-weight: 500; color: var(--ink-mid); }
.ews-tile .s { font-size: 11px; color: var(--ink-mid); }

.ews-card { margin: 0 0 16px; padding: 10px 12px 8px; border: 1px solid var(--rule); border-radius: 8px; }
.ews-card h4 { margin: 0 0 4px; font-size: 12.5px; font-weight: 650; }
.ews-card h4 .u { font-weight: 400; color: var(--ink-mid); margin-left: 4px; }
.ews-legend { display: flex; flex-wrap: wrap; gap: 3px 14px; font-size: 11.5px; color: var(--ink-mid); margin: 2px 0 4px; }
.ews-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ews-legend i { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.ews-legend i.dash { background-image: linear-gradient(90deg, currentColor 60%, transparent 60%) !important; background-size: 5px 2px; }
.ews-chart { position: relative; }
.ews-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ews-chart .grid, .ews-sunpath .grid, .ews-orbit .grid { stroke: var(--rule); stroke-width: 1; fill: none; }
.ews-chart .axis { stroke: var(--rule-firm); stroke-width: 1; }
.ews-chart .xtick { stroke: var(--rule-firm); stroke-width: 1; }
.ews-card .tick { font-size: 10px; fill: var(--ink-mid); font-variant-numeric: tabular-nums; }
.ews-card .tick.strong { fill: var(--ink); font-weight: 650; }
.ews-chart .band { fill: var(--ink); opacity: .07; }
.ews-chart .cross { stroke: var(--ink-mid); stroke-width: 1; stroke-dasharray: 3 3; }
.ews-card .dot { stroke: var(--panel); stroke-width: 2; }
.ews-chart .hit { fill: transparent; cursor: crosshair; }
.ews-tip {
    position: absolute; top: 4px; z-index: 2; pointer-events: none;
    display: flex; flex-direction: column; gap: 2px;
    padding: 6px 9px; border: 1px solid var(--rule-firm); border-radius: 6px;
    background: var(--panel); box-shadow: var(--float-shadow, 0 4px 14px rgba(0,0,0,.12));
    font-size: 11.5px; color: var(--ink); white-space: nowrap;
}
.ews-tip span { display: flex; align-items: center; gap: 6px; color: var(--ink-mid); }
.ews-tip span b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ews-tip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ews-axis { margin: 2px 0 0; font-size: 11px; color: var(--ink-mid); }
.ews-data { margin-top: 4px; font-size: 11.5px; }
.ews-data summary { cursor: pointer; color: var(--ink-mid); }
.ews-data .table-scroll { max-height: 220px; overflow: auto; margin-top: 4px; }
.ews-sunpath svg, .ews-orbit svg { display: block; width: 100%; max-width: 260px; margin: 0 auto; height: auto; }
.ews-sunpath .now { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.ews-orbit .earth { fill: var(--cool-pale); stroke: var(--cool); stroke-width: 1.5; }
.ews-orbit .shadow { fill: var(--ink); opacity: .08; }
.ews-orbit .eclipse { stroke: var(--ink); stroke-linecap: round; }

@media (max-width: 1280px) {
    .ews-body { grid-template-columns: 170px minmax(300px, 1fr) minmax(300px, 1fr); }
    .ews-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
    .ews-body { grid-template-columns: 1fr; overflow: auto; }
    .ews-nav { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--rule); }
    .ews-form, .ews-preview { overflow: visible; border-right: 0; }
    .ews-head { flex-wrap: wrap; }
}

/* Checklists sit inside .field, whose inputs and labels are full-width blocks. */
.ews-form .ews-checks .ews-check { display: flex; flex-direction: row; align-items: center; gap: 7px; margin: 0; font-weight: 400; color: var(--ink); }
.ews-form .ews-checks .ews-check input[type="checkbox"] { width: auto; flex: 0 0 auto; margin: 0; }
