@import url('https://fonts.bunny.net/css?family=inter:400,500,600,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&display=swap');

:root {
  /* Surfaces & text */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Brand */
  --primary: #007288;
  --primary-hover: #005f73;
  --primary-soft: #e6f4f7;
  --primary-contrast: #ffffff;

  /* Semantic */
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0ea5e9;
  --info-soft: #f0f9ff;

  --error-bg: var(--danger-soft);
  --error-text: #b91c1c;
  --error-border: #fecaca;

  /* Type scale (locked) */
  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.875rem;    /* 14 */
  --fs-base: 1rem;      /* 16 */
  --fs-md: 1.0625rem;   /* 17 */
  --fs-lg: 1.25rem;     /* 20 */
  --fs-xl: 1.5rem;      /* 24 */
  --fs-2xl: 1.875rem;   /* 30 */
  --fs-3xl: 2.25rem;    /* 36 */

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-normal: 1.5;
  --lh-relaxed: 1.65;

  /* Spacing scale (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 10px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
  --shadow: var(--shadow-lg);

  /* Motion */
  --duration-fast: 120ms;
  --duration-normal: 180ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Focus ring (a11y) */
  --ring: 0 0 0 3px rgba(0, 114, 136, 0.35);
  --ring-danger: 0 0 0 3px rgba(220, 38, 38, 0.3);

  /* Layout */
  --nav-h: 72px;
  --bottom-nav-h: 0px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --container-max: 1280px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* Locked type scale: applies to all pages unless a more specific rule wins. */
h1, .h1 {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-2xl);
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  letter-spacing: -0.015em;
}
h2, .h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-xl);
  line-height: var(--lh-snug);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
h3, .h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
  font-weight: var(--fw-semibold);
}
p { margin: 0 0 var(--space-3); }
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }

/* Global a11y focus ring */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-xs);
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--ring);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Dark mode — automatic via OS preference. Tokens shift, components follow. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --surface: #111a2e;
    --surface-muted: #182238;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    --border: #1f2a44;
    --border-strong: #2c3a5e;

    --primary: #2db5cc;
    --primary-hover: #4ec6db;
    --primary-soft: #0e2b34;
    --primary-contrast: #0b1220;

    --success-soft: #062b21;
    --warning-soft: #2c1d05;
    --danger-soft: #2c0d0d;
    --info-soft: #082235;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 10px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px -12px rgba(0, 0, 0, 0.6);

    --ring: 0 0 0 3px rgba(45, 181, 204, 0.4);
  }
}

/* PWA install gate — full-screen overlay shown on mobile browsers until installed. */
:root[data-pwa-gate] body {
  overflow: hidden;
}
.pwa-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(180deg, var(--primary) 0%, #005f73 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  padding-bottom: calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
  padding-top: calc(var(--space-6) + env(safe-area-inset-top, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pwa-gate-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-5);
  max-width: 28rem;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
}
.pwa-gate-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-4);
  display: block;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px;
}
.pwa-gate-title {
  margin: 0 0 var(--space-2);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.015em;
  color: #fff;
}
.pwa-gate-subtitle {
  margin: 0 0 var(--space-5);
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
.pwa-gate-lede {
  margin: 0 0 var(--space-4);
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--fs-base);
}
.pwa-gate-button {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  border: 0;
  background: #fff;
  color: var(--primary);
  font: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 80ms var(--ease);
}
.pwa-gate-button:active { transform: scale(0.98); }
.pwa-gate-button:disabled { opacity: 0.6; cursor: progress; }
.pwa-gate-steps {
  text-align: left;
  margin: 0;
  padding-left: var(--space-5);
  color: rgba(255, 255, 255, 0.95);
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
}
.pwa-gate-steps li { margin-bottom: var(--space-2); }
.pwa-gate-steps strong { color: #fff; font-weight: var(--fw-semibold); }
.pwa-gate-icon-ios {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 0.95em;
}
.pwa-gate-manual {
  margin-top: var(--space-4);
  text-align: left;
}
.pwa-gate-manual summary {
  cursor: pointer;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.85);
  padding: var(--space-2) 0;
  list-style: none;
}
.pwa-gate-manual summary::-webkit-details-marker { display: none; }
.pwa-gate-manual summary::before {
  content: "▸";
  display: inline-block;
  margin-right: var(--space-2);
  transition: transform var(--duration-fast) var(--ease);
}
.pwa-gate-manual[open] summary::before {
  transform: rotate(90deg);
}
.pwa-gate-manual-note {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.7);
  line-height: var(--lh-snug);
}

