:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: #f0fdfa;
  --primary-border: #99f6e4;
  --t0-bg: #fff1f2;
  --t0-text: #be123c;
  --t0-border: #fecdd3;
  --t1-bg: #fffbeb;
  --t1-text: #b45309;
  --t1-border: #fde68a;
  --t2-bg: #eff6ff;
  --t2-text: #1d4ed8;
  --t2-border: #bfdbfe;
  --t3-bg: #f1f5f9;
  --t3-text: #475569;
  --t3-border: #cbd5e1;
  --ok-bg: #ecfdf5;
  --ok-text: #047857;
  --ok-border: #a7f3d0;
  --radius: 8px;
  --radius-lg: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Login View */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-mark i {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-style: normal;
  font-weight: 700;
  font-size: 13px;
}

.login-card h1 {
  font-size: 19px;
  font-weight: 650;
  margin: 16px 0 6px;
}

.login-card .sub {
  color: var(--text-muted);
  margin: 0 0 22px;
  font-size: 13px;
}

.form-field {
  margin-bottom: 16px;
}

.form-field label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.14);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}

.btn:hover:not(:disabled) {
  background: var(--surface-subtle);
  border-color: #94a3b8;
}

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

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-danger {
  color: var(--t0-text);
  border-color: var(--t0-border);
  background: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--t0-bg);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 8px;
}

.btn-ghost:hover:not(:disabled) {
  background: #eef2f6;
  color: var(--text);
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-full {
  width: 100%;
  padding: 9px 14px;
  font-size: 13.5px;
}

.error-msg {
  color: var(--t0-text);
  font-size: 12px;
  margin: 8px 0 12px;
  min-height: 18px;
}

/* Top Navigation Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-tab {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 550;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
}

.nav-tab:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.nav-tab.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 650;
}

.nav-tab .count-pill {
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  background: #e2e8f0;
  color: var(--text-secondary);
}

.nav-tab.active .count-pill {
  background: #ccfbf1;
  color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 550;
}

.user-chip .role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

/* Main Container */
.workspace {
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px 24px 48px;
}

/* Role Focus Strip & Summary Metrics */
.role-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 12.5px;
}

.role-strip strong {
  color: var(--text);
}

.role-strip span {
  color: var(--text-secondary);
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.metric-card .m-label {
  color: var(--text-muted);
  font-size: 12px;
}

.metric-card .m-value {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 2px;
  letter-spacing: -0.02em;
}

.metric-card .m-sub {
  color: var(--text-muted);
  font-size: 11.5px;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.toolbar input[type="search"] {
  width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
}

.toolbar select {
  width: auto;
  padding: 6px 10px;
}

.segmented {
  display: inline-flex;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 7px;
}

.segmented button {
  border: 0;
  background: transparent;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-secondary);
  cursor: pointer;
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Rubric Reference Panel */
.rubric-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
}

.rubric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.rubric-col h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--text);
}

.rubric-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.rubric-col li {
  padding: 2px 0;
}

/* Process Group & Ledger Table */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}

.process-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}

.process-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.process-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  font-weight: 650;
  padding: 2px 6px;
  background: #e2e8f0;
  border-radius: 4px;
  color: var(--text);
}

.domain-tag {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-weight: 550;
}

.process-desc {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.table-scroll {
  overflow-x: auto;
}

table.ledger {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
}

table.ledger th {
  padding: 9px 10px;
  background: #fcfcfd;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  white-space: nowrap;
}

table.ledger td {
  padding: 10px;
  border-bottom: 1px solid #eef2f6;
  vertical-align: top;
}

table.ledger tr:last-child td {
  border-bottom: 0;
}

table.ledger tbody tr:hover {
  background: #f8fafc;
}

table.ledger tbody tr.mine-row {
  background: #fafffe;
}

table.ledger tbody tr.mine-row:hover {
  background: #f0fdfa;
}

.act-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
}

