/* Application styles. Tokens live in tokens.css; Bootstrap is vendored locally. */
:root {
  --bs-primary: var(--color-primary);
  --bs-primary-rgb: 52, 104, 245;
  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: 0.875rem;
  --bs-body-color: var(--color-text);
  --bs-body-bg: var(--color-canvas);
  --bs-border-color: var(--color-border);
  --bs-link-color: var(--color-primary);
  --bs-link-hover-color: var(--color-primary-hover);
  --bs-offcanvas-transition: transform var(--duration-drawer) var(--ease-drawer);
}

body { background: var(--color-canvas); color: var(--color-text); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, .page-title, .hero-title { letter-spacing: -0.02em; }
.text-muted, .text-secondary { color: var(--color-muted) !important; }
html { -webkit-text-size-adjust: 100%; }

/* ---- Buttons & controls ---- */
.btn-primary {
  --bs-btn-bg: var(--color-primary);
  --bs-btn-border-color: var(--color-primary);
  --bs-btn-hover-bg: var(--color-primary-hover);
  --bs-btn-hover-border-color: var(--color-primary-hover);
  --bs-btn-active-bg: var(--color-primary-hover);
  --bs-btn-active-border-color: var(--color-primary-hover);
  box-shadow: 0 1px 2px rgba(36, 85, 219, 0.3);
}
.btn { font-weight: 500; }
.form-control, .btn, .dropdown-menu, .form-select { border-radius: var(--radius-md); }
.form-control, .form-select { background-color: var(--color-surface); }
.form-control:focus, .form-select:focus { background-color: var(--color-surface); }
.form-control:disabled, .form-select:disabled { background-color: var(--color-canvas); }
:focus-visible { outline: 3px solid rgba(52, 104, 245, 0.45); outline-offset: 2px; }

/* Press feedback: instant, transform-only so layout never shifts. */
.btn, .nav-link-item, .dropdown-item { transition-property: color, background-color, border-color, transform, box-shadow; }
.btn { transition-duration: 150ms, 150ms, 150ms, var(--duration-press), 150ms; transition-timing-function: ease, ease, ease, var(--ease-out), ease; }
.btn:not(:disabled):active { transform: scale(0.97); }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 2000; background: var(--color-surface); padding: var(--space-2) var(--space-4); }
.skip-link:focus { left: var(--space-2); top: var(--space-2); }

