/* OEE tracker page. Colour and spacing tokens come from home.css's :root;
   header height from home.css's .header--compact.

   Box-shadow rule (one shadowed section per page): the only shadow here is
   the floating message note, which sits over the page and needs one to
   read as separate. Everything else uses borders. */

:root {
  --oee-radius: 8px;
  --oee-border: #d6d6cc;
  --oee-calc-bg: #fbfcff; /* faint blue behind calculations and table hovers */
  --oee-note-bottom: 72px; /* clears the site's fixed bottom bar */
  /* formula sheet (L17): one blue tint per layer, deeper layers darker; tree lines in a mid blue */
  --oee-layer-1: color-mix(in srgb, var(--primary-blue) 5%, var(--white));
  --oee-layer-2: color-mix(in srgb, var(--primary-blue) 10%, var(--white));
  --oee-layer-3: color-mix(in srgb, var(--primary-blue) 15%, var(--white));
  --oee-layer-4: color-mix(in srgb, var(--primary-blue) 20%, var(--white));
  --oee-tree-line: color-mix(in srgb, var(--primary-blue) 40%, var(--white));
  --oee-tree-step: var(--space-md); /* indent per layer */
  --oee-tree-elbow: 1.5rem;         /* height where a branch meets its formula's first row */
}

.oee-container {
  max-width: 1120px;
  text-align: left;
}

/* ---------- buttons ---------- */

.oee-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 8px 16px;
  border: 1px solid var(--primary-blue);
  border-radius: 6px;
  background: var(--primary-blue);
  color: var(--white);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.oee-btn:hover {
  opacity: 0.9;
}

.oee-btn--secondary {
  background: var(--white);
  color: var(--primary-blue);
}

.oee-btn--secondary:hover {
  background: var(--blue-tint);
  opacity: 1;
}

.oee-btn--small {
  padding: 4px 10px;
  font-size: 0.9rem;
}

.oee-link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary-blue);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.oee-link-btn {
  display: block;
  margin-top: var(--space-xs);
  font-size: 1rem;
  text-decoration: underline;
}

.oee-link-btn--inline {
  display: inline;
  margin-top: 0;
}

.oee-icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.oee-icon-btn:hover {
  border-color: var(--primary-red);
  background: var(--red-tint);
  color: var(--primary-red);
}

.oee-icon-btn--plain {
  border-color: var(--oee-border);
  color: var(--primary-blue);
  font-size: 1.2rem;
}

.oee-icon-btn--plain:hover {
  border-color: var(--primary-blue);
  background: var(--blue-tint);
  color: var(--primary-blue);
}

.oee-icon-btn--plain:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- shared form controls ---------- */

.oee-container input[type="text"],
.oee-container input[type="number"],
.oee-container input[type="date"],
.oee-container input[type="time"],
.oee-container select,
.oee-container textarea {
  padding: 6px 8px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  background: var(--white);
  color: var(--black);
  font-family: inherit;
  font-size: 0.95rem;
}

.oee-container input:focus,
.oee-container select:focus,
.oee-container textarea:focus {
  border-color: var(--primary-blue);
  outline: 2px solid var(--blue-tint);
  outline-offset: 0;
}

.oee-container input:disabled,
.oee-container select:disabled,
.oee-container textarea:disabled {
  background: var(--bg-light);
  color: var(--muted);
}

.oee-help {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.oee-placeholder {
  margin-top: var(--space-sm);
  color: var(--muted);
  font-style: italic;
}

.oee-missing {
  color: var(--primary-red);
  font-weight: 600;
}

.oee-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.oee-unit-chip {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-light);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  white-space: nowrap;
}

/* ---------- banners ---------- */

.oee-banner {
  margin: var(--space-sm) 0;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--primary-red);
  border-left-width: 4px;
  border-radius: var(--oee-radius);
  background: var(--red-tint);
}

.oee-banner p {
  margin-bottom: var(--space-2xs);
  font-size: 0.95rem;
}

.oee-banner p:last-child {
  margin-bottom: 0;
}

.oee-banner .oee-btn {
  margin-right: var(--space-2xs);
}

.oee-banner--info {
  border-color: var(--primary-blue);
  background: var(--blue-tint);
}

/* ---------- landing ---------- */

.oee-doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
}

.oee-door {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--space-md);
  border: 1px solid var(--oee-border);
  border-top: 4px solid var(--primary-blue);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-door-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-xs);
  border-radius: 50%;
  background: var(--blue-tint);
  color: var(--primary-blue);
  font-size: 1.1rem;
}

