/*
 * 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: 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;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.brand {
  min-height: 56px;
  padding: 0 8px 12px;
  margin-bottom: 10px;
  gap: 11px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--fara-primary), #3b82f6);
  box-shadow: 0 12px 28px rgba(37, 99, 235, .3);
  font-size: 17px;
}

.brand strong {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.brand small {
  margin-top: 3px;
  color: #93a7c5;
  font-size: 9px;
  letter-spacing: .04em;
}

.sidebar nav {
  flex: 1;
  min-height: 0;
  gap: 2px;
  padding: 0 2px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(147, 197, 253, .16) transparent;
}

.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 {
  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);
}

.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. */
.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 {
  border-color: #2563eb;
  background: #fff;
  color: var(--fara-primary);
}

.sidebar-footer {
  margin-top: 0;
  padding: 10px 2px 0;
  border-top: 1px solid rgba(148, 163, 184, .12);
}

.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;
}

.sidebar-user .logout-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #8fa0b9;
}

.sidebar-user .logout-button:hover {
  background: rgba(244, 63, 94, .1);
  color: #fecdd3;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  height: calc(100vh - 32px);
  margin-block: 16px;
  margin-inline: 0 16px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--fara-surface);
  border-radius: 28px;
  box-shadow: var(--fara-shadow-lg);
  scrollbar-gutter: stable;
}

.topbar {
  min-height: 78px;
  height: auto;
  padding: 13px 28px;
  border: 0;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 0 rgba(210, 221, 236, .72), 0 8px 26px rgba(37, 56, 88, .035);
  backdrop-filter: blur(18px);
}

.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 {
  gap: 9px;
}

.notification-button,
.language-switcher select,
.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,
.language-switcher select: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;
}

.language-switcher select {
  min-width: 92px;
  padding: 0 12px;
}

.mobile-nav-toggle {
  display: none;
  width: 40px;
  padding: 0;
  font-size: 18px;
}

.sidebar-scrim {
  display: none;
}

/* 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 {
  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,
.table-card,
.info-card,
.runtime-field,
.builder-field,
.collaboration-card,
.work-item-completion-card,
.version-diagram-card,
.version-metadata-card {
  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;
}

.grid-2 {
  gap: 18px;
}

.panel {
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head,
.panel-heading,
.card-heading,
.collaboration-card__header,
.work-item-completion-card__header {
  padding: 18px 21px;
  border-bottom: 1px solid var(--fara-border);
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.panel-head h3,
.panel-heading h2,
.card-heading h2 {
  color: var(--fara-text);
  font-size: 15px;
  font-weight: 800;
}

.panel-head p,
.panel-heading p,
.card-heading p {
  color: var(--fara-muted);
}

.panel-head a,
.text-link,
.link-button {
  color: var(--fara-primary);
}

.quick-actions {
  gap: 10px;
  padding: 18px;
}

.quick-actions a {
  position: relative;
  padding: 15px 16px;
  border-color: var(--fara-border);
  border-radius: 13px;
  background: var(--fara-surface-muted);
  color: #31425d;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.quick-actions a:hover {
  border-color: #bfdbfe;
  background: var(--fara-primary-soft);
  color: var(--fara-primary-hover);
  transform: translateY(-1px);
}

.bar-row {
  padding: 13px 21px;
}

.bar {
  height: 7px;
  background: #eaf0f8;
}

.bar i {
  background: linear-gradient(90deg, #60a5fa, var(--fara-primary));
}

/* Tables ---------------------------------------------------------------- */
table {
  background: #fff;
}

.process-instance-table {
  table-layout: auto !important;
}

th,
td {
  padding: 13px 17px;
  border-bottom-color: var(--fara-border);
}

th {
  background: #f7f9fc;
  color: #71809a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}

tbody tr {
  transition: background .14s ease;
}

tbody tr:hover {
  background: #f8fbff;
}

.table-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c5d2e3 transparent;
}

.table-scroll-wrapper {
  border-radius: 15px;
  scrollbar-width: thin;
  scrollbar-color: #cbd8e9 transparent;
}

.table-primary-cell strong,
.table-key,
.table-reference {
  color: var(--fara-text);
}

.table-subtitle,
.table-email,
.table-date,
.table-version,
.table-number,
.muted {
  color: var(--fara-muted);
}

.empty,
.empty-cell,
.empty-state,
.collaboration-empty {
  color: var(--fara-muted);
}

