/* =========================================================
   Greedlist – Designsystem
   Ljust tema i :root, mörkt via [data-theme="dark"]. Båda är
   kompletta paletter; 'auto' löses i header.ejs mot systemet.
   Typografi: Young Serif (display) + DM Sans (UI).
   ========================================================= */

:root {
  color-scheme: light;

  /* Accent – guld/amber. --accent-ink är texten PÅ accent. */
  --accent: #D9971E;
  --accent-ink: #1E1813;
  --accent-soft: rgba(217, 151, 30, 0.16);
  --accent-soft-2: rgba(217, 151, 30, 0.09);
  --link: #8F620C;

  /* Sekundära färger (avatarer, tillfällen, statusar) */
  --berry: #B8456A;
  --sage: #6F8B62;
  --sky: #4F7FA8;
  --plum: #7A5C9E;
  --rust: #B5613A;
  --danger: #C83F3F;
  --danger-soft: rgba(200, 63, 63, 0.12);
  --ok: #3E7A4A;
  --ok-soft: rgba(79, 138, 91, 0.14);

  /* Ytor och text */
  --bg: #FAF6EF;
  --surface: #FFFFFF;
  --surface-2: #F3EDE2;
  --surface-3: #EAE2D4;
  --text: #1E1813;
  --text-2: rgba(30, 24, 19, 0.64);
  --text-3: rgba(30, 24, 19, 0.56);
  --line: rgba(30, 24, 19, 0.10);
  --line-2: rgba(30, 24, 19, 0.18);

  /* Primärknapp = "bläck" (inverteras i mörkt tema) */
  --ink: #1E1813;
  --ink-text: #FAF6EF;

  /* Spacing */
  --page-pad: 20px;
  --gap: 12px;
  --pad-card: 16px;

  /* Radier */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 999px;

  --transition: 160ms ease;
  --font-ui: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Young Serif', Georgia, 'Times New Roman', serif;
  --tabbar-h: 62px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --accent: #F0B54A;
  --accent-ink: #15110E;
  --accent-soft: rgba(240, 181, 74, 0.16);
  --accent-soft-2: rgba(240, 181, 74, 0.09);
  --link: #F0B54A;

  --berry: #D9688A;
  --sage: #8FAA80;
  --sky: #7FA9CE;
  --plum: #A98BCB;
  --rust: #D98A63;
  --danger: #E05A5A;
  --danger-soft: rgba(224, 90, 90, 0.16);
  --ok: #7DB88A;
  --ok-soft: rgba(125, 184, 138, 0.16);

  --bg: #15110E;
  --surface: #1F1A16;
  --surface-2: #2A231E;
  --surface-3: #352D27;
  --text: #F4EEE5;
  --text-2: rgba(244, 238, 229, 0.66);
  --text-3: rgba(244, 238, 229, 0.58);
  --line: rgba(244, 238, 229, 0.09);
  --line-2: rgba(244, 238, 229, 0.16);

  --ink: #F4EEE5;
  --ink-text: #15110E;
}

/* =========================================================
   Reset + bas
   ========================================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* =========================================================
   Typografi
   ========================================================= */
