/* ---- V1.74 full: Tailings and Water's Overview (tail-): Client\Apps\MineRegister\Tailings\TailingsOverview.razor, mockup 33. Design system
   tokens only (--os-*), full page width. The TARP levels: green the good ground, yellow the gold (accent), orange the ochre (warn), red the
   bad ground. ---- */

.tail-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tail-late { color: var(--os-bad-text); font-weight: 600; }

/* The levels: a chip, a dot, a line */
.mreg-chip.tail-lv--green { background: var(--os-good-soft); color: var(--os-good-text); }
.mreg-chip.tail-lv--yellow { background: var(--os-accent-soft); color: var(--os-accent-text); }
.mreg-chip.tail-lv--orange { background: var(--os-warn-soft); color: var(--os-warn-text); }
.mreg-chip.tail-lv--red { background: var(--os-bad-soft); color: var(--os-bad-text); }
.tail-legend { display: inline-flex; flex-wrap: wrap; gap: var(--os-space-1); }

/* The facility cards */
.tail-facs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--os-gutter); margin-top: var(--os-gutter); }
.tail-fac { padding: var(--os-space-3); display: flex; flex-direction: column; gap: var(--os-space-2); }
.tail-fac__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--os-space-2); }
.tail-fac__head .os-panel__title { margin: 0; }
.tail-fac__head p { margin: 0; }
.tail-fac__why { margin: 0; padding: var(--os-space-2); border-radius: var(--os-radius-md); background: var(--os-surface-sunken); font: var(--os-type-caption); }
.tail-fac__why.tail-lv--green { background: var(--os-good-soft); color: var(--os-good-text); }
.tail-fac__why.tail-lv--yellow { background: var(--os-accent-soft); color: var(--os-accent-text); }
.tail-fac__why.tail-lv--orange { background: var(--os-warn-soft); color: var(--os-warn-text); }
.tail-fac__why.tail-lv--red { background: var(--os-bad-soft); color: var(--os-bad-text); }
.tail-fac__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: var(--os-space-2); margin: 0; }
.tail-fac__facts div { display: flex; flex-direction: column-reverse; }
.tail-fac__facts dt { font: var(--os-type-caption); color: var(--os-text-3); }
.tail-fac__facts dd { margin: 0; font: var(--os-type-kpi-sm); font-variant-numeric: tabular-nums; }
.tail-fac__foot { margin: 0; }
.tail-gistm__totals { padding: var(--os-space-2) var(--os-space-3) 0; }

/* The instruments against their triggers: the track of the four zones, the dot now, the ring 7 days ago */
.tail-ins .tail-ins__track-col { width: 45%; min-width: 180px; }
.tail-track { position: relative; height: 12px; border-radius: var(--os-radius-pill); background: var(--os-surface-sunken); }
.tail-track__zone { position: absolute; top: 0; bottom: 0; }
.tail-track__zone:first-child { border-radius: var(--os-radius-pill) 0 0 var(--os-radius-pill); }
.tail-track__zone:last-of-type { border-radius: 0 var(--os-radius-pill) var(--os-radius-pill) 0; }
.tail-zone--green { background: var(--os-good-soft); stroke: var(--os-good); }
.tail-zone--yellow { background: var(--os-accent-soft); stroke: var(--os-accent-fill); }
.tail-zone--orange { background: var(--os-warn-soft); stroke: var(--os-warn); }
.tail-zone--red { background: var(--os-bad-soft); stroke: var(--os-bad); }
.tail-track__dot, .tail-track__ring { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; }
.tail-track__ring { border: 2px solid var(--os-text-3); background: transparent; }
.tail-track__dot { background: var(--os-good); border: 2px solid var(--os-surface); }
.tail-track__dot.tail-lv--yellow { background: var(--os-accent-fill); }
.tail-track__dot.tail-lv--orange { background: var(--os-warn); }
.tail-track__dot.tail-lv--red { background: var(--os-bad); }

