/* Stream B, ticket T5: Overview, Trend, Movement, Forecast routes. Variant-scoped rules only. */

/* Route wrapper: the shared components set their own bottom margin; the
   method disclosure does not, so it gets the same rhythm here. */
[data-design="engvision"] .ev-time .ev-method { margin: 0 0 var(--ev-grid-gap); }
[data-design="engvision"] .ev-time-method__text { max-width: 72ch; margin: 0; line-height: 1.5; }

[data-design="engvision"] .ev-time-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
/* A register cell whose word the row already says (TJ) holds it for screen
   readers only. The cell anchors the hidden word, so it stays inside the
   table's scroll box and never widens the page. */
[data-design="engvision"] .ev-time-table__said { position: relative; }

/* In-page actions that read as links: Link blue, underlined, 44px target. */
[data-design="engvision"] .ev-time-link {
  min-height: var(--ev-control-height);
  display: inline-flex;
  align-items: center;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ev-link);
  font-size: var(--ev-type-body);
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
[data-design="engvision"] .ev-time-link:disabled { color: var(--ev-muted); text-decoration: none; cursor: default; }

/* Overview lead aside: changes since the previous snapshot, each a drill. */
[data-design="engvision"] .ev-time-aside__title {
  margin: 0 0 var(--ev-space-2);
  color: var(--ev-muted);
  font-size: var(--ev-type-eyebrow);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
[data-design="engvision"] .ev-time-changes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ev-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
[data-design="engvision"] .ev-time-change {
  width: 100%;
  min-height: var(--ev-control-height);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--ev-space-1);
  padding: var(--ev-space-2) var(--ev-space-3);
  background: var(--ev-surface);
  border: 1px solid var(--ev-rule);
  border-radius: var(--ev-radius-control);
  color: var(--ev-text);
  text-align: left;
  cursor: pointer;
}
[data-design="engvision"] .ev-time-change:hover:not(:disabled) { border-color: var(--ev-emphasis); }
[data-design="engvision"] .ev-time-change:disabled { cursor: default; }
[data-design="engvision"] .ev-time-change__value {
  color: var(--ev-emphasis);
  font-size: var(--ev-type-panel-title);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
[data-design="engvision"] .ev-time-change:disabled .ev-time-change__value { color: var(--ev-muted); }
[data-design="engvision"] .ev-time-change__label { color: var(--ev-muted); font-size: var(--ev-type-small); }
[data-design="engvision"] .ev-time-goto { margin: var(--ev-space-3) 0 0; padding: 0; list-style: none; }

/* Segmented toggles in panel headers: 44px targets, navy when selected. */
[data-design="engvision"] .ev-time-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ev-space-3);
}
[data-design="engvision"] .ev-time .seg-toggle {
  padding: 0;
  gap: 0;
  background: var(--ev-surface);
  border: 1px solid var(--ev-rule);
  border-radius: var(--ev-radius-control);
}
[data-design="engvision"] .ev-time .seg-toggle button {
  min-height: var(--ev-control-height);
  padding: 0 var(--ev-space-3);
  border-radius: 0;
  color: var(--ev-text-2);
  font-size: var(--ev-type-meta);
  font-weight: 600;
}
[data-design="engvision"] .ev-time .seg-toggle button + button { border-left: 1px solid var(--ev-rule); }
[data-design="engvision"] .ev-time .seg-toggle button:first-child { border-radius: var(--ev-radius-control) 0 0 var(--ev-radius-control); }
[data-design="engvision"] .ev-time .seg-toggle button:last-child { border-radius: 0 var(--ev-radius-control) var(--ev-radius-control) 0; }
[data-design="engvision"] .ev-time .seg-toggle button.is-active { background: var(--ev-primary); color: var(--ev-on-primary); }
[data-design="engvision"] .ev-time .ev-panel__actions .legend { font-size: var(--ev-type-small); }

/* Charts and their text equivalent. */
[data-design="engvision"] .ev-time-figure { min-width: 0; margin: 0; }
[data-design="engvision"] .ev-time-figure__caption {
  max-width: 72ch;
  margin: var(--ev-space-3) 0 0;
  color: var(--ev-muted);
  font-size: var(--ev-type-meta);
  line-height: 1.5;
}

/* Overview breakdowns: one column, so the wide nested table keeps its
   columns; the labelled wrapper owns the scroll and its cue. */
[data-design="engvision"] .ev-time-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ev-grid-gap);
  margin: 0 0 var(--ev-grid-gap);
}
[data-design="engvision"] .ev-time-pair > .ev-panel { margin: 0; }
[data-design="engvision"] .ev-time .ev-table-wrap .tbl-wrap { overflow: visible; }