.oee-door h3 {
  margin-bottom: var(--space-2xs);
}

.oee-door p {
  flex: 1;
  margin-bottom: var(--space-sm);
  color: var(--muted);
}

.oee-note {
  margin-top: var(--space-md);
  color: var(--muted);
}

.oee-note p {
  margin-bottom: var(--space-2xs);
  font-size: 0.95rem;
}

.oee-note i {
  margin-right: var(--space-2xs);
  color: var(--primary-blue);
}

/* ---------- forms ---------- */

.oee-form {
  display: flex;
  flex-direction: column;
  max-width: 520px;
  padding: var(--space-md);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-form h3 {
  margin-bottom: var(--space-2xs);
}

.oee-form-intro {
  margin-bottom: var(--space-2xs);
  color: var(--muted);
  font-size: 0.95rem;
}

.oee-form label {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-3xs);
  font-weight: 600;
}

.oee-form .oee-help {
  margin-top: var(--space-3xs);
}

.oee-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.oee-form--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  max-width: none;
  margin-top: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
}

.oee-form--inline label {
  margin: 0;
}

.oee-form--inline input {
  flex: 1 1 240px;
  max-width: 420px;
}

/* ---------- workspace: file bar and tabs ---------- */

.oee-filebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-file-title {
  display: flex;
  flex-direction: column;
  flex: 1 1 220px;
}

.oee-file-title strong {
  font-size: 1.1rem;
}

.oee-file-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.oee-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-light);
  color: var(--muted);
  font-size: 0.9rem;
}

.oee-status .fa-check {
  color: var(--primary-blue);
}

.oee-status .is-warning {
  color: var(--primary-red);
  font-weight: 600;
}

.oee-tabs {
  display: flex;
  gap: var(--space-3xs);
  margin-top: var(--space-md);
  overflow-x: auto;
  border-bottom: 2px solid var(--primary-blue);
}

.oee-tab {
  flex: 0 0 auto;
  padding: var(--space-2xs) var(--space-sm);
  border: 1px solid var(--oee-border);
  border-bottom: 0;
  border-radius: var(--oee-radius) var(--oee-radius) 0 0;
  background: var(--white);
  color: var(--black);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.oee-tab i {
  margin-right: 6px;
  color: var(--primary-blue);
}

.oee-tab:hover {
  background: var(--blue-tint);
}

.oee-tab[aria-selected="true"] {
  border-color: var(--primary-blue);
  background: var(--primary-blue);
  color: var(--white);
}

.oee-tab[aria-selected="true"] i {
  color: var(--white);
}

.oee-panel {
  padding: var(--space-md) 0;
}

.oee-panel h3,
.oee-panel h4 {
  text-align: left;
}

/* ---------- overview ---------- */

.oee-overview-title {
  margin: var(--space-md) 0 var(--space-2xs);
}

.oee-panel > .oee-overview-title:first-child {
  margin-top: 0;
}

.oee-todo {
  list-style: none;
  max-width: 620px;
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-todo li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-2xs) var(--space-sm);
  border-bottom: 1px solid var(--bg-light);
}

.oee-todo li:last-child {
  border-bottom: 0;
}

.oee-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-3xs) var(--space-md);
  margin-top: var(--space-sm);
  font-size: 0.95rem;
}

.oee-facts dt {
  color: var(--muted);
}

/* ---------- headline figures ---------- */

/* OEE, then Performance + Quality, Availability + Loading, then TEEP (L16) */
.oee-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2xs);
  max-width: 32rem;
  margin-bottom: var(--space-2xs);
}

.oee-kpi {
  display: flex;
  flex-direction: column;
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-kpi span {
  color: var(--muted);
  font-size: 0.85rem;
}

.oee-kpi strong {
  font-size: 1.5rem;
  font-variant-numeric: tabular-nums;
}

/* OEE and TEEP span the full width, in blue */
.oee-kpi--main {
  grid-column: 1 / -1;
  border-color: var(--primary-blue);
  background: var(--primary-blue);
}

.oee-kpi--main span,
.oee-kpi--main strong {
  color: var(--white);
}

/* ---------- Overview: lines and plant setup (P2.1) ---------- */

.oee-line-figures td:first-child,
.oee-lines-table td:first-child {
  font-weight: 600;
}

.oee-todo-line {
  margin: var(--space-xs) 0 4px;
  font-size: 1rem;
}

.oee-setup {
  margin-top: var(--space-lg);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--oee-border);
}

