/* HSO Noten-Capture — Paperless-Style CSS */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #1a1a2e;
  background: #f0f2f5;
  font-size: 14px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Top-Bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #d1d5db;
  background: #fff;
  flex-shrink: 0;
}
.logo { font-weight: 700; font-size: 15px; color: #2563eb; display: flex; align-items: center; gap: 8px; }
.logo .dot { width: 10px; height: 10px; border-radius: 50%; background: #2563eb; }
.conn-status { font-size: 16px; color: #ccc; cursor: help; }
.conn-status.ok { color: #16a34a; }
.conn-status.err { color: #dc2626; }
.subagent-status { font-size: 16px; opacity: 0.3; cursor: help; }
.subagent-status.ok { opacity: 1; }
.progress { margin-left: 12px; font-size: 13px; color: #6b7280; display: flex; align-items: center; gap: 10px; }
.progress .bar { width: 180px; height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden; }
.progress .bar > div { height: 100%; width: 0%; background: #2563eb; transition: width .3s; }
.spacer { flex: 1; }
.btn {
  border: 1px solid #d1d5db; background: #fff; color: #1a1a2e;
  border-radius: 6px; padding: 7px 14px; font-size: 13px; cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: #2563eb; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 600; }
.btn.primary:hover { background: #1d4ed8; }
.btn.ghost { background: transparent; }
.btn.warn { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.warn:hover { background: #b91c1c; }

/* ---------- Main ---------- */
.main { flex: 1; display: flex; min-height: 0; }

/* ---------- Left: Meta ---------- */
.meta {
  width: 360px; border-right: 1px solid #d1d5db; background: #fff;
  overflow-y: auto; padding: 16px; flex-shrink: 0;
}
.meta h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: #6b7280; margin-bottom: 12px; margin-top: 4px;
}
.h2-note { font-weight: 400; text-transform: none; letter-spacing: 0; }
.srcfile {
  font-size: 12px; color: #6b7280;
  background: #f3f4f6; border-radius: 6px; padding: 8px 10px;
  margin-bottom: 16px; word-break: break-all; font-family: monospace;
}
.field { margin-bottom: 14px; }
.field label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; margin-bottom: 5px; color: #6b7280;
}
.conf { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }
.conf.high { background: #dcfce7; color: #166534; }
.conf.mid  { background: #fef9c3; color: #854d0e; }
.conf.low  { background: #fee2e2; color: #991b1b; }
.conf.man  { background: #e5e7eb; color: #6b7280; }
.field input, .field select {
  width: 100%; background: #fff; border: 1px solid #d1d5db;
  color: #1a1a2e; border-radius: 6px; padding: 8px 10px;
  font-size: 14px; font-family: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: #2563eb; }
.field input.dirty { border-color: #f59e0b; }
.hint { font-size: 11px; color: #6b7280; margin-top: 4px; }
.hint.warn { color: #b45309; font-weight: 600; }

/* Vorschau */
.preview-box {
  margin-top: 4px; border: 1px dashed #2563eb; border-radius: 8px;
  padding: 12px; background: #eff6ff;
}
.preview-box .ph { font-size: 11px; color: #6b7280; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.preview-box .fname { font-family: monospace; font-size: 13px; font-weight: 600; color: #2563eb; word-break: break-all; }
.preview-box .fdir { font-size: 12px; color: #6b7280; margin-top: 4px; font-family: monospace; }

/* ---------- Right: PDF ---------- */
.viewer { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #e5e7eb; }
.viewer .toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid #d1d5db; background: #fff; flex-shrink: 0;
}
.viewer .toolbar .pg { font-size: 13px; color: #6b7280; }
.zoom { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.vbtn {
  width: 28px; height: 28px; border: 1px solid #d1d5db; border-radius: 5px;
  background: #fff; color: #1a1a2e; cursor: pointer; font-size: 14px; line-height: 1;
}
.vbtn:hover { border-color: #2563eb; }
.pdf-area {
  flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: center;
  padding: 24px; gap: 16px;
}
.pdf-area .placeholder { color: #6b7280; margin-top: 40px; }
.pdf-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; margin-top: 40px; }
.spinner { width: 40px; height: 40px; border: 3px solid #e5e7eb; border-top-color: #2563eb; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner-text { color: #6b7280; font-size: 14px; }
.pdf-canvas-wrap {
  background: #fff; border-radius: 4px; box-shadow: 0 2px 12px rgba(0,0,0,.15);
  line-height: 0; flex-shrink: 0;
}
.pdf-canvas-wrap canvas { display: block; }

/* ---------- Bottom: Queue ---------- */
.queue { height: 92px; border-top: 1px solid #d1d5db; background: #fff; flex-shrink: 0; display: flex; flex-direction: column; }
.queue .qh {
  padding: 6px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: #6b7280; border-bottom: 1px solid #e5e7eb;
  display: flex; justify-content: space-between;
}
.qitems { flex: 1; display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto; }
.qitem {
  flex-shrink: 0; width: 150px; border: 1px solid #d1d5db; border-radius: 6px;
  padding: 6px 8px; font-size: 11px; overflow: hidden;
}
.qitem.active { border-color: #2563eb; background: #2563eb; color: #fff; }
.qitem .qn { font-family: monospace; font-size: 10px; color: #6b7280; margin-bottom: 2px; }
.qitem.active .qn { color: rgba(255,255,255,.7); }
.qitem .qt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: #fff; border-radius: 10px; padding: 24px;
  width: 480px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal.wide { width: 720px; }
.modal h3 { margin-bottom: 12px; font-size: 16px; }
.modal-hint { font-size: 12px; color: #6b7280; margin-bottom: 12px; }
.modal-hint code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.modal input[type="file"] { width: 100%; margin-bottom: 12px; }
.modal-progress { margin-bottom: 12px; }
.modal-progress .bar { width: 100%; height: 6px; border-radius: 3px; background: #e5e7eb; overflow: hidden; margin-bottom: 4px; }
.modal-progress .bar > div { height: 100%; width: 0%; background: #2563eb; transition: width .2s; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* Masterliste */
.ml-toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.ml-toolbar input { flex: 1; border: 1px solid #d1d5db; border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.ml-add-form { display: flex; gap: 8px; margin-bottom: 12px; padding: 12px; background: #f9fafb; border-radius: 6px; }
.ml-add-form input { border: 1px solid #d1d5db; border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.ml-add-form input[type="number"] { width: 80px; }
.ml-add-form input[type="text"] { flex: 1; }
.ml-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ml-table th { text-align: left; padding: 6px 8px; border-bottom: 2px solid #e5e7eb; color: #6b7280; font-size: 11px; text-transform: uppercase; }
.ml-table td { padding: 6px 8px; border-bottom: 1px solid #f3f4f6; }
.ml-table tr:hover td { background: #f9fafb; }
.ml-table .ml-edit { border: none; background: none; cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.ml-table .ml-edit:hover { background: #e5e7eb; }
.ml-table .ml-del { color: #dc2626; }
.ml-table input { width: 100%; border: 1px solid #d1d5db; border-radius: 4px; padding: 4px 6px; font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1a1a2e; color: #fff; border-radius: 8px; padding: 10px 18px; font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 300; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #dc2626; }
.toast.ok  { background: #16a34a; }

/* ---------- Upload: Drop Zone ---------- */
.drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: #6b7280;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 12px;
}
.drop-zone:hover { border-color: #2563eb; color: #2563eb; }
.drop-zone.dragover { border-color: #2563eb; background: #eff6ff; }

/* ---------- Upload: Dateiliste ---------- */
.upload-file-list {
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding: 0;
}
.upload-file-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 13px;
  background: #f9fafb;
  margin-bottom: 4px;
}
.upload-file-list li span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-list li .size { color: #9ca3af; font-size: 12px; white-space: nowrap; }
.upload-file-list li button {
  border: none; background: none; cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px;
}
.upload-file-list li button:hover { background: #fee2e2; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid #e5e7eb; margin-bottom: 16px; }
.tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 8px 16px; font-size: 14px; cursor: pointer; color: #6b7280;
}
.tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }
.tab-btn:hover { color: #374151; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.version { font-size: 11px; color: #9ca3af; font-weight: 400; margin-left: 6px; }
.version::before { content: "v"; }
#settings-msg.ok   { color: #16a34a; font-weight: 600; }
#settings-msg.warn { color: #d97706; font-weight: 600; }
#settings-msg.err  { color: #dc2626; font-weight: 600; }
