/* Impalads · Metrix – tokens enligt Impalads DESIGN.md (29 okt 2026).
   Gamla variabelnamn (--ink, --line, --accent …) behålls som alias så att app.js inte behöver ändras. */
@font-face { font-family: "Saira"; font-weight: 600; font-display: swap; src: url("/fonts/saira-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
:root {
  --bg: #F7F6F4; --surface: #FFFFFF; --sunken: #EFEDE9; --ink: #111111; --ink-2: #555350; --muted: #807C76;
  --line: #E4E1DC; --line-strong: #C9C5BE;
  --accent: #C9520C; --accent-hover: #B0470A; --accent-active: #963D09; --accent-ink: #FFFFFF; --accent-soft: #FBEADF;
  --blue: #1E6EB4; --blue-hover: #185B95; --soft: #EFEDE9; --focus: #1E6EB4;
  --err: #B3261E; --err-bg: #FBE4E1; --warn: #9A5B00; --warn-bg: #FBEFD9; --info: #1E6EB4; --info-bg: #E1EDF8;
  --ok: #1E7B47; --ok-bg: #E3F3E9;
  --radius: 8px; --shadow: none; --shadow-md: 0 4px 12px rgba(17,17,17,0.10);
  --font-heading: "Saira", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414; --surface: #1C1C1B; --sunken: #2A2A28; --ink: #F2F0EC; --ink-2: #B5B1AA; --muted: #8F8A83;
    --line: #333331; --line-strong: #5A5852;
    --accent-hover: #DB5F14; --accent-active: #E8711F; --accent-soft: #2E1708;
    --blue: #5AA0E0; --blue-hover: #7BB4E8; --soft: #2A2A28; --focus: #5AA0E0;
    --err: #F2756A; --err-bg: #3A1511; --warn: #E8A33C; --warn-bg: #332406; --info: #5AA0E0; --info-bg: #0F2A42;
    --ok: #4CC07A; --ok-bg: #11301E;
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/22px var(--font-body);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; margin: 0 0 .5rem; }
h1 { font-size: 32px; line-height: 38px; } h2 { font-size: 24px; line-height: 30px; } h3 { font-size: 18px; line-height: 24px; }
p { margin: 0 0 .75rem; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-hover); }
code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 13px; line-height: 18px; }

