/* ============================================================
   Studiebudget – visuellt system
   Mobil-först, ljust och mörkt tema, inga externa resurser.
   ============================================================ */

:root {
  color-scheme: light;

  --bg: #f4f1e9;
  --bg-deep: #e9e3d6;
  --surface: #fffdf9;
  --surface-2: #f7f3eb;
  --surface-3: #ede7da;
  --text: #17211b;
  --muted: #5c6b61;
  --border: rgba(23, 33, 27, 0.10);
  --border-strong: rgba(23, 33, 27, 0.18);

  --primary: #1d6a4b;
  --primary-2: #3e9c72;
  --primary-soft: #dbeee3;
  --on-primary: #ffffff;

  --danger: #b13a2b;
  --danger-soft: #f8e4df;
  --warning: #b6781f;
  --warning-soft: #faecd0;
  --warning-border: #d9a441;
  --warning-text: #7a4d0d;
  --success: #2f7d5b;
  --focus: #0b5e8a;

  --glow-1: rgba(93, 184, 139, 0.34);
  --glow-2: rgba(232, 176, 106, 0.30);
  --glow-3: rgba(95, 142, 214, 0.18);
  --grid-line: rgba(23, 33, 27, 0.035);

  --cat-housing: #3f8f6e;
  --cat-food: #d18a36;
  --cat-transport: #4a7fb5;
  --cat-leisure: #9a6bb5;
  --cat-health: #c25b5b;
  --cat-other: #8a948d;

  --shadow-sm: 0 1px 2px rgba(23, 33, 27, 0.05), 0 4px 12px rgba(23, 33, 27, 0.05);
  --shadow-md: 0 1px 2px rgba(23, 33, 27, 0.04), 0 12px 30px rgba(23, 33, 27, 0.08);
  --shadow-lg: 0 2px 4px rgba(23, 33, 27, 0.06), 0 20px 50px rgba(23, 33, 27, 0.16);

  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 13px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a100c;
  --bg-deep: #070b08;
  --surface: #131c16;
  --surface-2: #17221b;
  --surface-3: #1d2b22;
  --text: #eef4ef;
  --muted: #a2b1a7;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);

  --primary: #7fd1a6;
  --primary-2: #a7e6c5;
  --primary-soft: #1b3a2b;
  --on-primary: #06140c;

  --danger: #ff9f8c;
  --danger-soft: #3a201b;
  --warning: #f0b95c;
  --warning-soft: #3a2d12;
  --warning-border: #e0a640;
  --warning-text: #ffdfa0;
  --success: #8fd8b3;
  --focus: #8ccdf2;

  --glow-1: rgba(78, 180, 130, 0.24);
  --glow-2: rgba(220, 160, 80, 0.16);
  --glow-3: rgba(92, 140, 220, 0.14);
  --grid-line: rgba(255, 255, 255, 0.025);

  --cat-housing: #7fc7a2;
  --cat-food: #e8b06a;
  --cat-transport: #7fb0e0;
  --cat-leisure: #c39bdd;
  --cat-health: #ef8d8d;
  --cat-other: #a8b5ac;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 36px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.45), 0 26px 60px rgba(0, 0, 0, 0.55);
}

:root[data-accent="ocean"] {
  --primary: #1d5f8a;
  --primary-2: #3b8fbf;
  --primary-soft: #dbeaf4;
  --on-primary: #ffffff;
}

:root[data-accent="violet"] {
  --primary: #5a3d8a;
  --primary-2: #8a6bc0;
  --primary-soft: #e9e1f5;
  --on-primary: #ffffff;
}

:root[data-accent="amber"] {
  --primary: #9a6414;
  --primary-2: #c88a2e;
  --primary-soft: #f7ead2;
  --on-primary: #ffffff;
}

:root[data-theme="dark"][data-accent="ocean"] {
  --primary: #8ccdf2;
  --primary-2: #b5e2f8;
  --primary-soft: #163244;
  --on-primary: #06141c;
}

