/*
 * TTech OneStop - Downtime app (Client/Apps/Downtime, /downtime). Linked by Components/App.razor after app.css:
 * it also uses the shared panels, tables, KPIs, bubbles and the mg- crumbs / hero / cards / chips / tabs / save bar of
 * app.css. Only dt- rules here (the Targets app's tg- rules are in targets.css).
 * Dark theme: the tokens of app.css, and the few colours of this app below (light, then dark).
 * Copyright (c) 2026 Toupin Technologies Inc. All rights reserved.
 */

:root {
  --dt-changed: #fff3c4;   /* a cell or event to justify, a change not saved */
  --dt-amber: #9a6b00;
  --dt-run: #ecebe3;       /* timeline: running */
  --dt-down: #f1c4c4;      /* timeline: down */
}
:root[data-theme="dark"] {
  --dt-changed: #463b14;
  --dt-amber: #e6b95e;
  --dt-run: #36322b;
  --dt-down: #5c2b2b;
}

/* ---- Page, columns, framed tabs ---- */
.dt-page { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.dt-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.dt-stack { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.dt-side { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 12px; align-items: start; }
.dt-lead { margin: -4px 2px 0; }
.dt-of { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.dt-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.dt-hero-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-page a.mg-chip { text-decoration: none; }
.dt-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dt-empty { flex-direction: column; gap: 8px; }
.dt-empty p { margin: 0; }
/* The app bar's tabs scroll sideways when the screen is narrower than them (not the whole page) */
.appbar:has(.dt-apptab) .apptabs { min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
/* Inside the Reporting portal the app bar is hidden: the pages as tabs on the page */
.subtabs.dt-framed-nav { display: none; margin-bottom: 10px; }
html.framed .subtabs.dt-framed-nav { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Inputs: pickers with an icon, search, chips ---- */
.dt-control {
  width: 100%;
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}
.dt-control:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }
.dt-control:disabled { background: var(--panel-2); color: var(--faint); }
select.dt-control { cursor: pointer; }
.dt-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 0 4px 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
}
.dt-picker .dt-control { width: auto; min-width: 150px; max-width: 280px; border: 0; background: transparent; box-shadow: none; }
.dt-picker.dt-search .dt-control { min-width: 220px; }
.dt-picker:focus-within { border-color: var(--accent); }
.dt-inline-search { width: 200px; }
.dt-clear { color: var(--accent); font-size: 0.84rem; font-weight: 700; text-decoration: none; }
.dt-clear:hover { text-decoration: underline; }
.dt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.dt-chip b { padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.74rem; }
.dt-chip:hover { border-color: var(--accent); }
.dt-chip.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.dt-chip.on b { background: color-mix(in srgb, var(--on-accent) 25%, transparent); color: var(--on-accent); }
.dt-chip .mud-icon-root { font-size: 1rem; }
.dt-chip-issues { color: var(--warn); }
.dt-chip-issues.on { border-color: var(--warn); background: var(--warn); color: var(--on-accent); }
.dt-linkbtn { padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 700; }
.dt-linkbtn:hover { background: var(--accent-soft); }

/* ---- Overview: headline figures, reasons per time category (one bar each, a link), quick links ---- */
.dt-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dt-kpis .kpi .value { font-size: 1.6rem; }
@media (min-width: 1300px) { .dt-kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.dt-check-text { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.dt-bars { display: flex; flex-direction: column; gap: 4px; }
.dt-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(90px, 2fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
}
.dt-bar-row:hover { background: var(--accent-soft); }
.dt-bar-row .name { overflow: hidden; font-size: 0.86rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.dt-bar-row .track { height: 10px; overflow: hidden; border-radius: 0 4px 4px 0; background: var(--rule); }
.dt-bar-row .fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--accent); }
.dt-bar-row .value { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.dt-quick { display: flex; flex-wrap: wrap; gap: 8px 10px; }

/* ---- Dialogs and forms ---- */
.dt-dialog-title { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; }
.dt-dialog-title .mud-icon-root { color: var(--accent); }
.dt-dialog-context { margin: 0 0 10px; }
.dt-dialog-error { margin-top: 12px; }
.dt-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dt-field { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.dt-field > span { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.dt-field textarea { resize: vertical; }
.dt-wide { grid-column: 1 / -1; }
.dt-check-field { display: flex; align-items: flex-start; gap: 8px; font-weight: 700; cursor: pointer; }
.dt-check-field input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }
.dt-check-field small { display: block; font-weight: 500; }
.dt-sentence { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); }
.dt-sentence .mud-icon-root { color: var(--accent); }

/* ---- Tick lists (reasons of a type, types of a reason) ---- */
.dt-tickgroup { padding: 10px 14px; }
.dt-tickgroup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.dt-tickgroup-head .spacer { flex: 1; }
.dt-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 10px; }
.dt-checks-narrow { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.dt-option { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 0.88rem; }
.dt-option:hover { background: var(--head-bg); }
.dt-option.active { background: var(--accent-soft); }
.dt-option.changed { border-color: var(--brand-gold); background: var(--note-soft); }
.dt-option.inactive .dt-option-text > span { color: var(--muted); text-decoration: line-through; }
.dt-option input { flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.dt-option-text { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.dt-option-text > span { overflow-wrap: anywhere; }
.dt-option-text small { color: var(--muted); font-size: 0.74rem; }
.dt-option-go { display: inline-flex; color: var(--faint); opacity: 0; }
.dt-option:hover .dt-option-go, .dt-option-go:focus { opacity: 1; }
.dt-option-go:hover { color: var(--accent); }
.dt-sticky-save { position: sticky; z-index: 3; bottom: 0; box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.08); }
.dt-group-link { color: inherit; text-decoration: none; }
.dt-group-link:hover { background: var(--accent-soft); }
.dt-equipment-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 12px; margin: 0; padding: 6px 10px 8px; list-style: none; }
.dt-equipment-list a { display: block; padding: 3px 0; color: inherit; font-size: 0.86rem; text-decoration: none; }
.dt-equipment-list a:hover { color: var(--accent); }

/* ---- Tables: an icon column, the explorer, the rows of a view ---- */
.table td.dt-act { width: 34px; color: var(--faint); text-align: center; }
.table tr.link:hover td.dt-act { color: var(--accent); }
.dt-explorer td { white-space: nowrap; }
.dt-list td { white-space: nowrap; }
.dt-filterbar .dt-picker .dt-control { min-width: 120px; }

/* ---- Matrix: types (columns) x reasons (rows); scrolls inside its frame, headers stay ---- */
.dt-matrix-wrap {
  width: fit-content;
  max-width: 100%;
  min-height: 240px;
  max-height: calc(100vh - 300px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
html.framed .dt-matrix-wrap { max-height: calc(100vh - 230px); }
.dt-matrix { border-collapse: separate; border-spacing: 0; font-size: 0.84rem; }
.dt-matrix thead th { position: sticky; z-index: 2; top: 0; border-bottom: 1px solid var(--border); background: var(--panel); }
.dt-matrix .dt-corner {
  z-index: 3;
  left: 0;
  min-width: 230px;
  padding: 8px 10px;
  border-right: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.3px;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}
.dt-typecol { min-width: 40px; padding: 8px 4px 4px; vertical-align: bottom; }
.dt-typecol a {
  display: inline-block;
  max-height: 150px;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: rotate(180deg);
  writing-mode: vertical-rl;
}
.dt-typecol a:hover { color: var(--accent); }
.dt-typecol small { display: block; margin-top: 4px; color: var(--muted); font-weight: 600; text-align: center; }
.dt-typecol.changed { background: var(--note-soft); }
.dt-rowhead {
  position: sticky;
  z-index: 1;
  left: 0;
  max-width: 280px;
  min-width: 230px;
  overflow: hidden;
  padding: 4px 10px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  font-weight: 600;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dt-rowhead a { color: inherit; text-decoration: none; }
.dt-matrix tbody tr:hover .dt-rowhead a { color: var(--accent); }
.dt-group-row .dt-rowhead { max-width: none; padding: 8px 10px 6px; background: var(--head-bg); }
.dt-group-row .dt-rowhead .hint { margin-left: 6px; }
.dt-cell { padding: 3px 4px; border-bottom: 1px solid var(--rule); text-align: center; }
.dt-cell input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
.dt-cell.on { background: var(--accent-soft); }
.dt-cell.changed { background: var(--dt-changed); box-shadow: inset 0 0 0 2px var(--brand-gold); }
.dt-matrix .empty { min-height: 80px; }

/* ---- Filters: one sentence each, the rows it removes ---- */
.dt-filters { display: flex; flex-direction: column; gap: 8px; }
.dt-filter { border: 1px solid var(--rule); border-radius: 8px; background: var(--panel-2); }
.dt-filter.open { border-color: var(--accent); background: var(--panel); }
.dt-filter-main { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; }
.dt-priority {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 28px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.dt-filter-text { min-width: 0; flex: 1; }
.dt-filter-text .name { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 800; }
.dt-filter-text .sentence { margin-top: 2px; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.dt-filter-text .sentence b { color: var(--text); font-weight: 700; }
.dt-filter-side { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; }
.dt-filter-rows { padding: 0 12px 12px; }

/* ---- Operator preview: the PI menu of each equipment ---- */
.dt-menus { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; align-items: start; }
.dt-menus.single { grid-template-columns: minmax(0, 560px); }
.dt-menu { display: flex; flex-direction: column; gap: 8px; border-top: 4px solid var(--accent); }
.dt-menu header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dt-menu-title { font-size: 1rem; font-weight: 800; }
.dt-menu-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8rem;
  font-weight: 900;
}
.dt-menu-group ul { margin: 6px 0 2px; padding: 0; list-style: none; }
.dt-menu-group li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 8px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.88rem;
}
.dt-menu-group li:last-child { border-bottom: 0; }
.dt-menu-group li.removed > span { color: var(--faint); text-decoration: line-through; }
.dt-menu-group li.removed a { text-decoration: none; }
.dt-menu-empty { padding: 8px 0; }

/* ---- PI Builder: the sets on the left, the rows of one on the right ---- */
.dt-setlist { display: flex; max-height: calc(100vh - 300px); flex-direction: column; gap: 2px; margin-top: 8px; overflow-y: auto; }
.dt-setlist a { padding: 6px 8px; border-radius: 6px; color: inherit; font-size: 0.88rem; text-decoration: none; }
.dt-setlist a:hover { background: var(--accent-soft); }
.dt-setlist a.on { background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* ---- Definitions: the time usage model as bands, terms and KPIs ---- */
.dt-definitions .panel p { max-width: 900px; line-height: 1.55; }
.dt-model { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.dt-band {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.2;
}
.dt-band b { font-size: 0.82rem; }
.dt-band span { overflow-wrap: anywhere; }
.dt-band.rest { border-left: 4px solid var(--accent); background: var(--accent-soft); color: var(--chip-text); }
.dt-band.ut { background: var(--chip); color: var(--chip-text); }
.dt-band.dt { background: var(--bad-soft); color: var(--bad); }
.dt-band.sb { background: var(--warn-soft); color: var(--warn); }
.dt-band.od { background: var(--info-soft); color: var(--info); }
.dt-band.np { background: var(--good-soft); color: var(--good-text); }
.dt-band.carried { opacity: 0.45; }
.dt-terms th { width: 40%; color: var(--text); font-size: 0.86rem; font-weight: 700; letter-spacing: 0; text-transform: none; white-space: normal; }
.dt-terms td { color: var(--muted); }
.dt-terms th, .dt-terms td { vertical-align: top; }
.dt-subhead { margin: 12px 0 2px; color: var(--muted); font-size: 0.75rem; font-weight: 900; letter-spacing: 0.3px; text-transform: uppercase; }
.dt-formula { display: block; width: fit-content; margin-top: 4px; color: var(--text); white-space: nowrap; }

/* ---- Narrow screens: one column; on a phone a 16px gutter, nothing wider than the screen ---- */
@media (max-width: 1100px) {
  .dt-cols, .dt-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .content:has(.dt-page) { padding-right: 16px; padding-left: 16px; }
  .dt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dt-kpis .kpi .value { font-size: 1.25rem; }
  .dt-form { grid-template-columns: minmax(0, 1fr); }
  .dt-picker, .dt-picker .dt-control, .dt-picker.dt-search .dt-control { width: 100%; min-width: 0; max-width: none; }
  .dt-picker { flex: 1 1 100%; }
  .dt-inline-search { width: 100%; }
  .dt-bar-row { grid-template-columns: minmax(0, 1fr) 70px 30px; }
  .dt-matrix-wrap { max-height: 70vh; }
  .dt-matrix .dt-corner, .dt-rowhead { min-width: 150px; max-width: 170px; }
  .dt-filter-main { flex-wrap: wrap; }
  .dt-filter-side { width: 100%; justify-content: flex-end; }
  .dt-menus.single { grid-template-columns: minmax(0, 1fr); }
  .dt-model { gap: 2px; }
  .dt-band { padding: 4px; font-size: 0.68rem; }
  .dt-band.carried span { display: none; }
  .dt-terms th { width: 45%; }
}

/* ==== Downtime system: Events, Reports, Sectors tabs (EventsPage, EventPage, ReportsPage, SectorsPage, EventSectorPage) ==== */

/* ---- The pages of the reasons configuration, as a second row (Reasons tab) ---- */
/* flex-shrink 0: in the page column (.content, overflow auto) a row that scrolls sideways would otherwise shrink to
   nothing on a long page */
.dt-reasontabs { display: flex; flex-shrink: 0; gap: 4px; margin: -2px 0 10px; overflow-x: auto; scrollbar-width: none; }
.dt-reasontab {
  flex: 0 0 auto;
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.dt-reasontab:hover { background: var(--accent-soft); color: var(--text); }
.dt-reasontab.active { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent); }
html.framed .dt-reasontabs { display: none; }

/* ---- The mine and its clock, above the pages ---- */
.dt-mineline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 0 2px; }
.dt-mineline .mud-icon-root { color: var(--accent); }
.dt-mineline .spacer { flex: 1; }
.dt-picker.dt-date .dt-control { width: 150px; min-width: 0; }
.dt-live { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; color: var(--bad); font-size: 0.84rem; font-weight: 800; }
.dt-live .dot, .dt-event.open .dt-event-bar { animation: dt-pulse 1.6s ease-in-out infinite; }
.dt-live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
@keyframes dt-pulse { 50% { opacity: 0.35; } }
.dt-warn { color: var(--warn); font-weight: 600; }

/* ---- Event cards: a coloured bar for the state (in progress red, to justify gold, justified olive, not a downtime grey) ---- */
.dt-eventgroup .dt-subhead { margin: 4px 2px 6px; }
.dt-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 8px; }
.dt-event {
  display: flex;
  min-width: 0;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
}
a.dt-event:hover { border-color: var(--accent); }
.dt-event.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.dt-event.none { background: transparent; box-shadow: none; }
.dt-event-bar { flex: 0 0 6px; background: var(--faint); }
.dt-event.open .dt-event-bar { background: var(--bad); }
.dt-event.todo .dt-event-bar { background: var(--brand-gold); }
.dt-event.justified .dt-event-bar { background: var(--accent); }
.dt-event.excluded .dt-event-bar { background: #c9c9c9; }
.dt-event-main { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; padding: 10px 12px; }
.dt-event-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.dt-event-state {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}
.dt-event.open .dt-event-state, .dt-eventhero.open .dt-event-state { background: var(--bad-soft); color: var(--bad); }
.dt-event.todo .dt-event-state, .dt-eventhero.todo .dt-event-state { background: var(--dt-changed); color: var(--gold-text); }
.dt-event.justified .dt-event-state, .dt-eventhero.justified .dt-event-state { background: var(--accent-soft); color: var(--accent-strong); }
.dt-event-time { color: var(--muted); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.dt-event-time b { color: var(--text); }
.dt-event-reason { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.88rem; }
.dt-event-go { align-self: center; margin-right: 8px; color: var(--faint); }
a.dt-event:hover .dt-event-go { color: var(--accent); }

/* ---- Event page: state band, split, justification, reason tree, history ---- */
.dt-eventhero { border-top: 5px solid var(--faint); }
.dt-eventhero.open { border-top-color: var(--bad); }
.dt-eventhero.todo { border-top-color: var(--brand-gold); }
.dt-eventhero.justified { border-top-color: var(--accent); }
.dt-split { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); }
.dt-split .dt-field { min-width: 230px; }
.dt-split p { flex-basis: 100%; margin: 0; }
.dt-justified { display: flex; flex-direction: column; gap: 8px; }
.dt-justified-reason { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 1rem; }
.dt-comment { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--panel-2); }
.dt-justify-foot {
  position: sticky;
  z-index: 2;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px -16px -14px;
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--panel);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
}
.dt-picked { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.dt-tree { display: flex; flex-direction: column; gap: 10px; }
.dt-tree .dt-picker.dt-search { align-self: flex-start; }
.dt-tree-group { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.dt-reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-reason {
  display: inline-flex;
  min-height: 40px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
}
.dt-reason small { color: var(--muted); font-size: 0.72rem; font-weight: 500; }
.dt-reason:hover { border-color: var(--accent); background: var(--panel-2); }
.dt-reason.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.dt-reason.on small { color: var(--on-accent); opacity: 0.85; }
button.dt-chip { cursor: pointer; font: inherit; font-size: 0.84rem; font-weight: 700; }
.dt-log { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dt-log li { display: flex; flex-direction: column; gap: 1px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); font-size: 0.88rem; }
.dt-log li:last-child { border-bottom: 0; }

/* ---- Reports: KPIs, Pareto bars with the cumulated share, availability per sector ---- */
.dt-report-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1300px) { .dt-report-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.dt-report-kpis .kpi.alert .value { color: var(--dt-amber); }
.dt-pareto { display: flex; flex-direction: column; gap: 3px; }
.dt-pareto-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) minmax(80px, 2fr) 64px 52px;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 6px;
}
.dt-pareto-row:hover { background: var(--accent-soft); }
.dt-pareto-row .name { overflow: hidden; font-size: 0.86rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.dt-pareto-row .track { height: 12px; overflow: hidden; border-radius: 0 4px 4px 0; background: var(--rule); }
.dt-pareto-row .fill { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--accent); }
.dt-pareto-row.todo .fill { background: var(--brand-gold); }
.dt-pareto-row.cat-bad .fill { background: #b14a4a; }
.dt-pareto-row.cat-info .fill { background: #4f7fb4; }
.dt-pareto-row.cat-warn .fill { background: #c98a3c; }
.dt-pareto-row .value { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dt-pareto-row .cum { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; text-align: right; }
.dt-avail {
  display: inline-block;
  min-width: 70px;
  padding: 1px 6px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-soft) var(--avail), transparent var(--avail));
}
.dt-definitions-note { max-width: 1000px; line-height: 1.5; }

/* ---- Sectors: one card each; the trigger's timeline on the sector page ---- */
.dt-sectorcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.dt-sectorcard { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.dt-sectorcard:hover { border-color: var(--accent); }
.dt-sectorcard.inactive { opacity: 0.6; }
.dt-sectorcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 1rem; }
.dt-sectorcard-head .mg-chip { margin-left: auto; }
.dt-sectorcard-trigger { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.86rem; overflow-wrap: anywhere; }
.dt-sectorcard-trigger .mud-icon-root { color: var(--accent); }
/* The trigger text takes the room left by the icon and the chip (it wraps there, the icon never stays alone on a line) */
.dt-sectorcard-trigger > span:not(.mg-chip) { flex: 1 1 0; min-width: 0; }
.dt-sectorcard-figures { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding-top: 6px; border-top: 1px solid var(--rule); font-size: 0.86rem; }
.dt-sectorcard-figures .warn b { color: var(--dt-amber); }
.dt-timeline { display: block; width: 100%; height: 64px; }
.dt-timeline .run { fill: var(--dt-run); }
.dt-timeline .down { fill: var(--dt-down); }
.dt-timeline .event { fill: var(--bad); }
.dt-timeline .tick { stroke: var(--faint); stroke-width: 1; }
.dt-timeline .label { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.dt-timeline-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; }
.dt-timeline-legend i { display: inline-block; width: 12px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.dt-timeline-legend i.run { background: var(--dt-run); }
.dt-timeline-legend i.down { background: var(--dt-down); }
.dt-timeline-legend i.event { background: var(--bad); }
.dt-preview-list { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding-left: 18px; font-size: 0.86rem; }

/* ---- Phone: one column, big touch targets for justifying ---- */
@media (max-width: 720px) {
  .dt-events, .dt-sectorcards { grid-template-columns: minmax(0, 1fr); }
  .dt-report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dt-picker.dt-date { flex: 1 1 45%; }
  .dt-picker.dt-date .dt-control { width: 100%; }
  .dt-pareto-row { grid-template-columns: minmax(0, 1fr) 60px 50px; }
  .dt-pareto-row .track { grid-column: 1 / -1; grid-row: 2; }
  .dt-reason { flex: 1 1 100%; min-height: 46px; }
  .dt-justify-foot .dt-hero-actions .mud-button-root { flex: 1 1 auto; }
  .dt-mineline .spacer { display: none; }
  .dt-justify-foot textarea { min-height: 38px; }
  .dt-eventhero .dt-hero-actions .mud-button-root { flex: 1 1 auto; }
}