/* Buttons and forms ----------------------------------------------------- */
.primary,
.secondary,
.icon-action,
.table-action,
.logout-button,
.fara-button {
  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,
.table-action {
  border: 1px solid var(--fara-border-strong);
  background: #fff;
  color: #40516b;
}

.secondary:hover,
.table-action: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,
.field select,
.field textarea,
.runtime-field input,
.runtime-field select,
.runtime-field textarea,
.stacked-form input,
.stacked-form select,
.stacked-form textarea,
.rule-simulation-field input,
.rule-simulation-field select,
.rule-simulation-field textarea,
.rule-builder-form input,
.rule-builder-form select,
.rule-builder-form textarea,
.task-assignment-form input,
.task-assignment-form select,
.task-assignment-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"],
input[type="radio"] {
  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,
.runtime-field textarea,
.stacked-form textarea,
.rule-builder-form textarea {
  min-height: 110px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.runtime-field input:focus,
.runtime-field select:focus,
.runtime-field textarea:focus,
.stacked-form input:focus,
.stacked-form select:focus,
.stacked-form textarea:focus,
.rule-builder-form input:focus,
.rule-builder-form select:focus,
.rule-builder-form textarea:focus,
.task-assignment-form input:focus,
.task-assignment-form select:focus,
.task-assignment-form textarea:focus {
  outline: 0;
  border-color: #79a7f5;
  box-shadow: var(--fara-focus);
}

.field label,
.runtime-field label,
.assignment-field label {
  color: #43516a;
  font-size: 12px;
  font-weight: 750;
}

.form-panel,
.form-runtime,
.builder-panel,
.stacked-form,
.narrow-card {
  border: 1px solid rgba(210, 221, 236, .76);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--fara-shadow-md);
}

.page-actions {
  align-items: center;
  padding: 4px 2px;
  margin-bottom: 20px;
}

.page-actions h2 {
  color: var(--fara-text);
  font-size: 25px;
  letter-spacing: -.2px;
}

.page-actions p {
  color: var(--fara-muted);
}

.form-footer,
.builder-actions,
.rule-builder-submit {
  border-top-color: var(--fara-border);
}

.error,
.field-error,
.form-errors {
  color: var(--fara-danger);
}

/* Status, cards and messages ------------------------------------------- */
.pill,
.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,
.rule-simulation-result--match {
  background: #ecfdf3;
  color: #15803d;
}

/* Management-table cells are layout containers, never badges themselves. */
.management-table td.table-status,
.management-table td.table-mode,
.management-table td:last-child {
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-weight: inherit;
}

.management-table .status,
.management-table .status-pill,
.management-table .table-mode > .table-nowrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  min-height: 28px;
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--fara-primary-soft);
  color: var(--fara-primary-hover);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.management-table .status.on,
.management-table .status-published,
.management-table .status-completed {
  background: #ecfdf3;
  color: #15803d;
}

.management-table .status-review,
.management-table .status-waiting,
.management-table .status-suspended {
  background: #fff7e6;
  color: #a16207;
}

.management-table .status-failed,
.management-table .status-cancelled {
  background: #fff1f2;
  color: #be123c;
}

.management-table .status-draft,
.management-table .status-superseded {
  background: #f1f5f9;
  color: #64748b;
}

/* RBAC assignment table: keep boolean values as compact single-line badges. */
.membership-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.membership-table th,
.membership-table td {
  vertical-align: middle;
}

.membership-table th:nth-child(1) { width: 28%; }
.membership-table th:nth-child(2) { width: 18%; }
.membership-table th:nth-child(3) { width: 44%; }
.membership-table th:nth-child(4) { width: 10%; }

.membership-flag-cell,
.membership-status-cell {
  min-width: 6.5rem;
  text-align: center !important;
  white-space: nowrap;
}

.membership-badge {
  width: auto;
  min-width: 3.75rem;
  max-width: none;
  min-height: 30px;
  padding: 6px 12px;
  line-height: 1.35;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-break: keep-all !important;
}

.membership-badge--primary {
  background: var(--fara-primary-soft);
  color: var(--fara-primary-hover);
}

.membership-badge--active {
  background: #ecfdf3;
  color: #15803d;
}

.membership-badge--inactive {
  background: #f1f5f9;
  color: #64748b;
}

/* Keep wide grids inside their card and allocate space to business content. */
.content,
.page-actions,
.panel,
.table-card {
  min-width: 0;
  max-width: 100%;
}

.content {
  overflow-x: hidden;
}

.table-card > .management-table {
  width: 100% !important;
  max-width: none !important;
  border-collapse: separate;
  border-spacing: 0;
}

.management-table th,
.management-table td {
  padding: 13px 14px;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}

.management-table .table-primary-cell {
  min-width: 0;
  max-width: 30rem;
}

.management-table .table-key,
.management-table .table-reference {
  min-width: 10rem;
  max-width: 22rem;
  overflow-wrap: normal;
  word-break: normal;
}

.management-table .table-email {
  min-width: 0;
  font-size: 11px;
}

.management-table .table-actions-cell {
  min-width: 0;
}

.management-table .row-actions,
.management-table td.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: auto;
  min-width: 0;
  max-width: 18rem;
}

