/*
 * 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(--os-accent-fill); background: var(--os-accent-fill); color: var(--os-on-accent-fill); }
.dt-chip.on b { background: color-mix(in srgb, var(--os-on-accent-fill) 25%, transparent); color: var(--os-on-accent-fill); }
.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(--os-accent);
  color: var(--os-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(--os-accent-fill); color: var(--os-on-accent-fill); 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; }

/* ---- Events as a table (V1.44, EventsTable.razor: the owner's PI Vision event table): a group row per sector, a row per event
   (in progress red at the left, to justify gold, not a downtime greyed), the green Justify button, sortable titles ---- */
.dt-layout { display: inline-flex; gap: 2px; margin-left: auto; }
.dt-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.dt-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.dt-table th, .dt-table td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.dt-table thead th { position: sticky; top: 0; z-index: 1; background: var(--chip); color: var(--muted); font-size: 0.76rem; font-weight: 800; white-space: nowrap; }
.dt-table .num { text-align: right; }
.dt-table .nowrap { white-space: nowrap; }
.dt-table-sort { all: unset; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; }
.dt-table-sort.on, .dt-table-sort:hover { color: var(--text); }
.dt-table-sort:focus-visible, .dt-table-fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dt-table-group th { background: var(--accent-soft); padding: 3px 6px; }
.dt-table-fold { all: unset; display: inline-flex; align-items: center; gap: 4px; font-weight: 800; cursor: pointer; }
.dt-table tbody tr:not(.dt-table-group):hover td { background: var(--accent-soft); }
.dt-table tr.dt-row-open td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.dt-table tr.dt-row-todo td:first-child { box-shadow: inset 4px 0 0 var(--brand-gold); }
.dt-table tr.dt-row-excluded td { color: var(--muted); }
.dt-col-reason { min-width: 260px; }
.dt-col-comment { text-align: center; }
.dt-col-actions { text-align: right; }
.dt-table-kind { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.72rem; font-weight: 700; }
.dt-table-state { color: var(--muted); }
.dt-table-state.excluded { font-style: italic; }
.dt-table-justify {
  display: inline-block;
  min-width: 96px;
  padding: 2px 10px;
  border-radius: 4px;
  background: var(--good);
  color: var(--on-accent);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.dt-table-justify:hover { filter: brightness(1.08); }
/* V1.51: Justify is a button (the reasons open over the table) */
button.dt-table-justify { border: 0; font: inherit; font-weight: 700; cursor: pointer; }
button.dt-table-justify:disabled { opacity: 0.6; cursor: progress; }
.dt-rp-what { margin-bottom: 8px; font-weight: 600; }
.dt-rp-comment { width: 100%; margin-bottom: 4px; resize: vertical; }
.dt-table-comment { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); cursor: help; }
.dt-table-icon { display: inline-flex; padding: 2px 3px; border-radius: 4px; color: var(--muted); }
.dt-table-icon:hover { background: var(--chip); color: var(--accent); }
.dt-table-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.dt-table-foot .spacer { flex: 1; }
.dt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- 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(--os-accent-fill); background: var(--os-accent-fill); color: var(--os-on-accent-fill); }
.dt-reason.on small { color: var(--os-on-accent-fill); opacity: 0.85; }
button.dt-chip { cursor: pointer; font: inherit; font-size: 0.84rem; font-weight: 700; }
/* V1.50: Justify's modal (ReasonPickerDialog): every reason of the area, one card per equipment */
.dt-rp-open { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dt-rp-search { display: flex; margin-bottom: 12px; }
.dt-rp-search input { flex: 1; }
.dt-rp-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; align-items: start; max-height: 65vh; overflow: auto; padding: 2px; }
.dt-rp-group { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.dt-rp-head { display: flex; align-items: baseline; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--rule); background: var(--head-bg); }
.dt-rp-head .hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-rp-count { padding: 0 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 0.74rem; font-weight: 700; }
.dt-rp-reasons { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
.dt-rp-reason { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; }
.dt-rp-reason .mg-chip { flex: none; font-size: 0.72rem; }
.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; }
}