/* Toppfält: logga, 1px streck, produktnamn */
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 56px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { height: 28px; width: auto; display: block; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .brand .logo-light { display: none; } .brand .logo-dark { display: block; } }
.brand .rule { width: 1px; height: 20px; background: var(--line); }
.mark { font-weight: 700; letter-spacing: -.01em; }
.product { font: 600 18px/1 var(--font-heading); color: var(--ink); }
.top-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: 10px 0; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: none; }
.narrow { max-width: 420px; margin: 3rem auto; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stack > * + * { margin-top: 16px; }

label { display: block; font-weight: 500; font-size: 14px; margin: .5rem 0 .25rem; }
input, select, textarea { font: 400 14px/20px var(--font-body); color: inherit; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 4px; padding: 7px 10px; min-height: 36px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
textarea { min-height: 5rem; resize: vertical; }
select { width: auto; }
/* Knappar: primär = orange, .ghost = sekundär (ram), .danger = destruktiv */
button { font: 500 14px/20px var(--font-body); cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 4px; padding: 7px 12px; min-height: 36px; transition: background-color .12s, border-color .12s; }
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:active { background: var(--accent-active); border-color: var(--accent-active); }
button.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
button.ghost:hover { background: var(--sunken); }
button.danger { background: var(--surface); color: var(--err); border-color: var(--line-strong); }
button.danger:hover { background: var(--err-bg); }
button.card { border-color: var(--line); text-align: left; padding: 24px; font-weight: 400; }
button.card:hover { border-color: var(--line-strong); background: var(--surface); }
button:disabled, button:disabled:hover { opacity: .5; cursor: default; }
form button { margin-top: .75rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 24px; overflow-x: auto; }
.tabs button { background: none; color: var(--ink-2); border: 0; border-bottom: 2px solid transparent; border-radius: 0; min-height: 0;
  padding: 12px 16px; font-weight: 500; white-space: nowrap; }
.tabs button:hover { background: none; color: var(--ink); border-color: transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.pill { display: inline-block; min-width: 1.5em; padding: 0 5px; margin-left: 4px; border-radius: 2px; background: var(--sunken); color: var(--ink-2);
  font: 500 12px/16px var(--font-body); text-align: center; }
.tabs button[aria-selected="true"] .pill { background: var(--accent-soft); color: var(--accent); }
.pill:empty { display: none; }

.score { font: 600 32px/36px var(--font-heading); font-variant-numeric: tabular-nums; }
.score small { font: 400 13px/18px var(--font-body); color: var(--muted); }
/* Poängmätare: grön 80+, gul 60–79, röd under 60 (läses ur bredden som app.js sätter) */
.bar { height: 8px; background: var(--sunken); border-radius: 999px; overflow: hidden; margin: .6rem 0 .8rem; }
.bar > i { display: block; height: 100%; background: var(--err); border-radius: 999px; }
.bar > i[style*="width:6"], .bar > i[style*="width:7"] { background: var(--warn); }
.bar > i[style*="width:8"], .bar > i[style*="width:9"], .bar > i[style*="width:100"] { background: var(--ok); }
.bar > i[style*="width:6%"], .bar > i[style*="width:7%"], .bar > i[style*="width:8%"], .bar > i[style*="width:9%"] { background: var(--err); }
.points { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.points li { display: flex; justify-content: space-between; gap: .5rem; padding: 6px 0; border-top: 1px solid var(--line); }
.points li:first-child { border-top: 0; }

.tag { display: inline-block; font: 500 12px/16px var(--font-body); padding: 2px 6px; border-radius: 2px; white-space: nowrap; }
.tag.error { color: var(--err); background: var(--err-bg); }
.tag.warn { color: var(--warn); background: var(--warn-bg); }
.tag.info { color: var(--info); background: var(--info-bg); }
.tag.ok, .tag.applied { color: var(--ok); background: var(--ok-bg); }
.tag.pending { color: var(--warn); background: var(--warn-bg); }
.tag.approved { color: var(--info); background: var(--info-bg); }
.tag.failed { color: var(--err); background: var(--err-bg); }
.tag.rejected, .tag.reverted { color: var(--ink-2); background: var(--sunken); }

details.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .75rem; }
details.group > summary { list-style: none; cursor: pointer; padding: .85rem 1.1rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary .what { flex: 1 1 260px; }
details.group > summary .count { font: 600 18px/24px var(--font-heading); }
details.group[open] > summary { border-bottom: 1px solid var(--line); }
.items { padding: .25rem 1.1rem 1rem; }
.item { padding: .75rem 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.sugg { background: var(--accent-soft); border-radius: 4px; padding: .6rem .75rem; margin: .5rem 0; white-space: pre-wrap; }
.sugg[contenteditable="true"] { outline: 2px solid var(--accent); background: var(--surface); }

/* Scentyper i AI-scenformuläret: valbara kort med kryssruta */
.chips { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin: .25rem 0 .5rem; }
.chip { display: flex; gap: .5rem; align-items: flex-start; margin: 0; padding: .5rem .6rem; font-weight: 400; border: 1px solid var(--line-strong);
  border-radius: 4px; background: var(--surface); cursor: pointer; }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip input { width: auto; margin: .15rem 0 0; flex: none; }
.chip:has(input:disabled) { opacity: .6; cursor: default; }
.thumbs { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.thumb { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--soft); }
.thumb .cap { padding: .4rem .5rem; font-size: .8rem; }
.thumbs.three { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.grid.proposals { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
table.seasons th, table.seasons td { text-align: left; vertical-align: top; }
table.seasons select { padding: .3rem .5rem; }
.swatch { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); margin-right: .6rem; }
.swatch i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); display: inline-block; }

.chat { display: flex; gap: .5rem; }
.chat input { flex: 1; }
.change { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.change:first-child { border-top: 0; }
.diff { font-size: .9rem; }
.diff del { color: var(--err); } .diff ins { color: var(--ok); text-decoration: none; }

table.rep { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.rep th, table.rep td { text-align: right; padding: .4rem .5rem; border-top: 1px solid var(--line); white-space: nowrap; }
table.rep th:first-child, table.rep td:first-child { text-align: left; }
table.rep th { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; border-top: 0; }

.msg { margin-top: .75rem; }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; border-radius: 4px; box-shadow: var(--shadow-md); max-width: calc(100% - 2rem); z-index: 10; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
@media (max-width: 560px) {
  .change { grid-template-columns: 1fr; }
  .score { font-size: 2.1rem; }
}

@media (max-width: 640px) {
  .top { padding: 0 16px; }
  main { padding: 16px 16px 48px; }
  .card { padding: 16px; }
  .brand .rule, .brand .product { font-size: 16px; }
  button { min-height: 44px; }
  .tabs button { min-height: 0; }
}
table.rep code { font-size: 12px; background: var(--sunken); padding: 1px 4px; border-radius: 2px; }

.diff .seen,.small .seen{font-weight:600;color:var(--ink,#1c1915)}
.diff .cut{color:#9a948c}

/* Möten (Korpcorp) */
.korp-meeting h3 { margin: 0; overflow-wrap: anywhere; }
.korp-meeting h4 { margin: 1rem 0 .3rem; font-size: .9rem; color: var(--muted); }
.korp-md, .korp-meeting li { overflow-wrap: anywhere; }
.korp-meeting audio, .tab audio { width: 100%; max-width: 100%; }
.korp-transcript { list-style: none; padding: 0; margin: 1rem 0 0; }
.korp-transcript li { padding: .4rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.korp-tc { font-variant-numeric: tabular-nums; margin-right: .4rem; }
@media (max-width: 400px) { .korp-meeting .spread { flex-wrap: wrap; gap: .25rem; } }

/* Idag: knappar som går att trycka med tummen, och rader som aldrig blir bredare än skärmen */
.idag-list { list-style: none; padding: 0; margin: 0; }
.idag-list li { max-width: 100%; overflow-wrap: anywhere; }
.idag-actions, .idag-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.idag-form[hidden] { display: none; }
.idag-actions button, .idag-actions a, .idag-form button, .idag-add > button { min-height: 40px; }
.idag-actions a { display: inline-flex; align-items: center; }
.idag-form input, .idag-form select { min-height: 40px; max-width: 100%; flex: 1 1 160px; }
.idag-form button { margin-top: 0; }
.idag-add { margin-bottom: 1rem; }
.idag-err { color: var(--err); margin: 4px 0 0; }
.idag-err:empty { display: none; }
