/* Kompakt utseende: mindre luft, rubriker och knappar så att mer får plats på skärmen,
   särskilt i mobilen. Laddas sist på varje sida och justerar storlekarna i de andra filerna.
   Knappar och fält är fortfarande minst 36 px höga så att de är lätta att träffa med fingret. */

:root { --gutter: 32px; --header-h: 76px; }

/* ---------- Ram: meny, sidhuvud, kort, knappar ---------- */
.sidebar { padding: 24px 14px; gap: 28px; }
.brand-link { font-size: 17px; }
.nav { font-size: 14px; gap: 2px; }
.nav a, .nav-button { height: 40px; gap: 12px; font-size: 14px; }

.main { gap: 16px; }
.page-title h1 { font-size: 22px; }
.page-title .label, .page-sub { font-size: 11px; }
.card { padding: 20px; }
.empty { padding: 24px; font-size: 14px; }
.loading { padding: 24px; }

.btn { height: 38px; padding: 0 16px; font-size: 13px; gap: 8px; }
.icon-btn { width: 38px; height: 38px; }
.month-pill { height: 38px; min-width: 140px; font-size: 13px; }
.header-actions { gap: 8px; }
.field { height: 44px; font-size: 14px; }
.btn-block { height: 46px; }
.msg { padding: 10px 14px; font-size: 13px; }

.stats { gap: 12px; }
.stat { padding: 14px 16px; gap: 6px; }
.stat-value { font-size: 22px; }
.stat-note { font-size: 11px; }

/* ---------- Hem ---------- */
.home-top { gap: 16px; }
.headline { gap: 12px; padding: 4px 0; }
.headline .label { font-size: 11px; }
.hero-number { gap: 10px; }
.hero-number strong { font-size: 76px; }
.hero-number span { font-size: 22px; }
.headline p { font-size: 14px; line-height: 1.55; }
.headline .btn { height: 36px; padding: 0 14px; }
.ring-card { gap: 12px 20px; }
.ring { width: 116px; height: 116px; }
.ring-income strong { font-size: 22px; }
.ring-legend { padding-top: 8px; }
.ring-legend a { padding: 4px 8px; }
.ring-legend .name { font-size: 13px; }
.ring-legend .amount { font-size: 14px; }
.home-stats { gap: 12px; }
.home-stats .stat { padding: 14px 16px; }
.home-stats .stat-value { font-size: 22px; }
.home-stats .stat-note { font-size: 11px; }
.home-split { gap: 16px; }
.section-card { gap: 14px; }
.section-head h2 { font-size: 16px; }
.section-head .btn { height: 34px; padding: 0 14px; }
.goal-list { gap: 18px 28px; }
.goal-item { gap: 8px; }
.goal-row span:first-child { font-size: 14px; }
.goal-sub { font-size: 12px; }
.segments span { height: 12px; border-radius: 3px; }
.cat-bars { gap: 4px; }
.cat-name { font-size: 13px; }
.cat-track, .cat-bar { height: 10px; }
.cat-value { font-size: 12px; }
.ytd-grid { gap: 8px; }
.ytd { padding: 12px 14px; gap: 4px; }
.ytd strong { font-size: 18px; }
.ytd-note { font-size: 11px; }

/* ---------- Månadsbudget ---------- */
.groups { gap: 16px; }
.group { padding: 14px 12px 10px; gap: 4px; }
.group-head { padding: 0 8px 4px; }
.group-head h2 { font-size: 15px; }
.group-total { font-size: 14px; }
.rows { min-height: 42px; gap: 0; }
.rows-empty { height: 42px; }
.row { height: 42px; }
.handle, .del { height: 36px; }
.cell, .amt { height: 34px; font-size: 14px; }
.amt { font-size: 13px; }
.cell-static { font-size: 14px; }
.amt-static { font-size: 13px; }
.add-btn { height: 36px; font-size: 13px; }

/* ---------- Årsöversikt ---------- */
.year-table thead th { height: 40px; }
.year-table tbody tr:not(.group-row) { height: 32px; }
.sum-row { height: 36px !important; }

/* ---------- Sparmål och Lån ---------- */
.hero-stats { gap: 12px; }
.hero-stat { padding: 16px 18px; gap: 6px; }
.hero-value { font-size: 22px; }
.hero-stat.is-dark .hero-value { font-size: 34px; }
.cards { gap: 16px; }
.item-card { padding: 18px; gap: 12px; }
.item-title h2 { font-size: 16px; }
.item-sub { font-size: 12px; }
.tool-btn { width: 34px; height: 34px; }
.progress { height: 8px; }
.item-card .facts { gap: 10px 18px; }
.fact-value { font-size: 14px; }
.fact-value.is-big { font-size: 18px; }
.status { min-height: 28px; padding: 3px 12px; font-size: 12px; }
.item-foot .field { height: 38px; }
.edit-card { padding: 18px; gap: 14px; }
.edit-grid .field { height: 40px; }
.advice { padding: 14px 18px; font-size: 14px; }

/* ---------- Hjälp och guider ---------- */
.guides, .guide-articles { gap: 16px; }
.guide-hero { gap: 20px; }
.guide-hero h2 { font-size: 22px; }
.guide-hero p { font-size: 14px; }
.guide-hero-cta .btn { height: 44px; padding: 0 20px; font-size: 14px; }
.guide-layout { gap: 16px; }
.guide-toc { padding: 16px; gap: 10px; }
.guide-toc a { padding: 7px 10px; font-size: 13px; }
.guide-article { gap: 12px; }
.guide-article h2 { font-size: 18px; }
.guide-article p, .guide-steps li, .guide-list li { font-size: 14px; }
.guide-steps, .guide-list { gap: 8px; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  :root { --gutter: 14px; --header-h: 0px; }

  .sidebar { padding: 10px 14px; gap: 0; }
  .nav a, .nav-button { height: 44px; }

  .main { gap: 12px; }
  .page-header { padding: 12px 0 10px; gap: 10px; }
  .page-title { gap: 2px; }
  .page-title h1 { font-size: 20px; }
  .header-actions { gap: 6px; width: 100%; }
  .card { padding: 16px; border-radius: var(--r-card-sm); }

  .btn { height: 36px; padding: 0 12px; }
  .icon-btn { width: 36px; height: 36px; }
  .month-pill { height: 36px; }

  /* Månaden står redan i månadsväljaren, så den behövs inte under rubriken */
  .page-header:has(.month-pill) .page-title .label { display: none; }

  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .stat { padding: 10px; gap: 4px; border-radius: 14px; }
  .stat .label { font-size: 9px; letter-spacing: 0.06em; }
  .stat-value { font-size: 16px; }
  .stat-note { font-size: 10px; line-height: 1.35; }

  /* Hem: det viktigaste får plats utan att scrolla */
  .headline { gap: 8px; }
  .hero-number strong { font-size: 52px; }
  .hero-number span { font-size: 18px; }
  .headline p { font-size: 13px; }
  .ring { width: 88px; height: 88px; }
  .ring-value { font-size: 30px; }
  .ring-income strong { font-size: 18px; }
  .ring-legend .name { font-size: 12px; }
  .ring-legend .amount { font-size: 13px; }
  .home-stats { gap: 8px; }
  .home-stats .stat { padding: 10px 12px; }
  .home-stats .stat-value { font-size: 17px; }
  .section-card { gap: 10px; }
  .goal-list { gap: 14px; }
  .ytd { padding: 10px 12px; }
  .ytd strong { font-size: 16px; }

  /* Månadsbudget */
  .groups { gap: 10px; }
  .group { padding: 10px 6px 6px; border-radius: 16px; }
  .row { height: 40px; }
  .cell, .amt { height: 32px; }
  .amt { width: 88px; }
  .amt-static { width: 88px; }

  /* Sparmål och Lån */
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hero-stat.is-wide { grid-column: 1 / -1; }
  .hero-stat { padding: 12px 14px; }
  .hero-value { font-size: 18px; }
  .hero-stat.is-dark .hero-value { font-size: 28px; }
  .cards { gap: 10px; }
  .item-card { padding: 14px; gap: 10px; }
  .item-card .facts { gap: 8px 14px; }

  /* Hjälp och guider */
  .guide-hero h2 { font-size: 19px; }
  .guide-article h2 { font-size: 17px; }

  .support-fab { width: 46px; height: 46px; left: 12px; bottom: 12px; }
}

/* ==========================================================================
   Mobil som app (PWA): bottennavigering, safe areas och tumvänliga storlekar
   ========================================================================== */