/* ---- Platform batch 3, Q2: sector bubbles, Timeline tab, report tabs, GMG report, Settings tab ---- */
:root {
  --dt-gmg-pt: #7a9a4a;    /* the colours of the GMG classes (also GmgChart.razor) */
  --dt-gmg-np: #b9c98f;
  --dt-gmg-od: #e0bf3f;
  --dt-gmg-sbo: #d08a3a;
  --dt-gmg-sbe: #a3825a;
  --dt-gmg-dt: #b54a4a;
  --dt-gmg-ut: #8a8f99;
  --dt-tl-todo: #e0bf3f;   /* timeline: a downtime waiting for its reason */
  --dt-tl-done: #b54a4a;   /* timeline: a justified downtime */
  --dt-tl-excluded: #c9c9c9;
}
:root[data-theme="dark"] {
  --dt-gmg-np: #8a9a62;
  --dt-gmg-ut: #6c717b;
  --dt-tl-done: #c75b5b;
  --dt-tl-excluded: #5a5650;
}

/* Sector bubbles (SectorChips) */
.dt-sectorchips { align-items: center; }
.dt-sectorchips .dt-chip { text-decoration: none; }
.dt-chip-code { margin-right: 4px; color: var(--muted); font-size: 0.72rem; font-weight: 800; }
.dt-chip.on .dt-chip-code { color: var(--os-on-accent-fill); opacity: 0.8; }
.dt-chip-inactive { opacity: 0.65; border-style: dashed; }
.dt-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.dt-iconbtn:hover:not(:disabled) { border-color: var(--accent); }
.dt-iconbtn:disabled { opacity: 0.4; cursor: default; }
.dt-event-state.open { background: var(--bad-soft); color: var(--bad); }
.dt-event-state.todo { background: var(--dt-changed); color: var(--gold-text); }
.dt-event-state.justified { background: var(--accent-soft); color: var(--accent-strong); }

/* Timeline: a label column, then the track of each sector; the ruler on top */
.dt-tl-panel { display: flex; flex-direction: column; gap: 10px; }
.dt-tl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dt-tl-span { min-width: 104px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: center; }
.dt-tl-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 0.8rem; }
.dt-tl-key { display: inline-block; width: 12px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.dt-tl-key.run { background: var(--dt-run); }
.dt-tl-key.down { background: var(--dt-tl-done); }
.dt-tl-key.todo { background: var(--dt-tl-todo); }
.dt-tl-key.excluded { background: var(--dt-tl-excluded); }
.dt-tl { display: flex; flex-direction: column; gap: 6px; user-select: none; }
.dt-tl-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: center; gap: 10px; }
.dt-tl-label { display: flex; min-width: 0; flex-direction: column; line-height: 1.2; }
.dt-tl-label b { overflow: hidden; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }
.dt-tl-label small { color: var(--muted); font-size: 0.74rem; }
.dt-tl-todo { color: var(--gold-text); font-weight: 700; }
.dt-tl-ruler {
  position: relative;
  height: 38px;
  border-bottom: 1px solid var(--border);
  cursor: zoom-in;
  touch-action: pan-y;
}
.dt-tl-shift {
  position: absolute;
  top: 0;
  height: 16px;
  overflow: hidden;
  padding: 0 6px;
  border-radius: 4px 4px 0 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 16px;
  white-space: nowrap;
}
.dt-tl-shift.even { background: var(--panel-2); color: var(--muted); }
.dt-tl-tick { position: absolute; bottom: 0; width: 1px; height: 5px; background: var(--faint); }
.dt-tl-tick.major { height: 9px; }
.dt-tl-tick span {
  position: absolute;
  bottom: 10px;
  left: 0;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dt-tl-track {
  position: relative;
  height: 34px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel-2);
  cursor: crosshair;
  touch-action: pan-y;
}
.dt-tl-track.inactive { opacity: 0.6; cursor: default; }
.dt-tl-shiftline { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--faint); pointer-events: none; }
.dt-tl-seg { position: absolute; top: 6px; bottom: 6px; display: block; }
.dt-tl-seg.run { background: var(--dt-run); }
.dt-tl-seg.future { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--rule) 6px 7px); }
.dt-tl-seg.down {
  top: 2px;
  bottom: 2px;
  min-width: 3px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--dt-tl-done);
  cursor: pointer;
  font: inherit;
}
.dt-tl-seg.down.todo { background: var(--dt-tl-todo); }
.dt-tl-seg.down.excluded { background: var(--dt-tl-excluded); }
.dt-tl-seg.down:hover, .dt-tl-seg.down:focus-visible { z-index: 2; outline: 2px solid var(--text); outline-offset: 1px; }
.dt-tl-seg.down.selected { z-index: 3; outline: 3px solid var(--accent); outline-offset: 1px; }
.dt-tl-seg.down.dragging { z-index: 4; opacity: 0.75; }
.dt-tl-edge { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; touch-action: none; }
.dt-tl-edge.start { left: -3px; }
.dt-tl-edge.end { right: -3px; }
.dt-tl-edge::after {
  position: absolute;
  top: 25%;
  bottom: 25%;
  left: 3px;
  width: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  content: "";
}
.dt-tl-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--bad); pointer-events: none; }
.dt-tl-ghost {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border: 2px dashed var(--accent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  pointer-events: none;
}
.dt-tl-ruler .dt-tl-ghost { top: 16px; bottom: 0; }
.dt-tl-hint { margin: 0; }
.dt-tl-detail { display: flex; flex-direction: column; gap: 10px; border-color: var(--accent); }
.dt-tl-times { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.dt-tl-times .dt-field { min-width: 210px; }
.dt-tl-list tr.on td { background: var(--accent-soft); }

/* The two reports (ReportTabs) */
.dt-reporttabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); }
.dt-reporttab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}
.dt-reporttab:hover { color: var(--text); }
.dt-reporttab.active { border-color: var(--border); border-bottom-color: var(--background); background: var(--background); color: var(--accent-strong); }

