/* ===========================================================================
   The chart layer.

   Palette derived from Torqfolio's own tokens and validated, not eyeballed --
   scripts/validate_palette.js from the dataviz method, run against #ffffff,
   the color these cards actually render on:

     categorical (adjacent pairs: bars, stacks, lines)  ALL CHECKS PASS
       worst adjacent CVD  green<->blue  dE 15.8 (deutan)
       worst adjacent normal-vision      dE 17.7
       all four clear 3:1 on white
     ordinal ramp, brand hue (the listing pipeline)     ALL CHECKS PASS
     status vs white   good 4.47:1  warning 3.14:1  critical 4.43:1

   The all-pairs pairlist caps at TWO slots, so nothing here is a scatter,
   bubble or map. Only adjacent forms are built, which is what that pairlist
   covers.

   Single theme on purpose. #mechanicApp hard-sets a light background, so a
   chart in here can never land on a dark surface; a speculative dark palette
   would be tokens that are never exercised and never validated. If the
   workspace ever gains a real dark mode, re-step these against that surface
   and run the validator again -- do not flip them.
   =========================================================================== */
#mechanicApp .tf-viz{
  --viz-surface:#fff;
  --viz-plane:#f7f7f5;
  --viz-ink:#191b1e;
  --viz-ink-2:#52575b;
  --viz-muted:#7c8185;
  --viz-grid:#ebebe7;
  --viz-axis:#dcdeda;

  --viz-1:#c4552a;          /* brand orange   */
  --viz-2:#3a7fb5;          /* steel blue     */
  --viz-3:#0d7d46;          /* green          */
  --viz-4:#7b53b0;          /* violet         */
  --viz-flat:#c9ccc8;       /* de-emphasis    */

  --viz-ord-1:#e8a184;      /* ordinal ramp, brand hue, light -> dark */
  --viz-ord-2:#d4764c;
  --viz-ord-3:#bb5228;
  --viz-ord-4:#8a3a18;

  --viz-good:#27875a;
  --viz-warn:#c78312;
  --viz-crit:#d9412c;
}

/* --- the container -------------------------------------------------------- */
#mechanicApp .tf-viz{
  display:grid;gap:14px;margin:0 0 22px;padding:18px 20px 20px;
  border:1px solid var(--line);border-radius:10px;background:var(--viz-surface);
}
#mechanicApp .tf-viz-head{display:flex;align-items:baseline;justify-content:space-between;gap:14px;flex-wrap:wrap}
#mechanicApp .tf-viz-head h3{
  margin:0;font:650 15px/1.2 var(--sig);letter-spacing:-.02em;color:var(--viz-ink);
}
#mechanicApp .tf-viz-head p{margin:4px 0 0;font-size:12.5px;line-height:1.5;color:var(--viz-ink-2);max-width:62ch}
#mechanicApp .tf-viz-toggle{
  border:1px solid var(--line);border-radius:7px;background:var(--viz-plane);cursor:pointer;
  padding:6px 10px;font:600 10px/1 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--viz-ink-2);
}
#mechanicApp .tf-viz-toggle:hover{border-color:var(--viz-muted);color:var(--viz-ink)}

/* --- meters (a ratio against a limit) ------------------------------------- */
#mechanicApp .tf-meters{display:grid;gap:15px}
#mechanicApp .tf-meter-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:6px}
#mechanicApp .tf-meter-label{font:600 12.5px/1.3 Inter,system-ui,sans-serif;color:var(--viz-ink)}
#mechanicApp .tf-meter-val{
  font:650 12px/1 var(--mono);color:var(--viz-ink-2);font-variant-numeric:tabular-nums;white-space:nowrap;
}
/* Track is a lighter step of the fill's own ramp, so state reads across the
   whole bar rather than only the filled part. */