.oee-lines-table input[type=text] {
  width: 100%;
  min-width: 10rem;
  padding: 4px 6px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  font: inherit;
}

.oee-line-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-xs);
}

.oee-inline-details summary {
  color: var(--primary-blue);
  font-weight: 600;
  cursor: pointer;
}

.oee-inline-details form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2xs);
  margin-top: var(--space-2xs);
}

.oee-inline-details label,
.oee-add-line label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
  font-weight: 600;
}

.oee-inline-details input,
.oee-add-line input {
  padding: 4px 6px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

.oee-add-line {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-2xs) var(--space-sm);
  margin: var(--space-xs) 0 var(--space-sm);
}

/* ---------- tags (P2.3) ---------- */

.oee-tag {
  margin-bottom: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-tag-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-xs);
}

.oee-tag-head input {
  padding: 4px 6px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
}

.oee-tag-values {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: var(--space-2xs) 0 0;
  padding: 0;
  list-style: none;
}

.oee-tag-values li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid var(--oee-border);
  border-radius: 999px;
  background: var(--bg-light);
}

.oee-tag-values input {
  width: 9rem;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  font: inherit;
}

.oee-entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-sm);
  margin-top: var(--space-sm);
}

.oee-entry-tags label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.oee-entry-tags select,
.oee-entry-tags input {
  min-width: 10rem;
  padding: 6px 8px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

/* ---------- Daily entry: One day / Month grid (P2.4) ---------- */

.oee-view-switch {
  display: inline-flex;
  margin-bottom: var(--space-sm);
  border: 1px solid var(--primary-blue);
  border-radius: var(--oee-radius);
  overflow: hidden;
}

.oee-view-switch button {
  padding: 6px 14px;
  border: 0;
  background: var(--white);
  color: var(--primary-blue);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.oee-view-switch button + button {
  border-left: 1px solid var(--primary-blue);
}

.oee-view-switch button[aria-pressed="true"] {
  background: var(--primary-blue);
  color: var(--white);
}

.oee-grid {
  font-size: 0.9rem;
}

.oee-grid th,
.oee-grid td {
  padding: 4px 6px;
  white-space: nowrap;
}

.oee-grid thead th {
  vertical-align: bottom;
  white-space: normal;
  min-width: 5.5rem;
}

.oee-grid-unit {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.oee-grid tbody th {
  font-weight: 600;
  text-align: left;
}

.oee-grid input[type=text] {
  width: 5.5rem;
  padding: 3px 5px;
  border: 1px solid var(--oee-border);
  border-radius: 4px;
  font: inherit;
  text-align: right;
}

.oee-grid input[type=text]:disabled {
  background: var(--bg-light);
}

.oee-grid tr.is-locked {
  color: var(--muted);
}

.oee-grid tr.is-dirty td,
.oee-grid tr.is-dirty th {
  background: var(--blue-tint);
}

.oee-grid tr.has-error td,
.oee-grid tr.has-error th {
  background: var(--red-tint);
}

.oee-grid-status {
  color: var(--muted);
  font-size: 0.8rem;
}

/* downloads for the whole year (Excel report; PDF in P2.6) */
.oee-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2xs);
  margin-bottom: var(--space-xs);
}

/* ---------- dashboard charts (P1.6) ---------- */

.oee-charts {
  margin-top: var(--space-sm);
}

/* what an opened month shows, above its figures */
.oee-month-note {
  margin-bottom: var(--space-xs);
}

.oee-charts-head {
  display: flex;
  margin-bottom: var(--space-xs);
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2xs);
}

/* same arrangement as the result cards: OEE; P + Q; A + Loading; TEEP */
.oee-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-xs);
}

.oee-chart {
  margin: 0;
  padding: var(--space-2xs) var(--space-xs) var(--space-xs);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-chart--wide {
  grid-column: 1 / -1;
}

.oee-chart figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2xs);
  margin-bottom: 4px;
  font-weight: 700;
}

.oee-chart figcaption .oee-help {
  font-weight: 400;
}

.oee-chart-actions {
  display: inline-flex;
  gap: var(--space-xs);
  font-weight: 400;
}

.oee-chart-canvas {
  position: relative;
  height: 200px;
}

