:root {
  --navy: #0b2237;
  --teal: #0f9d84;
  --teal-dark: #0a7a67;
  --teal-soft: #e3f6f1;
  --bg: #f2f6f7;
  --card: #ffffff;
  --ink: #12222f;
  --muted: #62727e;
  --line: #dce5e8;
  --err: #b3392b;
  --ok: #0a7a67;
  --warn: #a86a00;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: #fff; }
body {
  margin: 0; background: var(--bg); color: var(--ink); min-height: 100vh; min-height: 100dvh;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--teal-dark); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; color: var(--navy); }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; color: var(--navy); }
small, .muted { color: var(--muted); }

/* ---- Topplinje ---- */
.top {
  display: flex; align-items: center; gap: .5rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line);
  padding: .5rem max(16px, env(safe-area-inset-right)) .5rem max(16px, env(safe-area-inset-left));
  padding-top: calc(.5rem + env(safe-area-inset-top, 0px));
  position: sticky; top: 0; z-index: 100;
}
.brand { display: block; flex: none; line-height: 0; }
.brand img { height: 46px; width: auto; }
.tabs { display: flex; gap: .2rem; align-items: center; margin-right: auto; }
.tabs a {
  display: flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: 999px;
  color: var(--muted); font-weight: 600; font-size: .95rem; text-decoration: none; transition: background .15s, color .15s;
}
.tabs a:hover { background: var(--teal-soft); color: var(--navy); }
.tabs a.active { background: var(--navy); color: #fff; }
.ico { width: 1.3rem; height: 1.3rem; flex: none; }
.userbar { display: flex; align-items: center; gap: .1rem; margin-left: auto; }
.userbar form { margin: 0; }
.iconbtn {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: none; border: 0;
  padding: 0; cursor: pointer; color: var(--muted); text-decoration: none; transition: background .15s;
}
.iconbtn:hover, .iconbtn.active { background: var(--teal-soft); color: var(--navy); }
.tabs + .userbar { margin-left: 0; }

main { max-width: 980px; margin: 0 auto; padding: 1.25rem 16px 3rem; }

/* ---- Kort, skjema, knapper ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 420px; margin: 2rem auto; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .8rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .7rem; font: inherit; color: inherit;
  background: #fff; border: 1px solid #c3d0d5; border-radius: 8px;
}
input[type=checkbox] { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.btn {
  display: inline-block; padding: .55rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  border-radius: 8px; border: 1px solid #c3d0d5; background: #fff; color: var(--navy);
}
.btn:hover { background: var(--teal-soft); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.danger { color: var(--err); border-color: #e3b9b3; }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--err); cursor: pointer; font: inherit; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok  { background: var(--teal-soft); border-color: #a9dfd2; color: #064d41; }
.flash.err { background: #fbe9e6; border-color: #efbab3; color: #7e2218; }
.flash.warn { background: #fff4de; border-color: #f0d49a; color: #6b4300; }

/* ---- Tabeller ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.pos { color: var(--ok); } .neg { color: var(--err); }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); }
.badge.sent { background: #e6ebf0; color: #3a4b59; }
.badge.open { background: #fff4de; color: var(--warn); }
.tablewrap { overflow-x: auto; }

/* ---- Oversikt ---- */
.hero { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.balance { background: var(--navy); color: #fff; border-color: var(--navy); }
.balance .label { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: #9ec9c0; }
.balance .value { font-size: 3rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.balance .value small { font-size: 1.1rem; color: #9ec9c0; font-weight: 600; }
.balance.neg-balance .value { color: #ffb4a8; }
.stamp .status { font-size: 1.05rem; margin-bottom: .75rem; }
.stamp .btn { width: 100%; padding: .9rem; font-size: 1.15rem; }
.stats { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.stats div { min-width: 90px; }
.stats b { display: block; font-size: 1.4rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.monthnav { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.monthnav h1 { margin: 0; flex: 1; text-transform: capitalize; }
.subtabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.subtabs a { padding: .35rem .9rem; border-radius: 999px; text-decoration: none; font-weight: 600; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.subtabs a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.empty { color: var(--muted); padding: .5rem 0; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .brand img { height: 38px; }
  /* Hovedmeny som fanelinje nederst */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; background: #fff; border-top: 1px solid var(--line);
    justify-content: space-around; gap: 0; padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom, 0px)); margin: 0;
  }
  .tabs a { flex-direction: column; gap: .1rem; padding: .3rem .4rem; font-size: .68rem; border-radius: 10px; flex: 1; justify-content: center; }
  .tabs a.active { background: var(--teal-soft); color: var(--navy); }
  .userbar { margin-left: auto; }
  main { padding-bottom: 6rem; }
  .balance .value { font-size: 2.6rem; }
}

/* Logoene er beskjært fra et bildeark og har svak bakgrunn – la den smelte inn i hvit flate */
.brand img, .card.narrow img { mix-blend-mode: multiply; }