.management-table .row-actions > a,
.management-table .row-actions > button,
.management-table .row-actions form > button,
.management-table .table-action {
  flex: 1 1 6.5rem;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 11px;
}

.form-definition-table,
.process-definition-table,
.process-instance-table {
  table-layout: auto !important;
}

.form-definition-table {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
}

.form-definition-table th:nth-child(1) { width: 31%; }
.form-definition-table th:nth-child(2) { width: 7%; }
.form-definition-table th:nth-child(3) { width: 7%; }
.form-definition-table th:nth-child(4) { width: 11%; }
.form-definition-table th:nth-child(5) { width: 20%; }
.form-definition-table th:nth-child(6) { width: 24%; }

.process-definition-table {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
}

.process-definition-table th,
.process-definition-table td {
  max-width: none !important;
}

.process-definition-table th:nth-child(1) { width: 28%; }
.process-definition-table th:nth-child(2) { width: 10%; }
.process-definition-table th:nth-child(3) { width: 10%; }
.process-definition-table th:nth-child(4) { width: 7%; }
.process-definition-table th:nth-child(5) { width: 15%; }
.process-definition-table th:nth-child(6) { width: 30%; }

.process-definition-table .table-primary-cell {
  min-width: 0 !important;
  overflow-wrap: normal;
}

.process-definition-table .table-key code {
  overflow-wrap: break-word;
  word-break: normal;
}

.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-definition-table .table-version,
.process-definition-table .table-number,
.process-definition-table .table-status,
.process-definition-table .table-date,
.process-definition-table .table-actions-cell {
  width: auto !important;
}

.process-definition-table .table-version,
.process-definition-table .table-number,
.process-definition-table .table-status,
.process-definition-table .table-date {
  text-align: center !important;
  white-space: nowrap;
}

.process-definition-table .table-date {
  direction: rtl;
  unicode-bidi: isolate;
  font-size: 11px;
}

.process-definition-table .table-actions-cell {
  padding-inline: 10px;
}

.process-definition-table .row-actions {
  display: flex;
  flex-wrap: wrap;
  width: auto;
}

.process-definition-table .table-action {
  width: auto;
  min-width: 0;
  padding-inline: 8px;
}

.process-definition-table-card {
  overflow-x: auto;
}

@media (max-width: 900px) {
  .process-definition-table-card {
    overflow-x: auto;
  }

  .process-definition-table {
    min-width: 52rem !important;
    max-width: none !important;
  }
}

.process-instance-table-card,
.runtime-table-card,
.form-definition-table-card,
.process-definition-table-card,
.table-card:has(> .membership-table) {
  container-type: inline-size;
  overflow-x: auto !important;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #b9c9dc transparent;
}

.process-instance-table,
.runtime-work-table {
  width: 100% !important;
  min-width: 64rem !important;
  max-width: none !important;
  table-layout: auto !important;
}

.process-instance-table th,
.process-instance-table td,
.runtime-work-table th,
.runtime-work-table td {
  max-width: none !important;
  padding: 12px 13px;
  line-height: 1.65;
  vertical-align: middle;
  overflow-wrap: normal;
  word-break: normal;
}

/* Process instances: related metadata is grouped so six readable columns
   replace the previous nine cramped columns. */
.process-instance-table th:nth-child(1) { width: 5%; }
.process-instance-table th:nth-child(2) { width: 23%; }
.process-instance-table th:nth-child(3) { width: 24%; }
.process-instance-table th:nth-child(4) { width: 14%; }
.process-instance-table th:nth-child(5) { width: 24%; }
.process-instance-table th:nth-child(6) { width: 10%; }

.process-instance-table .table-instance-id,
.process-instance-table .table-status,
.process-instance-table .table-actions-cell {
  width: auto !important;
  text-align: center !important;
}

.process-instance-table .table-primary-cell,
.process-instance-table .table-reference {
  width: auto !important;
  max-width: none !important;
  white-space: normal !important;
  overflow-wrap: normal !important;
  word-break: normal !important;
}

