/* ----------------------------------------
   Root Colors (KFUPM Color Palette)
---------------------------------------- */

:root {
  /* Primary */
  --turquoise-100: #d0e6e8;
  --turquoise-300: #6ba5ad;
  --turquoise-500: #115f66;
  --turquoise-700: #0c4349;
  --turquoise-900: #06272a;

  --green-100: #cdefe3;
  --green-300: #6bd0af;
  --green-500: #009767;
  --green-700: #006246;
  --green-900: #003828;

  --beige-100: #f7f2e7;
  --beige-300: #eee3cf;
  --beige-500: #ece0c7;

  /* Secondary / feedback (for callouts etc.) */
  --yellow-100: #fdeecb;
  --yellow-300: #f7d27a;
  --yellow-500: #f0ba4f;
  --yellow-700: #a57528;
  --yellow-900: #5e4213;

  --warning-100: #fdf0d0;
  --warning-500: #f2c56c;

  --tip-100: #d9f3ef;
  --tip-300: #8ccfc6;
  --tip-500: #2f8f87;
  --tip-700: #1b645f;

  --danger-100: #fde3e3;
  --danger-300: #f7b0b0;
  --danger-500: #db5c5c;
  --danger-700: #8f2d2d;
  --danger-900: #551616;

  --informative-100: #d7eff8;
  --informative-500: #89c4db;

  /* Neutral */
  --white: #ffffff;
  --gray-100: #e7e7e8;
  --gray-300: #c5c5c6;
  --gray-500: #adacad;
  --gray-700: #6b6b6c;
  --gray-900: #3d3d3e;
  --black: #000000;

  /* Interface */
  --bg: var(--beige-100);
  --surface: var(--white);
  --text: var(--turquoise-900);
  --text-muted: var(--gray-700);
  --accent: var(--green-500);
  --accent-soft: var(--green-100);
  --border: var(--gray-300);

  /* Layout */
  --sidebar-width: 300px;
  --sidebar-collapsed-width: 56px;
  --content-max-width-expanded: 960px;
  --content-max-width-collapsed: 1240px;
  --content-padding-x-expanded: 3rem;
  --content-padding-x-collapsed: 1.75rem;
}

/* ----------------------------------------
   Base Styles
---------------------------------------- */

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
}

body {
  font-family: "KFUPM", sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

h1,
h2,
h3,
h4,
h5 {
  color: var(--turquoise-700);
  font-weight: 700;
  margin-top: 0;
}

/* Typographic scale */
h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.1rem;
}

p {
  color: var(--text);
  font-size: 1rem;
  margin-top: 0;
}

/* Useful across pages (process page uses .muted; keep shared) */
.muted {
  color: var(--text-muted);
}

a {
  text-decoration: none;
  color: var(--turquoise-500);
  font-weight: 700;
}

a:hover,
a:focus {
  color: var(--green-700);
}

a:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

/* ----------------------------------------
   Skip Link
---------------------------------------- */