/* Print — clean documentation output for office use */
@media print {
  .app-nav,
  .chat-form,
  .handbook-search,
  .favorite-toggle,
  .step-info-button,
  .screenshot-editor,
  .link-action,
  #chatClear,
  .workbench-list,
  .handbook-nav { display: none !important; }

  body { background: #fff !important; color: #000 !important; }
  .workbench,
  .handbook,
  .chat { display: block !important; height: auto !important; padding: 0 !important; }
  .workbench-detail,
  .handbook-detail { border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .detail-body { display: block !important; }
  .detail-screenshot { min-height: auto !important; background: #fff !important; }
  figure.screenshot img { max-height: none !important; }
  .step-item { page-break-inside: avoid; border: 1px solid #aaa !important; }
  .handbook-article { page-break-inside: avoid; }
  a { color: #000 !important; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

.page {
  padding: 2rem 1rem;
}

/* App navbar */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(140%) blur(8px);
}
.app-nav-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--nav-h);
  padding: 0 1.5rem;
  width: 100%;
}
.app-nav-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.app-nav-brand:hover { text-decoration: none; }
.app-nav-brand-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}
@media (max-width: 720px) {
  .app-nav-brand-logo { height: 36px; }
}
.app-nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}
.app-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.app-nav-link:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.05);
  text-decoration: none;
}
.app-nav-link.is-active {
  color: var(--primary-contrast);
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 6px 16px -8px rgba(0, 114, 136, 0.6);
}
.app-nav-link.is-active:hover {
  color: var(--primary-contrast);
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.app-nav-logout {
  margin: 0 0 0 0.25rem;
}
.app-nav-logout-button {
  border-color: var(--border);
  color: var(--text-muted);
}
.app-nav-logout-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: transparent;
}

.app-nav-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.app-nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
}
.app-nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Mobile: hide top-nav links — bottom-nav takes over. Top stays for brand only. */
.app-bottom-nav { display: none; }

@media (max-width: 720px) {
  :root {
    --nav-h: 56px;
    --bottom-nav-h: 64px;
  }
  .app-nav-inner {
    padding: 0 1rem;
  }
  .app-nav-links { display: none; }

  .app-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: var(--bottom-nav-h);
    grid-auto-rows: 0;
    align-content: start;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px -8px rgba(15, 23, 42, 0.15);
  }
  .app-bottom-nav-link,
  .app-bottom-nav-logout button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: var(--bottom-nav-h);
    padding: 0 var(--space-1);
    border: 0;
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    font: inherit;
    font-size: 11px;
    font-weight: var(--fw-medium);
    line-height: 1;
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
    box-sizing: border-box;
  }
  .app-bottom-nav-logout { display: contents; }
  .app-bottom-nav-link.is-active {
    color: var(--primary);
  }
  .app-bottom-nav-link.is-active .app-bottom-nav-icon {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  }
  .app-bottom-nav-link:active {
    background: var(--surface-muted);
  }
  .app-bottom-nav-icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    font-size: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .app-bottom-nav-label {
    flex: 0 0 auto;
    height: 14px;
    line-height: 14px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Reserve space at viewport bottom so content doesn't hide behind bottom-nav. */
  body {
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }
  /* Heights now use --bottom-nav-h variable, set in :root; no override needed. */
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
  text-decoration: none;
  min-height: 44px;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}
.btn-primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
}
.btn-primary:active { transform: translateY(1px); }
.btn-block {
  width: 100%;
  padding: 0.875rem 1.25rem;
}

/* Auth */
.auth-body {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 0% -10%, rgba(0, 114, 136, 0.18), transparent 60%),
    radial-gradient(1000px 500px at 100% 110%, rgba(14, 165, 233, 0.18), transparent 60%),
    var(--bg);
}

.auth-shell {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  padding-top: max(1.25rem, env(safe-area-inset-top));
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.5rem;
}
.auth-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.auth-brand-name {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
}
.auth-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.field input {
  font: inherit;
  font-size: 16px; /* prevent iOS zoom on focus */
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 114, 136, 0.15);
}

.alert {
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}
.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.auth-footer {
  margin: 1.5rem 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-microsoft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #5e5e5e;
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  min-height: 44px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn-microsoft:hover {
  border-color: #999;
  text-decoration: none;
  box-shadow: 0 4px 12px -6px rgba(15, 23, 42, 0.18);
}
.btn-microsoft.btn-block {
  width: 100%;
}
@media (prefers-color-scheme: dark) {
  .btn-microsoft {
    background: #1a2244;
    color: var(--text);
    border-color: var(--border);
  }
  .btn-microsoft:hover {
    border-color: var(--primary);
  }
}

/* Workbench: 50/50 list + detail */
.workbench {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  width: 100%;
  height: calc(100dvh - var(--nav-h) - var(--bottom-nav-h) - var(--safe-bottom));
  padding: 1.5rem;
}

.workbench-list,
.workbench-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.workbench-list::before,
.workbench-detail::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 30%, transparent 100%);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.workbench-list {
  overflow: hidden;
}

.search-box {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 114, 136, 0.15);
}
.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.search-clear:hover {
  background: rgba(0, 114, 136, 0.08);
  color: var(--primary);
}
.search-box:has(.search-input:not(:placeholder-shown)) .search-clear {
  opacity: 1;
  pointer-events: auto;
}

