/* ========================================================================
   Pro:Tec RtC Tool — Corporate Design v2
   Quelle: TYPEWRITER Designs CD-Guide (2024)
   Primärfarbe: Deep Forest #2B4645
   Hausschrift: Greycliff CF (Connary Fagen Type Design)
   ======================================================================== */

/* ---- Webfonts ------------------------------------------------------------
   Greycliff CF wird via @font-face geladen sobald die WOFF2-Dateien in
   app/static/fonts/ vorliegen. Bis dahin greift der System-Font-Stack
   (geometrische Sans-Serif), der visuell sehr nahe an Greycliff liegt.
   --------------------------------------------------------------------- */
@font-face {
  font-family: "Greycliff CF";
  src: url("/static/fonts/greycliffcf-regular.woff2") format("woff2"),
       url("/static/fonts/greycliffcf-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Greycliff CF";
  src: url("/static/fonts/greycliffcf-bold.woff2") format("woff2"),
       url("/static/fonts/greycliffcf-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Greycliff CF";
  src: url("/static/fonts/greycliffcf-thin.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

/* ---- CD-Farbpalette (TYPEWRITER Designs) ----------------------------- */
:root {
  /* Primär */
  --brand:         #2b4645;
  --brand-light:   #3d5e5d;
  --brand-bg:      #f5f8f8;

  /* Sekundär (CD-konform) */
  --chalk-mint:    #c1d0d0;
  --light-taupe:   #ece9eb;

  /* Text */
  --off-black:     #3c3c3b;
  --text:          #3c3c3b;
  --muted:         #6b7574;

  /* Strukturfarben */
  --border:        #d0d6d6;
  --white:         #ffffff;

  /* Signal — CD-konform: Coral für Aktionsbedarf */
  --coral:         #eb5848;
  --coral-hover:   #d3422f;
  --coral-bg:      #fdebe8;

  /* Status */
  --success:       #2d6a4f;
  --success-bg:    #e7f5ee;
  --warning:       #c47a16;

  /* Typografie */
  --font-sans: "Greycliff CF",
               "Outfit", "Nunito Sans", "Inter",
               -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---- Reset / Basis ---------------------------------------------------- */
* { box-sizing: border-box; }
button { font-family: inherit; }

body {
  font-family: var(--font-sans);
  font-weight: 400;
  margin: 0;
  background: var(--brand-bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Header / Topbar -------------------------------------------------- */
header.topbar {
  background: var(--brand);
  color: var(--white);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}
header.topbar a { color: var(--white); text-decoration: none; display: flex; align-items: center; gap: 14px; }
header.topbar .brand-logo { width: 36px; height: 42px; flex-shrink: 0; }
header.topbar .brand-logo svg { width: 100%; height: 100%; display: block; }
header.topbar .brand-name { font-weight: 700; font-size: 20px; letter-spacing: 0.4px; line-height: 1.1; }
header.topbar .brand-sub  { font-size: 12px; opacity: 0.82; font-weight: 400; letter-spacing: 0.2px; }

/* ---- Layout ----------------------------------------------------------- */
main { max-width: 1200px; margin: 28px auto; padding: 0 28px; }
h1 { font-size: 26px; margin: 0 0 18px; color: var(--brand); font-weight: 700; letter-spacing: -0.2px; }
h2 { font-size: 18px; margin: 24px 0 12px; color: var(--brand); font-weight: 700; }

/* ---- Card ------------------------------------------------------------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px 26px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(43,70,69,0.04);
}

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-block;
  padding: 9px 20px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: var(--brand);
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  vertical-align: middle;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--brand-light); border-color: var(--brand-light); }

.btn-secondary { background: transparent; color: var(--brand); }
.btn-secondary:hover { background: var(--brand); color: var(--white); }

.btn-danger {
  background: var(--coral);
  border-color: var(--coral);
  color: var(--white);
}
.btn-danger:hover { background: var(--coral-hover); border-color: var(--coral-hover); }

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  min-height: 24px;
}
.btn-block { display: block; width: 100%; }
table td .btn { vertical-align: middle; }

/* ---- Formulare -------------------------------------------------------- */
form .field { margin-bottom: 18px; }
form label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--brand);
  letter-spacing: 0.2px;
}
form .field-hint {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
form input, form select, form textarea {
  width: 100%;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(43, 70, 69, 0.15);
}

/* ---- Tabelle ---------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--brand);
  color: var(--white);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
table td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--brand-bg); }

/* ---- Empty State / Flash --------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--muted);
  font-style: italic;
}
.flash-success {
  background: var(--success-bg);
  color: var(--success);
  padding: 11px 16px;
  border-radius: 6px;
  border-left: 4px solid var(--success);
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-error {
  background: var(--coral-bg);
  color: var(--coral-hover);
  padding: 11px 16px;
  border-radius: 6px;
  border-left: 4px solid var(--coral);
  margin-bottom: 16px;
  font-size: 14px;
}

/* ---- Helpers ---------------------------------------------------------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ---- Header-Navigation ----------------------------------------------- */
header.topbar { justify-content: space-between; }
header.topbar .brand-link { flex-shrink: 0; }
header.topbar .main-nav { display: flex; gap: 6px; }
header.topbar .nav-link {
  display: inline-block;
  padding: 8px 18px;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  border-radius: 6px;
  opacity: 0.78;
  transition: background 0.15s, opacity 0.15s;
}
header.topbar .nav-link:hover { background: rgba(255,255,255,0.10); opacity: 1; }
header.topbar .nav-link.active { background: rgba(255,255,255,0.15); opacity: 1; }
header.topbar .nav-toggle { display: none; margin-left: auto; background: rgba(255,255,255,.12); border: 0; color: var(--white); font-size: 22px; line-height: 1; width: 44px; height: 40px; border-radius: 8px; cursor: pointer; }
/* U1 (Validierung 08.09.2026): Tablet — Navigation umbrechen bzw. einklappen */
@media (max-width: 1200px) { header.topbar .nav-link { padding: 8px 12px; } header.topbar { padding: 12px 18px; } }
@media (max-width: 1000px) {
  header.topbar { flex-wrap: wrap; }
  header.topbar .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  header.topbar .main-nav { display: none; width: 100%; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.15); margin-top: 4px; }
  header.topbar.nav-open .main-nav { display: flex; }
  header.topbar .main-nav .nav-link { display: block; padding: 10px 12px; }
  header.topbar .main-nav > span { display: flex !important; flex-wrap: wrap; align-items: center; margin-left: 0 !important; margin-top: 6px; }
}
/* Breite Tabellen scrollen im eigenen Rahmen, nie die Seite */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll > table { min-width: 720px; }
.nowrap { white-space: nowrap; }

/* ---- Toolbar (Suche + Filter) --------------------------------------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar form.search-form { display: flex; gap: 6px; align-items: center; }
.toolbar input[type=search] {
  width: 280px; padding: 8px 12px;
  font-family: inherit; font-size: 14px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--white); color: var(--text);
}
.toolbar input[type=search]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(43,70,69,0.15); }
.filter-pills { display: flex; gap: 4px; background: var(--white); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.filter-pills a {
  display: inline-block; padding: 6px 14px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.2px; text-decoration: none; color: var(--brand);
  border-radius: 5px; transition: background 0.12s;
}
.filter-pills a:hover { background: var(--brand-bg); }
.filter-pills a.active { background: var(--brand); color: var(--white); }
.result-count { color: var(--muted); font-size: 13px; margin-left: auto; }

/* ---- Linkbare Tabellenzellen ---------------------------------------- */
table tr.linkable { cursor: pointer; }
table tr.linkable:hover td { background: var(--brand-bg); }

/* ---- Data-Grid (Stammdaten) ----------------------------------------- */
table.data-grid { width: auto; min-width: 480px; }
table.data-grid th {
  background: transparent; color: var(--muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 700; padding: 8px 14px 8px 0; text-align: left; width: 200px;
  border-bottom: 1px solid var(--border);
}
table.data-grid td {
  font-size: 15px; padding: 8px 0;
  border-bottom: 1px solid var(--border); color: var(--text);
}
table.data-grid tr:last-child th, table.data-grid tr:last-child td { border-bottom: none; }
.lock-icon { font-size: 12px; color: var(--muted); margin-left: 6px; cursor: help; }

/* ---- Disabled-State für Buttons -------------------------------------- */
.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(45%);
}
.btn:disabled:hover, .btn[disabled]:hover {
  background: var(--brand); border-color: var(--brand);
}
.btn-danger:disabled, .btn-danger[disabled] {
  background: var(--coral); border-color: var(--coral); color: var(--white);
}
.btn-danger:disabled:hover, .btn-danger[disabled]:hover {
  background: var(--coral); border-color: var(--coral);
}


/* UX-Review 05.09.: Benutzer-Chip in der Kopfzeile, Gefahr-Buttons zurückhaltend */
.user-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border-radius: 20px; padding: 4px 12px 4px 12px; }
.user-chip .user-name { font-weight: 600; }
.user-chip .user-role { font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; background: rgba(255,255,255,.18); border-radius: 10px; padding: 2px 8px; }
.btn-danger-quiet { background: #fff !important; color: var(--coral, #eb5848) !important; border: 1.5px solid var(--coral, #eb5848) !important; font-size: 13px !important; padding: 6px 12px !important; margin-left: auto; }
.tile-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* Session-Cockpit */
.cockpit { padding: 14px 18px; }
.cockpit-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 900px) { .cockpit-steps { grid-template-columns: repeat(2, 1fr); } }
.cockpit-step { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border, #c1d0d0); text-decoration: none; color: inherit; background: #fff; }
.cockpit-step.ok { border-color: #2e7d32; background: #e8f3ea; }
.cockpit-step.part { border-color: #e0a800; background: #fff8e1; }
.cockpit-step.open { border-color: #eb5848; background: #fdebe8; }
.cockpit-step.ready { border-color: #2b4645; background: #ece9eb; }
.cockpit-num { font-size: 11px; font-weight: 700; color: var(--muted, #5f6e6e); }
.cockpit-label { font-weight: 700; }
.cockpit-count { font-size: 13px; color: var(--muted, #5f6e6e); }
.cockpit-next { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-weight: 600; }
.badge-warn { background: #fff8e1; color: #8a6600; }

/* Session-Seite (UX-Review 05.09., Runde 2) */
.cockpit-note { font-weight: 400; color: #8a6600; }
.report-rows { display: flex; flex-direction: column; gap: 8px; }
.report-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.report-row .report-name { flex: 0 0 260px; font-weight: 600; color: var(--brand); }
.info-tip { cursor: help; font-weight: 400; opacity: .7; margin-left: 2px; }
.cell-muted { color: var(--muted); }
