/* CV-værkstedet – roligt og enkelt design i CV'ets egen blå farve. */
:root {
  --accent: #1b85b8;
  --accent-600: #166f9a;
  --accent-700: #12597b;
  --accent-50: #eef7fb;
  --accent-100: #d6ecf6;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e3e8ee;
  --border-strong: #cdd5de;
  --text: #1c2733;
  --text-2: #3c4a58;
  --muted: #6a7785;
  --faint: #a3adb8;
  --danger: #c0392b;
  --danger-50: #fdf2f1;
  --ok: #1e8a4c;
  --warn-50: #fff8e6;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .07);
  --shadow: 0 4px 14px rgba(16, 24, 40, .08), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 18px 50px rgba(16, 24, 40, .22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar: 56px;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent-600); }
a:hover { color: var(--accent-700); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .35em; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2, .h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; }
p { margin: 0 0 .75em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { background: #eef2f6; padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ok { color: var(--ok); }
.danger { color: var(--danger); }
.spacer { flex: 1; }
.icon { flex-shrink: 0; vertical-align: -3px; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar);
  display: flex; align-items: center; gap: 20px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.page-editor .topbar, .page-ide .topbar { position: static; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: #fff;
}
.brand-mark .icon { width: 17px; height: 17px; }
.topnav { display: flex; gap: 4px; }
.topnav a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 550;
}
.topnav a:hover { background: #eef1f5; color: var(--text); }
.topnav a.active { background: var(--accent-50); color: var(--accent-700); }
.logout { margin: 0 0 0 auto; }

/* ------------------------------------------------------------------ knapper */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 600 14px/1.2 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(18, 89, 123, .25); }
.btn-primary:hover:not(:disabled) { background: var(--accent-600); color: #fff; }
.btn-soft { background: var(--accent-50); color: var(--accent-700); border-color: var(--accent-100); }
.btn-soft:hover:not(:disabled) { background: var(--accent-100); color: var(--accent-700); }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { background: #f1f4f7; color: var(--text); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover:not(:disabled) { background: var(--danger-50); color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; }
button.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
kbd { font: 11px var(--mono); background: rgba(255, 255, 255, .22); padding: 1px 5px; border-radius: 4px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .12s, color .12s;
}
.icon-btn:hover:not(:disabled) { background: #edf1f5; color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.active { background: var(--accent-50); color: var(--accent-700); }
.icon-btn.danger:hover:not(:disabled) { background: var(--danger-50); color: var(--danger); }
.icon-btn.tiny { width: 26px; height: 26px; }
.icon-btn .icon { width: 16px; height: 16px; }
.icon-row { display: flex; align-items: center; gap: 1px; flex-shrink: 0; }

.chip {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  background: #edf1f5; color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip-accent { background: var(--accent-50); color: var(--accent-700); }

.spinner {
  display: inline-block; width: 16px; height: 16px; vertical-align: -3px;
  border: 2px solid var(--accent-100); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .75s linear infinite;
}
.spinner.light { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ formularer */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span:first-child, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field em, .label em { font-style: normal; font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 8px;
  font: 15px/1.45 var(--font); color: var(--text); background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: #a7b1bc; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100);
}
textarea { resize: vertical; min-height: 64px; }
textarea.autosize { overflow: hidden; }
select { width: auto; padding-right: 28px; }
.field select { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.hint.between { display: flex; justify-content: space-between; gap: 12px; }
.field-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px 4px; }
.toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix span {
  display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border-strong);
  border-left: 0; border-radius: 0 8px 8px 0; background: #f3f6f9; color: var(--muted); font-size: 14px;
}
.inline-field { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 600; }
.inline-field select { padding: 6px 28px 6px 9px; font-size: 14px; }
.inline-field.grow { flex: 1; min-width: 0; }
.inline-field.grow select { flex: 1; min-width: 0; width: 100%; }

/* ------------------------------------------------------------------ kort og sider */
.page { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.page.narrow { max-width: 680px; }
.page.wide { max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; margin-bottom: 6px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
.card.center { text-align: center; padding: 36px 24px; }
.page > .card:not(.center) > h1 { padding: 0; }
.card-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 18px;
  background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.card-toggle.static { cursor: default; }
.card-heading { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.card-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-50); color: var(--accent);
}
.card-body { padding: 2px 18px 16px; }
.card-body.row-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; }
.chev { display: inline-grid; place-items: center; color: var(--muted); }
.chev .icon { transition: transform .15s ease; }
.chev.open .icon { transform: rotate(90deg); }
.big-icon { color: var(--accent); margin-bottom: 8px; }
.big-icon .icon { width: 40px; height: 40px; }
.big-icon.danger { color: var(--danger); }
.card > h1 { font-size: 21px; }
.page.narrow .card:not(.center) { padding: 24px 26px; }

.alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 12px;
  border-radius: 10px; border: 1px solid; font-size: 14px;
}
.alert p { margin: 4px 0; }
.alert-danger { background: var(--danger-50); border-color: #f2c5c0; color: #7d2117; }
.alert-warn { background: var(--warn-50); border-color: #f1d797; color: #6a4b00; }
details.tech { margin: 8px 0; font-size: 13px; }
details.tech summary { cursor: pointer; color: inherit; opacity: .85; }
details.tech pre, pre.log {
  background: #0f1b2a; color: #dbe5ef; padding: 12px 14px; border-radius: 10px; overflow: auto;
  font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 260px; margin: 8px 0;
}
pre.log.tall { max-height: 68vh; min-height: 200px; }
pre.log.json { max-height: none; }

.flash-wrap { max-width: 680px; margin: 16px auto 0; padding: 0 24px; }
.flash { background: var(--accent-50); border: 1px solid var(--accent-100); color: var(--accent-700); padding: 10px 14px; border-radius: 10px; }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; font-size: 14px;
}
.banner-danger { background: var(--danger-50); color: #7d2117; border-bottom: 1px solid #f2c5c0; }
.banner span { flex: 1; }

/* ------------------------------------------------------------------ toasts og modaler */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast {
  background: #1f2a37; color: #fff; padding: 11px 15px; border-radius: 11px; font-size: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: #a8281c; }
.toast-success { background: #19703f; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(15, 23, 42, .45);
}
.modal {
  width: min(540px, 100%); max-height: 86vh; overflow: auto; background: #fff; border-radius: 16px;
  padding: 20px 22px; box-shadow: var(--shadow-lg);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.history-list { list-style: none; margin: 8px 0 0; padding: 0; }
.history-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px;
  border-top: 1px solid var(--border);
}
.history-list li > div { display: flex; flex-direction: column; }

.drawer { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: flex-end; background: rgba(15, 23, 42, .35); }
.drawer-panel { width: min(640px, 100%); height: 100%; overflow: auto; background: #fff; padding: 20px 24px; box-shadow: var(--shadow-lg); }
.drawer-panel h3 { margin-top: 18px; }

.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.menu-list button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; font: 14px var(--font); color: var(--text); text-align: left; cursor: pointer;
}
.menu-list button:hover { background: #f1f4f7; }
.menu-list button.danger { color: var(--danger); }

/* ------------------------------------------------------------------ login */
.page-login { background: radial-gradient(1200px 600px at 20% -10%, var(--accent-100), transparent 60%), var(--bg); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(400px, 100%); background: #fff; border: 1px solid var(--border); border-radius: 18px;
  padding: 32px 30px 28px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 24px; margin-top: 14px; }
.login-logo {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: #fff;
}
.login-logo .icon { width: 24px; height: 24px; }
.login-card .btn { margin-top: 6px; padding: 11px; }

/* ------------------------------------------------------------------ oversigt */
.doc-group { margin-bottom: 34px; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.group-head h2 { margin: 0; font-size: 19px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.doc-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .15s, transform .15s;
}
.doc-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.doc-thumb {
  position: relative; display: block; aspect-ratio: 210 / 297; background: #e8edf2; border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.thumb-placeholder { display: grid; place-items: center; height: 100%; color: var(--faint); }
.thumb-placeholder .icon { width: 42px; height: 42px; }
.thumb-badge {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 4px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
}
.thumb-badge .icon { width: 13px; height: 13px; }
.doc-info { padding: 12px 14px 2px; }
.doc-info h3 { margin: 0 0 2px; font-size: 15px; }
.doc-info h3 a { color: var(--text); text-decoration: none; }
.doc-info h3 a:hover { color: var(--accent-700); }
.doc-info p { margin: 0; }
.doc-actions { display: flex; gap: 5px; padding: 10px 12px 14px; margin-top: auto; }
.doc-actions .btn-primary { flex: 1; min-width: 0; }
.doc-actions .btn-ghost { padding: 6px 8px; }
.doc-new {
  align-items: center; justify-content: center; gap: 6px; min-height: 240px; padding: 20px; cursor: pointer;
  border: 2px dashed var(--border-strong); background: transparent; box-shadow: none; color: var(--accent-700);
  font: 600 15px var(--font); text-align: center;
}
.doc-new:hover { background: var(--accent-50); border-color: var(--accent); }
.doc-new .icon { width: 30px; height: 30px; }
.doc-new .muted { font-weight: 400; max-width: 180px; }

/* ------------------------------------------------------------------ editor */
.editor-bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.editor-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.editor-title h1 { font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.save-state > span { display: inline-flex; align-items: center; gap: 6px; }
.save-state.is-saved { color: var(--ok); }
.save-state.is-error { color: var(--danger); font-weight: 600; }
.bar-actions { display: flex; align-items: center; gap: 8px; }
.mobile-tabs { display: none; }
.editor-grid {
  max-width: 1560px; margin: 0 auto; padding: 22px 22px 80px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 45%); gap: 26px; align-items: start;
}
.form-col { min-width: 0; }
.preview-col { position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow: auto; border-radius: var(--radius); min-width: 0; }

.preview { background: #dde3ea; border-radius: var(--radius); padding: 12px; }
.preview-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.preview-title { display: flex; align-items: baseline; gap: 8px; }
.preview-state { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.preview-state > span { display: inline-flex; align-items: center; gap: 5px; }
.pages { display: flex; flex-direction: column; gap: 12px; transition: opacity .2s; }
.pages.busy { opacity: .6; }
.pdf-page {
  display: block; width: 100%; padding: 0; border: 0; background: #fff; cursor: zoom-in;
  box-shadow: 0 2px 10px rgba(16, 24, 40, .14);
}
.pdf-page img { display: block; width: 100%; height: auto; }
img.pdf-page { cursor: default; }
.pdf-page-empty { display: grid; place-items: center; aspect-ratio: 210 / 297; cursor: default; }

/* Sektioner i CV'et */
.column-block { margin-bottom: 30px; }
.column-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
.column-head h2 { margin: 0; }
.column-head p { margin: 0; }
.section-card { margin-bottom: 12px; }
.section-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 6px; }
.section-title {
  flex: 1; min-width: 60px; font-size: 16px; font-weight: 600; padding: 6px 8px;
  border-color: transparent; background: transparent;
}
.section-title:hover { border-color: var(--border); }
.section-title:focus { background: #fff; }
.section-card.is-hidden { background: var(--surface-2); border-style: dashed; }
.section-card.is-hidden .section-title { color: var(--muted); }
.hidden-note { display: flex; align-items: center; gap: 6px; margin: -4px 16px 10px 48px; font-size: 13px; color: var(--muted); }
.section-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.entries { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.entries > .btn, .items > .btn { align-self: flex-start; }
.entry { border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.entry.open { background: #fff; box-shadow: var(--shadow-sm); }
.entry.is-hidden { opacity: .55; }
.entry-head { display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 4px; }
.entry-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 6px; border: 0; border-radius: 8px;
  background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.entry-toggle:hover { background: #f1f4f7; }
.entry-summary { display: flex; flex-direction: column; min-width: 0; }
.entry-summary.plain { flex: 1; padding: 6px 10px; }
.group-title { flex: 1; min-width: 0; margin: 4px 0 4px 6px; font-weight: 600; }
.entry-summary strong, .entry-summary span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-body { padding: 6px 14px 4px; }
.items { display: flex; flex-direction: column; }
.item-row { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; }
.item-row.skill-row { align-items: center; }
.item-row > .icon-row { padding-top: 5px; }
.item-row.skill-row > .icon-row { padding-top: 0; }
.item-row.is-hidden :is(input, textarea) { color: var(--muted); background: var(--surface-2); text-decoration: line-through; }
.item-row :is(input, textarea) { flex: 1; min-width: 0; }
textarea.item-text { min-height: 0; resize: none; field-sizing: content; }
.bullet { width: 16px; text-align: center; color: var(--muted); flex-shrink: 0; padding-top: 10px; }
.rating { display: flex; gap: 5px; flex-shrink: 0; }
.dot {
  width: 18px; height: 18px; border-radius: 50%; border: 2px solid #c6d0da; background: #fff; padding: 0; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.dot.on { background: var(--accent); border-color: var(--accent); }
.dot:hover { border-color: var(--accent); }
.add-section { margin-top: 4px; }
.type-picker {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; padding: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.type-picker > p { grid-column: 1 / -1; margin: 0 0 2px; }
.type-option {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.type-option:hover { border-color: var(--accent); background: var(--accent-50); }

/* Profilbilleder: runde ligesom i CV'et */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 12px; }
.photo { position: relative; aspect-ratio: 1; }
.photo-pick {
  width: 100%; height: 100%; padding: 0; border-radius: 50%; overflow: hidden; cursor: pointer;
  border: 3px solid transparent; background: #e8edf2; transition: border-color .12s, box-shadow .12s;
}
.photo-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick:hover { border-color: var(--accent-100); }
.photo.selected .photo-pick { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-100); }
.photo-check {
  position: absolute; right: 0; bottom: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; border: 2px solid #fff;
}
.photo-check .icon { width: 14px; height: 14px; }
.photo-del {
  position: absolute; right: -4px; top: -4px; width: 26px; height: 26px; border-radius: 50%; display: none;
  place-items: center; border: 1px solid var(--border); background: #fff; color: var(--danger); cursor: pointer; box-shadow: var(--shadow-sm);
}
.photo-del .icon { width: 14px; height: 14px; }
.photo:hover .photo-del, .photo:focus-within .photo-del { display: grid; }
@media (hover: none) { .photo-del { display: grid; } }
.photo-none, .photo-upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 50%;
  border: 2px dashed var(--border-strong); background: transparent; color: var(--muted); font: 600 11px var(--font);
  cursor: pointer; text-align: center; padding: 6px;
}
.photo-upload > span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.photo-none.selected { border-color: var(--accent); color: var(--accent-700); background: var(--accent-50); }
.photo-none:hover, .photo-upload:hover { border-color: var(--accent); color: var(--accent-700); }
.photo-upload.busy { cursor: progress; }

.letter-body { min-height: 380px; font-size: 15.5px; line-height: 1.65; }
.count { white-space: nowrap; }

/* ------------------------------------------------------------------ admin */
.table-wrap { overflow-x: auto; padding: 0 8px 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 12px; }
.table td { padding: 11px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.table td a { text-decoration: none; }
.help-list { margin: 0; padding-left: 20px; }
.help-list li { margin-bottom: 9px; }
.prose code { font-size: 12.5px; }

.ide { display: flex; flex-direction: column; height: calc(100vh - var(--topbar)); }
.ide-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px;
  background: #fff; border-bottom: 1px solid var(--border);
}
.ide-bar .bar-actions { margin-left: auto; }
.ide-title { display: flex; align-items: center; gap: 8px; min-width: 200px; flex: 1; }
.title-input {
  font-size: 16px; font-weight: 600; padding: 5px 8px; border-color: transparent; background: transparent; min-width: 0;
}
.title-input:hover { border-color: var(--border); }
.ide-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr) minmax(320px, 36%); }
.ide-files { border-right: 1px solid var(--border); background: var(--surface-2); overflow: auto; padding: 12px 10px; }
.files-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; }
.file-list { list-style: none; margin: 0 0 10px; padding: 0; }
.file-list li { display: flex; align-items: center; border-radius: 7px; }
.file-list li.active { background: var(--accent-50); }
.file-name {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border: 0; background: none;
  font: 13px var(--mono); color: var(--text-2); text-align: left; cursor: pointer; border-radius: 7px;
}
.file-name:hover { background: #edf1f5; }
.file-list li.active .file-name { color: var(--accent-700); font-weight: 600; }
.file-name .icon { width: 15px; height: 15px; }
.file-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dirty-dot { color: #d97706; font-size: 11px; }
.tag-main { margin-left: auto; font: 600 10px var(--font); color: var(--accent-700); background: var(--accent-100); padding: 1px 6px; border-radius: 999px; }
.file-list li .icon-btn { opacity: 0; }
.file-list li:hover .icon-btn { opacity: 1; }
.used-by { display: flex; flex-direction: column; gap: 4px; padding: 12px 6px 0; border-top: 1px solid var(--border); margin-top: 12px; }
.ide-editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fff; }
.code-tabs { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.code-host { flex: 1; min-height: 0; position: relative; }
.code-host .CodeMirror { height: 100%; font: 13px/1.55 var(--mono); }
.code-host.tall { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.code-host.tall .CodeMirror { height: 64vh; }
.ide-preview { border-left: 1px solid var(--border); background: #dde3ea; overflow: auto; padding: 12px; }
.ide-preview .preview-state { display: flex; gap: 10px; margin: 0 0 10px; }
.cm-s-default .cm-keyword { color: #7a3e9d; }
.cm-s-default .cm-tag { color: #1b6fa3; }
.cm-s-default .cm-comment { color: #8a96a3; }

.tabs { display: flex; gap: 4px; margin: 6px 0 0; padding: 0 4px; }
.tabs button {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 1px solid transparent; border-bottom: 0;
  border-radius: 10px 10px 0 0; background: none; font: 600 14px var(--font); color: var(--muted); cursor: pointer;
}
.tabs button.active { background: #fff; border-color: var(--border); color: var(--accent-700); }
.tab-panel { padding: 16px 18px; border-top-left-radius: 0; }
.file-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.file-tabs button {
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: #fff;
  font: 12.5px var(--mono); color: var(--text-2); cursor: pointer;
}
.file-tabs button.active { border-color: var(--accent); background: var(--accent-50); color: var(--accent-700); }
.tab-panel .actions { margin-top: 12px; }

/* ------------------------------------------------------------------ mindre skærme */
@media (max-width: 1080px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr) minmax(320px, 42%); gap: 18px; padding: 16px 16px 80px; }
  .ide-grid { grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .ide-preview { grid-column: 1 / -1; max-height: 50vh; border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 900px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .mobile-tabs {
    display: flex; gap: 6px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 53px; z-index: 25;
  }
  .mobile-tabs button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px;
    border: 1px solid var(--border); border-radius: 9px; background: #fff; font: 600 14px var(--font); color: var(--muted);
  }
  .mobile-tabs button.active { background: var(--accent-50); border-color: var(--accent-100); color: var(--accent-700); }
  .show-form .preview-col { display: none; }
  .show-preview .form-col { display: none; }
  .preview-col { position: static; max-height: none; }
  .ide { height: auto; }
  .ide-grid { grid-template-columns: 1fr; }
  .ide-files { border-right: 0; border-bottom: 1px solid var(--border); max-height: 240px; }
  .ide-editor { height: 70vh; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 22px; }
  .page { padding: 18px 14px 50px; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .topbar { gap: 10px; padding: 0 12px; }
  .brand span:last-child { display: none; }
  .editor-bar { gap: 8px; padding: 8px 12px; flex-wrap: wrap; }
  .editor-title { order: 3; width: 100%; }
  .editor-title h1 { font-size: 16px; }
  .save-state { font-size: 12px; }
  .section-head { flex-wrap: wrap; }
  .section-title { flex-basis: 60%; }
  .type-picker { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
  .doc-actions { flex-wrap: wrap; }
  .doc-actions .btn-primary { flex-basis: 100%; }
  .card-body { padding: 2px 14px 14px; }
  .section-body { padding: 12px 10px 12px; }
  .entry-body { padding: 6px 10px 4px; }
  .mobile-tabs { top: 0; position: relative; }
}
