/* Secure access landing page */
.access-page {
  min-height: 100vh;
  margin: 0;
  background: #f5f3f8;
}

.access-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(420px, .95fr);
}

.access-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 8vw, 120px);
  color: #fff;
  background: linear-gradient(145deg, #17102c 0%, #2b1642 58%, #641e8c 100%);
}

.access-brand::after {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  right: -270px;
  bottom: -240px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  box-shadow: 0 0 0 72px rgba(255,255,255,.025), 0 0 0 144px rgba(255,255,255,.02);
}

.access-eyebrow, .access-kicker {
  margin: 0 0 20px;
  color: #43d7cf;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.access-brand h1 {
  max-width: 650px;
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(42px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: -.035em;
}

.access-brand > p:not(.access-eyebrow) {
  max-width: 580px;
  margin: 28px 0 0;
  color: rgba(255,255,255,.73);
  font-size: 17px;
  line-height: 1.65;
}

.access-mark {
  position: absolute;
  top: 36px;
  left: 40px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 9px;
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 700;
}

.access-panel {
  display: grid;
  place-items: center;
  padding: 40px;
}

.access-card {
  width: min(100%, 440px);
  padding: clamp(34px, 5vw, 56px);
  background: #fff;
  border: 1px solid #e5e0e9;
  border-radius: 4px;
  box-shadow: 0 24px 70px rgba(27, 15, 44, .10);
}

.access-card h2 {
  margin: 0;
  color: #1b1326;
  font-family: Georgia, serif;
  font-size: 34px;
  line-height: 1.15;
}

.access-copy {
  margin: 14px 0 28px;
  color: #6a6272;
  line-height: 1.55;
}

.access-form {
  display: grid;
  gap: 11px;
}

.access-username {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.access-form label {
  color: #302839;
  font-size: 13px;
  font-weight: 800;
}

.access-form input {
  box-sizing: border-box;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid #cfc8d4;
  border-radius: 3px;
  background: #fbfafc;
  font: inherit;
}

.access-form input:focus {
  outline: 3px solid rgba(100,30,140,.13);
  border-color: #641e8c;
}

.access-form button {
  margin-top: 7px;
  padding: 15px 18px;
}

.access-error {
  padding: 12px 14px;
  color: #871f2a;
  background: #fff1f2;
  border-left: 3px solid #b42332;
  font-size: 14px;
}

.access-assurance {
  margin: 22px 0 0;
  color: #807687;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 800px) {
  .access-shell { grid-template-columns: 1fr; }
  .access-brand { min-height: 300px; padding: 100px 32px 46px; }
  .access-brand h1 { font-size: clamp(36px, 10vw, 50px); }
  .access-panel { padding: 24px 18px 40px; }
  .access-card { padding: 32px 24px; }
}

/* Siemens Energy palette, carried from the workbook so screen and deliverable
   read as one artefact. Yellow means the same thing here as it does in the
   spreadsheet: a cell only a person can fill. */
:root {
  --plum:    #641E8C;
  --petrol:  #009999;
  --deep:    #1B1534;
  --amber:   #FFB612;
  --pink:    #C2185B;
  --muted:   #6E6A7A;
  --rule:    #E3E0E8;
  --paper:   #FFFFFF;
  --sheet:   #F7F6F9;
  --font: Arial, "Liberation Sans", Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--deep);
  background: var(--sheet);
}

h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0 0 .6rem; }
code { font-family: var(--font); color: var(--muted); }

