/* ============================================================
   myExam Cockpit Explorer – Stylesheet
   Siemens MAGNETOM Prisma Fit · UI-Nachbildung
   ============================================================ */

/* ---- Design Tokens ---------------------------------------- */
:root {
  --bg:          #252625;
  --bg2:         #2b2c2b;
  --panel:       #333533;
  --panel2:      #3b3d3a;
  --bar:         #2d2f2d;
  --bar2:        #40433f;
  --line:        #5d625b;
  --line-soft:   #474b46;
  --row1:        #74776f;
  --row2:        #686b64;
  --row3:        #5d615b;
  --row-dark:    #4b4f49;
  --text:        #f4f5f2;
  --muted:       #c8ccc4;
  --dim:         #a9afa5;
  --orange:      #ff6400;
  --orange2:     #ff7a16;
  --orange-head-top: #ff7f1a;
  --orange-head-bot: #e85800;
  --sel:         #cfd4ca;
  --selText:     #202220;
  --green:       #00c32a;
  --shadow:      rgba(0,0,0,.45);
  --focus-ring:  rgba(255,160,60,.55);
}

/* ---- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #1e1f1e;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---- App Shell -------------------------------------------- */
.app {
  height: 100vh;
  display: grid;
  grid-template-rows: 31px 64px 42px 1fr 26px;
  background: linear-gradient(180deg, #303230 0%, #252625 100%);
  overflow: hidden;
}

/* ---- Window Title ----------------------------------------- */
.window-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid #575b55;
  background: linear-gradient(180deg, #2e302e 0%, #252725 100%);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .05px;
  user-select: none;
}
.wt-left { color: var(--text); }
.window-controls {
  display: flex;
  gap: 20px;
  font-size: 18px;
  line-height: 1;
  color: #d5d9d2;
}
.window-controls span {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  transition: background .12s;
}
.window-controls span:hover { background: rgba(255,255,255,.12); }
.window-controls span:last-child:hover { background: rgba(200,50,50,.75); color: #fff; }

/* ---- Ribbon ----------------------------------------------- */
.ribbon {
  display: flex;
  align-items: stretch;
  background: #2c2e2c;
  border-bottom: 2px solid #4e524d;
  gap: 0;
  padding: 0 0 0 4px;
}
.ribbon-group {
  height: 64px;
  border: 1px solid #70746d;
  border-bottom: none;
  background: linear-gradient(180deg, #484b47 0%, #363936 100%);
  margin-left: 9px;
  display: grid;
  grid-template-rows: 28px 1fr;
  min-width: 310px;
}
.ribbon-group:nth-child(2) { min-width: 250px; }
.ribbon-title {
  padding: 7px 14px 0;
  font-size: 14px;
  font-weight: 700;
  color: #f1f3ee;
  letter-spacing: .03px;
}
.ribbon-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid rgba(255,255,255,.08);
}
.ribbon-tabs.r2 { grid-template-columns: 1fr 1fr; }
.ribbon-tabs span {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255,255,255,.1);
  font-size: 13px;
  color: #eef0ec;
  cursor: default;
  user-select: none;
  transition: background .1s;
}
.ribbon-tabs span:last-child { border-right: none; }
.ribbon-tabs span.active {
  font-weight: 700;
  background: rgba(255,255,255,.07);
  color: #fff;
}

/* ---- Toolbar ---------------------------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #4d524c;
  background: linear-gradient(180deg, #353735 0%, #2f312f 100%);
  padding: 0 6px;
}
.tool-left {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 6px 0 4px;
  height: 100%;
  border-right: 1px solid #4f544e;
}
.ico {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #d0d5cc;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: background .1s, border-color .1s;
  flex-shrink: 0;
}
.ico:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.18);
  color: #fff;
}
.ico:active {
  background: rgba(255,255,255,.17);
}
.ico svg { pointer-events: none; }
.ico-sep {
  width: 1px;
  height: 20px;
  background: #4f544e;
  margin: 0 4px;
  flex-shrink: 0;
}
.toolbar-fill { flex: 1; }

/* ---- Zoom Controls ---------------------------------------- */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px 0 6px;
}
.zoom-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #c8cdc5;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid transparent;
  background: transparent;
  transition: background .1s, border-color .1s, color .1s;
  flex-shrink: 0;
}
.zoom-btn:hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(255,255,255,.2);
  color: #fff;
}
.zoom-btn:active {
  background: rgba(255,255,255,.17);
  transform: scale(.95);
}
.zoom-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  transform: none;
}
.zoom-btn svg { pointer-events: none; }
.zoom-level {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #b8bdb5;
  cursor: pointer;
  user-select: none;
  padding: 3px 5px;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: background .1s, color .1s;
}
.zoom-level:hover {
  background: rgba(255,255,255,.08);
  color: #eee;
}