.skip-link {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -40px;
  background: var(--accent);
  color: var(--white);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  z-index: 1000;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ----------------------------------------
   Sidebar Navigation (Process Pages)
---------------------------------------- */

.sidebar {
  width: var(--sidebar-width);
  background: var(--turquoise-900);
  color: var(--white);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  padding: 1.5rem;
  padding-bottom: 4.25rem;
  overflow-y: auto;
  box-sizing: border-box;
  transition: width 0.24s ease;
  overflow-x: hidden;
}

.sidebar-header {
  text-align: center;
  margin-bottom: 2rem;
  min-height: 54px;
  position: relative;
}

.sidebar .logo {
  width: 85%;
  height: auto;
  margin-bottom: 1rem;
  transition:
    transform 0.24s ease,
    width 0.24s ease,
    margin 0.24s ease;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

.nav-links {
  list-style: none;
  padding: 0;
  margin-top: 2rem;
  transition: opacity 0.16s ease;
}

.nav-links li {
  margin: 0.7rem 0;
}

.nav-links a {
  color: var(--white);
  padding: 0.4rem 0.2rem;
  display: block;
  border-radius: 4px;
}

.nav-links a:hover,
.nav-links a:focus,
.nav-links a.active {
  background: var(--turquoise-700);
}

.sidebar-toggle {
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%);
  z-index: 30;
  border: 1px solid var(--turquoise-700);
  background: var(--turquoise-700);
  color: var(--white);
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    padding 0.24s ease,
    min-width 0.24s ease,
    min-height 0.24s ease,
    border-radius 0.24s ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  background: var(--surface);
  border-color: var(--turquoise-500);
  color: var(--turquoise-700);
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  padding: 0.95rem 0.4rem 4rem;
  overflow-x: hidden;
}

.sidebar-collapsed .content {
  margin-left: var(--sidebar-collapsed-width);
  padding-inline: var(--content-padding-x-collapsed);
}

.sidebar-collapsed .site-footer {
  margin-left: var(--sidebar-collapsed-width);
  padding-inline: var(--content-padding-x-collapsed);
}

.sidebar-collapsed .site-title {
  display: none;
}

.sidebar-collapsed .sidebar .logo {
  display: block;
  width: 250px;
  max-width: none;
  margin: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center;
}

.sidebar-collapsed .sidebar-header {
  margin-bottom: 0.9rem;
  min-height: 250px;
  height: 250px;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-header::before {
  content: none;
}

.sidebar-collapsed .nav-links {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar-expanding .nav-links {
  opacity: 0;
  pointer-events: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar-collapsed .sidebar-toggle {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  min-height: 5.35rem;
  min-width: 2.05rem;
  padding: 0.42rem 0.28rem;
  line-height: 1;
}

.sidebar-transitioning .sidebar-toggle,
.sidebar-transitioning .sidebar-toggle:hover,
.sidebar-transitioning .sidebar-toggle:focus-visible {
  background: var(--turquoise-700);
  border-color: var(--turquoise-700);
  color: var(--white);
}

.sidebar-transitioning .sidebar-toggle {
  pointer-events: none;
}

/* ----------------------------------------
   Page Toolbar (Back + Exports)
---------------------------------------- */

.page-actions {
  display: flex;
  justify-content: space-between; /* Pushes navigation to left, Exports to right */
  align-items: center;
  flex-wrap: wrap; /* Allows wrapping on mobile */
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--gray-300); /* Optional: adds a nice separator line */
}

.page-nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Grouping the two export buttons together */
.action-group {
  display: flex;
  gap: 0.75rem;
}

/* ----------------------------------------
   Buttons
---------------------------------------- */

/* Shared base for Back and Export buttons */
.back-button,
.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;

  /* Default Style (Outlined/Secondary) - Applied to all by default */
  background: var(--turquoise-700);
  color: var(--surface);
  border: 1px solid var(--border);
}

.back-button:hover,
.export-button:hover {
  background: var(--surface);
  border-color: var(--gray-500);
  color: var(--turquoise-700);
}

.back-button:focus-visible,
.export-button:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

.back-button:active,
.export-button:active {
  transform: scale(0.98);
}

/* Primary variant (Filled) - Only use if you really want to emphasize one */
.export-button.primary {
  background: var(--turquoise-700);
  color: var(--white);
  border-color: var(--turquoise-700);
}

.export-button.primary:hover {
  background: var(--turquoise-500);
  border-color: var(--turquoise-500);
}

.superuser-status-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.6rem;
  background: var(--surface);
}

.superuser-status-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.superuser-status-select {
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.28rem 0.45rem;
  background: var(--surface);
  color: var(--text);
}

.superuser-status-select:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

.superuser-version-input {
  width: 4.4rem;
  min-width: 4.4rem;
  text-align: center;
}

.superuser-page-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-top: -1rem;
  margin-bottom: 1.4rem;
}

.superuser-page-buttons,
.superuser-page-metadata {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.superuser-page-controls .superuser-status-control {
  padding: 0.35rem 0.5rem;
}

.superuser-page-controls .superuser-status-label {
  font-size: 0.78rem;
}

.superuser-page-controls .superuser-status-select {
  font-size: 0.86rem;
}

/* ----------------------------------------
   Mobile Adjustment
---------------------------------------- */
@media (max-width: 600px) {
  .page-actions {
    flex-direction: column;
    align-items: stretch; /* Full width buttons on mobile */
    gap: 1rem;
  }

  .page-nav-group {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .page-nav-group .back-button {
    width: 100%;
    box-sizing: border-box;
  }

  .action-group {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Split width evenly */
  }

  .superuser-page-controls {
    margin-top: -0.7rem;
    margin-bottom: 1.1rem;
    align-items: stretch;
    flex-direction: column;
  }

  .superuser-page-buttons,
  .superuser-page-metadata {
    width: 100%;
    justify-content: flex-start;
  }

  .superuser-page-buttons .export-button,
  .superuser-page-metadata .superuser-status-control {
    flex: 1 1 auto;
  }

  .superuser-page-metadata .superuser-status-control {
    justify-content: space-between;
  }

  .back-button {
    text-align: center;
  }
}
/* ----------------------------------------
   Main Content (Process Pages)
---------------------------------------- */

.content {
  margin-left: var(--sidebar-width);
  padding: 2.5rem var(--content-padding-x-expanded);
  width: auto;
  box-sizing: border-box;
  min-height: 100vh;
  transition:
    margin-left 0.24s ease,
    padding 0.24s ease;
}

.content-inner {
  max-width: var(--content-max-width-expanded);
  width: min(100%, var(--content-max-width-expanded));
  margin: 0 auto;
}

.page-header {
  margin-bottom: 2.5rem;
}

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

/* Sections and headings */
section {
  margin-bottom: 2.5rem;
}

section h3 {
  margin-bottom: 0.75rem;
}

section h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* ----------------------------------------
   Key Process Logic (Process Pages)
---------------------------------------- */

#key-process-logic ul {
  margin: 0.75rem 0 0;
  padding: 1rem 1.3rem;
  border: 1px solid var(--border);
  border-left: 5px solid var(--turquoise-300);
  border-radius: 8px;
  background: var(--surface);
  list-style: none;
}

#key-process-logic li {
  margin: 0 0 0.85rem;
  position: relative;
}