/* ---------------------------------------------------------------- masthead */
.masthead { background: var(--plum); color: #fff; padding: 1.4rem 0; }
.masthead-inner { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; }
.masthead h1 { font-size: 1.55rem; letter-spacing: -.01em; }
.masthead .sub { margin: .25rem 0 0; color: #E4CFF2; font-size: .82rem; }

.notices { max-width: 1240px; margin: 1rem auto 0; padding: 0 1.5rem; }
.notice {
  background: #fff; border-left: 3px solid var(--petrol);
  padding: .6rem .85rem; margin: 0 0 .5rem; font-size: .88rem;
}

/* ------------------------------------------------------------------ layout */
.shell {
  max-width: 1240px; margin: 0 auto; padding: 1.5rem;
  display: grid; grid-template-columns: 310px 1fr; gap: 1.5rem;
  align-items: start;
}
.rail { position: sticky; top: 1.5rem; display: grid; gap: 1rem; }

.panel { background: var(--paper); border: 1px solid var(--rule); padding: 1rem 1.1rem; }
.panel h2 {
  font-size: .82rem; color: var(--plum);
  padding-bottom: .5rem; margin-bottom: .75rem; border-bottom: 1px solid var(--rule);
}
.panel.quiet h2 { color: var(--muted); }
.count { font-size: .88rem; color: var(--muted); }
.count strong { color: var(--deep); font-size: 1.1rem; }
.empty { color: var(--muted); font-size: .86rem; }
.hint { margin: .7rem 0 0; font-size: .78rem; color: var(--muted); line-height: 1.45; }

.filelist { list-style: none; margin: 0 0 .9rem; padding: 0; font-size: .8rem; }
.filelist li {
  padding: .22rem 0; border-bottom: 1px solid var(--rule);
  color: var(--muted); word-break: break-all;
}
.filelist li:last-child { border-bottom: 0; }
.filelist a { color: var(--petrol); text-decoration: none; }
.filelist a:hover { text-decoration: underline; }
.filelist .more { font-style: italic; }
.workbook-action {
  display: block; color: var(--muted); font-size: .7rem; line-height: 1.25;
}

/* ------------------------------------------------------------------- forms */
.stack { display: grid; gap: .3rem; }
.stack label, .rulingform label {
  font-size: .74rem; font-weight: 700; color: var(--muted);
}
input, select, textarea, button {
  font-family: var(--font); font-size: .85rem;
}
input, select, textarea {
  width: 100%; padding: .42rem .55rem;
  border: 1px solid var(--rule); background: #fff; color: var(--deep);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--petrol); outline-offset: 1px; border-color: var(--petrol);
}
input[type=file] { padding: .3rem; font-size: .78rem; }

button {
  margin-top: .45rem; padding: .5rem .8rem; cursor: pointer;
  border: 1px solid var(--plum); background: #fff; color: var(--plum); font-weight: 700;
}
button:hover { background: var(--plum); color: #fff; }
button.primary { background: var(--plum); color: #fff; }
button.primary:hover { background: #4E1670; border-color: #4E1670; }
button.danger { border-color: var(--pink); color: var(--pink); }
button.danger:hover { background: var(--pink); color: #fff; }
button:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

/* ------------------------------------------------------------------ docket */
.tally {
  display: flex; flex-wrap: wrap; gap: 1.5rem;
  background: var(--paper); border: 1px solid var(--rule);
  padding: .8rem 1.1rem; margin-bottom: 1rem;
}
.stat { font-size: .8rem; color: var(--muted); }
.stat b { display: block; font-size: 1.3rem; color: var(--deep); line-height: 1.15; }
.stat.awaiting b { color: var(--plum); }

.blank {
  background: var(--paper); border: 1px solid var(--rule);
  padding: 2.5rem 1.5rem; text-align: center;
}
.blank h2 { font-size: 1rem; margin-bottom: .5rem; }
.blank p { color: var(--muted); max-width: 46ch; margin: 0 auto; }

.finding {
  background: var(--paper); border: 1px solid var(--rule);
  border-left: 4px solid var(--rule); padding: 1rem 1.2rem; margin-bottom: .85rem;
}
.finding.awaiting { border-left-color: var(--amber); }
.finding.ruled { border-left-color: var(--petrol); }

.finding-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: .6rem; }
.gapid { font-weight: 700; color: var(--plum); }
.finding-head h3 { font-size: .96rem; flex: 1 1 16rem; }
.sev { font-size: .7rem; font-weight: 700; padding: .1rem .45rem; border: 1px solid; }
.sev-high { color: var(--pink); border-color: var(--pink); }
.sev-medium { color: #9A6A00; border-color: var(--amber); }
.sev-low { color: var(--muted); border-color: var(--rule); }
.status { font-size: .74rem; color: var(--muted); }

.subjects { margin: .5rem 0 .35rem; font-weight: 700; font-size: .84rem; }
.evidence { font-size: .87rem; max-width: 82ch; }
.provenance { font-size: .74rem; color: var(--muted); margin-bottom: .8rem; }

.unruled {
  background: #FFFBEB; border: 1px solid var(--amber);
  padding: .5rem .7rem; font-size: .82rem; max-width: 80ch;
}
.ruling { border-top: 1px solid var(--rule); padding-top: .7rem; font-size: .87rem; max-width: 82ch; }
.ruling b { color: var(--plum); }
.assign { color: var(--muted); font-size: .8rem; margin-bottom: 0; }

details { margin-top: .6rem; }
summary { cursor: pointer; font-size: .78rem; color: var(--petrol); }
summary:focus-visible { outline: 2px solid var(--petrol); outline-offset: 2px; }

.rulingform { display: grid; gap: .3rem; margin-top: .7rem; max-width: 62rem; }
.rulingform .row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .7rem; }
.rulingform .row span { display: grid; gap: .3rem; }
.rulingform button { justify-self: start; }

.foot {
  max-width: 1240px; margin: 0 auto; padding: 1.5rem;
  font-size: .74rem; color: var(--muted); border-top: 1px solid var(--rule);
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; }
  .rulingform .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------- inventory screen */
.wide { max-width: 1500px; margin: 0 auto; padding: 1.5rem; }
.backlink { font-size: .82rem; }
.backlink a, .hint a { color: var(--petrol); }

.inv { width: 100%; border-collapse: collapse; font-size: .78rem; }
.inv th {
  text-align: left; font-size: .7rem; color: #fff; background: var(--deep);
  padding: .45rem .5rem; position: sticky; top: 0;
}
.inv td { padding: .45rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.inv td.num, .inv th.num { text-align: right; }
.inv tr.weak td { background: #FFFBEB; }
.inv tr.weak td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.inv .src { font-weight: 700; color: var(--plum); }
.inv .file { word-break: break-all; max-width: 16rem; }
.inv .pool { color: var(--muted); font-size: .72rem; }
.wide-hint { max-width: 78ch; margin-top: .9rem; }

/* ----------------------------------------------------------- workshop app */
.wk-app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100dvh;
  overflow: hidden;
  background: var(--sheet);
}

.wk-sidebar {
  background: var(--deep);
  color: #fff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--rule);
  z-index: 10;
}
.wk-brand {
  padding: 1.5rem;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.wk-title {
  font-size: 1.1rem;
  margin: 0 0 0.25rem 0;
  line-height: 1.3;
}
.wk-meta {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
}

.wk-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
}
.wk-nav-item {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-left: 4px solid transparent;
  color: rgba(255,255,255,0.7);
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  margin: 0;
}
.wk-nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}
.wk-nav-item.active {
  color: #fff;
  background: var(--plum);
  border-left-color: var(--petrol);
  font-weight: bold;
}
.sheet-count {
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
}

.wk-sidebar-actions {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.1);
}
.wk-sidebar-actions .btn {
  display: block;
  text-align: center;
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid var(--petrol);
  background: var(--petrol);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.wk-sidebar-actions .btn:hover {
  background: #007D7D;
  border-color: #007D7D;
}
.wk-sidebar-actions .btn-ghost {
  background: transparent;
  color: #E4CFF2;
  border: 1px solid rgba(255,255,255,0.2);
}
.wk-sidebar-actions .btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.wk-main {
  position: relative;
  overflow: hidden;
}

.wk-sheet-view {
  display: none;
  height: 100%;
}
.wk-sheet-view.active {
  display: block;
}

/* Cover Dashboard */
.cover-dashboard {
  height: 100%;
  overflow-y: auto;
  padding: 3rem;
  background: var(--sheet);
}
.cover-head {
  max-width: 800px;
  margin-bottom: 3rem;
}
.cover-head h2 {
  font-size: 2rem;
  color: var(--plum);
  margin-bottom: 1rem;
}
.cover-head p {
  font-size: 1.1rem;
  color: var(--muted);
}
.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
}
.cover-h3 {
  grid-column: 1 / -1;
  font-size: 1.2rem;
  color: var(--deep);
  margin: 1.5rem 0 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--rule);
}
.cover-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 1.5rem;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.cover-card label {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cover-card .readonly-value {
  font-size: 1.1rem;
  color: var(--deep);
  font-weight: 500;
  word-break: break-word;
}

/* Matrix View */
.register-matrix-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--sheet);
}
.matrix-head {
  padding: 1.5rem;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-shrink: 0;
}
.matrix-head-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.matrix-head h2 {
  font-size: 1.25rem;
  color: var(--deep);
  margin: 0;
}
.matrix-search {
  width: 300px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.85rem;
}
.matrix-search:focus {
  outline: none;
  border-color: var(--petrol);
  box-shadow: 0 0 0 2px rgba(0,153,153,0.2);
}
.matrix-head p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}

.matrix-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
}
.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  background: var(--paper);
}
.matrix-table th {
  background: var(--deep);
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--plum);
  border-right: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}