/* GMG report: KPIs, waterfall, colours of the classes */
.dt-gmg-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dt-gmg-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.dt-gmg-mini { display: flex; flex-direction: column; gap: 1px; }
.dt-gmg-mini .label { color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.dt-gmg-mini b { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.dt-waterfall { display: flex; flex-direction: column; gap: 3px; }
.dt-wf-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(100px, 2fr) 64px 52px; align-items: center; gap: 10px; padding: 2px 6px; }
.dt-wf-name { font-size: 0.86rem; }
.dt-wf-name small { color: var(--muted); font-weight: 700; }
.dt-wf-row.total .dt-wf-name { font-weight: 800; }
.dt-wf-row.loss .dt-wf-name { padding-left: 12px; color: var(--muted); }
.dt-wf-track { position: relative; height: 14px; border-radius: 3px; background: var(--rule); }
.dt-wf-bar { position: absolute; top: 0; bottom: 0; min-width: 1px; border-radius: 3px; background: var(--accent); }
.dt-wf-row.gmg-pt .dt-wf-bar, .dt-pareto-row.gmg-pt .fill, .dt-gmg-dot.gmg-pt { background: var(--dt-gmg-pt); }
.dt-wf-row.gmg-np .dt-wf-bar, .dt-pareto-row.gmg-np .fill, .dt-gmg-dot.gmg-np { background: var(--dt-gmg-np); }
.dt-wf-row.gmg-od .dt-wf-bar, .dt-pareto-row.gmg-od .fill, .dt-gmg-dot.gmg-od { background: var(--dt-gmg-od); }
.dt-wf-row.gmg-sbo .dt-wf-bar, .dt-pareto-row.gmg-sbo .fill, .dt-gmg-dot.gmg-sbo { background: var(--dt-gmg-sbo); }
.dt-wf-row.gmg-sbe .dt-wf-bar, .dt-pareto-row.gmg-sbe .fill, .dt-gmg-dot.gmg-sbe { background: var(--dt-gmg-sbe); }
.dt-wf-row.gmg-dt .dt-wf-bar, .dt-pareto-row.gmg-dt .fill, .dt-gmg-dot.gmg-dt { background: var(--dt-gmg-dt); }
.dt-wf-row.gmg-ut .dt-wf-bar, .dt-pareto-row.gmg-ut .fill, .dt-gmg-dot.gmg-ut { background: var(--dt-gmg-ut); }
.dt-pareto-row.todo[class*="gmg-"] .fill { background: var(--brand-gold); }
.dt-wf-value { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dt-wf-share { font-size: 0.8rem; font-variant-numeric: tabular-nums; text-align: right; }
.dt-gmg-chip { border-left-width: 4px; }
.dt-gmg-chip.gmg-ut { border-left-color: var(--dt-gmg-ut); }
.dt-gmg-chip.gmg-dt { border-left-color: var(--dt-gmg-dt); }
.dt-gmg-chip.gmg-sbo { border-left-color: var(--dt-gmg-sbo); }
.dt-gmg-chip.gmg-sbe { border-left-color: var(--dt-gmg-sbe); }
.dt-gmg-chip.gmg-od { border-left-color: var(--dt-gmg-od); }
.dt-gmg-chip.gmg-np { border-left-color: var(--dt-gmg-np); }
.dt-gmg-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dt-gmg-legend .mg-chip { border: 1px solid var(--border); border-left-width: 4px; }

/* Settings: production day, GMG mapping */
.dt-classpicker { display: inline-flex; align-items: center; gap: 6px; }
.dt-classpicker .dt-control { min-width: 220px; }
.dt-gmg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); }
.dt-gmg-table tr.inactive td { opacity: 0.6; }
.dt-gmg-table tr.changed td { background: var(--dt-changed); }

