/*
 * FARA visual system adapter for BPMS.
 * Loaded after legacy and page-specific styles so every product area shares
 * one calm workspace language without changing its Django behavior.
 */

:root {
  --fara-primary: #2563eb;
  --fara-primary-hover: #1d4ed8;
  --fara-primary-pressed: #1e40af;
  --fara-primary-soft: #eff6ff;
  --fara-primary-muted: #dbeafe;
  --fara-bg: #f2f6fc;
  --fara-surface: #ffffff;
  --fara-surface-muted: #f8fafd;
  --fara-sidebar: #101a31;
  --fara-sidebar-deep: #0d1629;
  --fara-border: #e3eaf4;
  --fara-border-strong: #d2ddec;
  --fara-text: #152238;
  --fara-muted: #62708a;
  --fara-tertiary: #95a1b5;
  --fara-success: #16a34a;
  --fara-warning: #d97706;
  --fara-danger: #dc2626;
  --fara-shadow-sm: 0 2px 10px rgba(37, 56, 88, .05);
  --fara-shadow-md: 0 10px 30px rgba(37, 56, 88, .09);
  --fara-shadow-lg: 0 24px 64px rgba(28, 50, 84, .12);
  --fara-focus: 0 0 0 4px rgba(37, 99, 235, .14);
  --fara-sidebar-width: 252px;
  --bg: var(--fara-bg);
  --surface: var(--fara-surface);
  --ink: var(--fara-text);
  --muted: var(--fara-muted);
  --line: var(--fara-border);
  --accent: var(--fara-primary);
  --accent-soft: var(--fara-primary-soft);
  --sidebar: var(--fara-sidebar);
  --sidebar-muted: #9fb0c9;
  --success: var(--fara-success);
  --shadow: var(--fara-shadow-md);
}

html,
body {
  width: 100%;
  max-width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fara-bg);
  color: var(--fara-text);
  font-family: Poppins, Vazirmatn, Vazir, Tahoma, Arial, sans-serif !important;
}

html[lang="en"],
html[dir="ltr"],
body.is-ltr,
:lang(en),
[lang="en"],
[dir="ltr"],
.ltr {
  font-family: Poppins, Vazirmatn, Vazir, Tahoma, Arial, sans-serif !important;
}

body {
  font-size: 14px;
  line-height: 1.75;
}

button,
input,
select,
textarea,
table,
th,
td,
a,
label,
small,
code,
pre,
dialog {
  font-family: inherit !important;
}

::selection {
  background: var(--fara-primary-muted);
  color: var(--fara-primary-pressed);
}

/* Application shell ----------------------------------------------------- */
.app-shell {
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--fara-bg);
}

.sidebar {
  position: relative;
  flex: 0 0 var(--fara-sidebar-width);
  width: var(--fara-sidebar-width);
  height: 100vh;
  padding: 18px 16px 14px;
  gap: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 0%, rgba(59, 130, 246, .16), transparent 28%),
    linear-gradient(180deg, var(--fara-sidebar) 0%, var(--fara-sidebar-deep) 56%, var(--fara-sidebar) 100%);
  border-inline-end: 1px solid rgba(148, 163, 184, .08);
  box-shadow: -18px 0 52px rgba(15, 23, 42, .08);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 190px;
  background: radial-gradient(circle at 70% 0%, rgba(96, 165, 250, .14), transparent 62%);
  pointer-events: none;
}

.app-shell.dz-drawer #app-sidebar,
.app-shell.dz-drawer .sidebar {
  width: auto;
  max-width: 100%;
  padding: 0;
  margin: 0;
  flex: none;
  background: transparent;
  box-shadow: none;
  border-inline-end: 0;
}

.app-shell.dz-drawer #app-sidebar::after,
.app-shell.dz-drawer .sidebar::after {
  display: none;
}

#app-sidebar > *,
.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  min-height: auto;
  padding: 18px 14px 14px;
  margin-bottom: 6px;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--fara-primary), #3b82f6);
  box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
  font-size: 16px;
}