.matrix-table td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  vertical-align: top;
  min-width: 200px;
  max-width: 400px;
  transition: background-color 0.5s ease;
}
/* Sticky first column */
.matrix-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 11; /* Above other headers */
}
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  background: #F0EDF5;
  z-index: 5; /* Above other cells */
  font-weight: bold;
  box-shadow: 1px 0 0 var(--rule);
}
.matrix-row.highlight td {
  background: rgba(100, 30, 140, 0.05);
}
.matrix-row.highlight td:first-child {
  background: #E4CFF2;
}

/* Human Input Cells */
.matrix-table td.human-input {
  background: #FFFBEB;
}
.matrix-table td.human-input:focus-within {
  background: #FEF3C7;
}

/* Cell content and inputs */
.matrix-cell-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
}
.matrix-input {
  width: 100%;
  border: 1px solid transparent;
  padding: 0.4rem 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
  color: var(--deep);
  background: transparent;
  font-family: inherit;
  transition: all 0.15s;
  line-height: 1.4;
}
textarea.matrix-input {
  resize: none;
  min-height: 36px;
  max-height: 76px;
  overflow: auto;
}
.matrix-input:hover {
  border-color: rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.5);
}
.matrix-input:focus {
  background: #fff;
  border-color: var(--petrol);
  box-shadow: 0 0 0 2px rgba(0, 153, 153, 0.15);
  outline: none;
}
td.human-input .matrix-input {
  border-color: rgba(255, 182, 18, 0.3);
}
td.human-input .matrix-input:hover {
  border-color: rgba(255, 182, 18, 0.6);
}
td.human-input .matrix-input:focus {
  background: #fff;
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(255, 182, 18, 0.2);
}