.process-list {
  list-style: none;
  margin: 0;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
  flex: 1;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.process-item-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}
.process-item-favorite {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  color: var(--text-subtle);
  font-size: 1.125rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms ease, background-color 120ms ease;
}
.process-item-favorite:hover {
  color: #d9a400;
  background: rgba(245, 180, 0, 0.08);
}
.process-item-favorite:focus-visible {
  outline: 2px solid #d9a400;
  outline-offset: 2px;
}
.process-item-favorite.is-favorite {
  color: #f5b400;
}
.process-item-favorite:disabled {
  opacity: 0.5;
  cursor: progress;
}
.process-item-row > .process-item {
  flex: 1 1 auto;
  min-width: 0;
}
.process-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    background-color 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
}
.process-item::before {
  display: none;
}
.process-item:hover {
  border-color: rgba(0, 114, 136, 0.4);
  box-shadow: 0 4px 14px -8px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}
.process-item:active {
  transform: translateY(0);
}
.process-item.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
}
.process-item.is-active::before {
  opacity: 1;
}

.process-item-icon {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    135deg,
    rgba(0, 114, 136, 0.15),
    rgba(14, 165, 233, 0.15)
  );
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
  transition: background 0.2s ease, color 0.2s ease;
}
.process-item.is-active .process-item-icon {
  background: rgba(255, 255, 255, 0.18);
  color: var(--primary-contrast);
}
.process-item.is-active .process-item-description {
  color: rgba(255, 255, 255, 0.85);
}

.process-item-name {
  min-width: 0;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.process-item-description {
  color: var(--text-muted);
  font-size: 0.875rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.process-item-systems {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
  align-items: center;
}

.process-item-chevron {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 300;
  transition: color 0.15s ease, transform 0.15s ease;
}
.process-item:hover .process-item-chevron {
  color: var(--primary);
  transform: translateX(2px);
}
.process-item.is-active .process-item-chevron {
  color: var(--primary-contrast);
}
.process-item.is-active .pill {
  background: rgba(255, 255, 255, 0.18);
  color: var(--primary-contrast);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Pill system — uniform shape, semantic variants. */
.pill {
  display: inline-flex;
  align-items: center;
  height: 1.375rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  border: 1px solid transparent;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pill-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.pill-typical {
  background: var(--success-soft);
  color: #047857;
}
.pill-warning {
  background: var(--warning-soft);
  color: #b45309;
}
.pill-count {
  background: var(--surface-muted);
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
}

.step-detail-header-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.search-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem 1rem;
  margin: 0;
}

/* Detail panel */
.workbench-detail {
  overflow-y: auto;
}
.detail-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
}
.detail-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: 100%;
}
.detail-title-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}
.detail-title {
  margin: 0;
  text-align: center;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.015em;
  color: var(--text);
}
@media (max-width: 720px) {
  .detail-title { font-size: var(--fs-xl); }
}
.favorite-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--text-muted, #888);
  font-size: 1.75rem;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color 120ms ease, background-color 120ms ease, transform 120ms ease;
}
.favorite-toggle:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: #d9a400;
}
.favorite-toggle:focus-visible {
  outline: 2px solid #d9a400;
  outline-offset: 2px;
}
.favorite-toggle.is-favorite {
  color: #f5b400;
}
.favorite-toggle:disabled {
  opacity: 0.5;
  cursor: progress;
}
.favorite-icon {
  display: inline-block;
}
.detail-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.detail-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}
.detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}
.detail-typical-for {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}
.detail-description-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}
.detail-description-wrap.is-editing {
  align-self: stretch;
  gap: 0.75rem;
}
.detail-description-wrap:not(.is-editing) {
  min-height: 1.5rem;
}
.detail-description-wrap:not(.is-editing) .link-action {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.detail-description-wrap.is-editing .link-action,
.detail-description-wrap:not(.is-editing):hover .link-action,
.detail-description-wrap:not(.is-editing):focus-within .link-action {
  opacity: 1;
  pointer-events: auto;
}
.detail-description {
  margin: 0;
  color: var(--text);
  font-size: 1.125rem;
  line-height: 1.55;
  text-align: center;
  max-width: 60rem;
}
.process-description-input {
  width: 100%;
  max-width: 60rem;
  font: inherit;
  font-size: 1.0625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.process-description-actions {
  display: flex;
  gap: 0.625rem;
  align-items: center;
  justify-content: center;
}

.detail-responsible {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.detail-responsible-label {
  font-weight: 500;
}
.detail-responsible-name {
  color: var(--text);
  font-weight: 600;
}
.responsible-avatar {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(
    135deg,
    rgba(0, 114, 136, 0.18),
    rgba(14, 165, 233, 0.18)
  );
  color: var(--primary);
  font-weight: 700;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.responsible-avatar-fallback {
  text-transform: uppercase;
}

.meta-line {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
}
.meta-line[hidden] {
  display: none;
}
.meta-line strong {
  font-weight: 600;
  color: var(--text);
}
.meta-sep {
  color: var(--border);
}
.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 1.25rem;
  flex: 1;
  min-height: 0;
}
.detail-body-empty {
  grid-template-columns: 1fr;
  text-align: center;
}
.detail-body-empty .detail-steps {
  overflow: visible;
}
.detail-steps {
  overflow-y: auto;
}

.step-list {
  list-style: none;
  margin: 0;
  padding: 0.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.step-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.05s ease,
    box-shadow 0.15s ease;
}
.step-item::before {
  display: none;
}
.step-item:hover {
  border-color: rgba(0, 114, 136, 0.35);
  box-shadow: 0 4px 14px -8px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
}
.step-item:active { transform: translateY(0); }
.step-item.is-active {
  border-color: var(--primary);
  background: #cce3e8;
  box-shadow: 0 4px 14px -8px rgba(0, 114, 136, 0.4);
}
.step-item.is-active::before { opacity: 1; }

.step-item-number {
  flex: 0 0 auto;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    rgba(0, 114, 136, 0.16),
    rgba(14, 165, 233, 0.16)
  );
  color: var(--primary);
  font-weight: 700;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.02em;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.step-item:hover .step-item-number {
  transform: scale(1.05);
}
.step-item.is-active .step-item-number {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: 0 4px 12px -4px rgba(0, 114, 136, 0.5);
}
.step-item-header {
  flex: 1;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.step-item-new-dot {
  flex: 0 0 auto;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: #dc2626;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.subprocess-item .step-item-header {
  font-weight: 600;
}
.subprocess-item .step-item-chevron {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: transform 0.15s ease;
}
.subprocess-item.is-expanded .step-item-chevron {
  color: var(--primary);
}

.step-children {
  margin-top: 0.375rem;
  margin-left: 1.625rem;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}
.step-children .step-list {
  gap: 0.375rem;
}

.detail-screenshot-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
}
.detail-screenshot {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  padding: var(--space-5);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-height: 320px;
  flex: 1;
  overflow: hidden;
}
.screenshot-content {
  flex: 1;
  display: flex;
  min-width: 0;
  min-height: 0;
}
figure.screenshot {
  flex: 1;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  min-width: 0;
  gap: 0.625rem;
}
figure.screenshot img {
  max-width: 100%;
  max-height: 100%;
  height: auto;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: zoom-in;
}

/* Lightbox overlay for screenshot zoom (mobile-critical) */
.screenshot-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.92);
  padding: var(--space-4);
  cursor: zoom-out;
  animation: lightbox-fade-in 150ms var(--ease);
}
@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.screenshot-lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.5);
}
.screenshot-lightbox-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.screenshot-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.step-detail {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: left;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
}
.step-detail-head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.step-detail-footer {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
}
.step-detail-footer strong {
  color: var(--text);
  font-weight: 600;
}