#key-process-logic li::before {
  content: "•";
  position: absolute;
  left: -0.85rem;
  color: var(--turquoise-500);
}

#key-process-logic li:last-child {
  margin-bottom: 0;
}

#key-process-logic .muted:not(.ref-note) {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.92rem;
  opacity: 0.9;
}

/* Hide in-page source references (keep in HTML for traceability) */
.ref-note {
  display: none;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.3rem;
  margin: 1rem 0;
  border-radius: 8px;
}

/* Process page metadata (Doc ID / Status / Updated / Version) */
.page-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem;
}

.page-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gray-300) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.4;
  max-width: 100%;
}

.page-meta-item .meta-label {
  font-weight: 700;
  color: var(--turquoise-700);
  white-space: nowrap;
}

.page-meta-item .meta-value {
  color: var(--text-muted);
  white-space: nowrap;
}

.page-meta-item.meta-docid .meta-value {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 720px) {
  .page-metadata {
    gap: 0.35rem;
    padding: 0.5rem 0.6rem;
  }

  .page-meta-item {
    font-size: 0.8rem;
  }
}

.raci-table,
.logic-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 1rem 0;
}

.raci-table th,
.raci-table td,
.logic-table th,
.logic-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: top;
}

.raci-table th,
.logic-table th {
  background: var(--beige-100);
  color: var(--turquoise-700);
  font-weight: 700;
  white-space: nowrap;
}

.raci-table tr:last-child td,
.logic-table tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--accent-soft);
  color: var(--green-900);
  font-weight: 700;
  margin-left: 0.35rem;
  white-space: nowrap;
}
/* ----------------------------------------
   Callouts
---------------------------------------- */

.callout {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
}

.callout h4 {
  margin-top: 0;
  margin-bottom: 0.35rem;
}

.callout h5 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}

/* Informational callout */
.callout-info {
  background: var(--informative-100);
  border-color: var(--informative-500);
}

/* Warning callout */
.callout-warning {
  background: var(--warning-100);
  border-color: var(--warning-500);
}

/* Tip callout */
.callout-tip {
  background: var(--tip-100);
  border-color: var(--tip-300);
}

/* Success callout */
.callout-success {
  background: var(--green-100);
  border-color: var(--green-300);
}

/* Critical callout */
.callout-danger {
  background: var(--danger-100);
  border-color: var(--danger-300);
}

blockquote {
  margin: 1.2rem 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--turquoise-300);
  background: var(--beige-100);
}

blockquote p:last-child {
  margin-bottom: 0;
}

mark {
  background: var(--yellow-100);
  color: inherit;
  padding: 0 0.16rem;
  border-radius: 3px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.4rem 0;
}

.align-left {
  text-align: left;
}

.align-center {
  text-align: center;
}

.align-right {
  text-align: right;
}

/* ----------------------------------------
   BPMN Model Frame (shared wrapper; viewer-specific is in bpmn-style.css)
---------------------------------------- */

.model-frame {
  border: 2px solid var(--turquoise-300);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

/* Footer under the viewer */
.model-frame-footer {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem 0.85rem;
  background: var(--beige-100);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.model-frame-footer-title,
.model-frame-footer-subtitle {
  margin: 0;
}

.model-frame-footer-title {
  margin-bottom: 0.25rem;
}

.model-frame-footer a {
  font-weight: 700;
  color: var(--turquoise-500);
}

.model-frame-footer a:hover,
.model-frame-footer a:focus {
  color: var(--green-700);
}

/* ----------------------------------------
   Footer (Process Pages)
---------------------------------------- */

.site-footer {
  margin-left: var(--sidebar-width);
  padding: 1rem var(--content-padding-x-expanded) 1.5rem;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--beige-300) 75%, var(--white)) 0%,
    color-mix(in srgb, var(--beige-300) 56%, var(--white)) 100%
  );
  border-top: 1px solid var(--border);
  box-sizing: border-box;
  transition:
    margin-left 0.24s ease,
    padding 0.24s ease;
}

.site-footer .content-inner {
  max-width: var(--content-max-width-expanded);
  width: min(100%, var(--content-max-width-expanded));
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.sidebar-collapsed .content-inner,
.sidebar-collapsed .site-footer .content-inner {
  max-width: var(--content-max-width-collapsed);
  width: min(100%, var(--content-max-width-collapsed));
  margin-left: 0;
  margin-right: auto;
}

.footer-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--turquoise-700);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.footer-entity {
  color: var(--turquoise-700);
}

.footer-separator {
  color: var(--green-700);
  font-weight: 800;
}

.footer-context {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.footer-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gray-300) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.footer-meta-label {
  font-weight: 700;
  color: var(--turquoise-700);
}