.display-xl, .display-lg, .display-md, .display-sm {
  font-family: var(--font-display);
  font-weight: 400;          /* Young Serif finns bara i en vikt */
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.display-xl { font-size: 36px; }
.display-lg { font-size: 30px; }
.display-md { font-size: 24px; }
.display-sm { font-size: 19px; line-height: 1.15; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.lead { font-size: 17px; line-height: 1.5; color: var(--text-2); }
.text-center { text-align: center; }
.wordmark {
  font-family: var(--font-display); font-weight: 400; font-size: 22px; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 8px; color: var(--text);
}
.wordmark:hover { text-decoration: none; }
.wordmark-symbol { width: 32px; height: auto; margin-top: -4px; }

/* =========================================================
   Layout
   ========================================================= */
.app { display: flex; flex-direction: column; min-height: 100vh; max-width: 680px; margin: 0 auto; }
main {
  flex: 1;
  padding: var(--page-pad);
  padding-top: max(var(--page-pad), calc(env(safe-area-inset-top) + 8px));
  padding-bottom: calc(var(--page-pad) * 2);
  display: flex; flex-direction: column; gap: 22px;
}
.app.has-tabbar main { padding-bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }

.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; align-items: center; gap: var(--gap); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head .eyebrow { margin: 0; }
.section-link { font-size: 13px; font-weight: 600; }

/* Sidhuvud */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-header-main { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.page-header-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.page-header-text .display-lg { overflow-wrap: anywhere; }
.page-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; padding-top: 2px; }

/* Modal-liknande topprad (Avbryt / Titel / Spara) */
.sheet-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.sheet-bar .sheet-title { font-weight: 700; font-size: 16px; text-align: center; }
.sheet-bar .sheet-right { text-align: right; }
.sheet-bar a, .sheet-bar button.link-btn { font-weight: 600; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around;
  max-width: 680px; margin: 0 auto;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px 0; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  border-radius: var(--radius-sm); transition: color var(--transition);
}
.tab:hover { text-decoration: none; color: var(--text-2); }
.tab.is-active { color: var(--text); }
.tab .icon { width: 22px; height: 22px; }
.tab.is-active .icon { color: var(--accent); }
.tab-icon-wrap { position: relative; display: inline-flex; }
.tab-badge {
  position: absolute; top: -5px; right: -9px; min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: var(--radius-full); background: var(--accent); color: var(--accent-ink);
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}

/* =========================================================
   Ikoner
   ========================================================= */
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 26px; height: 26px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-full);
  color: var(--text-2); background: transparent; border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.is-outlined { border-color: var(--line-2); }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark { display: none; }

/* =========================================================
   Kort
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--pad-card);
}
.card-tight { padding: 12px 14px; }
/* Listkort med stjärnknapp: kortet länkar, stjärnan sätter huvudlista. */
.list-card { display: flex; align-items: center; gap: 10px; }
.list-card-main { flex: 1 1 auto; min-width: 0; color: var(--text); }
.list-card-main:hover { text-decoration: none; }
.star-on { color: var(--accent); fill: currentColor; }
.card-soft { background: var(--surface-2); border-color: transparent; }
a.card { color: inherit; display: block; transition: border-color var(--transition), transform var(--transition); }
a.card:hover { text-decoration: none; border-color: var(--accent); }

/* Hero-kort (egen lista på Hem) */
.hero-card {
  position: relative; overflow: hidden;
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius-xl); padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  transition: transform var(--transition), filter var(--transition);
}
a.hero-card { color: var(--accent-ink); }
a.hero-card:hover { text-decoration: none; filter: brightness(1.03); }
.hero-card::after {
  content: ''; position: absolute; right: -40px; top: -60px; width: 190px; height: 190px;
  border-radius: 50%; background: rgba(255, 255, 255, 0.16); pointer-events: none;
}
.hero-card .eyebrow { color: rgba(30, 24, 19, 0.6); }
.hero-card .display-md { color: inherit; }
.hero-card .hero-meta { font-size: 14px; font-weight: 500; color: rgba(30, 24, 19, 0.72); }
.hero-count {
  background: var(--ink); color: var(--ink-text);
  border-radius: var(--radius-full); padding: 6px 12px; font-weight: 700; font-size: 14px;
  white-space: nowrap; align-self: flex-start;
}
[data-theme="dark"] .hero-card { --ink: #15110E; --ink-text: #F4EEE5; }

/* Rad-listor (På gång, Delad med, notiser) */
.row-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px; color: inherit;
  border-top: 1px solid var(--line); transition: background var(--transition);
}
.row-item:first-child { border-top: 0; }
a.row-item:hover { background: var(--surface-2); text-decoration: none; }
.row-item.is-unread { background: var(--accent-soft-2); }
.row-title { font-weight: 600; font-size: 15px; line-height: 1.3; }
.row-sub { font-size: 13px; color: var(--text-2); line-height: 1.35; }
.row-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.row-item .chevron { color: var(--text-3); margin-left: auto; }

/* Datumruta */
.date-box {
  width: 48px; height: 48px; border-radius: var(--radius-md); flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; line-height: 1;
}
.date-box .d { font-weight: 700; font-size: 17px; }
.date-box .m { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.9; }
.tone-berry { background: var(--berry); } .tone-sage { background: var(--sage); }
.tone-sky { background: var(--sky); } .tone-plum { background: var(--plum); }
.tone-rust { background: var(--rust); } .tone-gold { background: var(--accent); color: var(--accent-ink); }