.step-info-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.step-info-button:active { transform: scale(0.95); }
.step-info-button:hover,
.step-info-button:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  outline: none;
}

.step-info-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: 40rem;
  width: calc(100% - 2rem);
  box-shadow: 0 20px 50px -20px rgba(15, 23, 42, 0.4);
}
.step-info-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
}
.step-info-form {
  position: relative;
  margin: 0;
  padding: 1.5rem 1.75rem 1.5rem 1.5rem;
}
.step-info-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.step-info-close:hover {
  background: rgba(0, 114, 136, 0.08);
  color: var(--primary);
}
.step-info-body p {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.step-info-body p:last-child {
  margin-bottom: 0;
}
.step-info-body strong {
  color: var(--text);
  font-weight: 600;
}

.step-info-activity {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.step-info-activity-heading {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.step-info-activity-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.step-info-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.step-info-activity-item {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: var(--space-2) var(--space-3);
  align-items: baseline;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
.step-info-activity-target {
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.step-info-activity-action {
  display: inline-flex;
  align-items: center;
  height: 1.25rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.step-info-activity-action--create {
  background: var(--success-soft);
  color: #047857;
}
.step-info-activity-action--update {
  background: var(--primary-soft);
  color: var(--primary);
}
.step-info-activity-action--delete {
  background: var(--danger-soft);
  color: var(--danger);
}
.step-info-activity-who {
  color: var(--text);
  min-width: 0;
}
.step-info-activity-when {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
@media (max-width: 540px) {
  .step-info-activity-item {
    grid-template-columns: auto auto;
  }
  .step-info-activity-when {
    grid-column: 1 / -1;
  }
}
.step-detail-description {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  flex: 0 1 auto;
  min-width: 0;
}

.step-detail-description-wrap {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 0.625rem;
}
.step-detail-description-wrap.is-editing {
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  width: 100%;
  gap: 0.75rem;
}
.step-detail-description-wrap.is-empty {
  align-items: center;
  justify-content: flex-start;
}
.step-detail-description-wrap .link-action {
  flex: 0 0 auto;
}
.step-detail-description-wrap:not(.is-editing) .link-action[data-action="edit-description"] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.step-detail:hover .step-detail-description-wrap:not(.is-editing) .link-action[data-action="edit-description"],
.step-detail:focus-within .step-detail-description-wrap:not(.is-editing) .link-action[data-action="edit-description"] {
  opacity: 1;
  pointer-events: auto;
}

.step-description-input {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.step-description-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 114, 136, 0.15);
}
.step-description-input:disabled {
  opacity: 0.7;
}

.step-description-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
}
.step-description-actions .btn-secondary {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-contrast);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.step-description-actions .btn-secondary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.step-description-actions .btn-secondary:active {
  transform: translateY(1px);
}
.step-description-actions .btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.link-action {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
}
.link-action:hover {
  text-decoration: underline;
}
.link-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  text-decoration: none;
}

.screenshot-editor {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.detail-screenshot:hover .screenshot-editor,
.detail-screenshot:focus-within .screenshot-editor {
  opacity: 1;
  pointer-events: auto;
}
.screenshot-editor .btn-secondary {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 6px 16px -10px rgba(15, 23, 42, 0.45);
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.screenshot-editor .btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.screenshot-editor .btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.screenshot-overlay,
.screenshot-busy {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-weight: 600;
  z-index: 2;
}
.screenshot-overlay[hidden],
.screenshot-busy[hidden] {
  display: none;
}
.screenshot-overlay {
  background: rgba(0, 114, 136, 0.12);
  border: 2px dashed var(--primary);
  color: var(--primary);
}
.screenshot-busy {
  background: rgba(15, 23, 42, 0.4);
  color: #fff;
}
.screenshot {
  margin: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.screenshot img {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
}
.screenshot figcaption {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}
.screenshot-empty {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9375rem;
}
.screenshot-caption {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
}
.detail-empty {
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

@media (max-width: 900px) {
  .workbench {
    grid-template-columns: 1fr;
  }
  .detail-body {
    grid-template-columns: 1fr;
  }
}

/* Back button only visible on mobile when a process is active */
.detail-back {
  display: none;
}
@media (max-width: 720px) {
  /* Mobile master-detail: show either list or detail, never both */
  body:not(.has-active-process) .workbench-detail { display: none; }
  body.has-active-process .workbench-list { display: none; }
  body.has-active-process .detail-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    align-self: flex-start;
    min-height: 40px;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
    margin-bottom: var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    cursor: pointer;
  }
  body.has-active-process .detail-back:active {
    background: var(--surface-muted);
  }

  /* Compact mobile process-LIST layout — names get room, decoration shrinks */
  .workbench-list { padding: var(--space-3); }
  .process-list { gap: var(--space-2); }
  .process-item-row {
    gap: var(--space-1);
  }
  .process-item-favorite {
    min-width: 36px;
    min-height: 44px;
    width: 36px;
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--text-subtle);
    font-size: 1.5rem;
  }
  .process-item-favorite.is-favorite {
    border: 0;
    background: transparent;
  }
  .process-item {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "name chevron"
      "pills pills";
    gap: var(--space-1) var(--space-2);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
  }
  .process-item-name {
    grid-area: name;
    font-size: var(--fs-base);
    white-space: normal;
    line-height: var(--lh-snug);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .process-item-systems {
    grid-area: pills;
    justify-content: flex-start;
    gap: var(--space-1);
    flex-wrap: wrap;
  }
  .process-item-chevron {
    grid-area: chevron;
  }
  .process-item-systems .pill {
    height: 1.125rem;
    font-size: 0.625rem;
    padding: 0 var(--space-2);
  }
  .process-item-chevron {
    font-size: 1.5rem;
  }

  /* Compact mobile process-DETAIL layout */
  .workbench { padding: var(--space-3); gap: var(--space-3); }
  .workbench-detail { padding: var(--space-3); }
  .detail-inner { gap: var(--space-3); }
  .detail-title-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin: 0;
  }
  .detail-title {
    text-align: left;
    font-size: var(--fs-lg);
    line-height: var(--lh-snug);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .detail-header { margin-bottom: 0; gap: var(--space-2); }
  .detail-description { font-size: var(--fs-sm); line-height: var(--lh-snug); }

  /* Step list becomes a horizontal scroll strip — montøren ser alle trin på én linje */
  .detail-body {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  .detail-steps {
    overflow-x: auto;
    overflow-y: visible;
    flex: 0 0 auto;
    margin: 0 calc(var(--space-3) * -1);
    padding: var(--space-1) var(--space-3);
    scrollbar-width: none;
  }
  .detail-steps::-webkit-scrollbar { display: none; }
  .step-list {
    flex-direction: row;
    gap: var(--space-2);
    padding: 2px;
  }
  .step-list > li { flex: 0 0 auto; }
  .step-item {
    padding: var(--space-2) var(--space-3);
    min-width: 0;
    border-radius: var(--radius-full);
  }
  .step-item-header {
    font-size: var(--fs-sm);
    white-space: nowrap;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Screenshot dominates the remaining vertical space */
  .detail-screenshot-wrap { flex: 1; min-height: 0; }
  .detail-screenshot {
    padding: var(--space-3);
    min-height: 0;
  }
}

/* Mobile tweaks */
@media (max-width: 480px) {
  .auth-card {
    padding: 1.5rem 1.125rem;
    border-radius: var(--radius);
  }
  .auth-title { font-size: 1.375rem; }
}

/* Dark-mode helpers — token shifts handled centrally in :root rule above. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .field input { background: var(--surface-muted); }
}

/* Chat */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.chat {
  width: 100%;
  padding: 1.5rem;
  height: calc(100dvh - var(--nav-h) - var(--bottom-nav-h) - var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
@media (max-width: 720px) {
  .chat {
    padding: var(--space-3);
    gap: var(--space-3);
  }
  .chat-header {
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
  }
  .chat-header h1 { margin: 0; }
  .chat-subtitle { display: none; }
  .chat-clear {
    height: 2.25rem;
    padding: 0 var(--space-2);
  }
  .chat-empty {
    padding: var(--space-4) var(--space-2);
    gap: var(--space-3);
  }
  .chat-form {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    z-index: 5;
  }
}
.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}
.chat-header-text { min-width: 0; }
.chat-header h1 {
  margin: 0 0 var(--space-1);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.015em;
}
@media (max-width: 720px) {
  .chat-header h1 { font-size: var(--fs-xl); }
}
.chat-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.chat-clear {
  flex: 0 0 auto;
  height: 2rem;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}
.chat-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chat-empty {
  margin: auto;
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  max-width: 30rem;
}
.chat-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}
.chat-empty-icon .material-symbols-outlined {
  font-size: 32px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.chat-empty-title {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
.chat-empty-lede {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
.chat-empty-prompts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}
.chat-empty-prompt {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 52px;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease),
    transform 80ms var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}
.chat-empty-prompt:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-md);
}
.chat-empty-prompt:active { transform: scale(0.99); }
.chat-empty-prompt-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px !important;
}
.chat-empty-prompt-text {
  flex: 1;
  min-width: 0;
}
.chat-msg {
  display: flex;
}
.chat-msg-user { justify-content: flex-end; }
.chat-msg-assistant,
.chat-msg-error { justify-content: flex-start; }
.chat-bubble {
  max-width: 78%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-size: 0.975rem;
}
.chat-msg-user .chat-bubble { white-space: pre-wrap; }
.chat-bubble > *:first-child { margin-top: 0; }
.chat-bubble > *:last-child { margin-bottom: 0; }
.chat-bubble p { margin: 0.4em 0; }
.chat-bubble h1, .chat-bubble h2, .chat-bubble h3 {
  margin: 0.5em 0 0.3em;
  line-height: 1.25;
}
.chat-bubble h1 { font-size: 1.15rem; }
.chat-bubble h2 { font-size: 1.05rem; }
.chat-bubble h3 { font-size: 1rem; }
.chat-bubble ul, .chat-bubble ol {
  margin: 0.4em 0;
  padding-left: 1.4em;
}
.chat-bubble li { margin: 0.15em 0; }
.chat-bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.05em 0.35em;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 4px;
}
.chat-bubble pre {
  margin: 0.5em 0;
  padding: 0.6em 0.8em;
  background: rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.chat-bubble pre code {
  background: transparent;
  padding: 0;
  font-size: 0.875rem;
}
.chat-msg-user .chat-bubble code,
.chat-msg-user .chat-bubble pre {
  background: rgba(255, 255, 255, 0.18);
}
.chat-msg-user .chat-bubble {
  background: var(--primary);
  color: var(--primary-contrast);
}
.chat-msg-assistant .chat-bubble {
  background: var(--bg);
  border: 1px solid var(--border);
}
.chat-msg-error .chat-bubble {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}
.chat-process-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.4em 0;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.chat-process-btn:hover {
  background: var(--primary-hover);
  color: var(--primary-contrast);
  text-decoration: none;
}
.chat-link {
  color: var(--primary);
  text-decoration: underline;
}
.chat-thinking {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.chat-thinking > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chat-dot 1.2s infinite ease-in-out;
}
.chat-thinking > span:nth-child(2) { animation-delay: 0.15s; }
.chat-thinking > span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
/* Chat composer — input + send grouped as one element. */
.chat-form {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}
.chat-form:focus-within {
  border-color: var(--primary);
  box-shadow: var(--ring);
}
.chat-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  resize: none;
  min-height: 2.5rem;
  max-height: 12rem;
  padding: var(--space-2) var(--space-3);
  border: 0;
  background: transparent;
  color: var(--text);
}
.chat-input:focus,
.chat-input:focus-visible {
  outline: none;
  box-shadow: none;
}
.chat-input::placeholder {
  color: var(--text-subtle);
}
.chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 2.5rem;
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex: 0 0 auto;
}
.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.chat-send-icon {
  display: block;
}
@media (max-width: 540px) {
  .chat-send-label { display: none; }
  .chat-send { padding: 0 var(--space-3); }
}

/* Handbook */
.handbook {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  width: 100%;
  min-height: calc(100dvh - var(--nav-h) - var(--bottom-nav-h) - var(--safe-bottom));
  padding: 1.5rem;
}
.handbook-nav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  align-self: start;
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
  overflow: hidden;
}
.handbook-nav::before {
  content: "";
  display: block;
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 30%, transparent 100%);
}
.handbook-nav-title {
  margin: 0 0 0.75rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.handbook-section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.handbook-section-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.handbook-section-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.handbook-section-icon {
  flex: 0 0 auto;
  font-size: 20px;
  color: var(--text-muted);
}
.handbook-section-link.is-active .handbook-section-icon {
  color: var(--primary-contrast);
}
.handbook-card-icon {
  font-size: 36px !important;
  color: var(--primary);
  margin-bottom: var(--space-2);
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.handbook-section-link:hover {
  background: rgba(15, 23, 42, 0.05);
  text-decoration: none;
}
.handbook-section-link.is-active {
  background: var(--primary);
  color: var(--primary-contrast);
}
.handbook-section-count {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 var(--space-2);
  border-radius: var(--radius-full);
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
}
.handbook-section-link.is-active .handbook-section-count {
  background: rgba(255, 255, 255, 0.22);
  color: var(--primary-contrast);
}

.handbook-section-new-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
  vertical-align: middle;
}
.handbook-section-link.is-active .handbook-section-new-dot {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.28);
}
.handbook-card-title .handbook-section-new-dot {
  margin-left: 0.375rem;
}

.handbook-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.handbook-detail::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 30%, transparent 100%);
}
.handbook-detail-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}
.handbook-detail-title {
  margin: 0;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: -0.015em;
}
@media (max-width: 720px) {
  .handbook-detail-title { font-size: var(--fs-xl); }
}
.handbook-detail-lede {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-base);
}

.handbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}
.handbook-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.handbook-card:hover {
  border-color: var(--primary);
  text-decoration: none;
  box-shadow: 0 10px 28px -16px rgba(0, 114, 136, 0.55);
  transform: translateY(-2px);
}
.handbook-card:active { transform: translateY(0); }
.handbook-card-title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
}
.handbook-card-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
}
.handbook-card-count {
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--primary);
}

.handbook-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.handbook-search-input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.handbook-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 114, 136, 0.15);
}
.handbook-search-button {
  font: inherit;
  font-weight: 600;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-contrast);
  cursor: pointer;
  min-height: 44px;
}
.handbook-search-button:hover { background: var(--primary-hover); }

.handbook-live-results {
  position: relative;
  margin-top: calc(var(--space-2) * -1 + var(--space-1));
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2);
}
.handbook-live-results[data-state="loading"] {
  opacity: 0.7;
}
.handbook-live-heading {
  margin: var(--space-2) var(--space-3) var(--space-1);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.handbook-live-list {
  list-style: none;
  margin: 0 0 var(--space-2);
  padding: 0;
}
.handbook-live-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background-color var(--duration-fast) var(--ease);
}
.handbook-live-item:hover {
  background: var(--surface-muted);
  text-decoration: none;
}
.handbook-live-title {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
}
.handbook-live-section {
  font-size: var(--fs-xs);
  color: var(--primary);
  font-weight: var(--fw-medium);
}
.handbook-live-snippet {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}
.handbook-live-item mark {
  background: var(--primary-soft);
  color: var(--primary);
  padding: 0 2px;
  border-radius: 2px;
}
.handbook-live-empty {
  margin: 0;
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.handbook-results-heading {
  margin: 1.5rem 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.handbook-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.handbook-result {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
  row-gap: 0.25rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.handbook-result:hover {
  border-color: var(--primary);
  text-decoration: none;
  box-shadow: 0 6px 16px -12px rgba(0, 114, 136, 0.45);
}
.handbook-result-title {
  font-weight: 600;
  font-size: 1rem;
}
.handbook-result-section {
  align-self: start;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.07);
  color: var(--text-muted);
}
.handbook-result-snippet {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.handbook-articles {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.handbook-article {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-6);
  background: var(--surface);
  transition: border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}
.handbook-article:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.handbook-article:target {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
  scroll-margin-top: calc(var(--nav-h) + var(--space-4));
  animation: handbook-article-pulse 1.2s var(--ease) 1;
}
@keyframes handbook-article-pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 114, 136, 0.45); }
  60% { box-shadow: 0 0 0 12px rgba(0, 114, 136, 0); }
  100% { box-shadow: 0 0 0 4px var(--primary-soft); }
}
.handbook-article-title {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.01em;
  color: var(--text);
}
.handbook-article-body {
  line-height: var(--lh-relaxed);
  color: var(--text);
  font-size: var(--fs-base);
}
.handbook-article-body > *:first-child { margin-top: 0; }
.handbook-article-body > *:last-child { margin-bottom: 0; }
.handbook-article-body p {
  margin: 0 0 var(--space-3);
}
.handbook-article-body ul,
.handbook-article-body ol {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-6);
}
.handbook-article-body li { margin: var(--space-1) 0; }
.handbook-article-body li::marker { color: var(--text-muted); }
.handbook-article-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.handbook-article-body strong { font-weight: var(--fw-semibold); }
.handbook-article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.05em 0.35em;
  background: var(--surface-muted);
  border-radius: var(--radius-xs);
}