.matrix-empty {
  padding: 3rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Refs in matrix */
.matrix-table .field-refs {
  margin-top: auto;
}

/* Role × Process is a true matrix: fixed role axes and clickable evidence marks. */
.role-process-matrix .matrix-table th:first-child,
.role-process-matrix .matrix-table td:first-child {
  width: 136px;
  min-width: 136px;
  max-width: 136px;
}
.role-process-matrix .matrix-table th:nth-child(2),
.role-process-matrix .matrix-table td:nth-child(2) {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
}
.role-process-matrix .matrix-table th.role-column,
.role-process-matrix .matrix-table th.role-column ~ th:not(:last-child),
.role-process-matrix .matrix-table td:nth-child(n+3):not(:last-child) {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  padding-left: .3rem;
  padding-right: .3rem;
  text-align: center;
}
.role-process-matrix .matrix-table th.role-column {
  height: 190px;
  vertical-align: bottom;
  white-space: normal;
}
.role-process-matrix .matrix-table th.role-column .role-heading-list {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 168px;
}
.role-process-matrix .matrix-table th.role-column .role-heading-item {
  display: inline-flex;
  align-items: center;
  max-height: 164px;
  padding: .42rem .2rem;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 5px;
  color: #fff;
  background: #322a47;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .28);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  line-height: 1.05;
  overflow-wrap: normal;
  text-align: left;
}
.role-process-matrix .matrix-table th.role-column .role-heading-list-combined .role-heading-item:nth-child(3n+1) {
  border-color: #38c6ca;
  background: #006a70;
}
.role-process-matrix .matrix-table th.role-column .role-heading-list-combined .role-heading-item:nth-child(3n+2) {
  border-color: #cb8fdf;
  background: #633177;
}
.role-process-matrix .matrix-table th.role-column .role-heading-list-combined .role-heading-item:nth-child(3n) {
  border-color: #8abde1;
  background: #285879;
}
.role-process-matrix .matrix-table th:last-child,
.role-process-matrix .matrix-table td:last-child {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
  text-align: center;
}
.role-process-matrix .matrix-table tbody tr {
  height: 52px;
}
.role-process-matrix .matrix-table tbody tr:hover td {
  background-color: #f8fafb;
}
.role-process-matrix .matrix-table tbody tr:hover td:first-child {
  background-color: #e9e5ef;
}
.role-process-matrix .matrix-table th:first-child,
.role-process-matrix .matrix-table td:first-child {
  text-align: center;
}
.role-process-matrix .matrix-table th:nth-child(2),
.role-process-matrix .matrix-table td:nth-child(2) {
  text-align: left;
}
.role-process-matrix .matrix-table td:first-child,
.role-process-matrix .matrix-table td:nth-child(2),
.role-process-matrix .matrix-table td:last-child {
  vertical-align: middle;
}
.role-process-matrix .matrix-table td:first-child,
.role-process-matrix .matrix-table td:nth-child(2) {
  padding-top: .65rem;
  padding-bottom: .65rem;
}
.role-process-matrix .matrix-table td:first-child .matrix-cell-content,
.role-process-matrix .matrix-table td:nth-child(2) .matrix-cell-content,
.role-process-matrix .matrix-table td:last-child .matrix-cell-content {
  justify-content: center;
}
.role-process-matrix .matrix-table td:first-child .matrix-cell-content {
  align-items: center;
}
.role-process-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  max-width: 116px;
  padding: .3rem .65rem;
  border: 1px solid #d7cce0;
  border-radius: 999px;
  color: #662483;
  background: #f4eef7;
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  white-space: nowrap;
}
.role-process-id:hover,
.role-process-id:focus-visible {
  border-color: #662483;
  background: #ebe0f1;
  outline: none;
}
.role-process-name {
  display: block;
  color: var(--deep);
  font-size: .86rem;
  font-weight: 550;
  line-height: 1.35;
}
.role-process-matrix .matrix-input {
  text-align: center;
  padding: .25rem;
}
.role-process-matrix td.role-mark-cell {
  text-align: center;
  vertical-align: middle;
}
.role-process-matrix td.role-mark-cell .matrix-cell-content {
  align-items: center;
  justify-content: center;
}
.role-map-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 34px;
  height: 34px;
  margin: .1rem auto;
  padding: 0;
  border-radius: 50%;
  font-size: .82rem;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}
