@font-face {
  font-family: 'Schibsted Grotesk';
  src: url('/fonts/SchibstedGrotesk-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
}
:root {
  --blue: #0e3d87;
  --blue-deep: #0a2c63;
  --tone: #eaf0f9;
  --tone-2: #dbe5f4;
  --ink: #0a2147;
  --soft: #4a5f88;
  --line: #c6d3e8;
  --danger: #a3211d;
  --ok: #1d6b3a;
  --draft: #8a5300;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--tone); color: var(--ink); font-family: 'Schibsted Grotesk', system-ui, sans-serif; font-size: 16px; line-height: 1.4; letter-spacing: -0.005em; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: var(--tone); border: 0; padding: 8px 12px; min-height: 38px; font-weight: 600; color: var(--blue); transition: background-color 140ms ease, transform 100ms ease; }
button:hover:not(:disabled) { background: var(--tone-2); }
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
::selection { background: var(--blue); color: #fff; }
.primary { background: var(--blue); color: #fff; padding-inline: 18px; min-height: 42px; font-weight: 700; }
.primary:hover:not(:disabled) { background: var(--blue-deep); }
.ghost { background: transparent; text-decoration: underline; text-underline-offset: 0.2em; }
.danger { color: var(--danger); background: transparent; text-decoration: underline; text-underline-offset: 0.2em; }
.danger:hover:not(:disabled) { background: #f8e6e5; }

.field { display: grid; gap: 4px; }
.field > span, .imagefield__label { font-size: 14px; font-weight: 600; }
.field small { font-size: 13px; color: var(--soft); line-height: 1.3; }
input:not([type='file']), select, textarea { width: 100%; background: #fff; border: 1px solid var(--line); padding: 9px 10px; min-height: 42px; border-radius: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
textarea { resize: vertical; line-height: 1.35; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; }
.is-target { animation: flash 1.2s ease; }
@keyframes flash { 0%, 50% { background: var(--tone-2); box-shadow: 0 0 0 8px var(--tone-2); } 100% { background: transparent; box-shadow: 0 0 0 8px transparent; } }

/* Anmeldung */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--blue); }
.login form { width: min(100%, 400px); background: #fff; padding: 32px; display: grid; gap: 16px; justify-items: start; }
.login .field { width: 100%; }
.login h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; color: var(--blue); }
.login small { color: var(--soft); font-size: 13px; line-height: 1.35; }
.login button { width: 100%; }
.login a { font-weight: 600; color: var(--blue); }

/* Editor */
.ve { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: 'top top' 'canvas side'; }
.ve-top { grid-area: top; display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); min-width: 0; }
.ve-logo { flex: none; display: block; }
.ve-logo img { display: block; height: 44px; width: auto; }
.ve-tabs { display: flex; gap: 2px; flex-wrap: wrap; min-width: 0; }
.ve-tabs button { background: transparent; min-height: 40px; padding-inline: 12px; color: var(--ink); }
.ve-tabs button:hover { background: var(--tone); }
.ve-tabs button[aria-current] { background: var(--blue); color: #fff; }
.ve-publish { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; }
.ve-status { font-size: 14px; color: var(--soft); text-align: right; }
.ve-status[data-tone='ok'] { color: var(--ok); }
.ve-status[data-tone='draft'] { color: var(--draft); }
.ve-status[data-tone='error'] { color: var(--danger); font-weight: 600; }

.ve-mobile-switch { display: none; }
.ve-canvas { grid-area: canvas; display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.ve-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; }
.ve-tools__group { display: flex; gap: 4px; flex: none; }
.ve-tools button { background: #fff; }
.ve-tools button:hover:not(:disabled) { background: var(--tone-2); }
.ve-tools button[aria-pressed='true'], .ve-tools button[aria-pressed='true']:hover:not(:disabled) { background: var(--blue); color: #fff; }
.ve-tools__hint { font-size: 13px; color: var(--soft); text-align: center; min-width: 0; }
.ve-frame { min-height: 0; padding: 0 16px 16px; display: flex; justify-content: center; }
.ve-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; display: block; transition: width 260ms cubic-bezier(0.22, 1, 0.36, 1); }
.ve-frame[data-device='mobile'] iframe { width: 390px; max-width: 100%; }

.ve-side { grid-area: side; background: #fff; border-left: 1px solid var(--line); display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; }
.ve-fields { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.group { border-bottom: 1px solid var(--line); }
.group > summary { cursor: pointer; padding: 14px 16px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; color: var(--blue); list-style-position: inside; }
.group > summary:hover { background: var(--tone); }
.group__body { display: grid; gap: 14px; padding: 2px 16px 20px; }
.group__hint { font-size: 14px; color: var(--soft); }
.imagefield { display: grid; gap: 8px; }
.imagefield > img { width: 100%; max-height: 180px; object-fit: cover; display: block; }
.imagefield__empty { display: block; padding: 18px 12px; background: var(--tone); font-size: 14px; color: var(--soft); text-align: center; }
.imagefield__acts { display: flex; gap: 6px; flex-wrap: wrap; }
.list { display: grid; gap: 6px; }
.list__item { background: var(--tone); }
.list__item > summary { cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: 15px; list-style-position: inside; overflow-wrap: anywhere; }
.list__item > summary:hover { background: var(--tone-2); }
.list__body { display: grid; gap: 12px; padding: 6px 12px 12px; }
.list__body .imagefield__empty { background: #fff; }
.list__body .imagefield__acts button:not(.ghost) { background: #fff; }
.list__acts { display: flex; gap: 4px; flex-wrap: wrap; }
.list__acts button:not(.danger) { background: #fff; font-size: 14px; }
.list__add { background: #fff; border: 2px dashed var(--line); min-height: 44px; }
.list__add:hover:not(:disabled) { background: var(--tone); border-color: var(--blue); }
.ve-side__foot { display: flex; gap: 4px; padding: 8px 16px; border-top: 1px solid var(--line); }
.ve-side__foot button { background: transparent; flex: 1; font-size: 14px; }
.ve-side__foot button:hover { background: var(--tone); }

/* Dialoge und Meldungen */
.dlg { border: 0; padding: 24px; width: min(100% - 32px, 480px); color: var(--ink); box-shadow: 0 18px 50px rgb(10 33 71 / 0.28); }
.dlg::backdrop { background: rgb(10 33 71 / 0.5); }
.dlg form:not(.dlg__head) { display: grid; gap: 14px; }
.dlg > p { margin-block: 8px 16px; color: var(--soft); }
.dlg__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.dlg h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.025em; color: var(--blue); }
.dlg__list { display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; margin-bottom: 12px; }
.dlg__list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--tone); padding: 8px 10px; font-size: 15px; }
.dlg__list li button { background: #fff; font-size: 14px; flex: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; font-weight: 600; max-width: calc(100% - 32px); z-index: 50; box-shadow: 0 10px 30px rgb(10 33 71 / 0.3); }

/* Schmale Bildschirme: Bearbeiten und Vorschau im Wechsel */
@media (max-width: 1180px) {
  .ve-status { display: none; }
  .ve-tools__hint { display: none; }
  .ve { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 860px) {
  .ve { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: 'top' 'switch' 'main'; }
  .ve-top { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .ve-tabs { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .ve-tabs button { flex: none; }
  .ve-status { display: block; font-size: 13px; }
  .ve-publish { flex: 1; justify-content: flex-end; min-width: 0; }
  .ve-mobile-switch { grid-area: switch; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 6px 12px; background: var(--tone); }
  .ve-mobile-switch button { background: #fff; }
  .ve-mobile-switch button[aria-selected='true'] { background: var(--blue); color: #fff; }
  .ve-canvas, .ve-side { grid-area: main; border-left: 0; }
  body[data-view='edit'] .ve-canvas { display: none; }
  body[data-view='preview'] .ve-side { display: none; }
  .ve-tools__group[role='group'] { display: none; }
  .ve-frame { padding: 0 8px 8px; }
}
