/* Experientzia Admin: warm, calm and practical. Palette from the logo. */

:root {
  --bg: #FBF6EE;
  --surface: #FFFFFF;
  --surface-warm: #FFFCF8;
  --surface-muted: #F6EEE2;
  --ink: #2F4145;
  --muted: #6F6355;
  --border: #E8DCC8;
  --border-strong: #D5C3A7;
  --primary: #B04F2B;
  --primary-hover: #8A3C1E;
  --primary-tint: #F6E4D9;
  --secondary: #2C5A61;
  --secondary-hover: #21454B;
  --success: #2C5A61;
  --success-bg: #E6F0EF;
  --danger: #A63D40;
  --danger-hover: #87302F;
  --danger-bg: #F8E7E5;
  --warning-text: #7A4E0F;
  --warning-bg: #FCF1DF;
  --terracotta: #B04F2B;
  --gold: #D48A36;
  --teal: #2C5A61;
  --plum: #5E3050;
  --focus: #2C5A61;
  --muted-light: #8C7B67;
  --sidebar-width: 272px;
  --rail-width: 72px;
  --radius: 10px;
  --radius-small: 7px;
  --shadow: 0 1px 2px rgba(47, 65, 69, 0.05), 0 4px 14px rgba(47, 65, 69, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }
html.has-drawer { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

img { max-width: 100%; height: auto; }

a { color: var(--secondary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.9em; }

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

[hidden] { display: none !important; }

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* Icons: outlines from /img/icons.svg */

.icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.icon-button:hover:not(:disabled) { background: var(--surface-muted); color: var(--ink); }
.icon-button:disabled { opacity: 0.4; cursor: not-allowed; }
.icon-button--outline { border-color: var(--border-strong); background: var(--surface); }
.icon-button--outline:hover:not(:disabled) { border-color: var(--secondary); background: var(--surface); color: var(--secondary); }
.icon-button--danger { color: var(--danger); }
.icon-button--danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger-hover); }
.icon-button--small { width: 2.1rem; height: 2.1rem; }
.icon-button--small .icon { width: 1.1rem; height: 1.1rem; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}
.badge--small { min-width: 1.3rem; height: 1.3rem; padding: 0 0.35rem; font-size: 0.72rem; }
.badge--corner {
  position: absolute;
  top: 0.05rem;
  right: 0;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  box-shadow: 0 0 0 2px var(--surface);
  font-size: 0.66rem;
}

/* App shell: sidebar and page */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.appbar, .backdrop, .sidebar__close { display: none; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 4.4rem;
  padding: 0.9rem 0.6rem 0.9rem 1.1rem;
}
.sidebar__toggle { color: var(--muted); }
.sidebar__toggle-expand { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand__mark { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; }
.brand__name { overflow: hidden; font-size: 0.97rem; text-overflow: ellipsis; white-space: nowrap; }
.brand__suffix { color: var(--primary); font-weight: 600; }

.nav { flex: 1 0 auto; padding: 0.25rem 0.75rem 1.25rem; }

/* Groups are split by a rule and named by a small caps label, so a heading never looks like a link. */
.nav__group + .nav__group { margin-top: 0.85rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.nav__heading {
  margin: 0 0.75rem 0.45rem;
  color: var(--muted-light);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
  user-select: none;
}

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

.nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.6rem;
  padding: 0.45rem 0.75rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav__link:hover { background: var(--surface-muted); color: var(--ink); }
.nav__link[aria-current="page"] { background: var(--primary-tint); color: var(--primary-hover); font-weight: 650; }
.nav__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: -0.75rem;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}
.nav__icon { color: var(--muted); }
.nav__link:hover .nav__icon { color: var(--ink); }
.nav__link[aria-current="page"] .nav__icon { color: var(--primary); }
.nav__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__form { margin: 0; }

.sidebar__foot { padding: 0.75rem; border-top: 1px solid var(--border); }
.nav__account { display: grid; }
.nav__account-name, .nav__account-email { overflow: hidden; text-overflow: ellipsis; }
.nav__account-email { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  margin: -0.275rem;
  border-radius: 50%;
  background: var(--secondary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.rail-tooltip {
  position: fixed;
  z-index: 200;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-50%);
  box-shadow: 0 6px 18px rgba(47, 65, 69, 0.25);
}

.main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 2.25rem 2.5rem 4rem; }
.main:focus { outline: none; }

.page-header { margin-bottom: 1.75rem; }
.page-header__title { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.01em; }
.page-header__lead { max-width: 65ch; margin-top: 0.35rem; color: var(--muted); }

/* Collapsed to icons (wide screens only). Names stay in the page for screen readers, and show as tooltips. */
@media (min-width: 901px) {
  :root[data-sidebar-collapsed] .shell { grid-template-columns: var(--rail-width) minmax(0, 1fr); }
  :root[data-sidebar-collapsed] .sidebar__head { flex-direction: column; justify-content: flex-start; gap: 0.5rem; padding: 0.9rem 0 0.5rem; }
  :root[data-sidebar-collapsed] .brand__name,
  :root[data-sidebar-collapsed] .nav__label,
  :root[data-sidebar-collapsed] .nav__heading {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  :root[data-sidebar-collapsed] .nav__link { justify-content: center; padding: 0.45rem; }
  :root[data-sidebar-collapsed] .nav__link .badge { position: absolute; top: 0.1rem; right: 0.1rem; min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem; font-size: 0.68rem; box-shadow: 0 0 0 2px var(--surface); }
  :root[data-sidebar-collapsed] .avatar { margin: 0; }
  :root[data-sidebar-collapsed] .sidebar__toggle-collapse { display: none; }
  :root[data-sidebar-collapsed] .sidebar__toggle-expand { display: block; }
}

/* Narrow screens: a bar with the menu button, and the sidebar as a drawer over the page. */
@media (max-width: 900px) {
  .shell { display: block; }
  .appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 3.5rem;
    padding: 0.45rem 0.6rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .appbar .brand { flex: 1; margin-left: 0.2rem; }
  .appbar .brand__mark { width: 32px; height: 32px; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(19rem, 86vw);
    height: auto;
    border-right: 0;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
  }
  .sidebar[data-open] { visibility: visible; transform: none; box-shadow: 0 0 48px rgba(47, 65, 69, 0.3); transition-delay: 0s; }
  .backdrop { position: fixed; inset: 0; z-index: 50; display: block; background: rgba(47, 65, 69, 0.45); }
  .sidebar__toggle { display: none; }
  .sidebar__close { display: inline-flex; }
  .main { padding: 1.25rem 1rem 3rem; }
  .page-header__title { font-size: 1.5rem; }
}

@media (max-width: 600px) {
  body { font-size: 15px; }
}

/* Layout helpers */

.stack { display: grid; gap: 1rem; }
.stack--small { gap: 0.5rem; }
.stack--large { gap: 1.5rem; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.cluster--end { justify-content: flex-end; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button--primary { background: var(--primary); color: #fff; }
.button--primary:hover:not(:disabled) { background: var(--primary-hover); color: #fff; }
.button--secondary { background: var(--secondary); color: #fff; }
.button--secondary:hover:not(:disabled) { background: var(--secondary-hover); color: #fff; }
.button--outline { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.button--outline:hover:not(:disabled) { border-color: var(--secondary); color: var(--secondary); }
.button--quiet { background: transparent; color: var(--ink); border-color: var(--border); }
.button--quiet:hover:not(:disabled) { background: var(--surface); color: var(--ink); }
.button--danger { background: var(--danger); color: #fff; }
.button--danger:hover:not(:disabled) { background: var(--danger-hover); color: #fff; }
.button--danger-outline { background: var(--surface); color: var(--danger); border-color: #E3BFBC; }
.button--danger-outline:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger-hover); }
.button--small { min-height: 2.1rem; padding: 0.3rem 0.7rem; font-size: 0.9rem; }
.button--block { width: 100%; }
.button--link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--secondary);
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.button--link:hover:not(:disabled) { color: var(--primary-hover); }
.button .icon { width: 1.1rem; height: 1.1rem; margin-left: -0.15rem; }
.button--small .icon { width: 1rem; height: 1rem; }

/* Forms */

.field { display: grid; gap: 0.35rem; align-content: start; }
.field__label { font-weight: 600; }
.field__help { color: var(--muted); font-size: 0.9rem; }
.field__message { font-size: 0.9rem; font-weight: 600; }
.field__message--error { color: var(--danger); }
.field__message--warning { color: var(--warning-text); }

.input, .textarea, .select {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.textarea { min-height: 5.5rem; line-height: 1.5; resize: vertical; }
.textarea--code { font-family: var(--mono); font-size: 0.92rem; }
.input:hover, .textarea:hover, .select:hover { border-color: #C6AF8E; }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(44, 90, 97, 0.28);
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--danger);
  background: #FFFBFA;
}
.is-missing .input, .is-missing .textarea { border-color: var(--gold); background: #FFFCF5; }

.checkbox { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 500; cursor: pointer; }
.checkbox input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--primary); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 0.55rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.switch__input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
  position: relative;
  flex-shrink: 0;
  width: 2.5rem;
  height: 1.45rem;
  border-radius: 999px;
  background: #D6C8B2;
  transition: background-color 0.15s;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(1.45rem - 6px);
  height: calc(1.45rem - 6px);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.switch__input:checked + .switch__track { background: var(--secondary); }
.switch__input:checked + .switch__track::after { transform: translateX(1.05rem); }
.switch__input:focus-visible + .switch__track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch__input:disabled + .switch__track { opacity: 0.6; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1.1rem 1.25rem; }
/* A field whose label or help text reads as a sentence, such as a switch, takes the whole row. */
.field--wide { grid-column: 1 / -1; }
.field__label .pill { margin-left: 0.45rem; vertical-align: 0.1em; }
.form-section-title { margin-top: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 1rem; font-weight: 650; }

/* Cards, alerts, status */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 1.15rem; font-weight: 650; }
.card__lead { margin-top: 0.2rem; color: var(--muted); font-size: 0.92rem; }
.card__body { padding: 1.1rem 1.25rem; }
.card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface-warm);
}
.card__footer-note { margin-right: auto; color: var(--muted); font-size: 0.9rem; }

.alert { padding: 0.8rem 1rem; border: 1px solid; border-radius: 8px; }
.alert--error { background: var(--danger-bg); border-color: #E9C4C1; color: #7E2B2E; }
.alert--warning { background: var(--warning-bg); border-color: #EFD3A6; color: #6A440E; }
.alert--success { background: var(--success-bg); border-color: #C3DAD7; color: #1F4449; }
.alert--info { background: #EFF4F3; border-color: #D0DFDD; color: var(--ink); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  white-space: nowrap;
}
.pill--warning { background: var(--warning-bg); border-color: #EFD3A6; color: #6A440E; }
.pill--success { background: var(--success-bg); border-color: #C3DAD7; color: #1F4449; }
.pill--primary { background: var(--primary-tint); border-color: #EBC7B3; color: var(--primary-hover); }

.lang-tag {
  display: inline-block;
  padding: 0.08rem 0.36rem;
  border-radius: 4px;
  background: var(--secondary);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.35;
}
.lang-tag--en { background: var(--plum); }

.loading { display: flex; align-items: center; gap: 0.6rem; padding: 1rem 0; color: var(--muted); }
.spinner {
  display: inline-block;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.button .spinner { width: 0.95rem; height: 0.95rem; border-color: rgba(255, 255, 255, 0.45); border-top-color: #fff; }
.button--outline .spinner, .button--quiet .spinner { border-color: var(--border-strong); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  padding: 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  text-align: center;
}

/* Toasts and dialogs */

.toasts {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  display: grid;
  gap: 0.5rem;
  width: min(24rem, calc(100vw - 2rem));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem 0.75rem 1rem;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 28px rgba(47, 65, 69, 0.25);
}
.toast--success { background: var(--secondary); }
.toast--error { background: var(--danger); }
.toast__text { flex: 1; }
.toast__close {
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.dialog {
  width: min(30rem, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(47, 65, 69, 0.32);
}
.dialog::backdrop { background: rgba(47, 65, 69, 0.45); }
.dialog__body { display: grid; gap: 0.6rem; padding: 1.4rem 1.5rem 0.75rem; }
.dialog__title { font-size: 1.2rem; }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; padding: 1rem 1.5rem 1.35rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .spinner { animation-duration: 2.4s; }
}

/* Bilingual fields: Svenska and English side by side */

.loc-field { display: grid; gap: 0.5rem; padding: 1.1rem 0; border-top: 1px solid var(--border); }
.loc-field:first-child { padding-top: 0.25rem; border-top: 0; }
.loc-field__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.7rem; }
.loc-field__label { font-weight: 650; }
.loc-field__key {
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
}
.loc-field__actions { display: flex; gap: 0.75rem; margin-left: auto; }
.loc-field__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 1rem; }
.loc-field__col { display: grid; align-content: start; gap: 0.3rem; }
.loc-field__lang { display: flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
/* How long the text has grown, against the length a search engine still shows in full. */
.loc-field__count { justify-self: end; margin: -0.1rem 0 0; color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.loc-field__count.is-over { color: var(--warning-text); font-weight: 600; }
.loc-field__help { color: var(--muted); font-size: 0.9rem; }
.loc-field__hint { color: var(--muted); font-size: 0.82rem; }
.loc-field.is-changed > .loc-field__head .loc-field__label::after {
  content: "Changed";
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--warning-bg);
  color: #6A440E;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: 0.1em;
}

@media (max-width: 760px) {
  .loc-field__cols { grid-template-columns: 1fr; }
}

/* Texts page */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 1.25rem; }
.toolbar__search { position: relative; flex: 1 1 18rem; max-width: 32rem; }
.toolbar__search .icon { position: absolute; top: 50%; left: 0.75rem; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.toolbar__search .input { padding-left: 2.5rem; }

.texts-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 1.5rem; }
.group-nav { position: sticky; top: 1.5rem; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.group-nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.95rem;
  text-decoration: none;
}
.group-nav__link:hover { background: var(--surface); color: var(--ink); }
.group-nav__link[aria-current="true"] { background: var(--surface); font-weight: 650; box-shadow: inset 3px 0 0 var(--primary); }
.dirty-dot { flex-shrink: 0; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--gold); }
.group-select { display: none; }
.text-group { scroll-margin-top: 1.5rem; }

/* Shown while anything on the page is unsaved, at the bottom of the screen. */
.save-bar {
  position: sticky;
  bottom: 1rem;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin-top: 1.5rem;
  padding: 0.7rem 0.8rem 0.7rem 1.2rem;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 14px 34px rgba(47, 65, 69, 0.32);
}
.save-bar__text { font-weight: 600; }
.save-bar .button--primary { background: #fff; color: var(--ink); }
.save-bar .button--primary:hover:not(:disabled) { background: var(--primary-tint); color: var(--ink); }

@media (max-width: 1100px) {
  .texts-layout { grid-template-columns: 1fr; }
  .group-nav { display: none; }
  .group-select { display: block; flex: 1 1 14rem; }
}

@media (max-width: 900px) {
  .text-group { scroll-margin-top: 4.5rem; }
}

/* Content lists */

.list-group { display: grid; gap: 0.75rem; }
.list-group + .list-group { margin-top: 2rem; }
.list-group__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; }
.list-group__title { font-size: 1.1rem; font-weight: 650; }

.item-list { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.item-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.item-card.is-editing { border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(176, 79, 43, 0.12), var(--shadow); }
.item-card__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; padding: 0.8rem 0.9rem 0.8rem 1.1rem; }
.item-card__position { min-width: 1.3rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.item-card__titles { display: grid; flex: 1 1 16rem; gap: 0.2rem; min-width: 0; }
.item-card__title { display: flex; align-items: baseline; gap: 0.5rem; font-weight: 600; overflow-wrap: anywhere; }
.item-card__title--en { color: var(--muted); font-weight: 500; }
.item-card.is-hidden .item-card__titles { opacity: 0.7; }
.item-card__meta { color: var(--muted); font-size: 0.85rem; }
.item-card__controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; margin-left: auto; }
.item-card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.item-card__move { display: flex; gap: 0.15rem; margin-right: 0.35rem; }

@media (max-width: 640px) {
  .item-card__controls { justify-content: space-between; width: 100%; margin-left: 0; }
}
.item-card__editor { padding: 1.1rem; border-top: 1px solid var(--border); }
.item-card__editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }

.swatch { flex-shrink: 0; width: 1.1rem; height: 1.1rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
/* The public site's accent colours (site.css .is-*). The class names are the stored colour names; since the site's
   forest palette they show forest green, gold, lake blue and moss green. */
.swatch--terracotta { background: #1f5a2e; }
.swatch--gold { background: #e2b04a; }
.swatch--teal { background: #2b6478; }
.swatch--plum { background: #47771f; }

.choice-group { display: grid; gap: 0.45rem; margin: 0; padding: 0; border: 0; }
.choice-group legend { margin-bottom: 0.35rem; padding: 0; font-weight: 600; }
.choice-group__options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem 0.35rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input { margin: 0; accent-color: var(--primary); }

/* Pages editor */

.url-preview { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.url-preview code { padding: 0.05rem 0.35rem; border-radius: 4px; background: var(--surface-muted); color: var(--ink); }

.segmented { display: inline-flex; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 7px; }
.segmented button {
  padding: 0.2rem 0.65rem;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button[aria-pressed="true"] { background: var(--secondary); color: #fff; }

.markdown-preview {
  min-height: 12rem;
  max-height: 36rem;
  overflow: auto;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-warm);
  overflow-wrap: anywhere;
}
.markdown-preview > :first-child { margin-top: 0; }
.markdown-preview h1, .markdown-preview h2 { margin: 1.1rem 0 0.4rem; font-size: 1.2rem; }
.markdown-preview h3, .markdown-preview h4 { margin: 0.9rem 0 0.35rem; font-size: 1.05rem; }
.markdown-preview p, .markdown-preview ul, .markdown-preview ol { margin: 0 0 0.7rem; }
.markdown-preview table { border-collapse: collapse; margin-bottom: 0.7rem; }
.markdown-preview th, .markdown-preview td { padding: 0.3rem 0.5rem; border: 1px solid var(--border); }

.cheatsheet { color: var(--muted); font-size: 0.9rem; }
.cheatsheet summary { color: var(--secondary); font-weight: 600; cursor: pointer; }
.cheatsheet dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0.6rem 0 0; }
.cheatsheet dd { margin: 0; }

/* Images */

.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 1rem; }
.image-card { display: flex; flex-direction: column; }
.image-card__preview {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: repeating-linear-gradient(45deg, #F6EEE2 0 10px, #F1E6D6 10px 20px);
}
.image-card__preview img { width: 100%; height: 100%; object-fit: contain; }
.image-card__placeholder { max-width: 18rem; padding: 1rem; color: var(--muted); font-size: 0.92rem; text-align: center; }
.image-card__body { display: grid; flex: 1; align-content: start; gap: 0.9rem; padding: 1rem 1.1rem 1.1rem; }
.image-card__meta { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }

/* An image that belongs to one item in a list, such as a partner's logo. */
.image-field__preview {
  display: flex; align-items: center; justify-content: center;
  min-height: 6rem; padding: 0.9rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, #F6EEE2 0 10px, #F1E6D6 10px 20px);
}
.image-field__preview img { max-width: 100%; max-height: 4.5rem; object-fit: contain; }
.image-field__preview p { margin: 0; text-align: center; }
.image-field__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* Cards are narrow, so the Swedish and English alt texts are stacked instead of side by side. */
.image-card .loc-field__cols { grid-template-columns: 1fr; }
.file-button { position: relative; }
.file-button input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-button:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.upload-progress { width: 100%; height: 0.5rem; accent-color: var(--primary); }

/* Messages */

.tabs { display: inline-flex; gap: 0.25rem; margin-bottom: 1rem; padding: 0.25rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-muted); }
.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.messages-layout { display: grid; grid-template-columns: minmax(17rem, 23rem) minmax(0, 1fr); align-items: start; gap: 1rem; }
.messages-layout__detail { position: sticky; top: 1.5rem; }
.message-empty { display: grid; justify-items: center; gap: 0.6rem; padding: 3rem 1.5rem; color: var(--muted); text-align: center; }
.message-empty .icon { width: 2.6rem; height: 2.6rem; color: var(--border-strong); stroke-width: 1.4; }
.message-list { display: grid; margin: 0; padding: 0; list-style: none; }
.message-list li + li { border-top: 1px solid var(--border); }
.message-list__button {
  display: grid;
  gap: 0.15rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.message-list li:first-child .message-list__button { border-radius: var(--radius) var(--radius) 0 0; }
.message-list li:last-child .message-list__button { border-radius: 0 0 var(--radius) var(--radius); }
.message-list__button:hover { background: var(--surface-warm); }
.message-list__button[aria-current="true"] { background: var(--primary-tint); box-shadow: inset 3px 0 0 var(--primary); }
.message-list__top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.message-list__name { font-weight: 500; overflow-wrap: anywhere; }
.message-list__date { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.message-list__preview { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.is-unread .message-list__name { font-weight: 750; }
.unread-dot { display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.4rem; border-radius: 50%; background: var(--primary); vertical-align: 0.1em; }

.message-detail__meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 1rem; margin: 0; }
.message-detail__meta dt { color: var(--muted); font-weight: 600; }
.message-detail__meta dd { margin: 0; overflow-wrap: anywhere; }
.message-body {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-warm);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .messages-layout { grid-template-columns: 1fr; }
  .messages-layout__detail { position: static; }
}

/* Dashboard */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 1rem; }
.stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.2rem 0.5rem;
  padding: 1rem 1.1rem;
  border-top: 4px solid var(--border);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.stat:hover { color: var(--ink); box-shadow: 0 1px 2px rgba(47, 65, 69, 0.06), 0 8px 22px rgba(47, 65, 69, 0.1); }
.stat .icon { grid-column: 2; grid-row: 1; color: var(--muted-light); }
.stat--terracotta { border-top-color: var(--terracotta); }
.stat--gold { border-top-color: var(--gold); }
.stat--teal { border-top-color: var(--teal); }
.stat--plum { border-top-color: var(--plum); }
.stat__value { grid-column: 1; grid-row: 1; font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { grid-column: 1 / -1; color: var(--muted); font-size: 0.9rem; font-weight: 600; line-height: 1.3; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 1rem; margin-top: 1rem; }
.checklist { display: grid; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; align-items: flex-start; gap: 0.7rem; }
.check-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}
.check-icon--ok { background: var(--secondary); }
.check-icon--warn { background: var(--gold); }
.link-list { display: grid; margin: 0; padding: 0; list-style: none; }
.link-list li + li { border-top: 1px solid var(--border); }
.link-list a { display: grid; gap: 0.1rem; padding: 0.65rem 0; color: var(--ink); text-decoration: none; }
.link-list a:hover .link-list__title { text-decoration: underline; }
.link-list__title { font-weight: 600; }

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* Tables */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { background: var(--surface-warm); color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.table__actions { text-align: right; white-space: nowrap; }

/* Sign-in and error pages */

.auth-page {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, #F5DEC8 0, transparent 42%),
    radial-gradient(circle at 92% 92%, #DFEAE7 0, transparent 38%),
    var(--bg);
}
.auth-main { width: 100%; max-width: 27rem; margin: auto; padding: 2rem 1rem; }
.auth-card {
  display: grid;
  gap: 1rem;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(47, 65, 69, 0.1);
}
.auth-card__brand { display: flex; align-items: center; gap: 0.8rem; }
.auth-card__brand img { width: 3.25rem; height: 3.25rem; border-radius: 50%; }
.auth-card__name { font-size: 1.1rem; font-weight: 700; }
.auth-card__title { font-size: 1.5rem; }
.auth-card__lead { color: var(--muted); }
.auth-card__note { color: var(--muted); font-size: 0.88rem; }

@media (max-width: 480px) {
  .auth-card { padding: 1.5rem 1.25rem; }
}