.role-map-label {
  display: block;
  line-height: 1;
}
.role-map-x-inferred .role-map-label {
  transform: translateY(-.02em);
}
.role-map-x-static {
  color: var(--deep);
  background: transparent;
}
.matrix-computed-value {
  display: block;
  width: 100%;
  padding: .4rem .5rem;
  text-align: center;
  font-size: .85rem;
  font-weight: 700;
  color: var(--deep);
}

/* SIPOC Master: readable evidence register rather than a compressed spreadsheet. */
.sipoc-master-matrix .matrix-table {
  table-layout: fixed;
}
.sipoc-master-matrix .matrix-table th,
.sipoc-master-matrix .matrix-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}
.sipoc-master-matrix .matrix-table th {
  padding: .75rem .7rem;
  line-height: 1.25;
}
.sipoc-master-matrix .matrix-table td {
  padding: .7rem .65rem;
  vertical-align: top;
  background: #fff;
}
.sipoc-master-matrix .matrix-table tbody tr:nth-child(even) td {
  background: #f3f7f8;
}
.sipoc-master-matrix .matrix-table tbody tr:nth-child(odd) td:first-child {
  background: #f1edf5;
}
.sipoc-master-matrix .matrix-table tbody tr:nth-child(even) td:first-child {
  background: #e8eef0;
}
.sipoc-master-matrix .matrix-table tbody tr:hover td {
  background: #eaf5f5;
}
.sipoc-master-matrix .matrix-table tbody tr:hover td:first-child {
  background: #e2d8ea;
}
.sipoc-master-matrix .matrix-table th:nth-child(1),
.sipoc-master-matrix .matrix-table td:nth-child(1) {
  width: 128px;
  min-width: 128px;
  max-width: 128px;
  text-align: center;
  vertical-align: middle;
}
.sipoc-master-matrix .matrix-table th:nth-child(2),
.sipoc-master-matrix .matrix-table td:nth-child(2) {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
}
.sipoc-master-matrix .matrix-table th:nth-child(3),
.sipoc-master-matrix .matrix-table td:nth-child(3),
.sipoc-master-matrix .matrix-table th:nth-child(4),
.sipoc-master-matrix .matrix-table td:nth-child(4),
.sipoc-master-matrix .matrix-table th:nth-child(5),
.sipoc-master-matrix .matrix-table td:nth-child(5) {
  width: 200px;
  min-width: 200px;
  max-width: 200px;
}
.sipoc-master-matrix .matrix-table th:nth-child(6),
.sipoc-master-matrix .matrix-table td:nth-child(6) {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
}
.sipoc-master-matrix .matrix-table th:nth-child(7),
.sipoc-master-matrix .matrix-table td:nth-child(7),
.sipoc-master-matrix .matrix-table th:nth-child(8),
.sipoc-master-matrix .matrix-table td:nth-child(8),
.sipoc-master-matrix .matrix-table th:nth-child(9),
.sipoc-master-matrix .matrix-table td:nth-child(9),
.sipoc-master-matrix .matrix-table th:nth-child(10),
.sipoc-master-matrix .matrix-table td:nth-child(10) {
  width: 230px;
  min-width: 230px;
  max-width: 230px;
}
.sipoc-master-matrix .matrix-cell-content {
  min-height: 38px;
  gap: .3rem;
}

/* SIPOC values stay compact in the grid. The complete value is available in
   the detail dialog, rather than making every row as tall as its longest note. */