/* ---- Main Layout ------------------------------------------ */
.main {
  min-height: 0;
  display: grid;
  grid-template-columns: 318px 1fr;
  background: #252625;
  overflow: hidden;
}

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  border-right: 2px solid #141514;
  background: #2f322f;
  display: grid;
  grid-template-rows: 40px 43px 1fr;
  min-height: 0;
  overflow: hidden;
}

/* Fleet Row */
.fleet-row {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid #4a4f49;
  background: #363836;
}
.fleet-select {
  height: 28px;
  background: linear-gradient(180deg, #717469 0%, #676a63 100%);
  border: 1px solid #8e9389;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
  cursor: default;
  user-select: none;
}
.fleet-select span { font-size: 10px; color: #dde0d8; }
.lock {
  height: 28px;
  border: 1px solid #737870;
  background: linear-gradient(180deg, #595d56 0%, #4d514b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c0c5bc;
  cursor: default;
}

/* Search Row */
.search-row {
  display: grid;
  grid-template-columns: 28px 1fr 24px 46px;
  gap: 6px;
  align-items: center;
  padding: 7px 8px;
  border-bottom: 1px solid #4a4f49;
  background: #373a37;
}
.search-icon {
  width: 28px;
  height: 26px;
  border: 1px solid #828780;
  background: linear-gradient(180deg, #636860 0%, #585d56 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-row input {
  height: 26px;
  width: 100%;
  background: #6c706a;
  border: 1px solid #3d413c;
  border-top-color: #202320;
  color: #fff;
  outline: none;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  transition: border-color .15s;
}
.search-row input:focus {
  border-color: var(--orange2);
  box-shadow: 0 0 0 1px rgba(255,122,22,.25);
}
.search-row input::placeholder { color: #c8ccc5; font-weight: 400; }
.search-row button {
  height: 26px;
  width: 24px;
  border: 1px solid #606560;
  background: linear-gradient(180deg, #4d524b 0%, #444843 100%);
  color: #dde0d8;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .1s;
}
.search-row button:hover { background: linear-gradient(180deg, #5a5f59 0%, #505550 100%); color: #fff; }
.search-count {
  font-size: 11px;
  color: #c0c5bc;
  text-align: right;
  white-space: nowrap;
  user-select: none;
}

/* ---- Explorer Tree ---------------------------------------- */
.tree {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 5px 0 20px;
  scrollbar-color: #8a8f86 #2a2d2a;
  scrollbar-width: thin;
}
.tree::-webkit-scrollbar { width: 7px; }
.tree::-webkit-scrollbar-track { background: #2a2d2a; }
.tree::-webkit-scrollbar-thumb { background: #7a7f76; border-radius: 4px; }
.tree::-webkit-scrollbar-thumb:hover { background: #9a9f96; }

.node {
  height: 27px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.045);
  white-space: nowrap;
  cursor: pointer;
  color: #e0e4dd;
  position: relative;
  padding-left: calc(var(--level, 0) * 17px + 10px);
  padding-right: 8px;
  font-size: 13px;
  user-select: none;
  transition: background .08s;
}
.node:hover { background: #424640; }
.node:active { background: #3d4140; }

/* Folder nodes */
.node.folder { font-weight: 700; color: #eaeee6; }
.node.folder::before {
  content: '▸';
  width: 15px;
  margin-right: 3px;
  color: #b8bdb5;
  font-size: 11px;
  flex-shrink: 0;
  transition: transform .12s;
}
.node.folder.open::before { content: '▾'; }

/* Item nodes */
.node.item::before {
  content: '';
  width: 13px;
  height: 11px;
  margin-right: 6px;
  background: #9a9f96;
  border-radius: 1px;
  flex-shrink: 0;
  background-image: repeating-linear-gradient(
    180deg, #b0b5ac 0, #b0b5ac 1px, transparent 1px, transparent 3px
  );
}

/* Selected item */
.node.item.selected {
  background: linear-gradient(180deg, #d5dbd0 0%, #c0c6bb 100%);
  color: var(--selText);
  font-weight: 700;
  border-bottom-color: #a8aea4;
}
.node.item.selected::before { background: #5a6058; background-image: none; }
.node.item.selected:hover { background: linear-gradient(180deg, #dae0d5 0%, #c8cec3 100%); }

/* Search hit */
.node.search-hit { box-shadow: inset 3px 0 0 var(--orange2); }

/* Hidden */
.node.hidden { display: none; }

/* No results */
.no-results {
  padding: 16px 14px;
  color: #b0b5ac;
  font-size: 13px;
  line-height: 1.5;
}

/* Highlight in search */
mark {
  background: var(--orange2);
  color: #111;
  padding: 0 1px;
  border-radius: 1px;
}

/* ---- Workspace -------------------------------------------- */
.workspace {
  min-width: 0;
  overflow: auto;
  position: relative;
  background:
    radial-gradient(ellipse at 85% 85%, rgba(130,75,60,.12), transparent 38%),
    linear-gradient(180deg, #2e302e 0%, #2b2c2b 100%);
  scrollbar-color: #7a7f76 #232623;
  scrollbar-width: thin;
}
.workspace::-webkit-scrollbar { width: 9px; height: 9px; }
.workspace::-webkit-scrollbar-track { background: #232623; }
.workspace::-webkit-scrollbar-thumb { background: #6a6f66; border-radius: 5px; border: 2px solid #232623; }
.workspace::-webkit-scrollbar-thumb:hover { background: #8a8f86; }
.workspace::-webkit-scrollbar-corner { background: #1e201e; }

/* ---- Program Wrap ----------------------------------------- */
.program-wrap {
  padding: 10px 16px 80px 16px;
  min-width: max-content;
  transform-origin: top left;
}

/* ---- Pathline --------------------------------------------- */
.pathline {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #e8ece5;
  margin-bottom: 6px;
  user-select: none;
}
.path-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit {
  width: 24px;
  height: 24px;
  background: linear-gradient(180deg, #797e75 0%, #6b7068 100%);
  border: 1px solid #909690;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .1s;
  color: #e8ece5;
}
.edit:hover { background: linear-gradient(180deg, #878d83 0%, #797e75 100%); }

/* ---- Program Frame ---------------------------------------- */
.program-frame {
  width: var(--pw, auto);
  border: 2px solid #c86020;
  background: #2c2e2c;
  box-shadow:
    0 0 0 1px #141514,
    0 0 12px rgba(180,80,20,.18),
    0 8px 32px rgba(0,0,0,.35);
}

/* ---- View Tabs -------------------------------------------- */
.viewtabs {
  height: 30px;
  background: #272928;
  border-bottom: 1px solid #4a4f49;
  display: flex;
  align-items: flex-end;
  padding: 0 0 0 4px;
  gap: 2px;
  user-select: none;
}
.viewtabs span {
  height: 25px;
  min-width: 130px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #5a5f58;
  border-bottom: none;
  background: #35383480;
  font-size: 13px;
  font-weight: 700;
  color: #c0c5bc;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  transition: background .1s, color .1s;
}
.viewtabs span:hover { background: #45484480; color: #e0e4de; }
.viewtabs span.active {
  background: #929690;
  color: #fff;
  border-color: #6a6f68;
}

/* ---- Lanes Grid ------------------------------------------- */
.lanes {
  display: grid;
  grid-template-columns: var(--cols, 1fr);
  column-gap: 4px;
  background: #1e201e;
}

/* ---- Lane ------------------------------------------------- */
.lane {
  min-width: 0;
  background: #545850;
  position: relative;
}

/* Lane Header (orange bar) */
.lane-head {
  height: 30px;
  background: linear-gradient(180deg, var(--orange-head-top) 0%, var(--orange-head-bot) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  border-bottom: 1px solid #a04010;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  position: relative;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px 0 30px;
  user-select: none;
}
.lane-head .tick {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
  font-weight: 900;
  line-height: 1;
}

/* Lane flow container */
.flow { background: #555953; }

/* ---- Sequence Rows ---------------------------------------- */
.row {
  height: 39px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #74776f 0%, #666a63 100%);
  border-top: 1px solid #808780;
  border-bottom: 1px solid #404540;
  overflow: hidden;
  transition: filter .08s;
}
.row:nth-child(even) {
  background: linear-gradient(180deg, #6e726a 0%, #61655e 100%);
}
.row:hover { filter: brightness(1.08); }

/* Row top: sequence name + time */
.row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Row bottom: person icon/badge + pill */
.row-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 3px 7px;
  height: 19px;
  flex-shrink: 0;
}

/* Sequence Name */
.rname {
  font-weight: 700;
  font-size: 13px;
  text-decoration: underline;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.5);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 18px;
}
.rname.rblank {
  text-decoration: none;
  color: transparent;
}

/* Time */
.rtime {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.45);
  white-space: nowrap;
  flex-shrink: 0;
  padding-left: 8px;
}

/* Icons area (bottom-left): person icon + badge */
.ricons {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c8ccc5;
  flex-shrink: 0;
}

/* Person/patient icon */
.seq-icon {
  flex-shrink: 0;
  color: #c0c5bc;
  display: block;
}

/* Badge (arrow/chevron shape) */
.badge {
  min-width: 24px;
  height: 14px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f0f2ee;
  color: #3a3e39;
  font-size: 10px;
  font-weight: 700;
  clip-path: polygon(0 0, 80% 0, 100% 50%, 80% 100%, 0 100%, 14% 50%);
  flex-shrink: 0;
  letter-spacing: .5px;
}

/* Pill (function label, bottom-right of row-bot or dq-bot) */
.pill {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 8px 0 6px;
  background: rgba(210,214,208,.38);
  border: 1px solid rgba(255,255,255,.32);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 2px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  user-select: none;
  flex-shrink: 0;
}
.pill::before {
  content: '▶';
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 50%;
  width: 12px;
  height: 12px;
  font-size: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  flex-shrink: 0;
}

/* ---- Label Blocks ----------------------------------------- */
.label {
  min-height: 29px;
  background: linear-gradient(180deg, #626660 0%, #595d58 100%);
  border-top: 1px solid #72776e;
  border-bottom: 1px solid #3c403b;
  color: #f0f2ee;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  padding: 5px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
}
.label.orange {
  color: var(--orange2);
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, #5a5e58 0%, #525651 100%);
}

/* ---- Decision Block --------------------------------------- */

/* Decision question row */
.decision-q {
  height: 39px;
  background: linear-gradient(180deg, #5e635c 0%, #555952 100%);
  border-top: 1px solid #74796f;
  border-bottom: 1px solid #38403a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Decision top: question text */
.dq-top {
  display: flex;
  align-items: center;
  padding: 4px 8px 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Decision bottom: dropdown + pill */
.dq-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 3px 7px;
  height: 19px;
  flex-shrink: 0;
}

.qtext {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 17px;
}

/* Dropdown widget */
.dropdown {
  display: inline-flex;
  align-items: center;
  height: 18px;
  min-width: 72px;
  background: linear-gradient(180deg, #787e72 0%, #6c7268 100%);
  border: 1px solid #8e958a;
  color: #ebeee8;
  font-size: 12px;
  font-weight: 700;
  padding: 0 18px 0 7px;
  position: relative;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.dropdown::after {
  content: '▾';
  position: absolute;
  right: 5px;
  color: #dfe3dc;
  font-size: 10px;
}
/* Decision title bar (orange) */
.decision-title {
  height: 25px;
  background: linear-gradient(180deg, #5e625c 0%, #565a54 100%);
  color: var(--orange2);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #3a3e39;
  border-bottom: 1px solid #72786d;
  text-align: center;
  user-select: none;
}

/* Branch grid */
.branch-grid {
  display: grid;
  grid-template-columns: repeat(var(--bcols, 2), 1fr);
  background: #424641;
}
.branch {
  min-width: 0;
  border-right: 2px solid #262926;
  background: #565b54;
}
.branch:last-child { border-right: none; }

/* Branch header */
.branch-head {
  height: 25px;
  background: linear-gradient(180deg, #696d66 0%, #606460 100%);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #3e4240;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

/* ---- Spacer ----------------------------------------------- */
.spacer {
  background: linear-gradient(180deg, #5e625c 0%, #545852 100%);
  border-bottom: 1px solid #404740;
}

/* ---- Status Bar ------------------------------------------- */
.status {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-top: 1px solid #4a4f49;
  background: #181918;
  color: #c0c5bc;
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  user-select: none;
}

/* ---- Responsive ------------------------------------------- */
@media (max-width: 1200px) {
  .main { grid-template-columns: 290px 1fr; }
  .ribbon-group { min-width: 280px; }
  .ribbon-group:nth-child(2) { min-width: 220px; }
}
@media (max-width: 900px) {
  .main { grid-template-columns: 260px 1fr; }
  .ribbon-group { min-width: 240px; }
  .ribbon-group:nth-child(2) { min-width: 190px; }
  .viewtabs span { min-width: 100px; font-size: 12px; padding: 0 10px; }
}
@media (max-width: 680px) {
  .sidebar { display: none; }
  .main { grid-template-columns: 1fr; }
}

/* ---- Focus / Accessibility -------------------------------- */
:focus-visible {
  outline: 2px solid var(--orange2);
  outline-offset: 1px;
}
button:focus-visible, .ico:focus-visible, .zoom-btn:focus-visible {
  outline: 2px solid var(--orange2);
  outline-offset: 2px;
}
