/* Nystarten CMS - designsystem
   Apple-inspirerat: systemtypsnitt med optisk spårning, translucenta ytor,
   fjädrande mikrorörelser, ljust/mörkt läge, reducerad rörelse respekteras. */

:root {
  color-scheme: light dark;
  --blue: #213a8f;
  --blue-dark: #2e276c;
  --sky: #6cb5db;
  --light: #c7e5f4;
  --lightest: #e4f4fd;
  --ink: #0d1b3e;
  --green: #1e9e56;
  --orange: #e08700;
  --red: #e51834;

  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --chrome: rgba(248, 249, 252, 0.78);
  --sidebar: rgba(244, 245, 250, 0.86);
  --text: #0d1b3e;
  --text-2: #55608a;
  --text-3: #8b93b4;
  --hairline: rgba(13, 27, 62, 0.1);
  --hairline-2: rgba(13, 27, 62, 0.06);
  --accent: #2b4bb5;
  --accent-press: #213a8f;
  --tint: rgba(43, 75, 181, 0.09);
  --shadow-sm: 0 1px 2px rgba(13, 27, 62, 0.05), 0 1px 8px rgba(13, 27, 62, 0.04);
  --shadow-md: 0 2px 8px rgba(13, 27, 62, 0.07), 0 8px 32px rgba(13, 27, 62, 0.09);
  --shadow-lg: 0 4px 16px rgba(13, 27, 62, 0.1), 0 24px 64px rgba(13, 27, 62, 0.18);

  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, Arial, sans-serif;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);       /* kritiskt dämpad känsla */
  --spring-pop: cubic-bezier(0.34, 1.3, 0.5, 1);  /* liten studs för momentum */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101118;
    --surface: #1b1d27;
    --surface-2: #22242f;
    --chrome: rgba(20, 21, 30, 0.75);
    --sidebar: rgba(16, 17, 24, 0.82);
    --text: #eef0f8;
    --text-2: #9aa3c7;
    --text-3: #6a7194;
    --hairline: rgba(238, 240, 248, 0.12);
    --hairline-2: rgba(238, 240, 248, 0.07);
    --accent: #7a97f0;
    --accent-press: #93abf5;
    --tint: rgba(122, 151, 240, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.35), 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4), 0 24px 64px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.008em;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }

/* ── Inloggning ─────────────────────────────────────────── */

