/* ============================================================
   ISF / RWTH Aachen — Corporate Design
   Farb-/Typografie-Tokens aus dem RWTH Corporate Design Manual
   (08.2014), übernommen aus dem "ISF RWTH Design System".
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;300;400;500;700;900&family=Roboto+Condensed:wght@300;400;700&display=swap');

:root {
  --font-corporate: "Helvetica Neue", "HelveticaNeue", "Roboto", "Helvetica", "Arial", sans-serif;
  --font-corporate-condensed: "Helvetica Neue Condensed", "HelveticaNeueCondensed",
                              "Roboto Condensed", "Arial Narrow", "Helvetica", sans-serif;

  --weight-thin: 100;
  --weight-light: 300;
  --weight-regular: 400;
  --weight-bold: 700;

  /* Primärpalette — RWTH-Blau (HKS 44) */
  --rwth-blue-100: #00549F;
  --rwth-blue-75:  #407FB7;
  --rwth-blue-50:  #8EBAE5;
  --rwth-blue-25:  #C7DDF2;
  --rwth-blue-10:  #E8F1FA;

  /* Sekundärpalette */
  --black-100: #000000;
  --black-75:  #646567;
  --black-50:  #9C9E9F;
  --black-25:  #CFD1D2;
  --black-10:  #ECEDED;

  --green-100: #57AB27;
  --orange-100: #F6A800;
  --red-100: #CC071E;

  --bg: #FFFFFF;
  --bg-tint: var(--rwth-blue-10);
  --fg: #000000;
  --fg-muted: var(--black-75);
  --fg-on-color: #FFFFFF;
  --border: var(--black-25);
  --border-strong: #000000;

  --status-success: var(--green-100);
  --status-warning: var(--orange-100);
  --status-danger: var(--red-100);
  --status-info: var(--rwth-blue-100);

  --unit: 8px;
  --space-1: calc(var(--unit) * 0.5);
  --space-2: var(--unit);
  --space-3: calc(var(--unit) * 1.5);
  --space-4: calc(var(--unit) * 2);
  --space-6: calc(var(--unit) * 3);
  --space-8: calc(var(--unit) * 4);
  --space-12: calc(var(--unit) * 6);

  --rule-thin: 0.5px solid var(--border-strong);
  --rule-base: 1px solid var(--border-strong);

  /* Die Marke verwendet keine abgerundeten Ecken, keine Schatten,
     keine Verläufe. */
  --radius: 0px;
  --shadow-none: none;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-corporate);
  font-weight: var(--weight-light);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--rwth-blue-100);
  text-decoration: none;
  border-bottom: 1px solid var(--rwth-blue-50);
}
a:hover { color: var(--rwth-blue-75); border-bottom-color: var(--rwth-blue-100); }

h1, .h1 {
  font-family: var(--font-corporate);
  font-weight: var(--weight-thin);
  font-stretch: expanded;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--fg);
  margin: 0 0 var(--space-6);
}
h2, .h2 {
  font-family: var(--font-corporate);
  font-weight: var(--weight-thin);
  font-stretch: expanded;
  font-size: 24px;
  line-height: 1.2;
  color: var(--fg);
  margin: var(--space-8) 0 var(--space-4);
}
h3, .h3 {
  font-family: var(--font-corporate);
  font-weight: var(--weight-bold);
  font-size: 16px;
  color: var(--rwth-blue-100);
  margin: var(--space-6) 0 var(--space-3);
}

/* ===== Kopfzeile: Logo, weißer Hintergrund ===== */
.site-header { background: var(--bg); }
.skyline-banner {
  position: relative;
  height: 76px;
  background: var(--bg);
  border-bottom: var(--rule-thin);
}
.skyline-banner .lockup {
  position: absolute;
  top: 14px;
  right: var(--space-8);
  height: 44px;
  width: auto;
}

/* ===== Horizontale Navigation ===== */
.nav {
  border-top: var(--rule-thin);
  border-bottom: var(--rule-thin);
  background: var(--bg);
}
.nav .inner {
  display: flex;
  align-items: stretch;
  max-width: 1280px;
  margin: 0 auto;
}
.nav a {
  display: block;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-corporate);
  font-weight: var(--weight-bold);
  font-size: 14px;
  color: var(--fg);
  text-decoration: none;
  border: 0;
  border-right: var(--rule-thin);
  position: relative;
}
.nav a:first-child { border-left: var(--rule-thin); }
.nav a:hover { color: var(--rwth-blue-100); }
.nav a[aria-current="page"] { color: var(--rwth-blue-100); }
.nav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--rwth-blue-100);
}
.nav .spacer { flex: 1; border-right: var(--rule-thin); }
.nav .user-info {
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-corporate);
  font-weight: var(--weight-light);
  font-size: 13px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.nav .user-info form { display: inline; }
