/* ============================================================
   DMS 2.0 – Projektraum · CoCo REAL Corporate Design
   ------------------------------------------------------------
   MARKENFARBEN – exakt aus dem Firmenlogo gemessen:
   CoCo-Marineblau #273b5f · REAL-Hellblau #9ebbe5
   ============================================================ */
:root {
  --brand:        #273b5f;   /* CoCo-Marineblau (Kopfleiste, Buttons) */
  --brand-dark:   #1e2e4a;   /* dunklere Abstufung (Hover)            */
  --brand-ink:    #162237;   /* fast schwarz für Verläufe             */
  --brand-accent: #9ebbe5;   /* REAL-Hellblau: Linien & Flächen       */
  --brand-accent-text: #627ba2; /* Mittelblau: kleine Akzent-Texte    */
  --brand-accent-soft: #edf3fb; /* Hellblau sehr hell (Flächen)       */

  /* Abgeleitete Oberfläche – muss i. d. R. nicht angefasst werden */
  --primary: var(--brand);
  --primary-dark: var(--brand-dark);
  --accent: #eef2f6;
  --bg: #f3f2ef;
  --card: #ffffff;
  --border: #dcdfe3;
  --text: #26313a;
  --muted: #6e7b86;
  --green: #2e7d32;
  --orange: #d05e00;
  --red: #c62828;
  --gray: #757575;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(16,28,38,.05), 0 1px 6px rgba(16,28,38,.04);
  --shadow-2: 0 4px 14px rgba(16,28,38,.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); }
h1, h2, h3 { letter-spacing: -0.01em; }

/* „Plankopf"-Beschriftung: versal, gesperrt – das wiederkehrende Motiv */
.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--brand-accent-text);
}

/* ---------------- Anmeldung ---------------- */
#login-view {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background:
    linear-gradient(160deg, rgba(36,56,74,.045) 0%, rgba(36,56,74,0) 45%),
    var(--bg);
}
.login-box {
  background: var(--card);
  padding: 38px 40px 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-accent);   /* Plankopf-Linie */
  box-shadow: var(--shadow-2);
  width: 380px;
}
.login-logo { max-height: 52px; max-width: 240px; display: block; margin-bottom: 16px; }
.login-box h1 { margin: 2px 0 2px; color: var(--brand); font-size: 26px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }

/* ---------------- Kopfleiste ---------------- */
header {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-ink) 130%);
  color: #fff; padding: 9px 20px;
  border-bottom: 3px solid var(--brand-accent);  /* Plankopf-Linie */
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
  min-height: 56px;
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.brand-logo { height: 34px; max-width: 150px; background: #fff; border-radius: 6px; padding: 3px 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand-text small {
  font-size: 9.5px; font-weight: 700; letter-spacing: .22em;
  text-transform: uppercase; color: var(--brand-accent);
}
#breadcrumb { flex: 1; font-size: 14px; opacity: .95; min-width: 160px; }
#breadcrumb a { color: #fff; text-decoration: none; opacity: .85; }
#breadcrumb a:hover { opacity: 1; text-decoration: underline; }
.header-right { display: flex; align-items: center; gap: 10px; }
.header-right .muted { color: #b9c6d2; }
#global-search {
  width: 290px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px; font-size: 14px;
  background: rgba(255,255,255,.10); color: #fff;
}
#global-search::placeholder { color: #a8b6c2; }
#global-search:focus { background: #fff; color: var(--text); outline: none; }
.header-btn { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.25); color: #fff; }
.header-btn:hover { background: rgba(255,255,255,.22); }

main { padding: 22px 20px 48px; max-width: 1400px; margin: 0 auto; }