.process-instance-table .table-reference {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: start;
}

.process-instance-summary strong,
.process-instance-started .table-email,
.process-instance-started .table-date,
.process-instance-state .table-mode {
  display: block;
}

.process-instance-summary .table-version,
.process-instance-state .table-mode,
.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;
}

.process-instance-table .row-actions.single-action {
  display: flex;
  width: 100%;
  justify-content: center;
}

.process-instance-table .row-actions.single-action .table-action {
  width: 100%;
  min-width: 0;
}

/* Work queue: task ownership lives with the task, eliminating the narrow
   status/email column that previously broke addresses character by character. */
.runtime-work-table th:nth-child(1) { width: 23%; }
.runtime-work-table th:nth-child(2) { width: 18%; }
.runtime-work-table th:nth-child(3) { width: 20%; }
.runtime-work-table th:nth-child(4) { width: 12%; }
.runtime-work-table th:nth-child(5) { width: 15%; }
.runtime-work-table th:nth-child(6) { width: 12%; }

.runtime-task-summary strong,
.runtime-process-summary,
.runtime-task-assignee,
.runtime-work-table .table-subtitle {
  display: block;
}

.runtime-task-state {
  display: grid;
  gap: 3px;
  margin-top: 7px;
  color: var(--fara-muted);
  font-size: 10px;
}

.runtime-task-assignee {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: start;
  font-size: 11px;
  white-space: nowrap;
}

.runtime-work-table .table-reference {
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: start;
  overflow-wrap: break-word;
}

.runtime-work-table .table-date {
  direction: rtl;
  unicode-bidi: isolate;
  text-align: center !important;
  font-size: 11px;
}

.runtime-work-table .task-priority {
  min-width: 0;
  white-space: nowrap;
}

.runtime-work-table .actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 0 !important;
}

.runtime-work-table .actions > a,
.runtime-work-table .actions > form,
.runtime-work-table .actions button {
  width: 100%;
  min-width: 0;
  margin: 0;
}

@container (max-width: 60rem) {
  .process-instance-table {
    min-width: 60rem !important;
    max-width: none !important;
  }

  .runtime-work-table {
    min-width: 56rem !important;
    max-width: none !important;
  }

  .form-definition-table,
  .process-definition-table {
    min-width: 52rem !important;
    max-width: none !important;
  }

  .membership-table {
    min-width: 52rem;
  }
}

.info-card,
.immutable-banner,
.request-context-notice,
.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"] .info-card,
html[dir="rtl"] .immutable-banner,
html[dir="rtl"] .request-context-notice,
html[dir="rtl"] .runtime-check,
html[dir="rtl"] .alert-panel {
  box-shadow: inset -3px 0 0 #93c5fd, var(--fara-shadow-sm);
}

.success-card,
.empty-state {
  border: 1px solid var(--fara-border);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--fara-shadow-md);
}

.success-icon {
  background: #ecfdf3;
  color: var(--fara-success);
}

/* Rule engine ----------------------------------------------------------- */
.rule-summary-strip {
  gap: 12px;
}

.rule-summary-strip > div {
  border: 1px solid var(--fara-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--fara-shadow-sm);
}

.rule-business-panel,
.rule-effect-panel,
.rule-editor-panel,
.rule-simulation-panel {
  border-color: rgba(210, 221, 236, .76);
  border-radius: 22px;
}

.rule-business-panel > .eyebrow,
.rule-simulation-panel > .eyebrow,
.rule-effect-panel > .eyebrow {
  color: var(--fara-primary);
}

.rule-effect-panel > .rule-effect-list,
.rule-simulation-panel > .rule-visual-form {
  min-width: 0;
  max-width: calc(100% - 3rem);
}

.rule-simulation-grid,
.rule-simulation-field,
.rule-simulation-field input,
.rule-simulation-field select,
.rule-simulation-field textarea {
  min-width: 0;
  max-width: 100%;
}

.rule-condition-row,
.rule-effect-card,
.rule-decision-summary-card,
.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);
}

.rule-if {
  background: var(--fara-primary-muted);
  color: var(--fara-primary-hover);
}

.rule-logic-joiner,
.rule-output-summary span {
  background: #eef3f9;
  color: #52647d;
}

.rule-simulation-result {
  border: 0;
  box-shadow: var(--fara-shadow-sm);
}

