:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --line: #d7ddd7;
  --text: #17211b;
  --muted: #637168;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b7791f;
  --danger: #b42318;
  --focus: #2563eb;
  --shadow: 0 10px 24px rgba(23, 33, 27, 0.08);
  --control-height: 34px;
  --control-height-compact: 30px;
  --control-radius: 7px;
  --control-padding-x: 10px;
  --badge-height: 24px;
  --badge-padding-x: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

#app {
  min-height: 100dvh;
}

button,
.button-link,
input,
select,
textarea,
.upload-button {
  font: inherit;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0 var(--control-padding-x);
  line-height: 1.15;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

button.primary:hover {
  background: var(--accent-strong);
}

button:disabled,
button[disabled],
button.primary:disabled,
button.primary[disabled] {
  cursor: not-allowed;
  border-color: var(--line);
  background: #edf2ef;
  color: #7b877f;
  opacity: 0.68;
  box-shadow: none;
}

button:disabled:hover,
button[disabled]:hover,
button.primary:disabled:hover,
button.primary[disabled]:hover {
  border-color: var(--line);
  background: #edf2ef;
  color: #7b877f;
}

button.ghost {
  background: transparent;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
}

input:not([type="checkbox"]):not([type="radio"]),
select:not([multiple]) {
  height: var(--control-height);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

label.field-error {
  color: var(--danger);
}

label.field-error input,
label.field-error select,
label.field-error textarea,
fieldset.field-error {
  border-color: rgba(180, 35, 24, 0.72);
  background-color: rgba(180, 35, 24, 0.04);
}

label.field-error input:focus,
label.field-error select:focus,
label.field-error textarea:focus {
  outline-color: var(--danger);
}

textarea {
  padding: 8px 10px;
  resize: vertical;
}

label {
  display: grid;
  align-content: start;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height);
  color: var(--text);
}

label.check input {
  width: 18px;
  min-height: 18px;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0 var(--control-padding-x);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.15;
}

.upload-button:hover {
  border-color: var(--accent);
}

.upload-button input {
  display: none;
}

.loading {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--muted);
}

.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(280px, 420px) 1fr;
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 40px;
}

.login-brand {
  display: grid;
  gap: 8px;
}

.login-brand strong {
  font-size: 30px;
}

.login-brand span {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-aside {
  display: grid;
  align-content: end;
  padding: 40px;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.12), rgba(183, 121, 31, 0.10)),
    var(--surface-2);
}

.login-aside dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  max-width: 760px;
}

.login-aside div {
  border-top: 3px solid var(--accent);
  padding-top: 10px;
}

.login-aside dt {
  font-weight: 800;
}

.login-aside dd {
  margin: 4px 0 0;
  color: var(--muted);
}