/* ---- Navy sidebar ---- */
.app-sidebar { width: var(--sidebar-width); background-color: var(--navy-900) !important; color: var(--navy-text); border: 0; }
@media (min-width: 992px) {
  .app-sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; }
  .app-main { margin-left: var(--sidebar-width); }
}
.brand { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-6) var(--space-6) var(--space-2); font-weight: 650; font-size: 1rem; color: #fff; text-decoration: none; line-height: 1.2; }
.brand small { color: var(--navy-muted); font-weight: 500; font-size: 0.75rem; }
.brand:hover { color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; background: var(--color-primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.8125rem; letter-spacing: 0; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 6px 16px rgba(52, 104, 245, 0.45); flex: none; }
.sidebar-scroll { overflow-y: auto; padding: 0 var(--space-3) var(--space-4); flex: 1; scrollbar-width: thin; scrollbar-color: var(--navy-700) transparent; }
.nav-group-label { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--navy-muted); padding: var(--space-4) var(--space-3) 6px; font-weight: 600; }
.nav-link-item { position: relative; display: flex; align-items: center; gap: var(--space-3); padding: 7px var(--space-3); border-radius: var(--radius-md); color: var(--navy-text); text-decoration: none; font-weight: 500; transition-duration: 120ms; transition-timing-function: ease; }
@media (hover: hover) and (pointer: fine) {
  .nav-link-item:not(.active):hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
}
.nav-link-item.active { background: var(--color-primary); color: #fff; box-shadow: 0 6px 16px rgba(52, 104, 245, 0.35); }
.nav-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: 0.9; }
.sidebar-user { margin: var(--space-2) var(--space-3) var(--space-4); padding: var(--space-3); border-radius: var(--radius-lg); background: var(--navy-800); border: 1px solid rgba(255, 255, 255, 0.06); display: flex; align-items: center; gap: var(--space-3); }
.sidebar-user-text { min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-user-name { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: var(--navy-muted); font-size: 0.75rem; }
.sidebar-logout { background: transparent; border: 1px solid rgba(255, 255, 255, 0.14); color: var(--navy-text); border-radius: var(--radius-md); padding: 6px 10px; font-size: 0.8125rem; font-weight: 500; }
@media (hover: hover) and (pointer: fine) { .sidebar-logout:hover { background: rgba(255, 255, 255, 0.08); color: #fff; } }
.sidebar-close { filter: invert(1) grayscale(1) brightness(1.6); }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--color-primary-tint); color: var(--color-primary-hover); font-weight: 700; font-size: 0.8125rem; flex: none; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.125rem; }
.avatar-on-dark { background: rgba(127, 162, 255, 0.18); color: var(--navy-accent); }

/* ---- Topbar & content ---- */
.app-topbar { background: rgba(255, 255, 255, 0.96); border-bottom: 1px solid var(--color-border); padding: var(--space-3) var(--space-6); display: flex; align-items: center; gap: var(--space-3); position: sticky; top: 0; z-index: 100; min-height: 64px; }
.topbar-context { color: var(--color-muted); font-size: 0.8125rem; min-width: 0; }
.topbar-context strong { color: var(--color-text); font-weight: 600; }
.topbar-actions { min-width: 0; flex-shrink: 1; }
.icon-btn { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border-radius: var(--radius-md); }
.user-menu-btn { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-content { padding: var(--space-8) var(--space-6); max-width: 1440px; }
@media (min-width: 992px) { .app-content { padding: 36px 40px 56px; } }

/* ---- Page header ---- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); }
.page-header-text { min-width: 0; flex: 1 1 260px; }
.page-title { font-size: 1.75rem; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.page-subtitle { color: var(--color-muted); margin: var(--space-1) 0 0; font-size: 0.9375rem; }
.breadcrumb { --bs-breadcrumb-font-size: 0.8125rem; --bs-breadcrumb-divider-color: var(--color-muted); }

/* ---- Surfaces ---- */
.surface { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); }
.surface-body { padding: var(--space-6); }
.section-title { font-size: 1rem; font-weight: 650; margin: 0; }
.widget-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }

.icon-tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--color-primary-tint); color: var(--color-primary-hover); flex: none; }
.icon-tile svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-tile-lg { width: 56px; height: 56px; border-radius: 16px; }
.icon-tile-lg svg { width: 26px; height: 26px; }