.oee-chart--wide .oee-chart-canvas,
.oee-chart--custom .oee-chart-canvas {
  height: 240px;
}

.oee-chart-status {
  margin: var(--space-2xs) 0;
  color: var(--muted);
}

.oee-chart-list {
  display: grid;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
}

/* targets: six percentage boxes */
.oee-targets summary {
  color: var(--primary-blue);
  font-weight: 600;
  cursor: pointer;
}

.oee-targets[open] {
  flex-basis: 100%;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-targets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-2xs) var(--space-sm);
  margin-top: var(--space-2xs);
}

.oee-targets-grid label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.9rem;
  font-weight: 600;
}

.oee-target-input input {
  width: 5.5rem;
  padding: 4px 6px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

/* the chart builder */
.oee-chart-builder {
  display: grid;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
  padding: var(--space-sm);
  border: 1px solid var(--primary-blue);
  border-radius: var(--oee-radius);
  background: var(--blue-tint);
}

.oee-chart-builder h4 {
  margin: 0;
}

.oee-chart-builder > label,
.oee-chart-builder-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.oee-chart-builder input[type=text],
.oee-chart-builder input[type=number],
.oee-chart-builder select {
  max-width: 22rem;
  padding: 6px 8px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  background: var(--white);
  font: inherit;
  font-weight: 400;
}

.oee-chart-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--space-md);
  margin: 0;
  padding: 0;
  border: 0;
}

.oee-chart-kind legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 600;
}

.oee-chart-kind .oee-check-label {
  white-space: normal;
}

.oee-chart-pick {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px var(--space-sm);
  margin: 0;
  padding: var(--space-2xs) var(--space-xs);
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  background: var(--white);
}

.oee-chart-pick legend {
  padding: 0 4px;
  font-weight: 600;
}

.oee-chart-pick .oee-check-label {
  white-space: normal;
}

.oee-chart-pick .is-off {
  opacity: 0.45;
}

.oee-chart-builder-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-xs) var(--space-sm);
}

/* ---------- OEE formula tab ---------- */

.oee-check {
  margin: 0 0 var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--oee-radius);
}

.oee-check.is-ok {
  border-color: var(--primary-blue);
  background: var(--blue-tint);
  color: var(--primary-blue);
  font-weight: 600;
}

.oee-check.is-error {
  border-color: var(--primary-red);
  background: var(--red-tint);
  color: var(--primary-red);
}

.oee-check ul {
  margin-top: var(--space-3xs);
  padding-left: 1.25em;
  font-size: 0.95rem;
}

.oee-logic-small-screen {
  display: none;
}

.oee-formulas,
.oee-inputs,
.oee-standards {
  margin-top: var(--space-lg);
}

.oee-formulas > h3,
.oee-inputs > h3,
.oee-standards > h3 {
  margin-bottom: var(--space-3xs);
}

.oee-formulas > .oee-help,
.oee-inputs > .oee-help,
.oee-standards > .oee-help {
  margin-bottom: var(--space-sm);
}

/* "Use your changes" (P1.5): new version from a date, or correct the current one */
.oee-apply {
  margin: 0 0 var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--primary-blue);
  border-left-width: 4px;
  border-radius: var(--oee-radius);
  background: var(--blue-tint);
}

.oee-apply > h3 {
  margin-bottom: var(--space-3xs);
}

.oee-apply-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-xs);
  margin: var(--space-xs) 0;
}

.oee-apply-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-apply-option h4 {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  margin: 0;
  color: var(--primary-blue);
  font-size: 1rem;
}

.oee-apply-option p {
  margin: 0;
}

.oee-apply-option label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  font-weight: 600;
}

