/* Agrepto Klarhet 0.6.0 – färger från agrepto.se */
:root {
  color-scheme: light;
  --navy: #010c1e;
  --navy-2: #0a1c2c;
  --navy-3: #12303f;
  --turquoise: #86dddd;
  --teal: #1d6f72;
  --teal-2: #124f52;
  --orange: #d8590a;
  --ink: #0b1a2b;
  --ink-2: #33454f;
  --muted: #4b5d68;
  --line: #d5e1e6;
  --line-2: #e6eef1;
  --bg: #eef3f6;
  --surface: #ffffff;
  --surface-2: #f3f7f9;
  --ok: #145c3f;
  --ok-bg: #e6f4ef;
  --warn: #7a3a06;
  --warn-bg: #fff4ea;
  --danger: #a12626;
  --danger-bg: #fdeaea;
  --info-bg: #e8f3f6;
  /* Äldre namn som används av Fortnox- och Google Ads-sidorna */
  --brand: var(--teal);
  --brand2: var(--teal-2);
  --card: var(--surface);
  --font-body: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", "Segoe UI", system-ui, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-body);
}
a { color: var(--teal); }
a:hover { color: var(--teal-2); }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

h1, h2, h3 { font-family: var(--font-display); color: var(--ink); line-height: 1.1; }
h1 { font-size: clamp(32px, 4vw, 44px); font-weight: 700; margin: 0 0 12px; }
h2 { font-size: 26px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 20px; font-weight: 700; margin: 0; }
p { margin: 0 0 14px; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 17px; max-width: 760px; }
.eyebrow { margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.danger-text { color: var(--danger); font-size: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.back-link { margin-bottom: 10px; font-weight: 600; }
.back-link a { text-decoration: none; }

/* Skal: sidopanel + innehåll */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  width: 248px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 28px;
  padding: 28px 18px;
  background: var(--navy); color: #dfe9ee;
}
.main { flex: 1; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 22px; }
.main > .card, .main > section { margin-bottom: 0; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; z-index: 10; background: #fff; padding: 8px 12px; border-radius: 8px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--turquoise); color: var(--navy);
  font: 700 24px/1 var(--font-display);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font: 700 22px/1.1 var(--font-display); letter-spacing: .02em; }
.brand-text small { font-size: 12px; color: #97b3bf; letter-spacing: .08em; text-transform: uppercase; }
.brand-dark { color: var(--navy); justify-content: center; margin-bottom: 24px; }
.brand-dark:hover { color: var(--navy); }
.brand-dark .brand-text small { color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px;
  color: #c5d6de; text-decoration: none; font-weight: 500; font-size: 15px;
}
.nav-link:hover { background: var(--navy-2); color: #fff; }
.nav-link.is-active { background: var(--navy-3); color: #fff; font-weight: 600; }
.nav-link.is-active .nav-icon { color: var(--turquoise); }
.nav-link.is-disabled { color: #6f8995; cursor: default; }
.nav-link.is-disabled:hover { background: transparent; color: #6f8995; }
.nav-label { margin: 18px 0 4px; padding: 0 12px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #7f9aa6; }

.account { margin-top: auto; padding: 14px 12px; border-radius: 12px; background: var(--navy-2); display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #97b3bf; }
.account strong { color: #fff; font-size: 14px; }
.account form { margin-top: 8px; }

/* Inloggning */
.layout-auth { background: var(--bg); }
.auth-main { max-width: 440px; margin: 0 auto; padding: 64px 16px 32px; }
.auth-main .card h1 { font-size: 34px; }
.auth-footer { text-align: center; font-size: 14px; color: var(--muted); margin-top: 24px; }

/* Sidhuvud */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .lead { margin: 10px 0 0; }
.inline-form { display: flex; gap: 10px; align-items: center; }
.inline-form select { margin: 0; }

/* Kort */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 26px 28px; margin-bottom: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.empty-state { text-align: center; padding: 40px 28px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 8px; }
.section-heading h2 { margin-bottom: 4px; }
.grid, .integration-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.integration-card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.integration-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 12px; }

/* Formulär */
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input, select, textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid #b9c9d0; border-radius: 10px;
  background: #fff; color: var(--ink); font: inherit;
}
select { width: auto; max-width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible {
  outline: 3px solid var(--turquoise); outline-offset: 2px;
}
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 0; border-radius: 10px;
  background: var(--turquoise); color: var(--navy);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button:hover, button:hover { background: #6fd0d0; color: var(--navy); }
.button:focus-visible, button:focus-visible { outline-color: var(--navy); }
.button.secondary, button.secondary { background: #fff; color: var(--ink); border: 1px solid #c9d6dd; }
.button.secondary:hover, button.secondary:hover { background: var(--surface-2); color: var(--ink); }
.button.ghost, button.ghost { background: transparent; color: #dfe9ee; border: 1px solid #2a4556; }
.button.ghost:hover, button.ghost:hover { background: var(--navy-3); color: #fff; }
.button.small, button.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.button.disabled { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); cursor: not-allowed; }
button:disabled { opacity: .65; cursor: wait; }

/* Meddelanden */
.notice { border-radius: 12px; padding: 12px 16px; border: 1px solid transparent; color: var(--ink-2); }
.notice.error { background: var(--danger-bg); color: var(--danger); border-color: #f3c6c6; }
.notice.success { background: var(--ok-bg); color: var(--ok); border-color: #bfe3d3; }
.notice.info { background: var(--info-bg); border-color: #c6e0e6; }

/* Märken */
.badge, .status {
  display: inline-flex; align-items: center;
  padding: 4px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 700; white-space: nowrap;
  background: var(--ok-bg); color: var(--ok);
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .status.pending { background: var(--warn-bg); color: var(--warn); }
.badge.muted { background: var(--surface-2); color: var(--ink-2); }
.badge.soon { background: var(--warn-bg); color: var(--warn); }

/* Källchips på översikten */
.source-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.source-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.source-chip strong { color: var(--ink); }
.source-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #9fb3bd; }
.source-chip.is-ok .dot { background: #1f8a5b; }
.source-chip.is-warn { background: var(--warn-bg); border-color: #f5c9a6; color: var(--warn); }
.source-chip.is-warn .dot { background: var(--orange); }
.source-chip.is-warn strong { color: var(--warn); }

/* Nyckeltal */
.kpi-grid, .metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.kpi, .metrics > div { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.kpi-label, .metrics span { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi-value, .metrics strong {
  display: block; margin-top: 4px;
  font: 600 30px/1.1 var(--font-display); font-variant-numeric: tabular-nums;
}
.money-lines { line-height: 1.25; }

/* Tabeller */
.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line-2); text-align: left; white-space: nowrap; vertical-align: top; }
thead th {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid var(--navy);
}
tbody th { font-weight: 600; }
.number { text-align: right; }

/* Integrationer */
.integration-table { display: flex; flex-direction: column; }
.integration-row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 2fr) minmax(0, 2fr);
  gap: 16px; align-items: center;
  padding: 18px 24px; border-top: 1px solid var(--line-2);
}
.integration-head {
  border-top: 0; padding-top: 12px; padding-bottom: 12px;
  background: var(--surface-2);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.integration-name { display: flex; flex-direction: column; gap: 2px; }
.integration-name strong { font-size: 16px; }
.integration-name span, .integration-sync { font-size: 14px; color: var(--ink-2); }
.actions-cell { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.actions-cell form { margin: 0; }
.integration-head .actions-cell { display: block; text-align: right; }

.trust-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.trust-card { background: var(--navy); color: #dfe9ee; border-radius: 16px; padding: 22px 24px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.trust-card strong { font: 700 22px/1.1 var(--font-display); color: var(--turquoise); }

/* Användare */
.users-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.users-layout.single { grid-template-columns: minmax(0, 1fr); }
.users-layout > .card { margin-bottom: 0; }
.subheading { margin-top: 28px; font-size: 20px; }
.row-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.row-form select { padding: 7px 10px; }
td form { margin: 0; }
.button.danger, button.danger { background: #fff; color: var(--danger); border: 1px solid #efc2c2; }
.button.danger:hover, button.danger:hover { background: var(--danger-bg); color: var(--danger); }
.role-choices { border: 0; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.role-choices legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.role-choice {
  display: flex; gap: 12px; align-items: flex-start; margin: 0;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400;
}
.role-choice:has(input:checked) { border-color: var(--teal); background: #f0f8f7; }
.role-choice input { margin-top: 4px; }
.role-choice span { display: flex; flex-direction: column; gap: 2px; }
.role-choice small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.invite-link-card { border-color: #bfe3d3; background: #f5fbf9; }
.copy-field { display: flex; gap: 10px; }
.copy-field input { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.copy-field .button { white-space: nowrap; flex-shrink: 0; }
.users-layout th, .users-layout td { white-space: normal; }
.users-layout .row-form, .users-layout .button { white-space: nowrap; }
.form-actions { margin-top: 20px; }

/* Mitt konto och tvåstegsverifiering */
.account-link { color: var(--turquoise); font-size: 13px; text-decoration: none; margin-top: 2px; }
.account-link:hover, .account-link.is-active { color: #fff; text-decoration: underline; }
.notice.warn-notice { background: var(--warn-bg); border-color: #f5c9a6; color: var(--warn); }
.notice.warn-notice a { color: var(--warn); font-weight: 600; }
.code-input { max-width: 220px; font: 600 22px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .15em; }
.secret-key { margin: 10px 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px dashed #b9c9d0; }
.secret-key code { background: none; padding: 0; font-size: 20px; letter-spacing: .08em; font-weight: 600; }
code.wrap { word-break: break-all; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 12px; color: var(--ink-2); }
.recovery-codes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.recovery-codes code { display: block; text-align: center; padding: 8px; font-size: 15px; background: #fff; border: 1px solid var(--line); }
.danger-zone { margin-top: 12px; }
.danger-zone summary { cursor: pointer; color: var(--danger); font-weight: 600; }

/* Inloggning med Google/Microsoft */
.button.social-button {
  width: 100%; margin-top: 8px;
  background: #fff; color: #1f1f1f; border: 1px solid #b9c9d0;
  font-weight: 600; gap: 12px;
}
.button.social-button:hover { background: var(--surface-2); color: #1f1f1f; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 4px; font-size: 13px; color: var(--muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Äldre sidor */
.topbar, .container, .footer { display: none; }

@media (max-width: 1100px) {
  .integration-row { grid-template-columns: minmax(0, 1fr) auto; }
  .integration-head { display: none; }
  .integration-sync { grid-column: 1 / -1; }
  .actions-cell { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    position: static; height: auto; width: 100%;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 12px 16px;
  }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; gap: 4px; }
  .nav-label, .nav-link.is-disabled { display: none; }
  .nav-link { white-space: nowrap; padding: 9px 12px; }
  .account { margin: 0 0 0 auto; padding: 0; background: transparent; flex-direction: row; align-items: center; }
  .account strong, .account span { display: none; }
  .account form { margin: 0; }
  .main { padding: 20px 16px 40px; }
  .kpi-grid, .metrics, .trust-grid, .users-layout { grid-template-columns: 1fr; }
  .copy-field { flex-direction: column; }
  .recovery-codes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 20px 16px; }
  .integration-row { padding: 16px; }
  .section-heading { flex-direction: column; }
}
.method-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.method-list li { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.worker-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }
.worker-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #1f8a5b; margin-right: 4px; }
.worker-status.is-stale { color: var(--warn); }
.worker-status.is-stale .dot { background: var(--orange); }

/* Inställningssidor för integrationer */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.facts div { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.facts dt { font-size: 13px; font-weight: 600; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-weight: 600; color: var(--ink); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.button-row form { margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.two-col > .card { margin-bottom: 0; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* Koppla från */
.danger-card { border-color: #efc2c2; padding: 0; }
.danger-card > summary { cursor: pointer; padding: 18px 28px; font-weight: 700; color: var(--danger); list-style-position: inside; }
.danger-card[open] > summary { border-bottom: 1px solid #f3d6d6; }
.disconnect-form { padding: 20px 28px 24px; max-width: 640px; }
.button.danger-solid, button.danger-solid { background: var(--danger); color: #fff; }
.button.danger-solid:hover, button.danger-solid:hover { background: #7f1d1d; color: #fff; }

/* Översikt (0.10.0) */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-top: 14px; border-radius: 12px; background: #dde7ec; }
.segmented a { padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 15px; color: var(--ink-2); text-decoration: none; }
.segmented a:hover { color: var(--ink); background: rgba(255, 255, 255, .55); }
.segmented a.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(1, 12, 30, .12); }
.segmented.small { margin-top: 0; }
.segmented.small a { padding: 6px 12px; font-size: 14px; }
.overview-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.overview-filters label { margin: 0; font-size: 13px; color: var(--muted); }
.overview-filters label span { display: block; margin-bottom: 4px; }
.overview-filters select { margin: 0; padding: 8px 12px; font-weight: 600; color: var(--ink); }
.card-pad { padding: 26px 28px 0; }

.kpi-tiles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin: 18px 0 20px; }
.kpi-tile { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; }
.kpi-tile:hover { border-color: var(--teal); color: var(--ink); }
.kpi-tile.is-active { border: 2px solid var(--teal); padding: 15px 17px; }
.kpi-tile-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi-tile.is-active .kpi-tile-label { color: var(--teal); font-weight: 700; }
.kpi-tile-value { font-family: var(--font-display); font-size: clamp(21px, 1.8vw, 27px); font-weight: 600; line-height: 1.05; white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.kpi-tile-delta { font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi-tile-delta.is-good { color: #16734c; }
.kpi-tile-delta.is-bad { color: var(--danger); }
.kpi-tile.is-profit { background: var(--navy); border-color: var(--navy); color: #fff; }
.kpi-tile.is-profit:hover { color: #fff; border-color: var(--turquoise); }
.kpi-tile.is-profit.is-active { border-color: var(--turquoise); }
.kpi-tile.is-profit .kpi-tile-label, .kpi-tile.is-profit .kpi-tile-delta { color: #b9cfd8; }
.kpi-tile.is-profit .kpi-tile-delta.is-good { color: #7fe0b0; }
.kpi-tile.is-profit .kpi-tile-delta.is-bad { color: #ffb4a8; }

.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.chart-head p { margin: 0 0 6px; }
.chart-total strong { font-family: var(--font-display); font-size: 30px; margin-right: 10px; }
.line-chart { display: block; width: 100%; height: auto; margin: 14px 0 6px; }
.chart-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0; margin: 0 0 8px; font-size: 14px; color: var(--ink-2); }
.chart-legend li { display: flex; align-items: center; gap: 8px; }
.swatch-line { display: inline-block; width: 26px; border-top: 3px solid var(--teal); }
.swatch-line.is-compare { border-top: 3px dashed #7ec9cc; }

.attr-list { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.attr-list li { display: grid; grid-template-columns: 110px minmax(80px, 1fr) 56px minmax(0, 190px); align-items: center; gap: 14px; }
.attr-country { font-weight: 600; }
.attr-bar { width: 100%; height: 8px; }
.attr-list strong { text-align: right; font-variant-numeric: tabular-nums; }

.month-table td, .month-table th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.month-table .row-toggle { color: var(--ink); text-decoration: none; font-weight: 600; }
.month-table .row-toggle span { display: inline-block; width: 14px; color: var(--teal); }
.month-table tr.is-open > * { background: #e8f3f6; }
.month-table tr.is-week > * { background: var(--surface-2); font-size: 14px; }
.month-table tr.is-week th { padding-left: 32px; }
.month-table tr.is-week .row-toggle { font-weight: 500; }
.month-table tr.is-day > * { font-size: 13px; color: var(--muted); }
.month-table tr.is-day th { padding-left: 56px; font-weight: 500; }
.month-table tfoot tr > * { font-weight: 700; border-top: 2px solid var(--ink); background: var(--surface); }

.country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 16px; }
.country-box { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.country-box header { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.country-box h3 { display: flex; align-items: center; gap: 8px; }
.country-main { margin: 10px 0 12px; }
.country-main strong { font-family: var(--font-display); font-size: 26px; margin-right: 8px; }
.country-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0; }
.country-facts dt { font-size: 13px; color: var(--muted); }
.country-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.swatch.c0 { background: #010c1e; } .swatch.c1 { background: #1d6f72; } .swatch.c2 { background: #d8590a; } .swatch.c3 { background: #86dddd; }
.swatch.c4 { background: #7f9aa6; } .swatch.c5 { background: #f5b98a; } .swatch.c6 { background: #4b5d68; } .swatch.c7 { background: #b9cfd8; }
.donut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 240px)); gap: 28px; align-items: start; margin: 16px 0; }
.donut-grid figure { margin: 0; text-align: center; }
.donut-grid figcaption { margin-top: 8px; font-weight: 600; color: var(--ink-2); }
.donut { width: 100%; max-width: 220px; height: auto; }
.share-table td.is-over { color: var(--orange); font-weight: 700; }
.share-table td.is-under { color: var(--teal); font-weight: 700; }

@media (max-width: 1280px) { .kpi-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .kpi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .donut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .donut-grid .share-table { grid-column: 1 / -1; }
  .attr-list li { grid-template-columns: 90px minmax(60px, 1fr) 48px; }
  .attr-list li > .small { grid-column: 1 / -1; }
  .card-pad { padding: 20px 16px 0; }
}


/* Översikt: tabeller (0.11.0) */
.crumb { margin: 0; font-size: 14px; font-weight: 600; }
.crumb a { text-decoration: none; }
.country-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.country-chips a { padding: 6px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none; }
.country-chips a:hover { border-color: var(--teal); color: var(--ink); }
.country-chips a.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.ov-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ov-head h2 { margin-bottom: 4px; }

.ov-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.ov-table th, .ov-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; vertical-align: middle; }
.ov-table thead th { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; text-align: right; background: var(--surface); vertical-align: bottom; border-bottom: 1px solid var(--line); }
.ov-table thead tr:last-child th:first-child { text-align: left; }
.ov-table thead .grp th { font-size: 11px; color: var(--teal); border-bottom: 2px solid var(--turquoise); text-align: center; padding-bottom: 6px; }
.ov-table thead .grp th.blank { border-bottom: 0; }
.ov-table td { text-align: right; font-variant-numeric: tabular-nums; }
.ov-table tbody th, .ov-table tfoot th { text-align: left; font-weight: 600; }
.ov-table .is-neg { color: var(--danger); }
.ov-table .is-strong { font-weight: 700; }
.ov-table tfoot > tr > * { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; background: var(--surface); }
.ov-table tr.is-selected > * { background: #e8f3f6; }

.ov-table .row-toggle { display: inline-flex; align-items: center; gap: 0; min-height: 0; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.ov-table .row-toggle:hover { background: none; color: var(--teal); }
.ov-table .row-toggle .chev { display: inline-block; width: 18px; color: var(--teal); font-weight: 700; }
.ov-table .row-toggle .chev::before { content: "›"; }
.ov-table .row-toggle[aria-expanded="true"] .chev::before { content: "⌄"; }
.ov-table .row-toggle .muted { margin-left: 5px; font-weight: 500; }
.ov-table tr.ov-month.is-open > * { background: #e8f3f6; }
.ov-table tr.ov-month.is-open > th { box-shadow: inset 4px 0 0 var(--teal); }
.ov-table tr.ov-month.is-future > * { color: #9fb3bd; }
.ov-table tr.ov-month.is-future .row-label { padding-left: 18px; }
.ov-table tr.ov-week > * { background: var(--surface-2); font-size: 13px; }
.ov-table tr.ov-week > th { padding-left: 36px; }
.ov-table tr.ov-week.is-open > * { background: #eef6f8; }
.ov-table tr.ov-day > * { font-size: 13px; color: var(--muted); }
.ov-table tr.ov-day > th { padding-left: 62px; font-weight: 500; }
.ov-table tr.ov-day .is-neg { color: var(--danger); }

.country-link, .country-name { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); font-weight: 700; text-decoration: none; }
.country-link:hover { color: var(--teal); }
.country-link .go { margin-left: 6px; color: var(--teal); font-size: 13px; }
.country-box h3 a { color: var(--ink); text-decoration: none; }
.country-box h3 a:hover { color: var(--teal); }
.share { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.share-bar { display: block; }
.donut-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; margin: 0 0 8px; font-size: 14px; }
.country-main .is-neg, .country-facts .is-neg { color: var(--danger); }
.attr-country a { color: var(--ink); font-weight: 600; text-decoration: none; }
.attr-country a:hover { color: var(--teal); }

/* Period, jämförelse och förändring (0.12.0) */
.filter-group { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.date-pair { display: flex; gap: 8px; align-items: flex-end; }
.date-pair[hidden] { display: none; }
.date-pair input { margin: 0; padding: 7px 10px; font: inherit; font-size: 14px; }
.period-line { margin: 0; font-size: 15px; color: var(--ink-2); }
.delta { display: block; margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.delta.is-good { color: #16734c; }
.delta.is-bad { color: var(--danger); }
.country-facts dd .delta, .country-main .delta { display: inline-block; margin-left: 8px; }
.ov-table tr.ov-day .delta { font-weight: 600; }
.chart-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chart-legend .swatch { margin-right: 0; }

/* Länderkort och kanaltabell (0.13.0) */
.country-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; margin-top: 16px; }
.country-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.country-card h3 { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.country-card h3 a { color: var(--ink); text-decoration: none; }
.country-card h3 a:hover { color: var(--teal); }
.country-card h3 small { font: 600 13px var(--font-body); color: var(--muted); }
.pies { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.pies figure { margin: 0; text-align: center; }
.pies figcaption { margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.pies .donut { max-width: 150px; }
.pie-legend { list-style: none; padding: 0; margin: 6px 0 0; font-size: 12px; text-align: left; }
.pie-legend li { display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; }
.pie-legend .swatch { width: 9px; height: 9px; margin-right: 5px; }
.swatch.c-other { background: #9fb3bd; }
.card-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line-2); }
.card-figures dt { font-size: 12px; color: var(--muted); }
.card-figures dd { margin: 0; font-size: 15px; font-weight: 700; }
.card-figures .is-neg { color: var(--danger); }

.total-hint { display: block; margin-top: 2px; font-size: 11px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }

/* Filtermeny, kvartal och mobil (0.14.0) */
.overview-filters { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-end; gap: 10px; }
.filter-dates { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.filter-dates:not(:has(.date-pair:not([hidden]))) { display: none; }
fieldset.date-pair { margin: 0; padding: 6px 12px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
fieldset.date-pair legend { padding: 0 4px; font-size: 12px; font-weight: 700; color: var(--teal); }
fieldset.date-pair label { margin: 0; }

.ov-table tr.ov-quarter > * { background: #e3f1f2; font-weight: 700; border-top: 2px solid var(--turquoise); border-bottom: 2px solid var(--turquoise); }
.ov-table tr.ov-quarter > th { color: var(--teal-2); }
.ov-table tr.ov-quarter.is-future > * { background: var(--surface-2); color: #9fb3bd; border-color: var(--line); }

.quarter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.quarter-box { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.quarter-box header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.quarter-box.is-future { background: var(--surface-2); color: var(--muted); }
.quarter-box .country-facts { grid-template-columns: 1fr; }
.quarter-box .country-facts div { display: flex; justify-content: space-between; gap: 8px; }
.quarter-box .country-facts dd { text-align: right; }

@media (max-width: 1100px) {
  .quarter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .overview-filters { width: 100%; align-items: stretch; }
  .filter-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-row label, .filter-row select { width: 100%; }
  .filter-dates { justify-content: stretch; }
  fieldset.date-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  fieldset.date-pair[hidden] { display: none; }
  fieldset.date-pair input { width: 100%; }
  .quarter-grid { grid-template-columns: 1fr; }
  .country-cards { grid-template-columns: 1fr; }
  .ov-table th, .ov-table td { padding: 8px 8px; }
}

/* Nyckeltal överst med sju rutor (0.15.0) */
.chart-card .chart-head h3 { font-size: 22px; margin-bottom: 4px; }
@media (max-width: 1400px) { .kpi-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .kpi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Händelser: ändringar i kopplingarna (0.16.0) */
.ov-table .event-marker { display: inline-flex; align-items: center; gap: 3px; min-height: 0; margin-left: 8px; padding: 2px 8px; border: 1px solid #b9cfd8; border-radius: 999px; background: #fff; color: var(--ink-2); font: 700 11px/1.4 var(--font-body); cursor: pointer; vertical-align: middle; }
.ov-table .event-marker:hover { background: #fff; border-color: var(--teal); color: var(--teal); }
.ov-table .event-marker[aria-expanded="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.ov-table tr.ov-events > td { padding: 8px 12px 12px 34px; background: #fbf7f1; border-bottom: 1px solid var(--line); text-align: left; white-space: normal; }
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.event-list time { display: inline-block; min-width: 92px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.chart-events { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #fbf7f1; }
.chart-events h4 { margin: 0 0 6px; font-size: 14px; color: var(--ink); }
.event-dot { color: #4b5d68; margin-right: 4px; }
@media (max-width: 700px) {
  .ov-table .event-marker { padding: 5px 10px; font-size: 12px; }
  .ov-table tr.ov-events > td { padding-left: 12px; }
  .event-list time { display: block; min-width: 0; }
}

/* Händelsemarkören till vänster, i Agreptos blå, och smalare periodkolumn (0.16.1) */
.ov-table tbody th, .ov-table tfoot th, .ov-table thead tr:last-child th:first-child { width: 1%; }
.ov-table .event-slot { display: inline-block; width: 46px; vertical-align: middle; }
.ov-table .event-marker { margin-left: 0; border-color: var(--navy); background: var(--navy); color: #fff; }
.ov-table .event-marker:hover { background: var(--navy-3); border-color: var(--navy-3); color: #fff; }
.ov-table .event-marker[aria-expanded="true"] { background: var(--turquoise); border-color: var(--turquoise); color: var(--navy); }
.ov-table tr.ov-events > td { padding-left: 58px; }
.ov-table tr.ov-week > th { padding-left: 24px; }
.ov-table tr.ov-day > th { padding-left: 44px; }
@media (max-width: 700px) {
  .ov-table .event-slot { width: 42px; }
  .ov-table tr.ov-week > th { padding-left: 14px; }
  .ov-table tr.ov-day > th { padding-left: 24px; }
  .ov-table tr.ov-events > td { padding-left: 12px; }
}

/* Händelsemarkören som liten cirkel i vänstermarginalen, händelseraden i Agreptos blå (0.16.2) */
.ov-table tbody th { position: relative; }
.ov-table .event-slot { display: none; }
.ov-table .event-marker {
  position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: var(--navy); color: #fff;
  font: 700 10px/1 var(--font-body); cursor: pointer;
}
.ov-table .event-marker::after { content: ""; position: absolute; inset: -10px; } /* större tryckyta på mobilen */
.ov-table .event-marker:hover { background: var(--navy-3); color: #fff; }
.ov-table .event-marker[aria-expanded="true"] { background: var(--turquoise); color: var(--navy); }
.ov-table tr.ov-week > th .event-marker { left: 6px; }
.ov-table tr.ov-day > th .event-marker { left: 22px; }
.ov-table tr.ov-events > td { padding: 10px 14px 12px 30px; background: var(--navy); color: #fff; border-bottom: 0; }
.ov-table tr.ov-events .event-list { color: #fff; }
.ov-table tr.ov-events .event-list time { color: var(--turquoise); }
.chart-events { background: var(--navy); color: #fff; }
.chart-events h4, .chart-events .event-list { color: #fff; }
.chart-events .event-list time { color: var(--turquoise); }
.chart-events .event-dot { color: var(--turquoise); }
@media (max-width: 700px) {
  .ov-table tr.ov-events > td { padding-left: 14px; }
}
.ov-table tbody tr > th, .ov-table tfoot tr > th { padding-left: 28px; }
.ov-table tbody tr.ov-week > th { padding-left: 44px; }
.ov-table tbody tr.ov-day > th { padding-left: 64px; }
.ov-table .event-marker { left: 5px; }
.ov-table tr.ov-week > th .event-marker { left: 21px; }
.ov-table tr.ov-day > th .event-marker { left: 41px; }
.ov-table tbody tr.ov-events > td { padding-left: 28px; }
@media (max-width: 700px) {
  .ov-table tbody tr > th, .ov-table tfoot tr > th { padding-left: 26px; }
  .ov-table tbody tr.ov-week > th { padding-left: 36px; }
  .ov-table tbody tr.ov-day > th { padding-left: 46px; }
  .ov-table tr.ov-week > th .event-marker { left: 13px; }
  .ov-table tr.ov-day > th .event-marker { left: 23px; }
}

/* Månads- och kvartalsrader: bara en mörkblå siffra som notis, ingen cirkel (0.16.3) */
.ov-table tr.ov-month > th .event-marker,
.ov-table tr.ov-quarter > th .event-marker { background: none; color: var(--navy); font-size: 12px; }
.ov-table tr.ov-month > th .event-marker:hover,
.ov-table tr.ov-quarter > th .event-marker:hover { background: none; color: var(--teal); text-decoration: underline; }
.ov-table tr.ov-month > th .event-marker[aria-expanded="true"],
.ov-table tr.ov-quarter > th .event-marker[aria-expanded="true"] { background: none; color: var(--teal); text-decoration: underline; }

/* Nedbrytning: "· totalt" på utfälld rad, blått och vitt per nivå (0.16.5) */
.ov-table .total-when-open { display: none; }
.ov-table tr.is-open .total-when-open { display: inline; }
.ov-table tr.ov-month.is-open > * { background: #dbe9f4; }
.ov-table tr.ov-week > * { background: #eef5fb; }
.ov-table tr.ov-week.is-open > * { background: #e3eef8; }
.ov-table tr.ov-day > * { background: #fff; }

/* Varannan rad och mörkblå utfälld vecka (0.16.6) */
.ov-table tr.ov-week > * { background: #fff; }
.ov-table tr.ov-week.is-alt > * { background: #eef5fb; }
.ov-table tr.ov-day > * { background: #fff; }
.ov-table tr.ov-day.is-alt > * { background: #f2f7fc; }
.ov-table tr.ov-week.is-open > * { background: var(--navy); color: #fff; }
.ov-table tr.ov-week.is-open .row-toggle,
.ov-table tr.ov-week.is-open .row-toggle:hover { color: #fff; }
.ov-table tr.ov-week.is-open .muted { color: #b9cfd8; }
.ov-table tr.ov-week.is-open .row-toggle .chev { color: var(--turquoise); }
.ov-table tr.ov-week.is-open td.is-neg { color: #ffb4a8; }
.ov-table tr.ov-week.is-open .delta { color: #b9cfd8; }
.ov-table tr.ov-week.is-open .delta.is-good { color: #7fe0b0; }
.ov-table tr.ov-week.is-open .delta.is-bad { color: #ffb4a8; }
.ov-table tr.ov-week.is-open .event-marker { background: var(--turquoise); color: var(--navy); }

/* Jämförelsevärdet i nyckeltalsrutorna (0.17.0) */
.kpi-tile-cmp { font-size: 12px; color: var(--muted); line-height: 1.3; }
.kpi-tile.is-profit .kpi-tile-cmp { color: #b9cfd8; }

/* Nyckeltal i två grupper: resultat | marknadsföring och ordrar (0.17.1) */
.kpi-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)) 14px repeat(4, minmax(0, 1fr)); }
.kpi-tile.is-group-start { grid-column: 5; }
@media (max-width: 1400px) {
  .kpi-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-tile.is-group-start { grid-column: auto; }
}
@media (max-width: 700px) {
  .kpi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1400px) {
  .kpi-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-tile.is-group-start { grid-column: 1; } /* marknadsföringsgruppen börjar på ny rad */
}
@media (max-width: 700px) {
  .kpi-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-tile.is-group-start { grid-column: 1; }
}

/* Kanaler över tid: en tabell per kanal, som kanalblocken i landsfliken (0.20.0) */
.channel-jump { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.channel-jump a { display: inline-flex; align-items: center; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none; background: var(--surface); }
.channel-jump a:hover { border-color: var(--teal); }
.channel-block { margin-top: 26px; scroll-margin-top: 16px; }
.channel-block h3 { display: flex; align-items: center; margin: 0 0 8px; font-size: 18px; }

/* Kostnader från Fortnox (0.23.0) */
.cost-table tr.is-pending > th, .cost-table tr.is-pending > td.number { color: var(--muted); }
.cost-table td .badge { white-space: nowrap; }

/* Kostnader: utfälld månad med veckor och konton (0.79.0) */
.cost-table .month-toggle { color: inherit; text-decoration: none; }
.cost-table .month-toggle:hover { text-decoration: underline; }
.cost-table .chev { display: inline-block; width: 14px; margin-right: 6px; color: var(--muted); font-weight: 700; transition: transform .15s; }
.cost-table .chev::before { content: "›"; }
.cost-table .chev.is-empty::before { content: ""; }
/* Månadsnamnet på en rad även i mobilläget med nyckeltalsknappar (has-metric-chips tillåter radbrytning). */
.cost-table.has-metric-chips > tbody > tr > th, .cost-table > tbody > tr > th { white-space: nowrap; }
.cost-table tr.is-open > th, .cost-table tr.is-open > td { background: #eef3ff; }
.cost-table tr.is-open .chev { transform: rotate(90deg); }
.cost-table tr.cost-detail-row > td { padding: 0 0 14px; background: #f8faff; text-align: left; }
.cost-detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; margin: 6px 12px 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.cost-detail.is-stacked { grid-template-columns: minmax(0, 1fr); }
/* Rutorna håller sig inom den synliga bredden när månadstabellen skrollar i sidled (mobil, surfplatta). */
.cost-wrap { container-type: inline-size; }
.cost-table .cost-detail { position: sticky; left: 12px; box-sizing: border-box; width: calc(100cqw - 24px); }
@media (max-width: 1100px) { .cost-detail { grid-template-columns: minmax(0, 1fr); } }
.cost-detail-title { margin: 0 0 8px; font-size: 15px; }
.cost-table .cost-detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
/* Inre tabeller: egna regler som väger tyngre än .ov-table (smal första kolumn, indrag, radbrytning i mobilläget). */
.cost-table .cost-detail-table th, .cost-table .cost-detail-table td { width: auto; padding: 6px 8px; text-align: left; border-bottom: 1px solid #eef1f5; white-space: nowrap; }
.cost-table .cost-detail-table thead th { font-size: 12px; font-weight: 600; color: var(--muted); border-bottom-color: var(--line); }
.cost-table .cost-detail-table .number { text-align: right; font-variant-numeric: tabular-nums; }
.cost-table .cost-detail-table tbody th { font-weight: 600; }
.cost-table .cost-detail-table tbody th a { color: var(--ink); text-decoration: none; }
.cost-table .cost-detail-table tbody th a:hover { text-decoration: underline; }
.cost-table .cost-detail-table tfoot th a { color: var(--ink); text-decoration: none; }
.cost-table .cost-detail-table tfoot th a:hover { text-decoration: underline; }
.cost-table .cost-detail-table tr.is-selected > th, .cost-table .cost-detail-table tr.is-selected > td { background: #eef3ff; }
.cost-table .cost-detail-table tfoot th, .cost-table .cost-detail-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line); }
.cost-table .cost-detail-table.cost-accounts td:nth-child(2) { white-space: normal; }
/* Smal skärm: Kategori döljs i kontolistan så att Belopp får plats (kategorin syns i veckotabellen). */
@container (max-width: 560px) { .cost-accounts th:nth-child(3), .cost-accounts td:nth-child(3) { display: none; } }
.cost-table .cost-detail .dot-cell { width: 18px; padding-left: 0; padding-right: 0; text-align: center; }
.cost-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.cost-dot.is-booked { background: #1f9d55; }
/* Ej bokförd: ihålig ring, så att formen och inte bara färgen skiljer (färgblindhet); kontrast minst 3:1 mot vitt. */
.cost-dot.is-pending { box-sizing: border-box; background: transparent; border: 2px solid #c96a00; }
.cost-legend { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.cost-legend .cost-dot { margin-left: 8px; }
.cost-legend .cost-dot:first-child { margin-left: 0; }
.cost-weeks { margin-bottom: 8px; }
.cost-weeks a { padding: 6px 12px; font-size: 14px; }
.cost-weeks .is-disabled { padding: 6px 12px; font-size: 14px; font-weight: 600; color: var(--muted); opacity: .55; cursor: not-allowed; }

/* Mobilen: ett nyckeltal åt gången i tabellerna (0.24.0) */
.metric-chips { display: none; }
@media (max-width: 700px) {
  .metric-chips { display: flex; gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; scrollbar-width: none; }
  .metric-chips::-webkit-scrollbar { display: none; }
  .metric-chip { flex: none; min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; cursor: pointer; }
  .metric-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--turquoise); }
  table.has-metric-chips .m-hide { display: none; }
  table.has-metric-chips thead .grp { display: none; }
  table.has-metric-chips { table-layout: auto; }
  table.has-metric-chips > * > tr > th, table.has-metric-chips > * > tr > td { white-space: normal; }
  table.has-metric-chips > * > tr > td { white-space: nowrap; width: 45%; }
}
.cost-years { float: right; margin: 0 0 8px 12px; }
@media (max-width: 700px) { .cost-years { float: none; margin: 0 0 10px; } }
.reconcile-table tr.is-pending > th, .reconcile-table tr.is-pending > td.number { color: var(--muted); }

/* Systemstatus (0.26.1) */
.ov-table td.error-cell { white-space: normal; min-width: 280px; text-align: left; color: var(--danger); font-size: 13px; }

/* Kostnader: översikt med cirklar och staplar (0.80.0). Randigt = från plattformen; texten står alltid bredvid färgen. */
.cost-overview h2 { margin-top: 0; }
.cost-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; margin: 4px 0 16px; }
.cost-filters .cost-view { margin-left: auto; }
.cost-period-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.cost-period-form select, .cost-period-form input[type="date"] { min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; font-size: 14px; font-weight: 600; }
.cost-ov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .cost-ov-grid { grid-template-columns: minmax(0, 1fr); } .cost-filters .cost-view { margin-left: 0; } }
.cost-ov-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: var(--surface); min-width: 0; }
.cost-ov-card h3 { margin: 0 0 12px; font-size: 16px; }
.cost-ov-card .donut { display: block; width: 220px; height: 220px; max-width: 100%; margin: 0 auto 12px; }
.cost-legend-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.cost-legend-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eef1f5; }
.cost-legend-list li.sum { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line); }
.cost-legend-list li.sub { border-bottom: 0; padding-top: 0; color: var(--muted); font-size: 13px; }
.cost-legend-list .val, .cost-other-list .val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.cost-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; vertical-align: middle; }
.cost-sw.is-hatched { background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(255, 255, 255, .55) 3px 5px); }
.cost-sw.g-cost_of_goods, .cost-sw.p0 { background-color: #010c1e; }
.cost-sw.g-ads_platform, .cost-sw.p2 { background-color: #d8590a; }
.cost-sw.g-payroll, .cost-sw.p1 { background-color: #1d6f72; }
.cost-sw.g-shipping_logistics, .cost-sw.p4 { background-color: #7f9aa6; }
.cost-sw.g-payment_fees, .cost-sw.p6 { background-color: #4b5d68; }
.cost-sw.g-other_booked, .cost-sw.p7 { background-color: #b9cfd8; }
.cost-sw.g-marketing_booked, .cost-sw.p5 { background-color: #f5b98a; }
.cost-sw.p3, .cost-sw.g-email_platform_api { background-color: #86dddd; }
.cost-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 11px; font-weight: 700; white-space: nowrap; }
.cost-tag.is-booked { background: #eef1f5; color: var(--ink-2); }
.cost-bars-wrap { overflow-x: auto; }
.cost-bars-wrap .cost-bars { display: block; width: 100%; min-width: 620px; height: auto; }
.cost-bars a rect { cursor: pointer; }
.cost-bars a:hover rect, .cost-bars a:focus rect { opacity: .85; }
.cost-bar-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; font-size: 13px; }
.cost-bar-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cost-ov-total { margin: 10px 0 0; font-size: 14px; }
.cost-other { margin-top: 20px; }
.cost-other-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; font-size: 14px; }
@media (max-width: 900px) { .cost-other-list { grid-template-columns: minmax(0, 1fr); } }
.cost-other-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #eef1f5; }
.cost-other-list li.sum { grid-column: 1 / -1; font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line); margin-top: 4px; }
.cost-ov-note { display: flex; gap: 8px; align-items: center; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