.register-matrix-view .cell-preview-trigger {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 2.5rem;
  max-height: 4.2rem;
  margin: 0;
  padding: .3rem .4rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--deep);
  font: inherit;
  font-size: .82rem;
  line-height: 1.45;
  text-align: left;
  overflow: hidden;
}
.register-matrix-view .cell-preview-trigger:hover {
  border-color: rgba(0, 153, 153, .35);
  background: rgba(255, 255, 255, .8);
  color: var(--deep);
}
.register-matrix-view .cell-preview-trigger:focus-visible {
  border-color: var(--petrol);
  outline: 2px solid rgba(0, 153, 153, .25);
  outline-offset: 1px;
}
.register-matrix-view .cell-preview-readonly {
  background: rgba(27, 21, 52, .025);
}
.register-matrix-view .cell-preview-text {
  display: -webkit-box;
  width: 100%;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.register-matrix-view .cell-ref-summary {
  display: flex;
  align-items: baseline;
  gap: .35rem;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: .18rem .35rem;
  border: 1px solid rgba(0, 153, 153, .2);
  border-radius: 999px;
  background: rgba(0, 153, 153, .06);
  color: var(--petrol);
  font: inherit;
  font-size: .7rem;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.register-matrix-view .cell-ref-summary:hover,
.register-matrix-view .cell-ref-summary:focus-visible {
  border-color: var(--petrol);
  background: rgba(0, 153, 153, .14);
  color: #006d6d;
  outline: 2px solid rgba(0, 153, 153, .18);
  outline-offset: 1px;
}
.cell-ref-summary-count {
  flex: 0 0 auto;
  font-weight: 700;
}
.cell-ref-summary-ids {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Process Map Inventory: spacious source audit with compact metric columns. */
.process-map-inventory-matrix .matrix-table {
  table-layout: fixed;
}
.process-map-inventory-matrix .matrix-table th,
.process-map-inventory-matrix .matrix-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}
.process-map-inventory-matrix .matrix-table th {
  padding: .7rem .6rem;
  line-height: 1.25;
}
.process-map-inventory-matrix .matrix-table td {
  padding: .65rem .55rem;
  vertical-align: top;
  background: #fff;
}
.process-map-inventory-matrix .matrix-table tbody tr:nth-child(even) td {
  background: #f3f7f8;
}
.process-map-inventory-matrix .matrix-table tbody tr:nth-child(odd) td:first-child {
  background: #f1edf5;
}
.process-map-inventory-matrix .matrix-table tbody tr:nth-child(even) td:first-child {
  background: #e8eef0;
}
.process-map-inventory-matrix .matrix-table tbody tr:hover td {
  background: #eaf5f5;
}
.process-map-inventory-matrix .matrix-table tbody tr:hover td:first-child {
  background: #e2d8ea;
}
.process-map-inventory-matrix .matrix-table th:nth-child(1),
.process-map-inventory-matrix .matrix-table td:nth-child(1) {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  text-align: center;
  vertical-align: middle;
}
.process-map-inventory-matrix .matrix-table th:nth-child(2),
.process-map-inventory-matrix .matrix-table td:nth-child(2) {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
}
.process-map-inventory-matrix .matrix-table th:nth-child(3),
.process-map-inventory-matrix .matrix-table td:nth-child(3) {
  width: 76px;
  min-width: 76px;
  max-width: 76px;
}
.process-map-inventory-matrix .matrix-table th:nth-child(4),
.process-map-inventory-matrix .matrix-table td:nth-child(4) {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}
.process-map-inventory-matrix .matrix-table th:nth-child(5),
.process-map-inventory-matrix .matrix-table td:nth-child(5) {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}
.process-map-inventory-matrix .matrix-table th:nth-child(6),
.process-map-inventory-matrix .matrix-table td:nth-child(6) {
  width: 126px;
  min-width: 126px;
  max-width: 126px;
}
.process-map-inventory-matrix .matrix-table th:nth-child(n+7):nth-child(-n+12),
.process-map-inventory-matrix .matrix-table td:nth-child(n+7):nth-child(-n+12) {
  width: 82px;
  min-width: 82px;
  max-width: 82px;
  text-align: center;
}
.process-map-inventory-matrix .matrix-table th:nth-child(13),
.process-map-inventory-matrix .matrix-table td:nth-child(13) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
  text-align: center;
}
.process-map-inventory-matrix .matrix-table th:nth-child(14),
.process-map-inventory-matrix .matrix-table td:nth-child(14) {
  width: 210px;
  min-width: 210px;
  max-width: 210px;
}
.process-map-inventory-matrix .matrix-table th:nth-child(15),
.process-map-inventory-matrix .matrix-table td:nth-child(15) {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}
.process-map-inventory-matrix .matrix-table th:nth-child(16),
.process-map-inventory-matrix .matrix-table td:nth-child(16) {
  width: 390px;
  min-width: 390px;
  max-width: 390px;
}
.process-map-inventory-matrix .matrix-input {
  padding: .2rem .25rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.process-map-inventory-matrix textarea.matrix-input {
  min-height: 36px;
  max-height: none;
  overflow: hidden;
}
.process-map-inventory-matrix .source-id-link {
  min-width: 64px;
}

/* Process Register: clear lineage, ownership, and evidence at a glance. */
.process-register-matrix .matrix-table {
  table-layout: fixed;
}
.process-register-matrix .matrix-table th,
.process-register-matrix .matrix-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}
.process-register-matrix .matrix-table th {
  padding: .75rem .65rem;
  line-height: 1.25;
}
.process-register-matrix .matrix-table td {
  padding: .7rem .6rem;
  vertical-align: top;
  background: #fff;
}
.process-register-matrix .matrix-table tbody tr:nth-child(even) td {
  background: #f3f7f8;
}
.process-register-matrix .matrix-table tbody tr:nth-child(odd) td:first-child {
  background: #f1edf5;
}
.process-register-matrix .matrix-table tbody tr:nth-child(even) td:first-child {
  background: #e8eef0;
}
.process-register-matrix .matrix-table tbody tr:hover td {
  background: #eaf5f5;
}
.process-register-matrix .matrix-table tbody tr:hover td:first-child {
  background: #e2d8ea;
}
.process-register-matrix .matrix-table th:nth-child(1),
.process-register-matrix .matrix-table td:nth-child(1) {
  width: 136px;
  min-width: 136px;
  max-width: 136px;
  text-align: center;
  vertical-align: middle;
}
.process-register-matrix .matrix-table th:nth-child(2),
.process-register-matrix .matrix-table td:nth-child(2) {
  width: 250px;
  min-width: 250px;
  max-width: 250px;
}
.process-register-matrix .matrix-table th:nth-child(3),
.process-register-matrix .matrix-table td:nth-child(3),
.process-register-matrix .matrix-table th:nth-child(4),
.process-register-matrix .matrix-table td:nth-child(4) {
  width: 240px;
  min-width: 240px;
  max-width: 240px;
}
.process-register-matrix .matrix-table th:nth-child(5),
.process-register-matrix .matrix-table td:nth-child(5) {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
}
.process-register-matrix .matrix-table th:nth-child(6),
.process-register-matrix .matrix-table td:nth-child(6) {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
}
.process-register-matrix .matrix-table th:nth-child(7),
.process-register-matrix .matrix-table td:nth-child(7) {
  width: 130px;
  min-width: 130px;
  max-width: 130px;
}
.process-register-matrix .matrix-table th:nth-child(8),
.process-register-matrix .matrix-table td:nth-child(8) {
  width: 220px;
  min-width: 220px;
  max-width: 220px;
}
.process-register-matrix .matrix-table th:nth-child(9),
.process-register-matrix .matrix-table td:nth-child(9) {
  width: 340px;
  min-width: 340px;
  max-width: 340px;
}
.process-register-matrix .matrix-input {
  padding: .2rem .25rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.process-register-matrix textarea.matrix-input {
  min-height: 38px;
  max-height: none;
  overflow: hidden;
}
.process-register-matrix .field-refs {
  gap: .3rem;
  margin-top: .35rem;
}
.process-register-matrix .field-refs .ref-chip {
  padding: .2rem .5rem;
}

/* Refs */
.field-refs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.ref-chip {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 16px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.15s;
  margin: 0;
  color: var(--muted);
}
.ref-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.ref-chip[data-ref-kind="source"] {
  background: rgba(0, 153, 153, 0.08);
  border-color: rgba(0, 153, 153, 0.2);
  color: var(--petrol);
}
.ref-chip[data-ref-kind="source"]:hover { background: rgba(0, 153, 153, 0.15); }

.ref-chip[data-ref-kind="gap"] {
  background: rgba(194, 24, 91, 0.08);
  border-color: rgba(194, 24, 91, 0.2);
  color: var(--pink);
}
.ref-chip[data-ref-kind="gap"]:hover { background: rgba(194, 24, 91, 0.15); }

.ref-chip[data-ref-kind="process"] {
  background: rgba(100, 30, 140, 0.08);
  border-color: rgba(100, 30, 140, 0.2);
  color: var(--plum);
}
.ref-chip[data-ref-kind="process"]:hover { background: rgba(100, 30, 140, 0.15); }

/* Dialog */
#source-panel {
  width: 85vw;
  height: 85vh;
  max-width: 1400px;
  margin: auto;
  border: none;
  border-radius: 6px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
  padding: 0;
  background: var(--paper);
  color: var(--deep);
}
#source-panel::backdrop {
  background: rgba(27, 21, 52, 0.7);
  backdrop-filter: blur(4px);
}
.source-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.source-header {
  background: var(--deep);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.source-header h3 {
  font-size: 1.1rem;
  margin: 0;
}
.source-header .btn {
  margin: 0;
  padding: 0.4rem 1rem;
}
.source-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}
.source-meta {
  width: 320px;
  padding: 1.5rem;
  background: var(--sheet);
  border-right: 1px solid var(--rule);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.sm-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.sm-group div {
  font-size: 0.95rem;
  color: var(--deep);
  word-break: break-word;
}
.source-preview {
  flex: 1;
  background: #E3E0E8;
}
.source-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* SIPOC cell detail dialog */
#cell-panel {
  width: min(92vw, 980px);
  max-width: 980px;
  max-height: min(88vh, 820px);
  margin: auto;
  padding: 0;
  border: 1px solid #cfc8d4;
  border-radius: 8px;
  background: var(--paper);
  color: var(--deep);
  box-shadow: 0 24px 70px rgba(27, 15, 44, .28);
  overflow: hidden;
}
#cell-panel::backdrop {
  background: rgba(27, 21, 52, .58);
  backdrop-filter: blur(3px);
}
.cell-dialog-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(88vh, 820px);
}
.cell-dialog-header {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  background: var(--deep);
  color: #fff;
}
.cell-dialog-kicker {
  margin: 0 0 .2rem;
  color: #73e3df;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.cell-dialog-header h3 {
  font-size: 1.3rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.cell-dialog-header > div { min-width: 0; }
#cp-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-width: 92px;
  min-height: 44px;
  background: #fff;
  color: #211331;
  border: 2px solid #fff;
  font-weight: 700;
  white-space: nowrap;
}
#cp-close:hover { background: #e4fcfa; color: #211331; }
#cp-close:focus-visible {
  background: #fff;
  color: #211331;
  outline: 3px solid #73e3df;
  outline-offset: 3px;
}
.cell-dialog-process {
  margin: .25rem 0 0;
  color: rgba(255, 255, 255, .72);
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.cell-dialog-header .btn {
  flex: 0 0 auto;
  margin: 0;
  padding: .4rem .85rem;
  border-color: rgba(255, 255, 255, .28);
  color: #fff;
}
.cell-dialog-header .btn:hover,
.cell-dialog-header .btn:focus-visible {
  border-color: #fff;
  background: rgba(255, 255, 255, .12);
  color: #fff;
}
.cell-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.35rem 1.5rem;
}
.cell-dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .8rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: .75rem;
}
.cell-dialog-meta span + span {
  padding-left: .8rem;
  border-left: 1px solid var(--rule);
}
.cell-dialog-value {
  display: grid;
  gap: .4rem;
}
.cell-dialog-value > label,
.cell-dialog-references h4 {
  margin: 0;
  color: var(--deep);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.cell-dialog-editor,
.cell-dialog-readonly {
  width: 100%;
  min-height: 220px;
  max-height: 48vh;
  padding: .8rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  color: var(--deep);
  font: inherit;
  font-size: .95rem;
  line-height: 1.6;
  overflow-y: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.cell-dialog-editor {
  resize: vertical;
}
.cell-dialog-editor:focus {
  border-color: var(--petrol);
  box-shadow: 0 0 0 3px rgba(0, 153, 153, .14);
  outline: none;
}
.cell-dialog-readonly {
  background: #f7f6f9;
}
.cell-dialog-references {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.cell-dialog-references .field-refs {
  margin-top: .55rem;
}
.cell-dialog-references .ref-chip {
  margin-top: 0;
}
.cell-dialog-no-refs {
  margin: .5rem 0 0;
  color: var(--muted);
  font-size: .8rem;
}
.cell-dialog-error {
  margin-top: 1rem;
  padding: .65rem .8rem;
  border-left: 3px solid var(--pink);
  background: #fff1f2;
  color: #871f2a;
  font-size: .82rem;
}
.cell-dialog-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.5rem;
  border-top: 1px solid var(--rule);
  background: #fbfafc;
}
.cell-dialog-actions {
  display: flex;
  gap: .6rem;
}
.cell-dialog-actions button {
  margin: 0;
}
.cell-dialog-dirty {
  color: var(--muted);
  font-size: .78rem;
}

/* Save Indicator */
.save-indicator {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--deep);
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 1000;
}
.save-indicator[hidden] { display: none; }
.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}
.save-indicator.saving {
  background: var(--plum);
}
.save-indicator.success {
  background: var(--petrol);
}
.save-indicator.error {
  background: var(--pink);
}

@media (max-width: 700px) {
  #cell-panel {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
  }
  .cell-dialog-shell {
    max-height: calc(100vh - 1rem);
  }
  .cell-dialog-header,
  .cell-dialog-body,
  .cell-dialog-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .cell-dialog-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .cell-dialog-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .cell-dialog-editor,
  .cell-dialog-readonly {
    min-height: 180px;
    max-height: 48vh;
  }
}