/* ---- Hero ---- */
.hero { position: relative; overflow: hidden; background: var(--navy-800); color: #fff; border-radius: var(--radius-xl); padding: var(--space-8); margin-bottom: var(--space-6); box-shadow: var(--shadow-md); isolation: isolate; }
.hero-pattern { position: absolute; inset: 0 0 0 auto; width: min(52%, 520px); height: 100%; z-index: -1; opacity: 0.9; pointer-events: none; }
.hero-eyebrow { color: var(--navy-accent); font-weight: 600; font-size: 0.8125rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 var(--space-2); }
.hero-title { font-size: 1.75rem; font-weight: 700; margin: 0 0 var(--space-2); }
.hero-text { color: #b9c6de; max-width: 52ch; margin: 0 0 var(--space-6); font-size: 0.9375rem; }
.hero .btn-light { color: var(--navy-900); font-weight: 600; }
.hero-meta { margin-top: var(--space-6); color: #b9c6de; font-size: 0.8125rem; display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); }
.hero-meta strong { color: #fff; font-weight: 600; }

/* ---- Metric cards ---- */
.metric-card { padding: var(--space-6); height: 100%; position: relative; transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
}
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.metric-label { display: flex; align-items: center; gap: var(--space-2); min-width: 0; color: var(--color-muted); font-weight: 550; }
.metric-value { font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: var(--space-4); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; letter-spacing: -0.03em; }
.metric-value.is-empty { color: #aab4c5; }
.metric-note { margin: var(--space-2) 0 0; font-size: 0.75rem; color: var(--color-muted); }
.help-btn { position: relative; flex: none; border: 1px solid var(--color-border); background: var(--color-surface); padding: 0; color: var(--color-muted); line-height: 1; border-radius: 50%; width: 24px; height: 24px; font-size: 0.75rem; font-weight: 700; }
.help-btn::after { content: ""; position: absolute; inset: -10px; } /* ~44px hit area */

/* ---- Setup stepper ---- */
.step-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-3); }
.step-card { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-lg); text-decoration: none; color: inherit; background: var(--color-surface); transition: border-color 160ms ease, box-shadow 200ms var(--ease-out), transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .step-card:hover { border-color: #c8d6fb; box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }
}
.step-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--color-primary-tint); color: var(--color-primary-hover); font-weight: 700; flex: none; }
.step-title { font-weight: 650; margin: 0 0 2px; }
.step-text { margin: 0; color: var(--color-muted); font-size: 0.8125rem; }

/* ---- Empty states & art ---- */
.empty-state { text-align: center; padding: 48px var(--space-6); }
.empty-art { width: 160px; max-width: 60%; height: auto; margin: 0 auto var(--space-4); display: block; }
.empty-state h2 { font-size: 1.125rem; font-weight: 700; }
.empty-state p { color: var(--color-muted); max-width: 54ch; margin: 0 auto var(--space-4); }
.empty-inline { color: var(--color-muted); margin: 0; font-size: 0.875rem; }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--color-canvas); border: 1px solid var(--color-border); color: var(--color-muted); font-size: 0.75rem; font-weight: 600; }
.chip-primary { background: var(--color-primary-tint); border-color: transparent; color: var(--color-primary-hover); }
.empty-requires { font-size: 0.8125rem; }
.empty-note { font-size: 0.8125rem; margin: var(--space-2) auto 0 !important; }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.feature-list li { display: flex; gap: var(--space-3); align-items: flex-start; color: var(--color-text); }
.feature-list svg { width: 18px; height: 18px; flex: none; margin-top: 1px; fill: none; stroke: var(--color-success); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Status badges ---- */
.badge-status { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-info { color: var(--color-info); } .badge-warning { color: var(--color-warning); }
.badge-success { color: var(--color-success); } .badge-danger { color: var(--color-danger); }

/* ---- Detail lists (settings) ---- */
.detail-list { margin: 0; }
.detail-list > div { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.detail-list > div:first-child { border-top: 0; padding-top: 0; }
.detail-list dt { flex: 0 0 140px; color: var(--color-muted); font-weight: 500; }
.detail-list dd { margin: 0; flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.profile-head { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-6); min-width: 0; }
.profile-name { font-size: 1.125rem; font-weight: 700; margin: 0; overflow-wrap: anywhere; }

/* ---- List toolbar, table, pager ---- */
.list-toolbar { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); box-shadow: var(--shadow-sm); }
.toolbar-row { display: flex; gap: var(--space-2); align-items: center; }
.toolbar-search { flex: 1 1 auto; min-width: 0; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); align-items: end; padding-top: var(--space-3); }
.table-card { overflow: hidden; }
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); font-weight: 600; white-space: nowrap; background: var(--color-canvas); }
.table td, .table th { padding: var(--space-3) var(--space-4); overflow-wrap: anywhere; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-4); }
.pager-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.pager-size { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.pager-size .form-select { width: auto; }
.pager-current { white-space: nowrap; }

/* ---- Skeleton (opacity only; static under reduced motion) ---- */
.skeleton { background: var(--color-border); border-radius: var(--radius-sm); animation: skeleton-pulse 1.4s ease-in-out infinite; }
.skeleton-line { height: 14px; margin: var(--space-3) 0; }
@keyframes skeleton-pulse { 50% { opacity: 0.5; } }

/* ---- Auth ---- */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: minmax(380px, 5fr) 6fr; } }
.auth-panel { display: none; position: relative; overflow: hidden; background: var(--navy-900); color: #fff; padding: 56px; isolation: isolate; }
@media (min-width: 992px) { .auth-panel { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-panel .hero-pattern { width: 100%; opacity: 0.6; inset: auto 0 0 0; height: 70%; }
.auth-tagline { font-size: 2rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.03em; max-width: 14ch; margin: 0 0 var(--space-4); }
.auth-sub { color: #b9c6de; max-width: 38ch; margin: 0; }
.auth-points { list-style: none; padding: 0; margin: var(--space-6) 0 0; display: grid; gap: var(--space-3); color: var(--navy-text); }
.auth-points li { display: flex; gap: var(--space-3); align-items: center; }
.auth-points svg { width: 18px; height: 18px; fill: none; stroke: var(--navy-accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.auth-main { display: grid; place-items: center; padding: var(--space-6) var(--space-4); }
.auth-card { width: 100%; max-width: 420px; padding: var(--space-8); }
.auth-brand { display: flex; align-items: center; gap: var(--space-3); font-weight: 650; margin-bottom: var(--space-6); }
.auth-brand .brand-mark { box-shadow: 0 6px 16px rgba(52, 104, 245, 0.35); }
@media (min-width: 992px) { .auth-card { border: 0; box-shadow: none; background: transparent; padding: 0; } .auth-brand { display: none; } }
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--space-4); }
.auth-wrap .auth-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-md); padding: var(--space-8); }

/* ---- Touch & mobile ---- */
a, button, .btn, select, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.btn, .nav-link-item, .dropdown-item { -webkit-user-select: none; user-select: none; }

@media (max-width: 991.98px) {
  /* >=16px inputs stop iOS Safari zooming the page on focus. */
  .form-control, .form-select { font-size: 1rem; }
  .btn, .form-control, .form-select { min-height: 44px; }
  .nav-link-item { min-height: 44px; }
  .app-topbar { padding: calc(var(--space-2) + env(safe-area-inset-top)) calc(var(--space-4) + env(safe-area-inset-right)) var(--space-2) calc(var(--space-4) + env(safe-area-inset-left)); }
  .app-content { padding: var(--space-6) calc(var(--space-4) + env(safe-area-inset-right)) calc(var(--space-6) + env(safe-area-inset-bottom)) calc(var(--space-4) + env(safe-area-inset-left)); }
  .app-sidebar { max-width: 86vw; padding-bottom: env(safe-area-inset-bottom); }
  .hero { padding: var(--space-6); }
}

@media (max-width: 575.98px) {
  .page-title { font-size: 1.5rem; }
  .hero-title { font-size: 1.375rem; }
  .hero-pattern { opacity: 0.35; width: 100%; }
  .hero .btn { width: 100%; }
  .page-header { margin-bottom: var(--space-4); }
  .page-action { width: 100%; }
  .metric-card { padding: var(--space-4); }
  .metric-value { font-size: 1.5rem; margin-top: var(--space-3); }
  .metric-note { display: none; }
  .metric-top { flex-direction: column-reverse; align-items: flex-start; gap: var(--space-2); }
  .metric-card .icon-tile { width: 32px; height: 32px; border-radius: 10px; }
  .metric-card .icon-tile svg { width: 17px; height: 17px; }
  .surface-body { padding: var(--space-4); }
  .empty-state { padding: var(--space-8) var(--space-4); }
  .auth-wrap .auth-card, .auth-card { padding: var(--space-6) var(--space-4); }
  .toolbar-row { flex-wrap: wrap; }
  .toolbar-search { flex: 1 0 100%; }
  .toolbar-row > .btn { flex: 1 1 0; }
  .pager { flex-direction: column; align-items: stretch; }
  .pager-controls { justify-content: space-between; }
  .pager .btn-group { width: 100%; }
  .pager .btn-group > .btn { flex: 1 1 auto; }
  .user-menu-btn { max-width: 120px; }
  .topbar-context { display: none; }
}

/* Tables become cards below md; labels come from each cell's data-label. */
@media (max-width: 767.98px) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }
  .table-stack tr:last-child { border-bottom: 0; }
  .table-stack td { display: flex; gap: var(--space-3); justify-content: space-between; padding: var(--space-1) 0; border: 0; text-align: right; }
  .table-stack td::before { content: attr(data-label); flex: 0 0 38%; text-align: left; color: var(--color-muted); font-weight: 500; }
  .table-stack td.cell-primary { font-weight: 600; text-align: left; padding-bottom: var(--space-2); }
  .table-stack td.cell-primary::before { display: none; }
}