@media (max-width: 900px) {
  .handbook {
    grid-template-columns: 1fr;
  }
  .handbook-nav {
    position: static;
  }
}
.handbook-back { display: none; }

@media (max-width: 720px) {
  .handbook {
    padding: var(--space-3);
    grid-template-columns: 1fr;
  }
  /* On mobile the sidebar duplicates the card grid — hide it so cards become the primary nav. */
  .handbook-nav { display: none; }
  .handbook-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    align-self: flex-start;
    min-height: 40px;
    padding: var(--space-2) var(--space-3) var(--space-2) var(--space-2);
    margin-bottom: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    text-decoration: none;
  }
  .handbook-back:active {
    background: var(--surface-muted);
    text-decoration: none;
  }
  .handbook-detail {
    padding: var(--space-4);
  }
  .handbook-detail::before { display: none; }
  /* Cards fill the width on small phones */
  .handbook-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  .handbook-card {
    padding: var(--space-5);
  }
}

/* -------------------------------------------------------------------------
   Print button (in process detail title row)
   ------------------------------------------------------------------------- */
.print-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted, #888);
  text-decoration: none;
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}
.print-button:hover {
  background-color: rgba(0, 0, 0, 0.04);
  color: var(--primary);
  text-decoration: none;
}
.print-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.print-button .material-symbols-outlined {
  font-size: 1.5rem;
}

