/* Bolagsinblick – Mitt konto. Tokens copied from web/static/style.css (v2); keep them in step.
   Idea: an annual report, read through a lens. Paper-white pages, ink-navy type,
   a serif for headlines (like a printed report), a precise sans for everything else,
   and tabular figures wherever there are numbers. One accent colour, used for actions. */

@font-face {
  font-family: "Newsreader";
  src: url("/billing/assets/fonts/newsreader.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/billing/assets/fonts/geist.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/billing/assets/fonts/geist-mono.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --paper-2: #f4f6f9;
  --ink: #0f1e33;
  --ink-2: #44526a;
  --ink-3: #6b778c;
  --rule: #dfe4ec;
  --rule-strong: #c5cdd9;
  --accent: #2148c9;
  --accent-ink: #ffffff;
  --accent-hover: #1a3aa6;
  --accent-wash: #eef2fd;
  --pos: #0d7a4f;
  --neg: #b42318;
  --code-bg: #0f1e33;
  --code-ink: #dbe3ef;
  --code-dim: #8693a8;
  --code-key: #9cc0ff;
  --code-str: #b9e4c4;
  --code-num: #f3d08a;
  --focus: #2148c9;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 30, 51, 0.06), 0 12px 32px -12px rgba(15, 30, 51, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1726;
    --paper-2: #121f33;
    --ink: #e8edf5;
    --ink-2: #b3bfd1;
    --ink-3: #8794a9;
    --rule: #22324a;
    --rule-strong: #30425e;
    --accent: #7d9cff;
    --accent-ink: #0d1726;
    --accent-hover: #9db4ff;
    --accent-wash: #17264a;
    --pos: #4cc48f;
    --neg: #ff8a7e;
    --code-bg: #08111e;
    --focus: #9db4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  }
}


* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper-2); color: var(--ink); font: 400 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.015em; }
h3 { font-size: 0.98rem; font-weight: 600; }
code { font-family: var(--mono); font-size: 0.86em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 0.86rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h3.subhead { padding: 18px 24px 6px; font-size: 0.9rem; color: var(--ink-2); border-top: 1px solid var(--rule); }
.card > header + .body { padding-top: 8px; padding-bottom: 14px; }
.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 12px; background: var(--paper); padding: 8px 12px; z-index: 50; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.04rem; letter-spacing: -0.01em; }
.logo svg { width: 26px; height: 26px; flex: none; }
.logo .lens { fill: none; stroke: var(--ink); stroke-width: 2.4; }
.logo .line { fill: var(--ink); }
.logo .line-accent { fill: var(--accent); }
.logo small { font-weight: 400; color: var(--ink-3); font-size: 0.9rem; padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--rule-strong); }
.who { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--ink-2); min-width: 0; }
.who .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }

/* Test-mode ribbon */
.testmode { background: #fff4d6; color: #5a4300; font-size: 0.85rem; text-align: center; padding: 7px 16px; border-bottom: 1px solid #f0dca6; }
@media (prefers-color-scheme: dark) { .testmode { background: #3a2f0b; color: #f3d08a; border-color: #5a4a14; } }

/* Layout: a contents rail like a report's table of contents, cards on the right */
.layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; padding-top: 40px; padding-bottom: 72px; align-items: start; }
.rail { position: sticky; top: 96px; }
.rail ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); counter-reset: s; }
.rail li { counter-increment: s; border-bottom: 1px solid var(--rule); }
.rail ol a { display: flex; gap: 12px; padding: 10px 2px; color: var(--ink-2); text-decoration: none; font-size: 0.92rem; }
.rail ol a::before { content: counter(s, decimal-leading-zero); font: 500 0.8rem/1.9 var(--mono); color: var(--ink-3); }
.rail ol a:hover { color: var(--ink); }
.rail .help { margin-top: 20px; font-size: 0.85rem; color: var(--ink-3); }
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: clamp(1.9rem, 3.2vw, 2.5rem); line-height: 1.1; }
.page-head p { margin-top: 8px; color: var(--ink-2); }
.cards { display: grid; gap: 20px; min-width: 0; }