.login-scene[hidden] { display: none; }
.login-scene {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(108, 181, 219, 0.25), transparent 60%),
    radial-gradient(50rem 36rem at 110% 110%, rgba(33, 58, 143, 0.22), transparent 55%),
    var(--bg);
  padding: 24px;
}
.login-card {
  width: min(23.5rem, 100%);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 44px 40px 36px;
  text-align: center;
  animation: login-in 0.55s var(--spring) both;
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.login-logo {
  width: 58px; height: 58px;
  border-radius: 15px;
  background: linear-gradient(150deg, var(--blue), var(--blue-dark));
  color: #fff;
  display: grid; place-items: center;
  font-size: 27px; font-weight: 700;
  margin: 0 auto 18px;
  box-shadow: 0 8px 22px rgba(33, 58, 143, 0.35);
}
.login-card h1 {
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.login-card .sub { color: var(--text-2); font-size: 14px; margin: 0 0 26px; }
.login-card .field { text-align: left; margin-bottom: 12px; }
.login-error {
  color: var(--red);
  font-size: 13px;
  min-height: 18px;
  margin: 10px 0 4px;
}

/* ── App-skal ───────────────────────────────────────────── */

.app { display: none; }
.app.visible { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0;
  height: 100dvh;
  overflow-y: auto;
  background: var(--sidebar);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-right: 1px solid var(--hairline-2);
  padding: 18px 12px 14px;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 16px;
}
.sidebar-brand .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(150deg, var(--blue), var(--blue-dark));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
  flex: none;
}
.sidebar-brand strong { font-size: 14px; display: block; letter-spacing: -0.01em; }
.sidebar-brand span { font-size: 11.5px; color: var(--text-3); display: block; margin-top: 1px; }

.nav-group { margin-top: 14px; }
.nav-group-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 0 10px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border: 0; background: none;
  border-radius: 9px;
  cursor: pointer;
  color: var(--text);
  font-size: 13.5px; font-weight: 500;
  text-align: left;
  transition: background 0.14s ease, transform 0.14s var(--spring);
}
.nav-item:hover { background: var(--tint); }
.nav-item:active { transform: scale(0.98); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .ico { width: 20px; text-align: center; flex: none; font-size: 14px; }
.nav-item .badge {
  margin-left: auto;
  background: var(--tint); color: var(--accent);
  border-radius: 20px; font-size: 11px; font-weight: 600;
  padding: 1px 7px;
}
.nav-item.active .badge { background: rgba(255, 255, 255, 0.22); color: #fff; }

.sidebar-footer {
  margin-top: auto; padding: 12px 10px 2px;
  border-top: 1px solid var(--hairline-2);
  display: flex; align-items: center; gap: 9px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(150deg, var(--sky), var(--blue));
  color: #fff; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; flex: none;
}
.sidebar-footer .who { min-width: 0; }
.sidebar-footer .who strong { font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .who span { font-size: 11px; color: var(--text-3); }
.sidebar-footer .logout {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 15px; padding: 6px; border-radius: 8px;
  transition: background 0.14s ease;
}
.sidebar-footer .logout:hover { background: var(--tint); color: var(--accent); }

/* ── Huvudyta ───────────────────────────────────────────── */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 32px;
  background: var(--chrome);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.topbar.scrolled { border-bottom-color: var(--hairline-2); }
.topbar h1 {
  font-size: 21px; font-weight: 700; letter-spacing: -0.022em;
  margin: 0; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .crumb {
  border: 0; background: none; cursor: pointer; padding: 4px 8px;
  margin-left: -8px;
  color: var(--accent); font-size: 13.5px; font-weight: 500;
  border-radius: 8px;
  transition: background 0.14s ease;
}
.topbar .crumb:hover { background: var(--tint); }
.topbar .spacer { flex: 1; }

.content { padding: 26px 32px 80px; max-width: 61rem; width: 100%; margin: 0 auto; }
.content.wide { max-width: 76rem; }

/* ── Knappar ────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; cursor: pointer;
  border-radius: 10px;
  padding: 8px 15px;
  font-size: 13.5px; font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--hairline);
  transition: transform 0.16s var(--spring), background 0.14s ease, box-shadow 0.14s ease, opacity 0.14s;
}
.btn:hover { background: var(--tint); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary {
  background: var(--accent); color: #fff; box-shadow: none;
}
.btn.primary:hover { background: var(--accent-press); }
.btn.danger { color: var(--red); }
.btn.plain { background: none; box-shadow: none; color: var(--accent); }
.btn.plain:hover { background: var(--tint); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { padding: 7px 9px; }

/* ── Statuspiller ───────────────────────────────────────── */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  border-radius: 20px; padding: 2.5px 9px;
  white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.publicerad { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.pill.andrad { color: var(--orange); background: color-mix(in srgb, var(--orange) 13%, transparent); }
.pill.utkast { color: var(--text-2); background: color-mix(in srgb, var(--text-2) 12%, transparent); }
.pill.klar { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); }
.pill.pagar { color: var(--orange); background: color-mix(in srgb, var(--orange) 13%, transparent); }
.pill.ej { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }

/* ── Kort & listor ──────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.list-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.search {
  flex: 1; min-width: 180px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 7px 12px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--tint); }
.search input { border: 0; background: none; outline: none; width: 100%; font-size: 13.5px; }
.search .ico { color: var(--text-3); font-size: 13px; }

.doc-list { display: flex; flex-direction: column; }
.doc-row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: none; border: 0; cursor: pointer;
  padding: 13px 18px;
  border-bottom: 1px solid var(--hairline-2);
  transition: background 0.13s ease;
  color: var(--text);
}
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: var(--surface-2); }
.doc-row:active { background: var(--tint); }
.doc-row .thumb {
  width: 42px; height: 42px; border-radius: 50%;
  object-fit: cover; flex: none;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
}
.doc-row .thumb.ph { display: grid; place-items: center; font-size: 17px; }
.doc-row .doc-main { min-width: 0; flex: 1; }
.doc-row .doc-title {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-row .doc-sub {
  font-size: 12.5px; color: var(--text-2); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-row .handle {
  color: var(--text-3); cursor: grab; flex: none;
  padding: 4px 2px; font-size: 14px;
  touch-action: none;
}
.doc-row.dragging { opacity: 0.45; }
.doc-row.drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.doc-row.drop-below { box-shadow: inset 0 -2px 0 var(--accent); }
.doc-row .chev { color: var(--text-3); flex: none; font-size: 13px; }

.empty {
  text-align: center; color: var(--text-2);
  padding: 56px 20px;
}
.empty .big { font-size: 34px; margin-bottom: 10px; }

/* ── Översikt ───────────────────────────────────────────── */

.hero-head { margin: 6px 0 22px; }
.hero-head h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; margin: 0 0 3px; }
.hero-head p { color: var(--text-2); margin: 0; font-size: 14px; }

.stat-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 26px;
}
.stat-card {
  padding: 16px 18px;
  cursor: pointer;
  border: 1px solid var(--hairline-2);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.18s var(--spring), box-shadow 0.18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card:active { transform: scale(0.975); }
.stat-card .n { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-card .l { font-size: 12.5px; color: var(--text-2); font-weight: 500; margin-top: 2px; display: flex; gap: 6px; align-items: center; }

.section-title {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 0 12px;
}
.section-title h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
.section-title .cnt { color: var(--text-3); font-size: 13px; }
.section-title .right { margin-left: auto; }

/* ── Redigeraren ────────────────────────────────────────── */

.editor-status {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--text-3);
}
.editor-status .dirty { color: var(--orange); font-weight: 600; }

.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field .help { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.4; }
.input, textarea.input, select.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--tint); }
textarea.input { resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.editor-card { padding: 26px 28px; margin-bottom: 18px; }
.editor-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 44rem) { .editor-grid-2 { grid-template-columns: 1fr; } }

/* Repeater (listor av objekt) */
.rep { display: flex; flex-direction: column; gap: 8px; }
.rep-item {
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius);
  overflow: clip;
}
.rep-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 0; background: none; cursor: pointer;
  text-align: left; color: var(--text);
  font-size: 13px; font-weight: 600;
}
.rep-head .chevron { color: var(--text-3); transition: transform 0.22s var(--spring); font-size: 11px; }
.rep-item.open .rep-head .chevron { transform: rotate(90deg); }
.rep-head .rep-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-head .rep-title .idx { color: var(--text-3); font-weight: 500; margin-right: 7px; font-variant-numeric: tabular-nums; }
.rep-tools { display: flex; gap: 2px; opacity: 0; transition: opacity 0.14s ease; }
.rep-item:hover .rep-tools, .rep-item.open .rep-tools { opacity: 1; }
.rep-tools button {
  border: 0; background: none; cursor: pointer;
  color: var(--text-3); font-size: 12px;
  padding: 4px 6px; border-radius: 6px;
  transition: background 0.13s ease, color 0.13s ease;
}
.rep-tools button:hover { background: var(--tint); color: var(--accent); }
.rep-tools button.del:hover { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.rep-body { padding: 4px 14px 12px; display: none; }
.rep-item.open .rep-body { display: block; animation: rep-in 0.28s var(--spring) both; }
@keyframes rep-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.rep-add {
  align-self: flex-start;
  margin-top: 2px;
}

/* Stringlist */
.strlist { display: flex; flex-direction: column; gap: 7px; }
.strlist-row { display: flex; gap: 7px; align-items: flex-start; }
.strlist-row .input { flex: 1; }
.strlist-row .rm {
  border: 0; background: none; cursor: pointer; color: var(--text-3);
  padding: 8px 7px; border-radius: 8px; font-size: 13px; flex: none;
  transition: background 0.13s, color 0.13s;
}
.strlist-row .rm:hover { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }

/* Bildfält */
.img-field { display: flex; gap: 14px; align-items: center; }
.img-preview {
  width: 84px; height: 84px; border-radius: var(--radius);
  object-fit: cover; background: var(--surface-2);
  border: 1px solid var(--hairline-2); flex: none;
}
.img-drop {
  flex: 1;
  border: 1.5px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--text-2); font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.img-drop:hover, .img-drop.over { border-color: var(--accent); background: var(--tint); }
.img-drop input { display: none; }
.img-actions { display: flex; gap: 6px; margin-top: 8px; }

/* Markdown */
.md-tabs { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; margin-bottom: 8px; border: 1px solid var(--hairline-2); }
.md-tabs button {
  border: 0; background: none; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  padding: 4px 12px; border-radius: 7px;
  transition: background 0.16s var(--spring), color 0.14s;
}
.md-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.md-preview {
  border: 1px solid var(--hairline-2);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px 18px;
  font-size: 14.5px;
  line-height: 1.6;
  min-height: 120px;
}
.md-preview h2, .md-preview h3 { letter-spacing: -0.018em; margin: 1.1em 0 0.4em; }
.md-preview p { margin: 0.6em 0; }
.md-preview ul { padding-left: 1.3em; }

/* Åtgärdsrad (spara/publicera) */
.actionbar {
  position: sticky; bottom: 0; z-index: 25;
  margin-top: 24px;
  display: flex; align-items: center; gap: 10px;
  background: var(--chrome);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--hairline-2);
  border-radius: 16px;
  padding: 11px 14px;
  box-shadow: var(--shadow-md);
}
.actionbar .status { flex: 1; font-size: 12.5px; color: var(--text-2); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Media ──────────────────────────────────────────────── */

.media-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.media-item {
  border: 1px solid var(--hairline-2);
  border-radius: var(--radius);
  overflow: clip;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.18s var(--spring), box-shadow 0.18s ease;
  text-align: left; padding: 0;
}
.media-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.media-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface-2); }
.media-item .meta { padding: 8px 10px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Modal / sheet ──────────────────────────────────────── */

.scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 14, 30, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.scrim.in { opacity: 1; }
.sheet {
  position: fixed; z-index: 95;
  inset-inline: 0; margin-inline: auto;
  top: 8dvh;
  width: min(34rem, calc(100vw - 32px));
  max-height: 84dvh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 26px 28px;
  opacity: 0; transform: translateY(16px) scale(0.98);
  transition: opacity 0.3s var(--spring), transform 0.3s var(--spring);
}
.sheet.in { opacity: 1; transform: none; }
.sheet h3 { margin: 0 0 16px; font-size: 17px; letter-spacing: -0.018em; }
.sheet .sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ── Toast ──────────────────────────────────────────────── */

.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--hairline-2);
  color: var(--text);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 10px 18px;
  font-size: 13.5px; font-weight: 600;
  display: flex; gap: 8px; align-items: center;
  animation: toast-in 0.4s var(--spring-pop) both;
}
.toast.out { animation: toast-out 0.3s var(--spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(8px) scale(0.96); } }
.toast .ok { color: var(--green); }
.toast .err { color: var(--red); }

/* ── Tabeller (användare) ───────────────────────────────── */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-3);
  padding: 10px 18px; border-bottom: 1px solid var(--hairline-2);
}
.table td { padding: 12px 18px; border-bottom: 1px solid var(--hairline-2); font-size: 13.5px; }
.table tr:last-child td { border-bottom: 0; }

/* ── Vyväxling ──────────────────────────────────────────── */

.view { animation: view-in 0.32s var(--spring) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Responsivt ─────────────────────────────────────────── */

@media (max-width: 52rem) {
  .app.visible { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 80; width: 268px; height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.32s var(--spring);
    box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-flex !important; }
  .content { padding: 20px 16px 90px; }
  .topbar { padding: 12px 16px; }
}
.menu-btn { display: none; }

/* ── Tillgänglighet ─────────────────────────────────────── */

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar, .topbar, .actionbar, .login-card, .toast {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: var(--surface);
  }
}