.app-shell {
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: stretch;
  background: linear-gradient(to right, #18231d 0, #18231d 250px, transparent 250px);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: #18231d;
  color: #ffffff;
  padding: 18px;
  overflow: hidden;
}

.brand {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 23px;
}

.brand span {
  color: #c9d5cc;
  font-size: 13px;
}

.nav {
  display: grid;
  align-content: start;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.nav button {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  background: transparent;
  color: #e9f0eb;
  text-align: left;
  padding: 0 10px;
}

.nav button.active {
  background: #26362d;
  border-color: #405044;
}

.nav button.nav-planned {
  border-color: transparent;
  background: transparent;
  color: rgba(233, 240, 235, 0.44);
  cursor: not-allowed;
  opacity: 1;
}

.nav button.nav-planned::after {
  content: "später";
  margin-left: auto;
  color: rgba(233, 240, 235, 0.46);
  font-size: 11px;
  font-weight: 800;
}

.main {
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
}

.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-left: auto;
  min-width: 0;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar.is-hidden {
  display: none;
}

.toolbar label {
  min-width: min(180px, 100%);
}

.reader-mode-button {
  flex: 0 0 auto;
  min-height: 38px;
  border-color: rgba(15, 118, 110, 0.3);
  background: #eef7f4;
  color: var(--accent-strong);
  font-weight: 800;
}

.reader-mode-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.user-menu {
  position: relative;
  flex: 0 0 auto;
}

.user-menu-button {
  gap: 8px;
  min-height: 38px;
  padding: 0 9px 0 6px;
  background: var(--surface);
  border-color: var(--line);
}

.user-menu-button:hover {
  border-color: var(--accent);
}

.user-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #18231d;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.user-menu-name {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 250px;
  max-width: calc(100vw - 32px);
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.user-menu-details {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--line);
}

.user-menu-details strong,
.user-menu-details span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-details span {
  color: var(--muted);
  font-size: 13px;
}

.user-menu-item {
  width: 100%;
  justify-content: flex-start;
}

.user-menu-item:disabled {
  cursor: not-allowed;
  color: var(--muted);
  opacity: 0.65;
}

.content {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 18px;
  padding: 22px;
}

.band {
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.band-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.band-header label {
  min-width: 220px;
}

.band-header h2 {
  margin: 0;
  font-size: 17px;
}

.muted-line {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.platform-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.platform-tenant-list {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.platform-tenant-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.platform-tenant-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.platform-tenant-card-header h3 {
  margin: 0;
  font-size: 18px;
}

.platform-tenant-card-header span:not(.status),
.platform-tenant-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.platform-tenant-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.platform-tenant-meta div {
  min-width: 0;
}

.platform-tenant-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.platform-license-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.module-fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.module-fieldset legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 5px;
}

.module-fieldset.wide {
  grid-column: span 2;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
  padding: 16px;
}

.form-grid .wide {
  grid-column: span 2;
}

.form-static {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 7px 10px;
}

.form-static strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.form-static span {
  overflow-wrap: anywhere;
}

.form-grid > button,
.form-grid > .upload-button {
  grid-column: 1 / -1;
  align-self: start;
  justify-self: start;
  width: auto;
  min-width: min(220px, 100%);
}

.form-grid > .form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-form select[multiple] {
  min-height: 108px;
}

.role-fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.role-fieldset legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 5px;
}

.document-requirements p {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  color: var(--muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  display: grid;
  gap: 2px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.metric strong {
  font-size: 24px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-panel {
  box-shadow: var(--shadow);
}

.dashboard-panel-accent {
  border-top: 4px solid var(--accent);
}

.dashboard-panel-warn {
  border-top: 4px solid var(--warn);
}

.dashboard-panel-neutral {
  border-top: 4px solid #6b7280;
}

.dashboard-list {
  display: grid;
  gap: 0;
  padding: 6px 0;
}

.dashboard-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.dashboard-item:last-child {
  border-bottom: 0;
}

.dashboard-item-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-document-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  overflow-wrap: anywhere;
}

.dashboard-document-link:hover {
  color: var(--accent);
}

.dashboard-item-main span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.dashboard-item-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  flex-wrap: wrap;
}

.dashboard-item-actions.compact-actions {
  align-self: start;
}

.dashboard-item-actions button {
  min-height: var(--control-height);
  padding: 0 10px;
}

.dashboard-more {
  padding: 10px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.document-workspace-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.document-view-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.document-view-tabs button {
  display: grid;
  gap: 2px;
  justify-items: start;
  min-height: 58px;
  padding: 8px 10px;
  background: var(--surface-2);
  text-align: left;
}

.document-view-tabs button.active {
  border-color: var(--focus);
  background: #eff6ff;
  color: #1d4ed8;
}

.document-view-tabs strong {
  font-size: 17px;
}

.document-view-tabs span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.document-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(5, minmax(140px, 1fr));
  gap: 10px;
  align-items: start;
}

.document-filter-grid .wide {
  grid-column: span 2;
}

.document-list,
.document-group-list {
  display: grid;
  gap: 10px;
}

.document-group {
  display: grid;
  gap: 8px;
}

.document-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.document-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px 180px;
  gap: 14px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.document-card-main,
.document-card-title,
.document-card-state {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.document-card-title strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.document-card-title span,
.document-card-meta,
.document-card-state span:not(.status) {
  color: var(--muted);
  font-size: 13px;
}

.document-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
}

.document-card-meta span {
  overflow-wrap: anywhere;
}

.document-card-actions {
  display: flex;
  justify-content: end;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.document-card-actions button {
  flex: 0 0 auto;
}

.document-card-state {
  justify-items: stretch;
}

.document-card-state .status {
  justify-self: stretch;
  text-align: center;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-inline-message {
  display: inline-flex;
  align-items: center;
  min-height: var(--badge-height);
  max-width: min(280px, 34vw);
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
  padding: 0 var(--badge-padding-x);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-inline-message.error {
  border-color: rgba(180, 53, 42, 0.25);
  background: rgba(180, 53, 42, 0.08);
  color: #9f2f25;
}

.template-card-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.template-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px 460px;
  gap: 14px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.template-card-main {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(260px, 1fr);
  gap: 12px;
  min-width: 0;
}

.template-card-main div,
.template-card-revision {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.template-card-main strong,
.template-card-revision strong {
  overflow-wrap: anywhere;
}

.template-card-main span,
.template-card-revision span:not(.status) {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.template-card-revision .status {
  justify-self: start;
}

.template-card-actions {
  display: flex;
  justify-content: end;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.document-modal-body {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 8px;
}

.detail-tabs button {
  height: var(--control-height);
  align-self: flex-start;
  background: var(--surface-2);
}

.detail-tabs button.active {
  border-color: var(--focus);
  background: #ffffff;
  color: var(--focus);
}

.compact-tabs {
  margin-bottom: 12px;
}

.compact-tabs button span {
  color: var(--muted);
  font-size: 13px;
}

.document-detail-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.document-detail-layout.single {
  grid-template-columns: 1fr;
}

.document-detail-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.document-detail-panel.wide {
  grid-column: 1 / -1;
}

.document-detail-panel h3,
.document-detail-panel p {
  margin: 0;
}

.action-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.action-category {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.action-category-header {
  display: grid;
  gap: 2px;
}

.action-category-header h4 {
  margin: 0;
}

.action-category-header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.action-category .action-stack {
  justify-content: flex-start;
}

.workflow-path {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-path li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px;
  color: var(--muted);
  font-weight: 800;
}

.workflow-path li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  height: 24px;
  border-radius: 999px;
  background: #ffffff;
  color: inherit;
}

.workflow-path li.done,
.workflow-path li.current {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
}

.workflow-path li.current {
  outline: 2px solid rgba(15, 118, 110, 0.16);
}

.document-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.document-history-grid h4 {
  margin: 0 0 8px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  padding: 10px;
}

.history-item div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.history-item span,
.history-item small {
  color: var(--muted);
}

.distribution-panel {
  display: grid;
  gap: 16px;
}

.distribution-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.distribution-summary-grid > div {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  display: grid;
  align-content: center;
  gap: 2px;
}

.distribution-summary-grid strong {
  font-size: 26px;
}

.distribution-summary-grid span {
  color: var(--muted);
  font-size: 13px;
}

.distribution-rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.distribution-rule {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.process-map {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  gap: 14px;
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 16px;
}

.process-side {
  display: grid;
  place-items: center;
  min-height: 100%;
  border-radius: 4px;
  background: #075494;
  color: #ffffff;
  font-weight: 800;
}

.process-side span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 0;
  white-space: nowrap;
}

.process-side-right span {
  transform: none;
}

.process-lanes {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.process-lane {
  display: grid;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px clamp(18px, 3vw, 44px) 20px;
}

.process-lane h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.process-lane-management {
  background: #f8e2cf;
}

.process-lane-core {
  background: #dfedf7;
}

.process-lane-support {
  background: #e8efd9;
}

.process-node-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-width: 0;
}

.process-node-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.process-card,
.process-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.process-card {
  display: grid;
  place-items: center;
  gap: 4px;
  width: clamp(150px, 10vw, 220px);
  min-height: 78px;
  text-align: center;
  box-shadow: 0 6px 14px rgba(23, 33, 27, 0.10);
  color: var(--text);
  cursor: pointer;
  white-space: normal;
}

.process-card:hover {
  transform: translateY(-1px);
  border-color: var(--focus);
}

.process-card.is-selected {
  outline: 3px solid rgba(37, 99, 235, 0.32);
  outline-offset: 3px;
}

.process-card-management {
  min-height: 112px;
  border-color: #b87742;
  background: #f3b77b;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 50% 100%, 0 72%);
  padding-bottom: 25px;
}

.process-card-core {
  border-color: #7290a8;
  background: #b7d0e6;
}

.process-card-support {
  border-color: #7c913f;
  background: #91a947;
}

.process-card strong,
.process-detail strong {
  overflow-wrap: anywhere;
}

.process-card strong {
  line-height: 1.18;
  hyphens: auto;
}

.process-card span,
.process-card small,
.process-detail span,
.process-detail small,
.process-detail p {
  color: var(--muted);
}

.process-card-management span,
.process-card-management small,
.process-card-core span,
.process-card-core small {
  color: rgba(23, 33, 27, 0.78);
}

.process-card-support,
.process-card-support span,
.process-card-support small {
  color: #17211b;
}

.process-admin-toolbar .band-header {
  align-items: center;
}

.process-arrow {
  display: inline-block;
  width: 34px;
  height: 2px;
  background: #485760;
  position: relative;
  flex: 0 0 auto;
}

.process-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -5px;
  border-left: 9px solid #485760;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.is-hidden {
  display: none !important;
}

.process-detail-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.process-workspace .band-header {
  align-items: flex-start;
}

.process-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.process-breadcrumb button {
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 12px;
  font-weight: 800;
}

.process-breadcrumb button:hover {
  color: var(--focus);
}

.process-breadcrumb strong {
  color: var(--text);
}

.process-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.organization-tabs {
  padding: 0;
}

.process-tabs button {
  min-height: var(--control-height);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.process-tabs button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.process-tabs button.active {
  border-color: var(--focus);
  background: #eff6ff;
  color: #1d4ed8;
}

.process-workspace .document-detail-panel {
  padding: 12px;
}

.process-overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.process-detail {
  display: grid;
  gap: 10px;
}

.process-tree-card {
  margin-top: 12px;
}

.process-tree {
  overflow-x: auto;
  padding: 4px 0;
}

.process-tree-node {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.process-tree-node button {
  justify-content: flex-start;
  width: min(520px, 100%);
  height: auto;
  min-height: 44px;
  border-color: var(--line);
  background: #ffffff;
  text-align: left;
}

.process-tree-node.root > button {
  border-color: var(--accent);
  background: #edf6f3;
}

.process-tree-node button {
  display: grid;
  align-content: center;
  gap: 2px;
}

.process-tree-node button span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.process-tree-children {
  display: grid;
  gap: 8px;
  margin-left: 22px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
}

.process-detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.process-detail p {
  margin: 0;
}

.process-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.process-steps li {
  padding-left: 4px;
}

.process-steps span,
.process-steps small {
  display: block;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.profile-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.profile-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.revision-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.revision-list span {
  display: inline-flex;
  align-items: center;
  min-height: var(--badge-height);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 var(--badge-padding-x);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.workflow-list {
  display: grid;
  gap: 8px;
}

.workflow-list div {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
}

.workflow-list span,
.workflow-list small {
  color: var(--muted);
}

.process-child-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.process-child-button {
  display: grid;
  gap: 3px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 9px 10px;
  color: var(--text);
  text-align: left;
}

.process-child-button:hover {
  border-color: var(--focus);
}

.process-child-button span {
  color: var(--muted);
  font-size: 12px;
}

.process-flow-detail {
  overflow: hidden;
}

.react-flow-host {
  min-height: 420px;
}

.flow-readonly-host {
  min-height: 520px;
}

.flow-empty-view {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 360px;
  color: var(--muted);
  text-align: center;
}

.flow-empty-view strong {
  color: var(--text);
}

.flow-editor-modal-body,
.flow-edit-host {
  min-height: 0;
}

.flow-edit-host {
  height: 100%;
}

.process-flow-board {
  display: grid;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.process-flow-row {
  display: grid;
  grid-template-columns: 150px repeat(var(--flow-columns), minmax(190px, 1fr));
  gap: 10px;
  min-width: min(100%, calc(150px + var(--flow-columns) * 210px));
}

.process-flow-lane-label {
  display: grid;
  align-content: center;
  min-height: 96px;
  border-radius: 6px;
  background: #eef2f7;
  color: var(--text);
  font-weight: 900;
  padding: 10px;
  overflow-wrap: anywhere;
}

.process-flow-cell {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.flow-step-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 96px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px;
  box-shadow: 0 4px 10px rgba(23, 33, 27, 0.08);
}

.flow-step-start,
.flow-step-end {
  border-radius: 999px;
  align-content: center;
  text-align: center;
}

.flow-step-decision {
  border-color: #b45309;
  background: #fff7ed;
}

.flow-step-document {
  border-color: #2563eb;
  background: #eff6ff;
}

.flow-step-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.flow-step-head strong {
  overflow-wrap: anywhere;
}

.flow-step-head span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--badge-height);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  padding: 0 var(--badge-padding-x);
  line-height: 1;
}

.flow-step-card p,
.flow-step-card small {
  margin: 0;
  color: var(--muted);
}

.flow-documents {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.flow-documents span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--badge-height);
  border-radius: 999px;
  background: #e7f6ec;
  color: #14532d;
  font-size: 11px;
  font-weight: 900;
  padding: 0 var(--badge-padding-x);
  line-height: 1;
}

.flow-arrow {
  position: absolute;
  right: -18px;
  top: 42px;
  width: 20px;
  height: 2px;
  background: #64748b;
  z-index: 1;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -5px;
  border-left: 8px solid #64748b;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.flow-step-settings {
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

.flow-step-settings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.flow-step-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.flow-step-form label,
.flow-step-form .wide {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.flow-step-form .wide {
  grid-column: 1 / -1;
}

.flow-step-form input,
.flow-step-form select,
.flow-step-form textarea {
  min-width: 0;
  width: 100%;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  padding: 0 10px;
  font: inherit;
  color: var(--text);
}

.flow-step-form input,
.flow-step-form select:not([multiple]) {
  height: var(--control-height);
}

.flow-step-form textarea {
  padding: 8px 10px;
}

.flow-step-form button {
  min-height: var(--control-height);
  align-self: end;
}

.archive-band {
  border-color: #c8d1cc;
}

.archive-grid {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.archive-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
}

.archive-category-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  align-content: center;
  justify-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  text-align: left;
}

.archive-category-card strong {
  font-size: 16px;
}

.archive-category-card span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: var(--badge-height);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 var(--badge-padding-x);
  line-height: 1;
}

.archive-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.archive-panel h3 {
  margin: 0;
  font-size: 15px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(23, 33, 27, 0.38);
  padding: 5vh 5vw;
}

.modal-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 90vw;
  height: 90vh;
  max-width: 90vw;
  max-height: 90vh;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(23, 33, 27, 0.28);
}

.modal-body {
  min-width: 0;
  overflow: auto;
}

.signature-panel {
  width: min(620px, 92vw);
  height: auto;
  max-width: 92vw;
  max-height: 92vh;
}

.workflow-panel {
  width: min(900px, 92vw);
  height: auto;
  max-width: 92vw;
  max-height: 92vh;
}

.signature-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.workflow-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.signature-body p {
  margin: 0;
  color: var(--muted);
}

.workflow-notice {
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.06);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.workflow-notice.warning {
  border-color: rgba(183, 121, 31, 0.34);
  background: rgba(183, 121, 31, 0.08);
}

.workflow-preview {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.workflow-preview h3 {
  margin: 0;
  font-size: 18px;
}

.process-admin-modal-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.process-quality {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 16px 0;
  border: 1px solid rgba(183, 121, 31, 0.34);
  border-radius: 8px;
  background: rgba(183, 121, 31, 0.08);
  padding: 12px;
}

.process-quality-ok {
  grid-template-columns: minmax(0, 1fr);
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.08);
}

.process-quality div {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.process-quality strong,
.process-quality b {
  color: var(--text);
}

.process-quality span {
  color: var(--muted);
}

.process-quality ul {
  display: grid;
  gap: 3px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.preview-frame {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.preview-message {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 420px;
  padding: 24px;
  background: #f3f5f2;
  color: var(--muted);
  text-align: center;
}

.preview-message strong {
  color: var(--text);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.process-document-block {
  display: grid;
  gap: 8px;
}

.process-document-block > span {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
}

.muted-text {
  margin: 0;
  color: var(--muted);
}

.product-document-section {
  margin-top: 2px;
}

.product-document-groups {
  display: grid;
  gap: 8px;
}

.product-document-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.product-document-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}

.product-document-group summary::-webkit-details-marker {
  display: none;
}

.product-document-group summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.product-document-group .chip-row {
  padding: 0 12px 12px;
}

.document-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: var(--badge-height);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 0 var(--badge-padding-x);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  overflow-wrap: anywhere;
}

button.document-pill {
  cursor: pointer;
}

button.document-pill:hover {
  border-color: var(--accent);
  background: #e4f1ed;
}

.product-workspace {
  overflow: hidden;
}

.product-grid {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  padding: 16px;
}

.equipment-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px 0;
}

.equipment-due-chip,
.equipment-mini-card {
  display: grid;
  justify-content: stretch;
  text-align: left;
  gap: 3px;
  height: auto;
  min-height: var(--control-height);
  padding: 8px 10px;
}

.equipment-mini-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.plain-link {
  height: auto;
  min-height: 0;
  justify-content: start;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.plain-link:hover {
  background: transparent;
}

.plain-link strong,
.plain-link span {
  display: block;
}

.equipment-due-chip {
  background: rgba(183, 121, 31, 0.08);
  border-color: rgba(183, 121, 31, 0.28);
}

.equipment-due-chip span,
.equipment-mini-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.equipment-inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.equipment-card .chip-row {
  justify-content: flex-start;
}

.product-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.product-card-header strong {
  display: block;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.product-card-header span:not(.status),
.product-meta dd {
  color: var(--muted);
}

.product-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.product-meta div {
  display: grid;
  gap: 2px;
}

.product-meta dt,
.product-card h3 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0;
}

.product-meta dd {
  margin: 0;
}

.product-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.audit-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.audit-program-list,
.audit-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.audit-program-card,
.audit-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.audit-program-card > div:first-child,
.audit-card-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.audit-program-card strong,
.audit-card-main strong {
  display: block;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.audit-program-card span:not(.status),
.audit-card-main span:not(.status) {
  color: var(--muted);
}

.audit-link-group {
  display: grid;
  gap: 6px;
}

.audit-link-group h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.audit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-card-summary {
  margin: 0;
}

.audit-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.audit-choice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
}

.audit-picker {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.audit-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.audit-picker-header strong,
.audit-picker-header span {
  display: block;
}

.audit-picker-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.audit-choice-list,
.audit-document-choice-list,
.audit-scope-list,
.audit-document-list {
  display: grid;
  gap: 8px;
}

.audit-choice-list,
.audit-document-choice-list {
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.audit-choice-group {
  display: grid;
  gap: 6px;
}

.audit-choice-group h3 {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.audit-choice,
.audit-scope-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 9px 10px;
}

.audit-choice input {
  margin-top: 2px;
}

.audit-choice strong,
.audit-choice small,
.audit-scope-item strong,
.audit-scope-item span {
  display: block;
  overflow-wrap: anywhere;
}

.audit-choice small,
.audit-scope-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.audit-scope-item {
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  text-align: left;
}

.audit-modal-panel {
  width: min(1500px, 92vw);
  max-width: 92vw;
}

.product-modal-panel {
  width: min(1500px, 92vw);
}

.product-instruction-actions {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.product-instruction-actions .inline-form {
  display: flex;
  align-items: end;
  gap: 8px;
  flex: 1 1 520px;
  min-width: min(100%, 360px);
}

.product-instruction-actions label {
  flex: 1 1 auto;
  min-width: min(100%, 280px);
}

.product-process-overview,
.product-document-process-groups,
.product-file-groups {
  display: grid;
  gap: 12px;
}

.product-process-overview h4,
.product-document-process-group h4 {
  margin: 0 0 6px;
}

.product-document-process-group {
  display: grid;
  gap: 6px;
}

.product-file-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.product-file-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.product-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.product-file-row strong,
.product-file-row span {
  display: block;
  overflow-wrap: anywhere;
}

.product-file-row span {
  color: var(--muted);
}

.product-file-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.product-file-revisions {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.product-file-revisions summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.product-file-version-list,
.product-revision-timeline {
  display: grid;
  gap: 8px;
}

.product-file-version-list {
  margin-top: 8px;
}

.product-file-version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.product-file-version-row strong,
.product-file-version-row span {
  display: block;
  overflow-wrap: anywhere;
}

.product-file-version-row span {
  color: var(--muted);
  font-size: 13px;
}

.product-revision-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.capability-study-list {
  display: grid;
  gap: 10px;
}

.capability-study-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.capability-study-main,
.capability-study-state {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.capability-study-main strong,
.capability-study-main span {
  display: block;
}

.capability-study-main span {
  color: var(--muted);
  font-size: 13px;
}

.capability-study-state {
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.capability-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.capability-metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 8px;
}

.capability-metrics span,
.capability-metrics strong {
  display: block;
}

.capability-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.compact-note-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.capability-actions {
  justify-content: flex-start;
}

.capability-history summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.file-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.file-action-button input {
  display: none;
}

.product-revision-group h4 {
  margin: 0;
}

.process-chip {
  min-height: var(--badge-height);
  border-radius: 999px;
  padding: 0 var(--badge-padding-x);
  background: #e8f1f8;
  border-color: #b7cfe2;
  font-size: 12px;
  font-weight: 800;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

.form-message {
  display: grid;
  align-items: center;
  min-height: var(--control-height);
  color: var(--accent-strong);
  font-weight: 700;
}

.notice {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
  padding: 11px 14px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.notice.error {
  border-color: rgba(180, 35, 24, 0.24);
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.table-wrap {
  max-width: 100%;
  overflow-x: visible;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  background: #f8faf8;
}

td strong {
  display: block;
}

td span {
  color: var(--muted);
  font-size: 13px;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.action-stack button,
.action-stack .upload-button {
  height: var(--control-height);
  min-height: var(--control-height);
  padding: 0 10px;
  align-self: flex-start;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  min-height: var(--badge-height);
  border-radius: 999px;
  padding: 0 var(--badge-padding-x);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.documents-table th:nth-child(1) {
  width: 11%;
}

.documents-table th:nth-child(2) {
  width: 19%;
}

.documents-table th:nth-child(3) {
  width: 10%;
}

.documents-table th:nth-child(4) {
  width: 16%;
}

.documents-table th:nth-child(5) {
  width: 13%;
}

.documents-table th:nth-child(6) {
  width: 10%;
}

.documents-table th:nth-child(7) {
  width: 9%;
}

.documents-table th:nth-child(8) {
  width: 12%;
}

.template-table th:nth-child(1) {
  width: 18%;
}

.template-table th:nth-child(2) {
  width: 28%;
}

.template-table th:nth-child(3) {
  width: 18%;
}

.template-table th:nth-child(4) {
  width: 12%;
}

.template-table th:nth-child(5) {
  width: 24%;
}

.status.published,
.status.approved {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.status.in_review,
.status.warning,
.status.due,
.status.restricted {
  border-color: rgba(183, 121, 31, 0.3);
  background: rgba(183, 121, 31, 0.1);
  color: var(--warn);
}

.status.planned,
.status.prepared {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
}

.status.incomplete,
.status.in_progress,
.status.in_calibration {
  border-color: rgba(183, 121, 31, 0.3);
  background: rgba(183, 121, 31, 0.1);
  color: var(--warn);
}

.status.completed {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.status.archived {
  color: var(--muted);
}

.status.active {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.status.overdue,
.status.blocked,
.status.failed {
  border-color: rgba(180, 35, 24, 0.3);
  background: rgba(180, 35, 24, 0.08);
  color: var(--danger);
}

.status.passed {
  border-color: rgba(15, 118, 110, 0.3);
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
}

.status.locked,
.status.disabled,
.status.inactive,
.status.retired,
.status.not_applicable {
  color: var(--muted);
}

.empty {
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.empty.compact {
  padding: 14px 10px;
}

.error {
  min-height: 24px;
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 900px) {
  .login-page,
  .app-shell {
    grid-template-columns: 1fr;
    background: #18231d;
  }

  .login-aside {
    display: none;
  }

  .sidebar {
    position: static;
    display: grid;
    min-height: 0;
    height: auto;
    max-height: none;
    grid-template-rows: auto auto auto;
    gap: 14px;
    overflow: visible;
  }

  .nav {
    flex: none;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    overflow: visible;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .role-fieldset {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .document-view-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .document-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .document-card {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .document-card-actions {
    justify-content: start;
    flex-wrap: wrap;
  }

  .template-card,
  .template-card-main {
    grid-template-columns: 1fr;
  }

  .template-card-actions {
    justify-content: start;
  }

  .document-detail-layout {
    grid-template-columns: 1fr;
  }

  .action-category-grid {
    grid-template-columns: 1fr;
  }

  .document-history-grid {
    grid-template-columns: 1fr;
  }

  .process-map {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 10px;
  }

  .process-quality {
    grid-template-columns: 1fr;
  }

  .process-node-row,
  .process-node-wrap {
    flex-wrap: wrap;
  }

  .process-arrow {
    display: none;
  }

  .process-flow-row {
    grid-template-columns: 128px repeat(var(--flow-columns), minmax(170px, 1fr));
    min-width: min(100%, calc(128px + var(--flow-columns) * 188px));
  }
}

@media (max-width: 1100px) {
  .table-wrap {
    padding: 12px;
  }

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: grid;
    gap: 12px;
  }

  .responsive-table tr {
    display: grid;
    gap: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 12px;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 0.32fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-bottom: 0;
    padding: 0;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .responsive-table td[data-label="Aktionen"] {
    grid-template-columns: 1fr;
  }

  .responsive-table td[data-label="Aktionen"]::before {
    margin-bottom: 2px;
  }

  .action-stack {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  }
}

@media (max-width: 1180px) {
  .process-map {
    grid-template-columns: 1fr;
    max-width: 720px;
  }

  .process-side {
    min-height: 46px;
  }

  .process-side span,
  .process-side-right span {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .process-lane {
    padding: 16px;
  }

  .process-node-row,
  .process-node-wrap {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    width: 100%;
  }

  .process-card {
    width: min(100%, 560px);
    max-width: 560px;
  }

  .process-card-management {
    min-height: 140px;
    padding-bottom: 34px;
  }

  .process-arrow {
    display: none;
  }
}

@media (max-width: 620px) {
  .login-panel,
  .content,
  .topbar {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }

  .toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar label {
    width: 100%;
  }

  .user-menu {
    margin-left: auto;
  }

  .user-menu-name {
    display: none;
  }

  .form-grid .wide {
    grid-column: span 1;
  }

  .metric-grid,
  .platform-summary,
  .platform-tenant-meta,
  .platform-license-form,
  .role-fieldset,
  .module-fieldset,
  .distribution-summary-grid,
  .document-view-tabs,
  .document-filter-grid {
    grid-template-columns: 1fr;
  }

  .document-filter-grid .wide {
    grid-column: span 1;
  }

  .module-fieldset.wide {
    grid-column: span 1;
  }

  .platform-tenant-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-item {
    grid-template-columns: 1fr;
  }

  .dashboard-item-actions {
    justify-content: start;
  }

  .process-map {
    grid-template-columns: 1fr;
  }

  .process-side {
    min-height: 42px;
  }

  .process-side span,
  .process-side-right span {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .process-node-row,
  .process-node-wrap {
    display: grid;
    grid-template-columns: 1fr;
  }

  .process-card {
    width: 100%;
  }

  .process-flow-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .process-flow-lane-label {
    min-height: 42px;
  }

  .flow-arrow {
    display: none;
  }

  .flow-step-form {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-grid.compact {
    grid-template-columns: 1fr;
  }

  .audit-choice-layout {
    grid-template-columns: 1fr;
  }

  .audit-card-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-file-row {
    grid-template-columns: 1fr;
  }

  .product-file-actions {
    justify-content: start;
  }

  .workflow-path {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    padding: 10px;
  }

  .responsive-table tr {
    padding: 10px;
  }

  .responsive-table td {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .action-stack {
    grid-template-columns: 1fr 1fr;
  }
}