:root[data-theme="dark"][data-accent="violet"] {
  --primary: #c9a9f0;
  --primary-2: #dec6f8;
  --primary-soft: #2d2140;
  --on-primary: #120a1c;
}

:root[data-theme="dark"][data-accent="amber"] {
  --primary: #f0c06a;
  --primary-2: #f7d797;
  --primary-soft: #3a2d12;
  --on-primary: #1c1406;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

button,
input,
select {
  font: inherit;
}

svg {
  display: block;
}

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

input:focus-visible,
select:focus-visible {
  outline: none;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60rem 32rem at 8% -12%, var(--glow-1), transparent 62%),
    radial-gradient(48rem 26rem at 112% 4%, var(--glow-2), transparent 58%),
    radial-gradient(42rem 28rem at 50% 116%, var(--glow-3), transparent 62%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(circle at 50% 16%, #000 0, transparent 72%);
  mask-image: radial-gradient(circle at 50% 16%, #000 0, transparent 72%);
}

/* ------------------------------------------------------------
   Skip link och startfel
   ------------------------------------------------------------ */

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.startup-error {
  width: calc(100% - 2rem);
  max-width: 44rem;
  margin: 0.75rem auto 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
}

.startup-error p {
  margin: 0;
}

.startup-error p + p {
  margin-top: 0.35rem;
}

.startup-error code {
  font-size: 0.85em;
}

/* ------------------------------------------------------------
   Apphuvud
   ------------------------------------------------------------ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 25;
  padding: 0.7rem 1rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
}

.app-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.brand__mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.app-header__text {
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.app-header p {
  margin: 0.12rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.theme-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.theme-button svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

.theme-icon--moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon--moon {
  display: block;
}

.theme-button:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

/* ------------------------------------------------------------
   Huvudinnehåll och vyer
   ------------------------------------------------------------ */

.app-main {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.view {
  animation: view-in 0.35s ease both;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.view-head {
  margin: 0.35rem 0 1rem;
}

.view-head h2 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.view-head > p:not(.eyebrow) {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ------------------------------------------------------------
   Kort och sektionsrubriker
   ------------------------------------------------------------ */

.card {
  position: relative;
  margin-bottom: 1rem;
  padding: 1.15rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-md);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  opacity: 0.55;
  pointer-events: none;
}

:root[data-theme="dark"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}

.card--dashboard {
  background: linear-gradient(180deg, var(--surface), var(--surface-2) 62%, var(--surface));
}

.card--form {
  position: relative;
  z-index: 5;
  overflow: visible;
}

.card--setup {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: linear-gradient(135deg, var(--primary-soft), var(--surface) 58%, var(--surface-2));
}

.section-head {
  margin-bottom: 1rem;
}

.section-head h3 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ------------------------------------------------------------
   Formulär
   ------------------------------------------------------------ */

.field {
  margin-bottom: 0.95rem;
}

.field:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0.68rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

select {
  padding-right: 2.3rem;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

input::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
  opacity: 1;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
  border-width: 2px;
}

.hint {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.field-error {
  margin: 0.35rem 0 0;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 700;
}

.inline-field {
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
}

.inline-field input {
  flex: 1 1 auto;
}

.inline-field .button {
  flex: 0 0 auto;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-bottom: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.checkbox-field input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  accent-color: var(--primary);
}

.checkbox-field label {
  margin: 0;
  font-weight: 600;
}

.field--kind {
  min-width: 0;
  margin-bottom: 1rem;
  padding: 0;
  border: 0;
}

.field--kind legend {
  padding: 0;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-2);
}

.segmented__option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  min-height: 58px;
  margin: 0;
  padding: 0.35rem 0.3rem;
  border-radius: 11px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented__option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented__option small {
  font-size: 0.61rem;
  font-weight: 600;
  opacity: 0.75;
}

.segmented__option:has(input:checked) {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.segmented__option:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.field--period {
  min-width: 0;
  padding: 0;
  border: 0;
}

.field--period legend {
  padding: 0;
  margin-bottom: 0.35rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.segmented--small {
  padding: 0.25rem;
  border-radius: 13px;
}

#cost-fixed-period-field .segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented--small .segmented__option {
  min-height: 44px;
  font-size: 0.78rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.form-actions .button {
  flex: 1 1 auto;
}

/* ------------------------------------------------------------
   Knappar
   ------------------------------------------------------------ */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  padding: 0.68rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color: var(--on-primary);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 24%, transparent);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px color-mix(in srgb, var(--primary) 32%, transparent);
}

.button:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 24%, transparent);
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.button svg {
  flex: 0 0 auto;
  width: 1.05em;
  height: 1.05em;
}

.button.secondary {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--primary);
  box-shadow: none;
}

.button.secondary:hover {
  border-color: color-mix(in srgb, var(--primary) 38%, var(--border-strong));
  background: var(--primary-soft);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.button.danger {
  border-color: color-mix(in srgb, var(--danger) 38%, transparent);
  background: transparent;
  color: var(--danger);
  box-shadow: none;
}

.button.danger:hover {
  background: var(--danger-soft);
}

.button.small {
  min-height: 40px;
  padding: 0.4rem 0.72rem;
  border-radius: 11px;
  font-size: 0.8rem;
}

.button-stack {
  display: grid;
  gap: 0.55rem;
}

.action-row {
  justify-content: flex-start;
  padding: 0.68rem 0.78rem;
  text-align: left;
  white-space: normal;
}

.button.action-row--demo {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border-strong));
  background: linear-gradient(135deg, var(--primary-soft), var(--surface-2));
  color: var(--primary);
}

.action-row__icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}

.action-row__icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.action-row__text {
  display: flex;
  flex-direction: column;
  gap: 0.02rem;
  min-width: 0;
}

.action-row__title {
  font-size: 0.88rem;
  font-weight: 800;
}

.action-row__sub {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 500;
}

.button.danger .action-row__icon {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}

.privacy-note {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
}

.privacy-note svg {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  color: var(--primary);
}

.privacy-link-row {
  margin: 0.45rem 0 0;
  padding-left: 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.privacy-link-row a {
  color: var(--primary);
  text-underline-offset: 0.18em;
}

/* ------------------------------------------------------------
   Sammanfattningsrad i listor
   ------------------------------------------------------------ */

.list-summary {
  margin: 0 0 0.9rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-soft), var(--surface));
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

/* ------------------------------------------------------------
   Listor och kort
   ------------------------------------------------------------ */

.item-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.item:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.05);
}

