/* Pengeflyt – styles.
   All colors are tokens (custom properties) defined once here and swapped for dark mode.
   Chart colors were checked for contrast and color-blind safety. */

:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --surface-3: #e6e5e0;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #898781;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.2);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #256abf;
  --accent-hover: #1c5cab;
  --accent-text: #256abf;
  --accent-soft: rgba(42, 120, 214, 0.1);
  --on-accent: #ffffff;
  --income: #2a78d6;
  --expense: #eb6834;
  --meter-ok: #2a78d6;
  --series-1: #2a78d6;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --good-text: #006300;
  --critical-text: #b42828;
  --hover-band: rgba(11, 11, 11, 0.045);
  --toast-bg: #1f1f1e;
  --toast-text: #f0efec;
  --toast-action: #8cbcf5;
  --backdrop: rgba(11, 11, 11, 0.45);
  --shadow-sm: 0 1px 2px rgba(11, 11, 11, 0.04);
  --shadow-lg: 0 16px 40px rgba(11, 11, 11, 0.18), 0 2px 8px rgba(11, 11, 11, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242423;
    --surface-3: #2f2f2d;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --text-3: #898781;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);
    --grid: #2c2c2a;
    --axis: #383835;
    --accent-hover: #2a78d6;
    --accent-text: #6da7ec;
    --accent-soft: rgba(57, 135, 229, 0.16);
    --income: #3987e5;
    --expense: #d95926;
    --meter-ok: #3987e5;
  --series-1: #3987e5;
    --good-text: #0ca30c;
    --critical-text: #e66767;
    --hover-band: rgba(255, 255, 255, 0.05);
    --toast-bg: #f0efec;
    --toast-text: #0b0b0b;
    --toast-action: #1c5cab;
    --backdrop: rgba(0, 0, 0, 0.6);
    --shadow-sm: none;
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242423;
  --surface-3: #2f2f2d;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #898781;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --grid: #2c2c2a;
  --axis: #383835;
  --accent-hover: #2a78d6;
  --accent-text: #6da7ec;
  --accent-soft: rgba(57, 135, 229, 0.16);
  --income: #3987e5;
  --expense: #d95926;
  --meter-ok: #3987e5;
  --series-1: #3987e5;
  --good-text: #0ca30c;
  --critical-text: #e66767;
  --hover-band: rgba(255, 255, 255, 0.05);
  --toast-bg: #f0efec;
  --toast-text: #0b0b0b;
  --toast-action: #1c5cab;
  --backdrop: rgba(0, 0, 0, 0.6);
  --shadow-sm: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--accent-text);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Without this, classes like .button (display: inline-flex) would show "hidden" elements. */
[hidden] {
  display: none !important;
}

.icon {
  flex: none;
  display: block;
}

[data-icon] {
  display: inline-flex;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.skip-link:focus {
  top: 12px;
  box-shadow: var(--shadow-lg); /* only when visible, or the shadow peeks into the page */
}

.muted {
  color: var(--text-2);
}

.muted-note {
  color: var(--text-2);
  font-size: 14px;
}

kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 12px/1.6 var(--font);
}

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  color: var(--text);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.sidebar-add {
  margin: 0 0 14px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  color: var(--text-2);
  font-size: 13px;
}

.sidebar-foot .icon {
  width: 16px;
  height: 16px;
}

.view {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 32px 56px;
}

.view:focus {
  outline: none;
}

.loading {
  color: var(--text-2);
}

