/* Lions NINE product styling, aligned with Morpheus Studio's Tailwind theme
   and static/css/input.css. Tokens are shared by all Trinity components. */
:root {
  color-scheme: light;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius-control: 8px;
  --radius-card: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 5%);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--gray-900);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.5; }
h1, h2, p { margin: 0; }
h1 { font-size: 24px; line-height: 32px; font-weight: 700; }
h2 { font-size: 18px; line-height: 28px; font-weight: 600; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-800); }
button, input { font: inherit; }
button { cursor: pointer; }
form { margin: 0; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; }
/* Hidden as a whole until focused: a full-page capture draws fixed elements at the scroll position, so moving it off screen is not enough (#24). */
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 20; background: white; padding: 8px 16px; border-radius: var(--radius-control); }
.skip-link:not(:focus) { width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: 0 0 auto; }
.muted { color: var(--gray-500); }
.app-body { display: flex; flex-direction: column; }
.app-header { background: white; border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); }
.header-inner { min-height: 64px; width: 100%; padding: 0 32px; display: flex; align-items: center; gap: 32px; }
.brand { font-size: 20px; line-height: 28px; font-weight: 700; color: var(--brand-600); flex: 0 0 auto; }
.main-nav { display: flex; flex: 1; gap: 16px; align-items: center; }
.main-nav a { padding: 8px 12px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--gray-600); border-radius: var(--radius-control); white-space: nowrap; }
.main-nav a:hover, .main-nav a[aria-current="page"] { color: var(--brand-600); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.language-switcher { display: flex; align-items: center; gap: 4px; font-size: 14px; white-space: nowrap; }
.language-switcher a { padding: 4px 8px; color: var(--gray-500); border-radius: 4px; }
.language-switcher a:hover, .language-switcher a[aria-current="true"] { color: var(--brand-600); }
.language-switcher a[aria-current="true"] { font-weight: 500; }
.language-divider { color: var(--gray-300); }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; border-radius: var(--radius-control); color: var(--gray-700); }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { color: var(--brand-600); }
.user-avatar { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600); flex: 0 0 auto; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.user-dropdown { position: absolute; right: 0; top: 40px; width: 240px; max-width: calc(100vw - 32px); background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-control); box-shadow: var(--shadow-lg); padding: 4px 0; z-index: 10; }
.user-dropdown-info { padding: 8px 16px; border-bottom: 1px solid var(--gray-100); overflow-wrap: anywhere; font-size: 14px; }
.user-dropdown-info .muted { font-size: 12px; }
.logout-button { width: 100%; text-align: left; border: 0; background: white; padding: 8px 16px; font-size: 14px; color: #dc2626; }
.logout-button:hover { background: #fef2f2; }
.app-main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 32px; min-width: 0; }
.page-heading { margin-bottom: 24px; }
.page-heading p { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.app-footer { margin-top: auto; padding: 16px 32px; border-top: 1px solid var(--gray-200); background: white; color: var(--gray-500); text-align: center; font-size: 14px; }
.card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--gray-200); }
.card-body { padding: 16px 24px; }
.badge-list { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 12px; line-height: 16px; font-weight: 500; }
.badge-neutral { background: var(--gray-100); color: var(--gray-800); }
.badge-brand { background: var(--brand-100); color: var(--brand-800); }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-partial { background: #fef2f2; color: #b91c1c; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; font-size: 14px; line-height: 20px; font-weight: 500; border: 1px solid transparent; border-radius: var(--radius-control); transition: background-color .2s, color .2s, border-color .2s; }
.btn-primary { color: white; background: var(--brand-600); }
.btn-primary:hover { color: white; background: var(--brand-700); }
.btn-secondary { color: var(--gray-700); background: white; border-color: var(--gray-300); }
.btn-secondary:hover { color: var(--gray-700); background: var(--gray-50); }
.page-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.table-card { border-radius: var(--radius-control); overflow: hidden; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th { padding: 8px 16px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); font-size: 12px; font-weight: 500; color: var(--gray-500); letter-spacing: .05em; }
td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-600); overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--gray-50); }
.cell-primary { font-weight: 600; color: var(--gray-900); }
.tenant-table td { height: 52px; }
.tenant-table .row-action { text-align: right; white-space: nowrap; }
.users-table { min-width: 600px; table-layout: fixed; }
.empty-state { padding: 32px 24px; text-align: center; color: var(--gray-500); font-size: 14px; }
.auth-body { display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: linear-gradient(135deg, var(--brand-50), white, #faf5ff); }
.auth-main { width: 100%; max-width: 448px; }
.auth-brand { text-align: center; margin-bottom: 32px; }
.auth-brand h1 { font-size: 30px; line-height: 36px; color: var(--brand-600); font-weight: 700; }
.auth-brand p { font-size: 14px; margin-top: 8px; color: var(--gray-500); }
.auth-card { background: white; padding: 32px; border: 1px solid var(--gray-100); border-radius: 16px; box-shadow: var(--shadow-lg); }
.auth-card h2 { font-size: 20px; line-height: 28px; color: var(--gray-800); margin-bottom: 24px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
.input { width: 100%; padding: 10px 16px; border: 1px solid var(--gray-300); border-radius: var(--radius-control); font-size: 14px; line-height: 20px; background: white; color: var(--gray-900); transition: border-color .2s, box-shadow .2s; }
.input::placeholder { color: var(--gray-400); }
.input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-500); }
.auth-submit { width: 100%; padding: 10px 16px; }
.auth-language { display: flex; justify-content: center; margin-top: 24px; }
.alert-error { padding: 12px; margin-bottom: 16px; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; border-radius: var(--radius-control); font-size: 14px; }
.error-state { display: flex; min-height: 60vh; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 16px; }
.error-code { font-size: 60px; line-height: 1; color: var(--brand-600); font-weight: 700; }
.error-state h1 { font-size: 20px; line-height: 28px; font-weight: 500; color: var(--gray-600); }
.error-state p:not(.error-code) { color: var(--gray-500); }
.error-state .btn { margin-top: 8px; }
@media (max-width: 1023px) {
  .header-inner { gap: 16px; padding-right: 24px; padding-left: 24px; }
  .main-nav { gap: 4px; }
  .main-nav a { padding-right: 8px; padding-left: 8px; }
  .user-name { display: none; }
  .app-main { padding-right: 24px; padding-left: 24px; }
}
@media (max-width: 767px) {
  .header-inner { flex-wrap: wrap; padding: 12px 16px; gap: 8px 16px; }
  .main-nav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .header-actions { gap: 8px; }
  .app-main { padding: 24px 16px; }
  .card-header, .card-body { padding: 16px; }
}
@media (max-width: 374px) {
  .auth-card { padding: 24px; }
  .header-inner { column-gap: 8px; }
  .language-switcher a { padding-right: 4px; padding-left: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* Business workflow: shared product tokens, no build step or external assets. */
[hidden] { display: none !important; }
.app-main > .card, .app-main > details, #run-progress > .card, #generation-progress > .card { margin-top: 20px; }
.header-inner { max-width: 1600px; flex-wrap: wrap; }
.main-nav { flex-wrap: wrap; }
.workflow-steps { list-style: decimal inside; display: flex; flex-wrap: wrap; gap: 12px; padding: 0; margin: 20px 0; font-size: 14px; color: var(--gray-500); }
.workflow-steps li { padding: 8px 12px; background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-control); }
.workflow-steps [aria-current] { color: var(--brand-700); background: var(--brand-50); border-color: var(--brand-500); }
.eyebrow { font-size: 12px; letter-spacing: .12em; color: var(--brand-600) !important; }
.summary-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 20px 0; font-size: 14px; }
.card-header { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.record-list { display: grid; }
.record-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--gray-100); overflow-wrap: anywhere; }
.record-row small { display: block; color: var(--gray-500); margin-top: 6px; }
.record-row:last-child { border-bottom: 0; }
.record-row .badge { flex-shrink: 0; }
.json-view { overflow: auto; max-height: 420px; padding: 16px; border-radius: var(--radius-control); background: var(--gray-50); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0; }
.code-input { font-family: ui-monospace, monospace; font-size: 13px; }
textarea { resize: vertical; }
label { font-size: 14px; }
.check-label { display: flex; align-items: baseline; gap: 10px; margin: 12px 0; }
input[type=checkbox] { accent-color: var(--brand-600); }
form > .btn, form > label + .btn { margin-top: 12px; }
form + form { margin-top: 16px; }
fieldset { border: 1px solid var(--gray-200); border-radius: var(--radius-control); }
.app-main details { margin-top: 16px; }
summary { cursor: pointer; font-size: 14px; font-weight: 500; }
.app-main details[open] > summary { margin-bottom: 12px; }
.notice-warning { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.notice, .form-feedback { margin: 12px 0; padding: 12px 16px; border: 1px solid var(--brand-100); border-radius: var(--radius-control); background: var(--brand-50); font-size: 14px; overflow-wrap: anywhere; }
.form-feedback[role=alert] { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
button:disabled { opacity: .6; cursor: wait; }
.tool-row { padding: 16px 0; border-bottom: 1px solid var(--gray-200); }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0; }
.meta-list dt { color: var(--gray-500); }
.meta-list dd { margin: 0; overflow-wrap: anywhere; }
@media(max-width: 600px) { .meta-list { grid-template-columns: 1fr; gap: 0; } .meta-list dd { margin-bottom: 8px; } }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin: 20px 0; }
.card-body > p { overflow-wrap: anywhere; }
@media(max-width: 1200px) { .main-nav { order: 3; flex-basis: 100%; } }
@media(max-width: 767px) { .record-row { flex-wrap: wrap; } }

