.top-navigation {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-shrink: 0;
  scrollbar-width: none;
}
.top-navigation a {
  font-size: 11px;
  padding: 12px 14px;
  border-radius: 99px;
  white-space: nowrap;
}
.top-navigation a.active {
  background: var(--text);
  color: var(--surface);
}
.topbar .breadcrumb {
  display: none;
}
.topbar .user-copy,
.topbar .quick-create-label {
  display: none;
}
.topbar .search-trigger {
  width: 40px;
  flex: 0 0 40px;
  padding: 0;
  justify-content: center;
}
.topbar .search-trigger span,
.topbar .search-trigger kbd {
  display: none;
}
.topbar-spacer {
  min-width: 0;
}
.shell-main { container-type: inline-size; container-name: app-content; }
.topbar > button { flex-shrink: 0; white-space: nowrap; }
/* Available content width matters more than viewport width when the rail expands. */
@container app-content (max-width: 1000px) {
  .topbar .top-navigation { display: none; }
  .topbar .breadcrumb { display: flex; overflow: hidden; }
  .topbar .breadcrumb > a,
  .topbar .breadcrumb > span { display: none; }
  .topbar .breadcrumb strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .mobile-menu { display: inline-flex; }
}
@container app-content (max-width: 460px) {
  .topbar { padding-inline: 12px; gap: 8px; }
  .topbar .breadcrumb { display: none; }
  .topbar > button[data-action="quick-create"] { width: 40px; padding-inline: 0; }
}
.sidebar-collapsed .sidebar {
  padding-inline: 8px;
}
body.sidebar-collapsed .brand {
  padding: 0;
  justify-content: center;
}
.sidebar-collapsed .nav-link {
  width: 48px;
  height: 48px;
  margin: 6px auto;
  background: var(--surface);
}
.sidebar-collapsed .nav-link.active {
  background: var(--text);
  color: var(--surface);
}
.sidebar-collapsed .nav-group + .nav-group {
  margin-top: 8px;
}
/* Keep the rail and content on the same clock; transitions can reverse mid-flight. */
.sidebar {
  transition: width 260ms cubic-bezier(.32,.72,0,1),
    transform 260ms cubic-bezier(.32,.72,0,1),
    padding 260ms cubic-bezier(.32,.72,0,1);
}
.shell-main {
  transition: margin-right 260ms cubic-bezier(.32,.72,0,1);
}
.sidebar .sidebar-footer {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  padding: 12px 0 6px;
}
.sidebar .sidebar-collapse {
  min-height: 44px;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.sidebar .sidebar-collapse .icon { flex: 0 0 18px; }
@media (min-width: 981px) {
  .sidebar .brand,
  body.sidebar-collapsed .brand { justify-content: flex-start; }
  .sidebar .brand { transition: padding 260ms cubic-bezier(.32,.72,0,1); }
  body.sidebar-collapsed .brand { padding-inline: 10px; }
  .sidebar .brand-copy,
  .sidebar .nav-link span,
  .sidebar .sidebar-collapse span {
    display: block;
    max-width: 230px;
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    transition: opacity 160ms ease-out, max-width 260ms cubic-bezier(.32,.72,0,1);
  }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-link span,
  body.sidebar-collapsed .sidebar-collapse span {
    display: block;
    max-width: 0;
    opacity: 0;
  }
  .sidebar .nav-label {
    display: block;
    max-height: 30px;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 160ms ease-out, max-height 260ms cubic-bezier(.32,.72,0,1),
      margin-bottom 260ms cubic-bezier(.32,.72,0,1);
  }
  body.sidebar-collapsed .nav-label {
    display: block;
    max-height: 0;
    margin-bottom: 0;
    opacity: 0;
  }
  .sidebar .nav-link {
    width: 100%;
    height: 48px;
    margin: 6px 0;
    overflow: hidden;
    white-space: nowrap;
    transition: width 260ms cubic-bezier(.32,.72,0,1),
      padding 260ms cubic-bezier(.32,.72,0,1),
      gap 260ms cubic-bezier(.32,.72,0,1), background-color 160ms ease-out, color 160ms ease-out;
  }
  body.sidebar-collapsed .nav-link {
    width: 48px;
    margin-inline: 6px;
    padding-inline: 15px;
    justify-content: flex-start;
    gap: 0;
  }
  .sidebar .nav-group + .nav-group {
    transition: margin-top 260ms cubic-bezier(.32,.72,0,1);
  }
  .sidebar .sidebar-collapse { overflow: hidden; }
  body.sidebar-collapsed .sidebar-collapse {
    width: 48px;
    height: 44px;
    margin-inline: auto;
    padding: 0;
    gap: 0;
  }
  .sidebar-collapse .icon { transition: transform 260ms cubic-bezier(.32,.72,0,1); }
  body.sidebar-collapsed .sidebar-collapse .icon { transform: rotate(180deg); }
}
body.sidebar-keyboard-toggle .sidebar,
body.sidebar-keyboard-toggle .sidebar *,
body.sidebar-keyboard-toggle .shell-main { transition: none !important; }
.wf-panel {
  background: transparent;
  margin-bottom: 28px;
}
.wf-panel-body {
  background: var(--surface-soft);
  border-radius: 0 0 34px 34px;
  padding: 24px;
}
#workflow-root {
  scroll-margin-top: 94px;
}
.wf-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
}
.wf-panel-head > .wf-heading, .wf-panel-head > .wf-tools {
  background: var(--surface-soft);
  border-radius: 34px 34px 0 0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wf-panel-head > .wf-tools { justify-content: flex-end; }
.wf-heading { flex-wrap: wrap; justify-content: space-between; }
.wf-heading h2 { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.wf-panel-head h2 {
  font-size: 17px;
  margin: 0;
  font-weight: 600;
}
.wf-count {
  font-size: 11px;
  background: var(--surface);
  padding: 5px 8px;
  border-radius: 99px;
}
.wf-tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  align-items: center;
  border-radius: 0 0 28px 28px;
  box-shadow: 0 28px 0 var(--surface-soft);
  background: transparent;
}
.wf-tabs .btn {
  border: 0;
  font-size: 11px;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.wf-tools {
  display: flex;
  gap: 8px;
}
.wf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.wf-card {
  background: var(--surface);
  border-radius: 30px;
  padding: 22px;
  min-width: 0;
}
.wf-card header,
.wf-card footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.wf-card h3 {
  font-size: 14px;
  margin: 0;
  overflow-wrap: anywhere;
}
.wf-card h3 button {
  border: 0;
  background: none;
  cursor: pointer;
  text-align: start;
}
.wf-facts {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-block: 20px;
}
.wf-facts strong {
  display: block;
  font-size: 20px;
  font-weight: 550;
}
.wf-facts small {
  color: var(--text-soft);
  font-size: 10px;
}
.wf-rings {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-around;
}
.wf-ring {
  width: 130px;
  height: 130px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.wf-ring canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.wf-ring strong {
  font-size: 24px;
  font-weight: 550;
}
.wf-ring small,
.wf-step-summary {
  font-size: 10px;
  color: var(--text-soft);
}
.wf-step-summary {
  display: grid;
  gap: 7px;
}
.wf-step-summary strong {
  font-size: 20px;
  color: var(--text);
}
.wf-card footer {
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 14px;
  flex-wrap: wrap;
}
.wf-people {
  display: flex;
  padding-inline-start: 6px;
}
.wf-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-strong);
  border: 2px solid var(--surface);
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
}
.wf-people .wf-avatar {
  margin-inline-start: -6px;
}
.wf-avatar .icon {
  width: 17px;
  height: 17px;
}
.wf-empty {
  padding: 34px 16px;
  color: var(--text-faint);
  text-align: center;
  font-size: 12px;
}
.wf-pipeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.wf-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  width: 100%;
  border: 0;
  border-radius: 99px;
  background: var(--surface);
  margin-bottom: 12px;
  cursor: pointer;
  text-align: start;
}
.wf-pill span:nth-child(2) {
  flex: 1;
  min-width: 0;
}
.wf-pill strong,
.wf-pill small {
  display: block;
  overflow-wrap: anywhere;
}
.wf-pill strong {
  font-size: 12px;
  font-weight: 550;
}
.wf-pill small {
  font-size: 10px;
  color: var(--text-soft);
}
.wf-detail-head {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.wf-detail-head > div {
  flex: 1;
  min-width: 160px;
}
.wf-detail-head h3 {
  margin: 0;
}
.wf-detail-head p {
  color: var(--text-soft);
  font-size: 12px;
  white-space: pre-wrap;
}
.wf-graph-scroll {
  overflow: auto;
}
.wf-graph {
  display: flex;
  gap: 55px;
  position: relative;
  width: max-content;
  min-width: 100%;
  padding: 12px 0;
}
.wf-connections {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.wf-stage {
  width: 230px;
  position: relative;
}
.wf-stage > h4 {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}
.wf-node {
  padding: 20px;
  background: var(--surface);
  border-radius: 28px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}
.wf-node h4 {
  margin: 0;
  font-size: 13px;
}
.wf-node p,
.wf-node small {
  margin: 0;
  font-size: 10px;
  color: var(--text-soft);
}
.wf-node-person {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
}
.wf-node .btn {
  width: 100%;
}
.wf-editor-step {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 25px;
  padding: 20px;
  margin-bottom: 14px;
}
.wf-editor-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
}
.wf-hint {
  font-size: 11px;
  color: var(--text-soft);
}
.wf-dependencies {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  grid-column: 1 / -1;
}
.wf-dependencies legend {
  font-size: 12px;
  margin-bottom: 12px;
}
.wf-dependencies label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 20px;
  background: var(--surface-soft);
}
.wf-dependencies small {
  color: var(--text-soft);
}
.wf-error {
  color: var(--danger);
}
.workflow-modal {
  background: var(--surface-soft);
}
.wf-picker-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  clip-path: inset(50%);
  overflow: hidden;
}
.wf-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--field-border);
  border-radius: 99px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.wf-picker-trigger::after {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  align-self: center;
  background-color: var(--text-soft);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.wf-picker-trigger[aria-expanded="true"]::after { transform: rotate(180deg); }
.wf-picker-trigger:disabled,
.wf-picker-panel button:disabled { opacity: .5; cursor: not-allowed; }
.wf-picker-trigger:focus-visible,
.wf-picker-panel button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wf-picker-panel {
  position: fixed;
  inset: auto;
  margin: 0;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 16px 48px rgb(0 0 0 / 18%);
  overflow: auto;
  direction: rtl;
  font: inherit;
}
.wf-picker-panel button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 16px;
  padding: 10px;
  cursor: pointer;
}
.wf-picker-option { display: block; width: 100%; text-align: start; min-height: 44px; }
.wf-picker-panel [aria-selected="true"],
.wf-picker-panel [aria-pressed="true"] { background: var(--text); color: var(--surface); }
@media (hover: hover) and (pointer: fine) {
  .wf-picker-trigger:not(:disabled):hover {
    background: var(--surface-soft);
    color: var(--text);
    border-color: var(--text-soft);
  }
  .wf-picker-panel button:not(:disabled):hover {
    background: var(--surface-soft);
    color: var(--text);
  }
  .wf-picker-panel button[aria-selected="true"]:not(:disabled):hover,
  .wf-picker-panel button[aria-pressed="true"]:not(:disabled):hover {
    background: var(--text);
    color: var(--surface);
    box-shadow: inset 0 0 0 2px var(--border-strong);
  }
}
.wf-calendar-head, .wf-calendar-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wf-calendar-head strong { font-size: 12px; }
.wf-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; padding-block: 12px; text-align: center; }
.wf-calendar-grid button { padding: 6px 0; min-height: 34px; }
.wf-calendar-grid small { color: var(--text-soft); }
.wf-calendar-grid .is-today { box-shadow: inset 0 0 0 1px var(--border-strong); }
.wf-calendar-foot { border-top: 1px solid var(--border); padding-top: 6px; font-size: 12px; }
.modal-backdrop {
  backdrop-filter: blur(8px);
}
.modal .input,
.modal .select {
  border-radius: 99px;
  min-height: 46px;
  border-color: transparent;
  background: var(--surface);
}
.modal .select[multiple] {
  border-radius: 18px;
  min-height: 88px;
}
.modal .textarea {
  border-radius: 24px;
  border-color: transparent;
  background: var(--surface);
}
.modal .input:focus,
.modal .select:focus,
.modal .textarea:focus {
  border-color: var(--border-strong);
}
/* Text entry boundaries remain visible before hover/focus in every form. */
.number-field { position: relative; min-width: 0; width: 100%; }
.number-field > .number-field-display {
  appearance: textfield;
  -moz-appearance: textfield;
  padding-inline-end: 42px;
  min-height: 46px;
  text-align: right;
}
.number-field > .number-field-source { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; clip-path: inset(50%); }
.number-field > input::-webkit-inner-spin-button,
.number-field > input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.number-field-actions {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}
.number-field-actions svg { display: block; flex: none; }
.number-field-actions button {
  width: 24px;
  height: 15px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.number-field-actions button + button { border-top: 1px solid var(--border-strong); border-radius: 0 0 7px 7px; }
.number-field-actions button:disabled { opacity: .4; cursor: not-allowed; }
.number-field-actions button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .number-field-actions button:not(:disabled):hover { background: var(--text); color: var(--surface); }
}
:root { --field-border: #8b95a5; }
:root[data-theme="dark"] { --field-border: #78859a; }
.select:not(.wf-picker-source),
.modal .select:not(.wf-picker-source) { border: 1px solid var(--field-border); }
.wf-picker-trigger:focus-visible,
.wf-picker-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input:not(.wf-picker-source),
textarea.textarea,
.modal .input:not(.wf-picker-source),
.modal textarea.textarea {
  border: 1px solid var(--field-border);
  background: var(--surface);
  color: var(--text);
}
.input:not(.wf-picker-source):focus,
textarea.textarea:focus,
.modal .input:not(.wf-picker-source):focus,
.modal textarea.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input:not(.wf-picker-source)[aria-invalid="true"],
textarea.textarea[aria-invalid="true"],
.modal .input:not(.wf-picker-source)[aria-invalid="true"],
.modal textarea.textarea[aria-invalid="true"] { border-color: var(--danger); }
@media (max-width: 1180px) {
  .topbar {
    gap: 8px;
    padding-inline: 16px;
  }
}
@media (max-width: 980px) {
  body.sidebar-collapsed .brand { justify-content: flex-start; padding-inline: 10px; }
  .top-navigation {
    display: none;
  }
  .wf-panel-head { grid-template-columns: 1fr 1fr; }
  .wf-panel-head > .wf-heading { grid-column: 1; grid-row: 2; border-radius: 0 26px 0 0; }
  .wf-panel-head > .wf-tools { grid-column: 2; grid-row: 2; border-radius: 26px 0 0 0; }
  .wf-panel-body { padding: 18px; }
  .wf-tabs {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: center;
    box-shadow: none;
    padding: 0 0 14px;
    max-width: 100%;
    overflow: auto;
  }
}
@media (max-width: 720px) {
  .wf-pipeline {
    grid-template-columns: 1fr;
  }
  .wf-tabs {
    order: 3;
    width: 100%;
  }
  .wf-panel-body {
    padding: 14px;
    border-radius: 0 0 26px 26px;
  }
  .wf-panel-head > .wf-heading, .wf-panel-head > .wf-tools { padding: 14px; }
  .wf-cards {
    grid-template-columns: 1fr;
  }
}
.global-search { padding: 22px; display: flex; flex-direction: column; height: min(620px, 88dvh); max-height:88dvh; gap: 12px; overflow:hidden; }
.global-search > header, .global-search > footer { flex-shrink:0; }
.global-search header { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.global-search h2 { font-size:18px; margin:0; }
.global-search .command-input { flex-shrink:0; width:100%; border:1px solid var(--field-border, #8b95a5); border-radius:18px; padding:14px 18px; }
.search-filters { display:flex; flex-wrap:nowrap; align-items:center; gap:6px; height:42px; overflow:auto; flex-shrink:0; }
.search-filters > .btn { flex-shrink:0; white-space:nowrap; }
.search-filters .btn { font-size:12px; min-height:32px; padding:5px 12px; }
.search-filters .btn[aria-pressed="true"] { background:var(--text); color:var(--surface); }
.search-status, .global-search footer { font-size:12px; color:var(--text-muted, #748094); margin:0; }
.global-search .search-status { height:40px; flex-shrink:0; overflow:auto; }
.global-search .search-results { overflow:auto; min-height:0; flex:1; max-height:none; padding:0; overscroll-behavior:contain; opacity:1; transition:opacity 120ms ease; }
.global-search .search-results[aria-busy="true"] { opacity:.55; }
.search-results h3 { font-size:12px; margin:14px 8px 6px; color:var(--text-muted, #748094); }
.global-search .command-item { width:100%; text-align:start; border-radius:14px; padding:12px; }
.global-search .command-item span { min-width:0; overflow-wrap:anywhere; }
.global-search .command-item.active, .global-search .command-item:hover { background:var(--text); color:var(--surface); }
.global-search .command-item.active .cell-sub, .global-search .command-item:hover .cell-sub { color:inherit; opacity:.8; }
.global-search footer { padding-top:10px; border-top:1px solid var(--border); }
@media(max-width:540px) { .global-search { padding:14px; max-height:88dvh; } .global-search h2 {font-size:16px;} }