.brand strong {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.brand small {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: .01em;
}

.sidebar nav {
  flex: 1;
  min-height: 0;
  gap: 2px;
  padding: 0 2px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
  scrollbar-gutter: stable;
}

.sidebar nav::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .16);
  border-radius: 9999px;
  transition: background .2s ease;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .32);
}

.sidebar nav::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 38px;
  padding: 0 10px;
  gap: 10px;
  overflow: hidden;
  border-radius: 11px;
  color: #c8d2e3;
  font-size: 12px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}

/* Keep the notifications item aligned exactly like every other nav item.
   Workflow pages also load management.css, which historically spread this
   link's children across the full row. */
.sidebar nav a.sidebar-notification-link {
  justify-content: flex-start;
  width: 100%;
  text-align: start;
}

.sidebar nav a::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(147, 197, 253, .08), transparent);
  transform: translateX(80%);
  transition: transform .45s ease, opacity .2s ease;
  pointer-events: none;
}

.sidebar nav a:hover {
  color: #fff;
  background: rgba(96, 165, 250, .09);
  transform: translateX(-2px);
}

.sidebar nav a:hover::after {
  opacity: 1;
  transform: translateX(-80%);
}

.sidebar nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(59, 130, 246, .34), rgba(37, 99, 235, .11) 74%, transparent);
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, .12), 0 8px 26px rgba(2, 6, 23, .1);
}

.sidebar nav a.active::before,
#app-sidebar nav a.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -2px;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(#93c5fd, #3b82f6);
  box-shadow: 0 0 14px rgba(96, 165, 250, .7);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  color: #9fb0c9;
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

.nav-icon svg,
.notification-button__icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.active .nav-icon,
.sidebar nav a:hover .nav-icon {
  color: #bfdbfe;
}

.nav-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 7px 5px;
  color: #6f819d;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
}

.nav-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, .12);
}

#app-drawer:not(:checked) ~ .dz-drawer-side .nav-label {
  display: none !important;
}

#app-drawer:not(:checked) ~ .dz-drawer-side #app-sidebar nav {
  overflow-x: hidden !important;
  scrollbar-width: none !important;
}

#app-drawer:not(:checked) ~ .dz-drawer-side #app-sidebar nav::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.nav-icon--bell {
  position: relative;
  overflow: visible;
}

/* Keep the unread count visually attached to the bell. A separate flex item
   can drift to the opposite edge of the sidebar in RTL layouts. */
#app-sidebar .nav-icon--bell .sidebar-notification-count,
.sidebar .nav-icon--bell .sidebar-notification-count {
  position: absolute;
  inset-block-start: -7px;
  inset-inline-start: -8px;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin: 0;
  padding-inline: 4px;
  border: 2px solid #101827;
  border-radius: 999px;
  background: var(--fara-primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  z-index: 1;
}

.sidebar nav a.active .nav-icon--bell .sidebar-notification-count,
.sidebar nav a[aria-current="page"] .nav-icon--bell .sidebar-notification-count,
#app-sidebar nav a.active .nav-icon--bell .sidebar-notification-count,
#app-sidebar nav a[aria-current="page"] .nav-icon--bell .sidebar-notification-count {
  border-color: #2563eb;
  background: #fff;
  color: var(--fara-primary);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 13px;
  transition: background .16s ease;
}

.sidebar-user:hover {
  background: rgba(96, 165, 250, .08);
}

.sidebar-user__avatar {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .3);
}

.sidebar-user__copy {
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}

.sidebar-user__copy strong,
.sidebar-user__copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user__copy strong {
  color: #fff;
  font-size: 11px;
}

