/* Personalfreigabe – styles */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --ink: #1b2130;
  --ink-2: #414a5a;
  --muted: #6a7282;
  --line: #e2e0d8;
  --line-strong: #cfccc2;
  --accent: #1f5f4a;
  --accent-ink: #ffffff;
  --accent-soft: #e5efe9;
  --accent-hover: #174c3b;
  --warn: #9a5b00;
  --warn-soft: #fff4dd;
  --danger: #b3261e;
  --danger-soft: #fdebea;
  --info: #1e4f8a;
  --info-soft: #e7f0fb;
  --violet: #5b3a9b;
  --violet-soft: #efe9fb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(27, 33, 48, .05), 0 2px 8px rgba(27, 33, 48, .04);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; font-weight: 650; }
h2 { font-size: 1.12rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; margin-top: 1.4em; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.brand-mark { color: var(--accent); display: flex; }
.mainnav { display: flex; gap: 4px; height: 100%; }
.mainnav a { display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 500; }
.mainnav a:hover { color: var(--ink); background: #faf9f6; }
.mainnav a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.langswitch { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.langswitch a { padding: 3px 9px; font-size: .78rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.langswitch a.is-active { background: var(--ink); color: #fff; }
.bell { position: relative; color: var(--ink-2); display: flex; padding: 6px; border-radius: 6px; }
.bell:hover, .bell.is-active { background: var(--accent-soft); color: var(--accent); }
.bell-count { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.usermeta { display: flex; flex-direction: column; line-height: 1.2; }
.username { font-weight: 600; font-size: .88rem; }
.userroles { font-size: .74rem; color: var(--muted); }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; padding: 4px; text-decoration: underline; }
.linkbtn:hover { color: var(--ink); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }

/* ---------- page head ---------- */
.pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.pagehead p { margin: 0; }
.pagehead-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px !important; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-approve { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-approve:hover { background: var(--accent-hover); color: #fff; }
.btn-reject { color: var(--danger); border-color: #e6b7b3; }
.btn-reject:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-warn { color: var(--warn); border-color: #e8cf9c; }
.btn-warn:hover { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.btn-ghost-danger { border-color: transparent; background: transparent; color: var(--danger); }
.btn-ghost-danger:hover { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-small { padding: 4px 10px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-ms { width: 100%; padding: 11px 16px; font-size: 1rem; }

/* ---------- flash & callouts ---------- */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; }
.flash-success { background: var(--accent-soft); border-color: #bcd6c8; color: #154433; }
.flash-error { background: var(--danger-soft); border-color: #f0c2be; color: #7f1b15; }
.callout { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; border-left: 4px solid; }
.callout p { margin: 6px 0 0; white-space: normal; }
.callout-warn { background: var(--warn-soft); border-color: #d98e04; }
.callout-info { background: var(--info-soft); border-color: var(--info); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-slim { padding: 16px; }
.card-hr { border-top: 3px solid var(--info); }
.card-action { border-top: 3px solid var(--accent); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .05em; padding: 2px 7px; border-radius: 4px; background: var(--info-soft); color: var(--info); vertical-align: middle; margin-left: 6px; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge-draft { background: #f1f0ec; color: var(--ink-2); border-color: var(--line-strong); }
.badge-pending_hr { background: var(--info-soft); color: var(--info); }
.badge-returned_hm, .badge-returned_hr { background: var(--warn-soft); color: var(--warn); }
.badge-pending_md { background: var(--violet-soft); color: var(--violet); }
.badge-approved { background: var(--accent-soft); color: var(--accent); }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-archived { background: #ecebe6; color: var(--muted); }
.badge-initial { background: var(--warn-soft); color: var(--warn); }

/* ---------- tabs, chips, toolbar ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--ink-2); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: .85rem; font-weight: 500; }
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-count { font-size: .74rem; padding: 0 6px; border-radius: 9px; background: rgba(0,0,0,.07); }
.chip.is-active .chip-count { background: rgba(255,255,255,.2); }
.search { display: flex; gap: 6px; }
.search input[type=search] { width: 280px; }
.search select { width: auto; }

/* ---------- tables ---------- */
.tablewrap { margin-bottom: 18px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .tablewrap { box-shadow: none; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.list th { text-align: left; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fbfaf7; }
table.list th.center { text-align: center; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list a { text-decoration: none; font-weight: 600; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: #faf9f5; }
tr.is-waiting td { background: #fffbef; }
tr.is-inactive td { opacity: .6; }
table.options input[type=text] { min-width: 180px; }
.input-sort { width: 80px !important; }
.w-sort { width: 100px; }

.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 44px; text-align: center; color: var(--muted); }

/* ---------- forms ---------- */
input[type=text], input[type=email], input[type=search], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; font-size: .95rem;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 95, 74, .15); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.formgrid { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.formnav { position: sticky; top: 84px; }
.formnav ol { list-style: none; margin: 0 0 14px; padding: 0; counter-reset: sec; }
.formnav li { counter-increment: sec; }
.formnav a { display: flex; gap: 10px; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--ink-2); font-size: .9rem; }
.formnav a::before { content: counter(sec); width: 20px; height: 20px; border-radius: 50%; background: var(--line); color: var(--ink-2); font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; margin-top: 1px; }
.formnav a:hover { background: var(--surface); color: var(--ink); }
.formnav a.has-errors::before { background: var(--danger); color: #fff; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.fields-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px 20px; }
.field-textarea, .field-software { grid-column: 1 / -1; }
.card-hr .fields { grid-template-columns: 1fr; }
.field { min-width: 0; }
.field .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; color: var(--ink); }
.field .help { font-size: .82rem; color: var(--muted); margin: -2px 0 6px; }
.req { color: var(--danger); font-weight: 700; }
.opt { color: var(--muted); font-weight: 400; font-size: .82rem; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); background: #fffafa; }
.field.has-error .choices { outline: 1px solid var(--danger); outline-offset: 4px; border-radius: 4px; }
.error-msg { color: var(--danger); font-size: .82rem; margin: 5px 0 0; font-weight: 500; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 4px 0; }
.choices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.choice { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .93rem; }
.choice-extra { padding-left: 16px; border-left: 1px solid var(--line); }
.inline-other { display: flex; align-items: center; gap: 10px; margin-top: 10px; max-width: 520px; }
.inline-other label { white-space: nowrap; font-size: .9rem; }
.suffix { display: flex; align-items: center; gap: 8px; }
.suffix input { max-width: 120px; }
.suffix span { color: var(--muted); font-size: .9rem; }
.field.is-hidden { display: none; }

.actionbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.pfform > .formgrid .actionbar { position: sticky; bottom: 0; background: rgba(244, 243, 239, .94); backdrop-filter: blur(4px); padding: 14px 0; border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- view ---------- */
.viewgrid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.viewside { position: sticky; top: 84px; }
dl.kv { display: grid; grid-template-columns: minmax(170px, 34%) 1fr; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; padding: 8px 12px 8px 0; border-top: 1px solid var(--line); }
dl.kv dd { margin: 0; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
dl.kv dt:first-of-type, dl.kv dd:first-of-type { border-top: 0; }
dd.prose { white-space: normal; }

.stepper { list-style: none; display: flex; margin: 0 0 22px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); gap: 0; }
.step { flex: 1; display: flex; align-items: center; gap: 10px; position: relative; font-size: .9rem; color: var(--muted); }
.step:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--line); margin: 0 14px; }
.step-done:not(:last-child)::after { background: var(--accent); }
.step-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; flex: none; background: #fff; }
.step-done { color: var(--ink); }
.step-done .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step-current { color: var(--ink); font-weight: 600; }
.step-current .step-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-rejected { color: var(--danger); font-weight: 600; }
.step-rejected .step-dot { background: var(--danger); border-color: var(--danger); color: #fff; }
.step-label { white-space: nowrap; }

.decision { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.decision strong { font-size: 1.05rem; }
.decision p { flex-basis: 100%; margin: 6px 0 0; }
.decision-approved { background: var(--accent-soft); border: 1px solid #bcd6c8; }
.decision-approved strong { color: var(--accent); }
.decision-rejected { background: var(--danger-soft); border: 1px solid #f0c2be; }
.decision-rejected strong { color: var(--danger); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 18px; border-left: 2px solid var(--line); margin-left: 5px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.timeline li.tl-md_approve::before { background: var(--accent); }
.timeline li.tl-md_reject::before { background: var(--danger); }
.timeline li.tl-hr_return_hm::before, .timeline li.tl-md_return_hr::before, .timeline li.tl-md_return_hm::before { background: #d98e04; }
.timeline li.tl-hr_forward::before { background: var(--violet); }
.timeline li.tl-submit::before { background: var(--info); }
.tl-head { font-size: .9rem; }
.tl-meta { font-size: .8rem; color: var(--muted); }
.tl-comment { margin-top: 6px; padding: 8px 10px; background: #faf9f5; border: 1px solid var(--line); border-radius: 6px; font-size: .88rem; }

/* ---------- notifications ---------- */
.notiflist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.notiflist li + li { border-top: 1px solid var(--line); }
.notiflist a { display: flex; gap: 14px; padding: 14px 18px; text-decoration: none; color: var(--ink-2); }
.notiflist a:hover { background: #faf9f5; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: none; }
.notiflist .is-unread a { color: var(--ink); }
.notiflist .is-unread .notif-dot { background: var(--accent); }
.notiflist .is-unread .notif-text { font-weight: 600; }
.notif-body { display: flex; flex-direction: column; gap: 4px; }
.notif-meta { font-size: .8rem; color: var(--muted); display: flex; gap: 6px; align-items: center; }

/* ---------- admin ---------- */
.listsgrid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.sidelist { display: flex; flex-direction: column; gap: 2px; }
.sidelist a { padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.sidelist a:hover { background: var(--surface); }
.sidelist a.is-active { background: var(--ink); color: #fff; }
.addform .fields-3 { margin-bottom: 8px; }

/* ---------- login / waiting ---------- */
.login { display: flex; justify-content: center; padding-top: 6vh; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 36px 36px 30px; width: 100%; max-width: 420px; box-shadow: var(--shadow); text-align: center; }
.login-card form { text-align: left; }
.login-card .field { margin: 14px 0; }
.login-mark { color: var(--accent); margin-bottom: 14px; }
.login-domains { font-size: .8rem; color: var(--muted); margin-top: 16px; }
.devlogin { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line-strong); display: grid; gap: 6px; }
.devlogin-warn { font-size: .78rem; color: var(--danger); font-weight: 600; }
.waiting { max-width: 560px; margin: 8vh auto 0; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 40px; box-shadow: var(--shadow); }
.waiting-icon { color: var(--warn); margin-bottom: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .formgrid, .viewgrid, .listsgrid { grid-template-columns: 1fr; }
  .formnav, .viewside { position: static; }
  .formnav ol { display: flex; flex-wrap: wrap; gap: 4px; }
  .usermeta { display: none; }
}
@media (max-width: 720px) {
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .mainnav { order: 3; width: 100%; overflow-x: auto; height: 40px; }
  .wrap { padding: 20px 16px 60px; }
  .fields, .fields-2, .fields-3 { grid-template-columns: 1fr; }
  .pagehead { flex-direction: column; }
  .search { width: 100%; flex-wrap: wrap; }
  .search input[type=search] { width: 100%; flex: 1; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dd { border-top: 0; padding-top: 0; }
  .stepper { flex-direction: column; gap: 10px; align-items: flex-start; }
  .step::after { display: none; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .viewside, .pagehead-actions .btn, .flash, .card-hr form .actionbar, .stepper { display: none !important; }
  .viewgrid { display: block; }
  .card { box-shadow: none; border: 1px solid #bbb; break-inside: avoid; padding: 12px 16px; margin-bottom: 10px; }
  .wrap { padding: 0; max-width: none; }
  a { color: inherit; text-decoration: none; }
}