.oee-apply-option input {
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

.oee-logic-note {
  margin: 0 0 var(--space-sm);
}

/* formula versions and corrections */
.oee-history {
  margin-top: var(--space-lg);
}

.oee-history-list {
  margin: var(--space-2xs) 0 0;
  padding-left: var(--space-md);
}

.oee-history-list li {
  padding: 4px 0;
}

.oee-history-fix {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

/* "What's next" at the end of the formula page */
.oee-next {
  margin-top: var(--space-lg);
  padding: var(--space-sm);
  border: 1px solid var(--oee-border);
  border-left: 4px solid var(--primary-blue);
  border-radius: var(--oee-radius);
}

.oee-next > h3 {
  margin-bottom: var(--space-3xs);
}

.oee-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.oee-role {
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  border: 1px solid var(--oee-border);
  border-top: 4px solid var(--primary-blue);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-role h4 {
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
  margin-bottom: var(--space-2xs);
  color: var(--primary-blue);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* One formula per line: "Name = part op part op part [+ part] [operation]" */
.oee-eq {
  padding: var(--space-2xs) 0;
  border-bottom: 1px solid var(--bg-light);
}

.oee-eq:last-child {
  border-bottom: 0;
}

.oee-eq--top {
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--primary-blue);
  border-radius: var(--oee-radius);
  background: var(--blue-tint);
}

/* A part's formula (L17): tree lines on the left, then the formula on its layer's shade */
.oee-eq--sub {
  display: flex;
  align-items: stretch;
  padding: 0;
  border-bottom: 0;
}

.oee-eq-body {
  flex: 1;
  min-width: 0;
  margin: 3px 0;
  padding: 6px var(--space-2xs);
  border-radius: 6px;
}

.oee-layer-1 .oee-eq-body { background: var(--oee-layer-1); }
.oee-layer-2 .oee-eq-body { background: var(--oee-layer-2); }
.oee-layer-3 .oee-eq-body { background: var(--oee-layer-3); }
.oee-layer-4 .oee-eq-body { background: var(--oee-layer-4); }

.oee-eq--sub.has-error,
.oee-eq--sub.is-flash {
  background: none;
}

.oee-eq--sub.has-error .oee-eq-body {
  background: var(--red-tint);
}

.oee-eq--sub.is-flash .oee-eq-body {
  background: var(--blue-tint);
  transition: background 0.3s;
}

.oee-tree {
  display: flex;
  flex-shrink: 0;
}

.oee-tree-col {
  position: relative;
  width: var(--oee-tree-step);
}

/* a layer above whose branch carries on below this line */
.oee-tree-col.is-line::before,
.oee-tree-col.is-tee::before,
.oee-tree-col.is-last::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 1px);
  border-left: 2px solid var(--oee-tree-line);
}

/* the last branch stops where it meets its formula */
.oee-tree-col.is-last::before {
  bottom: auto;
  height: var(--oee-tree-elbow);
}

.oee-tree-col.is-tee::after,
.oee-tree-col.is-last::after {
  content: "";
  position: absolute;
  top: calc(var(--oee-tree-elbow) - 1px);
  left: calc(50% - 1px);
  right: 0;
  border-top: 2px solid var(--oee-tree-line);
}

/* fold / unfold the formulas of a line's parts */
.oee-fold,
.oee-fold-space {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
}

.oee-fold {
  padding: 0;
  border: 1px solid var(--oee-tree-line);
  border-radius: 4px;
  background: var(--white);
  color: var(--primary-blue);
  cursor: pointer;
}

.oee-fold:hover {
  background: var(--blue-tint);
}

.oee-fold.has-error {
  border-color: var(--primary-red);
  color: var(--primary-red);
}

.oee-fold-note {
  color: var(--muted);
  font-size: 0.75rem;
}

.oee-fold-note.has-error {
  color: var(--primary-red);
}

.oee-eq.has-error {
  background: var(--red-tint);
}

.oee-eq.is-flash,
.oee-inputs-table tr.is-flash td {
  background: var(--blue-tint);
  transition: background 0.3s;
}

.oee-eq-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.oee-eq-name {
  padding: 2px 4px;
  border: 0;
  border-bottom: 1px dashed var(--primary-blue);
  background: none;
  color: var(--black);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.oee-eq-name:hover {
  background: var(--blue-tint);
}

.oee-eq-name--fixed {
  border-bottom: 0;
  cursor: default;
}

.oee-eq-name--fixed:hover {
  background: none;
}

.oee-eq-equals,
.oee-eq-op {
  color: var(--primary-blue);
  font-weight: 700;
}

.oee-eq-fixed {
  font-weight: 600;
}

/* The operator between two parts: click it to change it (L11) */
.oee-op-btn {
  width: 28px;
  height: 28px;
  border: 1px dashed transparent;
  border-radius: 50%;
  background: var(--blue-tint);
  color: var(--primary-blue);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.oee-op-btn:hover:not(:disabled),
.oee-op-btn.is-open {
  border-color: var(--primary-blue);
}

.oee-op-btn:disabled {
  background: none;
  cursor: default;
}

.oee-menu--ops {
  min-width: 170px;
}

.oee-menu > button.is-current {
  background: var(--blue-tint);
  font-weight: 600;
}

.oee-op-symbol {
  width: 16px;
  color: var(--primary-blue);
  font-weight: 700;
  text-align: center;
}

.oee-eq--top .oee-eq-main + .oee-eq-main {
  margin-top: var(--space-2xs);
}

/* Parts of a formula */
.oee-chip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.oee-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--oee-border);
  border-radius: 999px;
  background: var(--white);
  color: var(--black);
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.oee-chip i {
  color: var(--muted);
  font-size: 0.75rem;
}

.oee-chip:hover,
.oee-chip.is-open {
  border-color: var(--primary-blue);
  background: var(--blue-tint);
}

.oee-chip--calc {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  font-weight: 600;
}

.oee-chip--number {
  width: 5.5rem;
  border-style: dashed !important;
  border-radius: 999px !important;
  text-align: center;
  cursor: text;
}

.oee-chip.has-error {
  border-color: var(--primary-red);
  background: var(--red-tint);
  color: var(--primary-red);
}

.oee-chip-note {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.oee-add-btn {
  padding: 4px 10px;
  border: 1px dashed var(--primary-blue);
  border-radius: 999px;
  background: none;
  color: var(--primary-blue);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.oee-add-btn:hover,
.oee-add-btn.is-open {
  background: var(--blue-tint);
}

.oee-icon-btn--tiny {
  width: 22px;
  height: 22px;
  font-size: 0.95rem;
}

/* The small menu a chip opens */
.oee-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 250px;
  padding: var(--space-2xs);
  border: 1px solid var(--primary-blue);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-menu > button {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--black);
  font-family: inherit;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
}

.oee-menu > button i {
  width: 16px;
  color: var(--primary-blue);
}

.oee-menu > button:hover {
  background: var(--blue-tint);
}

.oee-menu > button.is-danger,
.oee-menu > button.is-danger i {
  color: var(--primary-red);
}

.oee-menu > button.is-danger:hover {
  background: var(--red-tint);
}

.oee-menu-rename {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2xs);
  padding: 4px 6px var(--space-2xs);
  border-bottom: 1px solid var(--bg-light);
}

.oee-menu-rename label,
.oee-menu-select {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.oee-menu-select {
  padding: var(--space-2xs) 6px 4px;
}

/* ⓘ tips (L10): open on hover or focus (computer) and on tap (phone) */
.oee-tip {
  position: relative;
  display: inline-flex;
}

.oee-tip-btn {
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--primary-blue);
  font-size: 0.9rem;
  line-height: 1;
  cursor: help;
}

.oee-tip-box {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  z-index: 60;
  display: none;
  width: 280px;
  padding: var(--space-xs);
  border: 1px solid var(--primary-blue);
  border-radius: var(--oee-radius);
  background: var(--white);
  color: var(--black);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.45;
  text-align: left;
  text-transform: none;
  transform: translateX(-50%);
}

.oee-tip:hover .oee-tip-box,
.oee-tip:focus-within .oee-tip-box,
.oee-tip.is-open .oee-tip-box {
  display: block;
}

.oee-tip-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: var(--space-2xs);
}

.oee-tip-examples span {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-light);
  color: var(--muted);
}