/* Reduced motion: drop movement, keep colour/opacity feedback. */
@media (prefers-reduced-motion: reduce) {
  .btn:not(:disabled):active { transform: none; }
  .metric-card, .step-card { transition: none; transform: none !important; }
  .offcanvas { transition: none !important; }
  .skeleton { animation: none; }
}

.min-w-0 { min-width: 0; }

/* The "Needs" chip carries a sentence; let it wrap instead of overflowing small screens. */
.empty-requires .chip { white-space: normal; text-align: left; border-radius: var(--radius-lg); }

/* Sidebar: scroll hint (fade) and tighter rhythm on short viewports so every item stays reachable. */
.sidebar-scroll { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent); padding-bottom: var(--space-6); }
@media (min-width: 992px) and (max-height: 900px) {
  .nav-link-item { padding-top: 6px; padding-bottom: 6px; }
  .nav-group-label { padding-top: var(--space-3); }
  .brand { padding-top: var(--space-4); }
}

/* ---- Language switcher ---- */
.lang-switcher .dropdown-item[aria-current="true"] { font-weight: 600; color: var(--color-primary-hover); }
.auth-main { position: relative; }
.auth-lang { position: absolute; top: var(--space-4); right: var(--space-4); }
@media (min-width: 992px) { .auth-lang { top: var(--space-6); right: var(--space-6); } }
/* Gujarati glyphs have taller ascenders/descenders: give text a little more line height. */
html[lang="gu"] body { line-height: 1.65; }
html[lang="gu"] .page-title, html[lang="gu"] .hero-title, html[lang="gu"] .auth-tagline { line-height: 1.35; letter-spacing: 0; }
html[lang="gu"] .nav-group-label, html[lang="gu"] .table > thead th, html[lang="gu"] .hero-eyebrow { text-transform: none; letter-spacing: 0.02em; }