#mechanicApp .tf-meter-track{
  position:relative;height:10px;border-radius:5px;overflow:hidden;background:#efeeea;
}
#mechanicApp .tf-meter-fill{
  position:absolute;left:0;top:0;bottom:0;border-radius:5px 4px 4px 5px;
  background:var(--viz-good);transition:width .3s ease;
}
#mechanicApp .tf-meter.is-warn  .tf-meter-fill{background:var(--viz-warn)}
#mechanicApp .tf-meter.is-warn  .tf-meter-track{background:#f7edd8}
#mechanicApp .tf-meter.is-crit  .tf-meter-fill{background:var(--viz-crit)}
#mechanicApp .tf-meter.is-crit  .tf-meter-track{background:#f8ded9}
#mechanicApp .tf-meter.is-good  .tf-meter-track{background:#dfeee6}
/* The threshold notch: where the limit sits, when the track runs past it. */
#mechanicApp .tf-meter-mark{
  position:absolute;top:-2px;bottom:-2px;width:2px;background:var(--viz-ink);opacity:.55;
}
#mechanicApp .tf-meter-note{
  display:flex;align-items:flex-start;gap:7px;margin-top:7px;
  font-size:12px;line-height:1.5;color:var(--viz-ink-2);
}
#mechanicApp .tf-meter-note svg{width:14px;height:14px;flex:none;margin-top:1px}
#mechanicApp .tf-meter.is-good .tf-meter-note svg{color:var(--viz-good)}
#mechanicApp .tf-meter.is-warn .tf-meter-note svg{color:var(--viz-warn)}
#mechanicApp .tf-meter.is-crit .tf-meter-note svg{color:var(--viz-crit)}

/* --- horizontal bars ------------------------------------------------------ */
#mechanicApp .tf-bars{display:grid;gap:9px}
#mechanicApp .tf-bar-row{
  display:grid;grid-template-columns:minmax(84px,29%) minmax(0,1fr);gap:12px;align-items:center;
  padding:2px 0;border-radius:6px;
}
#mechanicApp .tf-bar-row:hover{background:var(--viz-plane)}
#mechanicApp .tf-bar-name{
  font-size:12.5px;line-height:1.35;color:var(--viz-ink);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
#mechanicApp .tf-bar-lane{display:flex;align-items:center;gap:9px;min-width:0}
#mechanicApp .tf-bar-fill{
  height:14px;min-width:2px;border-radius:0 4px 4px 0;background:var(--viz-1);
}
#mechanicApp .tf-bar-fill.is-flat{background:var(--viz-flat)}
#mechanicApp .tf-bar-num{
  font:650 12px/1 var(--mono);color:var(--viz-ink-2);font-variant-numeric:tabular-nums;white-space:nowrap;
}
#mechanicApp .tf-bar-sub{display:block;font-size:11px;color:var(--viz-muted);margin-top:1px}

/* --- line chart ----------------------------------------------------------- */
#mechanicApp .tf-line-wrap{position:relative}
#mechanicApp .tf-line-svg{display:block;width:100%;height:auto;overflow:visible}
#mechanicApp .tf-line-svg .grid{stroke:var(--viz-grid);stroke-width:1}
#mechanicApp .tf-line-svg .axis{stroke:var(--viz-axis);stroke-width:1}
#mechanicApp .tf-line-svg .tick{
  fill:var(--viz-muted);font:500 10px/1 var(--mono);font-variant-numeric:tabular-nums;
}
#mechanicApp .tf-line-svg .series{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
#mechanicApp .tf-line-svg .endcap{stroke:var(--viz-surface);stroke-width:2}
#mechanicApp .tf-line-svg .crosshair{stroke:var(--viz-muted);stroke-width:1;opacity:0}
#mechanicApp .tf-line-svg.is-live .crosshair{opacity:.55}
#mechanicApp .tf-line-tip{
  position:absolute;z-index:5;min-width:132px;padding:9px 11px;pointer-events:none;opacity:0;
  border:1px solid var(--line);border-radius:8px;background:var(--viz-surface);
  box-shadow:0 8px 24px rgba(28,31,33,.14);transition:opacity .12s ease;
}
#mechanicApp .tf-line-tip.is-on{opacity:1}
#mechanicApp .tf-line-tip b{
  display:block;margin-bottom:6px;font:600 10px/1 var(--mono);
  letter-spacing:.07em;text-transform:uppercase;color:var(--viz-muted);
}
#mechanicApp .tf-tip-row{display:flex;align-items:baseline;gap:8px;padding:2px 0}
/* A short stroke, not a filled box: at tooltip density a box is data-weight ink
   doing a label's job. */
