:root {
  --bg: #F5F5F5;
  --card: #FFFFFF;
  --line: #E0E0E0;
  --line-soft: #EEEEEE;
  --text: #212121;
  --text-2: #616161;
  --text-3: #757575;
  --muted: #9E9E9E;
  --dark: #333333;
  --primary: #1F4E5F;
  --orange: #E8590C;
  --orange-bg: #FFF1E6;
  --orange-soft: #FFE8D6;
  --orange-text: #9A3412;
  --info-bg: #E3F2FD;
  --info: #1976D2;
  --info-text: #0D47A1;
  --inh: #78909C;
  --inh-bg: #ECEFF1;
  --inh-text: #455A64;
  --green: #2E7D32;
  --purple: #6A1B9A;
  --purple-bg: #F3E5F5;
  --red-bg: #FFEBEE;
  --red: #B71C1C;
  --check: #1F4E5F;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Roboto Flex", Roboto, system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
.ic { display: inline-block; flex: none; vertical-align: middle; }

/* ---------- Concept strip ---------- */
.strip {
  height: 36px; background: #1A1A1A; color: #BDBDBD; display: flex; align-items: center;
  gap: 4px; padding: 0 12px; font-size: 12px; position: sticky; top: 0; z-index: 50; overflow-x: auto;
}
.strip .lbl { color: #9E9E9E; margin-right: 8px; white-space: nowrap; }
.strip a { text-decoration: none; padding: 5px 10px; border-radius: 14px; white-space: nowrap; color: #E0E0E0; }
.strip a:hover { background: #2E2E2E; }
.strip a.on { background: var(--orange); color: #fff; font-weight: 600; }
.strip .sp { flex: 1; }
.strip button {
  background: none; border: 1px solid #444; color: #E0E0E0; border-radius: 14px; padding: 4px 10px;
  cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.strip button:hover { background: #2E2E2E; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 52px 1fr; min-height: calc(100vh - 36px); min-width: 1280px; }
.rail { background: #EEEEEE; display: flex; flex-direction: column; align-items: center; padding-top: 14px; gap: 26px; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 56px; background: var(--dark); display: flex; align-items: center; padding: 0 24px; gap: 20px; }
.logo { display: flex; align-items: center; gap: 6px; color: #fff; font-size: 11px; font-weight: 600; }
.logo .testo {
  background: radial-gradient(circle at 30% 30%, #FFB04D, #E8590C); color: #fff; font-weight: 700;
  font-size: 15px; padding: 4px 10px; border-radius: 16px;
}
.topbar .sp { flex: 1; }
.topbar .ti { position: relative; display: inline-flex; }
.topbar .badge {
  position: absolute; top: -6px; left: 12px; background: #E53935; color: #fff; font-size: 10px; font-weight: 600;
  border-radius: 8px; padding: 0 5px; line-height: 15px;
}
.body { display: flex; flex: 1; min-height: 0; }
.snav { width: 272px; background: #fff; box-shadow: 1px 0 4px rgba(0,0,0,.12); padding: 12px; flex: none; }
.snav .it {
  display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 2px; color: var(--text);
  text-decoration: none; font-size: 14px;
}
.snav .it.sub { padding: 9px 14px; }
.snav .it .t { flex: 1; }
.snav .it.on { background: #EEEEEE; font-weight: 600; }
.snav .it.sub:hover { background: #F5F5F5; }
.neu { background: var(--orange-soft); color: #C2410C; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 10px; }
.content { flex: 1; padding: 22px 32px 28px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- Generic ---------- */
h1.pt { font-size: 24px; font-weight: 600; margin: 0; }
.sub { color: var(--text-2); margin: 4px 0 0; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.card { background: var(--card); border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.btn {
  height: 40px; border-radius: 20px; padding: 0 24px; font-weight: 600; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--primary); white-space: nowrap;
}
.btn.ic-start { padding-left: 16px; }
.btn.contained { background: var(--primary); color: #fff; }
.btn.outlined { background: #fff; color: var(--primary); }
.btn.text { border-color: transparent; background: none; color: var(--primary); padding: 0 12px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible, .cb:focus-visible, .tg:focus-visible { outline: 3px solid #FF9F4D; outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500; white-space: nowrap; line-height: 15px;
}
.chip.grey { background: #EEEEEE; color: var(--text-2); }
.chip.inh { background: var(--inh-bg); color: var(--inh-text); }
.chip.or { background: var(--orange-bg); color: var(--orange-text); }
.chip.path { background: var(--purple-bg); color: var(--purple); font-size: 10px; }
.chip.red { background: var(--red-bg); color: var(--red); }
.lv-Betrachter { background: #E3F2FD; color: #0D47A1; }
.lv-Bearbeiter { background: #E8F5E9; color: #1B5E20; }
.lv-Freigeber { background: #EDE7F6; color: #4527A0; }
.lv-Alarm-Bearbeiter { background: #FFF3E0; color: #E65100; }
.lv-Alarm-Verantwortlicher { background: #FCE4EC; color: #880E4F; }
.lv-Benutzerdefiniert { background: #F5F5F5; color: #424242; }
.lv-Vollzugriff { background: #F5F5F5; color: #757575; }

/* checkbox (Web Unity look) */
.cb {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; padding: 0; cursor: pointer; border-radius: 16px; flex: none;
}
.cb:hover:not(:disabled) { background: rgba(31,78,95,.08); }
.cb i { width: 18px; height: 18px; border: 2px solid #424242; border-radius: 2px; display: flex; align-items: center; justify-content: center; }
.cb.on i, .cb.ind i { background: var(--check); border-color: var(--check); }
.cb.on i::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.cb.ind i { background: #fff; }
.cb.ind i::after { content: ""; width: 10px; height: 2px; background: var(--check); }
.cb.inh i { background: #B0BEC5; border-color: #B0BEC5; }
.cb.inh i::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.cb:disabled { cursor: default; }
.cb.dis i { border-color: #D6D6D6; }
.cb.dis.on i { background: #CFD8DC; border-color: #CFD8DC; }
.cbw { display: inline-flex; align-items: center; }
.cbw .ic { margin-left: -4px; }

/* toggle */
.tg { width: 44px; height: 24px; border-radius: 12px; border: 2px solid var(--check); background: #fff; position: relative; cursor: pointer; padding: 0; flex: none; }
.tg::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--check); transition: left .15s; }
.tg.on { background: var(--check); }
.tg.on::after { left: 23px; background: #fff; }
.tg:disabled { opacity: .3; cursor: default; }

/* radio */
.rb { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; margin-top: 2px; }
.rb.on { border: 5px solid var(--orange); }

/* tree */
.tree { width: 268px; flex: none; padding: 16px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid #BDBDBD; border-radius: 4px; padding: 0 10px; height: 36px; background: #fff; }
.search input { border: 0; outline: 0; font: inherit; font-size: 13px; flex: 1; min-width: 0; }
.tn {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px 7px 4px; border-radius: 4px; cursor: pointer;
  font-size: 13px; border: 0; background: none; width: 100%; text-align: left;
}
.tn:hover { background: #F5F5F5; }
.tn.sel { background: var(--orange-bg); font-weight: 600; }
.tn.lock { color: var(--muted); }
.tn .exp { width: 18px; height: 18px; display: inline-flex; border-radius: 3px; }
.tn .exp:hover { background: #E0E0E0; }
.cnt { background: #EEEEEE; color: var(--text-2); font-size: 10px; font-weight: 600; border-radius: 9px; padding: 1px 6px; }
.tn.sel .cnt { background: #FFD8B8; color: var(--orange-text); }

.split { display: flex; flex: 1; min-height: 640px; }
.det { flex: 1; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.crumb { display: flex; align-items: center; gap: 4px; color: var(--text-3); font-size: 12px; flex-wrap: wrap; }
.crumb button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text-3); font-size: 12px; }
.crumb button:hover { text-decoration: underline; }

/* tables */
.tbl { border: 1px solid var(--line); border-radius: 4px; overflow: visible; }
.tbl .tr { display: grid; align-items: center; border-top: 1px solid var(--line-soft); padding: 6px 4px 6px 12px; position: relative; background: #fff; }
.tbl .tr:first-child { border-top: 0; }
.tbl .tr.head { background: #FAFAFA; padding-top: 10px; padding-bottom: 8px; font-size: 12px; font-weight: 600; color: #424242; border-radius: 4px 4px 0 0; }
.tbl .tr.changed { background: #FFF8F1; }
.tbl .tr.changed::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 3px; background: var(--orange); }
.tbl .tr.locked { background: #FAFAFA; }
.hc { font-size: 11px; font-weight: 600; text-align: center; line-height: 13px; color: #424242; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.grp { display: grid; font-size: 11px; color: var(--text-3); font-weight: 500; text-align: center; }
.grp span { border-bottom: 1px solid #BDBDBD; margin: 0 6px; padding-bottom: 4px; }
.cc { display: flex; justify-content: center; align-items: center; }
.rn b { font-weight: 500; display: block; font-size: 13px; }
.rn span { font-size: 11px; color: var(--text-3); }

.dd {
  display: flex; align-items: center; gap: 4px; border: 1px solid #BDBDBD; border-radius: 4px; padding: 6px 6px 6px 10px;
  background: #fff; cursor: pointer; font-size: 12px; width: 100%; text-align: left;
}
.dd.open { border: 2px solid var(--orange); padding: 5px 5px 5px 9px; }
.dd .t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.iconbtn { border: 0; background: none; padding: 4px; border-radius: 50%; cursor: pointer; display: inline-flex; }
.iconbtn:hover { background: #EEEEEE; }
.iconbtn:disabled { opacity: .3; cursor: default; }

.menu {
  position: absolute; z-index: 30; background: #fff; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18);
  padding: 8px 0; min-width: 240px;
}
.menu .mh { font-size: 10px; font-weight: 600; color: var(--muted); padding: 4px 16px 6px; letter-spacing: .5px; }
.menu .mo { display: flex; gap: 10px; padding: 8px 16px 8px 12px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.menu .mo:hover { background: #F5F5F5; }
.menu .mo.on { background: var(--orange-bg); }
.menu .mo b { font-weight: 500; display: block; font-size: 13px; }
.menu .mo.on b { font-weight: 600; }
.menu .mo span { font-size: 11px; color: var(--text-3); }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 6px 0; }

.banner { display: flex; gap: 10px; padding: 10px 14px; border-radius: 4px; background: var(--info-bg); color: var(--info-text); font-size: 12px; line-height: 1.45; }
.banner ul { margin: 4px 0 0; padding-left: 18px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; font-size: 11px; color: var(--text-2); }
.legend > span { display: inline-flex; align-items: center; gap: 2px; }

.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 4px 0 10px; cursor: pointer; color: var(--text-3); font-size: 13px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--orange); }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 60; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 480px; background: #fff; z-index: 61;
  box-shadow: -4px 0 16px rgba(0,0,0,.2); display: flex; flex-direction: column;
}
.drawer .dh { display: flex; align-items: center; padding: 20px 16px 16px 24px; }
.drawer .db { flex: 1; overflow: auto; padding: 4px 24px 16px; display: flex; flex-direction: column; gap: 22px; }
.drawer .df { display: flex; justify-content: flex-end; gap: 12px; padding: 12px 24px 16px; border-top: 1px solid var(--line); }
.step { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.step i { background: var(--dark); color: #fff; font-style: normal; font-size: 11px; border-radius: 10px; padding: 1px 7px; }

.seg { display: flex; border: 1px solid #BDBDBD; border-radius: 6px; overflow: hidden; background: #fff; }
.seg button { flex: 1; border: 0; border-right: 1px solid #BDBDBD; background: #fff; padding: 9px 12px; cursor: pointer; font-size: 12px; color: #424242; white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--dark); color: #fff; font-weight: 600; }
.seg button:disabled, .menu .mo:disabled { opacity: .4; cursor: default; }

.stepper { display: inline-flex; border: 1px solid #BDBDBD; border-radius: 4px; align-items: center; }
.stepper button { border: 0; background: none; padding: 3px 10px; cursor: pointer; font-size: 14px; }
.stepper button:disabled { opacity: .3; }
.stepper b { padding: 0 6px; min-width: 18px; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--dark); color: #fff;
  padding: 10px 16px; border-radius: 4px; z-index: 80; display: flex; gap: 16px; align-items: center; font-size: 13px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.toast button { background: none; border: 0; color: #FFB74D; font-weight: 600; cursor: pointer; }

/* concept notes drawer */
.notes { position: fixed; top: 36px; right: 0; bottom: 0; width: 440px; background: #fff; z-index: 70; box-shadow: -4px 0 16px rgba(0,0,0,.2); overflow: auto; padding: 28px; }
.notes h2 { font-size: 22px; margin: 10px 0 16px; }
.notes h3 { font-size: 11px; letter-spacing: .6px; color: var(--text-3); margin: 18px 0 6px; text-transform: uppercase; }
.notes ul { margin: 0; padding-left: 18px; line-height: 1.5; color: #333; }
.notes li { margin-bottom: 4px; }

.empty { color: var(--text-3); font-size: 13px; padding: 24px; text-align: center; }
.pill-btn { border: 1px solid #BDBDBD; background: #fff; border-radius: 16px; padding: 6px 12px; cursor: pointer; font-size: 12px; color: #424242; }
.pill-btn.on { background: var(--dark); border-color: var(--dark); color: #fff; font-weight: 600; }
.link { border: 0; background: none; color: #1565C0; font-weight: 500; font-size: 12px; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }
select.native { font: inherit; font-size: 13px; padding: 7px 8px; border: 1px solid #BDBDBD; border-radius: 4px; background: #fff; }