/* The trends against their trigger lines */
.tail-trends { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--os-space-3); padding: 0 var(--os-space-3) var(--os-space-3); }
.tail-trend { margin: 0; }
.tail-trend figcaption { display: flex; align-items: center; gap: var(--os-space-2); flex-wrap: wrap; }
.tail-chart { width: 100%; height: auto; display: block; }
.tail-chart__trigger { stroke-dasharray: 4 4; stroke-width: 1.5; }
.tail-chart__axis { stroke: var(--os-chart-axis); }
.tail-chart__label { fill: var(--os-chart-label); font: var(--os-type-caption); font-size: 0.55rem; }
.tail-chart__line { fill: none; stroke: var(--os-chart-2); stroke-width: 1.75; stroke-linejoin: round; }
.tail-chart__now { fill: var(--os-good); stroke: var(--os-surface); stroke-width: 1.5; }
.tail-chart__now.tail-lv--yellow { fill: var(--os-accent-fill); }
.tail-chart__now.tail-lv--orange { fill: var(--os-warn); }
.tail-chart__now.tail-lv--red { fill: var(--os-bad); }

/* The TARP response in progress */
.tail-pick { display: flex; flex-wrap: wrap; gap: var(--os-space-1); padding: 0 var(--os-space-3) var(--os-space-2); }
.tail-response { margin: 0 var(--os-space-3); padding: var(--os-space-2) var(--os-space-3); border-radius: var(--os-radius-md); background: var(--os-surface-sunken); }
.tail-response.tail-lv--yellow { background: var(--os-accent-soft); }
.tail-response.tail-lv--orange { background: var(--os-warn-soft); }
.tail-response.tail-lv--red { background: var(--os-bad-soft); }
.tail-response p { margin: var(--os-space-1) 0 0; }
.tail-steps { list-style: none; margin: 0; padding: var(--os-space-2) var(--os-space-3) var(--os-space-3); display: grid; gap: var(--os-space-2); }
.tail-step { display: flex; align-items: flex-start; gap: var(--os-space-2); }
.tail-step .mud-icon-root { flex: none; color: var(--os-text-3); }
.tail-step__text { flex: 1; min-width: 0; }
.tail-done { display: grid; gap: var(--os-space-2); padding: 0 var(--os-space-3) var(--os-space-3); }
.tail-done__buttons { display: flex; gap: var(--os-space-2); }

/* The water balance, the permit and the GISTM topics: labelled bars */
.tail-bars { list-style: none; margin: 0; padding: var(--os-space-2) var(--os-space-3); display: grid; gap: var(--os-space-2); }
.tail-bars li { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr auto; align-items: center; gap: var(--os-space-2); }
.tail-bars__label { font: var(--os-type-caption); color: var(--os-text-2); overflow-wrap: anywhere; }
.tail-bars__track { position: relative; display: flex; height: 10px; border-radius: var(--os-radius-pill); background: var(--os-surface-sunken); overflow: hidden; }
.tail-bars__fill { display: block; height: 100%; background: var(--os-chart-1); }
.tail-bars__fill--inflow { background: var(--os-chart-2); }
.tail-bars__fill--reclaim { background: var(--os-chart-3); }
.tail-bars__fill--evaporation { background: var(--os-chart-other); }
.tail-bars__fill--discharge { background: var(--os-chart-1); }
.tail-bars__fill--over { background: var(--os-bad); }
.tail-bars__fill--met { background: var(--os-good); }
.tail-bars__fill--partly { background: var(--os-warn); }
.tail-permit { display: grid; gap: var(--os-space-1); padding: var(--os-space-2) var(--os-space-3); }
.tail-permit__head { display: flex; justify-content: space-between; align-items: center; gap: var(--os-space-2); }
.tail-permit p { margin: 0; }

/* The inspections calendar: a mark per day (done the good ground, a finding the ochre, due the info ground, late the bad ground) */
.tail-panel { margin-top: var(--os-gutter); }
.tail-cal .tail-cal__day { text-align: center; white-space: nowrap; }
.tail-cal th.tail-cal__today { color: var(--os-accent-text); }
.tail-cal__mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--os-radius-sm, 4px);
    border: 1px solid var(--os-border); background: var(--os-surface-sunken); color: var(--os-text-3); vertical-align: middle; }