html { -webkit-tap-highlight-color: transparent; }
.brand-logo { height: 19px; width: auto; display: block; flex-shrink: 0; }
.hero-brand .brand-logo { height: 22px; }
/* Loggan är vit. På ljus bakgrund (menyn i ljust tema) vänds den till mörk; hue-rotate behåller den blå tungan */
[data-theme-now="light"] .sidebar .brand-logo { filter: drop-shadow(0 0 0.5px #FFFFFF) drop-shadow(0 0 0.5px #FFFFFF) invert(1) hue-rotate(180deg); }
.tabbar { display: none; }

/* Ny version finns (js/pwa.js) */
.pwa-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 250;
  width: max-content;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
}
.pwa-toast .btn { height: 36px; }

/* Utan internet (js/pwa.js) */
.offline-bar {
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 900px) {
  /* Menyraden överst går upp under notchen; ytan bakom statusfältet är alltid mörk */
  .sidebar {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-left: calc(14px + env(safe-area-inset-left));
    padding-right: calc(14px + env(safe-area-inset-right));
    background: linear-gradient(to bottom, var(--status-bar) env(safe-area-inset-top), var(--surface) env(safe-area-inset-top));
  }
  .offline-bar + .app .sidebar { padding-top: 10px; background: var(--surface); }
  .sidebar.is-open { max-height: 100dvh; overflow-y: auto; box-shadow: var(--shadow-pop); }
  .menu-toggle { width: 44px; height: 44px; }

  .main {
    padding-left: calc(var(--gutter) + env(safe-area-inset-left));
    padding-right: calc(var(--gutter) + env(safe-area-inset-right));
    padding-bottom: calc(84px + env(safe-area-inset-bottom));
  }

  /* Bottennavigering */
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 6px calc(6px + env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    color: var(--text-2);
  }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .tabbar a:active { background: var(--subtle); }

  .support-fab { left: calc(12px + env(safe-area-inset-left)); bottom: calc(76px + env(safe-area-inset-bottom)); }
  .support-panel { inset: auto 12px calc(134px + env(safe-area-inset-bottom)) 12px; max-height: calc(100dvh - 200px); }
  .pwa-toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* Tumvänligt: minst 40–44 px att trycka på */
  .btn, .icon-btn, .month-pill { height: 42px; }
  .icon-btn { width: 42px; }
  .nav a, .nav-button { height: 46px; }
  .tool-btn { width: 40px; height: 40px; }
  .row { height: 48px; }
  .cell, .amt { height: 40px; }
  .handle { width: 30px; height: 44px; }
  .del { width: 36px; height: 44px; }
  .add-btn { height: 44px; }
  .amt, .amt-static { width: 104px; }

  /* 16 px i fält, annars zoomar iPhone in när man trycker i dem */
  .field, .cell, .amt, .amt-input, .item-foot .field, .edit-grid .field, .support-textarea, .ob-input, select { font-size: 16px; }
  .item-foot .field, .edit-grid .field { height: 44px; }
}

/* Namnet bredvid loggan: versaler med luft, lite mindre än förut (fliknamn och hemskärm heter fortfarande "Ursus") */
.brand-link span, .hero-brand span {
  font-size: 28px; /* versalerna blir ungefär lika höga som björnen */
  line-height: 1;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand-link, .hero-brand { gap: 12px; align-items: center; }
.sidebar .brand { padding: 0 4px; }
/* Björnen lika hög som bokstäverna */
.brand-logo, .hero-brand .brand-logo { height: 27px; }
/* Björnens linjer är tunna; en svag skugga i samma färg gör dem lite tjockare och tydligare */
.brand-logo { filter: drop-shadow(0 0 0.5px #FFFFFF) drop-shadow(0 0 0.5px #FFFFFF); }

/* ==========================================================================
   Menyns grupper, klockan med notiser (js/notify.js)
   ========================================================================== */
.brand-actions { display: flex; align-items: center; gap: 6px; }
.nav-label {
  padding: 14px 14px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav-label:first-child { padding-top: 0; }
.nav-foot { padding: 0; }

.bell {
  position: relative;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .2s, background .2s, border-color .2s;
}
.bell:hover, .bell[aria-expanded="true"] { color: var(--text); background: var(--subtle); border-color: var(--line-strong); }
.bell.has-unread { color: var(--text); }
.bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

.notif-panel {
  position: fixed;
  top: 20px;
  left: calc(var(--sidebar-w) - 12px);
  z-index: 120;
  width: min(380px, calc(100vw - 24px));
  max-height: min(560px, calc(100dvh - 40px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s var(--ease-out);
}
.notif-panel.is-open { opacity: 1; transform: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }
.notif-head h2 { font-size: 16px; font-weight: 500; }
.notif-head .link-button { font-size: 12px; }
.notif-list { list-style: none; margin: 0; padding: 0 8px; overflow-y: auto; }
.notif-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 10px;
  border-radius: var(--r-sm);
  color: var(--text);
}
a.notif-item:hover { background: var(--hover-bg); color: var(--text); }
.notif-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: transparent; }
.notif-item.is-unread .notif-dot { background: var(--accent); }
.notif-item.is-payday .notif-body strong { color: var(--accent); }
.notif-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-body strong { font-size: 13px; font-weight: 600; }
.notif-body span { font-size: 12px; line-height: 1.5; color: var(--text-2); }
.notif-item time { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); white-space: nowrap; padding-top: 2px; }
.notif-empty { padding: 8px 18px 16px; font-size: 13px; color: var(--text-2); }
.notif-foot { padding: 12px 18px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--accent); }

/* ==========================================================================
   Mobil: tätare, men fortfarande lätt att trycka (senaste lagret, vinner över det ovan)
   ========================================================================== */
@media (max-width: 900px) {
  .brand-link span { font-size: 20px; }
  .brand-logo, .hero-brand .brand-logo { height: 24px; }
  .sidebar { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px; }
  .menu-toggle, .bell { width: 38px; height: 38px; }
  .nav-label { padding: 12px 14px 4px; }
  .notif-panel { top: calc(60px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; max-height: calc(100dvh - 150px); }

  .main { gap: 10px; }
  .page-header { padding: 10px 0 8px; gap: 8px; }
  .page-title h1 { font-size: 18px; }
  .card { padding: 14px; }
  .btn, .icon-btn, .month-pill { height: 38px; }
  .icon-btn { width: 38px; }
  .btn { font-size: 13px; }

  /* Hem */
  .hero-number strong { font-size: 44px; }
  .hero-number span { font-size: 16px; }
  .headline { gap: 6px; }
  .headline p { font-size: 12.5px; }
  .headline .btn { height: 34px; font-size: 12px; }
  .ring-card { gap: 10px 16px; }
  .ring { width: 76px; height: 76px; }
  .ring-income strong { font-size: 17px; }
  .ring-legend a { padding: 3px 8px; }
  .home-stats .stat { padding: 10px 12px; }
  .home-stats .stat-value, .stat-value { font-size: 16px; }
  .section-head h2 { font-size: 15px; }

  /* Listor och kort */
  .row { height: 44px; }
  .cell, .amt { height: 36px; }
  .handle { height: 40px; }
  .del { height: 40px; }
  .add-btn { height: 40px; }
  .item-card { padding: 12px; }
  .hero-stat { padding: 10px 12px; }
  .hero-stat.is-dark .hero-value { font-size: 24px; }

  /* Bottennavigeringen */
  .tabbar { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a { min-height: 46px; gap: 2px; font-size: 10px; }
  .tabbar a svg { width: 20px; height: 20px; }
  .main { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .support-fab { width: 42px; height: 42px; bottom: calc(64px + env(safe-area-inset-bottom)); }

  /* Inloggning i mobilen: kompakt hero, liten infoplatta */
  .auth { padding: 12px; gap: 16px; align-content: start; min-height: 100dvh; }
  .hero { justify-content: flex-start; }
  .hero { padding: 18px 18px 16px; gap: 14px; border-radius: 22px; }
  .hero h1 { font-size: 26px; line-height: 1.1; }
  .hero-top .brand-link span, .hero-brand span { font-size: 20px; }
  .auth-tools { padding: 3px; }
  .auth-tools button { height: 28px; min-width: 28px; padding: 0 8px; font-size: 10px; }
  .auth-tools .tool-btn { width: 28px; }
  .hero .facts { padding: 10px 12px; gap: 4px; border-radius: 14px; }
  .facts-kind { font-size: 9.5px; }
  .facts-text { font-size: 12.5px !important; line-height: 1.45; min-height: 2.9em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .facts-dots button { width: 14px; height: 26px; }
  .facts-dots i { width: 5px; height: 5px; }
  .auth-box { gap: 18px; }
  .tab { height: 40px; font-size: 14px; }
  .auth-head { gap: 4px; }
  .auth-head h2 { font-size: 24px; }
  .auth-head p { font-size: 13px; }
  .form { gap: 16px; }
  .btn-block { height: 46px; }
}

/* ==========================================================================
   Surfplatta (600–900 px): mobilens meny, men mer bredd används – fler kolumner
   och en bottenmeny med ikon och text bredvid varandra
   ========================================================================== */
@media (min-width: 600px) and (max-width: 900px) {
  :root { --gutter: 24px; }
  .main { gap: 14px; }
  .page-title h1 { font-size: 22px; }

  /* Nyckeltalen på en rad */
  .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .home-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-stat.is-wide { grid-column: auto; }

  /* Hem: kvar att leva på och ringen bredvid varandra */
  .headline { grid-column: span 6; }
  .ring-card { grid-column: span 6; }
  .hero-number strong { font-size: 56px; }

  /* Månadsbudget, sparmål och lån i två kolumner */
  .groups { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .amt, .amt-static { width: 92px; }

  /* Bottenmenyn: samlad i mitten, ikon och text på samma rad */
  .tabbar { justify-content: center; grid-template-columns: repeat(5, minmax(0, 120px)); }
  .tabbar a { flex-direction: row; gap: 8px; min-height: 44px; font-size: 12px; }

  /* Hjälp, nyheter och om */
  .about-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { padding: 20px 40px; }
}

/* Klockan på datorn: längst till höger i sidhuvudet, panelen öppnas under den */
@media (min-width: 901px) {
  .page-header > .bell { margin-left: auto; }
  .page-header .page-title { margin-right: auto; }
  .page-header .bell { width: 40px; height: 40px; }
  .notif-panel { top: 88px; left: auto; right: var(--gutter); }
}

/* ==========================================================================
   Sparmål och Lån: kompakta, stilrena kort
   Fakta ligger på en rad när kortet är brett nog (4 kolumner för sparmål,
   3 för lån som har 6 fakta), annars 2 kolumner.
   ========================================================================== */
.cards { gap: 12px; }
.item-card { container-type: inline-size; padding: 16px 18px; gap: 10px; border-radius: var(--r-card-sm); }
.item-title { gap: 2px; }
.item-title h2 { font-size: 16px; }
.item-sub { font-size: 11.5px; }
.item-tools { gap: 0; margin: -4px -6px 0 0; }
.tool-btn { width: 32px; height: 32px; }
.tool-btn svg { width: 16px; height: 16px; }
.progress { height: 6px; }
.month-note { font-size: 11.5px; margin-top: -2px; }

.item-card .facts { gap: 10px 14px; padding: 10px 0 0; border-top: 1px solid var(--line); }
.fact { gap: 2px; }
.fact .label { font-size: 9.5px; letter-spacing: 0.1em; }
.fact-value { font-size: 14px; }
.fact-value.is-big { font-size: 15px; font-weight: 500; }
.inline-amount { gap: 4px; }
.inline-amount .amt-input { width: 76px; height: 28px; padding: 0 8px; font-size: 12.5px; border-radius: 8px; }
.inline-amount span { font-size: 11px; }
@container (min-width: 400px) {
  .item-card .facts:has(> .fact:nth-child(6)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container (min-width: 500px) {
  .item-card .facts:not(:has(> .fact:nth-child(6))) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.status { min-height: 24px; padding: 2px 10px; font-size: 11.5px; }
.item-foot { gap: 8px; padding-top: 10px; }
.item-foot .field { height: 34px; font-size: 13px; }
.item-foot .btn { height: 34px; padding: 0 14px; font-size: 12.5px; }

@media (max-width: 900px) {
  .item-card { padding: 14px; }
  .item-foot .field { font-size: 16px; } /* annars zoomar iPhone in */
  .inline-amount .amt-input { font-size: 16px; height: 32px; width: 84px; }
}

/* Hem: insiktsraden och jämförelsen med förra månaden */
.insight {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 520px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--text) !important;
  font-size: 13px !important;
  line-height: 1.5;
}
.insight svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.insight strong { font-weight: 600; }
.insight a { color: var(--accent); font-weight: 600; }
.insight[hidden] { display: none; }
.cat-delta { display: inline-block; min-width: 64px; margin-left: 8px; font-size: 11px; color: var(--text-3); text-align: right; }
.cat-delta.is-up { color: var(--warning-text); }
.cat-delta.is-down { color: var(--positive); }
@media (max-width: 900px) {
  .cat-value small.cat-delta { display: inline-block; min-width: 0; margin-left: 6px; font-size: 10px; }
  .insight { font-size: 12px !important; padding: 8px 10px; }
}

/* Hem: periodväljare för diagrammet och kvartalen */
.period-nav { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.period-arrow { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 999px; background: none; color: var(--text-2); font-size: 16px; line-height: 1; cursor: pointer; }
.period-arrow:hover:not(:disabled) { background: var(--subtle); color: var(--text); }
.period-arrow:disabled { opacity: .3; cursor: default; }
.period-select, .period-year { min-width: 64px; height: 28px; padding: 0 6px; border: 0; background: none; color: var(--text); font-family: var(--font-mono); font-size: 13px !important; text-align: center; text-align-last: center; }
.period-year { display: inline-grid; place-items: center; }
.period-picker { position: relative; }
.section-head:has(.period-picker) { position: relative; z-index: 5; }
.period-select { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 999px; cursor: pointer; }
.period-select svg { color: var(--text-3); transition: transform .15s; }
.period-select[aria-expanded="true"] svg { transform: rotate(180deg); }
.period-select:hover, .period-select[aria-expanded="true"] { background: var(--subtle); }
.period-menu { position: absolute; top: calc(100% + 8px); left: 50%; z-index: 20; display: flex; flex-direction: column; gap: 2px; min-width: 130px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-pop); transform: translateX(-50%); animation: period-in .12s ease-out; }
.period-menu[hidden] { display: none; }
.period-menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-family: var(--font-mono); font-size: 12.5px; text-align: left; cursor: pointer; white-space: nowrap; }
.period-menu button:hover, .period-menu button:focus-visible { background: var(--subtle); color: var(--text); outline: none; }
.period-menu button[aria-selected="true"] { color: var(--accent); }
.period-menu button[aria-selected="true"]::after { content: '✓'; font-size: 11px; }
@keyframes period-in { from { opacity: 0; transform: translate(-50%, -4px); } }
.section-head:has(.period-nav) { align-items: center; }
.chart-range { align-self: flex-end; margin-top: -8px; }
.chart-values.is-years { text-align: left; }
.chart-values.is-years dt, .chart-values.is-letters dt { white-space: nowrap; overflow: visible; }
.chart-values.is-letters dt { letter-spacing: 0; }
.quarter-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.quarter-table th, .quarter-table td { padding: 7px 10px; text-align: right; white-space: nowrap; }
.quarter-table thead th { padding-top: 0; font-size: 11px; font-weight: 400; color: var(--text-3); }
.quarter-table tbody tr { border-top: 1px solid var(--line); }
.quarter-table tbody th { text-align: left; font-weight: 400; }
.quarter-table tbody th strong { font-weight: 600; margin-right: 8px; }
.quarter-table tbody th span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .05em; color: var(--text-3); }
.quarter-table td { font-family: var(--font-mono); font-size: 12.5px; }
.quarter-table .is-positive { color: var(--positive); }
.quarter-table .is-negative { color: var(--warning-text); }
.quarter-table tr.is-current { background: var(--accent-tint); }
.quarter-table tr.is-current th { box-shadow: inset 2px 0 0 var(--accent); }
.quarter-table tr.is-current th strong { color: var(--accent); }
.quarter-table tr.is-empty { color: var(--text-3); }

/* ==========================================================================
   Mobil, ännu tätare (senaste lagret)
   ========================================================================== */
@media (max-width: 900px) {
  .main { gap: 8px; }
  .card { padding: 12px; }
  .section-card { gap: 8px; }
  .section-head { gap: 8px; }
  .section-head h2 { font-size: 14px; }
  .section-head .btn { height: 30px; padding: 0 12px; font-size: 12px; }
  .page-header { padding: 8px 0 6px; }
  .page-title h1 { font-size: 17px; }
  .btn, .icon-btn, .month-pill { height: 34px; }
  .icon-btn { width: 34px; }
  .month-pill { font-size: 12px; }
  .label { font-size: 10px; }

  .hero-number strong { font-size: 38px; }
  .hero-number span { font-size: 14px; }
  .headline p { font-size: 12px; }
  .insight { font-size: 11.5px !important; padding: 6px 9px; }
  .ring { width: 68px; height: 68px; }
  .ring-income strong { font-size: 15px; }
  .ring-legend { font-size: 11px; }
  .home-stats { gap: 8px; }
  .home-stats .stat { padding: 8px 10px; gap: 2px; }
  .home-stats .stat-value, .stat-value { font-size: 15px; }
  .home-stats .stat-note, .stat-note { font-size: 11px; }

  .chart-tick { font-size: 10px; }
  .chart-values { font-size: 10px; }
  .period-nav { padding: 2px; }
  .period-arrow { width: 24px; height: 24px; font-size: 14px; }
  .period-select, .period-year { height: 24px; min-width: 52px; font-size: 12px !important; }

  .cat-bars { gap: 2px; }
  .cat-bars li:not(.loading) { padding-top: 3px; padding-bottom: 3px; }
  .cat-name { font-size: 12px; }
  .cat-value { font-size: 11px; }
  .cat-track, .cat-bar { height: 8px; }

  .ytd-grid { gap: 6px; }
  .ytd { padding: 8px 10px; gap: 2px; }
  .ytd strong { font-size: 14px; }
  .ytd-note { font-size: 10px; }

  .quarter-table th, .quarter-table td { padding: 6px 6px; }
  .quarter-table td { font-size: 11.5px; }
  .quarter-table tbody th strong { margin-right: 5px; font-size: 12.5px; }
  .quarter-table tbody th span { font-size: 9.5px; }
  .quarter-table thead th { font-size: 10px; }

  .goal-list { gap: 14px; }
  .goal-item { gap: 6px; }
  .goal-row span:first-child { font-size: 13px; }
  .segments span { height: 12px; }
  .goal-sub { font-size: 11px; }

  .item-card { padding: 10px; }
  .row { height: 36px; min-height: 36px; }
  .cell, .amt { height: 30px; }
  .handle, .del { height: 32px; }
  .add-btn { height: 34px; }
  .group-head h2 { font-size: 14px; }
  .group-total { font-size: 13px; }
  .groups { gap: 8px; }
  .stat { padding: 8px 10px; gap: 2px; }
  .hero-stat { padding: 8px 10px; }
  .hero-stat.is-dark .hero-value { font-size: 20px; }
}

/* Frågetecken i hörnet av rutorna (js/tooltip.js) */
.stat, .hero-stat, .ring-card { position: relative; }
.stat .info-tip, .hero-stat .info-tip, .ring-card > .info-tip { position: absolute; top: 10px; right: 10px; margin: 0; }
.stat > .label, .hero-stat > .label { padding-right: 20px; }
.info-tip { display: inline-grid; place-items: center; }
span.info-tip { cursor: help; user-select: none; }
.section-head h2 .info-tip { vertical-align: 2px; }
.headline .label .info-tip { vertical-align: 0; }
@media (max-width: 900px) {
  .stat .info-tip, .hero-stat .info-tip, .ring-card > .info-tip { top: 7px; right: 7px; }
  .info-tip { width: 15px; height: 15px; font-size: 9.5px; }
}

/* Inloggning på datorn: allt ryms på skärmen utan att sidan går att skrolla.
   Björnen, rubriken och luften krymper efter fönstrets höjd. */
@media (min-width: 901px) {
  .auth { box-sizing: border-box; min-height: 100dvh; padding: clamp(16px, 3vh, 40px) 40px; }
  .hero { padding: clamp(24px, 4.5vh, 56px); gap: clamp(12px, 2.5vh, 40px); }
  .hero-visual { width: clamp(150px, 30vh, 300px); }
  .hero-body { gap: clamp(12px, 2.4vh, 32px); }
  .hero h1 { font-size: clamp(38px, 5.6vh, 56px); }
  .hero-body p { font-size: clamp(14px, 1.8vh, 17px); }
}

/* Mobilmenyn som liten ruta under menyknappen, och snabbmenyn överst (senaste lagret)
   På datorn syns menyn som vanligt i sidomenyn; rutan är då bara ett osynligt skal. */
.menu-panel { display: contents; }
@media (max-width: 900px) {
  .sidebar { position: sticky; }
  .sidebar.is-open { max-height: none; overflow: visible; box-shadow: none; }

  .menu-panel {
    display: none;
    position: absolute;
    top: calc(52px + env(safe-area-inset-top));
    right: calc(10px + env(safe-area-inset-right));
    z-index: 60;
    width: 220px;
    max-height: calc(100dvh - 70px - env(safe-area-inset-top));
    overflow-y: auto;
    flex-direction: column;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-pop);
    transform-origin: top right;
    animation: menu-in .14s ease-out;
  }
  .sidebar.is-open .menu-panel { display: flex; }
  .sidebar.is-open .nav, .sidebar.is-open .sidebar-foot, .menu-panel .nav, .menu-panel .sidebar-foot { display: flex; }
  .menu-panel .nav { padding: 0; gap: 1px; }
  .menu-panel .nav-label, .menu-panel a[data-tab] { display: none; }
  .menu-panel .nav a, .menu-panel .nav-button { height: 36px; padding: 0 10px; gap: 10px; border-radius: 9px; font-size: 13.5px; }
  .menu-panel .nav a svg, .menu-panel .nav-button svg { width: 17px; height: 17px; }
  .menu-panel .nav a[aria-current="page"]::before { display: none; }
  .menu-panel .sidebar-foot { margin-top: 5px; padding-top: 5px; gap: 1px; }
  .menu-panel .user { padding: 4px 10px 5px; }
  .menu-panel .user-name { font-size: 12.5px; }
  .menu-panel .user-email { font-size: 11px; }

  /* Snabbmenyn överst, direkt under loggan */
  .tabbar {
    position: static;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    margin: 6px 0 0;
    padding: 0;
    border: 0;
    background: none;
  }
  .tabbar a { min-height: 40px; gap: 2px; border-radius: 10px; font-size: 10px; }
  .tabbar a svg { width: 18px; height: 18px; }
  .tabbar a[aria-current="page"] { background: var(--accent-tint); }

  /* Ingen rad i botten längre: mindre luft där, och knapparna längre ner */
  .main { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .support-fab { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .support-panel { inset: auto 12px calc(70px + env(safe-area-inset-bottom)) 12px; max-height: calc(100dvh - 190px); }
  .pwa-toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .notif-panel { top: calc(106px + env(safe-area-inset-top)); max-height: calc(100dvh - 130px); }
}
@media (min-width: 600px) and (max-width: 900px) {
  .tabbar { justify-content: center; grid-template-columns: repeat(5, minmax(0, 130px)); }
  .tabbar a { flex-direction: row; gap: 7px; min-height: 36px; font-size: 12px; }
}
@keyframes menu-in { from { opacity: 0; transform: scale(.96) translateY(-4px); } }

/* Kontakta oss: nere till höger och lite mindre (senaste lagret) */
.support-fab { left: auto; right: 24px; bottom: 24px; width: 44px; height: 44px; }
.support-fab svg { width: 20px; height: 20px; }
.support-panel { inset: auto 24px 80px auto; }
@media (max-width: 900px) {
  .support-fab { left: auto; right: calc(14px + env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); width: 40px; height: 40px; }
  .support-fab svg { width: 18px; height: 18px; }
  .support-panel { inset: auto 12px calc(64px + env(safe-area-inset-bottom)) 12px; }
}

/* Månadsbudget i mobilen med bockrutan: smalare beloppsruta så att namnen får plats */
@media (max-width: 600px) {
  .row { gap: 4px; padding: 0 2px; }
  .row .handle { width: 22px; }
  .amt, .amt-static { width: 80px; }
  .row .check, .check-space { width: 20px; height: 20px; }
  .kr { width: 16px; }
  .del, .del-space { width: 26px; }
}

/* Mobil: små fält nu när iPhone inte zoomar in (maximum-scale=1 i viewport) */
@media (max-width: 900px) {
  .field, .cell, .amt, .amt-input, .item-foot .field, .edit-grid .field, .support-textarea, select { font-size: 14px; }
  .item-foot .field { font-size: 14px; }
  .inline-amount .amt-input { font-size: 14px; }
}

/* Hem: kort när budgeten är tom */
.start-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px 18px; border-color: var(--accent); background: var(--accent-tint); }
.start-card[hidden] { display: none; }
.start-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #FFFFFF; }
.start-text h2 { font-size: 16px; font-weight: 600; }
.start-text p { margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.start-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.start-actions .btn { height: 36px; padding: 0 16px; font-size: 13px; }
@media (max-width: 700px) {
  .start-card { grid-template-columns: auto minmax(0, 1fr); }
  .start-actions { grid-column: 1 / -1; }
  .start-actions .btn { flex: 1; justify-content: center; }
}

/* Historiken (klockan bredvid nyhetsikonen) */
.activity-btn svg { width: 18px; height: 18px; }
.activity-list { padding-bottom: 6px; }
.activity-day { padding: 12px 10px 4px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.activity-day:first-letter { text-transform: uppercase; }
.activity-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); }
a.activity-item.is-link:hover { background: var(--hover-bg); color: var(--text); }
.activity-avatar { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); font-size: 11.5px; font-weight: 600; }
.activity-avatar.is-me { background: var(--subtle); color: var(--text-2); }
.activity-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12.5px; line-height: 1.45; }
.activity-body strong { font-weight: 600; }
.activity-body small { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.activity-item time { padding-top: 3px; font-family: var(--font-mono); font-size: 10px; color: var(--text-3); white-space: nowrap; }
.activity-foot { font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.activity-close { width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: pointer; }
.activity-close:hover { background: var(--subtle); color: var(--text); }
@media (min-width: 901px) {
  .page-header > .activity-btn { margin-left: auto; }
  .page-header > .activity-btn + .bell { margin-left: 0; }
}

/* Det som ändrats lyses upp när man kommer från historiken */
.is-spotlight { animation: spotlight 1.1s ease-in-out 3; border-radius: var(--r-sm); }
@keyframes spotlight {
  0%, 100% { box-shadow: 0 0 0 0 transparent; background-color: transparent; }
  50% { box-shadow: 0 0 0 2px var(--accent); background-color: var(--accent-tint); }
}
.item-card.is-spotlight { border-radius: var(--r-card); }
@media (prefers-reduced-motion: reduce) { .is-spotlight { animation: none; box-shadow: 0 0 0 2px var(--accent); } }

/* Historik- och nyhetspanelen: mindre och tätare (senaste lagret) */
.notif-panel { width: min(320px, calc(100vw - 24px)); max-height: min(460px, calc(100dvh - 120px)); border-radius: 14px; }
.notif-head { padding: 10px 12px 6px; }
.notif-head h2 { font-size: 13.5px; font-weight: 600; }
.notif-list { padding: 0 4px; }
.notif-item { gap: 8px; padding: 8px 8px; }
.notif-body strong { font-size: 12.5px; }
.notif-body span { font-size: 11.5px; }
.notif-empty { padding: 4px 12px 10px; font-size: 12px; line-height: 1.5; }
.notif-foot { padding: 8px 12px; font-size: 12px; }
.activity-foot { font-size: 11px; }
.activity-close { width: 24px; height: 24px; font-size: 12px; }
.activity-item { grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; padding: 6px 8px; }
.activity-avatar { width: 22px; height: 22px; font-size: 10.5px; }
.activity-body { font-size: 12px; }
.activity-day { padding: 8px 8px 2px; }
@media (min-width: 901px) {
  .page-header .bell { width: 34px; height: 34px; }
  .page-header .bell svg { width: 17px; height: 17px; }
}
@media (max-width: 900px) {
  .notif-panel { left: auto; right: 10px; width: min(320px, calc(100vw - 20px)); }
}
@media (max-width: 900px) {
  .brand-actions .bell, .brand-actions .menu-toggle { width: 34px; height: 34px; }
  .brand-actions .bell svg { width: 17px; height: 17px; }
  .brand-actions { gap: 6px; }
  .notif-head h2 { font-size: 13.5px; }
  .notif-empty { font-size: 12px; }
}

/* Telefonen: ännu mindre knappar och paneler uppe till höger */
@media (max-width: 900px) {
  .brand-actions { gap: 5px; }
  .brand-actions .bell, .brand-actions .menu-toggle { width: 30px; height: 30px; }
  .brand-actions .bell svg { width: 15px; height: 15px; }
  .brand-actions .menu-toggle svg { width: 15px; height: 15px; }
  .brand-actions .bell-badge { min-width: 15px; height: 15px; font-size: 9px; line-height: 15px; top: -4px; right: -4px; }
  .notif-panel { right: 8px; width: min(290px, calc(100vw - 16px)); max-height: min(420px, calc(100dvh - 130px)); border-radius: 12px; }
  .notif-head { padding: 8px 10px 4px; }
  .notif-head h2 { font-size: 12.5px; }
  .notif-head .link-button { font-size: 11px; }
  .notif-item { gap: 6px; padding: 6px; }
  .notif-body { gap: 1px; }
  .notif-body strong { font-size: 11.5px; }
  .notif-body span { font-size: 10.5px; line-height: 1.4; }
  .notif-item time, .activity-item time { font-size: 9px; }
  .notif-foot { padding: 6px 10px; font-size: 11px; }
  .activity-item { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 6px; padding: 5px 6px; }
  .activity-avatar { width: 20px; height: 20px; font-size: 9.5px; }
  .activity-body { font-size: 11px; }
  .activity-body small { font-size: 9.5px; }
  .activity-day { padding: 6px 6px 1px; font-size: 9px; }
  .activity-foot { font-size: 10px; }
  .activity-close { width: 22px; height: 22px; font-size: 11px; }
}

/* Spar: de tre knapparna på en rad i mobilen */
@media (max-width: 900px) {
  body[data-page="goals"] .header-actions { flex-wrap: nowrap; }
  body[data-page="goals"] .header-actions .btn { flex: 1 1 auto; min-width: 0; padding: 0 8px; white-space: nowrap; }
}

/* Spar och Lån i telefonen: så kompakt som möjligt */
.status:not(.is-good):not(.is-bad) { display: none; } /* "Inget slutdatum satt" m.m. säger inget nytt */
@media (max-width: 900px) {
  .item-foot { flex-wrap: nowrap; }
  .item-foot .btn { flex-shrink: 0; }
}
@media (max-width: 600px) {
  .cards { gap: 8px; }
  .item-card { padding: 12px; gap: 8px; }
  .item-card .facts { padding-top: 8px; gap: 6px 12px; }
  .item-foot { padding-top: 8px; gap: 6px; }
  .item-foot .field, .item-foot .btn { height: 38px; }
  .account-body { gap: 8px; }
  .account-sum { font-size: 16px; }
}

/* Frågetecknet i det mörka nyckeltalet: i hörnet av kortet, inte efter etiketten */
.stat-dark > .label, .hero-stat.is-dark > .label { position: static; }
.advice[hidden] { display: none; }

/* Insikterna på Hem: byter text (tryck = nästa) */
.insight.is-rotating { cursor: pointer; user-select: none; }
.insight-text { flex: 1 1 auto; min-width: 0; }
.insight-text.is-new { animation: insight-in .35s ease-out; }
@keyframes insight-in { from { opacity: 0; transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .insight-text.is-new { animation: none; } }

/* Rubrik + periodväljare: väljaren stannar alltid till höger på samma rad (rubriken får bryta i stället) */
.section-head:has(.period-nav) { flex-wrap: nowrap; }
.section-head:has(.period-nav) h2 { min-width: 0; }
.section-head .period-nav { flex-shrink: 0; margin-left: auto; }

/* Nyckeltal som döljs (Sparat hittills, Lån kvar): resten fyller raden på bredare skärmar */
.stat[hidden] { display: none !important; }
@media (min-width: 1321px) { .stats.has-cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); } }
@media (min-width: 901px) { .home-stats.has-cols { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); } }

/* Telefonen: tätare Hjälp och guider, Om URSUS och Nyheter (mindre luft, samma innehåll) */
@media (max-width: 600px) {
  .guide-hero { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
  .guide-hero h2 { font-size: 17px; }
  .guide-hero p { font-size: 12px; line-height: 1.45; }
  .guide-hero .label { display: none; }
  .guide-hero-cta { gap: 4px; }
  .guide-hero-cta .btn { width: auto; height: 36px; padding: 0 14px; font-size: 12.5px; }
  .guide-hero-cta span { display: none; }

  .about { gap: 10px; }
  .about-hero { flex-direction: row; align-items: center; gap: 12px; padding: 14px; }
  .about-bear { width: 38px; }
  .about-hero h2 { font-size: 16px; margin-bottom: 2px; }
  .about-hero p { font-size: 12.5px; line-height: 1.5; }
  .about-grid { gap: 8px; }
  .about-card { gap: 4px; padding: 12px 14px; }
  .about-card h3, .about-contact h3 { font-size: 14.5px; }
  .about-card p, .about-contact p { font-size: 12.5px; line-height: 1.5; }
  .about-contact { padding: 12px 14px; gap: 10px; }

  .news { gap: 8px; }
  .news-item { gap: 4px; padding: 12px 14px; }
  .news-item h2 { font-size: 15px; }
  .news-item p { font-size: 12.5px; line-height: 1.5; }
}

/* Pekskärm: små knappar (bockrutor, pratbubblor, periodpilar, frågetecken) får en osynlig
   större tryckyta runt sig, så att de är lätta att träffa med fingret utan att se större ut */
@media (pointer: coarse) {
  .row .check, .note-btn, .period-arrow, .period-select, .info-tip { position: relative; }
  .row .check::after, .note-btn::after, .period-arrow::after, .period-select::after, .info-tip::after {
    content: '';
    position: absolute;
    inset: -8px;
  }
  .info-tip::after { inset: -10px; }
}

/* Appläge på iPhone (från hemskärmen, statusfältet ligger ovanpå sidan): inloggning, startfrågor
   och integritetssidan börjar under statusfältet/kameran och slutar ovanför hemindikatorn.
   env() är 0 i en vanlig webbläsare, så där ändras inget. */
@media (max-width: 900px) {
  .auth {
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  .ob { padding-top: env(safe-area-inset-top); padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
}
.public-main { padding-top: calc(28px + env(safe-area-inset-top)); padding-bottom: calc(48px + env(safe-area-inset-bottom)); }

/* ==========================================================================
   Navigering v3 (senaste lagret):
   Datorn: en stilren rad högst upp som följer med när man scrollar – loggan till vänster,
   sidorna i mitten, historik, nyheter och menyknappen till höger.
   Mobilen: menyraden överst (loggan, historik, nyheter, meny) och snabbmenyn i botten, nära tummen.
   Menyknappen öppnar en liten ruta med övriga sidor, konto, tema och Logga ut (båda).
   ========================================================================== */
.menu-toggle { display: inline-flex; }
.menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: calc(10px + env(safe-area-inset-right));
  z-index: 60;
  width: 230px;
  max-height: calc(100dvh - 90px - env(safe-area-inset-top));
  overflow-y: auto;
  flex-direction: column;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  transform-origin: top right;
  animation: menu-in .14s ease-out;
}
.sidebar.is-open .menu-panel { display: flex; }
.menu-panel .nav, .menu-panel .sidebar-foot { display: flex; }
.menu-panel .nav { padding: 0; gap: 1px; }
.menu-panel .nav-label, .menu-panel a[data-tab] { display: none; }
.menu-panel .nav a, .menu-panel .nav-button { height: 36px; padding: 0 10px; gap: 10px; border-radius: 9px; font-size: 13.5px; }
.menu-panel .nav a svg, .menu-panel .nav-button svg { width: 17px; height: 17px; }
.menu-panel .nav a[aria-current="page"]::before { display: none; }
.menu-panel .sidebar-foot { margin-top: 5px; padding-top: 5px; gap: 1px; border-top: 1px solid var(--line); }
.menu-panel .user { padding: 4px 10px 5px; }
.menu-panel .user-name { font-size: 12.5px; }
.menu-panel .user-email { font-size: 11px; }

@media (min-width: 901px) {
  .app { flex-direction: column; }
  .sidebar,
  [data-theme] .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px var(--gutter);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }
  [data-theme="dark"] .sidebar { background: rgba(4, 6, 11, .88); }
  [data-theme="light"] .sidebar { background: rgba(246, 249, 255, .9); }
  .brand { display: contents; }
  .brand-link { order: 1; }
  .brand-actions { order: 3; display: flex; align-items: center; gap: 6px; }
  .menu-toggle, .bell { width: 36px; height: 36px; }
  .tabbar {
    order: 2;
    display: flex;
    gap: 2px;
    margin: 0 auto;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--subtle);
  }
  .tabbar a { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
  .tabbar a svg { width: 17px; height: 17px; }
  .tabbar a:hover { color: var(--text); }
  .tabbar a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .2), inset 0 0 0 1px var(--line); }
  [data-theme="dark"] .tabbar a[aria-current="page"] svg { color: var(--accent-2); }
  [data-theme="light"] .tabbar a[aria-current="page"] svg { color: var(--accent); }
  .main { width: 100%; max-width: 1440px; margin: 0 auto; }
  .notif-panel { top: 64px; left: auto; right: var(--gutter); }
}

@media (max-width: 900px) {
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 4px calc(6px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-left));
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  [data-theme="dark"] .tabbar { background: #060910; }
  [data-theme="light"] .tabbar { background: #F6F9FF; }
  .tabbar a { flex-direction: column; min-height: 50px; gap: 3px; border-radius: 10px; font-size: 10px; background: none; }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a[aria-current="page"] { background: none; color: var(--accent); font-weight: 600; }
  [data-theme="dark"] .tabbar a[aria-current="page"] { color: #FFFFFF; }
  [data-theme="dark"] .tabbar a[aria-current="page"] svg { color: var(--accent-2); }
  .main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .support-fab { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .support-panel { inset: auto 12px calc(126px + env(safe-area-inset-bottom)) 12px; max-height: calc(100dvh - 220px); }
  .pwa-toast { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .notif-panel { top: calc(58px + env(safe-area-inset-top)); max-height: calc(100dvh - 150px); }
}
@media (min-width: 600px) and (max-width: 900px) {
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); justify-content: stretch; }
  .tabbar a { flex-direction: column; gap: 3px; min-height: 50px; font-size: 11px; }
}

/* Små menyer med val (Kopiera månad, Anpassa grupperna, Välj nyckeltal på Hem) */
.pick { position: relative; }
.pick-icon { width: 38px; padding: 0; }
.pick .pick-menu { left: auto; right: 0; transform: none; animation: none; min-width: 210px; z-index: 30; font-family: var(--font-sans); }
.pick-menu-wide { min-width: 250px; }
.pick .pick-menu button { font-family: var(--font-sans); font-size: 13px; color: var(--text); }
.pick .pick-menu [data-copy] { display: flex; justify-content: space-between; gap: 14px; }
.pick .pick-menu [data-copy] small { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.pick-note { padding: 4px 10px 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.layout-row { display: flex; align-items: center; gap: 2px; }
.pick .pick-menu .layout-check { flex: 1 1 auto; justify-content: flex-start; gap: 10px; }
.pick .pick-menu .layout-check::before { content: ''; flex-shrink: 0; width: 14px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 4px; }
.pick .pick-menu .layout-check[aria-checked="true"]::before { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 11px no-repeat; border-color: var(--accent); }
.pick .pick-menu .layout-check::after { content: none; }
.pick .pick-menu .layout-move { flex: 0 0 28px; width: 28px; padding: 0; justify-content: center; color: var(--text-2); }
.pick .pick-menu .layout-move:disabled { opacity: .25; cursor: default; }
.pick-hint { padding: 6px 10px 2px; font-size: 11px; line-height: 1.4; color: var(--text-3); }
.pick .pick-menu .pick-reset { margin-top: 4px; color: var(--accent); }

.pick-note-gap { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.pick .pick-menu .layout-check.is-radio::before { border-radius: 50%; }
.pick .pick-menu .layout-check:disabled { opacity: .4; cursor: not-allowed; }
/* Knappen Välj nyckeltal på Hem: liten, till höger ovanför rutorna */
.stats-tools { display: flex; justify-content: flex-end; margin-bottom: -6px; }
.pick-small { height: 28px; padding: 0 10px; gap: 6px; font-size: 12px; }
@media (max-width: 600px) { .stats-tools { margin-bottom: -2px; } .pick-small { height: 26px; font-size: 11.5px; } }

/* Sparat: uppdelning per sparmål/sparkonto i rutan (Hem och Månadsbudget), tydlig och läsbar */
.saved-list { display: flex; flex-direction: column; gap: 3px; width: 100%; margin-top: 2px; }
.saved-row { display: flex; justify-content: space-between; gap: 10px; min-width: 0; font-size: 12.5px; line-height: 1.35; }
.saved-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.saved-row span:last-child { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; color: var(--text); }
.saved-more { font-size: 11.5px; color: var(--text-3); }
@media (max-width: 600px) { .saved-row { font-size: 12px; } .saved-row span:last-child { font-size: 11.5px; } }
.this-month { white-space: nowrap; }

/* Månadsbudget i mobilen: månadsväljaren på en rad, knapparna mindre och jämnt fördelade på raden under */
@media (max-width: 600px) {
  body[data-page="budget"] .page-header { gap: 6px; padding-bottom: 4px; }
  body[data-page="budget"] .header-actions { gap: 6px; width: 100%; }
  body[data-page="budget"] .header-actions .btn,
  body[data-page="budget"] .header-actions .icon-btn,
  body[data-page="budget"] .header-actions .month-pill { height: 34px; font-size: 12.5px; }
  body[data-page="budget"] .header-actions .icon-btn { width: 34px; }
  body[data-page="budget"] .header-actions .month-pill { flex: 1 1 calc(100% - 80px); min-width: 0; }
  body[data-page="budget"] .header-actions .this-month { flex: 1 1 100%; order: -1; }
  body[data-page="budget"] .header-actions > .pick:not(:last-child) { flex: 1 1 0; }
  body[data-page="budget"] .header-actions > .pick:not(:last-child) .btn { width: 100%; padding: 0 10px; }
  body[data-page="budget"] #clear-all { flex: 1 1 0; padding: 0 10px; }
  body[data-page="budget"] .header-actions .pick-icon { width: 34px; }
}
@media (max-width: 600px) {
  body[data-page="budget"] .save-status:empty { display: none; }
  body[data-page="budget"] .header-actions { justify-content: stretch; }
  /* Nyckeltalen i budgeten är smala i mobilen: bara summan för Sparat (uppdelningen finns på Hem) */
  .stats .saved-list { display: none; }
}

/* Flytta genom att hålla och dra (js/reorder.js): boxen lyfts, de andra tonas ned, platsen streckas */
@media (hover: hover) and (pointer: fine) {
  .group-head, .home-blocks .section-head, .item-card .item-head, .home-stats .stat { cursor: grab; }
}
.group-head, .home-blocks .section-head, .item-card .item-head, .home-stats .stat { -webkit-touch-callout: none; }
@media (pointer: coarse) { .group-head, .home-blocks .section-head, .item-card .item-head, .home-stats .stat { -webkit-user-select: none; user-select: none; } }
.is-reordering > *:not(.is-placeholder), .is-reordering > * > *:not(.is-placeholder) { transition: opacity .15s; }
.is-reordering .group:not(.is-placeholder), .is-reordering .card:not(.is-placeholder), .is-reordering .item-card:not(.is-placeholder), .is-reordering .stat:not(.is-placeholder) { opacity: .45; }
.is-placeholder { background: transparent !important; box-shadow: none !important; border-color: transparent !important; outline: 2px dashed var(--accent); outline-offset: -2px; }
.is-placeholder > * { visibility: hidden; }
.reorder-ghost { z-index: 200; pointer-events: none; opacity: .97; will-change: transform; box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .75), 0 0 0 1px var(--accent) !important; transition: none; }
body.is-reorder-dragging { cursor: grabbing; -webkit-user-select: none; user-select: none; }

/* ==========================================================================
   Navigering v4 (senaste lagret):
   Datorn: ingen menyknapp – alla sidor i raden (även Aktier och Hjälp), och till höger
   Feedback, historik, nyheter, tema, inställningar och profilbilden (öppnar en liten profilmeny).
   Mobilen: historik, nyheter och profilbilden överst; profilmenyn har det som inte får plats.
   ========================================================================== */
@media (max-width: 900px) {
  .d-only, .tabbar a[data-desktop] { display: none !important; }
}
@media (min-width: 901px) {
  .m-only { display: none !important; }
}

/* Feedback-knappen */
.feedback-btn { order: -1; display: inline-flex; align-items: center; gap: 7px; height: 34px; margin-right: 4px; padding: 0 14px 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--subtle); color: var(--text-2); font: 500 13px var(--font-sans); cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.feedback-btn svg { width: 16px; height: 16px; }
.feedback-btn:hover, .feedback-btn:focus-visible { color: var(--text); border-color: var(--line-strong); }

/* Ikonerna till höger (samma utseende som klockorna) */
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text-2); cursor: pointer; transition: color .2s, background .2s, border-color .2s; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--text); background: var(--subtle); border-color: var(--line-strong); }
.brand-actions .icon-btn[aria-current="page"] { color: var(--text); background: var(--subtle); border-color: var(--line-strong); }
.brand-actions .icon-btn svg { width: 18px; height: 18px; }

/* Profilbilden (öppnar profilmenyn) */
.brand-actions .avatar-btn { order: 10; display: inline-flex; align-items: stretch; flex-shrink: 0; width: 36px; height: 36px; margin-left: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 50%; background: none; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.brand-actions .avatar-btn:hover, .brand-actions .avatar-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.avatar { display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2, var(--accent))); color: #FFFFFF; font-size: 13px; font-weight: 600; line-height: 1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { flex-shrink: 0; width: 40px; height: 40px; font-size: 16px; }

/* Profilmenyn */
.menu-panel { width: 250px; }
.menu-user { display: flex; align-items: center; gap: 11px; margin: 0 0 5px; padding: 8px 10px 11px; border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; color: var(--text); text-decoration: none; }
.menu-user:hover { background: var(--subtle); }
.menu-panel .menu-user .user { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 0; }
.menu-panel .menu-user .user-name { font-size: 14px; font-weight: 600; }
.menu-panel .nav a[aria-current="page"] { background: var(--subtle); color: var(--text); }

/* Sju sidor i raden på datorn: tätare när skärmen är smalare */
@media (min-width: 901px) and (max-width: 1240px) {
  .sidebar, [data-theme] .sidebar { gap: 10px; }
  .tabbar a { padding: 0 11px; gap: 6px; font-size: 13px; }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .brand-link span { display: none; }
  .feedback-btn { width: 34px; padding: 0; justify-content: center; margin-right: 0; }
  .feedback-btn span { display: none; }
  .tabbar a { padding: 0 9px; }
  .brand-actions { gap: 4px; }
}
@media (min-width: 901px) and (max-width: 1000px) {
  .tabbar a svg { display: none; }
}

/* Feedback-rutan */
.feedback-panel { position: fixed; z-index: 70; width: 380px; max-width: calc(100vw - 24px); padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(-4px); transition: opacity .14s ease-out, transform .14s ease-out; }
.feedback-panel.is-open { opacity: 1; transform: none; }
.feedback-panel.is-centered { top: calc(64px + env(safe-area-inset-top)); left: 12px; right: 12px; width: auto; max-width: 440px; margin: 0 auto; }
.feedback-panel h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.feedback-step[data-step="choose"] h2 { margin-bottom: 12px; }
.feedback-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.feedback-choice { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 20px 10px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--subtle); color: var(--text); font-family: var(--font-sans); cursor: pointer; transition: border-color .15s, transform .15s, background .15s; }
.feedback-choice:hover, .feedback-choice:focus-visible { border-color: var(--line-strong); transform: translateY(-1px); }
.feedback-choice svg { margin-bottom: 6px; }
.feedback-choice.is-issue svg { color: #F87171; }
.feedback-choice.is-idea svg { color: #FBBF24; }
.feedback-choice strong { font-size: 15px; font-weight: 600; }
.feedback-choice span { font-size: 12.5px; color: var(--text-3); }
.feedback-head { display: flex; align-items: center; gap: 6px; margin: -4px 0 10px -6px; }
.feedback-back { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--text-2); cursor: pointer; }
.feedback-back:hover { background: var(--subtle); color: var(--text); }
.feedback-text { width: 100%; min-height: 120px; padding: 10px 12px; font-size: 14px; line-height: 1.5; resize: vertical; }
.feedback-panel .msg-error:empty { display: none; }
.feedback-panel .msg-error { margin-top: 8px; }
.feedback-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.feedback-note { min-width: 0; font-size: 11.5px; line-height: 1.4; color: var(--text-3); overflow-wrap: anywhere; }
.feedback-foot .btn { flex-shrink: 0; height: 36px; padding: 0 18px; }
.feedback-done { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 4px; text-align: center; }
.feedback-done p { margin: 0 0 8px; font-size: 13.5px; color: var(--text-2); }
.support-fab { display: none !important; }

/* Korta namn på ikonerna (data-hint), visas under knappen när man pekar med musen */
.tooltip.is-hint { max-width: none; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; white-space: nowrap; }

/* Sidorna exakt i mitten av raden: tre kolumner där loggan och ikonerna får lika mycket plats var */
@media (min-width: 901px) {
  .sidebar, [data-theme] .sidebar { display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); }
  .sidebar .brand-link { grid-column: 1; justify-self: start; }
  .sidebar .tabbar { grid-column: 2; margin: 0; }
  .sidebar .brand-actions { grid-column: 3; justify-self: end; }
}

/* Små telefoner (t.ex. iPhone SE, 320–360 px): inget bryts på två rader och kategorinamnen får mer plats */
body[data-page="budget"] .header-actions .btn { white-space: nowrap; }
body[data-page="budget"] .group-head { touch-action: manipulation; } /* två snabba tryck = byt namn (ingen zoom) */
body[data-page="budget"] .group-head h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 360px) {
  body[data-page="budget"] .header-actions { gap: 5px; }
  body[data-page="budget"] .header-actions .btn { font-size: 12px; }
  body[data-page="budget"] .header-actions > .pick:not(:last-child) .btn, body[data-page="budget"] #clear-all { padding: 0 6px; }
  body[data-page="budget"] .row { gap: 2px; }
  body[data-page="budget"] .row .handle { width: 16px; }
  body[data-page="budget"] .row .note-btn { width: 20px; }
  body[data-page="budget"] .row .amt { width: 70px; padding: 0 8px; }
  body[data-page="budget"] .row .del { width: 20px; }
  body[data-page="budget"] .row .kr { font-size: 11px; }
  body[data-page="budget"] .group-head { gap: 6px; }
  .quick-save { gap: 5px; }
}
/* Det som lyses upp från Visa mig ska inte hamna under menyraden */
.is-spotlight { scroll-margin-top: 90px; scroll-margin-bottom: 90px; }

/* Profilmenyn i grupper: sidor, du själv (mobil), appen, Logga ut – med tunna linjer emellan */
.menu-panel .nav { display: flex; flex-direction: column; gap: 0; }
.menu-panel .menu-section { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; }
.menu-panel .menu-section + .menu-section { border-top: 1px solid var(--line); }
.menu-panel .menu-section:first-child { padding-top: 0; }
@media (min-width: 901px) {
  /* På datorn finns bara Nyheter kvar i första gruppen */
  .menu-panel .menu-section.m-only + .menu-section { border-top: 1px solid var(--line); }
}
.menu-panel .sidebar-foot { margin-top: 0; padding-top: 4px; }
.menu-panel .nav a, .menu-panel .nav-button { font-weight: 450; }
.menu-panel .nav a svg, .menu-panel .nav-button svg { color: var(--text-3); }
.menu-panel .nav a:hover svg, .menu-panel .nav-button:hover svg, .menu-panel .nav a[aria-current="page"] svg { color: var(--accent); }
.menu-panel [data-sign-out]:hover { color: #F87171; }
.menu-panel [data-sign-out]:hover svg { color: #F87171; }

/* Feedback i mobilens menyrad: bara ikonen, samma form som klockorna */
@media (max-width: 900px) {
  .brand-actions .feedback-btn { order: 0; width: 38px; height: 38px; margin: 0; padding: 0; justify-content: center; border-radius: 50%; background: transparent; }
  .brand-actions .feedback-btn span { display: none; }
  .brand-actions .feedback-btn svg { width: 18px; height: 18px; }
}
@media (max-width: 600px) { .brand-actions .feedback-btn { width: 34px; height: 34px; } }
@media (max-width: 360px) { .brand-actions .feedback-btn { width: 30px; height: 30px; } .brand-actions .feedback-btn svg { width: 15px; height: 15px; } }

/* Notiserna: rubrik, en kort mening och datum – luftigt med tunna linjer emellan */
.notif-list { padding: 0 6px; }
.notif-list li + li { border-top: 1px solid var(--line); }
.notif-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 10px 8px; border-radius: 10px; }
.notif-body { gap: 2px; }
.notif-body strong { font-size: 13px; font-weight: 600; line-height: 1.35; }
.notif-body span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; line-height: 1.45; color: var(--text-3); }
.notif-item time { padding-top: 2px; font-size: 10px; }
.notif-dot { margin-top: 5px; }
@media (max-width: 600px) {
  .notif-item { gap: 8px; padding: 9px 6px; }
  .notif-body strong { font-size: 12.5px; }
  .notif-body span { font-size: 11.5px; }
}

/* Skylten om flytten till ursusbudget.se (js/moved.js), överst på sidan */
.moved-banner { position: relative; z-index: 80; display: flex; align-items: center; gap: 14px; padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--accent); background: var(--accent-tint); color: var(--text); }
[data-theme="dark"] .moved-banner { background: #0B1F45; }
.moved-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.moved-text strong { font-size: 14px; font-weight: 600; }
.moved-text span { font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.moved-go { flex-shrink: 0; height: 36px; padding: 0 14px; font-size: 13px; }
@media (max-width: 600px) {
  .moved-banner { flex-direction: column; align-items: stretch; gap: 10px; }
  .moved-go { width: 100%; justify-content: center; }
}

/* Tydligt men diskret: att ekonomin är privat (Hem och Månadsbudget) */
.privacy-note { display: inline-flex; align-items: center; gap: 7px; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--text-3); text-decoration: none; }
.privacy-note svg { flex-shrink: 0; color: #1BAF7A; }
.privacy-note:hover { color: var(--text-2); }
.privacy-pill { margin-top: 6px; padding: 3px 10px 3px 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; }
.page-title .privacy-pill { align-self: flex-start; }
@media (max-width: 600px) {
  .privacy-note { font-size: 12px; }
  .privacy-pill { margin-top: 4px; font-size: 11px; }
}

/* Profilmenyn: temat som val (Mörkt / Ljust) med bock */
.menu-panel .menu-label { padding: 6px 10px 2px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.menu-panel .menu-theme .nav-button { position: relative; }
.menu-panel .menu-theme .theme-check { display: none; margin-left: auto; width: 14px; height: 14px; color: var(--accent); }
.menu-panel .menu-theme [aria-checked="true"] { color: var(--text); }
.menu-panel .menu-theme [aria-checked="true"] .theme-check { display: block; }
.menu-panel .menu-theme .icon-moon, .menu-panel .menu-theme .icon-sun-static { display: block !important; }

/* Skärmlåset (js/lock.js): sidan suddas ut och en liten ruta visas */
.is-locked .app { filter: blur(18px) saturate(.6); pointer-events: none; user-select: none; }
.is-locked body { overflow: hidden; }
.is-locked .notif-panel, .is-locked .feedback-panel, .is-locked .tooltip { display: none !important; }
.lock-screen { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 20px; background: rgba(4, 6, 11, .55); }
[data-theme="light"] .lock-screen { background: rgba(230, 236, 248, .55); }
.lock-screen[hidden] { display: none; }
.lock-card { display: flex; flex-direction: column; align-items: center; gap: 10px; width: min(340px, 100%); padding: 26px 22px 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-pop); text-align: center; }
.lock-badge { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 2px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); }
.lock-card h2 { margin: 0; font-size: 18px; font-weight: 600; }
.lock-hint { margin: 0 0 4px; font-size: 13px; line-height: 1.45; color: var(--text-2); }
.lock-input { width: 100%; height: 44px; font-size: 15px; text-align: center; }
.lock-input.is-masked { -webkit-text-security: disc; }
.lock-input.is-pin { font-family: var(--font-mono); font-size: 22px; letter-spacing: .5em; text-indent: .5em; }
.lock-error:empty { display: none; }
.lock-error { width: 100%; }
.lock-card .btn-block { width: 100%; height: 42px; }
.lock-addpin { display: flex; align-items: flex-start; gap: 8px; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--text-2); text-align: left; cursor: pointer; }
.lock-addpin[hidden] { display: none; }
.lock-addpin input { margin-top: 2px; accent-color: var(--accent); }
.lock-links { display: flex; justify-content: space-between; gap: 12px; width: 100%; margin-top: 6px; }
.lock-links .link-button { font-size: 12.5px; }
.lock-links .link-button[hidden] { display: none; }
.lock-links .lock-out { margin-left: auto; color: var(--text-3); }

/* Menyraden: lika mycket plats på båda sidor så att sidorna alltid står i mitten.
   Ikonerna till höger blir mindre och Feedback bara en ikon när skärmen är smalare. */
@media (min-width: 901px) and (max-width: 1380px) {
  .brand-actions .feedback-btn { width: 34px; padding: 0; justify-content: center; margin-right: 0; }
  .brand-actions .feedback-btn span { display: none; }
}
@media (min-width: 901px) and (max-width: 1240px) {
  .brand-actions { gap: 4px; }
  .brand-actions .bell, .brand-actions .icon-btn, .brand-actions .feedback-btn { width: 32px; height: 32px; }
  .brand-actions .avatar-btn { width: 32px; height: 32px; }
}
/* Minsta telefonerna: fem ikoner uppe till höger, så ordet URSUS göms (björnen står kvar) */
@media (max-width: 360px) { .brand-link span { display: none; } }

/* Historik och notiser i mobilen: kortare, så att de inte täcker hela sidan */
@media (max-width: 900px) {
  .notif-panel, .activity-panel { max-height: min(58dvh, 440px); }
}

/* Ögat i lösenords- och kodfält (js/eye.js) */
.eye-wrap { position: relative; display: block; width: 100%; }
.eye-wrap[hidden] { display: none; }
.eye-wrap > .field { width: 100%; padding-right: 44px; }
.eye-btn { position: absolute; top: 50%; right: 6px; display: grid; place-items: center; width: 32px; height: 32px; transform: translateY(-50%); border: 0; border-radius: 8px; background: none; color: var(--text-3); cursor: pointer; }
.eye-btn:hover, .eye-btn[aria-pressed="true"] { color: var(--text); background: var(--subtle); }
.lock-card .eye-wrap > .lock-input { padding-left: 44px; }
.pref-inline .eye-wrap { flex: 1 1 auto; width: auto; min-width: 0; }

/* Låsrutan: välj automatiskt lås */
.lock-times { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; width: 100%; }
.lock-times[hidden] { display: none; }
.lock-times button { height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--subtle); color: var(--text-2); font: 500 13px var(--font-sans); cursor: pointer; }
.lock-times button:hover { color: var(--text); border-color: var(--line-strong); }
.lock-times button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-tint); color: var(--text); }

/* Rullgardinslistor: läsbara val i mörkt läge (webbläsarens lista är annars vit) */
[data-theme="dark"] select option { background-color: #0E1320; color: #E9ECF2; }
[data-theme="light"] select option { background-color: #FFFFFF; color: #0E1116; }