.act-name {
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.act-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.act-step {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.45;
  max-width: 340px;
}

/* Compact inline score controls */
.score-select {
  width: 58px;
  padding: 4px 5px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: #fff;
}

.score-select.s5 {
  color: var(--t0-text);
  border-color: var(--t0-border);
  background: var(--t0-bg);
}

.score-select.s4 {
  color: var(--t1-text);
  border-color: var(--t1-border);
  background: var(--t1-bg);
}

.score-readonly {
  display: inline-block;
  min-width: 34px;
  padding: 3px 6px;
  text-align: center;
  border-radius: 5px;
  font-weight: 600;
  font-size: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.score-readonly.s5 {
  color: var(--t0-text);
  background: var(--t0-bg);
  border-color: var(--t0-border);
}

.score-readonly.s4 {
  color: var(--t1-text);
  background: var(--t1-bg);
  border-color: var(--t1-border);
}

.mtpd-select {
  width: 96px;
  padding: 4px 6px;
  font-size: 12px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-T0, .badge-gap, .badge-failed, .badge-open {
  background: var(--t0-bg);
  color: var(--t0-text);
  border-color: var(--t0-border);
}

.badge-T1, .badge-unverified, .badge-partial, .badge-in_progress, .badge-pending {
  background: var(--t1-bg);
  color: var(--t1-text);
  border-color: var(--t1-border);
}

.badge-T2, .badge-planned, .badge-accepted {
  background: var(--t2-bg);
  color: var(--t2-text);
  border-color: var(--t2-border);
}

.badge-T3 {
  background: var(--t3-bg);
  color: var(--t3-text);
  border-color: var(--t3-border);
}

.badge-matched, .badge-passed, .badge-confirmed, .badge-completed, .badge-closed {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}

.asset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 220px;
}

.asset-chip {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Two-column Analysis Grid */
.split-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-pad {
  padding: 16px;
}

.panel-pad h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.spof-row {
  margin-top: 10px;
}

.spof-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.spof-bar {
  height: 7px;
  background: #edf2f7;
  border-radius: 4px;
  overflow: hidden;
}

.spof-bar > span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
}

/* Slide-over Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}

.drawer {
  width: 100%;
  max-width: 620px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.1);
}

.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head h2 {
  margin: 2px 0 0;
  font-size: 16px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
}

.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.section-divider {
  margin: 18px 0 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-weight: 650;
  font-size: 13px;
  color: var(--text);
}

.check-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.check-list.single-col {
  grid-template-columns: 1fr;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  cursor: pointer;
}

.check-item input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--primary);
}

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

/* Toast */
#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #0f172a;
  color: #fff;
  padding: 9px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  z-index: 80;
  display: none;
}

/* Print Layout */
.print-only {
  display: none;
}

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11.5px;
  }
  #app, #drawer-root, #toast {
    display: none !important;
  }
  #print-root {
    display: block !important;
    padding: 0;
  }
  .print-doc h1 {
    font-size: 18px;
    margin: 0 0 6px;
  }
  .print-meta {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 16px;
  }
  .print-meta th, .print-meta td {
    border: 1px solid #64748b;
    padding: 5px 8px;
    text-align: left;
  }
  .print-meta th {
    background: #f1f5f9;
    width: 15%;
  }
  .print-section {
    margin: 14px 0 6px;
    font-size: 13.5px;
    font-weight: 700;
  }
  .print-sign {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  .print-sign div {
    border-top: 1px solid #334155;
    padding-top: 6px;
  }
}

@media (max-width: 1024px) {
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .split-grid, .rubric-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  .nav-tabs {
    overflow-x: auto;
    width: 100%;
  }
  .workspace {
    padding: 14px;
  }
  .grid-2, .grid-4, .check-list {
    grid-template-columns: 1fr;
  }
}