@media (max-width: 1100px) {
  .dt-gmg-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .dt-tl-row { grid-template-columns: 84px minmax(0, 1fr); gap: 6px; }
  .dt-tl-label b { font-size: 0.78rem; }
  .dt-tl-legend { display: none; }
  .dt-tl-track { height: 40px; }
  .dt-tl-edge { width: 14px; }
  .dt-tl-edge.start { left: -6px; }
  .dt-tl-edge.end { right: -6px; }
  .dt-tl-times .dt-field { flex: 1 1 100%; min-width: 0; }
  .dt-gmg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dt-wf-row { grid-template-columns: minmax(0, 1fr) 60px 46px; }
  .dt-wf-track { grid-column: 1 / -1; grid-row: 2; }
  .dt-classpicker .dt-control { width: 100%; min-width: 0; }
}

/* V1.30: the AI diagnosis of a stop and of a period, and the usual reasons above the reason tree */
.dt-usual { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.dt-usual .hint { margin-right: 4px; font-weight: 700; }

/* ---- V1.44: slowdowns, the live GMG card and the four charts of the GMG report ---- */
/* A slowdown: hatched on the timeline, its state chip in amber everywhere */
.dt-tl-seg.down.slow {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0 4px, transparent 4px 8px);
  box-shadow: inset 0 0 0 1px var(--dt-gmg-np);
}
.dt-event-state.slow, .dt-event.slow .dt-event-state, .dt-eventhero.slow .dt-event-state { background: var(--warn-soft); color: var(--warn); }
/* V1.44: a stop or a slowdown added by hand ("Drag to add" above the timeline, "Kind" in the form): the legend's key, the
   choice, and the frame of the drag drawn hatched in amber while a slowdown is chosen */
.dt-tl-key.slow {
  background: var(--dt-tl-todo) repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.45) 0 3px, transparent 3px 6px);
  box-shadow: inset 0 0 0 1px var(--dt-gmg-np);
}
.dt-tl-kind { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dt-tl-kind .hint { font-size: 0.8rem; font-weight: 700; }
.dt-chip.dt-kind.slow.on { border-color: var(--warn); background: var(--warn); color: var(--on-accent); }
.dt-tl.draw-slow .dt-tl-track { cursor: cell; }
.dt-tl.draw-slow .dt-tl-track .dt-tl-ghost {
  border-color: var(--warn);
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--warn) 35%, transparent) 0 4px, transparent 4px 8px);
}
.dt-tl-list .dt-table-kind { vertical-align: 1px; }

/* Live GMG card (GmgLiveCard.razor) */
.dt-live { margin-bottom: 12px; }
.dt-live-tick { display: inline-flex; align-items: center; gap: 6px; }
.dt-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); animation: dt-live-pulse 1.6s infinite; }
@keyframes dt-live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .dt-live-dot { animation: none; } }
.dt-live-legend { font-size: 0.78rem; color: var(--muted); }
.dt-live-key { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; }
.dt-live-key .dt-gmg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.dt-live-rows { display: flex; flex-direction: column; gap: 10px; }
.dt-live-row { display: grid; grid-template-columns: minmax(90px, 180px) minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 0.86rem; }
.dt-live-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dt-live-bar { display: flex; gap: 2px; height: 16px; min-width: 0; }
.dt-live-part { display: block; height: 100%; min-width: 2px; transition: width 0.6s ease; }
.dt-live-part:first-child { border-radius: 4px 0 0 4px; }
.dt-live-part:last-child { border-radius: 0 4px 4px 0; }
.dt-live-part:only-child { border-radius: 4px; }
.dt-live-part.gmg-pt { background: var(--dt-gmg-pt); }
.dt-live-part.gmg-np { background: var(--dt-gmg-np); }
.dt-live-part.gmg-od { background: var(--dt-gmg-od); }
.dt-live-part.gmg-sbo { background: var(--dt-gmg-sbo); }
.dt-live-part.gmg-sbe { background: var(--dt-gmg-sbe); }
.dt-live-part.gmg-dt { background: var(--dt-gmg-dt); }
.dt-live-part.gmg-ut { background: var(--dt-gmg-ut); }
.dt-live-state { padding: 1px 9px; border-radius: 10px; font-size: 0.76rem; font-weight: 700; white-space: nowrap; text-decoration: none; }
.dt-live-state.run { background: var(--good-soft); color: var(--good-text); }
.dt-live-state.slow { background: var(--warn-soft); color: var(--warn); }
.dt-live-state.stop { background: var(--bad-soft); color: var(--bad); }
@media (max-width: 640px) {
  .dt-live-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .dt-live-state { justify-self: start; }
}