.footer-meta-value {
  color: var(--text-muted);
}

.footer-version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--gray-300) 70%, transparent);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
  font-weight: 700;
  white-space: nowrap;
}

/* ----------------------------------------
   Responsive Design (Process Pages)
---------------------------------------- */

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 1.25rem 1.25rem 1rem;
  }

  .content {
    margin-left: 0;
    padding: 1.5rem 1.25rem;
    width: 100%;
  }

  .site-footer {
    margin-left: 0;
    padding: 1rem 1.25rem 2rem;
  }

  .site-footer .content-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-meta {
    justify-content: flex-start;
  }

  .sidebar-toggle {
    display: none;
  }

  .sidebar-collapsed .content,
  .sidebar-collapsed .site-footer {
    margin-left: 0;
  }

  .sidebar-collapsed .site-title {
    display: block;
  }

  .sidebar-collapsed .sidebar .logo {
    display: block;
    width: 85%;
    max-width: 100%;
    margin-bottom: 1rem;
    position: static;
    left: auto;
    top: auto;
    transform: none;
  }

  .sidebar-collapsed .sidebar-header::before {
    content: none;
  }

  .sidebar-collapsed .sidebar-header {
    margin-bottom: 2rem;
    height: auto;
  }

  .sidebar-collapsed .nav-links {
    opacity: 1;
    pointer-events: auto;
    height: auto;
    margin-top: 2rem;
    overflow: visible;
  }
}

/* ========================================
   HOME PAGE LAYOUT (NO SIDEBAR)
   Applies when <body class="home">
======================================== */

body.home {
  background: var(--bg);
}

/* Shell: header + main + footer stacked */
.home-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top header bar */
.home-header {
  background: var(--turquoise-900);
  color: var(--white);
  padding: 1rem 3rem;
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  align-items: flex-end;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.home-logo {
  height: 40px;
  width: auto;
}

.home-brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--beige-100);
  opacity: 0.88;
  white-space: nowrap;
  position: relative;
  top: 1px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 1rem;
}

.home-header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.home-header-link,
.admin-gateway-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--beige-100) 40%, transparent);
  background: var(--turquoise-700);
  color: var(--beige-100);
  font-size: 0.82rem;
  font-weight: 700;
}

.home-header-link:hover,
.home-header-link:focus-visible,
.admin-gateway-link:hover,
.admin-gateway-link:focus-visible {
  background: var(--beige-100);
  border-color: var(--beige-100);
  color: var(--turquoise-700);
}

/* Main area on home page */
.home-main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 3rem 2rem;
  box-sizing: border-box;
}

/* Hero section */
.hero {
  margin-bottom: 2.5rem;
}

.hero-subtitle {
  color: var(--text-muted);
  max-width: 720px;
}

/* Search & filters */
.hero-actions {
  margin-top: 1.5rem;
  max-width: 420px;
}

.search-label,
.filter-label {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.search-wrapper {
  max-width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
  color: var(--text);
}

.search-input:focus {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

/* Filter controls under search */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  width: 100%;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 0;
  min-width: 0;
}

.filter-select {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 2rem 0.55rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236BA5AD' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px 8px;
  box-sizing: border-box;
}

.filter-select:hover {
  border-color: var(--gray-500);
}

.filter-select:focus {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .filter-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .filter-select {
    width: 100%;
  }
}

/* Process list */
.process-list {
  margin-bottom: 2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.section-title {
  margin-bottom: 1.25rem;
}

/* Grid of process cards */
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  flex: 1;
}

/* Individual process card */
.process-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.3rem 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.process-name {
  line-height: 1.25;
  margin: 0;
  /* Reserve space for up to 2 lines so the summary always starts at the same Y */
  min-height: calc(1.25em * 2);

  /* Optional: clamp titles to 2 lines (prevents tall cards from long titles) */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* Tags & status */
.process-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
}

.process-tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  background: var(--beige-300);
  color: var(--turquoise-900);
}

.status-tag {
  background: var(--accent-soft);
  color: var(--green-900);
}

/* Link in card */
.process-link {
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

/* No-results message */
.no-results {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Home footer */
.home-footer {
  padding: 1rem 3rem 1.5rem;
  position: relative;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--beige-300) 73%, var(--white)) 0%,
    color-mix(in srgb, var(--beige-300) 55%, var(--white)) 100%
  );
  border-top: 1px solid var(--border);
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.home-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--green-500), var(--turquoise-500));
}

.home-footer .footer-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--turquoise-700);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.home-footer .footer-entity {
  color: var(--turquoise-700);
}

.home-footer .footer-separator {
  color: var(--green-700);
  font-weight: 800;
}

.home-footer .footer-context {
  color: var(--text-muted);
  font-weight: 500;
}

/* ----------------------------------------
   Back to Top Button (Process Pages)
---------------------------------------- */

.top-button {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.55rem 1rem;
  background: var(--turquoise-700);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition:
    background 0.2s ease,
    transform 0.1s ease;
  border: 1px solid var(--border);
}