/* Plan settings and movement pickers: persistent labels, 46px inputs. */
[data-design="engvision"] .ev-time-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  align-items: start;
  gap: var(--ev-space-4);
}
[data-design="engvision"] .ev-time-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ev-space-1);
}
[data-design="engvision"] .ev-time-field__label { color: var(--ev-text); font-size: var(--ev-type-meta); font-weight: 600; }
[data-design="engvision"] .ev-time-field__control {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--ev-space-2);
}
[data-design="engvision"] .ev-time-field__control input,
[data-design="engvision"] .ev-time-field__control select {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  min-height: var(--ev-input-height);
  padding: 0 var(--ev-space-3);
  background: var(--ev-surface);
  border: 1px solid var(--ev-border-strong);
  border-radius: var(--ev-radius-control);
  color: var(--ev-text);
  font-size: var(--ev-type-body);
  font-variant-numeric: tabular-nums;
}
[data-design="engvision"] .ev-time-field__unit { flex: 0 0 auto; color: var(--ev-muted); font-size: var(--ev-type-small); white-space: nowrap; }
[data-design="engvision"] .ev-time-field__hint { color: var(--ev-muted); font-size: var(--ev-type-small); line-height: 1.4; }

/* Plan comparison and overall estimate: a ruled band inside a panel. */
[data-design="engvision"] .ev-time-plan .ev-metric-band,
[data-design="engvision"] .ev-time-estimate .ev-metric-band {
  margin: 0;
  border: 0;
  border-radius: 0;
}
[data-design="engvision"] .ev-time-plan .ev-metric-band { grid-template-columns: repeat(4, minmax(0, 1fr)); }
[data-design="engvision"] .ev-time-plan--n1 .ev-metric-band { grid-template-columns: minmax(0, 1fr); }
[data-design="engvision"] .ev-time-plan--n2 .ev-metric-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
[data-design="engvision"] .ev-time-plan--n3 .ev-metric-band { grid-template-columns: repeat(3, minmax(0, 1fr)); }
[data-design="engvision"] .ev-time-plan .ev-metric-band__item {
  min-height: 0;
  border-right: 1px solid var(--ev-rule);
  border-bottom: 0;
}
[data-design="engvision"] .ev-time-plan .ev-metric-band__item:last-child { border-right: 0; }
[data-design="engvision"] .ev-time-plan[data-plan-state="unset"] .ev-panel__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
[data-design="engvision"] .ev-time-plan__invite {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: var(--ev-panel-padding);
  border-left: 1px solid var(--ev-rule);
}
[data-design="engvision"] .ev-time-plan__invite-text { max-width: 48ch; margin: 0; line-height: 1.5; }

[data-design="engvision"] .ev-time-estimate .ev-metric-band { grid-template-columns: repeat(6, minmax(0, 1fr)); }
[data-design="engvision"] .ev-time-estimate .ev-metric-band__item {
  min-height: 0;
  grid-column: span 2;
  border-right: 1px solid var(--ev-rule);
  border-bottom: 1px solid var(--ev-rule);
}
[data-design="engvision"] .ev-time-estimate .ev-metric-band__item:nth-child(n + 4) { grid-column: span 3; border-bottom: 0; }
[data-design="engvision"] .ev-time-estimate .ev-metric-band__item:nth-child(3),
[data-design="engvision"] .ev-time-estimate .ev-metric-band__item:nth-child(5) { border-right: 0; }

/* Registers: 14px ruled rows, row labels in ink, numbers right and tabular. */
[data-design="engvision"] .ev-time-table tbody th {
  color: var(--ev-text);
  font-size: var(--ev-type-table);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
/* Heads are positioned so a visually hidden label stays inside the table's
   scroll region instead of widening the page. */
[data-design="engvision"] .ev-time-table th { position: relative; }
[data-design="engvision"] .ev-time-table .num { white-space: nowrap; }
[data-design="engvision"] .ev-time-table tbody tr:last-child th { border-bottom: 0; }
[data-design="engvision"] .ev-time-table__label { white-space: nowrap; }
[data-design="engvision"] .ev-time-table__tag {
  display: inline-block;
  margin: 0 0 0 var(--ev-space-2);
  padding: 0 var(--ev-space-2);
  background: var(--ev-surface-sunk);
  border-radius: var(--ev-radius-badge);
  color: var(--ev-text-2);
  font-size: var(--ev-type-small);
  font-weight: 600;
}
[data-design="engvision"] .ev-time-table__sub {
  display: block;
  margin: var(--ev-space-1) 0 0;
  color: var(--ev-muted);
  font-size: var(--ev-type-small);
  font-weight: 500;
}
[data-design="engvision"] .ev-time-table tbody .ev-time-table__action { padding-top: var(--ev-space-1); padding-bottom: var(--ev-space-1); text-align: right; }
[data-design="engvision"] .ev-time-row-btn {
  min-height: var(--ev-control-height);
  padding: 0 var(--ev-space-2);
  background: none;
  border: 0;
  color: var(--ev-link);
  font-size: var(--ev-type-body);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

/* Forecast register: sortable heads are buttons; the level column stays in
   view while the figures scroll beside it on narrow screens. */
[data-design="engvision"] .ev-time-register thead th { padding-top: 0; padding-bottom: 0; }
[data-design="engvision"] .ev-time-register tbody th,
[data-design="engvision"] .ev-time-register tbody td { padding-top: var(--ev-space-1); padding-bottom: var(--ev-space-1); }
[data-design="engvision"] .ev-time-register th:first-child,
[data-design="engvision"] .ev-time-register td:first-child,
[data-design="engvision"] .ev-time-matrix th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--ev-surface);
}
/* A sticky cell paints over its neighbours' focus rings; the focused one
   rises so its whole ring shows. */
