:root {
  color-scheme: light;
  --green: #059347;
  --green-dark: #04703a;
  --green-ink: #059347;
  --green-soft: #e7f6ee;
  --purple: #572463;
  --purple-dark: #3d1846;
  --accent: #572463;
  --paper: #f4f4f5;
  --ink: #1c1720;
  --muted: #6d6572;
  --line: #e6e6e8;
  --white: #fff;
  --danger: #9f1239;
  --danger-fill: #9f1239;
  --warn: #9a6700;
  --warn-bg: #fff7e8;
  --shadow: 0 1px 2px rgba(28, 23, 32, 0.04);
  --pill-bg: #eee;
  --status-neutral: #ececee;
  --status-info: #e7f0ff;
  --status-warn: #fff3d6;
  --status-danger-bg: #ffe4ea;
  --status-purple-bg: #efe7f6;
  --status-amber-bg: #ffe8cc;
  --status-pending-bg: #efe4f3;
  --preview-bg: #f7f3f8;
  --sidebar: 272px;
  --mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 72'%3E%3Cpath fill='%23059347' d='M0 0H22V32A18 18 0 0 0 58 32V0H80V32A40 40 0 0 1 0 32Z'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::placeholder { color: var(--muted); opacity: 1; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  caret-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--paper) inset;
}
select option, select optgroup { background-color: var(--white); color: var(--ink); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--purple);
  color: #fff;
  padding: 16px 12px 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.sidebar::after {
  content: "";
  position: absolute; z-index: 0; pointer-events: none;
  width: 280px; height: 250px;
  inset-inline-start: -70px; bottom: -36px;
  background: var(--mark) center / contain no-repeat;
  opacity: .16;
}
.brand-row, .side-nav, .sidebar-foot { position: relative; z-index: 1; }
.brand-row { display: flex; align-items: center; gap: 6px; padding: 0 4px; }
.brand { display: flex; gap: 10px; align-items: center; color: #fff; min-width: 0; flex: 1; }
.brand strong, .brand small { display: block; }
.brand small { color: rgba(255,255,255,.68); font-size: 12px; }
.mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--paper); color: var(--green);
  display: grid; place-items: center; flex: none;
}
.mark svg { width: 24px; height: 22px; fill: currentColor; stroke: none; }
.mark-lg { width: 72px; height: 72px; border-radius: 20px; background: #fff; }
.mark-lg svg { width: 40px; height: 36px; }
.collapse-nav {
  width: 34px; height: 34px; border: 0; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; flex: none;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; padding-inline-end: 2px; }
.nav-label {
  margin: 14px 8px 4px; color: rgba(255,255,255,.55); font-size: 11px; font-weight: 700;
}
.nav-link {
  display: flex; align-items: center; gap: 10px; position: relative;
  color: rgba(255,255,255,.88); padding: 9px 10px; border-radius: 12px; font-weight: 500;
}
.nav-link svg { color: rgba(255,255,255,.7); flex: none; }
.nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-link.active { background: var(--paper); color: var(--accent); }
.nav-link.active svg { color: var(--green); }
.nav-link.active .nav-count { background: var(--green); color: #fff; }
.nav-count {
  margin-inline-start: auto; background: #fff; color: #2c102f;
  border-radius: 999px; min-width: 20px; text-align: center; font-size: 11px; padding: 1px 6px;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-chip { display: flex; gap: 10px; align-items: center; color: #fff; }
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: rgba(255,255,255,.68); font-size: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.16); color: white;
  display: grid; place-items: center; font-weight: 700; flex: none;
}
.linkish { background: none; border: 0; color: rgba(255,255,255,.72); padding: 0 4px; cursor: pointer; text-align: start; text-decoration: none; }
.linkish:hover { color: #fff; }
html.sidebar-compact { --sidebar: 88px; }
html.sidebar-compact .brand span:last-child,
html.sidebar-compact .nav-link > span,
html.sidebar-compact .nav-label,
html.sidebar-compact .user-chip span,
html.sidebar-compact .linkish { display: none; }
html.sidebar-compact .nav-link, html.sidebar-compact .brand { justify-content: center; }
html.sidebar-compact .sidebar::after { display: none; }
html.sidebar-compact .nav-count {
  position: absolute; top: 4px; inset-inline-end: 4px; margin: 0; min-width: 16px; padding: 0 4px;
}
html[dir="rtl"] .collapse-nav svg,
html.sidebar-compact .collapse-nav svg { transform: scaleX(-1); }
html[dir="rtl"].sidebar-compact .collapse-nav svg { transform: none; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; gap: 14px;
  min-height: 68px; padding: 10px 22px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 160px; }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; color: var(--purple-dark); font-weight: 700; }
.eyebrow { margin: 0; color: var(--green-ink); font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 16px; height: 3px; border-radius: 3px; background: var(--green); flex: none; }
.topbar-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn, .pref {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--white); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.pref { width: auto; padding: 0 12px; font-size: 13px; font-weight: 600; }
.prefs { display: flex; gap: 8px; }
.bell { position: relative; color: var(--ink); }
.bell span {
  position: absolute; top: -4px; inset-inline-end: -4px;
  background: var(--green); color: white; border-radius: 999px; font-size: 11px; padding: 0 5px; line-height: 16px;
}
.profile { position: relative; }
#profile-toggle { width: 52px; height: 52px; border-radius: 16px; }
#profile-toggle svg { width: 28px; height: 28px; }
.profile-menu {
  display: none;
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; z-index: 40;
  width: min(260px, calc(100vw - 28px));
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(48, 24, 56, 0.16);
  padding: 8px;
}
.profile.is-open .profile-menu { display: flex; flex-direction: column; }
.profile-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.profile-head strong, .profile-head small { display: block; }
.profile-head strong { font-size: 15px; }
.profile-head small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.profile-menu form { margin: 0; }
.profile-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border: 0; border-radius: 10px;
  background: none; color: inherit; text-align: start; text-decoration: none;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
}
.profile-item:hover { background: color-mix(in srgb, var(--green) 8%, var(--white)); }
.profile-item-danger { color: var(--danger); }
.notify { position: relative; }
.notify-panel {
  display: none;
  position: absolute; top: calc(100% + 10px); inset-inline-end: 0; z-index: 40;
  width: min(380px, calc(100vw - 28px));
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 44px rgba(48, 24, 56, 0.16);
  overflow: hidden;
}
.notify.is-open .notify-panel { display: flex; flex-direction: column; }
.notify-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.notify-head strong { font-size: 15px; }
.notify-head a { font-size: 13px; font-weight: 600; }
.notify-list { max-height: 360px; overflow: auto; padding: 8px; }
.notify-item { display: block; padding: 10px 12px; border-radius: 12px; color: inherit; }
.notify-item:hover { background: color-mix(in srgb, var(--green) 8%, var(--white)); }
.notify-item strong, .notify-item time, .notify-item p { display: block; }
.notify-item strong { font-size: 14px; }
.notify-item time { color: var(--muted); font-size: 12px; }
.notify-item p {
  margin: 4px 0 0; color: var(--muted); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notify-item.unread { background: var(--green-soft); }
.notify-empty { margin: 0; padding: 28px 12px; text-align: center; }
.notify-foot { margin: 0; padding: 8px; border-top: 1px solid var(--line); }
.notify-foot .btn { width: 100%; padding: 8px 10px; font-size: 13px; }
.notify-enable { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; }
.notice-popups { position: fixed; z-index: 60; bottom: 18px; inset-inline-end: 18px; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 28px)); }
.notice-popup { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; background: var(--white); color: inherit; border: 1px solid var(--line); border-inline-start: 4px solid var(--green); border-radius: 16px; box-shadow: 0 16px 40px rgba(48, 24, 56, .18); padding: 12px 12px 12px 14px; animation: notice-in .18s ease; }
.notice-popup a { color: inherit; min-width: 0; }
.notice-popup strong { display: block; font-size: 14px; }
.notice-popup p { margin: 4px 0 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notice-popup button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
@keyframes notice-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.menu-toggle { display: none; }
.backdrop { display: none; }
.nav-create { white-space: nowrap; }

.messages { padding: 12px 22px 0; }
.toast { margin: 0 0 8px; padding: 10px 12px; border-radius: 12px; background: var(--white); border: 1px solid var(--line); }
.toast-success { border-inline-start: 4px solid var(--green); }
.toast-error { border-inline-start: 4px solid var(--danger); }
.content { padding: 16px 22px 40px; }

.intro, .note { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; border-inline-start: 4px solid var(--green); }
.intro { border-inline-start-width: 0; border-top: 3px solid var(--green); }
.card:hover { border-color: var(--green); }
tbody tr:hover td { background: color-mix(in srgb, var(--green) 7%, transparent); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 16px;
  display: flex; flex-direction: column; gap: 6px; min-height: 104px;
  box-shadow: var(--shadow);
}
.card span { color: var(--muted); font-size: 13px; }
.card strong, .metric-copy b, .num {
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
}
.card strong { font-size: 28px; color: var(--accent); }
td.num, dd.num { white-space: nowrap; }
.form-grid .check input { width: auto; }
.muted { color: var(--muted); margin: 0; }
.panel {
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.panel h2 { margin: 0 0 12px; font-size: 17px; color: var(--purple-dark); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.row-actions .btn { padding: 6px 10px; font-size: 13px; }
.table-wrap { overflow-x: auto; }
.bulk-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bulk-tools { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; flex: 1; }
.bulk-tools label { display: grid; gap: 4px; margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.bulk-tools label[hidden], .bulk-tools [hidden] { display: none; }
.action-menu { position: relative; align-self: flex-end; }
.action-menu-toggle { display: inline-flex; align-items: center; gap: 8px; }
.action-menu-toggle::after {
  content: ""; width: 7px; height: 7px; flex: none;
  border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); margin-bottom: 3px;
}
.action-menu-list {
  position: absolute; top: calc(100% + 8px); inset-inline-start: 0; z-index: 30;
  min-width: 240px; display: flex; flex-direction: column;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 44px rgba(48, 24, 56, 0.16); padding: 8px;
}
.action-menu-item {
  width: 100%; border: 0; background: none; color: inherit; text-align: start;
  padding: 9px 10px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
}
.action-menu-item:hover { background: color-mix(in srgb, var(--green) 8%, var(--white)); }
.confirm-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: min(90vh, 640px);
  margin: auto;
  border: 0;
  border-radius: 22px;
  padding: 22px 22px 18px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(28, 23, 32, 0.28);
  overflow: auto;
}
.confirm-dialog[open] { display: flex; flex-direction: column; }
.confirm-dialog::backdrop {
  background: rgba(28, 23, 32, 0.48);
  backdrop-filter: blur(4px);
}
.confirm-icon {
  width: 48px; height: 48px; border-radius: 16px; margin-bottom: 14px;
  display: grid; place-items: center;
  background: var(--green-soft); color: var(--green-dark);
}
.confirm-dialog.is-danger .confirm-icon { background: var(--status-danger-bg); color: var(--danger); }
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-dialog h2 { margin: 0 0 8px; font-size: 20px; color: var(--purple-dark); }
.confirm-dialog [data-confirm-body] { margin: 0 0 14px; color: var(--muted); }
.confirm-count {
  align-self: flex-start; margin: 0 0 16px;
  background: var(--paper); color: var(--purple-dark);
  border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700;
}
.confirm-reason { display: grid; gap: 6px; margin: 0 0 16px; font-size: 13px; font-weight: 700; color: var(--muted); }
.confirm-reason[hidden], .confirm-dialog [hidden] { display: none; }
.confirm-reason textarea {
  width: 100%; min-height: 96px; resize: vertical;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  padding: 10px 12px; font-weight: 600; color: var(--ink);
}
.confirm-reason textarea.is-invalid { border-color: var(--danger); background: #fff5f7; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.bulk-tools select, .bulk-tools textarea {
  width: 240px; border: 1px solid var(--line); background: var(--paper);
  border-radius: 12px; padding: 8px 10px; color: var(--ink); font-weight: 600;
}
.bulk-tools textarea { min-height: 42px; height: 42px; resize: vertical; }
.pick { width: 36px; text-align: center; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); appearance: auto; -webkit-appearance: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 11px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; background: var(--pill-bg); color: var(--ink); font-size: 12px; font-weight: 600; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.status-draft, .status-cancelled { background: var(--status-neutral); }
.status-submitted { background: var(--status-info); }
.status-returned { background: var(--status-warn); }
.status-office_rejected, .status-rejected_final, .status-execution_failed { background: var(--status-danger-bg); color: var(--danger); }
.status-office_approved { background: var(--status-purple-bg); }
.status-accountant_rejected, .status-escalated, .status-appealed { background: var(--status-amber-bg); }
.status-pending_execution { background: var(--status-pending-bg); color: var(--accent); }
.status-completed, .status-auto { background: var(--green-soft); color: var(--green-dark); }
.status-extra { background: var(--status-purple-bg); color: var(--accent); }

.filter-bar, .filters {
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.filter-grid label, .field label, .stack label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin: 0 0 14px; }
.role-table { min-width: 760px; }
.perm-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.perm-table th, .perm-table td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.perm-table th:not(:first-child), .perm-table td:not(:first-child) { text-align: center; width: 140px; }
.perm-table input { margin-inline: auto; }
.fold, .group-fold {
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); margin-bottom: 10px;
}
.group-fold { background: var(--white); }
.group-fold .group-fold { margin-inline-start: 12px; background: var(--paper); }
.fold > summary, .group-fold > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-weight: 700;
}
.fold > summary::-webkit-details-marker, .group-fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before, .group-fold > summary::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); margin-bottom: 3px;
}
html[dir="rtl"] .fold > summary::before,
html[dir="rtl"] .group-fold > summary::before { transform: rotate(-45deg); }
.fold[open] > summary::before, .group-fold[open] > summary::before { transform: rotate(-45deg); margin-bottom: 0; }
html[dir="rtl"] .fold[open] > summary::before,
html[dir="rtl"] .group-fold[open] > summary::before { transform: rotate(45deg); }
.fold .filter-grid, .group-fold .table-wrap { padding: 0 12px 12px; }
.fold .check-row { margin: 0; padding: 0 12px 12px; }
.fold-note, .group-count { margin: 0 12px 12px; font-size: 13px; }
.group-count { margin: 0 0 12px; }
.group-meta { margin-inline-start: auto; color: var(--muted); font-weight: 600; font-size: 13px; }
.filter-grid input:not([type="checkbox"]):not([type="radio"]), .filter-grid select,
.filters input:not([type="checkbox"]):not([type="radio"]), .filters select,
.form-grid input:not([type="checkbox"]):not([type="radio"]), .form-grid select, .form-grid textarea,
.stack input:not([type="checkbox"]):not([type="radio"]), .stack select, .stack textarea,
.auth-card input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px;
}
.form-grid input[type="checkbox"], .form-grid input[type="radio"] {
  appearance: auto; -webkit-appearance: auto;
  width: 18px; height: 18px; min-width: 18px; margin: 0; padding: 0; flex: none;
  accent-color: var(--green);
}
.form-grid .switch-row input {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 26px; min-width: 44px; padding: 0;
  border: 0; border-radius: 999px; background: #d5d0d8; accent-color: auto;
}
.form-grid .switch-row input:checked { background: var(--green); }
.form-grid .office-choices { display: grid; gap: 8px; margin: 0; }
.form-grid .field .office-choices label {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  font-weight: 600; cursor: pointer;
}
.form-grid .office-choices label:has(input:checked) {
  border-color: var(--green); background: var(--green-soft);
}
.field:has(> input[type="checkbox"]) {
  display: flex; align-items: center; justify-content: flex-start; gap: 8px;
}
.field:has(> input[type="checkbox"]) label { margin: 0; }
.filter-grid input:not([type="checkbox"]):not([type="radio"]):focus, .filter-grid select:focus,
.filters input:not([type="checkbox"]):not([type="radio"]):focus, .filters select:focus,
.form-grid input:not([type="checkbox"]):not([type="radio"]):focus, .form-grid select:focus, .form-grid textarea:focus,
.stack input:not([type="checkbox"]):not([type="radio"]):focus, .stack select:focus, .stack textarea:focus,
.auth-card input:focus {
  outline: none; border-color: var(--accent); background: var(--white);
}
.filters { display: block; }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.check input { width: auto; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 12px 0; }
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; }
.matrix input { width: auto; }
.status-names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }
.status-name { display: grid; gap: 6px; margin: 0; font-weight: 600; font-size: 13px; min-width: 0; }
.status-name input { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px; }
.status-toolbar {
  position: sticky; top: 73px; z-index: 5; display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; padding: 8px 0; background: var(--paper);
}
.status-create { display: flex; align-items: end; gap: 8px; margin-bottom: 8px; }
.status-create label { flex: 1; display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.status-create input { width: 100%; border: 1px solid var(--line); background: var(--white); border-radius: 12px; padding: 10px 12px; }
.status-create-note { margin-bottom: 14px; }
.status-step.is-stopped { opacity: .55; }
.status-stop { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.status-rail {
  display: flex; gap: 8px; flex: 1; min-width: 0; overflow-x: auto;
  padding: 2px 2px 6px;
}
.status-step {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto; text-align: start;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 12px; cursor: pointer; color: inherit;
}
.status-step[aria-pressed="true"] { background: var(--preview-bg); border-color: var(--accent); }
.status-step:hover { border-color: var(--accent); }
.status-order {
  width: 26px; height: 26px; border-radius: 8px; background: var(--paper); color: var(--purple-dark);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none;
}
.status-step[aria-pressed="true"] .status-order { background: var(--accent); color: #fff; }
.status-step-copy { min-width: 0; }
.status-step-copy strong { font-size: 14px; line-height: 1.35; white-space: nowrap; }
.switch-row small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.stage-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(320px, 480px) auto;
  gap: 14px; align-items: end; margin-bottom: 16px;
}
.stage-head .status-order { align-self: center; }
.stage-title h2 { margin: 0; }
.stage-title .muted { margin-top: 4px; }
.stage-switches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stage-switches .switch-row {
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--paper);
}
.status-toolbar .btn { flex: none; }
.stage-card { margin-top: 18px; }
.stage-card h3 { margin: 0 0 8px; font-size: 16px; color: var(--purple-dark); }
.stage-card .muted { margin-bottom: 10px; }
.stage-matrix { width: 100%; border-collapse: collapse; background: var(--white); }
.stage-matrix th, .stage-matrix td {
  border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: center; font-size: 13px;
}
.stage-matrix th:first-child, .stage-matrix td:first-child { text-align: start; }
.stage-matrix thead th { color: var(--muted); font-size: 12px; font-weight: 700; }
.stage-matrix tbody th { font-weight: 700; }
.stage-matrix input { width: 18px; height: 18px; margin: 0; }
.action-table { display: flex; flex-direction: column; gap: 8px; }
.action-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--paper);
}
.action-name { display: grid; gap: 2px; min-width: 0; }
.action-name strong { font-size: 14px; line-height: 1.35; }
.action-name small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.action-add {
  display: flex; align-items: end; gap: 8px; margin-bottom: 12px;
}
.action-add label { flex: 1; display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.action-add input, .action-add select { width: 100%; border: 1px solid var(--line); background: var(--white); border-radius: 12px; padding: 10px 12px; }
.action-remove {
  justify-self: start; margin-top: 4px; border: 0; background: transparent;
  color: var(--danger); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; padding: 0;
}
.action-row .role-picks { grid-column: 1 / -1; margin-top: 0; }
.action-row .file-tick { grid-column: 2; grid-row: 1; }
.file-tick {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--white);
  font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.file-tick input { width: 16px; height: 16px; margin: 0; }
.file-tick:has(input:checked) { background: var(--green-soft); color: var(--green-dark); border-color: transparent; }
.file-pick {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "btn title" "btn hint" "names names";
  gap: 2px 12px; align-items: center; cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 14px; padding: 10px 12px; background: var(--paper);
}
.decide-now .file-pick { margin-bottom: 8px; }
.file-pick input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}
.file-pick-btn {
  grid-area: btn; justify-self: start;
  border: 1px solid var(--line); border-radius: 999px; background: var(--white);
  padding: 8px 12px; font-size: 13px; font-weight: 700; color: var(--accent);
}
.file-pick-title { grid-area: title; font-weight: 700; }
.file-pick-hint { grid-area: hint; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.4; }
.file-pick-names { grid-area: names; color: var(--green-dark); font-size: 13px; font-weight: 700; }
.file-pick-names:empty { display: none; }
.file-pick.has-files { border-style: solid; border-color: var(--green); background: var(--green-soft); }
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.switch-row span { display: grid; gap: 2px; min-width: 0; }
.switch-row strong { font-size: 14px; }
.switch-row input {
  appearance: none; width: 44px; height: 26px; margin: 0; padding: 0; flex: none;
  border: 0; border-radius: 999px; background: #d5d0d8; position: relative; cursor: pointer;
}
.switch-row input::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; inset-inline-start: 3px; transition: inset-inline-start .15s ease;
}
.switch-row input:checked { background: var(--green); }
.switch-row input:checked::after { inset-inline-start: 21px; }
.switch-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.role-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.role-picks-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.role-chip { position: relative; cursor: pointer; }
.role-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.role-chip span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-weight: 600; font-size: 13px;
}
.role-chip input:checked + span { background: var(--green-soft); color: var(--green-dark); border-color: transparent; }
.role-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-editor .panel-head { justify-content: flex-start; }
.status-editor .panel-head h2 { margin: 0; }
.status-editor[hidden] { display: none; }
.btn {
  border: 0; background: var(--purple); color: white; border-radius: 12px;
  padding: 10px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost:hover { filter: none; border-color: var(--accent); background: var(--paper); }
.btn-primary { background: var(--green); }
.btn-danger { background: var(--danger-fill); }
.btn-ghost { background: var(--white); color: var(--accent); border: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-section {
  grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin: 0; padding: 16px 0 2px; border-top: 1px solid var(--line);
}
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section[hidden] { display: none; }
.form-section h2 { grid-column: 1 / -1; margin: 0; font-size: 16px; }
.form-section .lead, .form-section .choice-note, .lead { margin: 0; color: var(--muted); font-size: 13px; }
.form-section .lead, .form-section .choice-note { grid-column: 1 / -1; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.req { color: var(--danger); font-weight: 700; }
.locked-value {
  margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--paper);
  border: 1px solid var(--line); font-weight: 600;
}
.inline-action { margin-top: 8px; }
.wide { grid-column: 1 / -1; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row input { flex: 1; min-width: 0; width: auto; }
.claim-form { display: flex; flex-direction: column; gap: 14px; max-width: 880px; }
.claim-block {
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
}
.claim-block[hidden], .claim-fields[hidden] { display: none; }
.claim-block-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.claim-step {
  width: 28px; height: 28px; border-radius: 9px; background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none;
}
.claim-block h2 { margin: 0; font-size: 16px; color: var(--purple-dark); }
.claim-block h3 { margin: 0 0 10px; font-size: 14px; }
.claim-block .lead { margin: 4px 0 0; }
.claim-block .note { margin-bottom: 12px; }
.claim-fields, .money { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.claim-fields:has(> .field:only-child) { grid-template-columns: 1fr; }
.money:has(> .field:only-child) { grid-template-columns: minmax(0, 320px); }
.money { margin-top: 14px; }
.claim-fields + .claim-fields { margin-top: 14px; }
.lookup { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.lookup .btn { height: 42px; white-space: nowrap; }
.area-pick { position: relative; }
.merchant-chosen {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--green-soft);
}
.merchant-chosen[hidden], #merchant-search[hidden] { display: none; }
.merchant-chosen strong, .merchant-chosen span { display: block; }
.merchant-chosen span { margin-top: 2px; color: var(--muted); font-size: 13px; }
.merchant-chosen .btn { flex: none; }
.area-results {
  position: absolute; z-index: 8; inset-inline: 0; top: calc(100% + 4px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 260px; overflow: auto;
}
.area-results[hidden] { display: none; }
.area-results button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: start; background: transparent; border: 0; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font: inherit; color: inherit;
}
.area-results button small { color: var(--muted); font-size: 12px; }
.area-results button:hover, .area-results button[aria-selected="true"] { background: var(--green-soft); }
.area-results .area-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.type-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.type-pick {
  display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--paper);
}
.type-pick input { width: auto; margin-top: 3px; accent-color: var(--green); flex: none; }
.type-pick strong, .type-pick small { display: block; }
.type-pick small { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.type-pick:has(input:checked) {
  border-color: var(--green); background: var(--green-soft);
}
.type-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.claim-form input:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
.claim-form select, .claim-form textarea {
  width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px;
}
.claim-form input:focus, .claim-form select:focus, .claim-form textarea:focus {
  outline: none; border-color: var(--accent); background: var(--white);
}
.claim-preview { margin-top: 14px; background: var(--paper); border-radius: 14px; padding: 14px; }
.claim-preview .facts { margin-top: 0; }
.claim-preview .lead, .claim-preview .note { margin-top: 10px; }
.upload-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px;
}
.upload-grid:empty { display: none; }
.upload-card {
  position: relative; margin: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
}
.upload-card img, .upload-card video {
  display: block; width: 100%; height: 140px; object-fit: cover; background: var(--white);
}
.upload-card figcaption, .upload-file {
  display: block; padding: 8px 10px 10px; font-size: 12px; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.upload-file {
  display: grid; place-items: center; min-height: 140px; padding: 12px;
  white-space: normal; text-align: center;
}
.upload-remove {
  position: absolute; top: 8px; inset-inline-end: 8px;
  border: 0; border-radius: 999px; background: var(--danger); color: #fff;
  font: inherit; font-size: 12px; line-height: 1; padding: 6px 10px; cursor: pointer;
}
.upload-toolbar { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
#attachment-note { display: block; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.file-drop {
  display: flex; flex-direction: column; gap: 8px; cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 16px; padding: 16px; background: var(--paper);
}
.file-drop small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.claim-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px;
}
.claim-actions .lead { margin: 0; max-width: 460px; }
.claim-actions .actions { margin-inline-start: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-error, .errorlist { color: var(--danger); margin: 0 0 8px; padding: 0; }
.preview { background: var(--preview-bg); border-radius: 12px; padding: 12px; }
.split { display: grid; grid-template-columns: 1.3fr .8fr; gap: 14px; }
.detail-head, .amounts { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.reason-banner {
  background: var(--white); border: 1px solid var(--line); border-inline-start: 4px solid var(--green);
  border-radius: 16px; padding: 14px 16px; margin-bottom: 14px;
}
.reason-banner.is-warn { border-inline-start-color: var(--warn); background: var(--warn-bg); }
.reason-banner.is-reject { border-inline-start-color: var(--danger); background: var(--status-danger-bg); }
.reason-kicker { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.reason-banner.is-warn .reason-kicker { color: var(--warn); }
.reason-banner.is-reject .reason-kicker { color: var(--danger); }
.reason-text { margin: 6px 0 0; font-size: 17px; font-weight: 700; line-height: 1.55; }
.reason-meta { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.amounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.amounts article { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.amounts span { color: var(--muted); display: block; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.facts div { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.decide { display: flex; flex-direction: column; gap: 8px; }
.decide-note { margin: 0 0 2px; color: var(--muted); font-size: 13px; }
.decide-now { margin: 0; }
.decide-now button {
  width: 100%; display: flex; text-align: start; cursor: pointer; font: inherit;
  border: 0; border-radius: 14px; padding: 12px 14px; background: var(--green); color: #fff;
}
.decide-now button strong, .decide-now button small,
.decide-item summary strong, .decide-item summary small { display: block; }
.decide-now button small { margin-top: 2px; font-size: 12px; font-weight: 500; color: rgba(255,255,255,.88); }
.decide-now.tone-quiet button {
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
}
.decide-now.tone-quiet button small { color: var(--muted); }
.decide-item {
  border: 1px solid var(--line); border-radius: 14px; background: var(--white);
}
.decide-item summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none;
}
.decide-item summary::-webkit-details-marker { display: none; }
.decide-item summary span { min-width: 0; }
.decide-item summary small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 500; }
.decide-item summary::after {
  content: ""; margin-inline-start: auto; width: 8px; height: 8px; flex: none;
  border-inline-end: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); margin-bottom: 4px;
}
html[dir="rtl"] .decide-item summary::after { transform: rotate(-45deg); }
.decide-item[open] summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
html[dir="rtl"] .decide-item[open] summary::after { transform: rotate(135deg); }
.decide-item[open] { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.decide-item.tone-no summary strong { color: var(--danger); }
.decide-item.tone-no[open] { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.decide > :not(.decide-note):not(.is-quiet) + .is-quiet {
  margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line);
}
.decide-body { display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; }
.decide-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.decide-body input:not([type="file"]), .decide-body select, .decide-body textarea {
  width: 100%; border: 1px solid var(--line); background: var(--paper);
  border-radius: 12px; padding: 10px 12px; font-weight: 500;
}
.decide-body textarea { min-height: 84px; resize: vertical; }
.decide-body input:focus, .decide-body select:focus, .decide-body textarea:focus {
  outline: none; border-color: var(--accent); background: var(--white);
}
.decide-body .btn { width: 100%; }
.decide-now button:focus-visible, .decide-item summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.shot { display: block; width: min(100%, 280px); margin-top: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); }
.split-even { grid-template-columns: 1fr 1fr; }
.split-board { grid-template-columns: 1.45fr .85fr; align-items: start; }
.board-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
@media (min-width: 861px) { .board-create { display: none; } }
.board-lead, .board-note { margin: 0; color: var(--muted); }
.board-note { margin: -2px 0 14px; font-size: 13px; }
.board-side { display: flex; flex-direction: column; gap: 14px; }
.board-side .panel { margin-bottom: 0; }
.board-side .facts { grid-template-columns: 1fr; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 14px; }
.metric {
  display: flex; align-items: center; gap: 12px; min-height: 92px;
  background: var(--white); border: 1px solid var(--line); border-radius: 18px;
  padding: 14px 16px; box-shadow: var(--shadow); color: inherit;
}
a.metric:hover { border-color: var(--green); }
.metric-icon {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center; background: var(--green-soft); color: var(--green-dark);
}
.metric-icon svg { width: 20px; height: 20px; }
.metric-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.metric-copy b { font-size: 26px; line-height: 1.15; color: var(--purple-dark); }
.metric-copy span { color: var(--muted); font-size: 13px; font-weight: 600; }
.metric-copy small { color: var(--ink); font-size: 13px; font-weight: 700; }
.tone-office .metric-icon { background: var(--status-info); color: var(--accent); }
.tone-accountant .metric-icon { background: var(--status-purple-bg); color: var(--accent); }
.tone-alert .metric-icon { background: var(--status-amber-bg); color: var(--warn); }
.tone-run .metric-icon { background: var(--status-pending-bg); color: var(--accent); }
.tone-done .metric-icon { background: var(--green-soft); color: var(--green-dark); }
.pipeline { display: flex; flex-direction: column; gap: 8px; }
.pipe {
  display: grid; grid-template-columns: minmax(150px, 230px) minmax(0, 1fr) auto;
  gap: 12px; align-items: center; color: inherit; padding: 4px 0;
}
.pipe-label { font-weight: 600; font-size: 14px; }
.pipe:hover .pipe-label { color: var(--accent); }
.pipe-track, .rank-track {
  height: 8px; border-radius: 999px; background: var(--paper); overflow: hidden;
}
.rank-track { height: 6px; margin-top: 6px; }
.pipe-fill, .rank-fill { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.pipe-count { min-width: 2.5ch; text-align: end; color: var(--purple-dark); font-variant-numeric: tabular-nums; }
.quiet-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quiet-step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: var(--paper);
  color: var(--muted); font-size: 12px; font-weight: 600;
}
.quiet-step b { color: var(--ink); font-weight: 700; }
.quiet-step:hover { color: var(--accent); }
.rank-name { font-weight: 600; }
.panel-scroll { max-height: 380px; overflow: auto; }
.stat-list, .attention { list-style: none; margin: 0; padding: 0; }
.stat-list li, .attention a {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); color: inherit; font-weight: 600;
}
.stat-list li:first-child, .attention li:first-child a { padding-top: 2px; }
.stat-list li:last-child, .attention li:last-child a { border-bottom: 0; padding-bottom: 0; }
.stat-list span, .attention span { color: var(--muted); font-weight: 600; }
.stat-list strong, .attention strong { color: var(--purple-dark); font-size: 18px; font-variant-numeric: tabular-nums; }
.attention .is-zero { color: var(--muted); font-weight: 600; }
.stat-list .is-hot { color: var(--danger); }
.attention a:hover span { color: var(--accent); }
.path { list-style: none; margin: 0; padding: 0; }
.path-step { display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 12px; }
.path-mark { position: relative; }
.path-mark::before {
  content: ""; position: absolute; inset-inline-start: 7px; top: 0; bottom: 0; width: 2px; background: var(--line);
}
.path-step:first-child .path-mark::before { top: 18px; }
.path-step:last-child .path-mark::before { bottom: auto; height: 18px; }
.path-step:only-child .path-mark::before { display: none; }
.path-mark::after {
  content: ""; position: absolute; z-index: 1; top: 16px; inset-inline-start: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--white); border: 3px solid var(--accent);
}
.path-step:last-child .path-mark::after { border-color: var(--green); background: var(--green-soft); }
.path-card { background: var(--paper); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.path-step:last-child .path-card { margin-bottom: 0; background: var(--white); border: 1px solid var(--line); }
.path-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.path-head time, .note-card header time { margin-inline-start: auto; color: var(--muted); font-size: 12px; }
.path-meta { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.path-note { margin: 8px 0 0; }
.talk-list { display: flex; flex-direction: column; gap: 8px; }
.note-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--paper); }
.note-card header { display: flex; align-items: flex-start; gap: 8px; }
.note-title { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; flex: 1; }
.note-title strong, .note-card header time { white-space: nowrap; }
.note-card p { margin: 8px 0 0; }
.who {
  width: 28px; height: 28px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: var(--status-purple-bg); color: var(--accent);
  font-size: 13px; font-weight: 700;
}
.appeal-open { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.appeal-approved { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.appeal-resolution { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.appeal-resolution strong { color: var(--ink); }
.talk-empty {
  margin: 0; padding: 18px 12px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 14px;
}
.talk-compose { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.talk-compose textarea {
  width: 100%; min-height: 84px; resize: vertical;
  border: 1px solid var(--line); background: var(--paper); border-radius: 12px; padding: 10px 12px;
}
.talk-compose textarea:focus { outline: none; border-color: var(--accent); background: var(--white); }
.timeline, .files, .plain { margin: 0; padding: 0 18px 0 0; }
html[dir="ltr"] .timeline, html[dir="ltr"] .files, html[dir="ltr"] .plain { padding: 0 0 0 18px; }
.timeline li, .comment, .notice { margin-bottom: 12px; }
.changelog-panel { padding: 0; }
.changelog-panel > summary {
  display: list-item; list-style: none; cursor: pointer;
  padding: 16px 18px; font-size: 17px; font-weight: 700;
}
.changelog-panel > summary::-webkit-details-marker { display: none; }
.changelog-summary { display: flex; align-items: center; gap: 8px; }
.changelog-summary::before {
  content: ""; width: 7px; height: 7px; flex: none;
  border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); margin-bottom: 3px;
}
html[dir="rtl"] .changelog-summary::before { transform: rotate(-45deg); }
.changelog-panel[open] .changelog-summary::before { transform: rotate(-45deg); margin-bottom: 0; }
html[dir="rtl"] .changelog-panel[open] .changelog-summary::before { transform: rotate(45deg); }
.changelog-count { margin-inline-start: auto; font-size: 13px; font-weight: 600; }
.changelog-body { padding: 0 18px 16px; }
.changelog-note { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.changelog { list-style: none; margin: 0; padding: 0; }
.changelog-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 12px;
  padding-bottom: 10px;
}
.changelog-item:last-child { padding-bottom: 0; }
.changelog-rail { position: relative; }
.changelog-rail::before {
  content: "";
  position: absolute;
  inset-inline-start: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.changelog-item:first-child .changelog-rail::before { top: 18px; }
.changelog-item:last-child .changelog-rail::before { bottom: auto; height: 18px; }
.changelog-item:only-child .changelog-rail::before { display: none; }
.changelog-mark {
  width: 14px; height: 14px; margin-top: 16px; border-radius: 50%;
  background: var(--white); border: 3px solid var(--accent); position: relative; z-index: 1;
}
.action-create .changelog-mark { border-color: var(--green); }
.action-delete .changelog-mark { border-color: var(--danger); }
.changelog-card { background: var(--paper); border-radius: 14px; padding: 12px 14px; }
.changelog-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.changelog-head time, .changelog-actor, .changelog-detail { color: var(--muted); font-size: 13px; }
.changelog-actor { margin-inline-start: auto; }
.changelog-diffs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.changelog-diffs li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  background: var(--white); border-radius: 10px; padding: 8px 10px;
}
.changelog-field { min-width: 128px; color: var(--muted); font-size: 13px; font-weight: 700; }
.changelog-old, .changelog-new { overflow-wrap: anywhere; }
.changelog-old { color: var(--muted); text-decoration: line-through; }
.changelog-new { font-weight: 700; }
.changelog-arrow::before { content: "←"; color: var(--accent); font-weight: 700; }
html[dir="ltr"] .changelog-arrow::before { content: "→"; }
.pill.changelog-create { background: var(--green-soft); color: var(--green-dark); }
.pill.changelog-update { background: var(--status-purple-bg); color: var(--accent); }
.pill.changelog-delete { background: var(--status-danger-bg); color: var(--danger); }
.comment, .notice { display: block; background: var(--paper); border-radius: 14px; padding: 12px; color: inherit; }
.notice.unread { border-inline-start: 4px solid var(--green); }
.muted, .empty { color: var(--muted); }
.missing {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 36px 20px 32px;
  background:
    radial-gradient(circle at top, color-mix(in srgb, var(--purple) 14%, transparent), transparent 58%),
    var(--white);
  border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.missing-code {
  margin: 0; font-size: 64px; line-height: 1; font-weight: 700; letter-spacing: -2px; color: var(--accent);
}
.missing h2 { margin: 0; font-size: 28px; }
.missing p { max-width: 440px; margin: 0 0 8px; color: var(--muted); }
.missing .actions { justify-content: center; }
.missing-card { text-align: center; }
.missing-card .btn { margin-top: 8px; }
.pager-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; color: var(--muted); flex-wrap: wrap; }
.pager-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-size { margin: 0; }
.page-size label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.page-size select { width: auto; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 6px 8px; }
.page-gap { color: var(--muted); padding: 0 2px; }
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pager a, .page-current {
  min-width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 0 8px;
}
.page-current { background: var(--purple); color: white; border-color: var(--purple); }
.auth-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 20px;
  background: #572463;
}
.auth-pane {
  width: min(420px, 100%);
  margin: auto;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}
.auth-intro { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; text-align: center; }
.auth-lockup { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-lockup .mark { background: #fff; color: #059347; box-shadow: 0 10px 24px rgba(28, 16, 36, 0.18); }
.auth-word { display: flex; align-items: baseline; justify-content: center; gap: 8px; line-height: 1; }
.auth-word strong, .auth-word span { display: inline; font-size: 26px; }
.auth-word strong { font-weight: 700; }
.auth-word span { font-weight: 500; color: rgba(255,255,255,.86); }
.auth-intro p { margin: 0; color: rgba(255,255,255,.78); font-size: 15px; }
.auth-card {
  width: 100%; background: #fff; color: #1c1720;
  --paper: #f4f4f5; --ink: #1c1720; --muted: #6d6572; --line: #e6e6e8;
  --white: #fff; --purple-dark: #3d1846; --accent: #572463; --danger: #9f1239;
  border: 0; border-radius: 24px; padding: 22px 24px 24px;
  box-shadow: 0 18px 48px rgba(28, 16, 36, 0.22);
}
.auth-card h1 { margin: 0 0 6px; color: #3d1846; font-size: 28px; }
.auth-card .muted { margin: 0; }
.auth-card .prefs { justify-content: flex-start; margin-bottom: 16px; }
.auth-card form { display: flex; flex-direction: column; }
.auth-card .form-error { margin: 12px 0 0; }
.auth-card label { font-weight: 600; font-size: 13px; margin-top: 12px; }
.auth-card .btn { width: 100%; margin-top: 18px; }

html[data-theme="dark"] .when-light, html:not([data-theme="dark"]) .when-dark { display: none; }
html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #100d13;
  --ink: #f7f2f8;
  --muted: #cfc4d3;
  --line: #564863;
  --white: #261e2e;
  --green-soft: #143528;
  --green-ink: #6ed9a4;
  --green-dark: #8ee0b2;
  --purple-dark: #f0d0f6;
  --accent: #e7c0ef;
  --danger: #ff8eab;
  --danger-fill: #a31845;
  --warn: #f2c56e;
  --warn-bg: #3e3012;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --pill-bg: #3a3144;
  --status-neutral: #3a3144;
  --status-info: #1c3354;
  --status-warn: #4a3916;
  --status-danger-bg: #4e2433;
  --status-purple-bg: #3d2a4c;
  --status-amber-bg: #4a3514;
  --status-pending-bg: #3d2a4c;
  --preview-bg: #312838;
}
html[data-theme="dark"] .mark { background: #f4f4f5; color: #059347; }
html[data-theme="dark"] .nav-link.active { background: #f4f4f5; color: var(--purple); }
html[data-theme="dark"] .nav-link.active svg { color: var(--green); }
html[data-theme="dark"] .nav-link.active .nav-count { background: var(--green); color: #fff; }

@media (max-width: 1100px) {
  .filter-grid, .cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .auth-word strong, .auth-word span { font-size: 22px; }
  .shell { grid-template-columns: 1fr; }
  .menu-toggle { display: grid; }
  .collapse-nav { display: none; }
  html.sidebar-compact { --sidebar: 272px; }
  html.sidebar-compact .brand span:last-child,
  html.sidebar-compact .nav-link > span,
  html.sidebar-compact .nav-label,
  html.sidebar-compact .user-chip span { display: block; }
  html.sidebar-compact .linkish { display: inline; }
  html.sidebar-compact .nav-count { position: static; margin-inline-start: auto; }
  .sidebar {
    position: fixed; z-index: 30; top: 0; inset-inline-start: 0;
    width: min(300px, 88vw); height: 100vh;
    transform: translateX(-105%); transition: transform .2s ease;
  }
  html[dir="rtl"] .sidebar { transform: translateX(105%); }
  html[dir="rtl"] .sidebar.is-open,
  .sidebar.is-open { transform: none; }
  .backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; }
  .cards, .amounts, .split, .form-grid, .form-section, .facts, .filter-grid, .pipe,
  .type-picks, .claim-fields, .money, .lookup, .stage-head, .stage-switches, .status-names { grid-template-columns: 1fr; }
  .status-step { min-width: 0; }
  .status-name { min-width: 0; }
  .status-create, .action-add { flex-direction: column; align-items: stretch; }
  .status-create .btn, .action-add .btn { width: 100%; }
  .status-step-copy small { display: none; }
  .lookup .btn, .claim-actions .actions, .claim-actions .actions .btn { width: 100%; }
  .claim-actions { align-items: stretch; }
  .content, .topbar, .messages { padding-left: 14px; padding-right: 14px; }
  .pipe { grid-template-columns: 1fr auto; }
  .pipe-track { grid-column: 1 / -1; }
  .board-top { align-items: stretch; flex-direction: column; }
  .board-top .btn { width: 100%; text-align: center; }
  .nav-create { display: none; }
  .topbar h1 { font-size: 18px; }
}
@media print {
  .sidebar, .topbar, .filter-bar, .filters, .backdrop, .actions, .btn, .decide, .pager-bar, .notice-popups { display: none !important; }
  .group-fold > :not(summary), .changelog-panel > .changelog-body, .status-editor[hidden] { display: block !important; }
  .status-rail { display: none !important; }
  .shell { display: block; }
  body, .panel, .card, .metric { background: white; color: black; }
}
