:root {
  --bg: #f4f5f3;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --line: #e2e3df;
  --accent: #1f4d3d;
  --accent-soft: #eef3f0;
  --warn: #8a5a00;
  --warn-soft: #fdf6e6;
  --error: #9b2c2c;
  --error-soft: #fdeded;
  --ok: #1f6b3d;
  --ok-soft: #edf6f0;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* --- Login ------------------------------------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 13px; }

/* --- Layout ------------------------------------------------------------ */

header.top {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

header.top h1 { margin: 0; font-size: 17px; font-weight: 600; }
header.top .base-url { color: var(--faint); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

main { max-width: 900px; margin: 0 auto; padding: 24px; }

nav.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

nav.tabs button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
}

nav.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

section.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

section.card > h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

section.card > p.section-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
}

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

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 5px; }

input[type="text"], input[type="url"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

textarea { min-height: 76px; resize: vertical; }

input[type="color"] {
  width: 48px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
}

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > .field { flex: 1 1 200px; margin-bottom: 16px; }
.row > .field.narrow { flex: 0 0 130px; }

button.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

button.btn:hover { filter: brightness(1.12); }
button.btn:disabled { opacity: .5; cursor: default; filter: none; }

button.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.btn.danger { background: #fff; color: var(--error); border: 1px solid #e8cccc; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

/* --- Meldungen ---------------------------------------------------------- */

.msg { font-size: 13px; padding: 9px 12px; border-radius: 6px; margin: 0 0 16px; }
.msg:empty { display: none; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.error { background: var(--error-soft); color: var(--error); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }

.note {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 14px 16px;
  font-size: 13px;
  color: #2f4a41;
  margin-bottom: 20px;
}

.note ul { margin: 8px 0 0; padding-left: 20px; }
.note li { margin-bottom: 4px; }
.note strong { font-weight: 600; }

/* --- Dropzone ----------------------------------------------------------- */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  background: #fafbfa;
  color: var(--muted);
  font-size: 13px;
  transition: border-color .12s, background .12s;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.dropzone strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.dropzone input[type="file"] { display: none; }

.preview-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(45deg, #efefef 25%, transparent 25%, transparent 75%, #efefef 75%) 0 0/16px 16px,
    linear-gradient(45deg, #efefef 25%, transparent 25%, transparent 75%, #efefef 75%) 8px 8px/16px 16px,
    #fff;
}

.preview-box img { display: block; max-width: 100%; height: auto; }
.preview-meta { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; gap: 16px; flex-wrap: wrap; }

.url-list { font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); margin-top: 16px; }
.url-list div { padding: 3px 0; overflow-wrap: anywhere; }
.url-list span { color: var(--faint); }

/* --- Mitarbeiter -------------------------------------------------------- */

.employee {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.employee-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.employee-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.employee-head .who { color: var(--faint); font-size: 12px; }

.signature-preview {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow-x: auto;
}

.empty-state { color: var(--muted); font-size: 13px; padding: 8px 0 16px; }

details.howto { margin-top: 20px; font-size: 13px; }
details.howto summary { cursor: pointer; font-weight: 500; }
details.howto ol { padding-left: 20px; color: var(--muted); }
details.howto li { margin-bottom: 6px; }
details.howto code { background: #eef0ed; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

.hidden { display: none !important; }

a.btn { text-decoration: none; display: inline-block; }