.requirement-values { margin: 8px 0; }
.requirement-values > div { display: grid; grid-template-columns: minmax(100px, 1fr) 3fr; gap: 12px; padding: 6px 0; }
.requirement-values dt { color: var(--gray-500); font-size: 14px; overflow-wrap: anywhere; }
.requirement-values dd { margin: 0; overflow-wrap: anywhere; }

/* Area navigation and the unified workflow workspace. */
.app-layout { display: flex; flex: 1; width: 100%; min-width: 0; }
.header-inner { max-width: none; gap: 20px; }
.header-actions { margin-left: auto; align-items: center; }
.area-switcher { position: relative; margin: 0; }
.area-switcher summary { cursor: pointer; padding: 10px 4px; font-weight: 600; }
.area-switcher nav { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 210px; background: white; border: 1px solid var(--gray-200); box-shadow: 0 8px 24px #0001; border-radius: 8px; padding: 8px; }
.area-switcher a { display: block; padding: 12px; }
.tenant-label { color: var(--gray-600); font-size: 13px; overflow-wrap: anywhere; }
.sidebar { width: 220px; flex-shrink: 0; padding: 24px 16px; border-right: 1px solid var(--gray-200); background: white; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { padding: 12px; border-radius: 8px; color: var(--gray-600); }
.sidebar a[aria-current], .sidebar a:hover { background: var(--brand-50); color: var(--brand-600); }
.sidebar-menu > summary { display: none; }
.heading-actions { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.workflow-row { padding: 20px 0; border-bottom: 1px solid var(--gray-200); }
.workflow-row h2 { font-size: 18px; margin: 0 0 10px; }
.workflow-row p, .workflow-row h2 { overflow-wrap: anywhere; }
.row-actions { display: flex; align-items: baseline; flex-wrap: wrap; gap: 16px; }
.row-actions details { margin-top: 0; }
.row-actions details[open] { flex-basis: 100%; }
.workflow-panel { border-top: 3px solid var(--brand-500); margin-top: 32px; padding-top: 24px; scroll-margin-top: 24px; }
.workflow-panel > .card { margin-top: 20px; }
.overview-links { display: grid; gap: 20px; }
.filters { flex-wrap: wrap; }
@media (max-width: 800px) {
  .app-layout { display: block; }
  .sidebar { width: 100%; border-right: 0; padding: 8px 16px; border-bottom: 1px solid var(--gray-200); }
  .sidebar-menu > summary { display: list-item; cursor: pointer; padding: 8px; }
  .tenant-label { flex-basis: 100%; order: 3; }
  .header-inner { gap: 8px 12px; }
  .heading-actions { flex-wrap: wrap; }
  .header-actions { flex-wrap: wrap; }
}

/* Workflow layouts share the product theme and application shell with run history. */
.area-switcher summary { display: flex; align-items: center; gap: 8px; list-style: none; }
.area-switcher summary::-webkit-details-marker { display: none; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.workflow-attention { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; margin-bottom: 20px; background: #fdf1ef; border: 1px solid #f2c9c2; border-radius: 10px; font-size: 13px; color: #8f1d14; }
.workflow-attention > span { flex: 1; }
.workflow-attention .btn { color: #8f1d14; border-color: #e3b3aa; font-size: 13px; flex-shrink: 0; }
.workflow-filters { margin-bottom: 20px; }
.workflow-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.workflow-search { flex: 0 1 250px; min-width: 180px; }
.workflow-search-input { position: relative; }
.workflow-search-input > .icon { position: absolute; top: 12px; left: 12px; color: var(--gray-500); pointer-events: none; }
.workflow-search-input .input { padding: 9px 32px 9px 36px; font-size: 13px; height: 40px; }
.workflow-search-submit { position: absolute; right: 2px; top: 2px; border: 0; border-radius: 6px; width: 28px; height: 36px; background: transparent; color: var(--gray-500); }
.workflow-search-submit .icon { transform: rotate(-90deg); }
.workflow-search-submit:hover { background: var(--gray-100); }
.workflow-sort { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.workflow-sort label { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.workflow-sort { flex-wrap: wrap; gap: 12px; }
.workflow-sort-field { display: flex; align-items: center; gap: 6px; }
.workflow-sort .input { padding: 7px 9px; width: auto; font-size: 13px; height: 36px; }
.workflow-filter-apply { min-height: 36px; padding: 6px 14px; font-size: 13px; }
.workflow-status-filters { border: 0; padding: 0; margin: 0; min-width: 0; flex: 1 1 480px; }
.workflow-status-options { display: flex; flex-wrap: wrap; gap: 6px; }
.workflow-status-option { position: relative; cursor: pointer; }
.workflow-status-option > input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.workflow-status-option > span { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: 999px; font-size: 12px; color: var(--gray-600); background: white; }
.workflow-status-option > input:checked + span { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-800); }
.workflow-status-option > input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 3px; }
.workflow-status-option:hover > span { border-color: var(--gray-400); }
.workflow-status-count { font-family: ui-monospace, monospace; font-size: 11px; opacity: .8; }
.workflow-screen .workflow-extra-filters { margin-top: 12px; display: inline-block; vertical-align: top; }
.workflow-extra-filters > summary { display: flex; align-items: center; gap: 7px; list-style: none; color: var(--gray-500); font-size: 12px; }
.workflow-extra-filters > summary::-webkit-details-marker { display: none; }
.workflow-extra-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.workflow-filter-field { min-width: 140px; }
.workflow-filter-field label { display: block; color: var(--gray-500); font-size: 12px; margin-bottom: 6px; }
.workflow-filter-field .input { padding: 8px 10px; font-size: 13px; }
.workflow-filter-hint { font-size: 11px; color: var(--gray-500); margin-top: 10px; }
.filter-reset { display: inline-block; padding: 10px 0; font-size: 12px; margin-left: 12px; }
.workflow-table { table-layout: fixed; }
.workflow-table th:first-child { border-top-left-radius: 12px; }
.workflow-table th:nth-child(2) { width: 250px; }
.workflow-table th:last-child { width: 320px; text-align: right; border-top-right-radius: 12px; }
.workflow-screen:lang(en) .workflow-table th:last-child { width: 360px; }
.workflow-total { font-size: 11px; margin-left: 8px; }
.workflow-table td { padding: 20px 16px; vertical-align: top; }
.workflow-table .workflow-row { border: 0; }
.workflow-row:hover { background: var(--gray-50); }
.workflow-row:last-child td:first-child { border-bottom-left-radius: 12px; }
.workflow-row:last-child td:last-child { border-bottom-right-radius: 12px; }
.workflow-identity { display: flex; gap: 12px; }
.workflow-symbol { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 8px; background: var(--brand-50); color: var(--brand-600); }
.workflow-symbol .icon { width: 18px; height: 18px; }
.workflow-copy { min-width: 0; }
.workflow-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 32px; }
.workflow-title h2 { margin: 0; font-size: 15px; line-height: 24px; font-weight: 600; }
.workflow-title a:hover { text-decoration: underline; }
.workflow-description { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--gray-600); }
.workflow-error-hint { display: flex; align-items: start; gap: 6px; font-size: 12px; color: #b42318; margin-top: 6px; }
.workflow-error-hint .icon { margin-top: 2px; width: 14px; height: 14px; }
.workflow-io-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.workflow-io-tags > span { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 8px; background: var(--gray-100); border-radius: 6px; color: var(--gray-600); font-size: 12px; }
.workflow-table .workflow-specs { margin-top: 8px; font-size: 12px; color: var(--gray-500); }
.workflow-specs summary { font-size: 11px; font-weight: 400; color: var(--gray-500); }
.workflow-specs[open] > summary { margin-bottom: 6px; }
.workflow-created { margin-top: 6px; font-size: 11px; font-variant-numeric: tabular-nums; }
.workflow-latest-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 4px; }
.result-badge { gap: 5px; }
.result-badge .icon { width: 14px; height: 14px; }
.result-succeeded { background: #dcfce7; color: #166534; }
.result-failed, .result-rejected { background: #fee2e2; color: #991b1b; }
.result-in_progress { background: #fff3dc; color: #8a5700; }
.result-partial { background: #fff3dc; color: #7a4300; }
.result-never { background: var(--gray-100); color: var(--gray-800); }
.workflow-time { font-size: 12px; color: var(--gray-500); }
.workflow-result-link { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; margin-top: 8px; }
.workflow-result-link .icon { width: 13px; height: 13px; }
/* OO: a run's output and result open from small buttons wherever runs are listed. */
.btn-compact { min-height: 32px; padding: 5px 10px; gap: 6px; font-size: 13px; white-space: nowrap; }
.btn-compact .icon { width: 15px; height: 15px; }
.run-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
/* The run history keeps readable columns; narrow screens scroll the table itself. */
.run-history-table { min-width: 680px; }
.workflow-action-buttons { display: flex; justify-content: flex-end; align-items: start; gap: 8px; }
.workflow-action-buttons > .btn { min-height: 40px; padding: 8px 12px; white-space: nowrap; }
.workflow-screen .workflow-more { position: relative; margin: 0; }
.workflow-more > summary { list-style: none; }
.workflow-more > summary::-webkit-details-marker { display: none; }
.workflow-screen .workflow-more[open] > summary { margin-bottom: 0; }
.icon-button { padding: 0; width: 40px; height: 40px; flex: 0 0 40px; }
.workflow-more-menu { position: absolute; top: 46px; right: 0; z-index: 20; width: 184px; background: white; border: 1px solid var(--gray-200); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgb(28 27 34 / 14%); }
.workflow-more-menu > a, .workflow-more-menu > button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; background: transparent; border: 0; border-radius: 6px; text-align: left; font-size: 13px; color: var(--gray-900); }
.workflow-more-menu > :hover { background: var(--gray-100); }
.workflow-more.is-up .workflow-more-menu { top: auto; bottom: 46px; }
.workflow-more-menu > .workflow-delete-trigger { color: #b42318; border-top: 1px solid var(--gray-100); border-radius: 0 0 6px 6px; }
.workflow-progress { margin-top: 8px; height: 4px; max-width: 180px; overflow: hidden; background: #f3e4c7; border-radius: 2px; }
.workflow-progress > span { display: block; width: 40%; height: 100%; background: #b06a00; animation: trinity-progress 1.4s ease-in-out infinite; }
.spin { animation: trinity-spin .9s linear infinite; transform-origin: 50% 50%; }
@keyframes trinity-spin { to { transform: rotate(360deg); } }
@keyframes trinity-progress { from { transform: translateX(-100%); } to { transform: translateX(350%); } }
.mobile-column-label { display: none; }
.workflow-empty { padding: 56px 24px; text-align: center; }
.workflow-empty > .icon { width: 32px; height: 32px; color: var(--gray-500); margin-bottom: 12px; }
.workflow-empty h2 { font-size: 16px; }
.workflow-empty p { font-size: 14px; color: var(--gray-500); margin: 8px 0 20px; }
.workflow-toast { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 16px; margin-bottom: 20px; border: 1px solid #b7ddc2; background: #e8f5ec; border-radius: 10px; font-size: 13px; color: #237a40; }
.workflow-toast a { margin-left: auto; text-decoration: underline; }
.workflow-toast[role=alert] { background: #fdf1ef; border-color: #f2c9c2; color: #8f1d14; }
/* LR (docs/workflow-list-run-ui.md): the run is confirmed in a small dialog in the middle. */
.workflow-run-drawer { width: 440px; max-width: calc(100% - 32px); max-height: calc(100dvh - 32px); margin: auto; padding: 0; border: 1px solid var(--gray-200); border-radius: 12px; background: white; color: var(--gray-900); }
.workflow-run-drawer[open] { display: flex; flex-direction: column; }
.run-confirm-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 24px 0; }
.run-confirm-heading h2 { flex: 1; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.run-confirm-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-50); color: var(--brand-600); }
/* Content height, not a zero basis: Safari shrank the body to its padding and cut the text. */
.workflow-run-drawer .drawer-content { flex: 0 1 auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 24px; }
.workflow-run-drawer .drawer-content > * { margin: 0; }
.workflow-run-drawer .drawer-footer { border-top: 0; padding: 0 24px 24px; }
.run-confirm-connection { color: var(--gray-600); }
.workflow-screen dialog::backdrop { background: rgb(28 27 34 / 32%); }
body:has(dialog[open]) { overflow: hidden; }
.drawer-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 24px 24px 20px; border-bottom: 1px solid var(--gray-100); }
.drawer-heading p { color: var(--gray-500); font-size: 12px; margin-bottom: 4px; }
.drawer-heading h2 { font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.drawer-heading .icon-button { border: 0; color: var(--gray-600); background: transparent; }
.drawer-heading .icon-button:hover { background: var(--gray-100); }
.drawer-content { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; overflow-wrap: anywhere; font-size: 13px; }
.drawer-content .form-field label { display: block; font-size: 13px; font-weight: 500; }
.drawer-content .form-field .muted { display: block; font-size: 11px; font-weight: 400; }
.drawer-content .input { display: block; margin-top: 6px; font-size: 13px; padding: 10px 12px; }
.drawer-content .form-field { margin-bottom: 20px; }
.drawer-content form > .muted { font-size: 12px; }
.drawer-reference { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 20px; }
.drawer-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--gray-100); }
.drawer-footer .btn { min-height: 44px; }
.workflow-delete-dialog { width: 440px; max-width: calc(100% - 32px); border: 1px solid var(--gray-200); border-radius: 12px; padding: 0; color: var(--gray-900); }
.delete-confirmation { padding: 24px; font-size: 13px; }
.delete-confirmation > p { margin-bottom: 12px; }
.delete-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn-danger { background: #b42318; color: white; }
.btn-danger:hover { background: #8f1d14; color: white; }
@media (max-width: 1250px) {
  .workflow-status-filters { order: 3; flex-basis: 100%; }
  .workflow-table th:nth-child(2) { width: 210px; }
  .workflow-table th:last-child { width: 320px; }
  .workflow-screen:lang(en) .workflow-table th:last-child { width: 360px; }
  .workflow-table td, .workflow-table th { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 1000px) {
  .workflow-table, .workflow-table tbody { display: block; }
  .workflow-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .workflow-table .workflow-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 20px; gap: 16px; border-top: 1px solid var(--gray-100); }
  .workflow-table .workflow-row:first-child { border-top: 0; }
  .workflow-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .workflow-info { grid-column: 1 / -1; }
  .mobile-column-label { display: block; font-size: 11px; color: var(--gray-500); margin-bottom: 8px; }
  .workflow-actions .mobile-column-label { text-align: right; }
}
@media (max-width: 480px) {
  .workflow-search { flex-basis: 100%; }
  .workflow-status-filters { order: 2; }
  .workflow-sort { order: 3; margin-left: 0; }
  .workflow-attention { flex-wrap: wrap; align-items: start; }
  .workflow-attention .btn { margin-left: 26px; }
  .workflow-table .workflow-row { padding: 16px; grid-template-columns: minmax(0, 1fr); }
  .workflow-actions .mobile-column-label { text-align: left; }
  .workflow-action-buttons { justify-content: flex-start; border-top: 1px solid var(--gray-100); padding-top: 12px; }
  .workflow-more-menu { right: 0; transform: translateX(16px); max-width: calc(100vw - 64px); }
  .workflow-extra-fields { gap: 10px; }
  .workflow-filter-field { min-width: 0; flex: 1 1 120px; }
  .drawer-heading, .drawer-content, .drawer-footer { padding: 16px; }
  .run-confirm-heading { padding: 16px 16px 0; }
  .workflow-run-drawer .drawer-content { padding: 12px 16px; }
  .workflow-run-drawer .drawer-footer { padding: 0 16px 16px; }
}
@media (prefers-reduced-motion: reduce) { .workflow-progress > span, .spin { animation: none; } }

/* Separate creation lifecycle from execution results. */
.workflow-tabs { display: flex; flex-wrap: wrap; gap: 24px; border-bottom: 1px solid var(--gray-200); margin-bottom: 20px; }
.workflow-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 0 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--gray-500); font-size: 14px; }
.workflow-tabs a[aria-current] { border-bottom-color: var(--brand-600); color: var(--brand-600); font-weight: 600; }
.workflow-tabs span { padding: 0 7px; background: var(--gray-100); border-radius: 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
.draft-intro { margin: 0 0 16px; color: var(--gray-500); font-size: 13px; }
.draft-filters .workflow-sort { margin-left: 0; }
.creation-failure-hint { font-size: 12px; margin-top: 8px; line-height: 1.6; color: #8f1d14; }
.draft-list .workflow-table th:last-child { width: 230px; }
.workflow-more-menu button:disabled { cursor: not-allowed; }
@media (max-width: 480px) {
  .draft-list .workflow-action-buttons { flex-wrap: wrap; }
  .draft-list .workflow-more-menu { right: 0; transform: none; }
}

.creation-badge { gap: 5px; padding: 4px 8px; font-size: 12px; line-height: 16px; font-weight: 600; background: var(--gray-100); color: var(--gray-500); }
.creation-badge .icon { width: 14px; height: 14px; }
.creation-badge.creation_failed { background: #fdebea; color: #b42318; }
.creation-badge.creation_running { background: #fff3dc; color: #8a5700; }

.workflow-screen:lang(en) .draft-list .workflow-table th:last-child { width: 260px; }

/* Workflow detail: the supplied design reference, using the existing application shell. */
.workflow-detail { display: flex; flex-direction: column; gap: 24px; }
.workflow-detail h3 { margin: 0; font-size: 14px; }
.detail-heading { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 20px 32px; }
.detail-heading-copy { flex: 1 1 560px; min-width: 0; }
.detail-breadcrumb { display: flex; gap: 8px; font-size: 13px; color: var(--gray-500); margin-bottom: 10px; overflow-wrap: anywhere; }
.detail-title { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.detail-title h1 { overflow-wrap: anywhere; }
.detail-title .badge { padding: 4px 10px; }
/* #106: the owner's rename form takes the title's place; buttons wrap under the input on phones. */
.detail-rename-open { color: var(--gray-500); }
.detail-rename { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.detail-rename input { flex: 1 1 320px; min-width: 0; font-size: 20px; font-weight: 600; }
.detail-rename-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-rename .form-feedback { flex-basis: 100%; }
.detail-draft { background: #fdf1dc; color: #7a4700; }
.detail-description { font-size: 15px; line-height: 1.7; color: var(--gray-600); margin-top: 10px; overflow-wrap: anywhere; }
.detail-metadata { position: relative; display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; font-size: 12px; color: var(--gray-500); }
.detail-id { display: flex; align-items: center; gap: 6px; min-width: 0; }
.detail-id code { background: var(--gray-100); padding: 2px 6px; border-radius: 4px; overflow-wrap: anywhere; }
/* The lists open under the whole line, so they never run past a narrow screen's edge. */
.app-main .detail-menu { margin-top: 0; min-width: 0; }
.detail-menu summary { font-size: inherit; font-weight: inherit; color: var(--gray-600); }
.app-main .detail-menu[open] > summary { margin-bottom: 0; }
.detail-menu nav { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; width: min(360px, 100%); max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; background: white; border: 1px solid var(--gray-200); border-radius: 10px; box-shadow: var(--shadow-sm); padding: 6px; }
.detail-menu nav a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 6px; color: var(--gray-600); }
.detail-menu nav a:hover { background: var(--gray-50); }
.detail-menu nav a[aria-current] { background: var(--brand-50); color: var(--brand-600); }
.detail-copy { display: inline-flex; align-items: center; justify-content: center; padding: 6px; border: 0; background: transparent; color: var(--gray-500); }
.detail-lifecycle { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; padding: 20px 28px; margin: 0; background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); list-style: none; }
.detail-lifecycle li { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 14px; }
.lifecycle-number { width: 30px; height: 30px; flex: 0 0 30px; border: 1px solid var(--gray-300); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--gray-500); }
.detail-lifecycle li > div { display: flex; flex-direction: column; gap: 2px; }
.detail-lifecycle li > div > span { font-size: 12px; color: var(--gray-500); }
.detail-lifecycle li > div > .lifecycle-note { color: var(--gray-700); }
.detail-lifecycle .is-done .lifecycle-number { background: #1f7a4d; color: white; border-color: #1f7a4d; }
.detail-lifecycle .is-current .lifecycle-number { background: var(--brand-600); color: white; border-color: var(--brand-600); box-shadow: 0 0 0 4px var(--brand-100); }
.detail-lifecycle .is-current strong { color: var(--brand-600); }
.detail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); }
.detail-tabs a { flex-shrink: 0; padding: 12px 20px; font-size: 14px; color: var(--gray-500); border-bottom: 3px solid transparent; }
.detail-tabs a:last-child { flex-shrink: 1; min-width: 0; }
.detail-tabs a[aria-current] { color: var(--brand-600); border-bottom-color: var(--brand-600); font-weight: 700; }
/* WD §7: the run card heads the right column; on one column it comes first, the settings last. */
.detail-grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(300px,1fr); grid-template-rows: auto 1fr; grid-template-areas: "main run" "main side"; gap: 24px; align-items: start; }
.detail-run { grid-area: run; }
.detail-main { grid-area: main; }
.detail-side { grid-area: side; }
.detail-stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.detail-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); padding: 24px; min-width: 0; display: flex; flex-direction: column; gap: 16px; overflow-wrap: anywhere; }
.detail-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.detail-section-heading > :not(h2) { font-size: 12px; }
.detail-flow-heading { align-items: flex-start; }
.detail-flow-heading > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.detail-flow-heading .detail-flow-meta { margin-top: 0; font-size: 12px; font-weight: 400; }
.detail-edit-form { display: flex; flex-direction: column; gap: 4px; }
.detail-edit-form [data-feedback]:empty { display: none; }
.detail-history th { padding: 10px 6px; }
.detail-history td { padding: 14px 6px; font-size: 12px; }
.detail-history td:first-child { min-width: 125px; }
.detail-history td:last-child a { display: inline-flex; gap: 4px; align-items: center; }
.detail-history .badge { white-space: nowrap; }
.detail-execute > form, .side-sharing form { display: flex; flex-direction: column; gap: 12px; }
.detail-execute label, .detail-execute p, .side-sharing p { font-size: 13px; }
.detail-execute .form-field { margin-bottom: 0; }
.detail-execute .btn-primary { width: 100%; }
.detail-execute .notice { margin: 0; }
.scope-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); background: var(--gray-100); border: 0; border-radius: 10px; padding: 4px; gap: 4px; margin: 0; min-width: 0; }
.scope-options label { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.scope-options label:has(input:checked) { background: white; color: var(--brand-600); box-shadow: 0 1px 3px rgb(0 0 0 / 8%); font-weight: 600; }
.scope-options input { accent-color: var(--brand-600); margin: 0; }
/* RP: the right column (docs/workflow-detail-side-ui.md). */
.side-facts { display: flex; flex-direction: column; gap: 12px; margin: 0; font-size: 13px; }
.side-facts > div { display: grid; grid-template-columns: minmax(80px, auto) minmax(0, 1fr); gap: 12px; }
.side-facts dt { color: var(--gray-500); }
.side-facts dd { margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.side-connection { display: flex; flex-direction: column; }
.side-connection small { font-size: 12px; color: var(--gray-500); }
.side-version { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.side-version select, .detail-execute select { text-overflow: ellipsis; }
/* WD §5–§6: the settings card's sharing, and the quieter stop card. */
.side-share-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.side-sharing small { font-size: 12px; color: var(--gray-500); }
.side-share-change > summary { display: inline-flex; align-items: center; min-height: 44px; list-style: none; cursor: pointer; color: var(--brand-600); font-weight: 600; }
.side-share-change > summary::-webkit-details-marker { display: none; }
.side-share-change[open] { display: flex; flex-direction: column; gap: 12px; }
/* Open, the scope choice and the checklist take the card's whole width. */
.side-facts > .side-sharing:has(details[open]) { grid-template-columns: minmax(0, 1fr); }
.side-stop { background: transparent; box-shadow: none; padding: 20px 24px; }
.side-stop h2 { font-size: 14px; line-height: 20px; color: var(--gray-700); }
.side-stop-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; }
.side-stop-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.side-stop-row strong { font-size: 14px; font-weight: 500; }
.side-stop-row p { margin: 0; font-size: 13px; color: var(--gray-600); }
.side-stop-row form { display: flex; flex-direction: column; gap: 4px; }
.side-stop-row:has(details[open]) { grid-template-columns: minmax(0,1fr); }
.side-window { border: 1px solid var(--brand-100); background: var(--brand-50); border-radius: var(--radius-control); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.side-window p { margin: 0; color: var(--gray-700); }
.side-window strong { font-size: 14px; color: var(--gray-900); }
.detail-execute > form .btn-primary { gap: 8px; }
.side-scope-action { display: none; flex-direction: column; gap: 12px; }
.side-scope-action p { margin: 0; }
.side-scope:has(input[value="tenant_shared"]:checked:not([data-saved])) [data-scope-action="tenant_shared"],
.side-scope:has(input[value="private"]:checked:not([data-saved])) [data-scope-action="private"] { display: flex; }
.side-scope-action .btn-primary { width: 100%; }
.side-note { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-control); padding: 12px 14px; color: var(--gray-700); }
.side-buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.side-buttons .btn-primary { width: auto; }
.scope-options .icon { width: 14px; height: 14px; }
.scope-options label:has(input:disabled) { cursor: not-allowed; color: var(--gray-500); }
.side-checklist { border-top: 1px solid var(--gray-100); padding-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.side-checklist-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.side-checklist-heading h3 { margin: 0; font-size: 14px; }
.side-checklist-heading span { font-size: 12px; }
.side-checklist ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.side-checklist li { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-control); font-size: 13px; }
.side-checklist li > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; align-items: flex-start; }
.side-checklist li p { margin: 0; color: var(--gray-700); }
.side-checklist li.is-current { border-color: var(--brand-100); background: var(--brand-50); }
.side-check { width: 20px; height: 20px; flex: 0 0 20px; border: 1.5px solid var(--gray-300); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.side-checklist .is-done .side-check { border: 0; color: #166534; }
.side-checklist .is-done .side-check .icon { width: 20px; height: 20px; }
.side-checklist .is-done strong { color: var(--gray-500); }
.side-invalidate p { margin: 0; font-size: 13px; color: var(--gray-700); }
.side-invalidate details { display: flex; flex-direction: column; gap: 8px; }
.side-invalidate summary { list-style: none; cursor: pointer; align-self: flex-start; }
.side-invalidate summary::-webkit-details-marker { display: none; }
.side-danger-outline { color: #b42318; background: white; border-color: #fecaca; }
.side-danger-outline:hover { color: #8f1d14; background: #fef2f2; }
.side-invalidate form { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.side-invalidate .check-label { margin: 4px 0; }
/* WD §4: the run card. */
.detail-run { border-color: var(--brand-100); }
.detail-run .detail-section-heading { align-items: center; }
.detail-run .badge { gap: 4px; }
.detail-run .badge .icon { width: 12px; height: 12px; }
.detail-run > .btn { width: 100%; }
.run-next, .run-period, .run-schedules, .run-stopped { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.run-next a { align-self: flex-start; margin-top: 8px; font-weight: 600; }
.run-big { font-size: 22px; line-height: 30px; font-weight: 700; color: var(--gray-900); }
.run-period strong, .run-schedules strong { font-size: 15px; color: var(--gray-900); }
.run-period strong.run-big { font-size: 22px; }
.run-promotion-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.run-stopped strong { font-size: 17px; color: var(--gray-900); }
.run-stopped p { color: var(--gray-700); font-size: 14px; }
.run-divider { width: 100%; margin: 0; border: 0; border-top: 1px solid var(--gray-100); }
.run-schedules-row { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.run-schedules-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.run-version-note { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 13px; }
.run-version-note a { font-weight: 600; }
.run-reason { font-size: 13px; color: var(--gray-700); }
.run-resume { display: flex; flex-direction: column; gap: 4px; }
.run-resume [data-feedback]:empty, .side-stop-row [data-feedback]:empty { display: none; }
/* RN: a run started on the detail, followed in place (docs/run-now-ui.md). */
.run-now-buttons { display: flex; flex-direction: column; gap: 8px; }
.run-now-buttons .btn { width: 100%; }
.run-now-status p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 13px; }
[data-run-now-busy], [data-run-now-busy]:hover { opacity: .75; cursor: wait; background: var(--brand-600); }
/* ST: the stopped notice and the schedules tab (docs/schedules-tab-ui.md). */
.workflow-detail > .detail-stopped { margin: 0; }
/* .notice is declared after .notice-warning, so the warning colours need the pair here. */
.notice.detail-stopped, .notice.run-version-note { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.detail-tab-count { margin-left: 6px; }
.schedules-top { position: relative; display: flex; flex-direction: column; gap: 16px; }
/* Room for "Add schedule", which sits at the heading's right. */
.schedules-intro { display: flex; flex-direction: column; gap: 4px; padding-right: 10rem; }
.schedules-intro p { font-size: 13px; }
.app-main .schedule-add { margin-top: 0; }
.schedule-add > summary { position: absolute; top: 0; right: 0; list-style: none; }
.schedule-add > summary::-webkit-details-marker { display: none; }
.schedule-add[open] > summary { background: var(--gray-100); }
.schedule-add-body { display: flex; flex-direction: column; gap: 16px; padding: 20px; border: 1px solid var(--gray-200); border-radius: var(--radius-control); background: var(--gray-50); }
.schedule-add-body h3, .schedule-card h3 { margin: 0; font-size: 16px; }
.schedule-form { display: flex; flex-direction: column; gap: 16px; }
.schedule-when { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; }
.schedule-when label { display: flex; flex-direction: column; gap: 4px; flex: 1 1 140px; min-width: 0; font-size: 13px; color: var(--gray-700); }
.schedule-when label[hidden] { display: none; }
.schedule-zone { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--gray-700); }
.schedule-zone span + span { padding: 10px 0; color: var(--gray-900); }
.schedule-preview { font-size: 14px; color: var(--gray-700); }
.schedule-preview:empty { display: none; }
.schedule-inputs { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.schedule-inputs legend { padding: 0; margin-bottom: 8px; font-size: 13px; color: var(--gray-500); }
.schedule-inputs .form-field { margin-bottom: 0; }
.schedule-form .notice { margin: 0; }
.schedule-form details { margin-top: 0; }
.schedule-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; margin: 0; font-size: 13px; }
.schedule-facts dt { margin-bottom: 4px; color: var(--gray-500); }
.schedule-facts dd { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.schedule-facts strong { font-size: 15px; }
.schedule-facts time { font-size: 12px; }
.schedule-version select { max-width: 200px; }
.schedule-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.schedule-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.schedule-card-top p { font-size: 12px; }
.schedule-state { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; font-size: 13px; }
.schedule-state form { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.schedule-state .form-feedback { margin: 0; padding: 4px 8px; font-size: 12px; }
.schedule-switch { position: relative; flex-shrink: 0; width: 40px; height: 24px; padding: 0; border: 0; border-radius: 9999px; background: var(--gray-300); transition: background-color .2s; }
.schedule-switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: var(--shadow-sm); transition: transform .2s; }
.schedule-switch[aria-checked="true"] { background: var(--brand-600); }
.schedule-switch[aria-checked="true"] span { transform: translateX(16px); }
.schedule-switch:disabled { cursor: not-allowed; }
.schedule-history { display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--gray-100); font-size: 12px; color: var(--gray-600); }
.schedule-policy { display: flex; flex-direction: column; gap: 4px; margin: 0; padding-left: 18px; font-size: 12px; }
@media (max-width: 760px) {
  .schedule-facts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .schedules-intro { padding-right: 0; }
  .schedule-add > summary { position: static; width: 100%; }
  .schedule-add-body { padding: 16px; }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 1200px) {
  .detail-grid { grid-template-columns: minmax(0,1fr); grid-template-rows: none; grid-template-areas: "run" "main" "side"; }
  .detail-grid > aside { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
  .detail-grid > aside:has(> :only-child) { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 760px) {
  .detail-lifecycle { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 20px; gap: 20px 12px; }
  .detail-lifecycle li { font-size: 12px; gap: 8px; }
  .detail-grid > aside { grid-template-columns: minmax(0,1fr); }
  .detail-tabs a { padding: 10px 12px; }
  .detail-card { padding: 20px; }
}
@media (max-width: 480px) {
  .detail-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-tabs a { padding: 10px 8px; font-size: 13px; overflow-wrap: anywhere; }
}

.detail-history-filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.detail-history-filters label { font-size: 12px; min-width: 140px; flex: 1; }
.detail-history table { min-width: 560px; }
.detail-history th { white-space: nowrap; }

.workflow-edit-page { max-width: 1000px; margin-inline: auto; }
.workflow-edit-page > .card { margin-top: 20px; }

/* Run result (RR): summary card, then the flow beside this run's conditions, then technical details. */
.run-breadcrumb { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 16px; font-size: 14px; }
.run-breadcrumb .detail-breadcrumb { flex-wrap: wrap; margin-bottom: 0; min-width: 0; }
#run-progress > .run-summary { margin-top: 0; }
.run-summary { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px 24px; padding: 24px; }
.run-summary-alone { grid-template-columns: minmax(0, 1fr); }
.run-summary-main { min-width: 0; }
.run-summary-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; }
.run-summary h1 { margin-top: 12px; overflow-wrap: anywhere; }
.run-summary-text { margin-top: 8px; font-size: 15px; line-height: 1.6; color: var(--gray-700); }
.run-summary .alert-error, .run-summary .notice { margin: 12px 0 0; }
.run-meta { display: flex; flex-wrap: wrap; row-gap: 4px; list-style: none; padding: 0; margin: 12px 0 0; font-size: 13px; color: var(--gray-500); }
.run-meta li { overflow-wrap: anywhere; }
.run-meta li + li::before { content: "·"; margin: 0 8px; }
.run-summary-actions { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.run-summary-actions > .btn { width: 100%; }
.run-summary-actions > p { font-size: 13px; }
.run-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; margin-top: 20px; }
.run-grid-main { grid-column: span 2; min-width: 0; }
.run-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.run-conditions { display: grid; gap: 12px; margin: 12px 0 0; font-size: 14px; }
.run-conditions dt { font-size: 13px; color: var(--gray-500); }
.run-conditions dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.run-inputs { margin: 0; }
.run-inputs div + div { margin-top: 4px; }
.run-inputs dt, .run-inputs dd { display: inline; margin: 0; }
.run-inputs dt::after { content: ": "; }
.run-service { margin-top: 12px; font-size: 14px; overflow-wrap: anywhere; }
.run-service + .run-service { padding-top: 12px; border-top: 1px solid var(--gray-100); }
.run-service p { margin-top: 2px; font-size: 13px; }
.run-service .alert-error { margin: 8px 0 0; }
.run-side section > p { margin-top: 12px; font-size: 14px; }
/* The flow: one marker per step joined by a line, like the conversation's flow. */
.run-steps { list-style: none; padding: 0; margin: 16px 0 0; }
.run-flow-step { position: relative; padding-bottom: 16px; overflow-wrap: anywhere; }
.run-flow-step:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 28px; bottom: 0; width: 2px; background: var(--gray-200); }
.run-flow-marker { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; }
.run-flow-marker .icon { width: 14px; height: 14px; }
.run-flow-body { padding-left: 36px; }
.run-flow-line { margin-top: 4px; font-size: 13px; color: var(--gray-700); }
.run-flow-body .notice, .run-flow-body .alert-error { margin: 8px 0 0; }
.run-step-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; }
.run-step-heading strong { min-width: 0; }
.run-step-heading > .muted { font-size: 12px; }
.run-step-time { margin-left: auto; font-size: 12px; color: var(--gray-500); font-variant-numeric: tabular-nums; }
.app-main .run-step-more { margin-top: 4px; }
.run-step-more summary { font-size: 13px; font-weight: 400; color: var(--gray-500); }
.app-main .run-step-more[open] > summary { margin-bottom: 0; }
.run-step-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 8px 0 0; font-size: 13px; }
.run-step-details dt { color: var(--gray-500); }
.run-step-details dd { margin: 4px 0 0; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .run-step-details { grid-template-columns: minmax(0, 1fr); } }
/* 再実行: a menu of three forms; disabled items keep readable text. */
.app-main .run-redo { position: relative; margin-top: 0; }
.run-redo > summary { width: 100%; list-style: none; }
.run-redo > summary::-webkit-details-marker { display: none; }
.app-main .run-redo[open] > summary { margin-bottom: 0; }
.run-redo-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: min(360px, calc(100vw - 32px)); padding: 4px; background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-control); box-shadow: var(--shadow-lg); }
.run-redo-menu form { padding: 10px 12px; }
.run-redo-menu form + form { border-top: 1px solid var(--gray-100); }
.run-redo-menu form p { margin-top: 4px; font-size: 13px; color: var(--gray-600); }
.run-redo-menu .run-redo-reason { color: var(--gray-800); }
.run-redo-item { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; font: inherit; font-size: 14px; font-weight: 600; color: var(--gray-900); cursor: pointer; }
.run-redo-item:hover:not(:disabled) { color: var(--brand-700); }
.run-redo-item:disabled { opacity: 1; color: var(--gray-500); cursor: not-allowed; }
.run-redo-note { padding: 8px 12px; border-top: 1px solid var(--gray-100); font-size: 12px; color: var(--gray-600); }
/* Technical details: closed at first, for everyone. */
.app-main .run-technical > details { margin-top: 0; }
.run-technical > details > summary h2 { display: inline; font-size: 16px; }
.run-technical > details > summary .muted { font-size: 13px; font-weight: 400; }
.run-technical h3 { margin: 16px 0 8px; font-size: 14px; }
.run-technical p { font-size: 14px; overflow-wrap: anywhere; }
.run-call + .run-call { margin-top: 12px; }
.run-call .alert-error { margin: 8px 0 0; }
.run-compare { margin-top: 16px; }
/* SR: the steps on the left, the chosen step's result on the right. */
.run-results { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.run-results-list { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.run-results-list li { overflow-wrap: anywhere; }
.run-results-list a, .run-results-list span { display: block; padding: 6px 10px; border-radius: var(--radius-control); }
.run-results-list a[aria-current] { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.run-result-view { min-width: 0; padding: 12px 16px; border: 1px solid var(--gray-200); border-radius: var(--radius-control); }
.run-result-view h4 { margin: 0 0 8px; font-size: 14px; }
.run-result-table { border: 1px solid var(--gray-100); border-radius: var(--radius-control); }
.run-result-table th, .run-result-table td { padding: 6px 10px; }
.run-result-table td { min-width: 80px; max-width: 360px; vertical-align: top; }
.run-result-fields { margin: 0; font-size: 14px; }
.run-result-fields > div + div { margin-top: 8px; }
.run-result-fields dt { color: var(--gray-500); font-size: 12px; }
.run-result-fields dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.run-result-report { width: 100%; height: 480px; border: 1px solid var(--gray-200); border-radius: var(--radius-control); background: white; }
/* RJ-2: a report view placed in the page; the sheet brings its version's stylesheet. */
.report-preview { display: block; max-height: 480px; overflow: auto; padding: 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-control); background: var(--gray-100); }
.report-preview[hidden] { display: none; }
.report-preview .report { padding: 32px 28px; }
.report-preview.run-result-report { height: auto; background: var(--gray-100); }
@media (max-width: 640px) { .report-preview { padding: 8px; } .report-preview .report { padding: 24px 16px; } }
@media (max-width: 1023px) {
  .run-summary, .run-grid { grid-template-columns: minmax(0, 1fr); }
  .run-grid-main { grid-column: auto; }
  .run-results { grid-template-columns: minmax(0, 1fr); }
  .run-redo-menu { position: static; width: auto; margin-top: 6px; box-shadow: none; }
}
@media (max-width: 767px) { .run-summary { padding: 16px; } }

/* History comparisons retain readable columns inside the keyboard-scrollable table. */
.history-diff table { min-width: 680px; }
.history-diff th { white-space: nowrap; }
.history-diff td:nth-child(2) { min-width: 110px; }
.history-diff pre { min-width: 180px; max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Keep ongoing creation visibly distinct from the returned result. */
.creation-busy { position: fixed; inset: auto 24px 24px auto; z-index: 40; display: flex; align-items: center; gap: 16px; width: min(480px, calc(100vw - 32px)); padding: 20px; background: white; color: var(--brand-800); border: 2px solid var(--brand-500); border-radius: var(--radius-card); box-shadow: var(--shadow-lg); pointer-events: none; overflow-wrap: anywhere; }
.creation-busy strong { display: block; font-size: 18px; }
.creation-busy p { margin-top: 4px; color: var(--gray-700); font-size: 14px; }
.creation-spinner, [data-creation-poll] [data-creation-heading]::before { display: inline-block; width: 28px; height: 28px; flex: 0 0 28px; border: 3px solid var(--brand-100); border-top-color: var(--brand-600); border-radius: 50%; animation: trinity-spin .9s linear infinite; }
[data-creation-poll] > section { border: 2px solid var(--brand-500); background: var(--brand-50); }
[data-creation-poll] [data-creation-heading] { display: flex; align-items: center; gap: 12px; }
[data-creation-poll] [data-creation-heading]::before { content: ''; }
@media (max-width: 480px) { .creation-busy { right: 16px; bottom: 16px; padding: 16px; } }
@media (prefers-reduced-motion: reduce) { .creation-spinner, [data-creation-poll] [data-creation-heading]::before { animation: none; } }

/* #30: phones get one header row and, in the workspace, a bottom bar, so the page starts high. */
.phone-menu, .area-tenant, .user-dropdown-language, .bottom-bar { display: none; }
@media (max-width: 767px) {
  .header-inner { flex-wrap: nowrap; min-height: 56px; padding: 6px 8px 6px 16px; gap: 8px; }
  .brand { display: flex; flex-direction: column; line-height: 1.15; }
  .brand-company { font-size: 11px; font-weight: 500; color: var(--gray-600); }
  .brand-product { font-size: 17px; }
  .area-switcher { min-width: 0; }
  .area-switcher summary { min-height: 44px; padding: 0 10px 0 12px; border-radius: 12px; background: var(--gray-100); font-size: 13px; font-weight: 500; gap: 6px; }
  .area-switcher summary:has(.area-tenant) .area-label { display: none; }
  .area-tenant { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .area-switcher nav { min-width: 200px; }
  .tenant-label { display: none; }
  .header-actions { flex-wrap: nowrap; }
  .header-actions > .language-switcher { display: none; }
  .user-menu summary { width: 44px; height: 44px; justify-content: center; }
  .user-dropdown { top: 48px; }
  .user-dropdown-language { display: block; padding: 8px 12px; border-bottom: 1px solid var(--gray-100); }
  .phone-menu { display: block; position: relative; }
  .phone-menu summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; }
  .phone-menu summary::-webkit-details-marker { display: none; }
  .phone-menu nav { position: absolute; top: 48px; left: 0; z-index: 30; width: min(280px, calc(100vw - 32px)); display: grid; padding: 8px; background: white; border: 1px solid var(--gray-200); border-radius: 8px; box-shadow: 0 8px 24px #0001; }
  .phone-menu nav a { padding: 12px; border-radius: 8px; color: var(--gray-700); }
  .phone-menu nav a[aria-current] { background: var(--brand-50); color: var(--brand-600); }
  .sidebar { display: none; }
  .bottom-bar { display: flex; align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; min-height: 64px; padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); background: white; border-top: 1px solid var(--gray-200); }
  .bottom-bar a { flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--gray-600); font-size: 12px; font-weight: 500; }
  .bottom-bar a .icon { width: 22px; height: 22px; }
  .bottom-bar a[aria-current] { color: var(--brand-700); font-weight: 700; }
  .bottom-bar .bottom-bar-new { flex: none; flex-direction: row; gap: 6px; min-height: 48px; padding: 0 18px 0 14px; border-radius: 24px; background: var(--brand-600); color: white; font-size: 14px; font-weight: 700; white-space: nowrap; }
  .bottom-bar .bottom-bar-new .icon { width: 18px; height: 18px; }
  .app-body:not(.dialogue-screen):has(.bottom-bar) .app-main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .app-body:has(.bottom-bar) .app-footer { display: none; }
  .dialogue-screen .bottom-bar { display: none; }
}
@media (max-width: 767px) {
  /* A back link to the parent instead of the whole path. */
  .detail-breadcrumb { margin-bottom: 4px; }
  .detail-breadcrumb > :not(a:last-of-type) { display: none; }
  .detail-breadcrumb a:last-of-type::before { content: "‹ "; }
  .workflow-detail { gap: 16px; }
  .detail-description { margin-top: 6px; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .detail-description.is-expanded { display: block; }
  .detail-more { padding: 0; border: 0; background: none; color: var(--brand-600); font-size: 13px; }
  .detail-metadata { margin-top: 8px; gap: 4px 16px; }
  .detail-id code { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .detail-tabs { display: flex; }
  .detail-tabs a { flex: 1 1 0; min-width: 0; padding: 10px 4px; text-align: center; font-size: 13px; }
  .detail-tabs a:last-child { flex-shrink: 1; }
}
/* #30: the workflow list on phones — results first: count tiles, the latest results as cards, then
   the workflows not run yet as compact rows. The tools, tiles and group rows exist only here. */
.phone-list-tools, .workflow-tiles, .workflow-group { display: none; }
@media (max-width: 767px) {
  .workflow-screen .page-heading { flex-wrap: nowrap; align-items: center; margin-bottom: 12px; }
  .workflow-screen .page-heading p, .workflow-screen .page-heading > .btn-primary { display: none; }
  .phone-list-tools { display: flex; gap: 4px; margin-left: auto; }
  .phone-list-tools .icon-button { width: 44px; height: 44px; flex-basis: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--gray-700); }
  .phone-list-tools .icon-button .icon { width: 22px; height: 22px; }
  .phone-list-tools [aria-expanded="true"] { background: var(--gray-100); color: var(--brand-700); }
  .workflow-tabs { flex-wrap: nowrap; gap: 0; padding: 2px; border: 0; border-radius: 14px; background: var(--gray-200); margin-bottom: 12px; }
  .workflow-tabs a { flex: 1 1 auto; justify-content: center; gap: 6px; min-height: 44px; padding: 0 8px; margin: 0; border: 0; border-radius: 12px; white-space: nowrap; color: var(--gray-600); }
  .workflow-tabs a[aria-current] { background: white; color: var(--gray-900); font-weight: 700; box-shadow: var(--shadow-sm); }
  .workflow-tabs span { padding: 0; background: none; color: inherit; }
  .workflow-tabs a[aria-current] span { color: var(--brand-700); }
  .workflow-filters[data-list-open=""] { display: none; }
  .workflow-filters[data-list-open="search"] :is(.workflow-status-filters, .workflow-sort, .workflow-extra-filters) { display: none; }
  .workflow-filters[data-list-open="filter"] .workflow-search { display: none; }
  .workflow-filters { margin-bottom: 12px; }
  .saved-dialogues-link { margin: 0 0 12px; font-size: 14px; }
  .workflow-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
  .workflow-tile { display: flex; flex-direction: column; justify-content: center; min-height: 64px; padding: 6px 14px; border: 1px solid var(--gray-200); border-radius: 14px; background: white; color: var(--gray-600); font-size: 12px; font-weight: 500; }
  .workflow-tile strong { font-size: 22px; line-height: 28px; color: var(--gray-900); }
  .workflow-tile-with_results strong { color: #166534; }
  .workflow-tile-attention.has-items strong { color: #991b1b; }
  .workflow-tile[aria-current] { border-color: var(--brand-500); background: var(--brand-50); }
  .workflow-screen .workflow-list { background: transparent; border: 0; box-shadow: none; }
  .workflow-screen .workflow-table .workflow-group { display: block; }
  .workflow-screen .workflow-table .workflow-group th { display: block; width: auto; padding: 0 0 10px; border: 0; border-radius: 0; background: none; text-align: left; font-size: 13px; font-weight: 700; color: var(--gray-700); }
  .workflow-screen .workflow-table .workflow-group:not(:first-child) th { padding-top: 12px; }
  .workflow-screen .workflow-table .workflow-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--gray-200); border-radius: 16px; background: white; }
  .workflow-screen .workflow-table .workflow-row:hover { background: white; }
  .workflow-table .workflow-row td { border-radius: 0; }
  .workflow-screen .workflow-symbol, .workflow-screen .workflow-io-tags, .workflow-screen .workflow-table .workflow-specs, .workflow-screen .workflow-table .mobile-column-label { display: none; }
  .workflow-screen .workflow-latest { order: -1; padding-right: 40px; }
  .workflow-latest-line { padding-top: 0; font-size: 12px; color: var(--gray-600); }
  .workflow-title h2 { font-size: 17px; line-height: 26px; font-weight: 700; }
  .workflow-title h2 a { color: var(--gray-900); }
  .workflow-description { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .workflow-screen .workflow-action-buttons { justify-content: flex-start; border-top: 0; padding-top: 4px; }
  .workflow-screen .workflow-action-buttons > :first-child:not(:only-of-type) { flex: 1; }
  .workflow-screen .workflow-action-buttons > .btn { min-height: 48px; justify-content: center; border-radius: 12px; }
  .workflow-screen .workflow-more { position: absolute; top: 4px; right: 4px; }
  .workflow-screen .workflow-more > summary { width: 44px; height: 44px; border: 0; background: transparent; }
  .workflow-screen .workflow-more-menu { transform: none; }
  /* Not run yet: one joined card of compact rows, the run button on the right. */
  .workflow-screen .workflow-table .workflow-row[data-result="never"] { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 12px 52px 12px 16px; margin: 0; border-radius: 0; border-top-width: 0; }
  .workflow-screen .workflow-table :is(.workflow-group, .workflow-row:not([data-result="never"])) + .workflow-row[data-result="never"], .workflow-screen .workflow-table .workflow-row[data-result="never"]:first-child { border-top-width: 1px; border-top-left-radius: 16px; border-top-right-radius: 16px; }
  .workflow-screen .workflow-table .workflow-row[data-result="never"]:last-child, .workflow-screen .workflow-table .workflow-row[data-result="never"]:has(+ :not(.workflow-row[data-result="never"])) { border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; margin-bottom: 12px; }
  .workflow-row[data-result="never"] .workflow-latest { display: none; }
  .workflow-row[data-result="never"] .workflow-info { grid-column: auto; }
  .workflow-row[data-result="never"] .workflow-title h2 { font-size: 15px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .workflow-row[data-result="never"] .workflow-title { flex-wrap: nowrap; min-height: 0; }
  .workflow-row[data-result="never"] .workflow-description { font-size: 13px; -webkit-line-clamp: 1; }
  .workflow-screen .workflow-row[data-result="never"] .workflow-action-buttons { padding-top: 0; }
  /* A quiet icon button, so the description keeps the width (the label stays for screen readers). */
  .workflow-screen .workflow-row[data-result="never"] .workflow-action-buttons > .btn { width: 44px; min-height: 44px; padding: 0; border-color: transparent; background: var(--brand-50); color: var(--brand-700); }
  .workflow-screen .workflow-row[data-result="never"] .workflow-action-buttons > .btn .icon { width: 20px; height: 20px; }
  .workflow-row[data-result="never"] .workflow-run-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .workflow-screen .workflow-row[data-result="never"] .workflow-more { top: 50%; transform: translateY(-50%); }
  /* The row whose 「…」 menu is open stays above the rows after it, so the menu is not covered. */
  .workflow-screen .workflow-table .workflow-row:has(.workflow-more[open]) { z-index: 25; }
}
@media (max-width: 767px) {
  /* #30: on phones the tiles filter by result; the filter panel holds the three sort fields in one row. */
  .workflow-screen .workflow-status-filters, .workflow-screen .workflow-attention { display: none; }
  .workflow-screen .workflow-sort { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; margin: 0; }
  .workflow-screen .workflow-sort-field { flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; }
  .workflow-screen .workflow-sort .input { width: 100%; min-width: 0; height: 40px; }
  .workflow-screen .workflow-filter-apply { grid-column: 1 / -1; min-height: 40px; }
  .workflow-screen .filter-reset { padding: 6px 0 0; margin-left: 0; }
}
/* #30: the run history — the filters open from the button beside the title, the conditions in use
   sit above the list with 「クリア」, and on phones each run is a card (no sideways scroll). */
.runs-heading { align-items: center; }
.runs-filter-toggle[aria-expanded="true"] { background: var(--gray-100); color: var(--brand-700); }
.run-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); align-items: end; gap: 12px 16px; margin: 0 0 16px; padding: 16px; border: 1px solid var(--gray-200); border-radius: 12px; background: white; }
.run-filters[hidden] { display: none; }
.run-filters label { display: grid; gap: 6px; min-width: 0; }
.run-filters .input { min-width: 0; height: 42px; padding-top: 0; padding-bottom: 0; }
.run-filter-wide { grid-column: span 2; }
.filter-period { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px 8px; min-width: 0; margin: 0; padding: 0; border: 0; font-size: 14px; }
.filter-period legend { padding: 0; margin-bottom: 6px; }
.filter-period .input { -webkit-appearance: none; appearance: none; padding: 0 10px; }
.run-filters > .btn { justify-self: start; height: 42px; }
.run-active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 13px; }
.run-active-label { color: var(--gray-500); }
.run-active-filters ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.run-active-filters li { padding: 3px 10px; border-radius: 9999px; background: var(--brand-50); color: var(--brand-700); overflow-wrap: anywhere; }
.run-clear-filters { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; margin-left: auto; font-weight: 500; }
.run-clear-filters .icon { width: 16px; height: 16px; }
.run-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.run-name > a:first-child { min-width: 0; }
.run-output-icon { flex: 0 0 32px; width: 32px; height: 32px; padding: 0; color: var(--gray-600); }
.run-output-icon .icon { width: 16px; height: 16px; }
@media (max-width: 767px) {
  .runs-heading { flex-wrap: nowrap; margin-bottom: 12px; }
  .runs-heading p { display: none; }
  .runs-heading p.page-count { display: block; }
  .runs-filter-toggle { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; }
  .runs-filter-toggle span { display: none; }
  .runs-filter-toggle .icon { width: 22px; height: 22px; }
  .run-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 12px; }
  .run-filter-wide, .run-filters > .btn { grid-column: 1 / -1; }
  .run-filters > .btn { justify-self: stretch; }
  .run-history-table { min-width: 0; }
  .run-history-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .run-history-table tbody { display: block; }
  .run-history-table tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 6px 8px; padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
  .run-history-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .run-history-table td[colspan] { grid-column: 1 / -1; }
  .run-cell-name { grid-area: 1 / 1 / 2 / -1; font-weight: 600; }
  .run-history-table .run-cell-state { grid-area: 2 / 1; display: flex; gap: 4px; }
  .run-cell-time { grid-area: 2 / 2; font-size: 13px; color: var(--gray-500); white-space: nowrap; }
  .run-cell-mode { grid-area: 2 / 3; font-size: 13px; color: var(--gray-500); }
  .run-cell-mode::before { content: "/ "; }
}
/* #30: the workflow detail's runs match the run history — the date opens the result, the output
   icon sits at the right, the filters open from the button; on phones each run is a card. */
.detail-history-heading { align-items: center; }
.detail-history-heading .muted { margin-right: auto; }
.detail-history-heading .runs-filter-toggle { font-size: 14px; }
.detail-history td.run-cell-name { min-width: 200px; }
.run-cell-revision-inline { display: none; }
.detail-history .run-cell-actions:empty { padding: 0; }
@media (max-width: 767px) {
  .detail-history table { min-width: 0; }
  .detail-history thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .detail-history tbody { display: block; }
  .detail-history tr { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
  .detail-history td { display: block; min-width: 0; padding: 0; border: 0; font-size: 13px; }
  .detail-history td[colspan] { grid-column: 1 / -1; }
  .detail-history td.run-cell-name { grid-area: 1 / 2; min-width: 0; font-weight: 600; }
  .detail-history td.run-cell-state { grid-area: 1 / 1; display: flex; gap: 4px; }
  .detail-history td.run-cell-mode { grid-area: 2 / 1 / 3 / -1; color: var(--gray-500); }
  .detail-history td.run-cell-mode::before { content: none; }
  .detail-history tbody tr:first-child { padding-top: 0; }
  .detail-history td.run-cell-revision, .detail-history td.run-cell-actions:empty { display: none; }
  .detail-history td.run-cell-actions { grid-area: 3 / 1 / 4 / -1; }
  .run-cell-revision-inline { display: inline; }
  .detail-history-heading .runs-filter-toggle { margin: -8px -8px -8px 0; }
}
/* #85 (docs/inbox-ui.md): the inbox, and the unread count beside its navigation entry. */
.nav-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 9999px; background: var(--brand-600); color: white; font-size: 12px; font-weight: 700; line-height: 1; }
.nav-count[hidden] { display: none; }
.sidebar nav a .nav-count { margin-left: auto; }
.inbox-actions { display: flex; align-items: center; gap: 8px; }
.inbox-actions .btn { white-space: nowrap; }
/* #91: the counts by the heading and the page position between the pagination buttons. */
/* `.page-heading p.page-count` outranks `.page-heading p`; the detail history row keeps its 12px. */
.page-count, .page-heading p.page-count { font-size: 14px; color: var(--gray-700); font-weight: 500; }
.page-position { display: inline-flex; align-items: center; font-size: 14px; color: var(--gray-600); }
.inbox-list { margin: 0; padding: 0; list-style: none; }
.inbox-item { position: relative; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto 16px; align-items: center; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--gray-100); }
/* #91: the whole row opens the item (the name's link covers it); the output button stays above it. */
.inbox-name::after { content: ""; position: absolute; inset: 0; }
.inbox-item:hover { background: var(--gray-50); }
.inbox-buttons { position: relative; z-index: 1; }
.inbox-go { grid-column: 4; display: flex; color: var(--gray-400); }
.inbox-go .icon { width: 16px; height: 16px; transform: rotate(-90deg); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-dot { width: 8px; height: 8px; border-radius: 50%; }
.inbox-item.is-unread .inbox-dot { background: var(--brand-600); }
.inbox-main { display: grid; gap: 4px; min-width: 0; }
.inbox-name { color: var(--gray-900); overflow-wrap: anywhere; }
.inbox-item.is-unread .inbox-name { font-weight: 700; }
.inbox-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--gray-600); }
.inbox-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
/* #107: the run history and the inbox by AI workflow — a two-part switch above the list, and each
   group a row that opens (chevron at the right) onto its newest runs. */
.view-switch { display: inline-flex; margin: 0 0 12px; border: 1px solid var(--gray-200); border-radius: 10px; background: white; }
.view-switch a { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 14px; color: var(--gray-700); font-size: 14px; font-weight: 500; text-decoration: none; }
.view-switch a:first-child { border-radius: 9px 0 0 9px; }
.view-switch a:last-child { border-radius: 0 9px 9px 0; }
.view-switch a + a { border-left: 1px solid var(--gray-200); }
.view-switch a:hover { background: var(--gray-50); }
.view-switch a[aria-current="true"] { background: var(--brand-50); color: var(--brand-700); }
.run-groups { margin: 0; padding: 0; list-style: none; }
.run-groups > li + li { border-top: 1px solid var(--gray-100); }
.run-group > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; align-items: center; gap: 4px 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
.run-group > summary::-webkit-details-marker { display: none; }
.run-group > summary:hover { background: var(--gray-50); }
.inbox-groups .run-group > summary { grid-template-columns: 8px minmax(0, 1fr) auto 16px; }
.run-group.is-unread > summary .inbox-dot { background: var(--brand-600); }
.run-group-main { display: grid; gap: 4px; min-width: 0; }
.run-group-name { color: var(--gray-900); font-weight: 600; overflow-wrap: anywhere; }
.inbox-groups .run-group-name { font-weight: 500; }
.inbox-groups .run-group.is-unread .run-group-name { font-weight: 700; }
.run-group-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--gray-600); }
.run-group-counts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; font-size: 13px; color: var(--gray-600); white-space: nowrap; }
.run-group-go { display: flex; color: var(--gray-400); }
.run-group-go .icon { width: 16px; height: 16px; transform: rotate(-90deg); }
.run-group[open] .run-group-go .icon { transform: none; }
.run-group-body { padding: 0 16px 12px 32px; }
.run-group-body .inbox-list { border-left: 2px solid var(--gray-100); }
.run-group-all { display: inline-flex; align-items: center; min-height: 32px; margin-top: 8px; font-size: 14px; font-weight: 500; }
@media (max-width: 767px) {
  .view-switch { display: flex; }
  .view-switch a { flex: 1 1 0; min-height: 40px; padding: 6px 8px; }
  .run-group > summary { grid-template-columns: minmax(0, 1fr) 16px; padding: 12px 16px; }
  .inbox-groups .run-group > summary { grid-template-columns: 8px minmax(0, 1fr) 16px; }
  .run-group-counts { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .inbox-groups .run-group-counts { grid-column: 2; }
  .run-group-go { grid-column: 2; grid-row: 1; }
  .inbox-groups .run-group-go { grid-column: 3; }
  .run-group-body { padding: 0 16px 12px; }
}
/* #86 (docs/notifications-ui.md): the header's bell and its unread count. */
.header-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 9999px; color: var(--gray-700); }
.header-bell:hover, .header-bell[aria-current="page"] { background: var(--gray-100); color: var(--brand-600); }
.header-bell .nav-count { position: absolute; top: 0; left: 22px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
/* On phones the same touch size as the account menu beside it. */
@media (max-width: 767px) { .header-bell { width: 44px; height: 44px; flex-basis: 44px; } }
@media (max-width: 767px) {
  .inbox-item { grid-template-columns: 8px minmax(0, 1fr) 16px; padding: 12px 16px; }
  .inbox-buttons { grid-column: 2; grid-row: 2; justify-content: flex-start; }
  .inbox-go { grid-column: 3; grid-row: 1; }
  .bottom-bar a { position: relative; }
  .bottom-bar .nav-count { position: absolute; top: 2px; left: calc(50% + 4px); min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
}