#mechanicApp .tf-tip-key{width:12px;height:2px;border-radius:1px;flex:none;position:relative;top:-3px}
#mechanicApp .tf-tip-val{
  font:650 14px/1 Inter,system-ui,sans-serif;color:var(--viz-ink);font-variant-numeric:tabular-nums;
}
#mechanicApp .tf-tip-name{font-size:12px;color:var(--viz-ink-2)}

/* --- legend --------------------------------------------------------------- */
#mechanicApp .tf-viz-legend{display:flex;flex-wrap:wrap;gap:7px 16px;align-items:center}
#mechanicApp .tf-viz-legend span{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:var(--viz-ink-2)}
#mechanicApp .tf-viz-legend i{width:14px;height:2px;border-radius:1px;flex:none}
#mechanicApp .tf-viz-legend i.rect{height:11px;width:11px;border-radius:2px}

/* --- stat tiles ----------------------------------------------------------- */
#mechanicApp .tf-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(132px,1fr));gap:11px}
#mechanicApp .tf-tile{
  position:relative;overflow:hidden;padding:13px 15px;
  border:1px solid var(--line);border-radius:9px;background:var(--viz-plane);
}
#mechanicApp .tf-tile-label{
  display:block;margin-bottom:7px;
  font:600 10px/1.2 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--viz-muted);
}
/* A rule across the top of the tile rather than a 9px chip. The four listing
   states are a pipeline, so the ramp is carrying their order -- and at chip
   size four steps of one hue were indistinguishable, which is a cue that is
   not a cue. */
#mechanicApp .tf-tile-swatch{position:absolute;left:0;right:0;top:0;height:3px}
/* Proportional figures on purpose: tabular-nums makes a standalone value look
   loose at display size. The tables below use tabular. */
#mechanicApp .tf-tile-val{display:block;font:650 26px/1 Inter,system-ui,sans-serif;letter-spacing:-.02em;color:var(--viz-ink)}
#mechanicApp .tf-tile-sub{display:block;margin-top:5px;font-size:11.5px;line-height:1.45;color:var(--viz-ink-2)}

/* --- the table twin ------------------------------------------------------- */
#mechanicApp .tf-viz-table{width:100%;border-collapse:collapse;font-size:12.5px}
#mechanicApp .tf-viz-table th,#mechanicApp .tf-viz-table td{
  padding:8px 10px;text-align:left;border-bottom:1px solid var(--viz-grid);color:var(--viz-ink);
}
#mechanicApp .tf-viz-table th{
  font:600 10px/1.2 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--viz-muted);
}
#mechanicApp .tf-viz-table td.num{text-align:right;font-variant-numeric:tabular-nums}
#mechanicApp .tf-viz-empty{
  padding:26px;text-align:center;border:1px dashed var(--line);border-radius:9px;
  color:var(--viz-ink-2);font-size:13px;
}
#mechanicApp .tf-viz-empty strong{display:block;margin-bottom:4px;color:var(--viz-ink);font-size:14px}

@media(max-width:640px){
  #mechanicApp .tf-bar-row{grid-template-columns:1fr;gap:4px}
  #mechanicApp .tf-viz{padding:15px 16px 17px}
}

/* Hosts the cards render into. The rows they sit in own no styling of their
   own, so a host with nothing in it takes up no space. */
#mechanicApp .tf-viz-host:empty,#mechanicApp .tf-viz-hostrow:empty{display:none}
#mechanicApp .tf-viz-host{display:block}
#mechanicApp .tf-viz-hostrow{display:block;margin-bottom:20px}
