:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #1b2733;
  --muted: #647383;
  --line: #dde3ea;
  --primary: #1f5fd6;
  --primary-dark: #174bb0;
  --primary-soft: #e3edff;
  --pos: #0f7a45;
  --neg: #c1281f;
  --income-band: #d9f0e3;
  --income-cat: #eef8f2;
  --expense-band: #dfe6f1;
  --expense-cat: #f1f4f9;
  --s: 1;
  --w-name: calc(280px * var(--s));
  --w-year: calc(112px * var(--s));
  --hdr-h: calc(46px * var(--s));
  --row-h: calc(42px * var(--s));
}
html[data-size="l"] { --s: 1.18; }
html[data-size="xl"] { --s: 1.4; }
html { font-size: calc(16px * var(--s)); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
}
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
h3 { font-size: 1.02rem; margin: 1.2rem 0 .5rem; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: .6rem 1.2rem;
}
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.topnav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; font-size: .95rem; }
.topnav a { text-decoration: none; }
.topnav a:hover { text-decoration: underline; }
.who { color: var(--muted); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; }
.linklike:hover { text-decoration: underline; }

.flash { margin: .8rem 1.2rem 0; padding: .7rem 1rem; border-radius: 10px; font-size: .97rem; }
.flash-ok { background: #e2f5ea; color: #0d5c34; }
.flash-error { background: #fde9e7; color: #9d1f17; }

/* ---------- knapper og felter ---------- */
.btn {
  font: inherit; font-size: .97rem; line-height: 1.2;
  padding: .6rem 1rem; min-height: var(--row-h);
  border: 1px solid #c3ccd6; background: #fff; color: var(--ink);
  border-radius: 9px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  white-space: nowrap;
}
.btn:hover { background: #f0f3f7; }
.btn:focus-visible, .icon-btn:focus-visible, .linklike:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #86adff; outline-offset: 1px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger-outline { color: var(--neg); border-color: #e3b1ad; }
.btn-danger-outline:hover { background: #fdeceb; }
.btn-danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn-danger:hover { background: #a21f18; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }

input[type=text], input[type=password], input[type=number], select {
  font: inherit; padding: .6rem .75rem; min-height: var(--row-h);
  border: 1px solid #b9c3ce; border-radius: 9px; background: #fff; color: var(--ink);
  max-width: 100%;
}
input:focus, select:focus { border-color: var(--primary); }
label { display: block; font-weight: 600; margin: .8rem 0 .3rem; }
label.check, label.radio { font-weight: 400; display: flex; align-items: center; gap: .55rem; margin: .5rem 0; cursor: pointer; }
label.check input, label.radio input[type=radio] { width: 20px; height: 20px; flex: none; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row > input[type=text] { flex: 1 1 200px; }

.icon-btn {
  font: inherit; font-size: .85rem; background: none; border: 1px solid transparent; color: var(--muted);
  padding: .25rem .5rem; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.3rem; margin-bottom: 1.1rem; box-shadow: 0 1px 2px rgba(20,40,60,.04); }
.error { background: #fde9e7; color: #9d1f17; padding: .7rem .95rem; border-radius: 9px; margin: 0 0 1rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: #e5eaf0; color: #43535f; vertical-align: middle; }

/* ---------- sider ---------- */
.page { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }
.page.narrow { max-width: 520px; }
.form-stack input { width: 100%; }
.form-stack .btn { margin-top: 1.1rem; }
.form-grid { display: grid; gap: .2rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: end; }
.form-grid .check, .form-grid > div:last-child { grid-column: 1 / -1; }
.table-scroll { overflow-x: auto; }
table.plain { border-collapse: collapse; width: 100%; }
table.plain th, table.plain td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.plain th { font-size: .85rem; color: var(--muted); }

.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth-box { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 6px 30px rgba(20,40,60,.1); }
.auth-box h1 { margin-bottom: .2rem; }
.auth-box .lead { color: var(--muted); margin-top: 0; }
.auth-box input[type=text], .auth-box input[type=password] { width: 100%; }
.auth-box .btn { margin-top: .8rem; }

.new-budget label { margin-top: 0; }
.empty { background: #fff; border: 2px dashed var(--line); border-radius: 14px; padding: 1.5rem; text-align: center; color: var(--muted); }
.budget-list { list-style: none; margin: 0; padding: 0; }
.budget-card { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.budget-open { flex: 1 1 260px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .15rem; }
.budget-name { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.budget-open:hover .budget-name { text-decoration: underline; }
.budget-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- budgetsiden ---------- */
body.page-budget { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.toolbar {
  display: flex; align-items: center; gap: .8rem 1.4rem; flex-wrap: wrap;
  padding: .6rem 1.2rem; background: #fff; border-bottom: 1px solid var(--line);
}
.toolbar .back { text-decoration: none; font-size: .95rem; white-space: nowrap; }
.toolbar .title { font-size: 1.35rem; margin: 0; display: flex; align-items: center; gap: .3rem; }
.yearnav { display: flex; align-items: center; gap: .4rem; }
.yearnav .yr { font-size: 1.25rem; padding: .3rem .85rem; font-weight: 700; }
.year { font-size: 1.5rem; font-weight: 700; min-width: 4.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.tools { margin-left: auto; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.status { font-size: .88rem; color: var(--muted); min-width: 11ch; text-align: right; }

.hint {
  margin: .7rem 1.2rem 0; padding: .8rem 1rem; background: #fff8e0; border: 1px solid #f0dc8f; border-radius: 10px;
  display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between;
}
.hint p { margin: 0 0 .3rem; }
.hint ol { margin: .2rem 0 0; padding-left: 1.3rem; }

.grid-wrap {
  flex: 1; min-height: 0; overflow: auto; margin: .7rem 1.2rem 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  scroll-padding-left: calc(var(--w-name) + var(--w-year) + 8px); scroll-padding-top: calc(var(--hdr-h) * 3 + 4px);
}
.loading { padding: 2rem; color: var(--muted); }

table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; min-width: calc(var(--w-name) + var(--w-year) + 12 * 84px * var(--s)); }
col.col-name { width: var(--w-name); }
col.col-year { width: var(--w-year); }

table.grid th, table.grid td {
  height: var(--row-h); padding: 0; border-bottom: 1px solid var(--line); border-right: 1px solid #edf0f4;
  background: var(--card); font-weight: 400; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
table.grid .num { text-align: right; padding: 0 10px; font-variant-numeric: tabular-nums; }

/* sticky: hoved-rækker */
table.grid thead th { position: sticky; z-index: 5; background: #fff; }
table.grid .hdr th { top: 0; height: var(--hdr-h); font-weight: 700; text-align: right; padding: 0 10px; border-bottom: 2px solid #c9d2dc; }
table.grid .hdr th.c-name, table.grid .result th.c-name { text-align: left; padding-left: 12px; }
table.grid .hdr th.cur { background: var(--primary-soft); color: var(--primary-dark); }
table.grid .saldo th, table.grid .saldo td { top: var(--hdr-h); height: var(--hdr-h); font-weight: 700; font-size: 1.02rem; border-bottom: 1px solid var(--line); background: #eaf1fd; }
table.grid .saldo td { position: sticky; z-index: 5; }
table.grid .saldo .namecell { padding-left: 8px; }
.rowlabel { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
table.grid .result th, table.grid .result td { top: calc(var(--hdr-h) * 2); height: var(--hdr-h); font-weight: 700; font-size: 1.02rem; border-bottom: 2px solid #c9d2dc; background: #f9fafc; }
table.grid .result td { position: sticky; z-index: 5; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.zero { color: var(--muted); }

/* sticky: kolonner */
table.grid .c-name { position: sticky; left: 0; z-index: 3; }
table.grid .c-year { position: sticky; left: var(--w-name); z-index: 3; font-weight: 600; border-right: 2px solid #c9d2dc; }
table.grid thead .c-name, table.grid thead .c-year { z-index: 7; }

/* sektioner (Indtægter / Udgifter) */
table.grid tr.section > * { height: calc(48px * var(--s)); font-weight: 700; font-size: 1.02rem; border-top: 2px solid #c9d2dc; }
table.grid tr.section.income > * { background: var(--income-band); }
table.grid tr.section.expense > * { background: var(--expense-band); }
table.grid tr.section .c-name { font-size: 1.1rem; letter-spacing: .01em; padding: 0 12px; }
table.grid tr.section.income .c-name { color: #0d5c34; }
table.grid tr.section.expense .c-name { color: #24406f; }

/* kategorier */
table.grid tr.cat > * { font-weight: 600; }
table.grid tr.cat.income > * { background: var(--income-cat); }
table.grid tr.cat.expense > * { background: var(--expense-cat); }
.namecell { display: flex; align-items: center; gap: .15rem; height: 100%; padding: 0 6px 0 4px; min-width: 0; }
.chev { font: inherit; width: 34px; height: 34px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--muted); flex: none; }
.chev:hover { background: rgba(0,0,0,.07); color: var(--ink); }
.cat-title { font: inherit; font-weight: 600; background: none; border: 0; padding: .3rem .25rem; cursor: pointer; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; flex: 0 1 auto; }
.namecell .icon-btn { margin-left: auto; flex: none; }

/* poster */
table.grid tr.item .c-name { padding: 0; }
.item-name {
  font: inherit; flex: 1; min-width: 0; height: calc(var(--row-h) - 1px); display: flex; align-items: center; gap: .4rem;
  border: 0; background: none; padding: 0 8px 0 4px; cursor: pointer; text-align: left; color: inherit;
}
.item-name .txt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.item-name .pen { margin-left: auto; opacity: .35; font-size: .85rem; flex: none; }
.item-name:hover { background: #f0f5ff; }
.item-name:hover .pen { opacity: 1; color: var(--primary); }
table.grid td.cell { cursor: cell; user-select: none; -webkit-user-select: none; position: relative; }
table.grid td.cell:hover { background: #f0f5ff; }
table.grid td.cell.sel { background: #d8e6ff; }
table.grid td.cell.focus { background: #fff; box-shadow: inset 0 0 0 2px var(--primary); }
table.grid td.cell.sel.focus { background: #c8dcff; }
table.grid td.cell.editing { padding: 0; }
.cell-input {
  width: 100%; height: 100%; border: 0; margin: 0; padding: 0 10px; text-align: right; font: inherit;
  background: #fff; box-shadow: inset 0 0 0 2px var(--primary); border-radius: 0; outline: none;
  font-variant-numeric: tabular-nums;
}
table.grid td.cur, table.grid .cur-col { background-image: linear-gradient(rgba(31,95,214,.05), rgba(31,95,214,.05)); }

/* tilføj-rækker */
table.grid tr.add .c-name { padding-left: 46px; }
table.grid tr.add td, table.grid tr.add th { height: calc(40px * var(--s)); }
.link-btn { font: inherit; font-size: .93rem; background: none; border: 0; color: var(--primary); cursor: pointer; padding: .35rem .3rem; border-radius: 7px; }
.link-btn:hover { background: var(--primary-soft); }
table.grid tr.addcat th, table.grid tr.addcat td { height: calc(56px * var(--s)); border-bottom: 0; }
table.grid tr.addcat .c-name { padding: 0 12px; }
table.grid tr.spacer > * { height: 14px; background: #f3f5f8; border-bottom: 0; }

/* valgt-bjælke */
.selbar {
  display: flex; align-items: center; gap: .6rem 1rem; flex-wrap: wrap;
  margin: .6rem 1.2rem 1rem; padding: .7rem 1rem; background: #fff; border: 2px solid var(--primary); border-radius: 12px;
  box-shadow: 0 4px 18px rgba(31,95,214,.18);
}
.selbar .info { font-weight: 600; }
.selbar .info small { font-weight: 400; color: var(--muted); }
.selbar .amount { display: flex; align-items: center; gap: .5rem; }
.selbar .amount input { width: 9.5rem; text-align: right; }
.selbar .grow { flex: 1; }
body.page-budget .tipline { margin: .5rem 1.4rem 1rem; }

/* ---------- dialoger ---------- */
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgba(10,20,40,.35); color: var(--ink); }
dialog.modal::backdrop { background: rgba(20,30,45,.5); }
.modal-body { padding: 1.4rem 1.5rem; overflow: auto; max-height: calc(100dvh - 24px); }
.modal-body h2 { font-size: 1.3rem; margin-bottom: .4rem; }
.modal-body label:first-of-type { margin-top: .4rem; }
.modal-body input[type=text], .modal-body input[type=number]:not(.w-year):not(.w-count) { width: 100%; }
.modal .actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1.4rem; }
.modal .actions .spacer { flex: 1; }
.w-year { width: 6.5rem; }
.w-count { width: 5.5rem; }
fieldset { border: 0; margin: .8rem 0 0; padding: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: .2rem; }
.preview { background: var(--primary-soft); color: #14367f; padding: .7rem .9rem; border-radius: 9px; margin: 1rem 0 0; min-height: 2.6rem; font-weight: 600; }
.sub { color: var(--muted); font-size: .93rem; margin: .1rem 0 .6rem; }
.rules { list-style: none; margin: .3rem 0; padding: 0; }
.rules li { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; background: #f4f6f9; border-radius: 9px; margin-bottom: .4rem; }
.rules li span { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chip { font: inherit; font-size: .9rem; padding: .35rem .75rem; border-radius: 99px; border: 1px solid #c3ccd6; background: #fff; cursor: pointer; }
.chip:hover { background: var(--primary-soft); border-color: var(--primary); }
.toast {
  position: fixed; left: 50%; top: .7rem; transform: translateX(-50%); z-index: 1000; pointer-events: none;
  background: #1b2733; color: #fff; padding: .75rem 1.2rem; border-radius: 10px; max-width: calc(100vw - 2rem); box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.toast.error { background: #a21f18; }

/* ---------- små skærme ---------- */
@media (max-width: 760px) {
  :root { --w-name: calc(150px * var(--s)); --w-year: calc(96px * var(--s)); }
  .topbar, .toolbar { padding-left: .8rem; padding-right: .8rem; }
  .grid-wrap, .selbar, .hint { margin-left: .5rem; margin-right: .5rem; }
  table.grid { min-width: calc(var(--w-name) + var(--w-year) + 12 * 84px * var(--s)); }
  table.grid .c-year { position: static; }
  .drag { display: none; }
  table.grid tr.add .c-name { padding-left: 14px; }
  .namecell .icon-btn { padding: .25rem .3rem; }
  .icon-btn .lbl, .tools .btn .lbl, .topnav .lbl { display: none; }
  .tools { margin-left: 0; }
  .grid-wrap { scroll-padding-left: calc(var(--w-name) + 8px); }
  /* kompakt topområde så skemaet får plads */
  .topbar { padding-top: .4rem; padding-bottom: .4rem; gap: .5rem; }
  .topnav { gap: .8rem; font-size: .88rem; }
  .who, .toolbar .back, #printBtn { display: none; }
  .toolbar { padding-top: .4rem; padding-bottom: .4rem; gap: .4rem .9rem; }
  .toolbar .title { font-size: 1.1rem; }
  .yearnav .yr { padding: .2rem .7rem; }
  .year { font-size: 1.3rem; }
  .status { min-width: 0; text-align: left; }
  .hint { padding: .5rem .7rem; font-size: .9rem; margin-top: .5rem; }
  .grid-wrap { margin-top: .5rem; }
}

/* ---------- udskrift ---------- */
@media print {
  body { background: #fff; }
  .topbar, .flash, .hint, .selbar, .tools, .yearnav .yr, #thisYear, .icon-btn, .link-btn, .chev, tr.add, tr.addcat, .back { display: none !important; }
  body.page-budget { height: auto; overflow: visible; display: block; }
  .grid-wrap { overflow: visible; border: 0; margin: 0; }
  table.grid { min-width: 0; font-size: 10px; }
  table.grid th, table.grid td { height: 22px; }
  table.grid .c-name, table.grid .c-year, table.grid thead th { position: static; }
  .item-name { padding-left: 16px; height: 22px; }
  @page { size: A4 landscape; margin: 10mm; }
}

/* ---------- visningsvælger, fortryd, "Mere"-menu ---------- */
.seg { display: inline-flex; border: 1px solid #c3ccd6; border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { font: inherit; font-size: .95rem; padding: .5rem .95rem; min-height: var(--row-h); border: 0; border-left: 1px solid #c3ccd6; background: #fff; color: var(--ink); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: #f0f3f7; }
.seg button[aria-pressed="true"] { background: var(--primary); color: #fff; font-weight: 600; }
.btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.btn[disabled] { opacity: .45; }
.more { position: relative; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(20,40,60,.2); padding: .4rem; min-width: 15rem; display: flex; flex-direction: column; gap: .2rem;
}
.more-menu .btn { border: 0; justify-content: flex-start; width: 100%; }
.mode-note { background: #eef4ff; border-color: #c5d6f7; }
.lbl { }

/* ---------- advarsel og grafer ---------- */
.warn {
  margin: .7rem 1.2rem 0; padding: .6rem 1rem; background: #fdeceb; border: 1px solid #e3b1ad; color: #8f1d16;
  border-radius: 10px; display: flex; gap: 1rem; align-items: center; justify-content: space-between; font-weight: 600;
}
tr.saldo td.flash { animation: flashcell 1.8s ease; }
@keyframes flashcell { 0%, 70% { box-shadow: inset 0 0 0 3px #d03b3b; } 100% { box-shadow: inset 0 0 0 0 transparent; } }
.charts { margin: .7rem 1.2rem 0; display: grid; grid-template-columns: 1.4fr 1fr; gap: .8rem; max-height: 44vh; max-height: 44dvh; overflow-y: auto; }
.chart-card { background: #fcfcfb; border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem .8rem; min-width: 0; }
.chart-title { font-size: 1rem; margin: 0 0 .1rem; font-weight: 600; color: #0b0b0b; }
.chart-sub { margin: 0 0 .4rem; font-size: .85rem; color: #52514e; }
.chart-line { margin-top: .5rem; }
.chart-line svg { display: block; max-width: 100%; }
.chart-line svg:focus-visible { outline: 3px solid #86adff; outline-offset: 2px; border-radius: 6px; }
.chart-empty { color: #52514e; margin: .6rem 0; }
.bars { display: flex; flex-direction: column; }
.brow { display: grid; grid-template-columns: minmax(70px, 34%) 1fr; align-items: center; height: 1.9rem; border-radius: 6px; }
.brow:hover, .brow:focus-visible { background: #f2f5fa; outline: none; }
.bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #52514e; font-size: .9rem; padding-right: .6rem; }
.bt { position: relative; height: 100%; }
.bar { position: absolute; left: 0; top: 50%; height: 16px; margin-top: -8px; background: #2a78d6; border-radius: 0 4px 4px 0; min-width: 2px; }
.brow:hover .bar, .brow:focus-visible .bar { background: #3987e5; }
.bv { position: absolute; top: 50%; transform: translateY(-50%); font-size: .88rem; color: #0b0b0b; font-variant-numeric: tabular-nums; white-space: nowrap; }
.viz-tip { position: fixed; z-index: 2000; pointer-events: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .65rem; box-shadow: 0 4px 14px rgba(0,0,0,.16); font-size: .85rem; max-width: 20rem; }
.viz-tip .tt { color: #52514e; margin-bottom: .15rem; }
.viz-tip .tr { display: flex; align-items: center; }
.viz-tip .tk { display: inline-block; width: 14px; border-top: 2px solid #2a78d6; margin-right: .45rem; }
.viz-tip .tl { color: #52514e; margin-left: .4rem; }

/* ---------- poster: træk, note, flyt ---------- */
table.grid tr.item .c-name { padding: 0; }
.itemrow { display: flex; align-items: center; height: 100%; }
.drag { width: 2.1rem; flex: none; text-align: center; cursor: grab; color: var(--muted); opacity: .55; user-select: none; letter-spacing: -2px; font-size: .95rem; }
.drag:hover { opacity: 1; color: var(--primary); }
.drag:active { cursor: grabbing; }
.noteic { font-size: .8rem; flex: none; }
tr.dragging > * { opacity: .45; }
tr.drop-before > * { box-shadow: inset 0 3px 0 var(--primary); }
tr.drop-after > * { box-shadow: inset 0 -3px 0 var(--primary); }
tr.drop-into > * { background: var(--primary-soft) !important; }
table.grid.mode-actual td.cell { background: #fffaf0; }
table.grid.mode-actual td.cell:hover { background: #fff3d6; }
table.grid.mode-actual td.cell.sel { background: #d8e6ff; }
table.grid td.dcell { font-weight: 500; }
textarea { font: inherit; padding: .6rem .75rem; border: 1px solid #b9c3ce; border-radius: 9px; background: #fff; color: var(--ink); width: 100%; resize: vertical; }
textarea:focus { border-color: var(--primary); outline: 3px solid #86adff; outline-offset: 1px; }
.linklike .lbl { }

@media (max-width: 900px) {
  .charts { grid-template-columns: 1fr; }
}
/* små skærme: siden scroller normalt (topområde og grafer kan scrolles væk), skemaet har sin egen faste højde */
@media (max-width: 760px) {
  body.page-budget { height: auto; min-height: 100dvh; overflow: visible; display: block; padding-bottom: 5.5rem; }
  .grid-wrap { height: 78dvh; flex: none; }
  .charts { max-height: none; overflow: visible; }
  .selbar { position: sticky; bottom: .5rem; z-index: 40; }
}
@media print {
  .warn, .charts, .seg, .more, #undoBtn, #redoBtn, #chartsBtn, .drag { display: none !important; }
}