.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-lg); min-width: 0; }
.card > header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 22px 24px 0; flex-wrap: wrap; }
.card > header h2 { font-size: 1.45rem; line-height: 1.2; }
.card > header .aside { font-size: 0.86rem; color: var(--ink-3); }
.card .body { padding: 18px 24px 24px; }
.card .foot { padding: 14px 24px; border-top: 1px solid var(--rule); background: var(--paper-2); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: 0.88rem; color: var(--ink-2); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-sm); font: 500 0.92rem/1 var(--sans); text-decoration: none; border: 1px solid transparent; cursor: pointer; white-space: nowrap; background: none; color: var(--ink); transition: background-color .15s ease, border-color .15s ease, color .15s ease; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-quiet { background: var(--paper); border-color: var(--rule-strong); }
.btn-quiet:hover { border-color: var(--ink-3); }
.btn-danger { background: var(--paper); border-color: color-mix(in srgb, var(--neg) 45%, var(--rule)); color: var(--neg); }
.btn-danger:hover { border-color: var(--neg); }
.btn-link { padding: 0; min-height: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.86rem; }
.btn svg { width: 16px; height: 16px; }
form.inline { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Overview figures: set like the key figures of a report */
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.figure { padding: 18px 24px 22px; }
.figure + .figure { border-left: 1px solid var(--rule); }
.figure .label { font-size: 0.82rem; color: var(--ink-3); }
.figure .value { font: 500 1.9rem/1.15 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.figure .sub { font-size: 0.85rem; color: var(--ink-2); margin-top: 2px; }
.meter { margin: 6px 24px 22px; }
.meter .bar { height: 10px; border-radius: 99px; background: var(--paper-2); border: 1px solid var(--rule); overflow: hidden; }
.meter .bar svg { display: block; width: 100%; height: 100%; }
.meter .bar rect { fill: var(--accent); }
.meter.warn .bar rect { fill: #c77700; }
.meter.full .bar rect { fill: var(--neg); }
.meter .legend { display: flex; justify-content: space-between; gap: 12px; font-size: 0.84rem; color: var(--ink-3); margin-top: 8px; font-variant-numeric: tabular-nums; }
.notice { margin: 0 24px 20px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-wash); color: var(--ink); font-size: 0.9rem; border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.notice.bad { background: color-mix(in srgb, var(--neg) 9%, var(--paper)); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }
.notice.good { background: color-mix(in srgb, var(--pos) 9%, var(--paper)); border-color: color-mix(in srgb, var(--pos) 35%, transparent); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.ledger { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.ledger th, .ledger td { padding: 12px 24px; border-top: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.ledger thead th { border-top: 0; font-weight: 500; color: var(--ink-3); font-size: 0.8rem; padding-top: 4px; padding-bottom: 8px; white-space: nowrap; }
.ledger td.num { white-space: nowrap; }
.ledger td.r, .ledger th.r { text-align: right; }
.ledger .keyname { font-weight: 600; }
.ledger code { color: var(--ink-2); }
.ledger td .actions { justify-content: flex-end; flex-wrap: nowrap; }
.tag { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--paper-2); border: 1px solid var(--rule); color: var(--ink-2); }
.tag.here { background: var(--accent-wash); border-color: transparent; color: var(--accent); }
.st { font-family: var(--mono); font-size: 0.84rem; font-weight: 600; }
.st.ok { color: var(--pos); } .st.client { color: #b25e00; } .st.server { color: var(--neg); }
@media (prefers-color-scheme: dark) { .st.client { color: #f3b46a; } }

/* New key, shown once */
.reveal { margin: 0 24px 20px; padding: 18px; border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--pos) 40%, transparent); background: color-mix(in srgb, var(--pos) 7%, var(--paper)); }
.reveal h3 { margin-bottom: 6px; }
.keybox { display: flex; gap: 8px; align-items: stretch; margin: 12px 0 10px; }
.keybox code { flex: 1; min-width: 0; display: block; padding: 11px 12px; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--r-sm); font-size: 0.92rem; word-break: break-all; color: var(--ink); }
pre.code { margin: 10px 0 0; padding: 14px 16px; background: var(--code-bg); color: var(--code-ink); border-radius: var(--r-sm); font-size: 0.8rem; line-height: 1.6; overflow-x: auto; }

/* Forms */
label { display: block; font-size: 0.86rem; font-weight: 500; margin-bottom: 6px; }
input[type=text], input[type=email] { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: inherit; }
input[type=text]:focus, input[type=email]:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.newkey { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 16px 24px 20px; border-top: 1px solid var(--rule); }
.newkey > div { flex: 1 1 220px; }

/* Usage chart */
.chart { padding: 6px 24px 4px; }
.chart svg { display: block; width: 100%; height: 160px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .b { fill: var(--accent); }
.chart .e { fill: var(--neg); }
.chart .axis-top { margin-bottom: 4px; }
.chart .axis-x { display: flex; justify-content: space-between; margin-top: 6px; }
.chart-legend { display: flex; gap: 18px; padding: 4px 24px 18px; font-size: 0.82rem; color: var(--ink-3); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--accent); }
.chart-legend i.e { background: var(--neg); }
.empty { padding: 8px 24px 24px; color: var(--ink-3); font-size: 0.9rem; }

/* Plans side by side, the current one marked */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 4px 24px 20px; }
.plan { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-wash); }
.plan .name { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.plan .price { font: 500 1.6rem/1.1 var(--serif); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan .price small { font: 400 0.8rem var(--sans); color: var(--ink-3); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 4px 0 10px; font-size: 0.86rem; color: var(--ink-2); display: grid; gap: 2px; }
.plan form, .plan .btn { margin-top: auto; }
.plan .btn { width: 100%; }
.billing-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 24px 20px; }
.billing-actions > div { border: 1px solid var(--rule); border-radius: var(--r-md); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.billing-actions p { font-size: 0.88rem; color: var(--ink-2); }
.billing-actions .btn { align-self: flex-start; margin-top: auto; }
.billing-actions form input + .btn { margin-top: 10px; }

/* Sign-in and simple pages */
.narrow { max-width: 480px; margin: 0 auto; padding: 64px 24px 80px; }
.narrow .card .body { padding: 28px; }
.narrow h1 { font-size: 2rem; line-height: 1.15; margin-bottom: 10px; }
.narrow p + p, .narrow p + form, .narrow form + p { margin-top: 14px; }
.narrow form .btn { margin-top: 14px; width: 100%; }

.site-foot { border-top: 1px solid var(--rule); background: var(--paper); font-size: 0.86rem; color: var(--ink-3); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 22px; padding-bottom: 22px; }
.site-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-foot a { color: var(--ink-2); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .rail { position: static; }
  .rail ol { display: flex; overflow-x: auto; border-top: 0; border-bottom: 1px solid var(--rule); gap: 4px; }
  .rail li { border: 0; flex: none; }
  .rail a { padding: 8px 10px 10px 0; }
  .rail .help { display: none; }
  .plans { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .figures { grid-template-columns: minmax(0, 1fr); }
  .figure + .figure { border-left: 0; border-top: 1px solid var(--rule); }
  .billing-actions { grid-template-columns: minmax(0, 1fr); }
  .card > header, .card .body, .newkey { padding-left: 16px; padding-right: 16px; }
  .ledger th, .ledger td { padding-left: 16px; padding-right: 16px; }
  h3.subhead { padding-left: 16px; padding-right: 16px; }
  .meter, .notice, .reveal { margin-left: 16px; margin-right: 16px; }
  .chart, .chart-legend, .plans, .billing-actions, .empty { padding-left: 16px; padding-right: 16px; }
  .who .email { display: none; }
  .hide-sm { display: none; }
}