.fab {
  display: none;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stack {
  display: grid;
  gap: 16px;
}

.view > * + * {
  margin-top: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: 16px;
  align-items: start;
}

/* ---------- Cards ---------- */

.card {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-subtitle {
  margin-top: 2px;
  color: var(--text-2);
  font-size: 13px;
}

.link,
.link-button {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.link:hover,
.link-button:hover {
  text-decoration: underline;
}

/* ---------- Buttons & inputs ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.button .icon {
  width: 18px;
  height: 18px;
}

.button-small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button-primary:hover {
  background: var(--accent-hover);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--surface-2);
}

.button-danger {
  background: var(--critical);
  color: #fff;
}

.button-danger:hover {
  background: #b42828;
}

.button-ghost-danger {
  padding: 0 10px;
  background: transparent;
  color: var(--critical-text);
}

.button-ghost-danger:hover {
  background: color-mix(in oklab, var(--critical) 10%, transparent);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.input {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

select.input {
  padding-right: 8px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
}

.segmented label {
  position: relative;
  flex: 1;
}

.segmented input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented span {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.12);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.segmented-wide {
  display: flex;
}

.segmented-wide span {
  padding: 8px 12px;
  font-size: 15px;
}

/* ---------- Month switcher ---------- */

.month-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.month-switcher .icon-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
}

.month-label {
  min-width: 140px;
  padding: 6px 8px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-weight: 600;
  cursor: pointer;
}

.month-label:hover {
  background: var(--surface-2);
}

/* ---------- Overview ---------- */

.hero-label {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
}

.hero-value {
  margin: 4px 0 6px;
  font-size: clamp(40px, 7vw, 56px);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-note {
  color: var(--text-2);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.stat dt {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.stat dd {
  margin: 0;
}

.stat .stat-value {
  margin-top: 2px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-note,
.delta {
  color: var(--text-2);
  font-size: 13px;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.delta.is-good {
  color: var(--good-text);
}

.delta.is-bad {
  color: var(--critical-text);
}

.cat-bars {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cat-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "label value"
    "bar bar";
  gap: 6px 12px;
  margin: 0 -10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}

.cat-bar:hover {
  background: var(--surface-2);
}

.cat-bar-label {
  grid-area: label;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 500;
}

.cat-bar-value {
  grid-area: value;
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}

.cat-bar-value strong {
  font-weight: 600;
}

.cat-bar-share {
  min-width: 3ch;
  color: var(--text-2);
  font-size: 13px;
  text-align: right;
}

.cat-bar-track {
  grid-area: bar;
  height: 8px;
}

.cat-bar-fill {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--expense);
}

.cat-icon {
  font-size: 18px;
  line-height: 1;
}

.cat-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 500;
}

/* Income vs. expenses chart */

.toggle {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-3);
}

.toggle button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.toggle button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.12);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 13px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.swatch-income,
.key-income {
  background: var(--income);
}

.swatch-expense,
.key-expense {
  background: var(--expense);
}

.chart {
  position: relative;
  min-height: 240px;
}

.chart svg {
  display: block;
  overflow: visible;
}

.chart .gridline {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart .baseline {
  stroke: var(--axis);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .x-tick {
  font-size: 12px;
}

.chart .x-tick.is-selected {
  fill: var(--text);
  font-weight: 600;
}

.chart .bar-income {
  fill: var(--income);
}

.chart .bar-expense {
  fill: var(--expense);
}

.chart .band {
  fill: transparent;
}

.chart .band.is-active {
  fill: var(--hover-band);
}

.chart .hit {
  fill: transparent;
  outline: none;
}

.chart .hit:focus-visible {
  stroke: var(--accent);
  stroke-width: 2;
}

.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  min-width: 168px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  pointer-events: none;
}

.tooltip-title {
  margin-bottom: 6px;
  color: var(--text-2);
  font-weight: 600;
}

.tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.tooltip-row strong {
  font-variant-numeric: tabular-nums;
}

.tooltip-row span:last-child {
  color: var(--text-2);
}

.tooltip-key {
  width: 12px;
  height: 2px;
  border-radius: 1px;
}

.tooltip-net {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

.data-table th:first-child {
  text-align: left;
}

.data-table thead th {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.data-table tbody th {
  font-weight: 500;
}

/* Budget meters & status */

.meter {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  background: color-mix(in oklab, var(--meter-color) 18%, var(--surface));
}

.meter-ok {
  --meter-color: var(--meter-ok);
}

.meter-warning {
  --meter-color: var(--warning);
}

.meter-over {
  --meter-color: var(--critical);
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--meter-color);
}

.meter-pace {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--text);
  opacity: 0.6;
}

.status {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.status .icon {
  width: 16px;
  height: 16px;
}

.status-ok .icon {
  color: var(--good);
}

.status-warning .icon {
  color: var(--warning);
}

.status-over .icon {
  color: var(--critical);
}

.watch-list,
.budget-list,
.plain-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.watch-list {
  gap: 18px;
}

.watch-head,
.watch-foot,
.budget-row-head,
.budget-row-figures {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.watch-head {
  margin-bottom: 8px;
}

.watch-figures {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.watch-foot {
  margin-top: 8px;
  font-size: 13px;
}

.all-good {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}

.callout {
  display: grid;
  justify-items: start;
  gap: 12px;
  color: var(--text-2);
}

/* ---------- Transactions ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.search {
  position: relative;
  flex: 1 1 220px;
}

.search .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.search .input {
  width: 100%;
  padding-left: 38px;
}

.list-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  color: var(--text-2);
  font-size: 14px;
}

.list-summary strong {
  color: var(--text);
  font-weight: 600;
}

.tx-card {
  padding: 8px 10px 10px;
}

.day-group + .day-group {
  margin-top: 4px;
}

.day-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 10px 4px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.day-total {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tx-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tx-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
  cursor: pointer;
}

.tx-row:hover {
  background: var(--surface-2);
}

.tx-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 20px;
}

.tx-row:hover .tx-icon {
  background: var(--surface);
}

.tx-main {
  min-width: 0;
}

.tx-title,
.tx-sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-title {
  font-weight: 500;
}

.tx-sub {
  color: var(--text-2);
  font-size: 13px;
}

.tx-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tx-amount.is-income {
  color: var(--good-text);
}

.card > .tx-list {
  margin: -8px -10px;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 36px 16px;
  color: var(--text-2);
  text-align: center;
}

.empty-emoji {
  font-size: 40px;
}

.empty h2 {
  color: var(--text);
  font-size: 18px;
}

.empty .button-row {
  justify-content: center;
  margin-top: 10px;
}

/* ---------- Budgets ---------- */

.budget-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.summary-value {
  margin: 2px 0;
  font-size: 36px;
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.budget-summary .meter {
  height: 12px;
}

.pace-note {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 14px;
}

.budget-list {
  gap: 4px;
}

.budget-row {
  display: grid;
  gap: 8px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--border);
}

.budget-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.budget-row-figures {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.unbudgeted-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.unbudgeted-row:first-child {
  border-top: 0;
}

.callout-card p {
  margin-top: 6px;
  color: var(--text-2);
}

/* ---------- Settings ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 16px;
  margin-top: 14px;
}

.settings-grid .input {
  width: 100%;
}

.settings-text {
  display: flex;
  gap: 10px;
  margin: 8px 0 14px;
  color: var(--text-2);
}

.settings-text .icon {
  margin-top: 2px;
}

.settings-text strong {
  color: var(--text);
}

.danger-zone {
  border-color: color-mix(in oklab, var(--critical) 35%, transparent);
}

.about {
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
}

/* ---------- Welcome ---------- */

.welcome {
  display: grid;
  justify-items: center;
  max-width: 620px;
  margin: 6vh auto 0;
  text-align: center;
}

.welcome h1 {
  margin-top: 16px;
  font-size: clamp(28px, 5vw, 36px);
  letter-spacing: -0.02em;
}

.welcome-lead {
  margin: 10px 0 24px;
  color: var(--text-2);
  font-size: 17px;
}

.welcome .button-row {
  justify-content: center;
}

.welcome-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  width: 100%;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.welcome-points li {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
}

.welcome-points .icon {
  color: var(--accent-text);
}

.welcome-points strong {
  color: var(--text);
}

.file-warning {
  max-width: 560px;
  margin: 10vh auto;
  display: grid;
  gap: 12px;
}

.file-warning pre {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* ---------- Dialogs ---------- */

dialog.sheet {
  width: min(560px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

dialog.sheet-small {
  width: min(440px, calc(100% - 32px));
}

dialog.sheet::backdrop {
  background: var(--backdrop);
}

dialog.sheet[open] {
  animation: sheet-in 0.18s ease-out;
}

dialog.sheet form {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 6px;
}

.sheet-header h2 {
  font-size: 19px;
}

.sheet-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 10px 20px 18px;
  overflow-y: auto;
}

.confirm-body {
  gap: 8px;
  padding-top: 22px;
}

.confirm-body h2 {
  font-size: 19px;
}

.confirm-body p {
  color: var(--text-2);
}

.sheet-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.spacer {
  flex: 1;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 6px;
}

.field > label,
.field > legend {
  padding: 0;
  margin-bottom: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
}

.field > label {
  margin-bottom: 0;
}

.field .input {
  width: 100%;
}

.optional {
  font-weight: 400;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 170px) minmax(0, 1fr);
  gap: 12px;
}

.field-hint {
  color: var(--text-2);
  font-size: 13px;
}

.field-hint .link-button {
  font-size: 13px;
}

.field-error {
  color: var(--critical-text);
  font-size: 13px;
  font-weight: 500;
}

.input[aria-invalid="true"],
.amount-input:has(input[aria-invalid="true"]) {
  border-color: var(--critical);
}

.amount-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
}

.amount-input:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.amount-input input {
  flex: 1;
  width: 0; /* an input's default width (~20 characters at 28px) is wider than a phone */
  min-width: 0;
  height: 56px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.amount-currency {
  color: var(--text-2);
  font-size: 18px;
  font-weight: 500;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}

.category-option {
  position: relative;
}

.category-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.category-option > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 10px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.2;
  text-align: center;
}

.category-emoji {
  font-size: 22px;
}

.category-option:hover > span {
  background: var(--surface-2);
}

.category-option input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.category-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(460px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-radius: 12px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s, transform 0.18s;
}

.toast-action {
  flex: none;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--toast-action);
  font-weight: 700;
  cursor: pointer;
}

.toast-action:hover {
  text-decoration: underline;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---------- Formue ---------- */

.hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
}

.live-live {
  color: var(--good-text);
}

.live-live .live-dot {
  background: var(--good);
  animation: pulse 2s ease-out infinite;
}

.live-error .live-dot {
  background: var(--warning);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.5);
  }
  70%,
  100% {
    box-shadow: 0 0 0 6px rgba(12, 163, 12, 0);
  }
}

/* Et tall blinker kort grønt eller rødt når kursen endrer det. */
.flash-up {
  animation: flash-up 1.2s ease-out;
}

.flash-down {
  animation: flash-down 1.2s ease-out;
}

@keyframes flash-up {
  from {
    color: var(--good-text);
  }
}

@keyframes flash-down {
  from {
    color: var(--critical-text);
  }
}

.gain,
.change {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.gain.is-up,
.change.is-up,
.delta-value.is-up {
  color: var(--good-text);
}

.gain.is-down,
.change.is-down,
.delta-value.is-down {
  color: var(--critical-text);
}

.card-header-wrap {
  flex-wrap: wrap;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.range-toggle {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-3);
}

.range-toggle button {
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.range-toggle button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.12);
}

.chart .line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .area {
  fill: var(--series-1);
  fill-opacity: 0.1;
}

.chart .end-dot,
.chart .crosshair-dot {
  fill: var(--series-1);
  stroke: var(--surface);
  stroke-width: 2;
}

.chart .crosshair {
  display: none;
}

.chart .crosshair.is-visible {
  display: inline;
}

.chart .crosshair-line {
  stroke: var(--axis);
  stroke-width: 1;
}

.chart .hit {
  touch-action: pan-y; /* dra sidelengs over grafen på mobil uten at siden ruller */
}

.key-line {
  background: var(--series-1);
}

.chart-note {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 12px;
}

/* ---------- Oversikt, Bank, Aksjer og fond, Krypto ---------- */

.overview {
  padding: 24px;
}

.overview-label {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
}

.overview-value {
  margin: 6px 0 10px;
  font-size: clamp(44px, 9vw, 72px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.03em;
}

.overview-change,
.wallet-change {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.wallet-change {
  margin-top: 6px;
}

/* Forsiden: én flis per side (Bank, Aksjer og fond, Krypto) med summen */
.section-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.section-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "head arrow"
    "value value"
    "note note";
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s;
}

.section-tile:hover {
  border-color: var(--border-strong);
}

.section-tile-head {
  display: flex;
  grid-area: head;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}

.section-tile-arrow {
  display: flex;
  grid-area: arrow;
  color: var(--text-3);
}

.section-tile-value {
  grid-area: value;
  margin-top: 4px;
  font-size: 26px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.section-tile-note {
  grid-area: note;
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.delta-pill.is-up {
  background: color-mix(in oklab, var(--good) 10%, transparent);
  color: var(--good-text);
}

.delta-pill.is-down {
  background: color-mix(in oklab, var(--critical) 10%, transparent);
  color: var(--critical-text);
}

.history {
  margin-top: 18px;
}

.history-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.history-empty {
  padding: 20px 0;
}

/* Fanene under Bank */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.page-header + .tabs {
  margin-top: -4px;
}

.tab {
  flex: none;
  margin-bottom: -1px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-current="page"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

/* Runde snarveier (Overfør, Sett inn, Kjøp …) */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-top: 18px;
}

.quick-action {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 64px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.quick-action-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  transition: background-color 0.15s;
}

.quick-action:hover .quick-action-icon {
  background: color-mix(in oklab, var(--accent) 24%, transparent);
}

.quick-action:focus-visible {
  outline: none;
}

.quick-action:focus-visible .quick-action-icon {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button-buy {
  background: #0a7f0a;
  color: #fff;
}

.button-buy:hover {
  background: #086a08;
}

.button-sell {
  background: #c13030;
  color: #fff;
}

.button-sell:hover {
  background: #a82828;
}

.portfolio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px 16px;
  margin: 14px 0 0;
}

.portfolio-stats dt {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.portfolio-stats dd {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Lister med kontoer, eiendeler og markeder */
.list-card > .card-title,
.list-card > .card-header {
  margin-bottom: 6px;
}

.account-list,
.asset-list {
  margin: 0 -10px;
  padding: 0;
  list-style: none;
}

.account-list > li + li,
.asset-list > li + li {
  border-top: 1px solid var(--border);
}

.account-row,
.asset-row,
.market-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  color: inherit;
  text-decoration: none;
}

.account-row,
.asset-row {
  border-radius: 12px;
}

.account-row:hover,
.asset-row:hover {
  background: var(--surface-2);
}

.account-main,
.asset-main {
  display: grid;
  flex: 1;
  min-width: 0;
}

.account-name,
.account-sub,
.asset-name,
.asset-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name,
.asset-name {
  font-weight: 500;
}

.account-sub,
.asset-sub {
  color: var(--text-2);
  font-size: 13px;
}

.account-figures,
.asset-figures {
  display: grid;
  justify-items: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.account-figures strong,
.asset-figures strong {
  font-weight: 600;
}

.row-chevron {
  flex: none;
  color: var(--text-3);
}

.coin-icon,
.stock-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.coin-icon {
  border-radius: 50%;
  background: var(--coin);
  color: var(--coin-text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.coin-icon.is-long {
  font-size: 9.5px;
}

.stock-icon {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 10px;
}

.coin-badge {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  height: 26px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Beholdningen av aksjer */
.holdings th,
.holdings td {
  padding-top: 12px;
  padding-bottom: 12px;
  vertical-align: middle;
}

.holdings tbody th[scope="row"] {
  font-weight: 400;
}

.holding-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.holding-link:hover .holding-title {
  text-decoration: underline;
}

.holding-text {
  display: grid;
  min-width: 0;
  text-align: left;
}

.holding-title {
  max-width: 220px;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-meta {
  color: var(--text-2);
  font-size: 12px;
}

.holding-value {
  display: block;
  font-weight: 600;
}

.mobile-only,
.nav-short {
  display: none;
}

.fund-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.fund-row:first-child {
  padding-top: 4px;
  border-top: 0;
}

.fund-main {
  display: grid;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.fund-main:hover .account-name {
  text-decoration: underline;
}

.holdings-table th[scope="row"] {
  white-space: nowrap;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.back-link + .page-header {
  margin-top: 12px;
}

.account-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.account-title h1 {
  overflow-wrap: anywhere;
}

.account-type-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  font-size: 26px;
}

.hero-actions {
  margin-top: 18px;
}

.movement-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.movement-item .tx-row {
  flex: 1;
  min-width: 0;
}

.tx-row.is-static {
  cursor: default;
}

.tx-row.is-static:hover {
  background: none;
}

a.tx-row {
  color: inherit;
  text-decoration: none;
}

.tx-figures {
  display: grid;
  justify-items: end;
  text-align: right;
}

.movement-delete {
  flex: none;
  color: var(--text-3);
}

.movement-delete:hover {
  color: var(--critical-text);
}

.category-option input:disabled + span {
  opacity: 0.4;
  cursor: not-allowed;
}

.field-row-even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.amount-input-small input {
  height: 46px;
  font-size: 20px;
}

/* ---------- Phones & small tablets ---------- */

@media (max-width: 899px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--border);
  }

  .brand,
  .sidebar-add,
  .sidebar-foot {
    display: none;
  }

  .nav-link {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    font-size: 11px;
  }

  .nav-link[aria-current="page"] {
    background: none;
  }

  /* "Aksjer" i stedet for "Aksjer og fond"; den lange teksten leses fortsatt av skjermlesere. */
  .nav-long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .nav-short {
    display: inline;
  }

  .view {
    padding: 16px 16px calc(100px + env(safe-area-inset-bottom));
  }

  .page-header h1 {
    font-size: 24px;
  }

  .fab {
    position: fixed;
    right: 16px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 18px;
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
  }

  .fab .icon {
    width: 26px;
    height: 26px;
  }

  .toasts {
    bottom: calc(150px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 599px) {
  .card {
    padding: 16px;
  }

  .page-header {
    margin-bottom: 14px;
  }

  .month-label {
    min-width: 124px;
  }

  .filters > select,
  .filters .segmented {
    flex: 1 1 auto;
  }

  .unbudgeted-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .unbudgeted-row .muted {
    grid-row: 2;
    font-size: 13px;
  }

  .unbudgeted-row .button {
    grid-row: 1 / span 2;
    grid-column: 2;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Bare tickeren i beholdningstabellen på mobil; navnet leses fortsatt av skjermlesere. */
  .holding-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  dialog.sheet,
  dialog.sheet-small {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Smale skjermer: aksjetabellen viser bare navn, i dag og verdi (resten står under navnet og verdien). */
@media (max-width: 699px) {
  .holdings .col-optional {
    display: none;
  }

  .holdings .mobile-only {
    display: inline;
  }

  .holdings td .mobile-only {
    display: block;
    font-size: 12px;
  }

  .holding-title {
    max-width: 150px;
  }

  .overview {
    padding: 18px;
  }

  /* Flisene under hverandre, som rader: navn og sum på én linje, lån/endring under */
  .section-tiles {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .section-tile {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "head value arrow"
      "note note note";
    padding: 14px 16px;
  }

  .section-tile-value {
    margin-top: 0;
    font-size: 20px;
  }

  /* Fanene deler bredden, så alle fire får plass på en smal telefon */
  .tabs {
    gap: 0;
  }

  .tab {
    flex: 1 1 auto;
    padding: 10px 6px;
    text-align: center;
  }

  /* Snarveiene på én rad */
  .quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .quick-action {
    min-width: 0;
  }

  /* Fond: "Ny verdi" under raden, så navnet får plass */
  .fund-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .fund-row .button {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Større trykkflater på berøringsskjermer (periodeknapper, små knapper og tilbake-lenken) */
@media (pointer: coarse) {
  .range-toggle button,
  .toggle button {
    height: 40px;
  }

  .button-small {
    min-height: 40px;
  }

  .back-link {
    min-height: 44px;
  }
}