.sidebar-user__copy small {
  margin-top: 4px;
  color: #92a2ba;
  font-size: 9px;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow: visible;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.topbar {
  min-height: 70px;
  height: auto;
  padding: 12px 32px;
  border: 0;
  border-bottom: 1px solid var(--fara-border);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar h1 {
  margin: 3px 0 0;
  color: var(--fara-text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
}

.topbar .eyebrow {
  color: var(--fara-primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--fara-border);
  border-radius: 12px;
  background: #fff;
  color: var(--fara-muted);
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37, 56, 88, .035);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.topbar-search-trigger:hover {
  border-color: #bdd2ff;
  background: var(--fara-primary-soft);
  color: var(--fara-primary);
}

.topbar-search-trigger__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.topbar-search-trigger__text {
  font-weight: 500;
  font-size: 12px;
}

.topbar-search-trigger__kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border: 1px solid rgba(210, 221, 236, .9);
  border-radius: 6px;
  background: #f8fafd;
  color: #64748b;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

@media (max-width: 640px) {
  .topbar-search-trigger {
    width: 40px;
    padding: 0;
    justify-content: center;
  }
  .topbar-search-trigger__text,
  .topbar-search-trigger__kbd {
    display: none;
  }
}

.notification-button,
.mobile-nav-toggle {
  min-height: 40px;
  border: 1px solid var(--fara-border);
  border-radius: 12px;
  background: #fff;
  color: var(--fara-muted);
  box-shadow: 0 3px 10px rgba(37, 56, 88, .035);
}

/* The notification trigger is part of the global top bar, so it must not
   depend on workflow-specific styles that are absent on dashboard pages. */
.notification-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  overflow: visible;
  text-decoration: none;
}

.notification-button:hover,
.mobile-nav-toggle:hover {
  border-color: #bdd2ff;
  background: var(--fara-primary-soft);
  color: var(--fara-primary);
}

.notification-button__icon {
  display: grid;
  place-items: center;
  color: currentColor;
}

.notification-button__badge {
  position: absolute;
  inset-block-start: -6px;
  inset-inline-start: -6px;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--fara-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  z-index: 1;
}

.mobile-nav-toggle {
  display: none;
  width: 40px;
  padding: 0;
  font-size: 18px;
}

/* Workspace content ----------------------------------------------------- */
.content {
  max-width: none;
  min-height: calc(100% - 78px);
  padding: clamp(22px, 3vw, 38px);
  background:
    radial-gradient(circle at 58% -12%, rgba(219, 234, 254, .7), transparent 30%),
    linear-gradient(180deg, #fafdff 0%, var(--fara-bg) 100%);
}

.content > * {
  max-width: 1180px;
  margin-inline: auto;
}

.content > .professional-designer-page,
.content > .workflow-designer {
  max-width: none;
}

.flash-stack {
  gap: 10px;
}

.flash {
  padding: 12px 15px;
  border: 0;
  border-radius: 13px;
  box-shadow: var(--fara-shadow-sm);
}

.flash.success {
  background: #ecfdf3;
  color: #12643f;
}

.flash.error:where(:not(.dashboard-shell *)) {
  background: #fff1f0;
  color: #a5271d;
}

.hero {
  position: relative;
  overflow: hidden;
  align-items: center;
  min-height: 176px;
  padding: 30px 32px;
  margin-bottom: 20px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 15% 0%, rgba(147, 197, 253, .22), transparent 34%),
    linear-gradient(135deg, #173b76 0%, #245fc4 58%, #2f75ed 100%);
  box-shadow: 0 20px 48px rgba(31, 90, 203, .18);
}

.hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -55px;
  top: -75px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  box-shadow: 0 0 0 35px rgba(255, 255, 255, .035), 0 0 0 70px rgba(255, 255, 255, .025);
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h2 {
  margin: 8px 0;
  font-size: 27px;
}

.hero p {
  color: #d7e6ff;
  line-height: 1.9;
}

.badge {
  color: #bfdbfe;
}

.stat,
.panel:where(:not(.dashboard-shell *)),
.runtime-field {
  border: 1px solid rgba(210, 221, 236, .76);
  border-radius: 20px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 38px rgba(30, 64, 175, .065);
}

.stats {
  gap: 15px;
  margin-bottom: 20px;
}

.stat {
  position: relative;
  min-height: 132px;
  padding: 20px;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}

.stat::after {
  content: "";
  position: absolute;
  inset-inline-end: -16px;
  bottom: -24px;
  width: 82px;
  height: 82px;
  border-radius: 28px;
  background: var(--fara-primary-soft);
  transform: rotate(22deg);
}

.stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(30, 64, 175, .1);
}

.stat span,
.stat small {
  position: relative;
  z-index: 1;
  color: var(--fara-muted);
}

.stat strong {
  position: relative;
  z-index: 1;
  color: var(--fara-text);
  font-size: 29px;
}

.panel:where(:not(.dashboard-shell *)) {
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head:where(:not(.dashboard-shell *)),
.panel-heading {
  padding: 18px 21px;
  border-bottom: 1px solid var(--fara-border);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.panel-head h3:where(:not(.dashboard-shell *)),
.panel-heading h2 {
  color: var(--fara-text);
  font-size: 15px;
  font-weight: 800;
}

.panel-head p:where(:not(.dashboard-shell *)),
.panel-heading p {
  color: var(--fara-muted);
}

.panel-head a:where(:not(.dashboard-shell *)) {
  color: var(--fara-primary);
}

.breakdown-list {
  padding: 4px 0;
}

.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 76px;
  gap: 14px;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid #f1f5f9;
  transition: background .15s ease;
}

.bar-row:last-child {
  border-bottom: 0;
}

.bar-row:hover {
  background: #f8fafc;
}

.bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, var(--fara-primary));
  border-radius: inherit;
  transition: width .3s ease;
}

.action-card__body {
  flex: 1;
  min-width: 0;
}

.action-card__body strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.action-card__body small {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modern Data Table */

.pill--create {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.pill--update {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.pill--delete {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.pill--view,
.pill--read {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

@media (max-width: 640px) {
  .bar-row {
    grid-template-columns: 110px 1fr 60px;
    padding: 10px 16px;
  }
}

/* Tables ---------------------------------------------------------------- */
table:where(:not(.dashboard-shell *)) {
  background: #fff;
}

th:where(:not(.dashboard-shell *)),
td:where(:not(.dashboard-shell *)) {
  padding: 13px 17px;
  border-bottom-color: var(--fara-border);
}

th:where(:not(.dashboard-shell *)) {
  background: #f7f9fc;
  color: #71809a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}

tbody tr:where(:not(.dashboard-shell *)) {
  transition: background .14s ease;
}

tbody tr:hover:where(:not(.dashboard-shell *)) {
  background: #f8fbff;
}

.table-primary-cell strong,
.table-reference {
  color: var(--fara-text);
}

.table-email,
.table-date,
.table-version,
.table-number,
.muted:where(:not(.dashboard-shell *)) {
  color: var(--fara-muted);
}

.empty:where(:not(.dashboard-shell *)),
.empty-cell {
  color: var(--fara-muted);
}

/* Buttons and forms ----------------------------------------------------- */
.primary,
.secondary,
.icon-action {
  min-height: 40px;
  border-radius: 12px;
  font-weight: 750;
  transition: transform .14s ease, box-shadow .18s ease, background .14s ease, border-color .14s ease;
}

.primary {
  border: 1px solid var(--fara-primary);
  background: linear-gradient(135deg, var(--fara-primary-hover), #3b82f6);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .22);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, .28);
}

.primary:active {
  transform: translateY(0);
  background: var(--fara-primary-pressed);
}

.secondary {
  border: 1px solid var(--fara-border-strong);
  background: #fff;
  color: #40516b;
}

.secondary:hover {
  border-color: #bdd2ff;
  background: var(--fara-primary-soft);
  color: var(--fara-primary-hover);
}

.compact {
  min-height: 34px;
}

.icon-action {
  border-color: var(--fara-border);
  color: var(--fara-muted);
}

.field input:where(:not(.dashboard-shell *)),
.field select:where(:not(.dashboard-shell *)),
.field textarea:where(:not(.dashboard-shell *)),
.runtime-field input,
.runtime-field select,
.runtime-field textarea,
.stacked-form input,
.stacked-form select,
.stacked-form textarea {
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid var(--fara-border-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--fara-text);
  box-shadow: 0 1px 2px rgba(37, 56, 88, .025);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

/* Native choice controls must never inherit text-field dimensions. Feature
   styles are allowed to load after this theme, so the physical and logical
   sizes are intentionally enforced at the shared boundary. */
input[type="checkbox"]:where(:not(.dashboard-shell *)),
input[type="radio"]:where(:not(.dashboard-shell *)) {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: 1.125rem !important;
  min-width: 1.125rem !important;
  max-width: 1.125rem !important;
  height: 1.125rem !important;
  min-height: 1.125rem !important;
  max-height: 1.125rem !important;
  inline-size: 1.125rem !important;
  min-inline-size: 1.125rem !important;
  max-inline-size: 1.125rem !important;
  block-size: 1.125rem !important;
  min-block-size: 1.125rem !important;
  max-block-size: 1.125rem !important;
  padding: 0 !important;
  box-shadow: none;
  accent-color: var(--fara-primary);
  vertical-align: middle;
  cursor: pointer;
}

.field textarea:where(:not(.dashboard-shell *)),
.runtime-field textarea,
.stacked-form textarea {
  min-height: 110px;
}

.field input:focus:where(:not(.dashboard-shell *)),
.field select:focus:where(:not(.dashboard-shell *)),
.field textarea:focus:where(:not(.dashboard-shell *)),
.runtime-field input:focus,
.runtime-field select:focus,
.runtime-field textarea:focus,
.stacked-form input:focus,
.stacked-form select:focus,
.stacked-form textarea:focus {
  outline: 0;
  border-color: #79a7f5;
  box-shadow: var(--fara-focus);
}

.field label:where(:not(.dashboard-shell *)),
.runtime-field label,
.assignment-field label {
  color: #43516a;
  font-size: 12px;
  font-weight: 750;
}

.form-runtime,
.stacked-form {
  border: 1px solid rgba(210, 221, 236, .76);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--fara-shadow-md);
}

.form-footer:where(:not(.dashboard-shell *)) {
  border-top-color: var(--fara-border);
}

.error:where(:not(.dashboard-shell *)),
.field-error {
  color: var(--fara-danger);
}

/* Status, cards and messages ------------------------------------------- */
.status,
.status-pill,
.task-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--fara-primary-soft);
  color: var(--fara-primary-hover);
  line-height: 1.35;
  font-weight: 800;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.status.on,
.status-pill.on,
.status.published,
.status-pill.published {
  background: #ecfdf3;
  color: #15803d;
}

/* Management-table cells are layout containers, never badges themselves. */

/* RBAC assignment table: keep boolean values as compact single-line badges. */

/* Keep wide grids inside their card and allocate space to business content. */
.content,
.panel:where(:not(.dashboard-shell *)) {
  min-width: 0;
  max-width: 100%;
}

.content {
  overflow-x: hidden;
}

.process-version-summary strong,
.process-version-summary a {
  display: block;
  white-space: nowrap;
}

.process-version-summary a {
  margin-top: 3px;
  color: var(--fara-primary);
  font-size: 9px;
  font-weight: 750;
}

/* Process instances: related metadata is grouped so six readable columns
   replace the previous nine cramped columns. */

.process-instance-summary strong,
.process-instance-started .table-email,
.process-instance-started .table-date {
  display: block;
}

.process-instance-summary .table-version,
.process-instance-started .table-date {
  width: auto !important;
  min-width: 0 !important;
  margin-top: 5px;
  color: var(--fara-muted);
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap !important;
}

.process-instance-started .table-email {
  width: auto !important;
  min-width: 0 !important;
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: start;
  font-size: 11px;
  white-space: nowrap !important;
}

.process-instance-started .table-date {
  direction: rtl;
  unicode-bidi: isolate;
}

/* Work queue: task ownership lives with the task, eliminating the narrow
   status/email column that previously broke addresses character by character. */

.runtime-task-summary strong,
.runtime-process-summary,
.runtime-task-assignee {
  display: block;
}

.runtime-task-assignee {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: start;
  font-size: 11px;
  white-space: nowrap;
}

.runtime-check,
.alert-panel {
  padding: 15px 18px;
  border: 0;
  border-radius: 15px;
  background: #f5f9ff;
  color: #40516b;
  box-shadow: inset 3px 0 0 #93c5fd, var(--fara-shadow-sm);
}

html[dir="rtl"] .runtime-check,
html[dir="rtl"] .alert-panel {
  box-shadow: inset -3px 0 0 #93c5fd, var(--fara-shadow-sm);
}

/* Rule engine ----------------------------------------------------------- */

.rule-builder-node,
.rule-score-band,
.rule-decision-row,
.rule-builder-subsection {
  border-color: var(--fara-border);
  border-radius: 14px;
  background: var(--fara-surface-muted);
}

/* Runtime, tasks, notifications and collaboration ---------------------- */

.assignment-history {
  border-color: var(--fara-border);
  border-radius: 14px;
  background: #fff;
}

.inspector-empty-icon {
  background: var(--fara-primary-soft);
  color: var(--fara-primary);
}

.work-item-completion-actions,
.task-secondary-actions {
  border-top-color: var(--fara-border);
}

/* Form and workflow designers ------------------------------------------ */
.professional-designer-page {
  background: var(--fara-bg);
}

.designer-commandbar,
.workflow-designer-toolbar {
  border-color: var(--fara-border);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 24px rgba(37, 56, 88, .05);
  backdrop-filter: blur(16px);
}

.designer-workspace,
.workflow-designer-body {
  border-color: var(--fara-border);
  background: #edf2f8;
}

.designer-left-panel,
.designer-right-panel,
.workflow-properties,
.workflow-outline,
.workflow-canvas-panel {
  border-color: var(--fara-border);
  background: #fff;
}

.designer-panel-tabs,
.workflow-panel-tabs,
.inspector-tabs {
  border-color: var(--fara-border);
  background: #f8fafd;
}

.designer-panel-tabs button.active,
.workflow-panel-tabs button.active,
.inspector-tabs button.active {
  border-bottom-color: var(--fara-primary);
  background: #fff;
  color: var(--fara-primary);
}

.designer-canvas-frame,
.workflow-canvas,
.preview-modal-card,
.form-settings-dialog {
  border-color: var(--fara-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--fara-shadow-md);
}

.component-search,
.workflow-properties input,
.workflow-properties select,
.workflow-properties textarea,
.inspector-body input,
.inspector-body select,
.inspector-body textarea {
  border-color: var(--fara-border-strong);
  border-radius: 10px;
}

.component-search:focus-within,
.workflow-properties input:focus,
.workflow-properties select:focus,
.workflow-properties textarea:focus,
.inspector-body input:focus,
.inspector-body select:focus,
.inspector-body textarea:focus {
  border-color: #79a7f5;
  box-shadow: var(--fara-focus);
}

.designer-version,
.designer-oss-pill,
.engine-badge,
.canvas-count {
  border-radius: 999px;
  background: var(--fara-primary-soft);
  color: var(--fara-primary-hover);
}

.canvas-status-dot {
  background: var(--fara-success);
}

.workflow-task-outline,
.workflow-guidance,
.tree-stage {
  border-color: var(--fara-border);
  border-radius: 12px;
}

/* Login ---------------------------------------------------------------- */
.login-page {
  grid-template-columns: minmax(360px, .9fr) minmax(440px, 1.1fr);
  padding: 24px;
  background:
    radial-gradient(circle at 75% 10%, rgba(96, 165, 250, .2), transparent 28%),
    linear-gradient(135deg, #0d1629, #142644 52%, #173b76);
}

.login-visual {
  align-self: center;
  max-width: 520px;
  padding: 54px;
  color: #fff;
}

.login-orb {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(96, 165, 250, .34), rgba(37, 99, 235, .18));
  box-shadow: 0 22px 60px rgba(0, 0, 0, .22);
  font-size: 30px;
  font-weight: 800;
}

.login-visual > strong {
  font-size: 36px;
  font-weight: 850;
}

.login-visual > p {
  max-width: 480px;
  margin: 14px 0 24px;
  color: #c7d7ee;
  font-size: 16px;
  line-height: 2;
}

.login-feature-list {
  display: grid;
  gap: 10px;
  color: #dbeafe;
  font-size: 13px;
}

.login-card {
  justify-self: start;
  width: min(460px, 100%);
  padding: 36px;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(2, 12, 27, .3);
}

.login-card .brand {
  border: 0;
  margin: 14px 0 28px;
  padding: 0;
}

.login-card .brand strong {
  color: var(--fara-text);
}

.login-card .brand small {
  color: var(--fara-muted);
}

.login-card h1 {
  margin: 0 0 5px;
  color: var(--fara-text);
  font-size: 28px;
}

.login-card > p {
  margin-bottom: 26px;
}

.login-language select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--fara-border);
  border-radius: 10px;
  background: #fff;
}

.login-note {
  display: block;
  margin-top: 20px;
  text-align: center;
  color: var(--fara-tertiary);
  font-size: 10px;
}

/* Direction and responsiveness ---------------------------------------- */
html[dir="rtl"] th:where(:not(.dashboard-shell *)),
html[dir="rtl"] td:where(:not(.dashboard-shell *)) {
  text-align: right;
}

html[dir="ltr"] .sidebar nav a:hover,
html[dir="ltr"] #app-sidebar nav a:hover {
  transform: translateX(2px);
}

@media (max-width: 1180px) {
  :root {
    --fara-sidebar-width: 224px;
  }

  .content {
    padding: 24px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    display: flex !important;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 60;
    width: min(84vw, 292px);
    height: 100vh;
    transform: translateX(110%);
    transition: transform .22s ease;
    box-shadow: -24px 0 70px rgba(2, 12, 27, .34);
  }

  html[dir="ltr"] .sidebar {
    transform: translateX(-110%);
  }

  .main {
    height: auto;
    min-height: 100%;
    margin: 0;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    min-height: 70px;
    padding: 11px 14px;
  }

  .topbar h1 {
    max-width: min(54vw, 360px);
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-toggle {
    display: grid;
    place-items: center;
    flex: 0 0 40px;
  }

  .content {
    min-height: calc(100% - 70px);
    padding: 18px 14px 26px;
  }

  .hero {
    min-height: 0;
    padding: 24px 20px;
    border-radius: 19px;
  }

  .hero h2 {
    font-size: 22px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat {
    min-height: 116px;
  }

  .panel:where(:not(.dashboard-shell *)),
.form-runtime,
.stacked-form {
    max-width: 100%;
    overflow: hidden;
    border-radius: 17px;
  }

  .panel-head:where(:not(.dashboard-shell *)),
.panel-heading {
    min-width: 0;
    padding: 16px;
  }

  .login-page {
    display: grid;
    grid-template-columns: 1fr;
    min-height: 100vh;
    height: auto;
    padding: 16px;
    overflow: auto;
  }

  .login-visual {
    display: none;
  }

  .login-card {
    justify-self: center;
    padding: 28px 22px;
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.sidebar-user__avatar {
  overflow: hidden;
}

.sidebar-user__avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* Account controls live outside product navigation and are shared by both shells. */
.sidebar-footer {
  position: relative;
}

.sidebar-account {
  position: relative;
}

.sidebar-account > summary {
  list-style: none;
}

.sidebar-account > summary::-webkit-details-marker {
  display: none;
}

.sidebar-user--trigger {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: start;
  color: inherit;
  cursor: pointer;
}

.sidebar-user--trigger:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.sidebar-user--trigger.active,
.sidebar-account[open] .sidebar-user--trigger {
  background: rgba(96, 165, 250, .11);
}

.sidebar-user__chevron {
  flex: 0 0 auto;
  color: #8fa0b9;
  font-size: 14px;
  transition: transform .16s ease;
}

.sidebar-user__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #94a3b8;
  transition: transform .2s ease, color .16s ease;
}

.sidebar-user:hover .sidebar-user__chevron {
  color: #ffffff;
}

.sidebar-account[open] .sidebar-user__chevron {
  transform: rotate(180deg);
  color: #60a5fa;
}

.account-menu {
  position: absolute;
  inset-inline: 0;
  bottom: calc(100% + 8px);
  z-index: 50;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  background: #111a2e;
  backdrop-filter: blur(16px);
  color: #e5edf8;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
}

.account-menu__header {
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.account-menu__header strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu__header small {
  display: block;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu > a,
.account-menu__logout button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #cbd5e1;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  text-align: start;
  cursor: pointer;
  transition: all .15s ease;
}

.account-menu > a:hover,
.account-menu > a:focus-visible {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.account-menu__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: #94a3b8;
  transition: color .15s ease;
}

.account-menu > a:hover .account-menu__icon {
  color: #60a5fa;
}

.account-menu__language {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 500;
}

.account-menu__language label {
  flex: 1;
}

.account-menu__language form {
  margin: 0;
}

.account-menu__language select {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 6px;
  padding: 2px 8px;
  background: #182338;
  color: #e5edf8;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s ease;
}

.account-menu__language select:hover,
.account-menu__language select:focus {
  border-color: rgba(96, 165, 250, .5);
}

.account-menu__divider {
  height: 1px;
  margin: 4px 6px;
  background: rgba(255, 255, 255, .08);
}

.account-menu__logout {
  margin: 0;
}

.account-menu__logout button {
  color: #f87171;
}

.account-menu__logout button .account-menu__icon {
  color: #f87171;
}

.account-menu__logout button:hover,
.account-menu__logout button:focus-visible {
  background: rgba(239, 68, 68, .12);
  color: #fca5a5;
}

.account-menu__logout button:hover .account-menu__icon {
  color: #fca5a5;
}

/* Shared control rhythm ---------------------------------------------------
   Primary actions, secondary actions and form footers keep one visual height
   and spacing across engines. Feature CSS may refine layout, not control size. */
.actions,
.form-actions,
.form-footer:where(:not(.dashboard-shell *)) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}

.primary,
.secondary,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 15px;
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
  text-decoration: none;
  cursor: pointer;
}

.button {
  border: 1px solid var(--fara-border-strong);
  background: #fff;
  color: #40516b;
}

.button:hover,
.button:focus-visible {
  border-color: #bdd2ff;
  background: var(--fara-primary-soft);
  color: var(--fara-primary-hover);
}

.button.primary {
  border-color: var(--fara-primary);
  background: linear-gradient(135deg, var(--fara-primary-hover), #3b82f6);
  color: #fff;
}

.form-footer:where(:not(.dashboard-shell *)),
.form-actions {
  justify-content: flex-end;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

[data-afraz-money-input] {
  direction: ltr;
  text-align: start;
  font-variant-numeric: tabular-nums;
}

html[dir="rtl"] [data-afraz-money-input] {
  direction: rtl;
  text-align: right;
}

@media (max-width: 700px) {
  .form-footer > *:where(:not(.dashboard-shell *)),
.form-actions > * {
    flex: 1 1 10rem;
  }
}

.global-search {
  width: min(560px, calc(100vw - 32px));
  margin: 12vh auto 0;
  padding: 0;
  border: 1px solid var(--fara-border);
  border-radius: 16px;
  background: var(--fara-surface);
  color: var(--fara-text);
  box-shadow: var(--fara-shadow-lg);
}

.global-search::backdrop {
  background: rgba(12, 22, 38, .45);
  backdrop-filter: blur(3px);
}

.global-search__input {
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border: 0;
  border-bottom: 1px solid var(--fara-border);
  background: transparent;
  color: inherit;
  font-size: 14px;
  outline: 0;
}

.global-search__list {
  max-height: 320px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.global-search__list a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: inherit;
  font-size: 13px;
  text-decoration: none;
}

.global-search__list a[aria-selected="true"],
.global-search__list a:hover {
  background: var(--fara-primary-soft);
  color: var(--fara-primary);
}

.global-search__group {
  padding: 10px 12px 4px;
  color: var(--fara-muted);
  font-size: 11px;
  font-weight: 600;
}

.global-search__empty {
  margin: 0;
  padding: 18px;
  color: var(--fara-muted);
  font-size: 13px;
  text-align: center;
}
