:root {
  /* HHN Corporate Design (Stand 03/2019) */
  --hhn-blue: #002896;     /* Primärfarbe Dunkelblau, RGB 0.40.150 */
  --hhn-orange: #ff9e00;   /* RGB 255.158.0 */
  --hhn-purple: #7a0b60;   /* RGB 122.11.96 */
  --hhn-grey: #747474;     /* Dunkelgrau */
  --hhn-bg-grey: #e3e3e3;  /* Hintergrundgrau */

  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #5f6670;
  --border: #d6d9de;
  --ok: #1d7a46;
  --warn: #b26a00;
  --err: #b3261e;
  --radius: 6px;
  --footer-h: 34px;

  /* Modusfarbe: Übung (Standard) */
  --accent: var(--hhn-blue);
  --accent-text: #ffffff;   /* Text auf Akzentflächen */
  --accent-ink: var(--hhn-blue); /* Akzent als Textfarbe auf Weiß */
  --accent-tint: #e8ecf6;

  font-family: Arial, Helvetica, sans-serif; /* CD-Ersatzschrift für Meta */
  font-size: 15px;
  color: var(--text);
}
body.mode-exam {
  --accent: var(--hhn-purple);
  --accent-ink: var(--hhn-purple);
  --accent-tint: #f5e8f1;
}
body.mode-admin {
  --accent: var(--hhn-orange);
  --accent-text: #1d2330;        /* Weiß auf Orange wäre zu kontrastarm */
  --accent-ink: #9a5800;         /* dunkles Orange für Text auf Weiß */
  --accent-tint: #fff2dc;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { display: flex; flex-direction: column; }
body > section, body > div { flex: 1 0 auto; }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }

button, .btn {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
}
button:hover { border-color: var(--accent-ink); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--err); }
button:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.error { color: var(--err); margin-top: 12px; min-height: 1.2em; }
.muted { color: var(--muted); }

/* ---------- Login ---------- */

.login-wrap {
  display: flex; align-items: center; justify-content: center; padding: 32px 16px;
  background: linear-gradient(rgba(0, 20, 70, .25), rgba(0, 20, 70, .25)), url("/img/campus.jpg") center / cover no-repeat;
}
.login { width: 100%; max-width: 420px; border: none; border-top: 6px solid var(--accent); border-radius: 4px; box-shadow: 0 8px 32px rgba(0, 0, 0, .25); }
.login .login-logo { display: block; height: 58px; width: auto; margin: 0 0 20px; }
.login h1 { font-size: 22px; margin: 0 0 4px; color: var(--accent-ink); }
#login-kicker { text-transform: uppercase; letter-spacing: .6px; font-size: 13px; }
.tabs { display: flex; gap: 4px; margin: 20px 0 4px; border-bottom: 1px solid var(--border); }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; }
.tabs button.active { border-bottom-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.login form button.primary { width: 100%; margin-top: 18px; padding: 10px; }
.privacy { font-size: 12px; margin: 16px 0 0; }
.login h1 { margin-top: 2px; }
.login form { margin-top: 8px; }
.register { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.register p { margin: 0 0 8px; font-size: 14px; }
.credentials { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 18px 0; font-size: 15px; }
.credentials dt { color: var(--muted); }
.credentials dd { margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: 1px; }
#register-result button.primary { width: 100%; margin-top: 16px; padding: 10px; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text); }
label.check input { width: auto; }
.code-input { font-family: ui-monospace, Consolas, monospace; font-size: 18px; letter-spacing: 2px; text-transform: uppercase; }
.notice { background: #fff4e0; border: 1px solid #f0d199; border-radius: var(--radius); padding: 10px 12px; margin-top: 16px; font-size: 14px; }

/* ---------- Kopfleiste ---------- */

.topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 16px; background: var(--surface); border-bottom: 4px solid var(--accent);
}
.topbar .brand { height: 34px; width: auto; display: block; margin-right: 6px; }
.topbar .title { font-weight: 600; }
.topbar .who { color: var(--muted); font-size: 14px; }
.topbar .spacer { flex: 1; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--accent); color: var(--accent-text); font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.badge.exam { background: var(--hhn-purple); color: #fff; }

/* ---------- Modellliste ---------- */

.home { max-width: 860px; margin: 24px auto; padding: 0 16px; }
.home .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.model-list { list-style: none; margin: 0; padding: 0; }
.model-list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 8px;
}
.model-list li .name { flex: 1; font-weight: 500; cursor: pointer; }
.model-list li .date { color: var(--muted); font-size: 13px; }

/* ---------- Editor ---------- */

.editor { display: flex; flex-direction: column; height: calc(100vh - var(--footer-h)); flex: 0 0 auto; }
.canvas-wrap { position: relative; flex: 1; min-height: 0; background: #fff; }
#canvas { position: absolute; inset: 0; }
.watermark {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-repeat: repeat;
}
.save-state { font-size: 13px; color: var(--muted); min-width: 160px; }
.save-state.ok { color: var(--ok); }
.save-state.pending { color: var(--warn); }
.save-state.err { color: var(--err); font-weight: 600; }
.banner { padding: 8px 16px; background: #fdecea; color: var(--err); font-weight: 600; text-align: center; }

/* bpmn-js: Palette über dem Wasserzeichen halten */
.djs-palette, .djs-context-pad, .djs-popup { z-index: 10; }
.bjs-powered-by { z-index: 10; }

/* ---------- Dialog ---------- */

dialog { border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 440px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin: 0 0 8px; font-size: 18px; }
dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ---------- Fußzeile ---------- */

.site-footer {
  flex: 0 0 var(--footer-h); height: var(--footer-h);
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--surface); border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.site-footer .spacer { flex: 1; }
.site-footer .app-env { border: 1px solid currentColor; border-radius: 4px; padding: 0 6px; font-weight: 600; color: #b45309; }
.site-footer .app-env:empty { display: none; }
.site-footer a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.site-footer a[href]:hover { color: var(--text); text-decoration: underline; }
.site-footer .bpmnio svg { height: 13px; width: auto; color: #404040; }