.oee-total-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-sm);
  margin-top: var(--space-2xs);
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--bg-light);
  font-size: 0.9rem;
}

.oee-total-mode-label {
  color: var(--muted);
  font-weight: 600;
}

.oee-total-mode label,
.oee-check-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.oee-check-label {
  margin-top: 4px;
}

.oee-node-error {
  display: block;
  margin: 4px 0 0;
  color: var(--primary-red);
  font-size: 0.85rem;
}

.oee-unit-input {
  width: 6.5rem;
}

.oee-value-input {
  width: 7rem;
}

/* Inputs table */
.oee-inputs-table td {
  vertical-align: top;
}

.oee-inputs-table tr.has-error td {
  background: var(--red-tint);
}

.oee-cell-name {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.oee-cell-name input {
  min-width: 11rem;
  font-weight: 600;
}

.oee-cell-unit {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---------- standards ---------- */

.oee-standards {
  margin-top: var(--space-lg);
}

.oee-standard {
  margin-top: var(--space-sm);
}

.oee-standard h5 {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-bottom: var(--space-2xs);
  font-size: 1rem;
}

.oee-standard-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
}

/* ---------- tables ---------- */

.oee-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  font-size: 0.95rem;
}

.oee-table th,
.oee-table td {
  padding: var(--space-2xs) var(--space-xs);
  border-bottom: 1px solid var(--oee-border);
  text-align: left;
  vertical-align: middle;
}