/* The four charts under the GMG report (GmgWeekCharts.razor): a 2 x 2 grid, one column on a phone */
.dt-charts4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 12px; margin: 12px 0; }
.dt-charts4 > .panel { margin: 0; min-width: 0; }

/* V1.73, each company's own hub (Client section) */
/* A setup form read only for a person who is not one of the company's administrators (HubSiteSelection.CanManage): the native
   controls inside are disabled; the box itself takes no room */
.dt-lock { display: contents; min-width: 0; margin: 0; padding: 0; border: 0; }
.dt-mono { font-family: var(--os-font-mono, ui-monospace, monospace); font-size: 0.8rem; }
/* The sector's trigger on the company's AVEVA CONNECT (EventSectorPage.razor): the search and the points found */
.dt-searchrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dt-searchrow .dt-control { flex: 1 1 260px; min-width: 0; }
.dt-hits { display: flex; flex-direction: column; max-height: 280px; overflow: auto; border: 1px solid var(--os-border); border-radius: 8px; }
.dt-hit { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 6px 10px; border: 0; border-bottom: 1px solid var(--os-border);
  background: none; color: inherit; font: inherit; font-size: 0.86rem; text-align: left; cursor: pointer; }
.dt-hit:last-child { border-bottom: 0; }
.dt-hit:hover, .dt-hit:focus-visible { background: var(--os-accent-soft); }
.dt-hit.on { border-left: 3px solid var(--os-accent); background: var(--os-accent-soft); }
.dt-hit .hint { font-size: 0.78rem; }
/* The plant site's link to a site of the company (SitePage.razor) */
.dt-coresite { margin-top: 6px; }
/* Reasons > Import (ReasonWorkbookPage.razor) */
.dt-workbook-actions, .dt-workbook-totals { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.dt-upload { position: relative; display: inline-flex; align-items: center; gap: 4px; margin: 6px 0; padding: 6px 12px; border: 1px solid var(--os-accent);
  border-radius: 6px; color: var(--os-accent); font-size: 0.84rem; font-weight: 600; cursor: pointer; }
.dt-upload:hover, .dt-upload:focus-within { background: var(--os-accent-soft); }
.dt-upload.disabled { opacity: 0.5; pointer-events: none; }
.dt-upload-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dt-workbook-table td { vertical-align: top; }
.dt-wb-change { font-size: 0.82rem; overflow-wrap: anywhere; }
.dt-wb-arrow { vertical-align: middle; color: var(--os-text-2); }

/* ---- V1.74, Reasons: Build the menus (BuildPage.razor), Sites (SitesPage.razor), the Advanced row of tabs, "Not linked to a site"
   (PlantPage.razor). The design system's tokens only (Refined Lode: --os-*), weights up to 600, rem sizes. The time category's colour
   (Dt.CategoryClass: bad = unscheduled downtime, info = scheduled downtime, warn = standby, neutral = the others) is one rule set
   for the dots, the operator menu's bars and the comparison. ---- */
.dt-advtabs { display: flex; flex-shrink: 0; gap: 2px; margin: -6px 0 10px; padding-bottom: 6px; overflow-x: auto; border-bottom: 1px solid var(--os-border-subtle); scrollbar-width: none; }
.dt-advtab { flex: 0 0 auto; padding: 4px 10px; border-radius: var(--os-radius-sm); color: var(--os-text-2); font: var(--os-type-small); text-decoration: none; white-space: nowrap; }
.dt-advtab:hover { background: var(--os-surface-hover); color: var(--os-text); }
.dt-advtab.active { background: var(--os-surface-selected); color: var(--os-text); font-weight: 600; }
html.framed .dt-advtabs { display: none; }

.dt-build-head { display: flex; flex-direction: column; gap: 4px; }
.dt-build-head h2 { display: flex; align-items: center; gap: 6px; margin: 0; }
.dt-lead-text { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: 0; color: var(--os-text-2); font: var(--os-type-body); }

/* Things to check, as a strip */
.dt-checkstrip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--os-border); border-radius: var(--os-radius-md);
  background: var(--os-surface-sunken); }
