/* kaselektriturgonkatki.ee - controls on the left, the result on the right.
   The one rule: the year grid never moves when something is switched on or
   off. Everything above it has a fixed height; anything that grows or shrinks
   lives in the sidebar or below the grid. Paper and ink; red only for "not
   enough", green only for what was added. */

:root{
  --paper:#F4F1EA;
  --panel:#FBFAF6;     /* the selected tab and its content */
  --tab-bar:#DDD7CA;   /* the bar the tabs sit on */
  --tab-off:#E9E5DC;   /* a tab not selected */
  --tab-hover:#F1EEE7;
  --ink:#1B1A17;
  --text-2:#3E3A33;
  --text-3:#5C574E;
  --line:rgba(27,26,23,.18);
  --line-soft:rgba(27,26,23,.12);
  --border:rgba(27,26,23,.22);
  --red:#9E1F17;
  --green:#3A7D35;
  --green-soft:#E6EFE0;
  --red-soft:#F6E2DE;   /* switched off or added demand: like the additions, in red */
  --serif:'Instrument Serif',Georgia,serif;
  --sans:'Hanken Grotesk','Helvetica Neue',Arial,sans-serif;
  --top:0px;
}

*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--paper);color:var(--ink);font:16px/1.5 var(--sans);-webkit-font-smoothing:antialiased}
a{color:var(--ink)}
a:hover{color:var(--red)}
button{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.linkish{border:0;background:none;padding:0;cursor:pointer;text-decoration:underline;text-decoration-color:var(--border);text-underline-offset:3px}
.linkish:hover{color:var(--red)}

/* --- header --- */
header.top{max-width:1440px;margin:0 auto;padding:28px 32px 20px;border-bottom:1px solid var(--line-soft)}
.top-line{display:flex;justify-content:space-between;align-items:baseline;gap:8px 24px;flex-wrap:wrap}
h1{margin:0;font:400 48px/1 var(--serif);letter-spacing:-.01em}
.beta{display:inline-block;vertical-align:.9em;margin-left:6px;padding:2px 7px;border:1px solid var(--border);border-radius:6px;font:500 12px/1.3 var(--sans);letter-spacing:.04em;text-transform:uppercase;color:var(--text-3)}
.toplinks{display:flex;gap:22px;font-size:15px;flex-wrap:wrap}
.toplinks a{text-decoration:none;white-space:nowrap}
.toplinks{align-items:baseline}
.toplinks a.linkish{text-decoration:underline;text-decoration-color:var(--border)}
h1 a.home{color:inherit;text-decoration:none}
/* ET/EN, drawn like the emissions tab's EUR/kg switch */
.lang-box{display:inline-flex;align-self:center;border:1px solid var(--border);border-radius:999px;overflow:hidden;font-size:12.5px;line-height:18px}
.lang-box>*{padding:0 7px;text-decoration:none;color:var(--text-3);background:var(--panel)}
.lang-box>[aria-current]{background:var(--ink);color:var(--paper)}
.lang-box a:hover{color:var(--red)}
.lede{margin:12px 0 0;font-size:16px;line-height:1.5;color:#4F4A42;max-width:900px}

/* --- the app: sidebar | stage, and the flow below the stage --- */
.app{
  max-width:1440px;margin:0 auto;display:grid;
  grid-template-columns:368px minmax(0,1fr);
  grid-template-areas:"controls stage" "controls flow" "foot foot";
  grid-template-rows:auto 1fr auto;
}
.controls{
  grid-area:controls;align-self:start;padding:16px 20px 24px 32px;
  border-right:1px solid var(--line-soft);display:flex;flex-direction:column;gap:8px;
}
/* The sidebar is part of the page: it scrolls with everything else, so no
   switch is ever hidden inside a panel of its own. */
.controls>*{flex-shrink:0}
.stage{grid-area:stage;min-width:0;padding:16px 32px 10px;display:flex;flex-direction:column}
.flow{grid-area:flow;min-width:0;padding:20px 32px 56px}

/* --- rows in the sidebar --- */
.rows{display:flex;flex-direction:column;gap:8px}
.row{border-radius:12px}
.row svg{width:22px;height:22px;flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.row-text{display:flex;flex-direction:column;gap:1px;flex-grow:1;min-width:0;text-align:left}
.row-t{font-size:15px;font-weight:600;line-height:1.25}
.row-s{font-size:12.5px;line-height:1.35;opacity:.75}

/* Switched off: a switch. On = filled ink with a red knob; some parts = tinted. */
.cut{display:flex;flex-direction:column;border:1.5px solid var(--border)}
.row-head{
  width:100%;min-height:55px;display:flex;align-items:center;gap:4px;padding-right:12px;
  border-radius:12px;background:transparent;
}
.row-open{
  flex-grow:1;min-width:0;min-height:54px;display:flex;align-items:center;gap:12px;padding:8px 6px 8px 12px;
  border:0;border-radius:10px;background:transparent;color:inherit;cursor:pointer;text-align:left;
}
.switch{position:relative;flex:none;width:44px;height:28px;padding:0;border:0;border-radius:14px;background:rgba(27,26,23,.18);cursor:pointer}
.switch span{position:absolute;top:4px;left:4px;width:20px;height:20px;border-radius:10px;background:#fff}
/* A card's choices sit inside its border, under the title row. */
.cut[data-state="all"],.cut[data-state="some"]{background:var(--red-soft);border-color:var(--red)}
.cut[data-state="all"] .switch{background:var(--red)}
.cut[data-state="all"] .switch span{left:20px}
.cut[data-state="some"] .switch{background:var(--paper);box-shadow:inset 0 0 0 1.5px var(--red)}
.cut[data-state="some"] .switch span{left:20px;background:var(--red)}
.parts{display:flex;flex-wrap:wrap;gap:6px;padding:0 12px 12px 46px}
.part{
  min-height:34px;padding:0 12px;border-radius:8px;border:1.5px solid var(--border);background:transparent;
  font-size:13px;cursor:pointer;display:flex;align-items:center;gap:6px;
}
.part[aria-pressed="true"]{background:var(--red);border-color:var(--red);color:#fff}
.part .mw{opacity:.7;font-variant-numeric:tabular-nums}
/* A rule that is always on (Latvia sends no more): shown on, can't be clicked,
   and doesn't colour the card. */
.part.moot{opacity:.4}
.part.locked{background:var(--text-3);border-color:var(--text-3);color:#fff;cursor:default}
.part.locked svg{width:13px;height:13px;stroke-width:2}

/* Added: size chips. On = green. */
.sep{border:0;border-top:1px solid var(--line);margin:10px 0}
.add{min-height:58px;display:flex;align-items:center;gap:8px;padding:8px 8px 8px 12px;border:1.5px solid var(--border)}
.add .row-text{flex:1;min-width:0}
/* The amount: a field, so it reads as something to type in (D90A). */
.amt{display:flex;align-items:center;gap:3px;min-height:38px;padding:0 8px;border:1.5px solid var(--border);border-radius:8px;background:var(--panel);cursor:text;font-size:13px;color:var(--text-3)}
.amt input{width:4.2ch;padding:0;border:0;background:transparent;font:inherit;font-variant-numeric:tabular-nums;color:var(--ink);text-align:right;outline:none;cursor:text}
.amt:focus-within{border-color:var(--text-2)}
.amt.on{background:var(--green);border-color:var(--green);color:rgba(255,255,255,.85)}
.amt.on input{color:#fff}
.add[data-add="dc"] .amt.on{background:var(--red);border-color:var(--red)}
.add.muted .amt,.add.muted .amt input{cursor:not-allowed}
.add.on{border-color:var(--green);background:var(--green-soft)}
.add.muted{opacity:.4;filter:grayscale(1)}
.add.muted button{cursor:not-allowed}
.seg{display:flex;gap:4px;flex:none}
.seg button{
  min-width:44px;min-height:38px;padding:0 5px;border-radius:8px;border:1.5px solid transparent;background:transparent;
  font-size:13px;font-variant-numeric:tabular-nums;color:var(--text-2);cursor:pointer;
}
.seg button[aria-pressed="true"]{border-color:rgba(27,26,23,.35)}
/* The data centre adds demand, not supply: red, like what is switched off. */
.add[data-add="dc"].on{border-color:var(--red);background:var(--red-soft)}
.actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:4px}
.btn{min-height:38px;padding:0 14px;border-radius:10px;border:1.5px solid var(--border);background:transparent;font-size:14px;cursor:pointer}
.btn-share{border-color:var(--green);color:var(--green)}
.btn-share:hover{background:var(--green-soft)}
.btn-reset{border-color:var(--red);color:var(--red)}
.btn-reset:hover{background:#F6E4E0}

/* --- the stage: every line has a fixed height --- */
.kpis{height:92px;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.kpi{padding:12px 16px;border-radius:12px;border:1px solid var(--line-soft);display:flex;flex-direction:column;justify-content:space-between;min-width:0}
.kpi-l{font-size:13px;color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kpi-n{font:400 46px/1 var(--serif);font-variant-numeric:tabular-nums;white-space:nowrap;display:flex;align-items:flex-end;gap:10px;min-width:0}
.kpi-n.is-short{color:var(--red)}
.kpi-n.kpi-add.on{color:var(--green)}
/* Beside the figure: the change from the actual year, and when. */
.kpi-x{display:flex;flex-direction:column;min-width:0;padding-bottom:4px;font:400 12.5px/1.3 var(--sans);color:var(--text-3)}
.kpi-x span{overflow:hidden;text-overflow:ellipsis}
/* One line per note, two at most, never taller than the figure: a narrow box
   must not grow over the grid. */
.kpi-x span:not(.x-w){white-space:nowrap}
.kpi-x{max-height:46px;overflow:hidden}
.x-w{white-space:pre-line}   /* a two-line side note: "kasutati" over the figure */
.x-d{font-weight:600;color:var(--text-2)}

/* Tabs on a bar, joined to the panel below: the selected tab has the panel's
   colour and no line under it, so the figures read as that tab's content. */
.views-row{display:flex;align-items:flex-end;gap:12px;padding:6px 6px 0;background:var(--tab-bar);
  border:1px solid var(--line);border-bottom:0;border-radius:12px 12px 0 0}
.views-row .views{flex:1 1 auto;min-width:0}
.views{display:flex;flex-wrap:nowrap;column-gap:4px;overflow-x:auto;scrollbar-width:none}
.views::-webkit-scrollbar{display:none}
.views [role="tab"]{
  flex:none;min-height:38px;padding:0 16px;border:0;border-radius:9px 9px 0 0;
  background:var(--tab-off);font-size:13.5px;color:var(--text-3);cursor:pointer;white-space:nowrap;
}
.views [role="tab"]:hover{background:var(--tab-hover);color:var(--ink)}
.views [role="tab"][aria-selected="true"]{background:var(--panel);color:var(--ink);font-weight:600}
.tab-panel{display:flex;flex-direction:column;gap:14px;padding:14px 16px 12px;background:var(--panel);
  border:1px solid var(--line);border-top:0;border-radius:0 0 12px 12px}
.tab-panel .kpi{background:var(--paper)}

.grid-wrap{display:grid;grid-template-columns:minmax(0,1fr) 28px;column-gap:10px;row-gap:6px}
#grid{display:block;width:100%;height:288px;border-radius:4px;cursor:crosshair;touch-action:pan-y}
.hours-axis{position:relative;height:288px;font-size:12px;color:var(--text-3);font-variant-numeric:tabular-nums}
.hours-axis span{position:absolute;left:0;transform:translateY(-50%);white-space:nowrap}
.hours-axis span:nth-child(1){top:0}
.hours-axis span:nth-child(2){top:25%}
.hours-axis span:nth-child(3){top:50%}
.hours-axis span:nth-child(4){top:75%}
.hours-axis span:nth-child(5){top:100%}
.months-axis{grid-column:1;position:relative;height:16px;font-size:12px;color:var(--text-3)}
.months-axis span{position:absolute;top:0;white-space:nowrap}
/* Under the grid: the hour pointed at on the left, the period on the right, one line. */
.underline{height:22px;display:flex;align-items:baseline;gap:24px;font-size:14px;line-height:22px}
.readout{flex-grow:1;min-width:0;margin:0;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.readout .pin{color:var(--red)}
.legend{height:22px;display:flex;gap:22px;align-items:center;font-size:13px;color:var(--text-3);white-space:nowrap;overflow:hidden}
.legend span{display:flex;align-items:center;gap:8px}
.sw{width:14px;height:14px;border-radius:3px;flex:none;display:block}
.sw-enough{background:linear-gradient(to right,#F3F0E9 0 20%,#CFCABF 20% 40%,#A59E8F 40% 60%,#7E7562 60% 80%,#534B3C 80% 100%)}
.sw-reserve{background:linear-gradient(to right,#D6E3ED 0 20%,#8FB0C9 20% 40%,#5686AA 40% 60%,#35607F 60% 80%,#1E3A52 80% 100%)}
.sw-affected{background:linear-gradient(to right,#F5CDB8 0 25%,#EFA27C 25% 50%,#D1492C 50% 75%,#9E1F17 75% 100%)}
.sw-imports{background:linear-gradient(to right,#FBF4D3 0 20%,#F6E9AE 20% 40%,#EBCB52 40% 60%,#C29A12 60% 80%,#8C6F0B 80% 100%)}
.sw-exports{background:linear-gradient(to right,#B9D6AE 0 33%,#86B67A 33% 66%,#4F8A4A 66% 100%)}
.sw-added{background:linear-gradient(to right,#B5D6A3 0 25%,#86BC72 25% 50%,#55964A 50% 75%,#2F6B2B 75% 100%)}
.sw-line{height:2px;border-radius:1px;background:var(--ink)}
.legend-gap{display:block;width:6px;flex:none}   /* between two items inside one legend entry */
.sw-short{background:linear-gradient(to right,#EFA27C 0 33%,#D1492C 33% 66%,#9E1F17 66% 100%)}

/* --- the flow below: free to grow --- */
.flow{display:flex;flex-direction:column;gap:10px;margin:0 32px;padding-left:0;padding-right:0}
/* Heading left, what the flow shows centred over it, the way back right. */
.flow-head{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:baseline;gap:16px}
.flow-head h2{margin:0;font-size:15px;font-weight:600;color:var(--text-2)}
.flow-total{font-size:13px;color:var(--text-3)}
.flow-head .linkish{justify-self:end;font-size:14px}
.flow-total{text-align:center}
.sankey{display:flex;flex-direction:column;gap:28px}
.band{position:relative;width:100%}
.band svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.sankey .node{position:absolute;border-radius:1px}
.sankey .lbl{position:absolute;font-size:12.5px;line-height:1.2;transform:translateY(-50%);color:var(--text-2)}
.sankey .lbl b{white-space:nowrap}
.sankey .lbl b{font-weight:500;color:var(--ink);font-variant-numeric:tabular-nums;margin-left:4px}
.sankey .lbl.left{text-align:right}
.sankey .lbl.red,.sankey .lbl.red b{color:var(--red);font-weight:600}
.sankey .lbl.green,.sankey .lbl.green b{color:var(--green);font-weight:600}
.sankey .empty{display:flex;align-items:center;justify-content:center;min-height:120px;border:1px dashed var(--line);border-radius:8px;font-size:14px;color:var(--text-3);text-align:center;padding:12px}
.minor{margin:0;font-size:14px;line-height:1.45;color:var(--text-3)}
.period{flex:none;margin:0;color:var(--text-3);white-space:nowrap}
/* The footer, well clear of the flow. */
.foot{grid-area:foot;margin:16px 32px 0;padding:16px 0 40px;border-top:1px solid var(--line-soft);font-size:14px;color:var(--text-3)}
.foot p{margin:0 0 6px}
.foot a{color:var(--text-2)}

/* --- ?debug=1 panel --- */
.debug{margin-top:12px;overflow-x:auto;font-size:13px;color:var(--text-2)}
.debug table{border-collapse:collapse;width:100%;font-variant-numeric:tabular-nums}
.debug td{padding:3px 12px 3px 0;border-bottom:1px solid var(--line-soft);vertical-align:top}
.debug td:nth-child(2){text-align:right;white-space:nowrap}
.debug td:nth-child(3){color:var(--text-3)}
.debug .dh th{text-align:left;padding:12px 0 4px;font-weight:600;color:var(--ink)}
.debug button{margin-top:10px;border:1.5px solid var(--border);background:transparent;border-radius:10px;min-height:40px;padding:0 14px;cursor:pointer}

/* --- the fine print, in a dialog --- */
dialog.notes{
  width:min(860px,calc(100vw - 32px));max-height:calc(100vh - 48px);padding:0 28px 28px;border:0;border-radius:14px;
  background:var(--paper);color:var(--text-3);font-size:14px;line-height:1.55;box-shadow:0 20px 60px rgba(27,26,23,.25);
}
dialog.notes::backdrop{background:rgba(27,26,23,.35)}
.notes-head{position:sticky;top:0;background:var(--paper);display:flex;justify-content:space-between;align-items:center;padding:20px 0 8px;gap:16px}
.notes-head h2{margin:0;font-size:17px;font-weight:600;color:var(--ink)}
.close{width:44px;height:44px;flex:none;border:0;border-radius:10px;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center}
.close svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round}
.notes h3{margin:18px 0 6px;font-size:14px;font-weight:600;color:var(--text-2)}
.notes p{margin:8px 0 12px}
.notes ol,.notes ul{margin:0;padding-left:20px}
.notes li{margin:0 0 4px}
.notes table{border-collapse:collapse;margin:4px 0 12px;font-variant-numeric:tabular-nums}
.notes th,.notes td{padding:3px 24px 3px 0;text-align:left;border-bottom:1px solid var(--line-soft)}
.notes th{font-weight:600;color:var(--text-2)}
.notes td:last-child,.notes th:last-child{padding-right:0}
.notes td.num,.notes th.num{text-align:right;white-space:nowrap}

/* --- narrower screens --- */
@media (max-width:1100px){
  .app{grid-template-columns:320px minmax(0,1fr)}
  .controls{padding-left:20px}
  .stage{padding:16px 20px 0}
  .flow{margin:0 20px}
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr));height:196px}   /* two rows of 92 + gap */
}
/* Narrower stage: the legend may take two lines. Always two, so the grid
   doesn't move when a tab or a switch changes the legend's length. */
@media (max-width:1180px){
  /* Six tabs don't fit on one line here: three per row, all visible; a long
     label may take two lines. The selected one keeps the panel's colour. */
  .views-row{padding:4px}
  .views{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;overflow:visible}
  .views [role="tab"]{padding:3px 4px;border-radius:7px;white-space:normal;line-height:1.15;text-align:center}
  .legend{height:42px;flex-wrap:wrap;align-content:flex-start;row-gap:4px;column-gap:14px;font-size:12px}
  .legend span{flex-wrap:wrap;row-gap:4px}
}
/* The phone's "Change scenario" sheet: hidden on wider screens. */
.sheet-open,.sheet-grip,.sheet-back{display:none}
/* Phone: the result, then the flow; the switches sit in a sheet that slides
   up over the lower 60% of the screen, so the tiles and the grid stay in
   view above it. Closed by the grip (tap or drag down) or a tap above it. */
@media (max-width:760px){
  header.top{padding:16px 16px 12px}
  h1{font-size:32px}
  .lede{font-size:15px}
  .app{grid-template-columns:minmax(0,1fr);grid-template-areas:"stage" "flow" "foot";grid-template-rows:auto}
  .stage{background:var(--paper);padding:8px 16px 8px;gap:8px}
  .controls{
    position:fixed;left:0;right:0;bottom:0;z-index:30;height:60vh;height:60dvh;overflow-y:auto;
    overscroll-behavior:contain;border-right:0;padding:0 16px 16px;background:var(--paper);
    border-radius:16px 16px 0 0;box-shadow:0 -6px 24px rgba(27,26,23,.18);
    transform:translateY(105%);transition:transform .25s ease,visibility 0s .25s;visibility:hidden;
  }
  body.sheet-on .controls{transform:none;visibility:visible;transition:transform .25s ease}
  .sheet-grip{
    display:flex;justify-content:center;position:sticky;top:0;z-index:1;width:auto;margin:0 -16px;
    padding:10px 0 12px;border:0;background:var(--paper);cursor:grab;touch-action:none;
  }
  .sheet-grip span{width:44px;height:5px;border-radius:3px;background:var(--line)}
  .sheet-back{display:block;position:fixed;inset:0;z-index:29}
  .sheet-back[hidden]{display:none}
  .sheet-open{
    display:block;position:fixed;left:16px;right:16px;bottom:12px;z-index:20;min-height:48px;
    border:0;border-radius:12px;background:var(--ink);color:var(--paper);font-size:16px;cursor:pointer;
    box-shadow:0 4px 16px rgba(27,26,23,.25);
  }
  body.sheet-on .sheet-open{display:none}
  .app{padding-bottom:72px}
  .flow{margin:0 16px}
  .kpis{height:62px;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
  .kpi{padding:0;border:0;gap:2px}
  .kpi-l{font-size:11px;white-space:normal;line-height:1.2}
  .kpi-n{font-size:21px}
  .kpi-n{gap:3px}
  .kpi-x{font-size:10px;padding-bottom:1px}
  .x-w{display:none}
  .views-row{border-radius:10px 10px 0 0}
  .views [role="tab"]{min-height:30px;font-size:12px}
  .tab-panel{padding:8px 8px 6px;gap:8px;border-radius:0 0 10px 10px}
  .tab-panel .kpi{background:none}
  .grid-wrap{grid-template-columns:minmax(0,1fr) 22px;column-gap:6px;row-gap:2px}
  #grid,.hours-axis{height:168px}
  .hours-axis{font-size:10px}
  .months-axis{font-size:11px;height:14px}
  .months-axis span:nth-child(even){display:none}
  .toplinks{gap:6px 16px}
  .underline{height:36px;font-size:13px;line-height:18px}
  .readout{white-space:normal}
  .period{display:none}
  .flow-head{grid-template-columns:minmax(0,1fr) auto}
  .flow-total{grid-row:2;grid-column:1 / -1;text-align:left}
  .foot{margin:16px 16px 0;padding:16px 0 32px}
  /* No legend on phones - only the CO2 cost switch of the emissions tab stays. */
  .legend>span:not(.cost-box){display:none}
  .legend:not(:has(.cost-box:not([hidden]))){display:none}
  .parts{padding-left:12px}
  .sankey .lbl{font-size:11.5px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* Kiisa: always there, so no switch - a dashed outline instead. */
/* Kiisa used: up to 24 h, up to 168 h (its 7-day fuel stock), more. */

/* The selected hour's tooltip: beside the hour, over the grid, lets the pointer through. */
.grid-box{position:relative;min-width:0}
.hour-tip{position:absolute;z-index:2;width:250px;max-width:calc(100% - 8px);padding:10px 12px;border-radius:10px;background:rgba(251,250,246,.97);border:1px solid var(--border);box-shadow:0 4px 18px rgba(27,26,23,.16);font-size:12.5px;line-height:1.35;pointer-events:none}
/* Closes the selected hour: red, in the tooltip's top right corner. */
.hour-close{position:absolute;top:6px;right:6px;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:var(--red);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;pointer-events:auto}
.hour-close svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round}
.hour-close:hover{background:#7E1812}
.tip-when{font-weight:600;margin-bottom:4px;padding-right:28px}
.tip-head{color:var(--text-3);margin:6px 0 2px}
.tip-head:first-of-type{margin-top:0}
.tip-row{display:flex;justify-content:space-between;gap:12px}
.tip-row b{font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap}
.tip-row.red{color:var(--red)}
.tip-row.red b{font-weight:600}
.tip-row.minus{color:var(--text-3)}
.tip-row.first{margin-top:4px;padding-top:4px;border-top:1px solid var(--line-soft)}

/* Emissions tab: the CO2 cost switch, at the end of the legend row. */
.cost-box{margin-left:auto;display:inline-flex;flex:none;border:1px solid var(--border);border-radius:999px;overflow:hidden}   /* 20 px: fits the 22 px legend, which clips */
.cost-box button{width:30px;height:18px;padding:0;text-align:center;border:0;background:var(--panel);font:inherit;font-size:12.5px;color:var(--text-3);cursor:pointer}
.cost-box button[aria-pressed="true"]{background:var(--ink);color:var(--paper)}
.cost-box[hidden]{display:none}
.legend .cost-box{gap:0}   /* not the legend items' 8 px: the two halves meet */

/* --- articles: the list where the app has its cards, the same line between --- */
.art-page{max-width:1440px;margin:0 auto;display:grid;grid-template-columns:368px minmax(0,1fr)}
.art-list{padding:16px 20px 24px 32px;border-right:1px solid var(--line-soft)}
.art-list h2{font:600 13px/1.3 var(--sans);letter-spacing:.04em;text-transform:uppercase;color:var(--text-3);margin:8px 0 12px}
.art-list ul{list-style:none;padding:0;margin:0}
.art-list li{margin:0 0 14px;line-height:1.35}
.art-list li a{text-decoration:none}
.art-list li.on a{font-weight:600}
.art-list li a:hover{color:var(--red)}
.article-date{display:block;color:var(--text-3);font-size:13px;margin-top:2px}
.draft{color:var(--red)}
.article{max-width:680px;padding:16px 32px 64px;font-size:17px;line-height:1.6}
.article-title{font:400 38px/1.15 var(--serif);margin:6px 0 20px}
.article-meta{margin:8px 0 0;font-size:14px;color:var(--text-3)}
.article h2{font:600 20px/1.3 var(--sans);margin:32px 0 8px}
.article table{border-collapse:collapse;margin:12px 0;font-size:15px}
.article th,.article td{padding:4px 10px;border-bottom:1px solid var(--line-soft);text-align:left}
.article .num{text-align:right}
.article figure{margin:16px 0}
.article img{max-width:100%;height:auto;border:1px solid var(--line-soft);border-radius:6px}
@media (max-width:1100px){
  .art-page{grid-template-columns:320px minmax(0,1fr)}
  .art-list{padding-left:20px}
  .article{padding:16px 20px 64px}
}
/* Phone: the article first, the list after it. */
@media (max-width:760px){
  .art-page{grid-template-columns:minmax(0,1fr)}
  .art-list{order:2;border-right:0;border-top:1px solid var(--line-soft);padding:16px}
  .article{padding:16px 16px 40px;font-size:16px}
  .article-title{font-size:30px}
}