.oee-table thead th {
  border-bottom: 2px solid var(--primary-blue);
  background: var(--white);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.oee-table tbody tr:hover {
  background: var(--oee-calc-bg);
}

.oee-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
}

.oee-table-scroll .oee-table {
  border: 0;
}

.oee-standard .oee-table {
  border: 1px solid var(--oee-border);
}

.oee-results-table th,
.oee-results-table td {
  white-space: nowrap;
}

.oee-results-table tr.is-empty td {
  color: var(--muted);
}

.oee-results-table tfoot th {
  border-top: 2px solid var(--primary-blue);
  border-bottom: 0;
  background: var(--blue-tint);
}

.oee-totals-table {
  max-width: 680px;
  border: 1px solid var(--oee-border);
}

/* ---------- daily entry ---------- */

.oee-entry-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.oee-entry-pick label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  font-weight: 600;
}

.oee-calendar {
  margin-bottom: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-calendar-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-2xs);
}

.oee-calendar-head strong {
  min-width: 9rem;
  text-align: center;
}

.oee-entry-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.oee-entry-side .oee-calendar {
  margin-bottom: 0;
}

.oee-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.oee-weekday {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.oee-day {
  height: 34px;
  border: 1px solid var(--oee-border);
  border-radius: 6px;
  background: var(--white);
  font-family: inherit;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.oee-day:hover:not(:disabled) {
  border-color: var(--primary-blue);
}

.oee-day.is-filled {
  border-color: var(--primary-blue);
  background: var(--primary-blue);
  color: var(--white);
}

.oee-day.is-missing {
  border-color: var(--primary-red);
  background: var(--red-tint);
  color: var(--primary-red);
}

.oee-day.is-incomplete {
  border: 2px dashed var(--primary-red);
  background: var(--white);
  color: var(--primary-red);
}

.oee-day.is-nonworking {
  background: var(--bg-light);
  color: var(--muted);
  text-decoration: line-through;
}

.oee-day.is-future,
.oee-day.is-outside {
  opacity: 0.35;
  cursor: default;
}

.oee-day.is-selected {
  outline: 3px solid var(--primary-red);
  outline-offset: 1px;
  font-weight: 700;
}

.oee-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-2xs);
  color: var(--muted);
  font-size: 0.85rem;
}

.oee-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.oee-day--key {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  cursor: default;
}

.oee-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  gap: var(--space-md);
  align-items: start;
}

.oee-entry-form {
  padding: var(--space-md);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-entry-form h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs);
  margin-bottom: var(--space-2xs);
}

.oee-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.oee-badge.is-filled {
  background: var(--blue-tint);
  color: var(--primary-blue);
}

.oee-badge.is-new {
  background: var(--red-tint);
  color: var(--primary-red);
}

.oee-nonworking {
  display: flex;
  margin: var(--space-2xs) 0 var(--space-sm);
  padding: var(--space-2xs) var(--space-xs);
  border-radius: 6px;
  background: var(--bg-light);
  white-space: normal;
}

.oee-entry-inputs {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.oee-entry-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.5rem 4.5rem;
  align-items: center;
  gap: var(--space-2xs);
  padding: 6px 0;
  border-bottom: 1px solid var(--bg-light);
}

.oee-entry-row input {
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.oee-entry-fixed {
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 6px;
  background: var(--bg-light);
}

.oee-entry-fixed h4 {
  margin-bottom: var(--space-3xs);
  font-size: 0.95rem;
}

/* circles after an input's name: the measures it affects (L16) */
.oee-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: var(--space-2xs);
  vertical-align: middle;
}

.oee-dot {
  display: inline-grid;
  place-items: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--primary-blue);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

.oee-entry-standard {
  padding: 4px 0;
  font-size: 0.95rem;
}

.oee-change-standard {
  display: inline-block;
  margin-left: var(--space-2xs);
}

.oee-change-standard summary {
  color: var(--primary-blue);
  font-weight: 600;
  cursor: pointer;
}

.oee-change-standard[open] {
  display: block;
  margin: var(--space-2xs) 0 0;
}

.oee-entry-notes {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  margin-top: var(--space-sm);
  font-weight: 600;
}