.dt-checkstrip-title { display: inline-flex; align-items: center; gap: 4px; color: var(--os-text-2); font: var(--os-type-label); }
.dt-checkchip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border: 1px solid var(--os-border); border-radius: var(--os-radius-pill);
  background: var(--os-surface); color: var(--os-text); font: var(--os-type-small); text-decoration: none; }
.dt-checkchip.warn { border-color: var(--os-warn-border); background: var(--os-warn-soft); color: var(--os-warn-text); }
.dt-checkchip.info { border-color: var(--os-info-border); background: var(--os-info-soft); color: var(--os-info-text); }
.dt-checkchip:hover { border-color: var(--os-border-strong); }

/* The three steps: side by side, stacked on a phone */
.dt-build { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.15fr) minmax(0, 0.95fr); gap: 12px; align-items: start; }
@media (max-width: 1100px) { .dt-build { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 720px) { .dt-build { grid-template-columns: minmax(0, 1fr); } }
.dt-step { display: flex; min-width: 0; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--os-border); border-radius: var(--os-radius-lg);
  background: var(--os-surface); }
.dt-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font: var(--os-type-h4); }
.dt-step-num { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: var(--os-radius-pill); background: var(--os-accent-fill);
  color: var(--os-on-accent-fill); font: var(--os-type-label); }
.dt-step-hint { margin-left: auto; color: var(--os-text-3); font: var(--os-type-small); }

/* 1 Kinds of equipment */
.dt-kinds { display: flex; flex-direction: column; gap: 6px; }
.dt-kind { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--os-border);
  border-radius: var(--os-radius-md); background: var(--os-surface); color: var(--os-text); font: inherit; text-align: left; cursor: pointer; }
.dt-kind:hover { border-color: var(--os-border-strong); background: var(--os-surface-hover); }
.dt-kind.on { border: var(--os-border-w-strong) solid var(--os-accent); background: var(--os-ai-soft); }
.dt-kind.changed .dt-kind-name::before { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--os-vein);
  content: ""; vertical-align: middle; }
.dt-kind-main { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.dt-kind-name { font: var(--os-type-body-strong); }
.dt-kind-sub { color: var(--os-text-2); font: var(--os-type-small); }
.dt-kind-chip { align-self: flex-start; padding: 0 7px; border-radius: var(--os-radius-pill); font: var(--os-type-caption); }
.dt-kind-chip.shared { background: var(--os-info-soft); color: var(--os-info-text); }
.dt-kind-chip.own { background: var(--os-warn-soft); color: var(--os-warn-text); }
.dt-kind-count { flex: 0 0 auto; padding: 1px 8px; border-radius: var(--os-radius-pill); background: var(--os-surface-sunken); color: var(--os-text-2); font: var(--os-type-small); }
.dt-addrow { display: flex; align-items: center; gap: 4px; width: 100%; padding: 8px 10px; border: 1px dashed var(--os-border-strong); border-radius: var(--os-radius-md);
  background: none; color: var(--os-accent-text); font: var(--os-type-body-strong); cursor: pointer; }
.dt-addrow:hover { background: var(--os-accent-soft); }
.dt-inlineform { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--os-border); border-radius: var(--os-radius-md); background: var(--os-surface-sunken); }
.dt-inlineform-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* 2 Its reasons, by time category */
.dt-cat-head { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--os-text); font: var(--os-type-eyebrow); text-transform: uppercase; }
.dt-dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--os-neutral); vertical-align: middle; }
.dt-dot.bad { background: var(--os-bad); }
.dt-dot.info { background: var(--os-info); }
.dt-dot.warn { background: var(--os-warn); }
.dt-dot.good { background: var(--os-good); }
.dt-reasonlist { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.dt-reasonrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding: 4px 6px; border-radius: var(--os-radius-sm); }
.dt-reasonrow:hover { background: var(--os-surface-hover); }
.dt-reasonrow label { display: flex; min-width: 0; align-items: center; gap: 8px; cursor: pointer; }
.dt-reasonrow input { width: 16px; height: 16px; accent-color: var(--os-accent); }
.dt-reasonrow.changed { background: var(--os-warn-soft); }
.dt-reasonrow.added { background: var(--os-good-soft); }
.dt-reasonname { font: var(--os-type-body); }
.dt-reasonchips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.dt-minichip { display: inline-flex; align-items: center; gap: 2px; padding: 0 7px; border-radius: var(--os-radius-pill); background: var(--os-surface-sunken);
  color: var(--os-text-2); font: var(--os-type-caption); text-decoration: none; white-space: nowrap; }