.item__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.item__title {
  display: flex;
  align-items: center;
  min-width: 0;
}

.item__name {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.98rem;
  font-weight: 800;
}

.item__amount {
  flex: 0 0 auto;
  font-size: 0.94rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.chip--success {
  background: var(--primary-soft);
  color: var(--primary);
}

.chip--warning {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.item__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.item__actions .button {
  flex: 1 1 auto;
}

.empty-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* ------------------------------------------------------------
   Kom igång-kort
   ------------------------------------------------------------ */

.setup-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-3) 80%, transparent);
}

.setup-progress__bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
  transition: width 0.4s ease;
}

.setup-progress-text {
  margin: 0.45rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.setup-list {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-step {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.setup-step.is-done {
  opacity: 0.72;
}

.setup-step__marker {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.setup-step__marker svg {
  width: 15px;
  height: 15px;
}

.setup-step.is-done .setup-step__marker {
  background: var(--primary-soft);
  color: var(--primary);
}

.setup-step__text {
  flex: 1 1 auto;
  min-width: 0;
}

.setup-step__text strong {
  display: block;
  font-size: 0.86rem;
}

.setup-step__text span {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
}

.setup-step .button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.3rem 0.6rem;
  font-size: 0.74rem;
}

.setup-demo {
  width: 100%;
  margin-top: 0.75rem;
}

/* ------------------------------------------------------------
   Dashboard-hjälte
   ------------------------------------------------------------ */

.budget-hero {
  position: relative;
  margin-bottom: 0.9rem;
  padding: 1.1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(120% 130% at 88% -10%, rgba(255, 255, 255, 0.55), transparent 46%),
    linear-gradient(135deg, var(--primary-soft), var(--surface) 60%, var(--surface-2));
}

:root[data-theme="dark"] .budget-hero {
  background:
    radial-gradient(120% 130% at 88% -10%, rgba(127, 209, 166, 0.18), transparent 46%),
    linear-gradient(135deg, var(--primary-soft), var(--surface) 60%, var(--surface-2));
}

.budget-hero::after {
  content: "";
  position: absolute;
  top: -70px;
  right: -50px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 28%, transparent), transparent 68%);
  pointer-events: none;
}

.budget-hero--danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: linear-gradient(135deg, var(--danger-soft), var(--surface) 60%, var(--surface-2));
}