/* -------------------------------------------------------------------------
   Printable process page
   ------------------------------------------------------------------------- */
body.is-print {
  background: #fff;
  color: var(--text);
}
.process-print {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2.5rem 4rem;
  font-size: var(--fs-base);
  line-height: var(--lh-normal, 1.5);
}
.process-print-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.process-print-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  min-height: 2.25rem;
  background: var(--primary);
  color: var(--primary-contrast);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.process-print-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.process-print-btn--secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}
.process-print-btn--secondary:hover {
  background: var(--primary-soft);
  color: var(--primary-hover);
  border-color: var(--primary-hover);
}
.process-print-header {
  margin-bottom: 2rem;
}
.process-print-title {
  margin: 0 0 0.5rem;
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.015em;
  color: var(--text);
}
.process-print-meta {
  margin: 0.25rem 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.process-print-meta--date {
  margin-top: 0.75rem;
  color: var(--text-subtle);
  font-size: var(--fs-xs);
}
.process-print-description {
  margin: 0.75rem 0 0;
  font-size: var(--fs-md);
  color: var(--text);
}
.process-print-empty {
  color: var(--text-muted);
  font-style: italic;
}
.print-step-list {
  list-style: none;
  counter-reset: print-step;
  margin: 0;
  padding: 0;
}
.print-step-list .print-step-list {
  margin-top: 1rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
}
.print-step {
  counter-increment: print-step;
  margin: 0 0 1.5rem;
  padding: 0 0 0 3rem;
  position: relative;
  page-break-inside: avoid;
  break-inside: avoid;
}
.print-step::before {
  content: counter(print-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-contrast);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.print-step--process::before {
  background: var(--surface-muted);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.print-step-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2.2rem;
}
.print-step-header {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.print-step-description {
  margin: 0.5rem 0 0;
  font-size: var(--fs-base);
  color: var(--text);
  white-space: pre-wrap;
}
.print-step-figure {
  margin: 0.75rem 0 0;
  padding: 0;
  page-break-inside: avoid;
  break-inside: avoid;
}
.print-step-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.print-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border: 1px solid var(--border);
}
.print-pill-optional {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}

@media print {
  @page {
    margin: 18mm 16mm;
  }
  body.is-print {
    background: #fff !important;
  }
  .no-print {
    display: none !important;
  }
  .process-print {
    max-width: none;
    padding: 0;
  }
  .process-print-title {
    font-size: 22pt;
  }
  .process-print-header {
    margin-bottom: 1rem;
    page-break-after: avoid;
    break-after: avoid;
  }
  .print-step {
    margin-bottom: 1rem;
  }
  .print-step::before {
    background: #000 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-step--process::before {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
  .print-step-figure img {
    max-height: 14cm;
    object-fit: contain;
  }
  .print-pill,
  .print-pill-optional {
    border-color: #555 !important;
    color: #000 !important;
    background: #fff !important;
  }
  a,
  a:visited {
    color: inherit;
    text-decoration: none;
  }
}