.tail-cal__mark .mud-icon-root { font-size: 1rem; }
.tail-cal--done { background: var(--os-good-soft); border-color: var(--os-good-border); color: var(--os-good-text); }
.tail-cal--finding { background: var(--os-warn-soft); border-color: var(--os-warn-border); color: var(--os-warn-text); }
.tail-cal--due { background: var(--os-info-soft); border-color: var(--os-info-border); color: var(--os-info-text); }
.tail-cal--late { background: var(--os-bad-soft); border-color: var(--os-bad-border); color: var(--os-bad-text); }
.tail-cal__legend { display: flex; flex-wrap: wrap; gap: var(--os-space-3); margin: 0; padding: var(--os-space-2) var(--os-space-3) var(--os-space-3); }
.tail-cal__legend > span { display: inline-flex; align-items: center; gap: var(--os-space-1); }
.tail-cal__legend .tail-cal__mark { width: 14px; height: 14px; }

/* The water flow diagram: in on the left, the site in the middle, out on the right (the chart hues of the design system) */
.tail-flow { padding: var(--os-space-2) var(--os-space-3); }
.tail-flow__svg { width: 100%; height: auto; display: block; }
.tail-flow__band { fill-opacity: 0.35; stroke: none; }
.tail-flow__site { fill: var(--os-text-2); }
.tail-flow__label { fill: var(--os-text-2); font: var(--os-type-caption); font-size: 0.7rem; }
.tail-flow__value { fill: var(--os-text); font: var(--os-type-caption); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
.tail-flow--inflow { fill: var(--os-chart-2); }
.tail-flow--drawn { fill: var(--os-chart-5); }
.tail-flow--reclaim { fill: var(--os-chart-3); }
.tail-flow--evaporation { fill: var(--os-chart-other); }
.tail-flow--discharge { fill: var(--os-chart-1); }
.tail-flow--stored { fill: var(--os-chart-4); }

/* The open actions: the action wraps; on a phone its source, facility and owner under it (browser check 2026-11-17) */
.tail-actions .tail-action { white-space: normal; min-width: 16ch; }
.tail-narrow { display: none; }
/* The flow legend: the phone's list in place of the diagram's labels */
.tail-flow__legend { display: none; list-style: none; margin: var(--os-space-2) 0 0; padding: 0; gap: var(--os-space-1); }
.tail-flow__legend li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--os-space-2); font: var(--os-type-caption); }
.tail-flow__swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.tail-flow__swatch.tail-flow--inflow { background: var(--os-chart-2); }
.tail-flow__swatch.tail-flow--drawn { background: var(--os-chart-5); }
.tail-flow__swatch.tail-flow--reclaim { background: var(--os-chart-3); }
.tail-flow__swatch.tail-flow--evaporation { background: var(--os-chart-other); }
.tail-flow__swatch.tail-flow--discharge { background: var(--os-chart-1); }
.tail-flow__swatch.tail-flow--stored { background: var(--os-chart-4); }

@media (max-width: 640px) {
    .tail-actions .tail-wide { display: none; }
    .tail-narrow { display: block; }
    .tail-flow__legend { display: grid; }
    .tail-step { flex-wrap: wrap; }
    .tail-step__text { flex-basis: calc(100% - 24px - var(--os-space-2)); }
    .tail-step > .os-btn { margin-left: calc(24px + var(--os-space-2)); }
    .tail-actions .tail-action { min-width: 12ch; }
    .tail-bars li { grid-template-columns: 1fr auto; }
    .tail-bars li .tail-bars__track { grid-column: 1 / -1; grid-row: 2; }
    /* The flow diagram shrinks with the screen: its labels give way to the legend list under it, at the page's size (re-review L3) */
    .tail-flow__label, .tail-flow__value { display: none; }
    .tail-flow { padding: var(--os-space-1); }
}