/* Runtime, tasks, notifications and collaboration ---------------------- */
.history-summary,
.work-item-sla-summary,
.runtime-filter-bar,
.notification-filter-bar,
.runtime-pagination {
  border-color: var(--fara-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--fara-shadow-sm);
}

.notification-card,
.collaboration-entry,
.version-task,
.process-context-list,
.readonly-form-field,
.assignment-history {
  border-color: var(--fara-border);
  border-radius: 14px;
  background: #fff;
}

.notification-card:hover,
.collaboration-entry:hover,
.version-task:hover {
  border-color: #bfdbfe;
  box-shadow: var(--fara-shadow-sm);
}

.notification-card:not(.is-read),
.notification-card.unread {
  background: #f6f9ff;
}

.notification-unread-dot {
  background: var(--fara-primary);
}

.collaboration-entry__marker,
.building-block-icon,
.inspector-empty-icon {
  background: var(--fara-primary-soft);
  color: var(--fara-primary);
}

.work-item-completion-actions,
.task-secondary-actions,
.task-assignment-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-building-blocks .building-block,
.workflow-task-outline,
.workflow-guidance,
.designer-section,
.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,
html[dir="rtl"] td {
  text-align: right;
}

html[dir="ltr"] .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) {
  .rule-effect-panel > .rule-effect-list,
  .rule-simulation-panel > .rule-visual-form {
    max-width: calc(100% - 2rem);
  }

  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%);
  }

  .sidebar-open .sidebar,
  html[dir="ltr"] .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: block;
    visibility: hidden;
    opacity: 0;
    border: 0;
    background: rgba(8, 20, 44, .5);
    backdrop-filter: blur(3px);
    transition: opacity .2s ease, visibility .2s ease;
  }

  .sidebar-open .sidebar-scrim {
    visibility: visible;
    opacity: 1;
  }

  .main {
    height: calc(100vh - 16px);
    margin: 8px;
    overflow-y: auto;
    border-radius: 20px;
  }

  .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;
  }

  .language-switcher select {
    min-width: 72px;
    max-width: 78px;
  }

  .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,
  .form-panel,
  .form-runtime,
  .builder-panel,
  .stacked-form,
  .narrow-card {
    max-width: 100%;
    overflow: hidden;
    border-radius: 17px;
  }

  .panel-head,
  .panel-heading,
  .card-heading {
    min-width: 0;
    padding: 16px;
  }

  .page-actions {
    align-items: stretch;
  }

  .page-actions .actions,
  .page-actions > a,
  .page-actions > button {
    width: 100%;
  }

  .table-card,
  .table-scroll-wrapper {
    overflow-x: auto;
  }

  .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__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  border-radius: 10px;
}

.sidebar-user__identity:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 3px;
}

.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-account[open] .sidebar-user__chevron {
  transform: rotate(180deg);
}

.account-menu {
  position: absolute;
  inset-inline: 0;
  bottom: calc(100% + 10px);
  z-index: 30;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 14px;
  background: #111c2e;
  color: #e5edf8;
  box-shadow: 0 18px 42px rgba(2, 8, 23, .32);
}

.account-menu__header {
  padding: 9px 10px 11px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, .14);
}

.account-menu__header strong,
.account-menu__header small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu__header strong {
  font-size: 12px;
}

.account-menu__header small {
  margin-top: 4px;
  color: #92a2ba;
  font-size: 10px;
}

.account-menu > a,
.account-menu__logout button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #dce6f5;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  text-align: start;
  cursor: pointer;
}

.account-menu > a:hover,
.account-menu > a:focus-visible,
.account-menu__logout button:hover,
.account-menu__logout button:focus-visible {
  background: rgba(96, 165, 250, .10);
  outline: none;
}

.account-menu__language {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  color: #dce6f5;
  font-size: 11px;
  font-weight: 700;
}

.account-menu__language form {
  margin: 0;
}

.account-menu__language select {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 8px;
  padding: 4px 8px;
  background: #17243a;
  color: #e5edf8;
  font: inherit;
  font-size: 10px;
}

.account-menu__divider {
  height: 1px;
  margin: 5px 4px;
  background: rgba(148, 163, 184, .14);
}

.account-menu__logout {
  margin: 0;
}

.account-menu__logout button:hover,
.account-menu__logout button:focus-visible {
  background: rgba(244, 63, 94, .10);
  color: #fecdd3;
}

/* 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,
.button-row,
.builder-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}

.primary,
.secondary,
.button,
.fara-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,
.button-row,
.builder-actions,
.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 > *,
  .button-row > *,
  .form-actions > * {
    flex: 1 1 10rem;
  }
}