.top-button:hover {
  background: var(--surface);
  border-color: var(--gray-500);
  color: var(--turquoise-700);
}

.top-button:focus {
  outline: 2px solid var(--yellow-500);
  outline-offset: 3px;
}

.top-button:active {
  transform: scale(0.98);
}

/* ========================================
   EXPORT / PRINT MODE
   Applied when <body> has .export-mode

   Goals:
   1) Hide navigation + export UI (keep document clean)
   2) Hide BPMN viewer (interactive; not export-friendly)
   3) Show an export-only BPMN notice with a link
   4) Improve pagination: keep cards/tables together
   5) Prevent sliced headings (anti-glyph-cut) in PDF raster slicing
======================================== */

/* -----------------------------
   1) Hide UI controls in export
------------------------------ */

body.export-mode .page-actions,
body.export-mode .export-button,
body.export-mode .back-button,
body.export-mode .top-button {
  display: none !important;
}

/* -----------------------------
   2) BPMN: hide viewer in export
------------------------------ */

body.export-mode .bpmn-viewer,
body.export-mode .model-frame {
  display: none !important;
}

/* -----------------------------
   3) BPMN: export-only notice
------------------------------ */

.export-bpmn-note {
  display: none; /* hidden on-screen */
}

body.export-mode .export-bpmn-note {
  display: block;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  background: var(--informative-100);
  border: 1px solid var(--informative-500);
  color: var(--text);
  font-size: 0.95rem;
}

body.export-mode .export-bpmn-note a {
  font-weight: 700;
}

/* -----------------------------
   4) Pagination control
   Keep blocks intact when possible
------------------------------ */

body.export-mode .card,
body.export-mode .callout,
body.export-mode table,
body.export-mode .raci-table,
body.export-mode .logic-table,
body.export-mode .model-frame-footer,
body.export-mode .page-header {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Reduce splitting inside tables */
body.export-mode tr,
body.export-mode td,
body.export-mode th {
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Orphans / widows (best-effort) */
body.export-mode p,
body.export-mode li {
  orphans: 3;
  widows: 3;
}

/* -----------------------------
   5) Headings: prevent "half-line"
   across pages in PDF (anti-glyph-cut)

   Rationale:
   Some PDF renderers rasterize then slice.
   A background + padding makes the slice hit
   background space instead of cutting glyph pixels.
------------------------------ */

body.export-mode h1,
body.export-mode h2,
body.export-mode h3,
body.export-mode h4,
body.export-mode h5 {
  display: block;
  width: 100%;

  /* safety buffer around glyphs */
  padding: 2mm 0;

  /* ensures slice cuts padding, not text */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;

  /* best-effort break avoidance */
  break-inside: avoid;
  page-break-inside: avoid;
  break-after: avoid;
  page-break-after: avoid;
}
body.export-mode .content-inner {
  background: #ffffff;
  padding: 1.5rem 2rem;
}

/* -----------------------------
   6) Export overlay (PDF export UX)
   Visible while export is running
------------------------------ */

.export-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 39, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.export-overlay .export-overlay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  color: var(--turquoise-900);
  font-weight: 700;
}

/* Responsive tweaks for home */
@media (max-width: 900px) {
  .home-header {
    padding: 1rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .home-main {
    padding: 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
  }

  .home-footer {
    padding: 1rem 1.5rem 1.5rem;
    align-items: flex-start;
    flex-direction: column;
  }

  .home-footer .footer-text {
    flex-wrap: wrap;
    gap: 0.35rem;
  }
}

/* ----------------------------------------
   Superuser Mode (Admin)
---------------------------------------- */

.superuser-enabled .superuser-editable-target {
  cursor: text;
  outline: 1px dashed var(--informative-500);
  outline-offset: 2px;
}

.superuser-enabled .superuser-editable-target:hover {
  background: color-mix(in srgb, var(--informative-100) 65%, white);
}

.superuser-enabled:not(.superuser-char-highlight-supported)
  .superuser-changed-target {
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--green-500) 58%, transparent);
  text-decoration-thickness: 0.22em;
  text-underline-offset: 0.14em;
  text-decoration-skip-ink: none;
}

::highlight(superuser-diff) {
  background: color-mix(in srgb, var(--green-100) 66%, white);
  color: inherit;
}

.superuser-active-target {
  outline: 2px solid var(--yellow-500) !important;
  background: color-mix(in srgb, var(--yellow-100) 65%, white);
}

.superuser-inline-editing {
  cursor: text;
  white-space: pre-wrap;
}

.superuser-toolbar {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1100;
  display: grid;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 0.9rem;
}

.superuser-title {
  font-weight: 800;
  color: var(--turquoise-700);
}

.superuser-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.superuser-chip-info {
  background: color-mix(in srgb, var(--informative-100) 65%, white);
  color: var(--informative-700);
  border: 1px solid var(--informative-300);
}