/* ---- Phase 2: page actions, hierarchy tree, plain lists, forms ---- */
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.toolbar-select { flex: 0 0 auto; width: auto; min-width: 130px; }
.form-card { max-width: 640px; }
.tree-card { overflow: hidden; }
.tree-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--color-border); }
.tree-list { list-style: none; margin: 0; padding: 0; }
.tree-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-6); padding-left: calc(var(--space-6) + var(--depth, 0) * 28px); border-top: 1px solid var(--color-border); position: relative; }
.tree-list > .tree-row:first-child { border-top: 0; }
.tree-row[style*="--depth: 0"]::before { display: none; }
.tree-row::before { content: ""; position: absolute; left: calc(var(--space-6) + (var(--depth, 1) - 1) * 28px + 8px); top: 50%; width: 14px; height: 1px; background: var(--color-border); }
.tree-row.is-inactive .tree-name { color: var(--color-muted); text-decoration: line-through; }
.tree-root { background: var(--color-canvas); }
.tree-main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-width: 0; }
.tree-name { font-weight: 650; overflow-wrap: anywhere; }
.tree-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tree-empty { padding: var(--space-4) var(--space-6); }
.indent { display: inline-block; padding-left: calc(var(--depth, 0) * 20px); }
.table-stack td.cell-actions, .table td.cell-actions { white-space: nowrap; text-align: right; }
.cell-actions > * { margin-left: var(--space-1); }
.plain-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-top: 1px solid var(--color-border); }
.plain-list li:first-child { border-top: 0; }
@media (max-width: 767.98px) {
  .table-stack td.cell-actions { justify-content: flex-end; gap: var(--space-2); padding-top: var(--space-3); }
  .table-stack td.cell-actions::before { display: none; }
  .table-stack td.cell-actions > * { margin-left: 0; }
}
@media (max-width: 575.98px) {
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .tree-row { padding-left: calc(var(--space-4) + var(--depth, 0) * 18px); padding-right: var(--space-4); }
  .tree-row::before { left: calc(var(--space-4) + (var(--depth, 1) - 1) * 18px + 6px); width: 8px; }
  .tree-head { padding: var(--space-4); }
  .tree-actions { width: 100%; }
}

.step-card.is-done .step-num { background: var(--color-success); color: #fff; }
.step-card.is-done .step-title { text-decoration: none; }


/* ---- Users pages ---- */
.area-search, .area-add { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); }
.area-search .form-control, .area-add .form-select { flex: 1 1 auto; min-width: 0; }
.table-compact td.cell-primary { font-weight: 550; }
.table-compact td.cell-actions { text-align: right; white-space: nowrap; }
@media (max-width: 575.98px) {
  .area-search, .area-add { flex-wrap: wrap; }
  .table-compact th, .table-compact td { padding: var(--space-2) var(--space-2); font-size: 0.8125rem; }
  .table-compact th:first-child, .table-compact td:first-child { padding-left: var(--space-3); }
  .table-compact td:nth-child(2), .table-compact td:nth-child(3), .table-compact th:nth-child(2), .table-compact th:nth-child(3) { text-align: center; }
  .table-compact .btn-sm { padding: 2px 8px; min-height: 32px; font-size: 0.75rem; }
  .table-compact .indent { padding-left: calc(var(--depth, 0) * 10px); }
}