.oee-entry-notes textarea {
  font-weight: 400;
  resize: vertical;
}

.oee-live {
  padding: var(--space-sm);
  border: 1px solid var(--oee-border);
  border-radius: var(--oee-radius);
  background: var(--white);
}

.oee-live h4 {
  margin-bottom: var(--space-2xs);
}

.oee-live .oee-kpi strong {
  font-size: 1.25rem;
}

.oee-live .oee-kpi--main strong {
  font-size: 1.75rem;
}

.oee-live-table {
  margin-top: var(--space-2xs);
  font-size: 0.9rem;
}

/* ---------- message note ---------- */

.oee-message {
  position: fixed;
  left: 50%;
  bottom: var(--oee-note-bottom);
  z-index: 1000;
  width: min(640px, calc(100% - 2 * var(--space-sm)));
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--primary-blue);
  border-left-width: 4px;
  border-radius: var(--oee-radius);
  background: var(--white);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  color: var(--primary-blue);
  font-weight: 600;
  line-height: 1.4;
  transform: translateX(-50%);
  cursor: pointer;
}

.oee-message:empty {
  display: none;
}

.oee-message.is-error {
  border-color: var(--primary-red);
  color: var(--primary-red);
}

.oee-message.is-prompt {
  border-color: var(--primary-red);
  cursor: default;
}

.oee-message .oee-prompt-text {
  display: block;
  margin-bottom: var(--space-2xs);
  color: var(--black);
}

.oee-prompt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

/* ---------- smaller screens ---------- */

@media (max-width: 900px) {
  .oee-entry-grid {
    grid-template-columns: 1fr;
  }

  .oee-live {
    position: static;
  }

  /* phones/tablets: calendar above the form, results below it */
  .oee-entry-side {
    display: contents;
  }

  .oee-entry-side .oee-calendar {
    order: -1;
  }

  :root {
    --oee-note-bottom: 84px;
  }
}

@media (max-width: 600px) {
  .oee-chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* lines and shifts become one card each, like the inputs table */
  .oee-lines-table thead {
    display: none;
  }

  .oee-lines-table,
  .oee-lines-table tbody,
  .oee-lines-table tr,
  .oee-lines-table td {
    display: block;
    width: 100%;
  }

  .oee-lines-table tr {
    padding: var(--space-2xs) 0;
    border-bottom: 2px solid var(--oee-border);
  }

  .oee-lines-table td {
    padding: 4px var(--space-xs);
    border: 0;
    text-align: left;
  }

  .oee-lines-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
  }

  .oee-filebar {
    flex-direction: column;
    align-items: flex-start;
  }

  .oee-file-title {
    flex: none;
  }

  .oee-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xs);
    border-bottom: 0;
  }

  .oee-tab,
  .oee-tab[aria-selected="true"] {
    border-bottom: 1px solid;
    border-radius: var(--oee-radius);
  }

  .oee-tab {
    border-color: var(--oee-border);
  }

  .oee-tab[aria-selected="true"] {
    border-color: var(--primary-blue);
  }

  .oee-door,
  .oee-form,
  .oee-entry-form,
  .oee-role {
    padding: var(--space-sm);
  }

  .oee-role {
    padding: var(--space-2xs);
  }

  .oee-logic-small-screen {
    display: block;
  }

  .oee-logic {
    --oee-tree-step: 0.9rem;
  }

  .oee-menu,
  .oee-tip-box {
    position: fixed;
    top: auto;
    bottom: var(--oee-note-bottom);
    left: 50%;
    width: min(340px, calc(100% - 2 * var(--space-sm)));
    transform: translateX(-50%);
  }

  /* the inputs table becomes one card per input */
  .oee-inputs-table thead {
    display: none;
  }

  .oee-inputs-table,
  .oee-inputs-table tbody,
  .oee-inputs-table tr,
  .oee-inputs-table td {
    display: block;
    width: 100%;
  }

  .oee-inputs-table tr {
    padding: var(--space-2xs) 0;
    border-bottom: 2px solid var(--oee-border);
  }

  .oee-inputs-table td {
    padding: 4px var(--space-xs);
    border: 0;
  }

  .oee-inputs-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
  }

  .oee-entry-row {
    grid-template-columns: minmax(0, 1fr) 7.5rem 3.5rem;
  }

  .oee-tab {
    padding: var(--space-2xs) var(--space-xs);
    font-size: 0.95rem;
  }
}