/* Notis-ikonruta */
.notif-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.notif-icon.tone-gold { color: var(--accent-ink); }

/* Banners */
.banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-md);
  font-size: 14px; line-height: 1.45; font-weight: 500;
}
.banner .icon { width: 18px; height: 18px; margin-top: 2px; }
.banner-soft { background: var(--accent-soft); color: var(--text); }
.banner-ink { background: var(--ink); color: var(--ink-text); }
.banner-ink .icon { color: var(--accent); }
.banner-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }

/* Nedräkning – egna tillfällen och egen födelsedag på hemskärmen. Emojin byts
   dag för dag, tonen skiljer jul från födelsedag från övriga tillfällen. */
.countdown {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: var(--radius-lg);
  border: 1px solid transparent; color: var(--text);
}
.countdown:hover { text-decoration: none; }
.countdown-emoji {
  width: 42px; height: 42px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 23px; line-height: 1;
  border-radius: var(--radius-full); background: var(--bg);
}
.countdown-head { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; }
.countdown-sub { display: block; font-size: 13px; color: var(--text-2); margin-top: 2px; }
.countdown-days {
  font-family: var(--font-display); font-size: 27px; line-height: 1; padding-left: 4px;
}
.countdown-event { background: var(--accent-soft); border-color: var(--accent-soft); }
.countdown-event .countdown-days { color: var(--accent); }
.countdown-jul {
  background: color-mix(in srgb, var(--sage) 18%, transparent);
  border-color: color-mix(in srgb, var(--sage) 30%, transparent);
}
.countdown-jul .countdown-days { color: var(--sage); }
.countdown-birthday {
  background: color-mix(in srgb, var(--berry) 15%, transparent);
  border-color: color-mix(in srgb, var(--berry) 28%, transparent);
}
.countdown-birthday .countdown-days { color: var(--berry); }

/* Notiser/meddelanden */
.notice { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
.notice-ok { background: var(--ok-soft); color: var(--ok); }
.notice-info { background: var(--accent-soft); color: var(--text); }

/* =========================================================
   Knappar
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; min-height: 46px;
  border-radius: var(--radius-md); font-weight: 600; font-size: 15px; line-height: 1;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), opacity var(--transition);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: default; pointer-events: none; }
/* Skrivskyddade fält (t.ex. mailadressen på profilen): ser ut som text i en ruta */
input[readonly] { background: var(--surface-2); color: var(--text-2); cursor: default; }
input[readonly]:focus { border-color: var(--line-2); box-shadow: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: var(--ink-text); }
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.05); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--link); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; min-height: 34px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }
.link-btn { color: var(--link); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.inline { display: inline; }
.is-done { color: var(--ok) !important; }

/* Fokus */
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .link-btn:focus-visible, .item-actions button:focus-visible, .item-actions a:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1.5px var(--accent);
}

/* Pills & badges */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
button.pill { border: none; font-family: inherit; cursor: pointer; }
button.pill:hover { color: var(--text); }
.pill-accent { background: var(--accent-soft); color: var(--text); }
.pill-ink { background: var(--ink); color: var(--ink-text); }
.pill .icon { width: 12px; height: 12px; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-muted { background: var(--surface-3); color: var(--text-3); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }

/* =========================================================
   Formulär
   ========================================================= */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label, .form-label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.form-hint { font-size: 13px; color: var(--text-3); line-height: 1.4; }
.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1; min-width: 0; }
.form-row > .w-narrow { flex: 0 0 90px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 13px 14px; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; min-width: 0; }
.input-with-btn .btn { flex-shrink: 0; }

