:root {
  --navy: #0b1f3a;
  --navy-2: #12294a;
  --accent: #c8a45a;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1a2333;
  --muted: #6b7280;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--navy);
  color: #fff;
}
.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  height: 22px;
  width: auto;
  display: block;
}
.brand-sub {
  font-size: 13px;
  line-height: 1;
  color: #c7d0de;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding-left: 14px;
  border-left: 1px solid #ffffff33;
  white-space: nowrap;
}
/* Auf schmalen Bildschirmen nur das Logo zeigen, statt den Zusatz umzubrechen */
@media (max-width: 560px) {
  .brand-sub { display: none; }
}
.user { font-size: 13px; color: #c7d0de; }
.user .badge {
  background: var(--accent);
  color: var(--navy);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}

.container { max-width: 1040px; margin: 0 auto; padding: 28px 20px 80px; }
.loading { color: var(--muted); }

h1 { font-size: 22px; margin: 0 0 18px; }

.meeting {
  background: var(--card);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(10, 25, 50, 0.08);
  margin-bottom: 22px;
  overflow: hidden;
}
.meeting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8eaee;
}
.meeting-head h2 { margin: 0; font-size: 17px; }
.meeting-head .date { color: var(--muted); font-size: 13px; margin-top: 2px; }

.doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid #f0f1f4;
}
.doc-row:last-child { border-bottom: none; }
.doc-name { font-weight: 600; font-size: 14.5px; cursor: pointer; color: var(--navy); }
.doc-name:hover { text-decoration: underline; }
.doc-sigs { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.doc-sigs .signed { color: #2e7d4f; }
.doc-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--navy-2); }
.btn.ghost {
  background: transparent;
  color: var(--navy);
}
.btn.ghost:hover { background: #eef1f5; }
.btn.danger { border-color: #b3382f; background: transparent; color: #b3382f; }
.btn.danger:hover { background: #fbeeed; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--navy); }
.btn.primary:hover { filter: brightness(1.05); }

.admin-panel {
  background: var(--card);
  border: 1px dashed #c2c9d4;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 26px;
}
.admin-panel h3 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.admin-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.field span { color: var(--muted); }
.field input {
  border: 1px solid #c2c9d4;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  min-width: 220px;
}

/* Viewer */
.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 12px 0;
  box-shadow: 0 6px 12px -8px rgba(10, 25, 50, 0.25);
}
.viewer-top h1 { margin: 0; font-size: 19px; }
.viewer-top .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pdf-pages { display: flex; flex-direction: column; gap: 18px; align-items: center; }
.pdf-page-wrap {
  position: relative;
  box-shadow: 0 2px 10px rgba(10, 25, 50, 0.15);
  background: #fff;
}
.pdf-page-wrap canvas { display: block; }
.placing .pdf-page-wrap canvas { cursor: crosshair; }
.sig-preview {
  position: absolute;
  pointer-events: none;
  opacity: 0.9;
  outline: 1.5px dashed var(--accent);
  outline-offset: 2px;
}
.sig-preview.placed {
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  outline-style: solid;
}
.sig-preview.placed:active { cursor: grabbing; }

.audit-box {
  background: var(--card);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(10, 25, 50, 0.08);
  padding: 14px 20px;
  margin: 18px auto 0;
  max-width: 820px;
  font-size: 13.5px;
}
.audit-box h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.audit-box ul { margin: 0; padding-left: 18px; }
.audit-box li { margin-bottom: 3px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  width: min(620px, calc(100vw - 32px));
}
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.sig-pad-wrap {
  position: relative;
  border: 1px solid #c2c9d4;
  border-radius: 8px;
  margin-top: 14px;
  background: #fbfbfc;
}
.sig-pad-wrap canvas { display: block; width: 100%; height: 180px; border-radius: 8px; }
.sig-baseline {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 38px;
  border-bottom: 1px dashed #c2c9d4;
  pointer-events: none;
}
.modal-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
.spacer { flex: 1; }

.tabs { display: flex; gap: 4px; margin-top: 16px; border-bottom: 1px solid #e0e3e9; }
.tab {
  border: none;
  background: none;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--navy); border-bottom-color: var(--accent); }
.tab-panel { padding-top: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-top: 10px; color: var(--text); }

.typed-preview-wrap {
  border: 1px solid #c2c9d4;
  border-radius: 8px;
  background: #fbfbfc;
}
.typed-preview-wrap canvas { display: block; width: 100%; height: 140px; }

.upload-preview-wrap {
  margin-top: 12px;
  border: 1px solid #c2c9d4;
  border-radius: 8px;
  background: repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
  padding: 10px;
  text-align: center;
}
.upload-preview-wrap img { max-width: 100%; max-height: 140px; }

.place-hint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  z-index: 40;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.place-hint .btn.ghost { color: #fff; border-color: #ffffff66; }

.hidden { display: none !important; }

.error-banner {
  background: #fbeeed;
  border: 1px solid #e5b5b0;
  color: #8f2b23;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
