/* Look & Feel angelehnt an dialogpersonal.ch: Nunito Sans, leichte graue Titel,
   Gelb #FFE515 als Akzent, flache hellgraue Flächen, dunkelgrauer Footer. */

@font-face { font-family: "Nunito Sans"; font-weight: 200 1000; font-display: swap; src: url("/static/fonts/NunitoSans.ttf") format("truetype"); }
@font-face { font-family: "Fira Sans"; font-weight: 800; src: url("/brand/fonts/FiraSans-ExtraBold.ttf"); }

:root {
  --yellow: #ffe515;
  --yellow-hover: #f2d900;
  --yellow-soft: #fff9c4;
  --ink: #000;
  --text: #4d4d4d;
  --muted: #707070;
  --line: #dcdcdc;
  --gray: #f2f2f2;
  --dark: #4d4d4d;
  --danger: #c0271d;
  --ok: #2e7d32;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: #fff; color: var(--ink);
  font: 16px/1.4 "Nunito Sans", Arial, sans-serif;
  accent-color: var(--yellow);
}

/* ------------------------------------------------------------ Header & Titel */

.topbar { background: #fff; box-shadow: 0 1px 10px rgba(0, 0, 0, .07); position: relative; z-index: 10; }
.topbar-inner { max-width: 1500px; margin: 0 auto; padding: 22px 40px 20px; display: flex; align-items: flex-end; gap: 48px; }
.logo { height: 58px; display: block; }
.topbar-title { font-size: 17px; color: var(--muted); padding-bottom: 2px; }
.btn.logout { margin-left: auto; font-size: 15px; color: var(--muted); }
.login { max-width: 460px; margin: 0 auto; padding: 0 20px 64px; }
.login .hint { margin: 0; }

.page-title { text-align: center; font-size: 40px; line-height: 1.4; font-weight: 300; color: var(--muted); margin: 48px 20px 36px; }

/* ------------------------------------------------------------ Layout & Flächen */

.layout {
  display: grid; grid-template-columns: minmax(420px, 1fr) minmax(440px, 640px);
  gap: 32px; padding: 0 40px 64px; max-width: 1500px; margin: 0 auto;
}
.col-form { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.col-preview { min-width: 0; }

.card { background: var(--gray); padding: 26px 28px 28px; }
.card h2 { margin: 0 0 18px; font-size: 21px; font-weight: 400; color: var(--ink); display: flex; align-items: center; gap: 14px; }
.step {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--yellow); color: #222; font-size: 16px; font-weight: 600; flex: none;
}

/* ------------------------------------------------------------ Upload */

.dropzone {
  border: 1.5px dashed #bdbdbd; padding: 26px 16px; background: #fff;
  text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, background .15s;
}
.dropzone small { color: var(--muted); font-size: 14px; }
.dropzone strong { font-weight: 600; }
.dropzone:hover, .dropzone:focus-visible { border-color: #222; outline: none; }
.dropzone.over { border-color: #222; background: var(--yellow-soft); }
kbd { font: 12px "Nunito Sans", sans-serif; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: #fff; color: var(--text); }

.filelist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.filelist li { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 8px 10px; background: #fff; }
.filelist li.uploading { opacity: .55; }
.thumb {
  width: 42px; height: 42px; object-fit: cover; background: var(--yellow);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #222;
}
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.file-meta { color: var(--muted); font-size: 13px; }
.file-actions { display: flex; align-items: center; gap: 2px; }
.file-actions label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); margin-right: 8px; white-space: nowrap; cursor: pointer; }
.icon-btn { border: 0; background: transparent; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; color: var(--muted); font-size: 15px; }
.icon-btn:hover { background: var(--yellow); color: #222; }
.icon-btn:disabled { opacity: .25; cursor: default; background: transparent; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

/* ------------------------------------------------------------ Formularelemente */

.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--text); }
.field em { font-weight: 400; font-style: normal; color: var(--muted); }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 0; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #222; box-shadow: 0 0 0 3px rgba(255, 229, 21, .7); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 15px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; }

/* Festanstellung / Temporär */
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); margin-bottom: 14px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 9px 18px; font-size: 15px; }
.seg input:checked + span { background: var(--yellow); font-weight: 600; }
.seg input:focus-visible + span { box-shadow: inset 0 0 0 2px #222; }
body.art-fest .only-temp, body.art-temporaer .only-fest { display: none !important; }

.btn {
  font: inherit; font-size: 15px; font-weight: 400; border: 0; background: #fff; color: #222;
  padding: 11px 22px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s;
}
.btn:hover:not(:disabled) { background: #e6e6e6; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--yellow); }
.btn.primary:hover:not(:disabled) { background: var(--yellow-hover); }
.btn.big { width: 100%; margin-top: 22px; padding: 16px; font-size: 18px; }
.btn.ghost { background: transparent; padding: 6px 12px; font-size: 18px; }
.btn.ghost:hover:not(:disabled) { background: #e6e6e6; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(0, 0, 0, .2); border-top-color: #222; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { margin: 12px 0 0; color: var(--muted); min-height: 1.2em; font-size: 15px; }
.status.error { color: var(--danger); }
.status.ok { color: var(--ok); }

/* ------------------------------------------------------------ Vorschau */

.preview-card {
  position: relative; background: var(--gray);
  display: flex; flex-direction: column; height: calc(100vh - 40px); min-height: 540px; overflow: hidden;
}
.preview-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.preview-toolbar > strong { font-size: 21px; font-weight: 400; }
.preview-state { color: var(--muted); font-size: 13px; margin-left: auto; }
.editing-bar { background: var(--yellow-soft); }
.edit-tip { color: var(--muted); font-size: 13px; margin-right: auto; }
.edit-tip kbd { margin: 0 1px; }

.notice, .warnings { position: relative; background: var(--yellow-soft); border-left: 5px solid var(--yellow); padding: 10px 44px 10px 16px; font-size: 14px; margin: 0 18px 12px; }
.notice ul { margin: 4px 0 0; padding-left: 18px; }
.notice-close { position: absolute; top: 6px; right: 6px; }

.preview-frame { position: relative; flex: 1; margin: 0 18px; background: #525659; }
.preview-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.preview-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 30px;
  background: #fff; color: var(--muted); font-size: 17px; font-weight: 300;
}
.preview-actions { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px 18px; }

/* ------------------------------------------------------------ E-Mail-Text */

.mail-card { background: var(--gray); padding: 22px 24px 24px; margin-top: 24px; }
.mail-head { display: flex; align-items: center; gap: 12px; }
.mail-head h2 { margin: 0; font-size: 21px; font-weight: 400; }
.mail-state { margin-left: auto; color: var(--ok); font-size: 14px; }
.mail-card .hint { margin: 6px 0 12px; }
.mail-text {
  background: #fff; border: 1px solid var(--line); padding: 16px 20px; min-height: 160px; outline: none;
  font: 15px/1.5 Arial, Helvetica, sans-serif; color: #000;
}
.mail-text:focus { border-color: #222; box-shadow: 0 0 0 3px rgba(255, 229, 21, .7); }
.mail-text p { margin: 0 0 14px; }
.mail-text ul { margin: 0 0 14px; padding-left: 44px; }
.mail-text li { margin: 0; }
.layout.editing .mail-card { display: none; }

/* ------------------------------------------------------------ Footer */

.site-footer {
  background: var(--dark); color: #fff; display: flex; justify-content: center; gap: 120px;
  padding: 44px 40px; font-size: 16px; line-height: 1.45; text-align: center;
}
.site-footer strong { font-weight: 700; }

/* ------------------------------------------------------------ Bearbeiten (Seiten im Dossier-Layout) */

.layout.editing { grid-template-columns: 1fr; max-width: 1200px; }
.layout.editing .col-form { display: none; }
.layout.editing #previewActions { display: none; }

.edit-view { flex: 1; min-height: 0; overflow: auto; background: #525659; margin: 0 18px 18px; padding: 24px; --s: 1; }
.edit-foot { text-align: center; color: #d6dbe3; margin: 0 0 8px; font-size: 13px; }
.sheet-wrap { width: calc(595.32pt * var(--s)); height: calc(841.92pt * var(--s)); margin: 0 auto 24px; }
.sheet {
  position: relative; width: 595.32pt; height: 841.92pt; background: #fff; color: #000;
  transform: scale(var(--s)); transform-origin: 0 0; box-shadow: 0 2px 12px rgba(0, 0, 0, .35);
  font: 11pt/12.65pt Arial, "Liberation Sans", Helvetica, sans-serif; hyphens: auto; -webkit-hyphens: auto;
}
.sheet .h, .p1-bewerbung, .p1-name, .p2-title { font-family: "Fira Sans", Arial, sans-serif; font-weight: 800; }
.s-logo { position: absolute; left: 240.95pt; top: 36pt; width: 113.4pt; height: 49.1pt; max-width: none; }

.p1-flow { position: absolute; top: 140.52pt; left: 0; width: 100%; font-size: 12pt; line-height: 13.8pt; }
.p1-addr { margin-left: 347.47pt; width: 230pt; min-height: 96.6pt; }
.p1-addr .u { text-decoration: underline; }
.p1-date { margin: 27.6pt 0 0 347.47pt; width: 230pt; }
.p1-row { display: grid; grid-template-columns: 148.586pt 305pt; margin: 41.4pt 0 0 70.944pt; }
.p1-bewerbung { position: absolute; left: 0; top: 517.81pt; width: 595.92pt; text-align: center; font-size: 21pt; line-height: 1.2; letter-spacing: 7.87pt; padding-left: 7.87pt; }
.p1-name { position: absolute; left: 0; width: 610.4pt; text-align: center; font-size: 20pt; line-height: 1.2; white-space: nowrap; }
.p-fixed { position: absolute; white-space: nowrap; }
.p1-footer { position: absolute; left: 0; top: 793.08pt; width: 595.32pt; text-align: center; font-size: 9pt; line-height: 10.32pt; color: #3366cc; white-space: pre; }

.p2-title { position: absolute; left: 220.67pt; top: 138.86pt; font-size: 21pt; line-height: 1.2; letter-spacing: 2.35pt; }
.p2-grid { position: absolute; top: 194.28pt; left: 70.944pt; display: grid; grid-template-columns: 148.826pt 331pt; align-items: baseline; }
.p2-grid .h { font-size: 13pt; line-height: 12.65pt; }
.p2-grid .full { grid-column: 1 / -1; }
.p2-grid .first { margin-top: 7.07pt; }
.p2-grid .gap { margin-top: 12.65pt; }
.p2-grid .sec { margin-top: 27.25pt; }
.p2-grid .optional-label { color: #8a8a8a; }
.rich > div + div { margin-top: 5.95pt; }

.inline-select { font: inherit; border: 0; padding: 0; margin: 0 0 0 -2px; width: auto; background: transparent; cursor: pointer; }
.inline-select:hover, .inline-select:focus { background: rgba(255, 229, 21, .45); box-shadow: none; }

.ed { outline: none; min-width: 20pt; cursor: text; }
span.ed { display: inline-block; }
.ed:hover { background: rgba(255, 229, 21, .3); box-shadow: 0 0 0 1.5pt rgba(255, 229, 21, .3); }
.ed:focus { background: rgba(255, 229, 21, .45); box-shadow: 0 0 0 1.5pt rgba(255, 229, 21, .45); }
.ed:empty::before { content: attr(data-placeholder); color: #a0a0a0; font-weight: 400; font-style: italic; }

/* ------------------------------------------------------------ Responsiv */

@media (max-width: 1060px) {
  .layout { grid-template-columns: 1fr; padding: 0 16px 40px; }
  .preview-card { position: static; height: 85vh; }
  .page-title { font-size: 30px; margin: 32px 16px 24px; }
  .topbar-inner { padding: 16px; gap: 24px; }
  .logo { height: 44px; }
  .site-footer { gap: 40px; flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .card { padding: 20px 16px; }
  .topbar-title { display: none; }
  .edit-tip { display: none; }
}

/* von der KI erkannte Unterlage (Lebenslauf, Arbeitszeugnis …) */
.file-typ { display: inline-block; background: var(--yellow); color: #222; font-weight: 700; font-size: 12px; padding: 0 6px; margin-right: 6px; }

.version { color: var(--muted); font-size: 12px; }

/* Seitenauswahl der Anhänge im Bearbeiten-Modus */
.attach-edit { margin-top: 30px; }
.attach-edit h3 { margin: 0; font-size: 17px; }
#attachCount { font-weight: 400; color: var(--muted); font-size: 14px; }
.attach-doc { margin-top: 22px; }
.attach-doc > header {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: baseline; gap: 10px;
  background: var(--bg, #f2f2f2); padding: 8px 0; border-bottom: 1px solid var(--line);
}
.attach-doc .doc-name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-doc .doc-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.attach-pages { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 16px 0; }
.attach-page { position: relative; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .18); line-height: 0; }
.attach-page img { width: min(520px, 90%); max-width: 520px; height: auto; display: block; margin: 0 auto; }
.attach-page .nr {
  position: absolute; left: -46px; top: 0; color: var(--muted); font: 13px "Nunito Sans", sans-serif; line-height: 1.4;
}
.attach-page .page-btn {
  position: absolute; right: 8px; top: 8px; border: 0; cursor: pointer; font: 13px "Nunito Sans", sans-serif;
  padding: 6px 12px; border-radius: 4px; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.attach-page .page-btn:hover { background: #fff; }
.attach-page.off img { opacity: .25; }
.attach-page.off { box-shadow: 0 0 0 2px #c00; }
.attach-page.off::before {
  content: "wird entfernt"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 20px "Nunito Sans", sans-serif; color: #c00; letter-spacing: .08em; text-transform: uppercase;
}
.attach-page.off .page-btn { background: #c00; color: #fff; }
.attach-empty { color: var(--muted); font-size: 14px; }
