/* Försäljning mot budget: the few rules app.css does not have. Tokens only (DESIGN.md §2). */

/* White plate behind the company favicons in both themes (Royal Design's logo is black on transparent). */
:root { --logo-plate: #ffffff; }

/* ---------- Figure tile (.kp): label · big number · goal bar · "84 % av dagsbudget | Budget 120 000" ----------
   Same surface as .stat (DESIGN.md §6), one figure per tile. The number scales with the card's width
   (container query units), so a long amount never gets cut on a narrow card. */
.kp { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; min-width: 0;
      display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.kp .l { color: var(--muted); font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp .v { font-size: 30px; line-height: 1.05; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kp-l { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap;
        color: var(--muted); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.kp-l b { color: var(--ink); font-weight: 600; }
.kp-l .pc { font-size: 1.25em; color: var(--tone, var(--ink)); }

/* Goal bar: sold of the goal. In the month tile the line marks the budget so far. */
.meter { position: relative; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, var(--surface)); }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--tone, var(--faint)); transform-origin: left; }
.meter.t-day { --tone: var(--accent); } /* today before the day budget is reached: data, not a status */
.meter .mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 2px var(--surface2); }
.enter .meter .fill { animation: grow .7s .15s var(--ease) backwards; }

/* ---------- Company cards: the big part of the page. Idag on top, Månaden under, both full width. ---------- */
.card.co { container-type: inline-size; }
.card.co .card-b { justify-content: flex-start; gap: 10px; }
.card.co .kp { flex: 1; }
.card.co .kp.hero .v { font-size: clamp(30px, 14cqi, 160px); }
.card.co .kp.sec .v { font-size: clamp(24px, 10cqi, 112px); }
.card.co .kp.hero .l, .card.co .kp.sec .l { font-size: clamp(12.5px, 4cqi, 26px); }
.card.co .kp-l { font-size: clamp(12.5px, 3.8cqi, 24px); }
.card.co .meter { height: clamp(8px, 2.4cqi, 20px); }
.card.co .kp.sec .meter { height: clamp(8px, 1.8cqi, 14px); }
.card.co .card-h h3 { font-size: clamp(14px, 4.6cqi, 30px); }
.card-f .foot-note { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }

/* Company favicon in the card header, in place of the line icon. On --logo-plate in both themes. */
.card-h .co-logo { width: clamp(22px, 7cqi, 44px); height: clamp(22px, 7cqi, 44px); border-radius: 6px; display: block; flex: none;
                   object-fit: contain; background: var(--logo-plate); box-shadow: 0 0 0 1px var(--line); }

/* ---------- The group: one low row, four tiles side by side, status in the header (no footer). ---------- */
.card.nofoot { padding-bottom: 14px; }
.card.nofoot .card-b { padding: 10px 0 0; }
.card-h .hmeta { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); font-size: 13px; }
.card-h .hmeta .foot-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.nofoot .card-h .help { margin-left: 0; }
.kps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.card.group .kp { padding: 8px 12px; gap: 4px; }
.card.group .kp .v { font-size: 24px; }
.card.group .meter { height: 6px; }
@media (max-width: 900px) { .kps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- A company that is not connected yet: dashed tile with "Kommer snart", muted, same height ---------- */
.card.soon .card-h h3 { color: var(--muted); }
.soon-b { flex: 1; min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
          border: 1px dashed var(--line2); border-radius: 8px; background: var(--surface2); color: var(--faint); padding: 14px; }
.soon-b .i { width: clamp(28px, 9cqi, 64px); height: clamp(28px, 9cqi, 64px); }
.soon-t { color: var(--ink); font-size: clamp(18px, 7cqi, 48px); font-weight: 600; letter-spacing: -0.01em; }
.soon-d { color: var(--muted); font-size: clamp(13px, 3.8cqi, 24px); }

/* ---------- TV (?tv=1): head · the group row · the company cards fill the rest of the screen ---------- */
body.tv .wrap { grid-template-rows: auto auto minmax(0, 1fr); }
body.tv .wrap > .card { min-height: 0; overflow: hidden; }
body.tv .help { display: none; }
body.tv .card.co .card-b { padding: 1.2vh 0 1.2vh; gap: 1.2vh; }
body.tv .card.co .kp { padding: 1.4vh 1.1vw; gap: 1vh; }
body.tv .card.group .card-h h3 { font-size: clamp(14px, 1vw, 26px); }
body.tv .card.group .card-b { padding-top: .8vh; }
body.tv .card.nofoot { padding-bottom: 1vh; }
body.tv .card.group .kp { padding: .7vh .9vw; gap: .4vh; }
body.tv .card.group .kp .l, body.tv .card.group .kp-l, body.tv .card-h .hmeta { font-size: clamp(12.5px, .8vw, 20px); }
body.tv .card.group .kp .v { font-size: clamp(22px, 1.9vw, 54px); }
body.tv .card.group .meter { height: clamp(6px, .6vh, 12px); }
body.tv .kps { gap: .6vw; }
body.tv .card-f { padding: .8vh 1vw; }
body.tv .badge { font-size: clamp(12px, .85vw, 22px); }
body.tv .card-f .foot-note { font-size: clamp(13px, .9vw, 22px); }
@media (max-width: 1280px) { body.tv .wrap { grid-template-rows: none; } }