/* ---------------- Karten & Raster ---------------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-1);
}
.card h3 {
  margin: 0 0 12px; font-size: 15px; color: var(--brand);
  padding-bottom: 8px; border-bottom: 1px solid #eef0f2;
}
.card.clickable { cursor: pointer; transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease; }
.card.clickable:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); border-color: #cfd5da; }

/* ---------------- Bedienelemente ---------------- */
.btn {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 15px; cursor: pointer; font-size: 14px; color: var(--text);
  transition: background .13s ease, border-color .13s ease, box-shadow .13s ease;
}
.btn:hover { background: #f2f4f6; border-color: #c8cdd2; }
.btn.primary {
  background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600;
}
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.primary:disabled { background: #9aa7b1; border-color: #9aa7b1; cursor: not-allowed; }
.btn.small { padding: 4px 11px; font-size: 13px; border-radius: 7px; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: #fdf1f0; border-color: #e6b6b2; }
.btn:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand-accent); outline-offset: 2px;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .13s ease, box-shadow .13s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(36,56,74,.12);
}
.req::after { content: " *"; color: var(--red); }

/* ---------------- Tabellen ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--brand-accent);
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
}
td { padding: 10px; border-bottom: 1px solid #edeff1; vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--brand-accent-soft); }
tr.replaced td { opacity: .55; }

/* ---------------- Status-Kennzeichen ---------------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.in_bearbeitung { background: #eceff1; color: var(--gray); }
.badge.zur_pruefung { background: #fff3e0; color: var(--orange); }
.badge.geteilt { background: #e3f2fd; color: #1565c0; }
.badge.freigegeben { background: #e8f5e9; color: var(--green); }
.badge.ersetzt { background: #fbe9e7; color: var(--red); text-decoration: line-through; }
.badge.ungueltig { background: #fbe9e7; color: var(--red); }
.badge.archiviert { background: #eceff1; color: var(--gray); }
.badge.conf-vertraulich { background: #fce4ec; color: #ad1457; }
.badge.conf-extern { background: #e0f2f1; color: #00695c; }
.badge.conf-intern { background: #eceff1; color: var(--gray); }
.badge.overdue { background: var(--red); color: #fff; }
.badge.soon { background: var(--orange); color: #fff; }

/* ---------------- Projektbereich ---------------- */
.project-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.sidebar {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; align-self: start;
  position: sticky; top: 76px; box-shadow: var(--shadow-1);
}
.sidebar a {
  display: block; padding: 9px 12px; border-radius: 8px; text-decoration: none;
  color: var(--text); font-size: 14px; border-left: 3px solid transparent;
  transition: background .12s ease;
}
.sidebar a:hover { background: var(--accent); }
.sidebar a.active {
  background: var(--brand); color: #fff; font-weight: 600;
  border-left-color: var(--brand-accent);    /* Registerkarten-Motiv */
}
.sidebar hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

/* ---------------- Werkzeugleisten ---------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar label { min-width: 140px; }
.toolbar .spacer { flex: 1; }

/* ---------------- Dialoge ---------------- */
#modal-backdrop {
  position: fixed; inset: 0; background: rgba(16,28,38,.55);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 100; overflow-y: auto; padding: 40px 16px;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--card); border-radius: 14px; padding: 26px;
  border-top: 4px solid var(--brand-accent);
  width: 100%; max-width: 760px; box-shadow: 0 16px 50px rgba(16,28,38,.32);
}
.modal h2 { margin-top: 0; color: var(--brand); font-size: 19px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------------- Hinweisboxen ---------------- */
.warnbox { background: #fff5e6; border: 1px solid #f0c689; color: #7a4a00; padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-weight: 600; }
.warnbox.red { background: #fbe9e7; border-color: #ef9a9a; color: var(--red); }
.okbox { background: #eef7ee; border: 1px solid #a5d6a7; color: var(--green); padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-weight: 600; }
.admin-help {
  background: var(--brand-accent-soft); border: 1px solid #cfdef2;
  border-radius: 10px; padding: 12px 14px; font-size: 13px; margin: 10px 0; line-height: 1.55;
}
.admin-help code, .filelist { font-family: ui-monospace, Consolas, monospace; }
.admin-help code { background: #fff; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }
.batchbar {
  background: var(--brand-accent-soft); border: 1px solid var(--brand-accent);
  color: #2c4468; padding: 10px 14px; border-radius: 10px; margin: 10px 0; font-size: 14px;
}

/* ---------------- Facetten / Filterchips ---------------- */
.facets { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.facet {
  background: #fff; border: 1px solid var(--border); border-radius: 20px;
  padding: 3px 13px; font-size: 13px; cursor: pointer; transition: all .12s ease;
}
.facet:hover { border-color: var(--brand); color: var(--brand); }
.facet.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------------- Erfassung ---------------- */
.auto-detected { outline: 2px solid #66bb6a; background: #f4fbf4; }
.dropzone {
  border: 2px dashed #c9cfd5; border-radius: var(--radius); padding: 28px 16px;
  text-align: center; cursor: pointer; color: var(--muted);
  transition: all .15s ease; background: #fbfbfa;
}
.dropzone:hover, .dropzone.over { border-color: var(--brand-accent); color: var(--brand); background: var(--brand-accent-soft); }
.dropzone strong { color: var(--text); }
#dropzone-file { margin-top: 6px; font-size: 13px; }
.preview-frame { width: 100%; height: 480px; border: 1px solid var(--border); border-radius: 10px; background: #fff; margin-top: 10px; }

/* ---------------- Meldung ---------------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--brand-ink); color: #fff; padding: 12px 22px;
  border-radius: 10px; z-index: 200; box-shadow: var(--shadow-2);
  border-left: 3px solid var(--brand-accent);
}
#toast.error { background: var(--red); border-left-color: #8c1c1c; }

/* ---------------- Kennzahlen ---------------- */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 20px 12px; min-width: 130px; box-shadow: var(--shadow-1);
  border-top: 3px solid var(--brand-accent);
}
.stat .num { font-size: 26px; font-weight: 700; color: var(--brand); letter-spacing: -0.02em; }
.stat .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

/* ---------------- Versionshistorie ---------------- */
.version-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
  flex-wrap: wrap; background: #fff;
}
.version-row.current { border-color: var(--green); background: #f6fbf6; box-shadow: inset 3px 0 0 var(--green); }
.version-row .vlabel { font-weight: 700; min-width: 80px; }

/* ---------------- Administration ---------------- */
.maint-banner {
  background: var(--orange); color: #fff; text-align: center;
  padding: 8px 16px; font-weight: 600; font-size: 14px;
  position: sticky; top: 59px; z-index: 49;
}
.maint-banner a { color: #fff; }
#maint-view { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.kv { width: 100%; font-size: 14px; border-collapse: collapse; }
.kv td { padding: 7px 8px; border-bottom: 1px solid #edeff1; }
.kv td:first-child { color: var(--muted); width: 40%; white-space: nowrap; }
.filelist {
  max-height: 220px; overflow-y: auto; background: #fafbfc;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 12px;
}
.spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 3px solid var(--brand-accent-soft); border-top-color: var(--brand-accent);
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.logo-preview { max-height: 60px; max-width: 260px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }

/* ---------------- Mobil & Bedienbarkeit ---------------- */
@media (max-width: 900px) {
  .project-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar a { padding: 6px 10px; border-left: none; }
  .form-grid { grid-template-columns: 1fr; }
  #global-search { width: 150px; }
  .brand-text small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: .01s !important; }
  html { scroll-behavior: auto; }
}

/* Anmeldeseite mit Hintergrundbild: Karte links neben dem Motiv */
#login-view.has-bg { justify-content: center; }
@media (min-width: 1150px) {
  #login-view.has-bg { justify-content: flex-start; padding-left: 9vw; }
}