[data-design="engvision"] .ev-time-register th:first-child:focus-within,
[data-design="engvision"] .ev-time-register td:first-child:focus-within,
[data-design="engvision"] .ev-time-matrix th:first-child:focus-within { z-index: 2; }
[data-design="engvision"] .ev-time-sort {
  min-height: var(--ev-control-height);
  display: inline-flex;
  align-items: center;
  gap: var(--ev-space-1);
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
[data-design="engvision"] .ev-time-sort__arrow { color: var(--ev-emphasis); }
[data-design="engvision"] .ev-time-level {
  min-height: var(--ev-control-height);
  padding: 0;
  background: none;
  border: 0;
  color: var(--ev-link);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
  white-space: nowrap;
  cursor: pointer;
}

/* Movement: pickers and the interval note sit in the lead's aside. */
[data-design="engvision"] .ev-time-pickers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--ev-space-3);
}
[data-design="engvision"] .ev-time-interval {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ev-muted);
  font-size: var(--ev-type-body);
  line-height: 1.5;
}
[data-design="engvision"] .ev-time-interval--blind { color: var(--ev-review); font-weight: 600; }
[data-design="engvision"] .ev-time-matrix tbody th,
[data-design="engvision"] .ev-time-matrix tbody td { padding-top: var(--ev-space-1); padding-bottom: var(--ev-space-1); }
[data-design="engvision"] .ev-time-matrix .ev-time-matrix__diag { background: var(--ev-surface-sunk); }
[data-design="engvision"] .ev-time-matrix__total { font-weight: 600; }
[data-design="engvision"] .ev-time-matrix__totals th,
[data-design="engvision"] .ev-time-matrix__totals td { font-weight: 600; border-top: 1px solid var(--ev-border-strong); }
[data-design="engvision"] .ev-time-cell-btn {
  min-width: var(--ev-control-height);
  min-height: var(--ev-control-height);
  padding: 0 var(--ev-space-2);
  background: none;
  border: 0;
  color: var(--ev-link);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

@media (max-width: 760px) {
  [data-design="engvision"] .ev-time-plan .ev-metric-band,
  [data-design="engvision"] .ev-time-plan--n2 .ev-metric-band,
  [data-design="engvision"] .ev-time-plan--n3 .ev-metric-band { grid-template-columns: minmax(0, 1fr); }
  [data-design="engvision"] .ev-time-plan .ev-metric-band__item,
  [data-design="engvision"] .ev-time-plan .ev-metric-band__item:last-child { border-right: 0; border-bottom: 1px solid var(--ev-rule); }
  [data-design="engvision"] .ev-time-plan[data-plan-state="set"] .ev-metric-band__item:last-child { border-bottom: 0; }
  [data-design="engvision"] .ev-time-plan[data-plan-state="unset"] .ev-panel__body { grid-template-columns: minmax(0, 1fr); }
  [data-design="engvision"] .ev-time-plan__invite { padding: var(--ev-panel-padding-compact); border-left: 0; }
}
@media (max-width: 520px) {
  [data-design="engvision"] .ev-time-changes { grid-template-columns: minmax(0, 1fr); }
  [data-design="engvision"] .ev-time-change { flex-direction: row; align-items: baseline; gap: var(--ev-space-2); }
  [data-design="engvision"] .ev-time-estimate .ev-metric-band { grid-template-columns: minmax(0, 1fr); }
  [data-design="engvision"] .ev-time-estimate .ev-metric-band__item,
  [data-design="engvision"] .ev-time-estimate .ev-metric-band__item:nth-child(n + 4) {
    grid-column: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ev-rule);
  }
  [data-design="engvision"] .ev-time-estimate .ev-metric-band__item:last-child { border-bottom: 0; }
}