/* Toggle */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 4px 0; }
.toggle-row .toggle-text { display: flex; flex-direction: column; gap: 2px; }
.toggle-row .toggle-title { font-weight: 600; font-size: 15px; }
.toggle-row .toggle-sub { font-size: 13px; color: var(--text-2); }
.toggle { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle .track { position: absolute; inset: 0; border-radius: var(--radius-full); background: var(--line-2); transition: background var(--transition); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform var(--transition); }
.toggle input:checked ~ .track { background: var(--accent); }
.toggle input:checked ~ .knob { transform: translateX(20px); }
.toggle input:focus-visible ~ .track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* Segmenterad kontroll (tema, prioritet) */
.segmented { display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; gap: 4px; }
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 6px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.segmented input:checked + span { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.segmented .icon { width: 16px; height: 16px; }

/* =========================================================
   Önskningskort
   ========================================================= */
.item-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; transition: border-color var(--transition), opacity var(--transition);
}
.item-card.is-mine { border-color: var(--accent); }
.item-card.is-paxad .item-thumb, .item-card.is-paxad .item-title, .item-card.is-paxad .item-note, .item-card.is-paxad .item-price { opacity: 0.55; }
.item-card.is-paxad { background: var(--surface-2); border-style: dashed; }
.item-card.is-received { opacity: 0.7; }
.item-main { display: flex; gap: 14px; padding: 14px; }
.item-thumb {
  width: 76px; height: 76px; border-radius: var(--radius-md); flex-shrink: 0; overflow: hidden;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  color: var(--text-3); position: relative;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Bildförhandsvisning i önskningsformuläret */
.image-preview { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.image-preview[hidden] { display: none; }
.image-preview img { width: 88px; height: 88px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); flex-shrink: 0; }
.item-thumb.is-placeholder .icon { width: 26px; height: 26px; }
.item-thumb .thumb-domain {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 4px;
  font-family: ui-monospace, Menlo, monospace; font-size: 8px; text-align: center;
  background: var(--surface-3); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-thumb.is-small { width: 40px; height: 40px; border-radius: var(--radius-xs); }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item-title { font-weight: 600; font-size: 16px; line-height: 1.25; overflow-wrap: anywhere; }
.item-title a { color: inherit; }
.item-note { font-size: 13px; color: var(--text-2); line-height: 1.4; white-space: pre-line; }
.item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.item-price { font-weight: 600; color: var(--link); }
.item-domain { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-3); }
.item-domain a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.item-domain .icon { width: 12px; height: 12px; }
.item-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.item-actions { display: flex; border-top: 1px solid var(--line); }
.item-actions > form { display: contents; }
.item-actions > *:not(form), .item-actions > form > * {
  flex: 1 1 0; min-width: 0; min-height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 8px; font-size: 14px; font-weight: 600; color: var(--text-2); text-align: center; line-height: 1.2;
  border-left: 1px solid var(--line); transition: background var(--transition), color var(--transition);
}
.item-actions > *:first-child, .item-actions > form:first-child > * { border-left: 0; }
.item-actions > * + form > *, .item-actions > form + * , .item-actions > form + form > * { border-left: 1px solid var(--line); }
.item-actions button, .item-actions a { cursor: pointer; text-decoration: none; }
.item-actions button:hover, .item-actions a:hover { background: var(--accent-soft-2); color: var(--text); text-decoration: none; }
.item-actions .primary { color: var(--link); }
.item-actions .accent { background: var(--accent); color: var(--accent-ink); }
.item-actions .accent:hover { filter: brightness(1.05); color: var(--accent-ink); background: var(--accent); }
.item-actions .disabled { color: var(--text-3); cursor: default; }
.item-actions .disabled:hover { background: none; color: var(--text-3); }
.item-actions .icon { width: 16px; height: 16px; }
.priority-stars { display: inline-flex; gap: 1px; color: var(--accent); }
.priority-stars .icon { width: 13px; height: 13px; fill: currentColor; }

/* Mottaget-rad (Fått-sektionen) */
.received-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-md); }
.received-row .item-thumb { width: 40px; height: 40px; border-radius: var(--radius-xs); opacity: 0.7; }
.received-row .row-title { text-decoration: line-through; color: var(--text-2); font-weight: 500; }