.nav .user-info a {
  display: inline;
  padding: 0;
  font: inherit;
  color: inherit;
  border: 0;
  border-bottom: 1px dotted var(--fg-muted);
}
.nav .user-info a:hover { color: var(--rwth-blue-100); border-bottom-color: var(--rwth-blue-100); }
.nav .user-info button.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: var(--weight-bold);
  color: var(--rwth-blue-100);
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid var(--rwth-blue-50);
}
.nav .user-info button.linkish:hover { color: var(--rwth-blue-75); border-bottom-color: var(--rwth-blue-100); }

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-8) var(--space-12);
}

/* ===== Tabellensuche ===== */
.table-search { margin: 0 0 var(--space-4); }
.table-search label { display: inline; font-weight: var(--weight-bold); font-size: 13px; margin-right: var(--space-2); }
.table-search input { display: inline-block; width: 280px; max-width: 100%; }

/* ===== Tabellen — dünne Linien statt Karten/Schatten ===== */
table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: var(--space-8);
  font-size: 14px;
}
th, td {
  border-bottom: var(--rule-thin);
  padding: var(--space-2) var(--space-3);
  text-align: left;
}
th {
  font-family: var(--font-corporate-condensed);
  font-weight: var(--weight-bold);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: var(--rule-base);
}
tr:hover td { background: var(--rwth-blue-10); }
td a { font-weight: var(--weight-bold); }

/* ===== Formulare ===== */
form p { margin: 0 0 var(--space-4); }
label { display: block; font-weight: var(--weight-bold); font-size: 13px; margin-bottom: var(--space-1); }
input, select, textarea {
  font-family: var(--font-corporate);
  font-size: 14px;
  font-weight: var(--weight-regular);
  padding: var(--space-2) var(--space-3);
  border: var(--rule-base);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  width: 100%;
  max-width: 420px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--rwth-blue-100);
  outline-offset: 1px;
}
input[readonly] { background: var(--black-10); color: var(--fg-muted); }
input[type="checkbox"], input[type="radio"] { width: auto; }

button, input[type="submit"] {
  font-family: var(--font-corporate);
  font-weight: var(--weight-bold);
  font-size: 14px;
  padding: var(--space-2) var(--space-6);
  border-radius: var(--radius);
  border: 1px solid var(--rwth-blue-100);
  background: var(--rwth-blue-100);
  color: var(--fg-on-color);
  cursor: pointer;
  transition: background 120ms linear, color 120ms linear;
}
button:hover, input[type="submit"]:hover { background: var(--rwth-blue-75); border-color: var(--rwth-blue-75); }

button[value="delete"] {
  background: var(--bg);
  color: var(--red-100);
  border-color: var(--red-100);
}
button[value="delete"]:hover { background: #FAEBE3; }

/* ===== Meldungen ===== */
.messages { list-style: none; padding: 0; margin: 0 0 var(--space-6); }
.messages li {
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--black-50);
  margin-bottom: var(--space-2);
  font-size: 14px;
}
.messages .success { border-color: var(--status-success); }
.messages .error   { border-color: var(--status-danger); }
.messages .info    { border-color: var(--status-info); }
.hinweis {
  border-left: 4px solid var(--status-warning);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tint);
}

/* ===== Login-Seite ===== */
.login-page {
  max-width: 360px;
  margin: var(--space-12) auto 0;
  padding: 0 var(--space-4);
}
.login-page .login-card {
  border: var(--rule-base);
  padding: var(--space-8);
}

/* ===== Drag-and-Drop-Dropzone ===== */
.datei-dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-4);
  text-align: center;
  cursor: pointer;
  color: var(--fg-muted);
  font-size: 13px;
}
.datei-dropzone.drag-over {
  background: var(--rwth-blue-10);
  border-color: var(--rwth-blue-100);
  color: var(--fg);
}

/* ===== Anlegen/Suchen-Untertabs ===== */
.tab-buttons {
  display: flex;
  border-bottom: var(--rule-base);
  margin-bottom: var(--space-4);
}
.tab-button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-corporate);
  font-weight: var(--weight-bold);
  font-size: 14px;
  color: var(--fg-muted);
  cursor: pointer;
}
.tab-button.aktiv {
  color: var(--rwth-blue-100);
  border-bottom-color: var(--rwth-blue-100);
}