.superuser-status,
.superuser-counter {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.superuser-status-info {
  color: var(--text-muted);
}

.superuser-status-warn {
  color: var(--yellow-700);
}

.superuser-status-error {
  color: var(--danger-700);
}

.superuser-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.superuser-delete-draft-button {
  border-color: var(--danger-900);
  background: var(--danger-900);
  color: var(--danger-100);
}

.superuser-delete-draft-button:hover:not(:disabled),
.superuser-delete-draft-button:focus-visible:not(:disabled) {
  border-color: var(--danger-700);
  background: var(--danger-700);
  color: var(--white);
}

.superuser-delete-draft-button.is-armed {
  border-color: var(--danger-700);
  background: var(--danger-700);
  color: var(--white);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger-300) 45%, transparent);
}

.superuser-delete-draft-button:disabled {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 78%, var(--gray-100));
  color: var(--gray-500);
}

.superuser-btn {
  font: inherit;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  cursor: pointer;
}

.superuser-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.superuser-btn-primary {
  background: var(--green-500);
  color: var(--white);
  border-color: var(--green-700);
}

.superuser-btn-primary:hover:not(:disabled),
.superuser-btn-primary:focus-visible:not(:disabled) {
  background: var(--green-700);
}

.superuser-btn-muted {
  background: var(--surface);
  color: var(--text);
}

.superuser-btn-warning {
  background: var(--yellow-500);
  color: var(--text);
  border-color: var(--yellow-700);
}

.superuser-btn-warning:hover:not(:disabled),
.superuser-btn-warning:focus-visible:not(:disabled) {
  background: var(--yellow-700);
  color: var(--white);
}

.superuser-inline-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.35rem 0 0.7rem;
  padding: 0.35rem 0.45rem;
  border: 1px dashed var(--informative-300);
  border-radius: 8px;
  background: color-mix(in srgb, var(--informative-100) 45%, white);
}

.superuser-inline-key {
  margin-right: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .superuser-toolbar {
    right: 0.5rem;
    bottom: 0.5rem;
  }
}

.superuser-alert {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  width: min(900px, calc(100vw - 1.5rem));
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.15);
}

.superuser-alert-error {
  border-color: var(--danger-500);
  background: color-mix(in srgb, var(--danger-100) 55%, white);
  color: var(--danger-700);
}

.superuser-alert-hint {
  display: inline-block;
  margin-left: 0.35rem;
}

.superuser-alert-close {
  margin-left: auto;
  border: 1px solid var(--danger-300);
  background: var(--surface);
  color: var(--danger-700);
  border-radius: 8px;
  padding: 0.2rem 0.55rem;
  font: inherit;
  cursor: pointer;
}

.superuser-alert-close:hover,
.superuser-alert-close:focus-visible {
  background: color-mix(in srgb, var(--danger-100) 45%, white);
}

/* ----------------------------------------
   Admin Dashboard
---------------------------------------- */

.admin-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(17, 95, 102, 0.08), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(0, 151, 103, 0.08), transparent 36%),
    var(--bg);
  color: var(--text);
}

.admin-header {
  padding: 1rem 1.2rem 1.08rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, white);
  background: linear-gradient(
    110deg,
    color-mix(in srgb, var(--surface) 86%, var(--beige-100)) 0%,
    color-mix(in srgb, var(--surface) 80%, var(--turquoise-100)) 100%
  );
  box-shadow: 0 5px 18px rgba(6, 39, 42, 0.08);
}

.admin-header-brand {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}
.admin-header-separator {
  color: var(--turquoise-700);
  font-size: 1.65rem;
}

.admin-logo {
  width: clamp(220px, 24vw, 320px);
  max-width: 100%;
  height: auto;
  flex: 0 0 auto;
}

.admin-header h1 {
  margin: 0;
  color: var(--turquoise-700);
}

.admin-back-link {
  white-space: nowrap;
  margin-right: auto;
}

.admin-back-link:hover,
.admin-back-link:focus-visible {
  text-decoration: none;
}

.admin-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.28rem;
}

.admin-actions-row {
  margin: 0;
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.55rem;
}

:is(.admin-actions, .admin-modal-actions) .admin-action-control {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
  background: var(--turquoise-700);
  color: var(--surface);
  border: 1px solid var(--border);
}

:is(.admin-actions, .admin-modal-actions) .admin-action-control:hover,
:is(.admin-actions, .admin-modal-actions) .admin-action-control:focus-visible {
  background: var(--surface);
  border-color: var(--gray-500);
  color: var(--turquoise-700);
}

:is(.admin-actions, .admin-modal-actions) .admin-action-control:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

:is(.admin-actions, .admin-modal-actions) .admin-action-control:active {
  transform: scale(0.98);
}

:is(.admin-actions, .admin-modal-actions) .admin-action-control:disabled {
  opacity: 1;
  cursor: not-allowed;
  transform: none;
  background: var(--turquoise-700);
  color: var(--surface);
  border-color: var(--border);
}

:is(.admin-actions, .admin-modal-actions) .admin-action-control:disabled:hover {
  background: var(--turquoise-700);
  color: var(--surface);
  border-color: var(--border);
}