/* Avatarer */
.avatar { display: inline-flex; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.avatar-sm { width: 36px; height: 36px; }
.avatar-md { width: 44px; height: 44px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 88px; height: 88px; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 40%; font-size: 17px; }
.avatar-lg .avatar-initial { font-size: 21px; } .avatar-xl .avatar-initial { font-size: 34px; } .avatar-sm .avatar-initial { font-size: 14px; }
.avatar-hue-berry { background: var(--berry); } .avatar-hue-sage { background: var(--sage); }
.avatar-hue-sky { background: var(--sky); } .avatar-hue-gold { background: var(--accent); color: var(--accent-ink); }
.avatar-hue-plum { background: var(--plum); } .avatar-hue-rust { background: var(--rust); }
a.avatar:hover { text-decoration: none; }
.avatar-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.avatar-row::-webkit-scrollbar { display: none; }
.avatar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; flex-shrink: 0; color: inherit; font-size: 13px; font-weight: 500; text-align: center; }
.avatar-col:hover { text-decoration: none; }
.avatar-col .avatar-name { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-invite .avatar-initial { background: var(--surface-3); color: var(--text-3); }

/* Tomt tillstånd */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 20px; }
.empty-state-icon { font-size: 44px; line-height: 1; }
.empty-state .btn { margin-top: 8px; }
.empty-card .icon-lg { color: var(--accent); }
.empty-card { border: 1px dashed var(--line-2); border-radius: var(--radius-lg); padding: 24px 18px; text-align: center; color: var(--text-2); font-size: 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* Auth */
.auth-wrap { display: flex; flex-direction: column; gap: 26px; padding-top: 20px; max-width: 440px; width: 100%; margin: 0 auto; }
.auth-wrap .display-xl { text-wrap: balance; font-size: 28px; }
/* Stor symbol överst på inloggning/registrering, liten på Hem */
.auth-top { display: flex; justify-content: flex-end; margin-bottom: -26px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--text); }
.auth-brand:hover { text-decoration: none; }
.auth-brand img { width: 200px; height: auto; }
.auth-brand .wordmark { font-size: 28px; }
.auth-brand + .stack-sm { text-align: center; }
.header-brand { align-items: center; gap: 12px; }
.header-brand img { width: 48px; height: auto; flex-shrink: 0; display: block; }
.auth-footnote { text-align: center; font-size: 13px; color: var(--text-3); }
.auth-alt { text-align: center; font-size: 14px; color: var(--text-2); }
.icon-tile { width: 92px; height: 92px; border-radius: 30px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.icon-tile .icon { width: 42px; height: 42px; }

/* Kodblock och länkrad */
.code-block { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.link-row { display: flex; align-items: center; gap: 10px; }
.link-row .url { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Divider */
.divider { height: 1px; background: var(--line); }

/* Spinner */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Deltagarlista (Gå ihop) */
.participants { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.participants .avatar { width: 24px; height: 24px; }
.participants .avatar-initial { font-size: 11px; }

/* Notisnivå per vän (vänlistan): alla = accent, viktiga = dämpad, inga = röd */
.notif-level.lvl-all { color: var(--accent); }
.notif-level.lvl-important { color: var(--text-2); }
.notif-level.lvl-none { color: var(--danger); }

/* Chatt i Gå ihop (inuti önskningskortet, ovanför knapparna) */
.chat { border-top: 1px solid var(--line); }
.chat summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
.chat summary::-webkit-details-marker { display: none; }
.chat summary:hover { background: var(--accent-soft-2); }
.chat summary .icon { width: 18px; height: 18px; color: var(--accent); }
.chat summary .chat-chevron { color: var(--text-3); transition: transform var(--transition); }
.chat[open] summary .chat-chevron { transform: rotate(90deg); }
.chat-log { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; padding: 4px 14px 12px; }
.chat-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.chat-msg.is-me { align-self: flex-end; align-items: flex-end; }
.chat-author { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 0 4px 2px; }
.chat-bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); border-top-left-radius: var(--radius-xs); padding: 8px 12px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.is-me .chat-bubble { background: var(--accent-soft); border-color: transparent; border-top-left-radius: var(--radius-md); border-top-right-radius: var(--radius-xs); }
.chat-time { font-size: 11px; color: var(--text-3); margin: 2px 4px 0; }
.chat-form { padding: 0 14px 14px; }
.chat-error { color: var(--danger); padding: 0 14px 12px; margin-top: -6px; }

/* Under-flikar */
.subtabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.subtabs a { padding: 10px 12px; font-weight: 600; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a:hover { text-decoration: none; color: var(--text); }
.subtabs a.is-active { color: var(--text); border-bottom-color: var(--accent); }

/* Definition-lista (profil, admin) */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }

/* Tabell (admin) */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 600; }

@media (min-width: 560px) {
  .display-xl { font-size: 42px; }
  .display-lg { font-size: 34px; }
}