/* ===== Spaltenauswahl ===== */
.spalten-knopf {
  background: var(--bg);
  color: var(--rwth-blue-100);
  border: 1px solid var(--rwth-blue-100);
  border-radius: var(--radius);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-corporate);
  font-weight: var(--weight-bold);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: var(--space-2);
}
.spalten-knopf:hover { background: var(--rwth-blue-10); }
.spalten-panel {
  border: var(--rule-thin);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: 13px;
}
.spalten-panel[hidden] { display: none; }
.spalten-panel label { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-regular); margin: 0; }
.spalten-panel input[type="checkbox"] { width: auto; }

/* ===== Sortierbare Tabellenspalten ===== */
.sortier-pfeil {
  font-size: 11px;
  color: var(--fg-muted);
}
table.sortierbar thead th:hover {
  color: var(--rwth-blue-100);
}

/* ===== Suchbare Auswahl ===== */
.suchbare-auswahl-ungueltig {
  border-color: var(--red-100);
}

/* ===== Vorauswahl der Spalten =====
   Gilt, bis jemand über „Spalten“ selbst wählt: Spalten ohne data-prioritaet
   immer, Stufe 2 erst ab 1300 px Fensterbreite, Stufe 3 nie. */
table[data-spalten-key] [data-prioritaet="3"] { display: none; }
@media (max-width: 1299px) {
  table[data-spalten-key] [data-prioritaet="2"] { display: none; }
}
/* Zu breite Tabellen scrollen in sich statt die Seite zu verbreitern (Hülle aus spaltenauswahl.js). */
.tabelle-scroll { overflow-x: auto; max-width: 100%; }
.spalten-panel .spalten-standard { align-self: flex-start; margin-top: var(--space-2); }

/* ===== Untertabs (z. B. Klebstoffe/Klebstoff-Bestand) ===== */
.unternav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: 0 0 var(--space-4);
  border-bottom: var(--rule-thin);
}
.unternav a {
  display: block;
  padding: var(--space-2) 0;
  font-family: var(--font-corporate);
  font-weight: var(--weight-light);
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
  border: 0;
  position: relative;
}
.unternav a:hover { color: var(--rwth-blue-100); }
.unternav a[aria-current="page"] { color: var(--rwth-blue-100); font-weight: var(--weight-bold); }
.unternav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--rwth-blue-100);
}

/* ===== Overlay „Neue Vorbehandlung“ auf den Kennwerte-Seiten ===== */
.vorbehandlung-neu { margin-left: var(--space-2); }
.vorbehandlung-dialog {
  width: min(900px, 92vw);
  height: 85vh;
  padding: var(--space-3);
  border: var(--rule-thin);
}
.vorbehandlung-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.vorbehandlung-dialog iframe { width: 100%; height: calc(100% - 3rem); border: 0; }
.dialog-seite main { max-width: none; padding: var(--space-3); }

/* ===== Scan-Vorschau Klebprotokoll (klebprotokoll-scan.js) ===== */
.scan-editor[hidden] { display: none; }
.scan-editor { margin: var(--space-3) 0; }
.scan-hinweis { color: var(--fg-muted); font-size: 13px; }
.scan-seite {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-items: start;
  margin-bottom: var(--space-4);
}
.scan-kopf { grid-column: 1 / -1; font-weight: var(--weight-bold); }
/* wie die Löschen-Knöpfe: entfernt nur die Seite aus dem Upload, nichts Gespeichertes */
.scan-kopf .scan-entfernen { background: var(--bg); color: var(--red-100); border-color: var(--red-100); margin-left: var(--space-2); }
.scan-kopf .scan-entfernen:hover { background: #FAEBE3; }
.scan-status { font-weight: var(--weight-regular); color: var(--fg-muted); }
.scan-foto { position: relative; touch-action: none; user-select: none; }
.scan-foto img, .scan-ergebnis img { display: block; width: 100%; height: auto; border: 1px solid var(--border); }
.scan-foto svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-foto polygon {
  fill: rgba(0, 84, 159, 0.15);
  stroke: var(--rwth-blue-100);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.scan-ecke {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--rwth-blue-100);
  cursor: grab;
  touch-action: none;
}
@media (max-width: 700px) {
  .scan-seite { grid-template-columns: 1fr; }
}