:is(.admin-actions, .admin-modal-actions) .admin-action-control:disabled:focus-visible {
  outline: none;
}

.admin-header-feedback {
  display: grid;
  gap: 0.15rem;
  justify-items: end;
}

.admin-header-feedback .admin-state-detail {
  margin: 0;
  max-width: 58ch;
  text-align: right;
  font-size: 0.84rem;
  line-height: 1.32;
}

.admin-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.admin-card {
  grid-column: span 12;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1rem 1.05rem;
  box-shadow: 0 6px 18px rgba(6, 39, 42, 0.07);
}

.admin-card h2 {
  margin: 0 0 0.6rem;
  color: var(--turquoise-700);
}

.admin-state-detail {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.admin-state-ok {
  color: var(--green-700);
}

.admin-state-warn {
  color: var(--yellow-700);
}

.admin-state-error {
  color: var(--danger-700);
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  border-radius: 9px;
  border: 1px solid var(--border);
  padding: 0.5rem 0.82rem;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
}

.admin-btn:hover {
  transform: translateY(-1px);
}

.admin-btn:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

.admin-btn-primary {
  background: linear-gradient(180deg, var(--green-500), var(--green-700));
  color: var(--white);
  border-color: var(--green-700);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.admin-btn-primary:hover,
.admin-btn-primary:focus-visible {
  background: linear-gradient(180deg, var(--green-700), #015139);
}

.admin-btn-muted {
  background: color-mix(in srgb, var(--surface) 78%, var(--beige-100));
  color: var(--text);
}

.admin-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.admin-processes {
  margin-top: 0.65rem;
}

.admin-process-drafts {
  margin-top: 0.58rem;
  margin-bottom: 0.75rem;
}

.admin-process-drafts-title {
  margin: 0 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.admin-process-draft-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.admin-process-draft-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.52rem 0.62rem;
  background: color-mix(in srgb, var(--surface) 90%, var(--beige-100));
}

.admin-process-draft-summary {
  margin: 0;
  color: var(--turquoise-700);
  font-weight: 700;
}

.admin-process-draft-actions {
  margin-top: 0.32rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.admin-process-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  column-gap: 1rem;
  row-gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: max-content;
  align-items: start;
}

.admin-process-item {
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: color-mix(in srgb, var(--surface) 88%, var(--turquoise-100));
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 120ms ease;
}

.admin-process-item:hover {
  border-color: var(--turquoise-300);
  box-shadow: 0 6px 14px rgba(6, 39, 42, 0.08);
  transform: translateY(-1px);
}

.admin-process-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
}

.admin-process-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
  min-height: calc(1.3em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 700;
  color: var(--turquoise-700);
}

.admin-process-delete-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--danger-300) 70%, var(--border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--danger-100) 52%, var(--surface));
  padding: 0;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
}

.admin-process-delete-icon img {
  width: 0.92rem;
  height: 0.92rem;
  opacity: 0.9;
}

.admin-process-delete-icon:hover,
.admin-process-delete-icon:focus-visible {
  background: color-mix(in srgb, var(--danger-100) 74%, var(--surface));
  border-color: var(--danger-500);
}

.admin-process-delete-icon:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: 2px;
}

.admin-process-delete-icon:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.admin-process-actions {
  margin-top: 0.22rem;
  display: flex;
  gap: 0.55rem;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font: inherit;
  color: var(--turquoise-700);
  border: 1px solid color-mix(in srgb, var(--turquoise-300) 66%, var(--border));
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  background: color-mix(in srgb, var(--surface) 86%, var(--turquoise-100));
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.admin-link:hover,
.admin-link:focus-visible {
  text-decoration: none;
  border-color: var(--turquoise-500);
  background: color-mix(in srgb, var(--turquoise-100) 76%, var(--surface));
}

.admin-link-primary {
  color: var(--turquoise-700);
  border-color: color-mix(in srgb, var(--turquoise-300) 66%, var(--border));
  background: color-mix(in srgb, var(--turquoise-100) 64%, var(--surface));
}

.admin-link-danger {
  color: var(--danger-700);
  border-color: color-mix(in srgb, var(--danger-300) 72%, var(--border));
  background: color-mix(in srgb, var(--danger-100) 52%, var(--surface));
}

.admin-link-danger:hover,
.admin-link-danger:focus-visible {
  color: var(--danger-700);
  border-color: var(--danger-500);
  background: color-mix(in srgb, var(--danger-100) 74%, var(--surface));
}

.admin-link:disabled {
  color: var(--text-muted);
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 80%, var(--gray-100));
  cursor: not-allowed;
}

.admin-link-disabled {
  color: var(--text-muted);
  pointer-events: none;
  text-decoration: none;
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface) 80%, var(--gray-100));
}

.admin-trash-processes {
  margin-top: 0.65rem;
}

.admin-trash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.72rem;
}

.admin-trash-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  background: color-mix(in srgb, var(--surface) 90%, var(--beige-100));
}