/* Department work queue and focused data entry */
:root {
  --bg: #f5f6f3;
  --text: #1b302d;
  --primary: #176c59;
  --primary-hover: #105341;
  --border: #dbe3dd;
  --radius-lg: 12px;
}
.topbar { height: auto; min-height: 64px; padding-block: 10px; flex-wrap: wrap; }
.brand-mark i { background: #164d40; border-radius: 50%; }
.nav-tab { font-size: 14px; }
.nav-tab.active { background: #e6f1eb; }
.workspace { max-width: 1380px; padding: 32px clamp(16px, 4vw, 64px) 56px; }
.workspace:has(.task-hero) { max-width: 1080px; }
.page-heading, .task-hero, .list-head, .task-row, .issue-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.page-heading { margin: 4px 0 26px; }
.page-heading h1, .task-hero h1 { margin: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; }
.page-heading p, .task-hero p { font-size: 14px; margin: 6px 0 0; color: var(--text-secondary); }
.task-hero { background: #e7efe8; border: 1px solid #d2dfd3; padding: clamp(20px, 3vw, 36px); border-radius: 15px; }
.task-context { color: #326451; font-weight: 650; margin-bottom: 6px; }
.task-hero .btn { margin-top: 19px; padding: 9px 17px; }
.task-progress { min-width: 155px; color: #476050; }
.task-progress strong { color: #214c38; font-size: 32px; font-weight: 650; }
.task-progress progress { display: block; width: 100%; height: 7px; accent-color: var(--primary); margin-top: 4px; }
.list-head { margin: 24px 0 10px; }
.list-head h2 { font-size: 19px; margin: 0; }
.list-head small { font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.task-list { list-style: none; background: #fff; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: 12px; }
.task-row { padding: 14px 20px; }
.task-row + .task-row { border-top: 1px solid var(--border); }
.task-row h3 { margin: 2px 0; font-size: 15px; }
.task-row .btn { flex-shrink: 0; }
.task-meta,.field-hint { color: var(--text-muted); font-size: 12px; }
.done-list, .analysis-fold, .existing-issues, .extra-fields { margin-block: 14px; }
summary { cursor: pointer; color: var(--primary); font-weight: 600; padding: 8px 0; }
.analysis-fold[open] > summary { margin-bottom: 8px; }
.text-link { padding: 12px 0; margin-top: 6px; color: var(--primary); background: transparent; border: 0; cursor: pointer; }
.business-note, .issue-editor { background: var(--surface-subtle); padding: 15px; border: 1px solid var(--border); border-radius: 9px; }
.business-note h3, .business-note p { margin: 0 0 6px; }
.business-note p { white-space: pre-line; }
.stack-label { display: grid; gap: 6px; margin: 12px 0; color: var(--text-secondary); font-weight: 600; }
.stack-label select, .stack-label input, .stack-label textarea { min-width: 0; font-weight: 400; }
.review-heading { margin: 20px 0 6px; }
.review-limit { margin-top: 18px; }
.issue-editor { margin: 12px 0; min-width: 0; }
.issue-editor legend { color: var(--primary); font-weight: 600; }
.issue-editor .grid-2 { gap: 10px; }
.issue-footer { align-items: end; }
.issue-footer .stack-label { flex: 1; margin: 0; }
@media (max-width: 830px) {
  .topbar { position: relative; }
  .topbar-left { width: 100%; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .topbar-right { flex-wrap: wrap; }
}
@media (max-width: 600px) {
  .task-hero, .page-heading { flex-direction: column; align-items: stretch; gap: 15px; }
  .topbar { padding: 12px 14px; gap: 8px; }
  .nav-tabs { width: 100%; }
  .nav-tab { white-space: nowrap; font-size: 13px; padding: 8px; }
  .task-progress { max-width: 220px; }
  .task-progress strong { font-size: 22px; }
  .task-row { padding: 12px; }
  .drawer-head,.drawer-body,.drawer-foot { padding: 12px 14px; }
  .stack-label { min-width: 0; }
  .segmented { max-width: 100%; }
}
.drill-list { display: grid; gap: 14px; }
.drill-card { padding: 18px 22px; margin: 0; }
.drill-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drill-head h2 { font-size: 17px; margin: 4px 0; }
.drill-card details { margin: 5px 0 12px; }
.plan-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.plan-facts dt { color: var(--text-muted); }
.plan-facts dd { margin: 0; }
.dept-rollup { padding: 0; display: flex; gap: 12px; flex-wrap: wrap; list-style: none; }
.dept-rollup li { background: white; padding: 10px; border-radius: 6px; }
.dept-rollup strong { display: block; }
.mobile-score-hint { display: none; }
#toast { pointer-events: none; }
@media (max-width: 600px) {
  .mobile-score-hint { display: block; font-size: 12px; color: var(--text-secondary); font-weight: 400; line-height: 1.5; }
  #toast { bottom: 70px; }
}

/* A process owns the branch, and each nested row represents an activity. */
.tree-controls, .tree-actions { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.process-tree, .tree-nodes { list-style: none; padding: 0; margin: 0; }
.process-tree { display: grid; gap: 12px; }
.tree-branch { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.tree-branch > summary {
  display: grid; grid-template-columns: 9px 20px minmax(0,1fr) auto; align-items: center;
  gap: 11px; padding: 16px 18px; color: var(--text); list-style: none; border-radius: 11px;
}
.tree-branch > summary::-webkit-details-marker { display: none; }
.tree-branch > summary::before {
  content: ''; width: 6px; height: 6px; border: solid var(--text-muted);
  border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg);
}
.tree-branch[open] > summary::before { transform: rotate(45deg); }
.tree-folder { position: relative; width: 19px; height: 13px; border-radius: 2px; background: #c3ddd2; border: 1px solid #75a791; }
.tree-folder::before {
  content: ''; position: absolute; top: -4px; left: -1px; width: 9px; height: 3px;
  background: #c3ddd2; border: 1px solid #75a791; border-bottom: 0; border-radius: 3px 3px 0 0;
}
.tree-process-name { font-size: 15px; }
.tree-count, .tree-state { color: var(--text-muted); font-size: 12px; font-weight: 400; }
.tree-children { padding: 0 18px 10px 46px; }
.tree-activity { position: relative; padding-left: 18px; }
.tree-activity::before, .tree-activity::after { content: ''; position: absolute; left: 0; }
.tree-activity::before { top: 0; bottom: 0; border-left: 1px solid #bfd2c7; }
.tree-activity:last-child::before { bottom: 50%; }
.tree-activity::after { top: 50%; width: 13px; border-top: 1px solid #bfd2c7; }
.tree-activity-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 6px 12px; padding: 9px 0 9px 8px; }
.tree-activity-name { font-weight: 520; overflow-wrap: anywhere; }
.tree-colleagues > summary { font-size: 12px; color: var(--text-secondary); }
.tree-actions .text-link { margin: 0; padding: 9px 0 3px; font-size: 12px; }
.tree-actions .text-link + .text-link { color: var(--text-muted); }
.tree-branch summary:focus-visible, .tree-actions button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 600px) {
  .department-tree .list-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .tree-branch > summary { grid-template-columns: 8px 19px minmax(0,1fr); gap: 4px 8px; padding: 12px; }
  .tree-count { grid-column: 3; }
  .tree-children { padding: 0 12px 9px 25px; }
  .tree-activity-row { grid-template-columns: minmax(0,1fr) auto; column-gap: 6px; }
  .tree-activity-row .tree-state { grid-column: 1; }
  .tree-activity-row button { grid-column: 2; grid-row: 1 / span 2; }
}

.queue-panel { padding: 14px 18px; }
.queue-panel h2 { font-size: 17px; margin: 0 0 10px; }
.ai-results > div { padding-block: 9px; border-bottom: 1px solid var(--border); }
.ai-results dt { font-weight: 650; }
.ai-results dd { color: var(--text-secondary); margin: 4px 0; }
.ai-results blockquote { margin: 6px 0; padding-left: 12px; border-left: 2px solid var(--primary-border); }