:root[data-theme="dark"] .budget-hero--danger {
  background: linear-gradient(135deg, var(--danger-soft), var(--surface) 60%, var(--surface-2));
}

.budget-hero--warn {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--border));
  background: linear-gradient(135deg, var(--warning-soft), var(--surface) 60%, var(--surface-2));
}

:root[data-theme="dark"] .budget-hero--warn {
  background: linear-gradient(135deg, var(--warning-soft), var(--surface) 60%, var(--surface-2));
}

.budget-hero__top {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.budget-hero__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.budget-hero__amount {
  position: relative;
  z-index: 1;
  margin: 0.1rem 0 0;
  color: var(--primary);
  font-size: clamp(2.6rem, 13vw, 3.6rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.budget-hero--danger .budget-hero__amount {
  color: var(--danger);
}

.budget-hero--warn .budget-hero__amount {
  color: var(--warning-text);
}

.budget-hero__sub {
  position: relative;
  z-index: 1;
  margin: 0.25rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

.status-pill--good {
  background: var(--primary-soft);
  color: var(--primary);
}

.status-pill--warn {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.status-pill--danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.budget-meter {
  position: relative;
  z-index: 1;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--warning-border), color-mix(in srgb, var(--warning-border) 65%, var(--surface)));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.budget-hero--danger .budget-meter {
  background: var(--danger);
}

.budget-meter__free {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
  box-shadow: 0 0 10px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.budget-hero.is-negative .budget-meter__free {
  background: transparent;
  box-shadow: none;
}

.budget-meter__legend {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.legend-swatch {
  flex: 0 0 auto;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
}

.legend-swatch--free {
  background: var(--primary);
}

.legend-swatch--fixed {
  background: var(--warning-border);
}

.legend-swatch--danger {
  background: var(--danger);
}

.stat-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.stat {
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.stat__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.stat__value {
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.stat--highlight {
  border-color: color-mix(in srgb, var(--primary) 25%, var(--border));
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.stat--highlight .stat__value {
  color: var(--primary);
}

.stat--danger .stat__value {
  color: var(--danger);
}

.reserve-breakdown {
  position: relative;
  z-index: 1;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

/* ------------------------------------------------------------
   Förfallna kostnader
   ------------------------------------------------------------ */

.due-costs {
  position: relative;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.due-head h4 {
  margin: 0;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.due-sub {
  margin: 0.2rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.due-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.due-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.7rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
}

.due-item.is-paid {
  opacity: 0.62;
}

.due-item__check {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.due-item__check input {
  flex: 0 0 auto;
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--primary);
}

.due-item__name {
  overflow-wrap: anywhere;
}

.due-item__meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.due-item.is-paid .due-item__name {
  color: var(--muted);
  text-decoration: line-through;
}

.due-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.variable-costs {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.variable-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.variable-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.7rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
}

.variable-item__title {
  display: inline-flex;
  align-items: center;
  font-size: 0.86rem;
  font-weight: 700;
}

.variable-item__meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ------------------------------------------------------------
   Kategoriikoner
   ------------------------------------------------------------ */

.category-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  margin-right: 0.5rem;
  border-radius: 0.55rem;
  background: var(--surface-3);
  color: var(--muted);
  vertical-align: middle;
}

.category-badge svg {
  width: 0.95rem;
  height: 0.95rem;
}

.category-badge--housing {
  background: color-mix(in srgb, var(--cat-housing) 16%, var(--surface));
  color: var(--cat-housing);
}

.category-badge--food {
  background: color-mix(in srgb, var(--cat-food) 16%, var(--surface));
  color: var(--cat-food);
}

.category-badge--transport {
  background: color-mix(in srgb, var(--cat-transport) 16%, var(--surface));
  color: var(--cat-transport);
}

.category-badge--leisure {
  background: color-mix(in srgb, var(--cat-leisure) 16%, var(--surface));
  color: var(--cat-leisure);
}

.category-badge--health {
  background: color-mix(in srgb, var(--cat-health) 16%, var(--surface));
  color: var(--cat-health);
}

.category-badge--other {
  background: color-mix(in srgb, var(--cat-other) 16%, var(--surface));
  color: var(--cat-other);
}

.category-picker {
  position: relative;
}

.category-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 50px;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.category-button:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border-strong));
}

.category-button[aria-expanded="true"] {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.category-button__icon {
  display: inline-flex;
  flex: 0 0 auto;
}

.category-button__icon .category-badge {
  margin-right: 0;
}

.category-button__label {
  flex: 1 1 auto;
  font-weight: 600;
}

.category-button__chevron {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.category-button[aria-expanded="true"] .category-button__chevron {
  transform: rotate(180deg);
}

.category-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  z-index: 40;
  display: grid;
  gap: 0.15rem;
  max-height: 20rem;
  margin: 0;
  padding: 0.35rem;
  overflow-y: auto;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  list-style: none;
  animation: menu-in 0.15s ease both;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.category-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.35rem 0.45rem;
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.category-option:hover,
.category-option:focus-visible {
  background: var(--primary-soft);
  outline: none;
}

.category-option__label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.category-option__label .category-badge {
  margin-right: 0.5rem;
}

.category-option__check {
  flex: 0 0 auto;
  color: var(--primary);
  opacity: 0;
}

.category-option[aria-selected="true"] .category-option__check {
  opacity: 1;
}

.category-option__check svg {
  width: 1rem;
  height: 1rem;
}

/* ------------------------------------------------------------
   Kostnadsfördelning / donut
   ------------------------------------------------------------ */

.breakdown {
  margin: 0 0 1rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.breakdown__header {
  margin-bottom: 0.85rem;
}

.breakdown__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.breakdown__sub {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.donut-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.donut {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border), var(--shadow-sm);
}

.donut__center {
  position: absolute;
  inset: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
  text-align: center;
}

.donut__value {
  font-size: 1.05rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.donut__label {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.donut-legend {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.donut-legend__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.4rem 0.55rem;
  border-radius: 10px;
  background: var(--surface-2);
}

.donut-legend__label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-size: 0.8rem;
  font-weight: 700;
}

.donut-legend__value {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.insight-text {
  margin: 0.8rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
}

/* ------------------------------------------------------------
   Tomma tillstånd och varningar
   ------------------------------------------------------------ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.4rem 0.5rem 0.8rem;
  text-align: center;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--primary-soft), var(--surface-3));
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.empty-state__icon svg {
  width: 28px;
  height: 28px;
}

.empty-title {
  margin: 0 0 0.3rem;
  font-size: 1.02rem;
  font-weight: 800;
}

.empty-state p:not(.empty-title) {
  max-width: 32ch;
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.alert {
  margin: 0.9rem 0 0;
  padding: 0.7rem 0.8rem;
  border-radius: 13px;
  font-size: 0.82rem;
  font-weight: 600;
}

.alert--danger {
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

/* Budgetväljare */

.budget-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.budget-actions .button {
  flex: 1 1 auto;
}

.budget-create .field {
  margin-bottom: 0;
}

/* ------------------------------------------------------------
   Planer: Free och Plus
   ------------------------------------------------------------ */

.plan-current {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.plan-current p {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
}

.plan-badge {
  flex: 0 0 auto;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.plan-badge--free {
  background: var(--surface-3);
  color: var(--muted);
}

.plan-badge--plus {
  background: var(--primary-soft);
  color: var(--primary);
}

.plan-badge--pro {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.plan-grid {
  display: grid;
  gap: 0.8rem;
}

.plan-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.plan-card.is-current {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent);
}

.plan-card--plus {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
}

.plan-card--pro {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: linear-gradient(180deg, var(--warning-soft), var(--surface) 58%, var(--surface-2));
}

.plan-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.plan-card__head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.plan-card__price {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.plan-card--pro .plan-card__price {
  color: var(--warning-text);
}

.plan-card__tagline {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.plan-card__features {
  display: grid;
  gap: 0.4rem;
  margin: 0.65rem 0 0.9rem;
  padding: 0;
  list-style: none;
}

.plan-feature {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.79rem;
}

.plan-feature__icon {
  flex: 0 0 auto;
  margin-top: 0.1rem;
  color: var(--primary);
}

.plan-feature__icon svg {
  width: 0.9rem;
  height: 0.9rem;
}

.plan-feature.is-planned {
  color: var(--muted);
}

.plan-feature.is-planned .plan-feature__icon {
  color: var(--muted);
}

.plan-card__button {
  width: 100%;
  margin-top: auto;
}

.plan-note {
  margin: 0.9rem 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.plan-info {
  margin-top: 0.8rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.plan-info h3 {
  margin: 0 0 0.25rem;
  font-size: 0.96rem;
}

.plan-info p {
  margin: 0;
  color: var(--muted);
  font-size: 0.79rem;
}

.plan-info ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.77rem;
}

.card--plus-upsell {
  border-color: color-mix(in srgb, var(--primary) 30%, var(--border));
  background: linear-gradient(135deg, var(--primary-soft), var(--surface) 60%, var(--surface-2));
}

.card--plus-upsell .plan-card__features {
  margin: 0.75rem 0 1rem;
}

.card--plus-upsell .button {
  width: 100%;
}

@media (min-width: 44rem) {
  .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
}

/* ------------------------------------------------------------
   Sparmål
   ------------------------------------------------------------ */

.goal-upsell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0.5rem;
  text-align: center;
}

.goal-upsell__icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--primary);
}

.goal-upsell__icon svg {
  width: 24px;
  height: 24px;
}

.goal-upsell__title {
  margin: 0 0 0.25rem;
  font-weight: 800;
}

.goal-upsell__text {
  max-width: 32ch;
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.goal-form {
  margin-bottom: 0.9rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.goal-form__grid {
  display: grid;
  gap: 0.55rem;
}

.goal-form .field {
  margin-bottom: 0;
}

.goal-form .button {
  width: 100%;
  margin-top: 0.7rem;
}

.goal-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.goal {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.goal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.goal__info {
  min-width: 0;
}

.goal__name {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.goal__meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.goal__percent {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 800;
}

.goal-progress {
  height: 9px;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.goal-progress__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
}

.goal__status {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.goal__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.goal-empty {
  margin-top: 0.6rem;
}

@media (min-width: 34rem) {
  .goal-form__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------
   What-if och färgteman
   ------------------------------------------------------------ */

.whatif-form {
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.whatif-form .field {
  margin-bottom: 0;
}

.whatif-result {
  margin: 0.75rem 0 0;
  padding: 0.62rem 0.7rem;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
}

.whatif-result.is-negative {
  background: var(--danger-soft);
  color: var(--danger);
}

.accent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.accent-swatch {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.accent-swatch:hover {
  border-color: var(--border-strong);
}

.accent-swatch.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.accent-swatch__dot {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.accent-swatch--forest .accent-swatch__dot {
  background: #3e9c72;
}

.accent-swatch--ocean .accent-swatch__dot {
  background: #3b8fbf;
}

.accent-swatch--violet .accent-swatch__dot {
  background: #8a6bc0;
}

.accent-swatch--amber .accent-swatch__dot {
  background: #c88a2e;
}

@media (min-width: 34rem) {
  .accent-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Låsta premiumfunktioner */

.action-row.is-locked {
  opacity: 0.72;
}

.action-row.is-locked .action-row__icon {
  background: var(--surface-3);
  color: var(--muted);
}

/* ------------------------------------------------------------
   Demoläge
   ------------------------------------------------------------ */

.demo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px dashed color-mix(in srgb, var(--primary) 45%, var(--border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary-soft) 80%, transparent);
}

.demo-banner__badge {
  flex: 0 0 auto;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.demo-banner__text {
  flex: 1 1 auto;
  min-width: 12rem;
  margin: 0;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
}

.demo-banner .button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
}

/* ------------------------------------------------------------
   Guidad rundtur
   ------------------------------------------------------------ */

.tour-panel {
  position: fixed;
  right: 1rem;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 1rem;
  z-index: 60;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border));
  border-radius: 18px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
  animation: message-in 0.25s ease both;
}

.tour-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.tour-panel__close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.tour-panel__close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.tour-panel__step {
  margin: 0 0 0.2rem;
  color: var(--primary);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tour-panel__title {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.tour-panel__text {
  margin: 0.3rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.tour-panel__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.tour-panel__actions .button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.35rem 0.72rem;
  font-size: 0.75rem;
}

.tour-highlight {
  position: relative;
  z-index: 55;
  border-radius: var(--radius);
  outline: 3px solid var(--primary);
  outline-offset: 4px;
  animation: tour-pulse 1.6s ease-in-out infinite;
}

@keyframes tour-pulse {
  0%,
  100% {
    outline-color: color-mix(in srgb, var(--primary) 55%, transparent);
  }
  50% {
    outline-color: var(--primary);
  }
}

/* ------------------------------------------------------------
   Meddelandebanderoll
   ------------------------------------------------------------ */

.app-message {
  position: fixed;
  right: 1rem;
  bottom: calc(96px + env(safe-area-inset-bottom));
  left: 1rem;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: auto;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  animation: message-in 0.25s ease both;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.app-message__text {
  flex: 1 1 auto;
  font-size: 0.84rem;
}

.app-message__action {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 11px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.app-message__close {
  flex: 0 0 auto;
  min-width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.app-message.is-error {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.app-message.is-success {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--primary-soft);
  color: var(--text);
}

/* ------------------------------------------------------------
   Flytande bottennavigation
   ------------------------------------------------------------ */

.bottom-nav {
  position: fixed;
  bottom: calc(0.65rem + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(30rem, calc(100% - 1.25rem));
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
}

.bottom-nav__button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.bottom-nav__button svg {
  width: 21px;
  height: 21px;
}

.bottom-nav__button:hover {
  background: color-mix(in srgb, var(--surface-3) 60%, transparent);
  color: var(--text);
}

.bottom-nav__button[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.bottom-nav__button[aria-current="page"] svg {
  transform: translateY(-1px);
}

/* ------------------------------------------------------------
   Större skärmar
   ------------------------------------------------------------ */

@media (min-width: 34rem) {
  .donut-layout {
    flex-direction: row;
    align-items: center;
  }

  .donut-legend {
    flex: 1 1 auto;
  }
}

@media (min-width: 44rem) {
  .app-header {
    padding-top: 1rem;
  }

  .app-main {
    padding-top: 1.25rem;
  }

  .card {
    padding: 1.35rem;
    border-radius: 28px;
  }

  .view-head h2 {
    font-size: 1.95rem;
  }

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

/* ------------------------------------------------------------
   Rörelse
   ------------------------------------------------------------ */

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