.admin-trash-title {
  margin: 0;
  font-weight: 700;
  color: var(--turquoise-700);
}

.admin-trash-meta {
  margin: 0.18rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.admin-trash-countdown {
  color: var(--yellow-900);
  font-weight: 700;
}

.admin-trash-actions {
  margin-top: 0.42rem;
}

.admin-debug-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  color: var(--text-muted);
}

.admin-debug-grid p {
  margin: 0;
  padding: 0.28rem 0.34rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--beige-100) 72%, var(--surface));
}

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

.admin-session-grid p {
  white-space: normal;
}

.admin-session-grid .admin-debug-value {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-session-note {
  margin: 0;
}

.admin-session-note-extra {
  margin: 0 0 0.58rem;
  min-height: 1.5em;
}

.admin-debug-value {
  display: inline-flex;
  align-items: center;
  margin-left: 0.35rem;
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--surface);
}

.admin-debug-value.is-ok {
  color: var(--green-900);
  border-color: color-mix(in srgb, var(--green-300) 42%, var(--border));
  background: color-mix(in srgb, var(--green-100) 40%, var(--surface));
}

.admin-debug-value.is-warn {
  color: var(--yellow-900);
  border-color: var(--yellow-300);
  background: color-mix(in srgb, var(--yellow-100) 76%, white);
}

.admin-debug-value.is-error {
  color: var(--danger-700);
  border-color: var(--danger-300);
  background: color-mix(in srgb, var(--danger-100) 76%, white);
}

.admin-debug-value.is-neutral {
  color: var(--text-muted);
}

.admin-checklist {
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-checklist li + li {
  margin-top: 0.55rem;
}

.admin-checklist li {
  position: relative;
  padding-left: 1.35rem;
  color: color-mix(in srgb, var(--text) 78%, var(--text-muted));
}

.admin-checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--green-700);
  font-weight: 800;
}

/* ----------------------------------------
   Admin Create-Process Modal
---------------------------------------- */

.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 39, 42, 0.5);
  backdrop-filter: blur(2px);
}

.admin-modal {
  width: min(680px, 96vw);
  max-height: min(92vh, 920px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--turquoise-300) 72%, var(--border));
  background: var(--surface);
  box-shadow: 0 22px 42px rgba(6, 39, 42, 0.28);
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--beige-100) 82%, var(--surface));
}

.admin-modal-header h3 {
  margin: 0;
  color: var(--turquoise-700);
}

.admin-modal-close {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-muted);
  padding: 0.33rem 0.58rem;
  font: inherit;
  cursor: pointer;
}

.admin-modal-close:hover,
.admin-modal-close:focus-visible {
  color: var(--text);
  border-color: var(--turquoise-300);
}

.admin-modal-body {
  padding: 0.95rem 1rem 1rem;
}

.admin-modal-help {
  margin: 0 0 0.72rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.admin-modal-form {
  display: grid;
  gap: 0.72rem;
}

.admin-modal-field {
  display: grid;
  gap: 0.32rem;
}

.admin-modal-label {
  font-weight: 700;
  color: var(--turquoise-700);
}

.admin-modal-field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.58rem;
  font: inherit;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, var(--beige-100));
}

.admin-modal-field input:focus-visible {
  outline: 2px solid var(--yellow-500);
  outline-offset: 1px;
  border-color: var(--turquoise-500);
}

.admin-modal-hint {
  font-size: 0.79rem;
  color: var(--text-muted);
}

.admin-modal-error {
  min-height: 1.2rem;
  margin: 0;
  color: var(--danger-700);
  font-weight: 700;
  font-size: 0.88rem;
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.72rem;
}

@media (max-width: 1100px) {
  .admin-header {
    padding: 0.95rem 1rem 1.02rem;
  }

  .admin-actions {
    align-items: stretch;
  }

  .admin-actions-row {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .admin-header-feedback {
    justify-items: start;
  }

  .admin-header-feedback .admin-state-detail {
    text-align: left;
    max-width: 100%;
  }
}

@media (min-width: 980px) {
  .admin-card-status,
  .admin-card-debug {
    grid-column: span 6;
  }

  .admin-card-processes,
  .admin-card-trash,
  .admin-card-checklist {
    grid-column: span 12;
  }
}

@media (max-width: 900px) {
  .admin-logo {
    width: min(240px, 72vw);
  }

  .admin-header {
    padding: 0.88rem 0.9rem 0.96rem;
  }

  .admin-main {
    padding: 0.95rem 0.85rem 1.4rem;
    gap: 0.75rem;
  }

  .admin-debug-grid {
    grid-template-columns: 1fr;
  }

  .admin-session-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-process-actions {
    flex-wrap: wrap;
  }

  .admin-modal {
    width: 100%;
    max-height: 95vh;
  }

  .admin-modal-actions {
    justify-content: stretch;
    flex-direction: column-reverse;
  }

  .admin-modal-actions .admin-btn {
    width: 100%;
  }
}