.dt-minichip.good { background: var(--os-good); color: var(--os-on-good); }
.dt-minichip.warn { background: var(--os-warn-soft); color: var(--os-warn-text); }
.dt-minichip .mud-icon-root { font-size: 0.9rem; }

/* 3 The operator's phone */
.dt-phone { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 2px solid var(--os-text); border-radius: var(--os-radius-xl); background: var(--os-surface); }
.dt-phone-top { color: var(--os-text-2); font: var(--os-type-small); text-align: center; }
.dt-phone-q { font: var(--os-type-body-strong); }
.dt-menuitem { padding: 8px 10px; border-left: 4px solid var(--os-neutral); border-radius: var(--os-radius-sm); background: var(--os-neutral-soft); color: var(--os-text);
  font: var(--os-type-body); }
.dt-menuitem.bad { border-left-color: var(--os-bad); background: var(--os-bad-soft); }
.dt-menuitem.info { border-left-color: var(--os-info); background: var(--os-info-soft); }
.dt-menuitem.warn { border-left-color: var(--os-warn); background: var(--os-warn-soft); }
.dt-menuitem.new { font: var(--os-type-body-strong); }

/* Where this menu is used, and the bar that says what Save does */
.dt-wherechips { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-wherechip { padding: 3px 10px; border: 1px solid var(--os-border); border-radius: var(--os-radius-pill); font: var(--os-type-small); }
.dt-wherechip b { font-weight: 600; }
.dt-savebar { position: sticky; bottom: 8px; z-index: var(--os-z-raised); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--os-warn-border); border-radius: var(--os-radius-md); background: var(--os-warn-soft); color: var(--os-text); font: var(--os-type-body); }
.dt-savebar-text { min-width: 0; flex: 1 1 320px; }

/* Equipment: a plant site linked to no site */
.dt-unlinked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dt-chip-warn { padding: 0 8px; border-radius: var(--os-radius-pill); background: var(--os-warn-soft); color: var(--os-warn-text); font: var(--os-type-caption); }

/* Sites: one card per site, the preview "dialogs", the comparison */
.dt-sitecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; align-items: start; }
.dt-sitecard { display: flex; min-width: 0; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--os-border); border-radius: var(--os-radius-lg);
  background: var(--os-surface); }
.dt-sitecard.current { border: var(--os-border-w-strong) solid var(--os-accent); }
.dt-sitecard-head { display: flex; align-items: center; gap: 8px; }
.dt-sitecard-name { margin: 0; font: var(--os-type-h4); }
.dt-sitestate { display: flex; align-items: center; gap: 6px; font: var(--os-type-body-strong); }
.dt-sitestate.shared { color: var(--os-good-text); }
.dt-sitestate.own { color: var(--os-warn-text); }
.dt-sitefigs { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--os-text-2); font: var(--os-type-small); }
.dt-sitecard-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dt-dialog { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--os-border-strong); border-radius: var(--os-radius-md); background: var(--os-surface-sunken); }
.dt-dialog p { margin: 0; }
.dt-dialog-title { margin: 0; font: var(--os-type-body-strong); }
.dt-synckind { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; border-top: 1px solid var(--os-border-subtle); }
.dt-synckind-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dt-synctick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; cursor: pointer; }
.dt-synctick input { width: 16px; height: 16px; accent-color: var(--os-accent); }
.dt-synctick-sub { padding-left: 22px; }
.dt-compare th.center, .dt-compare td.center { text-align: center; }
.dt-cell.shared, .dt-cell.own { color: var(--os-good-text); }
.dt-cell.off { color: var(--os-bad-text); font-weight: 600; }
.dt-cell.none { color: var(--os-text-3); }
