/* Amesbah / اتوماسیون مصباح — Able Pro RTL + Yekan Bakh + visual polish */
:root {
  --amesbah-font: 'Yekan Bakh', Tahoma, sans-serif;
  --bs-body-font-family: var(--amesbah-font);
  --bs-font-sans-serif: var(--amesbah-font);

  /* Brand core */
  --am-ink: #0f2a3d;
  --am-ink-muted: #5f6f7c;
  --am-ink-faint: #8a97a3;
  --am-teal: #1a7a6d;
  --am-teal-deep: #0f4f5c;
  --am-teal-mid: #2a9a88;
  --am-teal-hover: #15675c;
  --am-teal-soft: #e6f4f1;
  --am-teal-softer: #f3fbf9;
  --am-gold: #c4a35a;
  --am-gold-soft: #f7f1e4;

  /* Surfaces */
  --am-surface: #f0f4f7;
  --am-card: #ffffff;
  --am-border: rgba(15, 42, 61, 0.08);
  --am-border-strong: rgba(15, 42, 61, 0.14);
  --am-shadow: 0 10px 30px rgba(15, 42, 61, 0.06);
  --am-shadow-hover: 0 16px 40px rgba(15, 42, 61, 0.1);
  --am-radius: 14px;
  --am-radius-sm: 10px;

  /* Sidebar shell — layered teal ink, light text */
  --am-sidebar-bg: #0b3d46;
  --am-sidebar-bg-top: #134e58;
  --am-sidebar-bg-mid: #0d3f48;
  --am-sidebar-bg-bottom: #0a353d;
  --am-sidebar-glow-a: rgba(42, 154, 136, 0.35);
  --am-sidebar-glow-b: rgba(15, 79, 92, 0.55);
  --am-sidebar-border: rgba(255, 255, 255, 0.09);
  --am-sidebar-text: rgba(240, 250, 247, 0.94);
  --am-sidebar-text-muted: rgba(170, 210, 200, 0.72);
  --am-sidebar-caption: rgba(140, 195, 185, 0.55);
  --am-sidebar-active-bg: rgba(90, 190, 170, 0.22);
  --am-sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --am-sidebar-active-text: #ffffff;
  --am-sidebar-accent: #7dd4c4;
  --am-sidebar-accent-soft: rgba(125, 212, 196, 0.28);
  --am-sidebar-well: rgba(255, 255, 255, 0.08);
  --am-sidebar-well-active: rgba(125, 212, 196, 0.22);
  --am-brand-from: #4ec4b0;
  --am-brand-mid: #1f8a7a;
  --am-brand-to: #166b5f;
  --am-primary-rgb: 26, 122, 109;

  /* Bridge → Bootstrap / Able */
  --bs-primary: var(--am-teal);
  --bs-primary-rgb: var(--am-primary-rgb);
  --bs-primary-light: var(--am-teal-soft);
  --bs-link-color: var(--am-teal);
  --bs-link-hover-color: var(--am-teal-hover);
  --pc-sidebar-active-color: var(--am-teal);

  /* Semantic tones (shared with dashboard KPIs) */
  --am-amber: #c47a1a;
  --am-amber-soft: #fff6e8;
  --am-rose: #c0392b;
  --am-rose-soft: #fdecea;
  --am-green: #1f8a5b;
  --am-green-soft: #e8f7ef;
  --am-slate: #5b6b7a;
  --am-slate-soft: #eef2f5;
  --am-sky: #2f6f8f;
  --am-sky-soft: #e8f3f7;
}

html,
body,
.pc-sidebar,
.pc-header,
.pc-container,
.auth-main,
.pc-footer,
button,
input,
select,
textarea,
.form-control,
.btn,
.dropdown-menu,
.card,
.table,
h1, h2, h3, h4, h5, h6,
.pc-mtext,
.breadcrumb {
  font-family: var(--amesbah-font) !important;
  /* خاموش کردن salt/liga قالب Able که ی را کشیده می‌کند */
  font-feature-settings: normal !important;
  font-variant-ligatures: none !important;
  font-stretch: normal !important;
  letter-spacing: normal !important;
  font-synthesis: none;
  text-rendering: auto;
}

body {
  background: var(--am-surface) !important;
  font-weight: 400;
}

.pc-container .pc-content {
  /* فقط opacity — transform اینجا stacking context می‌سازد و مودال زیر backdrop می‌ماند */
  animation: amFadeIn 0.3s ease both;
}

@keyframes amFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/*
 * مودال باید مستقیم روی body و بالاتر از backdrop باشد.
 * Able: modal 1081 / backdrop 1071 — ما صریح‌تر override می‌کنیم.
 */
.modal {
  position: fixed !important;
  z-index: 1085 !important;
}
.modal.fade.show,
.modal.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.modal-backdrop {
  position: fixed !important;
  z-index: 1080 !important;
}
.modal-backdrop.show {
  opacity: 0.5 !important;
}
.modal-dialog {
  pointer-events: auto !important;
  z-index: auto;
  margin-top: 1.75rem;
  margin-bottom: 1.75rem;
}
.modal.show .modal-dialog,
.modal.fade.show .modal-dialog {
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.modal-content {
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
  background-color: #fff !important;
  color: var(--am-ink, #0f2a3d) !important;
  opacity: 1 !important;
  visibility: visible !important;
  box-shadow: 0 12px 40px rgba(15, 42, 61, 0.18);
}

/* ========== Sidebar shell ========== */
.pc-sidebar.amesbah-sidebar,
.pc-sidebar {
  border-left: 1px solid var(--am-sidebar-border);
  background:
    radial-gradient(ellipse 120% 55% at 100% -5%, var(--am-sidebar-glow-a), transparent 55%),
    radial-gradient(ellipse 90% 40% at 0% 100%, var(--am-sidebar-glow-b), transparent 50%),
    linear-gradient(
      175deg,
      var(--am-sidebar-bg-top) 0%,
      var(--am-sidebar-bg-mid) 48%,
      var(--am-sidebar-bg-bottom) 100%
    ) !important;
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.18);
}

.pc-sidebar .navbar-wrapper {
  background: transparent;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pc-sidebar .m-header,
.pc-sidebar .amesbah-sidebar-header {
  padding: 1.15rem 1rem 1rem !important;
  border-bottom: 1px solid transparent;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.02) 70%,
      transparent 100%
    );
  flex-shrink: 0;
  position: relative;
}

.pc-sidebar .amesbah-sidebar-header::after {
  content: '';
  position: absolute;
  inset-inline: 1rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--am-sidebar-accent-soft) 30%,
    color-mix(in srgb, var(--am-gold) 35%, transparent) 70%,
    transparent
  );
}

.pc-sidebar .m-header .b-brand {
  gap: 0.85rem;
  min-width: 0;
  width: 100%;
  padding: 0.35rem 0.15rem;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  text-decoration: none !important;
  transition: opacity 0.16s ease;
}

.pc-sidebar .m-header .b-brand:hover {
  background: transparent;
  border: none;
  opacity: 0.92;
}

.amesbah-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: linear-gradient(145deg, var(--am-teal-mid) 0%, var(--am-teal) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.amesbah-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  background: #fff;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.22),
    0 0 0 3px var(--am-sidebar-accent-soft, rgba(42, 154, 136, 0.18));
}
.amesbah-brand-logo.sm {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}
.am-brand-logo-lg {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: block;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 79, 92, 0.28);
}

.pc-sidebar .amesbah-brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 1.05rem;
  background:
    linear-gradient(145deg, var(--am-brand-from) 0%, var(--am-brand-mid) 55%, var(--am-brand-to) 100%);
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.28),
    0 0 0 3px var(--am-sidebar-accent-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.am-brand-mark-lg {
  width: 52px;
  height: 52px;
  font-size: 1.2rem;
  border-radius: 14px;
}

.amesbah-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
  gap: 0.18rem;
}

.amesbah-brand-title {
  font-weight: 800;
  font-size: 1.02rem;
  color: var(--am-ink) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-sidebar .amesbah-brand-title {
  color: #fff !important;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
}

.amesbah-brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--am-teal);
  letter-spacing: 0.01em;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-sidebar .amesbah-brand-sub {
  color: rgba(180, 220, 210, 0.78);
  opacity: 1;
  font-size: 0.68rem;
  font-weight: 500;
}

.am-auth-brand {
  font-size: 1.35rem !important;
  white-space: normal;
}

.pc-sidebar .navbar-content,
.pc-sidebar .amesbah-sidebar-body {
  padding-top: 0.45rem !important;
  padding-bottom: 0.35rem !important;
  flex: 1 1 auto;
  min-height: 0;
  /* leave room for sticky user footer (~88px) under SimpleBar */
  height: calc(100vh - 74px - 88px) !important;
}

.pc-sidebar .pc-user-card,
.pc-sidebar .amesbah-user-footer {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.14) 0%,
      rgba(255, 255, 255, 0.05) 100%
    ) !important;
  border-radius: 14px;
  margin: 0.35rem 12px 0.75rem;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  position: relative;
}

.pc-sidebar .amesbah-user-footer::before {
  content: '';
  position: absolute;
  inset-inline: 12px;
  top: -0.45rem;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(125, 212, 196, 0.3) 40%,
    transparent
  );
}

.pc-sidebar .pc-user-card .card-body {
  padding: 0.7rem 0.8rem !important;
}

.pc-sidebar .pc-user-card h6 {
  color: #fff;
  font-weight: 700;
  font-size: 0.84rem;
}

.pc-sidebar .pc-user-card small,
.pc-sidebar .amesbah-user-role {
  color: var(--am-sidebar-text-muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.pc-sidebar .pc-user-card .text-muted {
  color: var(--am-sidebar-text-muted) !important;
}

.pc-sidebar .am-user-avatar {
  width: 40px !important;
  height: 40px !important;
  background: linear-gradient(145deg, #4ec4b0, #1f7a6e);
  border: 2px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.25),
    0 0 0 3px rgba(125, 212, 196, 0.15);
  font-size: 0.95rem;
}

/* Section captions */
.pc-sidebar .pc-caption {
  margin: 0.85rem 0 0.35rem !important;
  padding: 0.4rem 0.85rem 0.35rem !important;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.pc-sidebar .pc-caption:first-child {
  margin-top: 0.25rem !important;
}

.pc-sidebar .pc-caption label {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
  color: var(--am-sidebar-caption) !important;
  text-transform: none;
  position: relative;
  display: inline-block;
  padding: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.pc-sidebar .pc-caption label::after {
  display: none;
}

.pc-sidebar .pc-caption::after {
  content: '';
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(125, 212, 196, 0.28),
    transparent 90%
  );
  border-radius: 999px;
}

.pc-sidebar .pc-navbar {
  padding-inline: 0.55rem 0.6rem;
  padding-bottom: 0.35rem;
}

.pc-sidebar .pc-navbar > .pc-item > .pc-link {
  display: block !important;
  margin: 0.12rem 0;
  padding: 0.7rem 0.85rem !important;
  border-radius: 12px !important;
  color: var(--am-sidebar-text) !important;
  font-weight: 500;
  font-size: 0.86rem;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
  position: relative;
}

/* Able template pattern: .pc-micon > i.ti */
.pc-sidebar .pc-navbar > .pc-item > .pc-link .pc-micon {
  width: 24px;
  height: 24px;
  margin-right: 0 !important;
  margin-left: 12px !important;
  display: inline-block;
  vertical-align: middle;
  text-align: center;
  color: var(--am-sidebar-text-muted) !important;
  background: transparent !important;
  border-radius: 0;
  box-shadow: none !important;
  flex: none;
  font-size: inherit;
}

.pc-sidebar .pc-navbar > .pc-item > .pc-link .pc-micon i {
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

.pc-sidebar .pc-navbar > .pc-item > .pc-link .pc-mtext {
  display: inline-block;
  vertical-align: middle;
  line-height: 1.35;
}

.pc-sidebar .pc-navbar > .pc-item > .pc-link:hover {
  background: var(--am-sidebar-hover-bg) !important;
  color: #fff !important;
}

.pc-sidebar .pc-navbar > .pc-item > .pc-link:hover .pc-micon {
  color: var(--am-sidebar-accent) !important;
  background: transparent !important;
}

/* Active: soft pill + accent rail (RTL: start edge) */
.pc-sidebar .pc-navbar > .pc-item.active > .pc-link {
  background: var(--am-sidebar-active-bg) !important;
  color: var(--am-sidebar-active-text) !important;
  font-weight: 700;
  box-shadow:
    inset 0 0 0 1px rgba(125, 212, 196, 0.22),
    0 4px 14px rgba(0, 0, 0, 0.12);
}

.pc-sidebar .pc-navbar > .pc-item.active > .pc-link::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 18%;
  bottom: 18%;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--am-sidebar-accent), var(--am-teal-mid));
  box-shadow: 0 0 8px var(--am-sidebar-accent-soft);
}

.pc-sidebar .pc-navbar > .pc-item.active > .pc-link .pc-micon {
  color: var(--am-sidebar-accent) !important;
  background: transparent !important;
  box-shadow: none !important;
}

[data-pc-direction='rtl'] .pc-sidebar .pc-navbar > .pc-item > .pc-link .pc-micon {
  margin-right: 0 !important;
  margin-left: 12px !important;
}

/* Able .pc-badge on dark sidebar */
.pc-sidebar .pc-badge {
  background: var(--am-sidebar-accent) !important;
  color: #0b2f2a !important;
  float: left;
  margin-left: 0;
  margin-right: 5px;
}

.pc-sidebar .pc-badge.bg-warning {
  background: #c4a35a !important;
  color: #1a1408 !important;
}

.pc-sidebar .pc-navbar > .pc-item.active > .pc-link .pc-badge {
  background: rgba(255, 255, 255, 0.92) !important;
  color: var(--am-teal-deep) !important;
}

/* ========== Header ========== */
.pc-header {
  backdrop-filter: blur(12px);
  background: rgba(240, 244, 247, 0.88) !important;
  border-bottom: 1px solid var(--am-border);
}

.pc-header .pc-head-link {
  border-radius: var(--am-radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}

.pc-header .pc-head-link:hover {
  background: var(--am-teal-soft) !important;
  color: var(--am-teal) !important;
}

.am-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--am-ink);
}

.amesbah-brand-mark.sm {
  width: 26px;
  height: 26px;
  font-size: 0.7rem;
  border-radius: 8px;
  box-shadow: none;
}

/* Page header */
.page-header {
  margin-bottom: 1.25rem;
}

.page-header-title h2 {
  font-weight: 700;
  color: var(--am-ink);
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.55rem);
}

.am-letter-crumb {
  margin-bottom: 0.65rem;
}

.am-letter-crumb .breadcrumb {
  margin-bottom: 0;
}

.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
}

.breadcrumb-item a {
  color: var(--am-teal);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item.active,
.breadcrumb-item[aria-current="page"] {
  color: #6b7a88;
}

.am-search-group .input-group-text,
.am-search-group .form-control {
  border-radius: 10px;
}

.am-search-group .form-control {
  border-inline-start: 0;
}

.am-search-group .input-group-text {
  border-inline-end: 0;
  color: #8a97a3;
}

/* Cards */
.card {
  border: 1px solid var(--am-border) !important;
  border-radius: var(--am-radius) !important;
  box-shadow: var(--am-shadow) !important;
  overflow: hidden;
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--am-border) !important;
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

.card-header h5 {
  font-weight: 700;
  color: var(--am-ink);
}

/* KPI */
.amesbah-kpi .card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.amesbah-kpi .card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--am-teal), var(--am-gold));
}

.amesbah-kpi .card:hover {
  transform: translateY(-3px);
  box-shadow: var(--am-shadow-hover) !important;
}

.amesbah-kpi .avtar {
  background: var(--am-teal-soft) !important;
  color: var(--am-teal) !important;
}

.amesbah-kpi h4 {
  font-weight: 700;
  color: var(--am-ink);
}

.funnel-pill {
  min-width: 88px;
  padding: 0.85rem 0.5rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--am-border);
  box-shadow: var(--am-shadow);
  transition: transform 0.2s ease;
}

.funnel-pill:hover {
  transform: translateY(-2px);
}

.funnel-pill .count {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--am-ink);
}

/* Buttons */
.btn-primary {
  --bs-btn-bg: var(--am-teal);
  --bs-btn-border-color: var(--am-teal);
  --bs-btn-hover-bg: var(--am-teal-hover);
  --bs-btn-hover-border-color: var(--am-teal-hover);
  --bs-btn-active-bg: var(--am-teal-deep);
  --bs-btn-active-border-color: var(--am-teal-deep);
  background-color: var(--am-teal) !important;
  border-color: var(--am-teal) !important;
  box-shadow: 0 6px 16px rgba(var(--am-primary-rgb), 0.25);
  border-radius: 10px !important;
  font-weight: 600;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--am-teal-hover) !important;
  border-color: var(--am-teal-hover) !important;
  color: #fff !important;
}

.btn-outline-primary {
  --bs-btn-color: var(--am-teal);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--am-teal);
  --bs-btn-hover-bg: var(--am-teal);
  --bs-btn-hover-border-color: var(--am-teal);
  --bs-btn-hover-color: #fff;
  color: var(--am-teal) !important;
  background-color: transparent !important;
  background-image: none !important;
  border-color: var(--am-teal) !important;
  border-radius: 10px !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
  background-color: var(--am-teal) !important;
  border-color: var(--am-teal) !important;
  color: #fff !important;
}

.btn-light-primary {
  background: var(--am-teal-soft) !important;
  color: var(--am-teal) !important;
  border: 0 !important;
  border-radius: 10px !important;
}

.btn-light-secondary {
  border-radius: 10px !important;
}

/* Chips & status */
.lang-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--am-gold-soft);
  color: #8a6d2f;
  border: 1px solid rgba(196, 163, 90, 0.35);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--am-teal-soft);
  color: var(--am-teal);
}

.priority-pill {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #eef2f5;
  color: #5b6b7a;
}

.priority-high,
.priority-urgent {
  background: #fdecea;
  color: #c0392b;
}

.priority-low {
  background: #eef2f5;
  color: #8a97a3;
}

.ltr-cell {
  direction: ltr;
  unicode-bidi: plaintext;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.due-overdue {
  color: #c0392b !important;
  font-weight: 700;
}

/* Tables */
.table > :not(caption) > * > * {
  padding: 0.75rem 0.95rem;
  vertical-align: middle;
}

.table thead th {
  font-weight: 700;
  color: #5b6b7a;
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
  border-bottom-width: 1px !important;
  background: #f7fafb;
  white-space: nowrap;
}

.table-hover tbody tr {
  transition: background 0.15s ease;
}

.table-hover tbody tr:hover {
  background: rgba(26, 122, 109, 0.04);
}

.card-footer {
  background: transparent !important;
  border-top: 1px solid var(--am-border) !important;
  padding: 0.85rem 1rem !important;
}

.card-footer .pagination {
  margin-bottom: 0;
  justify-content: center;
}

.page-link {
  border-radius: 8px !important;
  margin: 0 0.12rem;
  color: var(--am-ink);
  border-color: var(--am-border);
}

.page-item.active .page-link {
  background: var(--am-teal);
  border-color: var(--am-teal);
}

/* Kanban */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.25rem 0.15rem 1.25rem;
  align-items: flex-start;
}

.kanban-column {
  min-width: 290px;
  max-width: 310px;
  background: linear-gradient(180deg, #eef3f6 0%, #e8eef2 100%);
  border-radius: 16px;
  padding: 0.85rem;
  border: 1px solid var(--am-border);
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
  padding: 0.35rem 0.4rem;
}

.kanban-column-header strong {
  color: var(--am-ink);
  font-size: 0.92rem;
}

.kanban-card {
  background: var(--am-card);
  border-radius: 12px;
  padding: 0.95rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--am-border);
  box-shadow: 0 4px 14px rgba(15, 42, 61, 0.04);
  cursor: pointer;
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.kanban-card:hover {
  box-shadow: var(--am-shadow-hover);
  transform: translateY(-2px);
  border-color: rgba(26, 122, 109, 0.25);
}

.kanban-card .meta {
  font-size: 0.75rem;
  color: #6c7a86;
}

.kanban-card h6 {
  color: var(--am-ink);
  font-weight: 700;
  line-height: 1.45;
}

/* Timeline */
.am-timeline {
  position: relative;
  padding-right: 1.1rem;
}

.am-timeline::before {
  content: '';
  position: absolute;
  right: 0.35rem;
  top: 0.2rem;
  bottom: 0.2rem;
  width: 2px;
  background: linear-gradient(180deg, var(--am-teal), transparent);
}

.am-timeline-item {
  position: relative;
  padding: 0 1rem 1.15rem 0;
}

.am-timeline-item::before {
  content: '';
  position: absolute;
  right: -0.05rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--am-teal);
  box-shadow: 0 0 0 3px var(--am-teal-soft);
}

.am-timeline-item .time {
  font-size: 0.72rem;
  color: #7a8a98;
  margin-bottom: 0.15rem;
}

/* Auth */
.auth-amesbah .auth-wrapper.v1 {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-amesbah .auth-wrapper.v1 .auth-form {
  width: 100%;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 10% 10%, rgba(26, 122, 109, 0.18), transparent 55%),
    radial-gradient(800px 400px at 90% 80%, rgba(196, 163, 90, 0.18), transparent 50%),
    linear-gradient(165deg, #f3f7f8 0%, #eef2f4 100%);
}

.auth-amesbah .auth-wrapper.v1 .auth-form .card {
  margin: 0 auto;
  width: 100%;
  max-width: 440px;
  border: 0 !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 50px rgba(15, 42, 61, 0.12) !important;
  overflow: hidden;
}

.auth-amesbah .auth-form .card-body {
  padding: 2.25rem !important;
}

.auth-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--am-gold-soft);
  color: #8a6d2f;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.auth-amesbah .form-control {
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  border-color: var(--am-border);
}

.auth-amesbah .form-control:focus {
  border-color: var(--am-teal);
  box-shadow: 0 0 0 0.2rem rgba(26, 122, 109, 0.15);
}

.auth-demo-hint {
  border: 0;
  border-radius: 12px;
  background: var(--am-teal-soft);
  color: #145a52;
  font-size: 0.85rem;
}

/* Letter action panel */
.am-action-panel {
  background: linear-gradient(160deg, #fff, var(--am-teal-soft));
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius);
  padding: 1.25rem;
}

.am-soft-alert {
  border: 0;
  border-radius: 12px;
  background: var(--am-gold-soft);
  color: #6e5624;
}

.notifier-container,
.daterangepicker {
  font-family: var(--amesbah-font) !important;
}

.text-primary {
  color: var(--am-teal) !important;
}

.bg-light-primary {
  background: var(--am-teal-soft) !important;
  color: var(--am-teal) !important;
}

/* ========== کارتابل مکاتبات (Enterprise Inbox) ========== */
.ibx {
  --ibx-nav-w: 240px;
  --ibx-preview-w: min(420px, 38vw);
  --ibx-row-pad-y: 0.7rem;
  --ibx-row-pad-x: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ibx-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.ibx-chrome-start {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.ibx-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--am-ink-faint);
  margin-bottom: 0.15rem;
}

.ibx-breadcrumb a {
  color: var(--am-ink-muted);
  text-decoration: none;
}

.ibx-breadcrumb a:hover { color: var(--am-teal); }

.ibx-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--am-ink);
  margin: 0;
  line-height: 1.25;
}

.ibx-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--am-ink-muted);
}

.ibx-chrome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.ibx-nav-toggle {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--am-border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--am-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.ibx-shell {
  display: grid;
  grid-template-columns: var(--ibx-nav-w) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: stretch;
  min-height: calc(100vh - 210px);
}

.ibx-nav-panel {
  background: var(--am-card);
  border: 1px solid var(--am-border);
  border-radius: 12px;
  padding: 0.75rem;
  height: 100%;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.ibx-nav-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.45rem 0.75rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--am-border);
}

.ibx-nav-user .amesbah-brand-mark {
  width: 2.1rem;
  height: 2.1rem;
  font-size: 0.95rem;
}

.ibx-nav-user-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.ibx-nav-user-text strong {
  font-size: 0.88rem;
  color: var(--am-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ibx-nav-user-text span {
  font-size: 0.72rem;
  color: var(--am-ink-faint);
}

.ibx-nav-label {
  margin: 0.85rem 0.45rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--am-ink-faint);
  text-transform: none;
}

.ibx-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.48rem 0.55rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--am-ink);
  border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}

.ibx-folder:hover {
  background: rgba(26, 122, 109, 0.06);
  color: var(--am-teal-deep);
}

.ibx-folder.is-active {
  background: var(--am-teal-soft);
  color: var(--am-teal-deep);
  font-weight: 700;
}

.ibx-folder-main {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  min-width: 0;
}

.ibx-folder-main i {
  font-size: 1.05rem;
  opacity: 0.85;
}

.ibx-count {
  min-width: 1.45rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--am-ink-muted);
  background: var(--am-slate-soft);
  font-variant-numeric: tabular-nums;
}

.ibx-count.is-hot {
  background: var(--am-teal-soft);
  color: var(--am-teal-deep);
}

.ibx-count.is-urgent {
  background: var(--am-rose-soft);
  color: var(--am-rose);
}

.ibx-main {
  background: var(--am-card);
  border: 1px solid var(--am-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.ibx-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--am-border);
  background: #fff;
}

.ibx-search {
  flex: 1 1 220px;
  min-width: 0;
}

.ibx-search-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--am-border-strong);
  border-radius: 10px;
  background: #fafbfc;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.ibx-search-field:focus-within {
  background: #fff;
  border-color: rgba(26, 122, 109, 0.45);
  box-shadow: 0 0 0 3px rgba(26, 122, 109, 0.12);
}

.ibx-search-field > i {
  color: var(--am-ink-faint);
  font-size: 1.05rem;
}

.ibx-search-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--am-ink);
  padding: 0.25rem 0;
}

.ibx-search-clear {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--am-ink-muted);
  text-decoration: none;
}

.ibx-search-clear:hover {
  background: var(--am-slate-soft);
  color: var(--am-ink);
}

.ibx-kbd {
  font-size: 0.68rem;
  font-family: inherit;
  color: var(--am-ink-faint);
  border: 1px solid var(--am-border-strong);
  border-radius: 5px;
  padding: 0.05rem 0.35rem;
  background: #fff;
}

.ibx-toolbar-end {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.ibx-filter-menu {
  min-width: 220px;
}

.ibx-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem 0.15rem;
}

.ibx-chip-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--am-teal-soft);
  color: var(--am-teal-deep);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.ibx-chip-filter:hover { filter: brightness(0.97); color: var(--am-teal-deep); }

.ibx-chip-clear {
  font-size: 0.75rem;
  color: var(--am-ink-muted);
  text-decoration: none;
  margin-inline-start: 0.25rem;
}

.ibx-chip-clear:hover { color: var(--am-rose); }

.ibx-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  background: var(--am-teal-softer);
  border-bottom: 1px solid rgba(26, 122, 109, 0.15);
}

.ibx-bulk-info {
  font-size: 0.86rem;
  color: var(--am-teal-deep);
}

.ibx-bulk-actions {
  display: flex;
  gap: 0.35rem;
}

.ibx-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ibx-preview-w);
  min-height: 0;
  flex: 1 1 auto;
}

.ibx:not(.has-preview) .ibx-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.ibx:not(.has-preview) .ibx-preview {
  display: none;
}

.ibx-list {
  min-width: 0;
  overflow: auto;
  max-height: calc(100vh - 250px);
  border-inline-end: 1px solid var(--am-border);
}

.ibx:not(.has-preview) .ibx-list {
  border-inline-end: 0;
}

.ibx-group-label {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--am-ink-muted);
  background: rgba(247, 250, 251, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--am-border);
}

.ibx-group-count {
  font-weight: 600;
  color: var(--am-ink-faint);
  font-variant-numeric: tabular-nums;
}

.ibx-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) 2rem;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid rgba(15, 42, 61, 0.05);
  background: #fff;
  transition: background 0.1s ease;
}

.ibx-row:hover {
  background: rgba(26, 122, 109, 0.035);
}

.ibx-row.is-selected {
  background: rgba(26, 122, 109, 0.07);
}

.ibx-row.is-unread {
  background: linear-gradient(90deg, rgba(26, 122, 109, 0.04), transparent 28%);
}

.ibx-row.is-overdue {
  box-shadow: inset -2px 0 0 var(--am-rose);
}

.ibx-check {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--ibx-row-pad-y) 0.15rem;
  margin: 0;
  cursor: pointer;
}

.ibx-check input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.2rem;
  accent-color: var(--am-teal);
}

.ibx-row-main {
  display: grid;
  grid-template-columns: 0.55rem minmax(0, 1fr);
  gap: 0.55rem;
  padding: var(--ibx-row-pad-y) 0.25rem var(--ibx-row-pad-y) 0;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.ibx-unread-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  margin-top: 0.45rem;
  background: transparent;
}

.ibx-row.is-unread .ibx-unread-dot {
  background: var(--am-teal);
}

.ibx-row-body {
  min-width: 0;
}

.ibx-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.12rem;
}

.ibx-sender {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--am-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ibx-row.is-unread .ibx-sender {
  font-weight: 800;
}

.ibx-time {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--am-ink-faint);
}

.ibx-row-subject {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--am-ink);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ibx-row.is-unread .ibx-row-subject {
  font-weight: 800;
}

.ibx-row-preview {
  margin-top: 0.12rem;
  font-size: 0.78rem;
  color: var(--am-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ibx-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--am-ink-faint);
}

.ibx-row-meta .ibx-code {
  font-weight: 600;
  color: var(--am-ink-muted);
}

.ibx-flag {
  color: var(--am-amber);
  font-weight: 700;
}

.ibx-flag.danger { color: var(--am-rose); }

.ibx-attach {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.ibx-row-open {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--am-ink-faint);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease, background 0.12s ease;
}

.ibx-row:hover .ibx-row-open,
.ibx-row.is-selected .ibx-row-open,
.ibx-row-open:focus-visible {
  opacity: 1;
}

.ibx-row-open:hover {
  color: var(--am-teal);
  background: rgba(26, 122, 109, 0.06);
}

.ibx-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--am-ink-muted);
}

.ibx-empty-icon {
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.85rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--am-teal-softer);
  color: var(--am-teal);
  font-size: 1.45rem;
}

.ibx-empty h2 {
  font-size: 1.05rem;
  color: var(--am-ink);
  margin: 0 0 0.35rem;
}

.ibx-empty p {
  max-width: 28rem;
  margin: 0 auto 1rem;
  font-size: 0.86rem;
  line-height: 1.6;
}

.ibx-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.ibx-preview {
  min-width: 0;
  overflow: auto;
  max-height: calc(100vh - 250px);
  background: #fbfcfd;
}

.ibx-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 280px;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--am-ink-muted);
}

.ibx-preview-placeholder i {
  font-size: 1.75rem;
  color: var(--am-ink-faint);
  margin-bottom: 0.25rem;
}

.ibx-preview-bar {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--am-border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.ibx-preview-card {
  padding: 1rem 1.05rem 1.25rem;
}

.ibx-preview-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.ibx-preview-title {
  font-size: 1.1rem;
  font-weight: 750;
  color: var(--am-ink);
  margin: 0 0 0.65rem;
  line-height: 1.4;
}

.ibx-preview-people {
  display: grid;
  gap: 0.35rem;
  font-size: 0.84rem;
  margin-bottom: 0.9rem;
  color: var(--am-ink);
}

.ibx-meta-label {
  display: inline-block;
  min-width: 1.4rem;
  color: var(--am-ink-faint);
  font-size: 0.72rem;
  margin-inline-end: 0.25rem;
}

.ibx-preview-meta {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 1rem;
  padding: 0.75rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--am-border);
}

.ibx-preview-meta > div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.5rem;
  font-size: 0.82rem;
}

.ibx-preview-meta dt {
  margin: 0;
  color: var(--am-ink-faint);
  font-weight: 600;
}

.ibx-preview-meta dd {
  margin: 0;
  color: var(--am-ink);
  min-width: 0;
}

.ibx-preview-meta a {
  color: var(--am-teal-deep);
  text-decoration: none;
}

.ibx-preview-meta a:hover { text-decoration: underline; }

.ibx-preview-body,
.ibx-preview-files {
  margin-bottom: 1rem;
}

.ibx-preview-body h3,
.ibx-preview-files h3 {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--am-ink-faint);
  margin: 0 0 0.4rem;
}

.ibx-preview-body p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--am-ink);
  white-space: pre-wrap;
}

.ibx-preview-files ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.ibx-preview-files li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--am-border);
  font-size: 0.8rem;
}

.ibx-preview-files em {
  font-style: normal;
  margin-inline-start: auto;
  color: var(--am-ink-faint);
  font-size: 0.7rem;
}

.ibx-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.25rem;
}

.ibx-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--am-slate-soft);
  color: var(--am-slate);
}

.ibx-chip.danger {
  background: var(--am-rose-soft);
  color: var(--am-rose);
}

.ibx-code {
  font-variant-numeric: tabular-nums;
}

.ibx-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 61, 0.35);
  z-index: 1040;
}

/* Legacy cartable hooks (keep safe if referenced elsewhere) */
.cartable-layout { min-height: 60vh; }

@media (max-width: 1199.98px) {
  .ibx-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .ibx.has-preview .ibx-list {
    display: none;
  }

  .ibx.has-preview .ibx-preview {
    display: block;
    max-height: none;
    border-inline-end: 0;
  }

  .ibx:not(.has-preview) .ibx-preview {
    display: none;
  }

  .ibx-list {
    max-height: none;
    border-inline-end: 0;
  }

  .ibx-row-open {
    opacity: 1;
  }
}

@media (max-width: 991.98px) {
  .ibx-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .ibx-nav {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(300px, 88vw);
    z-index: 1050;
    transform: translateX(110%);
    transition: transform 0.2s ease;
    padding: 0.75rem;
    pointer-events: none;
  }

  .ibx.nav-open .ibx-nav {
    transform: translateX(0);
    pointer-events: auto;
  }

  .ibx-nav-panel {
    position: static;
    max-height: calc(100vh - 1.5rem);
    height: auto;
    box-shadow: var(--am-shadow-hover);
  }

  .ibx-title { font-size: 1.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ibx-folder,
  .ibx-row,
  .ibx-nav {
    transition: none !important;
  }
}

/* ========== مشاهده نامه (کارتابل) — redesign ========== */
.letter-view,
.letter-show {
  margin-bottom: 2rem;
}

.letter-cmd {
  position: sticky;
  top: 74px;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.85rem;
  border-radius: var(--am-radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(255, 255, 255, 0.94)),
    var(--am-card);
  border: 1px solid var(--am-border);
  border-top: 3px solid var(--am-teal);
  box-shadow: 0 10px 28px rgba(15, 42, 61, 0.07);
  backdrop-filter: blur(8px);
}

.letter-cmd-main {
  flex: 1 1 280px;
  min-width: 0;
}

.letter-cmd-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.letter-cmd-back {
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: var(--am-teal);
  background: var(--am-teal-soft);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.letter-cmd-back:hover {
  background: var(--am-teal);
  color: #fff;
}

.letter-code {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--am-ink);
  letter-spacing: 0.01em;
  direction: ltr;
  unicode-bidi: plaintext;
}

.letter-cmd-subject {
  margin: 0;
  font-size: clamp(1.05rem, 0.95rem + 0.45vw, 1.28rem);
  font-weight: 800;
  color: var(--am-ink);
  line-height: 1.45;
  max-width: 52rem;
}

.letter-cmd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.85rem;
  margin-top: 0.55rem;
}

.letter-meta-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--am-ink-muted);
  text-decoration: none;
}

.letter-meta-item i {
  color: var(--am-teal);
  font-size: 0.95rem;
  position: relative;
  top: 2px;
}

.letter-meta-item em {
  font-style: normal;
  color: var(--am-ink-faint);
  font-weight: 600;
}

.letter-meta-item strong {
  color: var(--am-ink);
  font-weight: 700;
}

.letter-meta-item.link:hover strong {
  color: var(--am-teal);
}

.letter-meta-item.is-overdue strong {
  color: var(--am-rose);
}

.letter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--am-slate-soft);
  color: var(--am-slate);
}

.letter-chip.danger {
  background: var(--am-rose-soft);
  color: var(--am-rose);
}

.letter-chip.muted {
  background: #eef2f5;
  color: #7a8a98;
}

.letter-cmd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}

.letter-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.48rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--am-border-strong);
  background: #fff;
  color: var(--am-ink);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.letter-action-btn:hover {
  background: var(--am-teal-softer);
  border-color: rgba(26, 122, 109, 0.35);
  color: var(--am-teal);
  transform: translateY(-1px);
}

.letter-action-btn.primary {
  background: var(--am-teal);
  border-color: transparent;
  color: #fff;
}

.letter-action-btn.primary:hover {
  background: var(--am-teal-hover);
  color: #fff;
}

.letter-action-btn.success {
  background: var(--am-gold);
  border-color: transparent;
  color: #2b220f;
}

.letter-action-btn.success:hover {
  background: #b89448;
  color: #2b220f;
}

.letter-action-btn.danger:hover {
  background: var(--am-rose-soft);
  border-color: rgba(192, 57, 43, 0.3);
  color: var(--am-rose);
}

.letter-cmd-actions .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  font-size: 0.86rem;
}

.letter-cmd-actions .dropdown-item i {
  color: var(--am-teal);
}

/* Summary strip */
.letter-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--am-radius);
  background:
    radial-gradient(520px 140px at 100% 0%, rgba(26, 122, 109, 0.08), transparent 60%),
    linear-gradient(180deg, #fff, var(--am-teal-softer));
  border: 1px solid var(--am-border);
}

.letter-strip-item {
  min-width: 0;
  padding: 0.15rem 0.25rem;
}

.letter-strip-item .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--am-ink-faint);
  margin-bottom: 0.25rem;
}

.letter-strip-item strong,
.letter-strip-item a {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--am-ink);
  text-decoration: none;
  line-height: 1.45;
  word-break: break-word;
}

.letter-strip-item a:hover {
  color: var(--am-teal);
}

.letter-strip-item.is-overdue strong {
  color: var(--am-rose);
}

.letter-closed-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Layout: rail + main */
.letter-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.letter-rail {
  position: sticky;
  top: 178px;
  z-index: 20;
}

.letter-rail-inner {
  padding: 0.65rem;
  border-radius: var(--am-radius);
  background: var(--am-card);
  border: 1px solid var(--am-border);
  box-shadow: var(--am-shadow);
}

.letter-nav-search {
  margin-bottom: 0.55rem;
}

.letter-nav-search .form-control {
  border-radius: 10px;
  background: var(--am-teal-softer);
  border-color: transparent;
}

.letter-rail-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.letter-nav-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.62rem 0.7rem;
  border-radius: 10px;
  color: var(--am-ink-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.letter-nav-item i {
  font-size: 1.05rem;
  opacity: 0.85;
}

.letter-nav-item:hover,
.letter-nav-item.active {
  background: var(--am-teal-soft);
  color: var(--am-teal);
}

.letter-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* Panels */
.letter-panel,
.letter-section {
  margin-bottom: 0;
  overflow: hidden;
  border-radius: var(--am-radius);
  background: var(--am-card);
  border: 1px solid var(--am-border);
  box-shadow: var(--am-shadow);
}

.letter-panel-head,
.letter-section-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(180deg, #fbfcfd, #f5f9f8);
  border-bottom: 1px solid var(--am-border);
  color: var(--am-ink);
  font-weight: 800;
  font-size: 0.95rem;
}

.letter-panel-head-split,
.letter-section-head-split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.letter-panel-title {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.letter-panel-title i,
.letter-section-head i {
  color: var(--am-teal);
  font-size: 1.1rem;
}

.letter-panel-body {
  padding: 1.05rem 1.15rem 1.2rem;
}

.ops-history-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--am-teal-soft);
  color: var(--am-teal);
  border: 1px solid rgba(26, 122, 109, 0.18);
}

/* People / KV */
.letter-people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.letter-person-card {
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--am-border);
  background: var(--am-teal-softer);
}

.letter-person-card > .label,
.letter-kv > .label,
.letter-content-block > .label,
.letter-files-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--am-ink-faint);
  margin-bottom: 0.45rem;
}

.letter-person,
.letter-field-value.person {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.letter-person strong,
.letter-field-value.person strong {
  display: block;
  color: var(--am-ink);
  font-size: 0.9rem;
}

.letter-person small,
.letter-field-value.person small {
  color: #8a97a3;
  font-size: 0.75rem;
}

.letter-person.compact {
  margin-bottom: 0.35rem;
}

.letter-person-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.letter-kv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.letter-kv {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--am-border);
  background: #fff;
}

.letter-kv > div {
  font-weight: 700;
  color: var(--am-ink);
  font-size: 0.86rem;
}

.letter-checklist {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px dashed rgba(26, 122, 109, 0.28);
  background: #fbfcfd;
}

.letter-checklist-title {
  font-weight: 800;
  color: var(--am-ink);
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.letter-checklist-title i {
  color: var(--am-teal);
}

.letter-check-item {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--am-border);
}

.letter-check-item i {
  font-size: 1.05rem;
  margin-top: 0.1rem;
}

.letter-check-item.is-ok i { color: var(--am-green); }
.letter-check-item.is-warn i { color: var(--am-amber); }

.letter-check-item strong {
  display: block;
  font-size: 0.84rem;
}

.letter-check-item small {
  color: #8a97a3;
}

.letter-subblock {
  border: 1px solid var(--am-border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.letter-subblock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.9rem;
  background: #f7fafb;
  border-bottom: 1px solid var(--am-border);
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--am-ink);
}

.letter-subblock-head i {
  color: var(--am-teal);
}

.letter-subblock-head + .table-responsive,
.letter-case-row {
  padding: 0.85rem 0.95rem;
}

.letter-content-block {
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--am-border);
  background: #fbfcfd;
}

.letter-content-block.highlight {
  background: linear-gradient(180deg, #fff, var(--am-gold-soft));
  border-color: rgba(196, 163, 90, 0.3);
}

.letter-prose {
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--am-ink);
  font-size: 0.9rem;
}

.letter-prose.subject {
  font-weight: 800;
  font-size: 1rem;
}

.letter-files-label {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.7rem !important;
  color: var(--am-ink) !important;
  font-size: 0.86rem !important;
}

.letter-files-label i {
  color: var(--am-teal);
}

.letter-divider {
  margin: 1.25rem 0;
  border: 0;
  border-top: 1px dashed var(--am-border-strong);
  opacity: 1;
}

.letter-upload-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.letter-empty,
.letter-empty-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  padding: 1.35rem 1rem;
  text-align: center;
  color: #7a8a98;
  background: #fbfcfd;
  border: 1px dashed rgba(26, 122, 109, 0.22);
  border-radius: 12px;
}

.letter-empty .ti {
  font-size: 1.5rem;
  color: var(--am-teal);
  opacity: 0.7;
}

.letter-empty-inline {
  padding: 0.55rem;
  border: 0;
  background: transparent;
  align-items: flex-start;
  text-align: start;
}

.letter-refs-table thead th {
  background: #f7fafb;
  font-size: 0.8rem;
  white-space: nowrap;
}

.letter-file-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.letter-file-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 220px;
  max-width: 100%;
  flex: 1 1 240px;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--am-border);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.letter-file-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 42, 61, 0.08);
  border-color: rgba(26, 122, 109, 0.28);
  color: inherit;
}

.letter-file-card i {
  font-size: 1.6rem;
  color: var(--am-teal);
}

.letter-file-card strong {
  display: block;
  font-size: 0.86rem;
}

.letter-file-card small {
  color: #8a97a3;
}

.letter-history-tabs,
.referral-view-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: #f0f4f7;
  margin-bottom: 1rem;
}

.letter-history-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--am-ink-muted);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.letter-history-tab.active {
  background: #fff;
  color: var(--am-teal);
  box-shadow: 0 2px 8px rgba(15, 42, 61, 0.06);
}

.letter-history-pane[hidden] {
  display: none !important;
}

.letter-comment-compose {
  padding-top: 0.85rem;
  border-top: 1px dashed var(--am-border-strong);
}

.refer-message-box {
  min-height: 140px;
  line-height: 1.8;
  resize: vertical;
}

/* دیتاپیکر شمسی */
jdp-container,
.jdp-container,
[class*="jalali-datepicker"] {
  font-family: var(--amesbah-font) !important;
  font-feature-settings: normal !important;
  z-index: 2300 !important;
}

input[data-jdp] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%231a7a6d' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 16px;
  padding-left: 2.25rem !important;
  cursor: pointer;
}

.modal .jdp-container {
  z-index: 2400 !important;
}

/* Legacy field helpers (kept for other pages) */
.letter-field label {
  display: block;
  font-size: 0.75rem;
  color: #7a8a98;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.letter-field-value {
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--am-border);
  border-radius: 10px;
  background: #fbfcfd;
  display: flex;
  align-items: center;
}

.letter-field-value.subject-box {
  font-weight: 700;
  color: var(--am-ink);
  background: #fff;
}

.letter-field-value.summary-box {
  min-height: 72px;
  align-items: flex-start;
  line-height: 1.7;
  white-space: pre-wrap;
}

.letter-field-value.summary-box.highlight {
  background: linear-gradient(180deg, #fff, var(--am-gold-soft));
  border-color: rgba(196, 163, 90, 0.35);
}

@media (max-width: 1199.98px) {
  .letter-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .letter-kv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .letter-layout {
    grid-template-columns: 1fr;
  }

  .letter-rail {
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .letter-rail-inner {
    padding: 0.45rem;
  }

  .letter-rail-scroll {
    flex-direction: row;
    overflow-x: auto;
    gap: 0.35rem;
    padding-bottom: 0.15rem;
    -webkit-overflow-scrolling: touch;
  }

  .letter-nav-item {
    margin: 0;
    padding: 0.45rem 0.75rem;
    background: #f5f8fa;
    border: 1px solid transparent;
  }

  .letter-nav-item.active {
    border-color: rgba(26, 122, 109, 0.25);
  }

  .letter-nav-item span {
    display: inline;
  }

  .letter-cmd {
    position: relative;
    top: auto;
  }

  .letter-people-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767.98px) {
  .letter-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .letter-cmd-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .letter-action-btn span {
    display: none;
  }

  .letter-action-btn {
    padding: 0.52rem 0.65rem;
  }

  .letter-kv-grid {
    grid-template-columns: 1fr;
  }

  .letter-upload-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ========== ارجاعات / پیگیری نامه ========== */
.referral-panel .card-body,
.referral-panel .letter-panel-body {
  background:
    radial-gradient(900px 220px at 100% 0%, rgba(26, 122, 109, 0.07), transparent 55%),
    radial-gradient(700px 200px at 0% 100%, rgba(196, 163, 90, 0.08), transparent 50%),
    #fff;
}

.process-flow-label,
.referral-tree-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--am-ink);
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
}

.process-flow-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding: 0.35rem 0.15rem 0.75rem;
}

.process-step {
  flex: 0 0 auto;
  width: 108px;
  text-align: center;
  position: relative;
}

.process-dot {
  width: 36px;
  height: 36px;
  margin: 0 auto 0.45rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid #d7e0e6;
  background: #fff;
  color: #8a97a3;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.process-name {
  font-size: 0.74rem;
  line-height: 1.45;
  color: #6b7a88;
  font-weight: 700;
}

.process-line {
  flex: 1 1 28px;
  min-width: 22px;
  height: 2px;
  margin-top: 17px;
  background: #d7e0e6;
  border-radius: 2px;
}

.process-step.is-done .process-dot,
.process-line.is-done {
  border-color: #1a7a6d;
  background: #1a7a6d;
  color: #fff;
}

.process-line.is-done {
  background: #1a7a6d;
}

.process-step.is-current .process-dot {
  border-color: #c4a35a;
  background: linear-gradient(145deg, #c4a35a, #e0c57d);
  color: #2b220f;
  box-shadow: 0 0 0 6px rgba(196, 163, 90, 0.22);
  animation: referralPulse 1.8s ease-in-out infinite;
}

.process-step.is-current .process-name {
  color: var(--am-ink);
}

.process-step.is-active .process-dot {
  border-color: #2a9a88;
  color: #1a7a6d;
  background: var(--am-teal-soft);
}

@keyframes referralPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(196, 163, 90, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(196, 163, 90, 0.08); }
}

.referral-count-chip {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1a7a6d;
  background: var(--am-teal-soft);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.referral-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.referral-summary-item {
  border: 1px solid var(--am-border);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.85);
  min-width: 0;
}

.referral-summary-item .label {
  display: block;
  font-size: 0.72rem;
  color: #8a97a3;
  margin-bottom: 0.2rem;
}

.referral-summary-item strong {
  display: block;
  font-size: 0.92rem;
  color: var(--am-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.referral-summary-item small {
  display: block;
  color: #6b7a88;
  font-size: 0.75rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.referral-view-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: #f0f4f7;
  margin-bottom: 1rem;
  border-bottom: 0;
}

.referral-tab {
  border: 0;
  background: transparent;
  color: var(--am-ink-muted);
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.referral-tab.active {
  background: #fff;
  color: var(--am-teal);
  box-shadow: 0 2px 8px rgba(15, 42, 61, 0.06);
  border-color: transparent;
}

.referral-scroll-box {
  max-height: min(420px, 55vh);
  overflow: auto;
  border: 1px solid var(--am-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.35rem 0.45rem;
  scrollbar-gutter: stable;
}

.referral-compact-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid #eef2f5;
}

.referral-compact-row:last-child {
  border-bottom: 0;
}

.referral-compact-row.is-current {
  background: linear-gradient(90deg, rgba(196, 163, 90, 0.12), transparent 70%);
  border-radius: 8px;
}

.compact-index {
  flex: 0 0 1.6rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b7a88;
  background: #f1f4f7;
  margin-top: 0.1rem;
}

.referral-compact-row.is-current .compact-index {
  background: #c4a35a;
  color: #2b220f;
}

.compact-main {
  min-width: 0;
  flex: 1;
}

.compact-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.compact-top strong {
  font-size: 0.9rem;
}

.compact-meta {
  font-size: 0.75rem;
  color: #8a97a3;
  margin-top: 0.15rem;
}

.compact-note {
  margin-top: 0.3rem;
}

.compact-note summary {
  cursor: pointer;
  color: #1a7a6d;
  font-size: 0.78rem;
  font-weight: 700;
  list-style: none;
}

.compact-note summary::-webkit-details-marker {
  display: none;
}

.compact-note div {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #445463;
  white-space: pre-wrap;
  background: #f7f9fb;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.referral-tree-dense .referral-node {
  margin-bottom: 0.45rem;
  animation: none;
}

.referral-tree-dense .referral-card {
  padding: 0.55rem 0.65rem;
  box-shadow: none;
}

.referral-tree-dense .referral-card:hover {
  transform: none;
}

.referral-tree-dense .referral-icon {
  width: 30px;
  height: 30px;
  font-size: 0.9rem;
}

.referral-tree-wrap,
.referral-feed {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--am-border);
  border-radius: 14px;
  padding: 1rem;
  height: 100%;
}

@media (max-width: 767.98px) {
  .referral-summary {
    grid-template-columns: 1fr;
  }

  .referral-scroll-box {
    max-height: min(360px, 50vh);
  }

  .process-step {
    width: 88px;
  }
}

.referral-tree {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0.15rem 0.5rem;
}

.referral-node {
  position: relative;
  padding-right: calc(var(--depth, 0) * 1.35rem);
  margin-bottom: 0.85rem;
  animation: referralIn 0.45s ease both;
}

.referral-node:nth-child(1) { animation-delay: 0.02s; }
.referral-node:nth-child(2) { animation-delay: 0.08s; }
.referral-node:nth-child(3) { animation-delay: 0.14s; }
.referral-node:nth-child(4) { animation-delay: 0.2s; }
.referral-node:nth-child(5) { animation-delay: 0.26s; }
.referral-node:nth-child(6) { animation-delay: 0.32s; }

@keyframes referralIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.referral-node:not(.is-root)::before {
  content: "";
  position: absolute;
  top: -0.55rem;
  bottom: 50%;
  right: calc(var(--depth, 1) * 1.35rem - 0.7rem);
  width: 2px;
  background: linear-gradient(180deg, rgba(26, 122, 109, 0.35), rgba(26, 122, 109, 0.12));
}

.referral-node:not(.is-root)::after {
  content: "";
  position: absolute;
  top: 1.35rem;
  right: calc(var(--depth, 1) * 1.35rem - 0.7rem);
  width: 0.85rem;
  height: 2px;
  background: rgba(26, 122, 109, 0.28);
}

.referral-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--am-border);
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 42, 61, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.referral-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 42, 61, 0.08);
}

.referral-node.is-current .referral-card {
  border-color: rgba(196, 163, 90, 0.55);
  background: linear-gradient(135deg, #fffdf7, #fff8ea);
  box-shadow: 0 10px 24px rgba(196, 163, 90, 0.18);
}

.referral-node.kind-completed .referral-card {
  border-color: rgba(26, 122, 109, 0.35);
  background: linear-gradient(135deg, #f7fffc, #eefaf6);
}

.referral-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--am-teal-soft);
  color: var(--am-teal);
  font-size: 1.15rem;
}

.referral-node.is-current .referral-icon {
  background: rgba(196, 163, 90, 0.22);
  color: #8a6b28;
}

.referral-node.kind-completed .referral-icon {
  background: rgba(26, 122, 109, 0.15);
  color: #1a7a6d;
}

.referral-body {
  flex: 1;
  min-width: 0;
}

.referral-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.15rem;
}

.referral-head strong {
  color: var(--am-ink);
  font-size: 0.95rem;
}

.referral-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #eef2f5;
  color: #6b7a88;
}

.referral-badge.current {
  background: rgba(196, 163, 90, 0.2);
  color: #8a6b28;
}

.referral-badge.done {
  background: rgba(26, 122, 109, 0.14);
  color: #1a7a6d;
}

.referral-badge.root {
  background: #e8f1ff;
  color: #3b6ea8;
}

.referral-title {
  font-size: 0.78rem;
  color: #7a8a98;
  margin-bottom: 0.35rem;
}

.referral-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.74rem;
  color: #8a97a3;
  margin-bottom: 0.35rem;
}

.referral-meta i {
  margin-left: 0.2rem;
}

.referral-note {
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #f7fafb;
  border: 1px dashed rgba(26, 122, 109, 0.25);
  font-size: 0.8rem;
  line-height: 1.6;
  color: #4d5d6b;
}

.referral-feed-list {
  position: relative;
  padding-right: 0.35rem;
}

.referral-feed-item {
  position: relative;
  display: flex;
  gap: 0.7rem;
  padding: 0 0 1rem 0;
}

.referral-feed-item:last-child {
  padding-bottom: 0;
}

.referral-feed-item::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 0;
  right: 5px;
  width: 2px;
  background: #e4ebef;
}

.referral-feed-item:last-child::before {
  display: none;
}

.feed-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: #1a7a6d;
  box-shadow: 0 0 0 4px rgba(26, 122, 109, 0.12);
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
}

.referral-feed-item.action-letter-completed .feed-dot {
  background: #c4a35a;
  box-shadow: 0 0 0 4px rgba(196, 163, 90, 0.18);
}

.feed-content {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #fbfcfd;
  border: 1px solid var(--am-border);
}

.feed-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
}

.feed-top span {
  color: #8a97a3;
  font-size: 0.74rem;
}

.feed-actor {
  font-size: 0.78rem;
  color: var(--am-teal);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.feed-msg {
  font-size: 0.78rem;
  color: #5f6f7c;
  line-height: 1.55;
}

/* ========== تاریخچه عملیات نامه ========== */
.ops-history-body {
  padding: 1rem 1.1rem 1.15rem;
}

.ops-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1.75rem 1rem;
  text-align: center;
  color: #7a8a98;
  background: #fbfcfd;
  border: 1px dashed rgba(26, 122, 109, 0.22);
  border-radius: 12px;
}

.ops-history-empty .ti {
  font-size: 1.65rem;
  color: var(--am-teal);
  opacity: 0.7;
}

.ops-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ops-history-item {
  display: flex;
  gap: 0.75rem;
  position: relative;
}

.ops-history-item + .ops-history-item {
  margin-top: 0.15rem;
}

.ops-history-rail {
  position: relative;
  flex: 0 0 28px;
  display: flex;
  justify-content: center;
}

.ops-history-item:not(:last-child) .ops-history-rail::before {
  content: "";
  position: absolute;
  top: 30px;
  bottom: -0.15rem;
  right: 50%;
  width: 2px;
  transform: translateX(50%);
  background: linear-gradient(180deg, rgba(26, 122, 109, 0.35), rgba(26, 122, 109, 0.06));
}

.ops-history-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--am-teal-soft);
  color: var(--am-teal);
  border: 1px solid rgba(26, 122, 109, 0.22);
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
}

.ops-history-dot .ti {
  font-size: 0.92rem;
}

.ops-history-item.action-letter-completed .ops-history-dot,
.ops-history-item.action-letter-approved .ops-history-dot {
  background: var(--am-gold-soft);
  color: #9a7a2e;
  border-color: rgba(196, 163, 90, 0.35);
}

.ops-history-item.action-letter-rejected .ops-history-dot {
  background: #fdecec;
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.22);
}

.ops-history-item.action-sla-warned .ops-history-dot,
.ops-history-item.action-sla-escalated .ops-history-dot {
  background: #fff6e8;
  color: #c47a1a;
  border-color: rgba(196, 122, 26, 0.28);
}

.ops-history-card {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 0.8rem 0.7rem;
  margin-bottom: 0.55rem;
  border-radius: 12px;
  background: #fbfcfd;
  border: 1px solid var(--am-border);
}

.ops-history-item:last-child .ops-history-card {
  margin-bottom: 0;
}

.ops-history-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.ops-history-action {
  font-size: 0.88rem;
  color: var(--am-ink);
  font-weight: 700;
}

.ops-history-time {
  font-size: 0.74rem;
  color: #8a97a3;
  white-space: nowrap;
}

.ops-history-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.2rem;
  font-size: 0.76rem;
  color: #7a8a98;
}

.ops-history-actor {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--am-teal);
  font-weight: 700;
}

.ops-history-actor .ti {
  font-size: 0.85rem;
  opacity: 0.85;
}

.ops-history-jalali {
  color: #8a97a3;
}

.ops-history-note-text,
.ops-history-note-full,
.ops-history-note-preview {
  font-size: 0.78rem;
  color: #5f6f7c;
  line-height: 1.6;
  margin: 0;
  word-break: break-word;
}

.ops-history-note {
  margin-top: 0.2rem;
}

.ops-history-note > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.ops-history-note > summary::-webkit-details-marker {
  display: none;
}

.ops-history-note-preview {
  flex: 1;
  min-width: 0;
}

.ops-history-more {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--am-teal);
  padding-top: 0.1rem;
}

.ops-history-note[open] .ops-history-more {
  display: none;
}

.ops-history-note[open] .ops-history-note-preview {
  display: none;
}

.ops-history-note-full {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed rgba(15, 42, 61, 0.1);
}

@media (max-width: 575.98px) {
  .ops-history-body {
    padding: 0.85rem 0.8rem 1rem;
  }

  .ops-history-card {
    padding: 0.55rem 0.65rem 0.6rem;
  }

  .ops-history-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }

  .ops-history-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
}

@media (max-width: 991.98px) {
  .process-step {
    width: 92px;
  }
}

/* ========== Tom Select (جستجوی AJAX) ========== */
.ts-wrapper {
  font-family: var(--amesbah-font) !important;
}

.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
  min-height: 42px;
  border-radius: 10px !important;
  border-color: var(--am-border) !important;
  background: #fff !important;
  box-shadow: none !important;
  padding: 0.4rem 0.75rem !important;
  font-feature-settings: normal !important;
}

.ts-wrapper.focus .ts-control {
  border-color: var(--am-teal) !important;
  box-shadow: 0 0 0 0.2rem rgba(26, 122, 109, 0.15) !important;
}

.ts-wrapper .ts-control input {
  font-family: var(--amesbah-font) !important;
  font-size: 0.9rem !important;
}

.ts-dropdown {
  z-index: 2000 !important;
  border-radius: 12px !important;
  border: 1px solid var(--am-border) !important;
  box-shadow: 0 14px 32px rgba(15, 42, 61, 0.12) !important;
  font-family: var(--amesbah-font) !important;
  overflow: hidden;
}

.ts-dropdown .option {
  padding: 0.65rem 0.85rem !important;
}

.ts-dropdown .active {
  background: var(--am-teal-soft) !important;
  color: var(--am-ink) !important;
}

.am-ts-option .am-ts-text {
  font-weight: 700;
  color: var(--am-ink);
}

.am-ts-option .am-ts-sub {
  font-size: 0.75rem;
  color: #8a97a3;
  margin-top: 0.15rem;
}

.ts-dropdown .no-results,
.ts-dropdown .spinner {
  padding: 0.85rem;
  color: #8a97a3;
  text-align: center;
}

[data-pc-direction='rtl'] .ts-wrapper.single .ts-control:after {
  left: 0.85rem;
  right: auto;
}

[data-pc-direction='rtl'] .ts-wrapper.single .ts-control {
  padding-left: 2rem !important;
  padding-right: 0.75rem !important;
}

.modal .ts-dropdown {
  z-index: 2100 !important;
}

.am-comments {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.am-comment {
  border: 1px solid #e7ecf1;
  border-radius: 0.75rem;
  padding: 0.9rem 1rem;
  background: #fff;
}

.am-comment.internal {
  background: #f7f8fa;
  border-style: dashed;
}

.am-comment.reply {
  margin-top: 0.75rem;
  margin-right: 1.25rem;
  background: #fafbfc;
}

.am-comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.am-comment-body {
  white-space: pre-wrap;
  line-height: 1.7;
  color: #2c3a47;
}

/* ===== UX polish ===== */
.am-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--am-teal), var(--am-teal-deep));
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow: 0 4px 10px rgba(26, 122, 109, 0.28);
}

.am-user-avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
  box-shadow: none;
}

.am-nav-badge {
  margin-inline-start: auto;
  margin-inline-end: 0.1rem;
  min-width: 1.4rem;
  height: 1.3rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgba(125, 212, 196, 0.22);
  color: #dff8f1;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex: 0 0 auto;
  border: 1px solid rgba(125, 212, 196, 0.35);
  letter-spacing: 0.01em;
}

.pc-sidebar .pc-navbar > .pc-item.active > .pc-link .am-nav-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: none;
}

.am-nav-badge.warn {
  background: rgba(196, 163, 90, 0.28);
  color: #f5ecd2;
  box-shadow: none;
  border-color: rgba(196, 163, 90, 0.45);
}

.am-header-quick {
  gap: 0.4rem;
  align-items: center;
}

.am-quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--am-border);
  color: var(--am-ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.am-quick-chip:hover,
.am-quick-chip.active {
  background: var(--am-teal-soft);
  border-color: rgba(26, 122, 109, 0.25);
  color: var(--am-teal);
}

.am-quick-chip.primary {
  background: var(--am-teal);
  border-color: var(--am-teal);
  color: #fff;
}

.am-quick-chip.primary:hover {
  background: var(--am-teal-hover);
  color: #fff;
}

.am-quick-chip.danger {
  background: #fff5f5;
  border-color: #f5c2c7;
  color: #b02a37;
}

.am-quick-chip span {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0 0.35rem;
  font-size: 0.72rem;
}

.am-flash-stack {
  position: sticky;
  top: 0.75rem;
  z-index: 40;
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.am-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  border: 0;
  border-radius: 12px;
  box-shadow: var(--am-shadow-hover);
  padding: 0.85rem 1rem;
}

.am-toast.success {
  background: #e8f7f2;
  color: #0f5132;
}

.am-toast.danger {
  background: #fdebec;
  color: #842029;
}

.am-toast i {
  font-size: 1.2rem;
  margin-top: 0.1rem;
}

.am-toast .btn-close {
  margin-right: auto;
  margin-left: 0;
}

.am-kpi-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.am-kpi-link .card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.am-kpi-link:hover .card {
  transform: translateY(-3px);
  box-shadow: var(--am-shadow-hover) !important;
}

.am-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 0.65rem;
  color: var(--am-teal);
}

.amesbah-kpi p {
  color: #6b7a88;
  font-size: 0.8rem;
  margin-bottom: 0.2rem !important;
}

.am-action-tile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--am-border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--am-ink);
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.am-action-tile:hover {
  background: var(--am-teal-soft);
  border-color: rgba(26, 122, 109, 0.3);
  color: var(--am-ink);
}

.am-action-tile i {
  font-size: 1.25rem;
  color: var(--am-teal);
}

.am-action-tile span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.am-action-tile small {
  color: #8a97a3;
}

.am-empty-state {
  text-align: center;
  padding: 2.75rem 1.25rem;
  color: #6b7a88;
}

.am-empty-state i {
  font-size: 2.1rem;
  color: var(--am-teal);
  opacity: 0.75;
  display: block;
  margin-bottom: 0.85rem;
}

.am-empty-state h6 {
  color: var(--am-ink);
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.am-empty-state p {
  max-width: 28rem;
  margin: 0 auto 1rem;
  line-height: 1.7;
}

.am-empty-mini {
  text-align: center;
  padding: 1.5rem 1rem;
  color: #8a97a3;
}

.am-empty-mini i {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}

.am-hover-table tbody tr:hover {
  background: rgba(26, 122, 109, 0.05);
}

.am-notify-panel {
  min-width: 320px;
}

.form-control:focus,
.form-select:focus,
.form-control:focus-visible,
.form-select:focus-visible,
.btn:focus-visible,
.pc-head-link:focus-visible,
.pc-link:focus-visible,
.am-quick-chip:focus-visible,
.am-mobile-dock a:focus-visible {
  outline: none;
  border-color: rgba(26, 122, 109, 0.45) !important;
  box-shadow: 0 0 0 0.2rem rgba(26, 122, 109, 0.14) !important;
}

.btn-primary {
  background: var(--am-teal) !important;
  border-color: var(--am-teal) !important;
}

.btn-primary:hover {
  background: #15675c !important;
  border-color: #15675c !important;
}

.btn-primary:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(26, 122, 109, 0.28) !important;
}

.am-mobile-dock {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--am-border);
  padding: 0.4rem 0.3rem calc(0.4rem + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 28px rgba(15, 42, 61, 0.08);
}

.am-mobile-dock a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  padding: 0.4rem 0.15rem;
  color: #6b7a88;
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.am-mobile-dock a:hover {
  background: rgba(26, 122, 109, 0.06);
  color: var(--am-teal);
}

.am-mobile-dock a i {
  font-size: 1.22rem;
}

.am-mobile-dock a.active,
.am-mobile-dock a.dock-primary {
  color: var(--am-teal);
}

.am-mobile-dock a.active:not(.dock-primary) {
  background: var(--am-teal-soft);
}

.am-mobile-dock a.dock-primary i {
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: var(--am-teal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  margin-bottom: 0.1rem;
  box-shadow: 0 6px 14px rgba(26, 122, 109, 0.3);
}

.am-mobile-dock em {
  position: absolute;
  top: 0.15rem;
  inset-inline-end: 16%;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 0.6rem;
  font-style: normal;
  display: grid;
  place-items: center;
}

@media (max-width: 767.98px) {
  .pc-container {
    padding-bottom: 4.5rem !important;
  }

  .pc-footer {
    display: none;
  }
}

@media print {
  .pc-sidebar,
  .pc-header,
  .pc-footer,
  .letter-topbar,
  .letter-cmd,
  .letter-cmd-actions,
  .letter-side-nav,
  .letter-rail,
  #section-actions,
  .am-mobile-dock,
  .am-flash-stack {
    display: none !important;
  }
  .pc-container {
    margin: 0 !important;
    width: 100% !important;
  }
  .letter-layout {
    display: block !important;
  }
}

/* ========== Role-aware dashboard (warm / colorful) ========== */
.am-dashboard {
  position: relative;
  margin: -0.35rem -0.15rem 0;
  padding: 0.35rem 0.15rem 0.5rem;
  border-radius: 18px;
  background:
    radial-gradient(920px 320px at 100% -10%, rgba(26, 122, 109, 0.12), transparent 58%),
    radial-gradient(720px 280px at 0% 8%, rgba(196, 163, 90, 0.1), transparent 55%),
    radial-gradient(640px 240px at 85% 70%, rgba(31, 138, 91, 0.05), transparent 50%),
    linear-gradient(180deg, rgba(240, 244, 247, 0.5), transparent 42%);
}

.am-dashboard::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    radial-gradient(rgba(15, 42, 61, 0.04) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 88%);
}

/* Dashboard v2 — denser command center */
.am-dashboard.am-dash-v2 {
  background:
    radial-gradient(800px 260px at 100% -8%, rgba(26, 122, 109, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(240, 244, 247, 0.35), transparent 36%);
}

.am-dashboard.am-dash-v2::before {
  opacity: 0.22;
}

.am-dash-cmd {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  padding: 1rem 1.15rem;
  margin-bottom: 0.85rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--am-border);
  position: relative;
  z-index: 1;
}

.am-dash-cmd-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  color: var(--am-ink-muted);
}

.am-dash-cmd-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 750;
  color: var(--am-ink);
  line-height: 1.3;
}

.am-dash-cmd-sub {
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  color: var(--am-ink-muted);
  max-width: 46rem;
}

.am-dash-cmd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.am-dash-attn-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--am-rose-soft);
  color: var(--am-rose);
  font-size: 0.72rem;
  font-weight: 700;
}

.am-dash-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  color: var(--am-ink);
}

.am-dash-section-sub {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--am-ink-muted);
}

.am-dash-priority {
  margin-bottom: 0.85rem;
  border-color: rgba(26, 122, 109, 0.18);
  box-shadow: 0 8px 24px rgba(15, 42, 61, 0.04);
}

.am-dash-focus-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.am-dash-focus-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.am-dash-seg {
  display: inline-flex;
  padding: 0.18rem;
  border-radius: 10px;
  background: var(--am-slate-soft);
  gap: 0.15rem;
}

.am-dash-seg button {
  border: 0;
  background: transparent;
  color: var(--am-ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
}

.am-dash-seg button.is-active {
  background: #fff;
  color: var(--am-teal-deep);
  box-shadow: 0 1px 2px rgba(15, 42, 61, 0.08);
}

.am-focus-go {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--am-teal);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.am-focus-row:hover .am-focus-go,
.am-focus-row:focus-visible .am-focus-go {
  opacity: 1;
}

.am-focus-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1rem;
  color: var(--am-ink-muted);
}

.am-focus-empty > i {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--am-green-soft);
  color: var(--am-green);
  font-size: 1.2rem;
}

.am-focus-empty strong {
  display: block;
  color: var(--am-ink);
  margin-bottom: 0.15rem;
}

.am-focus-empty p {
  margin: 0;
  font-size: 0.82rem;
}

.am-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.am-kpi-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--am-border);
  text-decoration: none;
  color: inherit;
  min-width: 0;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.am-kpi-chip:hover {
  border-color: rgba(26, 122, 109, 0.28);
  background: var(--am-teal-softer);
  transform: translateY(-1px);
}

.am-kpi-chip-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--am-teal-soft);
  color: var(--am-teal);
}

.am-kpi-chip.am-kpi-tone-warning .am-kpi-chip-icon { background: var(--am-amber-soft); color: var(--am-amber); }
.am-kpi-chip.am-kpi-tone-danger .am-kpi-chip-icon { background: var(--am-rose-soft); color: var(--am-rose); }
.am-kpi-chip.am-kpi-tone-success .am-kpi-chip-icon { background: var(--am-green-soft); color: var(--am-green); }
.am-kpi-chip.am-kpi-tone-info .am-kpi-chip-icon { background: var(--am-sky-soft); color: var(--am-sky); }

.am-kpi-chip-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.am-kpi-chip-text small {
  font-size: 0.7rem;
  color: var(--am-ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-kpi-chip-text strong {
  font-size: 1rem;
  color: var(--am-ink);
  line-height: 1.2;
}

.am-kpi-chip-pct {
  margin-inline-start: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--am-ink-muted);
}

.am-dash-feed {
  display: flex;
  flex-direction: column;
}

.am-dash-feed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.95rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(15, 42, 61, 0.05);
  transition: background 0.1s ease;
}

.am-dash-feed-row:last-child { border-bottom: 0; }
.am-dash-feed-row:hover { background: rgba(26, 122, 109, 0.04); }
.am-dash-feed-row.is-warn { box-shadow: inset -2px 0 0 var(--am-rose); }

.am-dash-feed-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.am-dash-feed-main strong {
  font-size: 0.9rem;
  color: var(--am-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-dash-feed-main small {
  font-size: 0.74rem;
  color: var(--am-ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-dash-feed-sep { margin: 0 0.15rem; opacity: 0.6; }

.am-dash-feed-flag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--am-rose);
  background: var(--am-rose-soft);
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
}

.am-dash-feed-row > .ti { color: var(--am-ink-faint); }

.am-empty-compact { padding: 1.5rem 1rem !important; }

.am-trend-val {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--am-ink-muted);
}

.am-dash-analytics {
  border: 1px solid var(--am-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.am-dash-analytics > summary { list-style: none; }
.am-dash-analytics > summary::-webkit-details-marker { display: none; }

.am-dash-analytics-sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  user-select: none;
}

.am-dash-analytics-sum strong {
  display: block;
  font-size: 0.95rem;
  color: var(--am-ink);
}

.am-dash-analytics-sum small {
  color: var(--am-ink-muted);
  font-size: 0.78rem;
}

.am-dash-analytics-sum .ti {
  color: var(--am-ink-faint);
  transition: transform 0.15s ease;
}

.am-dash-analytics[open] .am-dash-analytics-sum .ti {
  transform: rotate(180deg);
}

.am-dash-analytics-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--am-border);
}

.am-dash-mobile-cta {
  position: sticky;
  bottom: 0.75rem;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding: 0.55rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--am-border);
  box-shadow: 0 10px 28px rgba(15, 42, 61, 0.12);
  backdrop-filter: blur(8px);
}

@media (max-width: 767.98px) {
  .am-dash-cmd-actions .btn-outline-primary { display: none; }
  .am-dash-focus-tools { width: 100%; }
  .am-dash-seg { width: 100%; overflow-x: auto; }
  .am-focus-go { display: none; }
  .am-kpi-strip {
    display: flex;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scroll-snap-type: x proximity;
  }
  .am-kpi-chip {
    flex: 0 0 68%;
    scroll-snap-align: start;
  }
}

.am-dash-focus .card-header,
.am-dash-trend .card-header,
.am-dash-activity .card-header,
.am-dash-contracts .card-header {
  padding-block: 0.7rem;
}

.am-focus-row {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(15, 42, 61, 0.05);
  transition: background 0.12s ease;
}

.am-focus-row:last-child { border-bottom: 0; }
.am-focus-row:hover { background: rgba(26, 122, 109, 0.04); }

.am-focus-rail {
  align-self: stretch;
  width: 3px;
  border-radius: 99px;
  background: var(--am-teal);
}

.am-focus-row.tone-danger .am-focus-rail { background: var(--am-rose); }
.am-focus-row.tone-warning .am-focus-rail { background: var(--am-amber); }
.am-focus-row.tone-info .am-focus-rail { background: var(--am-sky); }
.am-focus-row.tone-primary .am-focus-rail { background: var(--am-teal); }

.am-focus-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.am-focus-body strong {
  font-size: 0.88rem;
  color: var(--am-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-focus-body small {
  font-size: 0.74rem;
  color: var(--am-ink-faint);
}

.am-focus-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--am-slate-soft);
  color: var(--am-slate);
  white-space: nowrap;
}

.am-focus-row.tone-danger .am-focus-badge {
  background: var(--am-rose-soft);
  color: var(--am-rose);
}

.am-focus-row.tone-warning .am-focus-badge {
  background: var(--am-amber-soft);
  color: var(--am-amber);
}

.am-focus-chevron {
  color: var(--am-ink-faint);
  font-size: 1rem;
}

.am-trend-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.35rem;
  height: 140px;
  padding: 0.25rem 0.15rem 0;
}

.am-trend-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  height: 100%;
  justify-content: flex-end;
}

.am-trend-bar {
  width: 70%;
  max-width: 22px;
  height: var(--h, 20%);
  border-radius: 6px 6px 3px 3px;
  background: var(--am-slate-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.am-trend-opened {
  display: block;
  width: 100%;
  height: var(--share, 50%);
  background: linear-gradient(180deg, var(--am-teal-mid), var(--am-teal));
}

.am-trend-label {
  font-size: 0.68rem;
  color: var(--am-ink-faint);
}

.am-trend-legend {
  display: flex;
  gap: 0.85rem;
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: var(--am-ink-muted);
}

.am-trend-legend .dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  margin-inline-end: 0.25rem;
  vertical-align: middle;
}

.am-trend-legend .dot.open { background: var(--am-teal); }
.am-trend-legend .dot.close { background: var(--am-slate-soft); border: 1px solid var(--am-border-strong); }

.am-contract-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.am-contract-stats > div {
  text-align: center;
  padding: 0.55rem 0.35rem;
  border-radius: 10px;
  background: var(--am-teal-softer);
  border: 1px solid rgba(26, 122, 109, 0.1);
}

.am-contract-stats strong {
  display: block;
  font-size: 1.05rem;
  color: var(--am-teal-deep);
}

.am-contract-stats span {
  font-size: 0.68rem;
  color: var(--am-ink-muted);
}

.am-contract-list {
  display: grid;
  gap: 0.35rem;
}

.am-contract-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--am-border);
  text-decoration: none;
  color: inherit;
  background: #fff;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.am-contract-row:hover {
  border-color: rgba(26, 122, 109, 0.25);
  background: var(--am-teal-softer);
}

.am-contract-row strong {
  display: block;
  font-size: 0.82rem;
  color: var(--am-ink);
}

.am-contract-row small {
  color: var(--am-ink-faint);
  font-size: 0.7rem;
}

.am-contract-row em {
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--am-teal);
  white-space: nowrap;
}

.am-activity-feed {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  max-height: 360px;
  overflow: auto;
}

.am-activity-feed li {
  border-bottom: 1px solid rgba(15, 42, 61, 0.05);
}

.am-activity-feed li:last-child { border-bottom: 0; }

.am-activity-item {
  display: grid;
  grid-template-columns: 0.7rem minmax(0, 1fr);
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

.am-activity-item:hover { background: rgba(26, 122, 109, 0.04); }
.am-activity-item.is-static { cursor: default; }

.am-activity-dot {
  width: 0.45rem;
  height: 0.45rem;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--am-teal);
}

.am-activity-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.am-activity-body strong {
  font-size: 0.78rem;
  color: var(--am-teal-deep);
}

.am-activity-body > span {
  font-size: 0.82rem;
  color: var(--am-ink);
  line-height: 1.45;
}

.am-activity-body small {
  font-size: 0.7rem;
  color: var(--am-ink-faint);
}

@media (max-width: 767.98px) {
  .am-dash-cmd-title { font-size: 1.15rem; }
  .am-focus-row {
    grid-template-columns: 4px minmax(0, 1fr) auto;
  }
  .am-focus-chevron { display: none; }
  .am-trend-chart { height: 120px; }
}

.am-dash-fade {
  animation: amDashFadeIn 0.45s ease both;
  animation-delay: calc(var(--am-i, 0) * 0.06s);
}

@keyframes amDashFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes amBarGrow {
  from { width: 0; }
  to { width: var(--am-bar, 0%); }
}

@keyframes amRingDraw {
  from { stroke-dasharray: 0 97.39; }
}

/* Override Able .page-header (flex/min-height/padding) so hero isn't crushed */
.am-dashboard > .page-header.am-dash-header,
.am-dash-header {
  position: relative;
  z-index: 1;
  display: block;
  align-items: stretch;
  top: auto;
  left: auto;
  right: auto;
  min-height: 0;
  margin: 0 0 2rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

/* Keep Able's adjacent-row padding from collapsing hero into KPIs */
.am-dashboard > .am-dash-header + .row.amesbah-kpi {
  padding-top: 0.15rem;
}

.am-dash-header .page-header-title {
  display: block;
  max-width: 46rem;
}

.am-dash-header .page-header-title h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--am-ink);
}

.am-dash-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  min-height: 8.25rem;
  padding: 1.4rem 1.55rem 1.55rem;
  border-radius: 18px;
  border: 1px solid rgba(26, 122, 109, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(232, 245, 242, 0.95) 48%, rgba(247, 241, 228, 0.7) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 14px 36px rgba(15, 42, 61, 0.07);
}

.am-dash-hero::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 12%;
  bottom: 12%;
  width: 4px;
  border-radius: 0 6px 6px 0;
  background: linear-gradient(180deg, var(--am-teal), rgba(26, 122, 109, 0.35));
  pointer-events: none;
}

.am-dash-hero::after {
  content: '';
  position: absolute;
  inset-inline-end: -48px;
  top: -56px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(26, 122, 109, 0.16), transparent 68%);
  pointer-events: none;
}

.am-dash-crumb {
  position: relative;
  z-index: 1;
}

.am-dash-header .am-dash-crumb .breadcrumb {
  margin-bottom: 0;
  padding: 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

.am-dash-hero-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.25rem;
}

.am-dash-hero-copy {
  flex: 1 1 16rem;
  min-width: 0;
}

.am-dash-hero-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin-bottom: 0.45rem;
}

.am-dash-subtitle {
  color: var(--am-ink-muted);
  max-width: 42rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.am-dash-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  flex: 0 1 auto;
}

.am-dash-hero-actions .btn {
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(26, 122, 109, 0.12);
}

.am-role-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.78rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--am-teal);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(26, 122, 109, 0.24);
  box-shadow: 0 4px 12px rgba(26, 122, 109, 0.08);
}

.am-dash-panel {
  position: relative;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), #fff) !important;
  border-color: var(--am-border) !important;
}

.am-dash-panel > .card-header {
  background: linear-gradient(90deg, rgba(26, 122, 109, 0.07), transparent 55%) !important;
}

.am-dash-chart-card {
  overflow: hidden;
}

.am-dash-list-card .table thead th {
  background: linear-gradient(180deg, var(--am-teal-softer), #f7fafb);
  color: var(--am-ink-muted);
}

.am-dash-side .am-side-stat-list li:nth-child(odd) {
  background: rgba(26, 122, 109, 0.035);
}

.am-dash-visual,
.am-dash-lists {
  position: relative;
  z-index: 1;
}

.am-kpi-sub {
  display: block;
  margin-top: 0.35rem;
  color: var(--am-ink-faint);
  font-size: 0.72rem;
  line-height: 1.4;
}

.amesbah-kpi {
  position: relative;
  z-index: 1;
}

.amesbah-kpi .am-kpi-card {
  border: 1px solid transparent !important;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.amesbah-kpi .am-kpi-card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: inherit;
  background: var(--am-teal);
}

.amesbah-kpi .am-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--am-shadow-hover) !important;
}

.am-kpi-link:hover .am-kpi-card {
  transform: translateY(-4px);
}

.am-kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.am-kpi-top .am-kpi-icon {
  margin-bottom: 0;
}

.am-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 0.55rem;
  font-size: 1.15rem;
  transition: transform 0.2s ease;
}

.am-kpi-link:hover .am-kpi-icon {
  transform: scale(1.06);
}

.am-kpi-ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  color: inherit;
}

.am-kpi-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.am-kpi-ring-track,
.am-kpi-ring-value {
  fill: none;
  stroke-width: 3.2;
}

.am-kpi-ring-track {
  stroke: rgba(15, 42, 61, 0.1);
}

.am-kpi-ring-value {
  stroke: currentColor;
  stroke-linecap: round;
  animation: amRingDraw 0.7s ease both;
}

.am-kpi-ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  color: var(--am-ink);
}

.am-kpi-tone-primary {
  background: linear-gradient(160deg, var(--am-teal-softer) 0%, var(--am-teal-soft) 100%) !important;
  border-color: rgba(26, 122, 109, 0.14) !important;
  color: var(--am-teal);
}
.am-kpi-tone-primary::before { background: linear-gradient(180deg, var(--am-teal), var(--am-teal-mid)) !important; }
.am-kpi-tone-primary .am-kpi-icon,
.am-kpi-tone-primary .bg-light-primary {
  background: rgba(26, 122, 109, 0.14) !important;
  color: var(--am-teal) !important;
}
.am-kpi-tone-primary h4 { color: #145a52; }

.am-kpi-tone-warning {
  background: linear-gradient(160deg, #fffbf4 0%, var(--am-amber-soft) 100%) !important;
  border-color: rgba(196, 122, 26, 0.16) !important;
  color: var(--am-amber);
}
.am-kpi-tone-warning::before { background: linear-gradient(180deg, var(--am-amber), #e0a84a) !important; }
.am-kpi-tone-warning .am-kpi-icon,
.am-kpi-tone-warning .bg-light-warning {
  background: rgba(196, 122, 26, 0.14) !important;
  color: var(--am-amber) !important;
}
.am-kpi-tone-warning h4 { color: #8a5510; }

.am-kpi-tone-danger {
  background: linear-gradient(160deg, #fff8f7 0%, var(--am-rose-soft) 100%) !important;
  border-color: rgba(192, 57, 43, 0.14) !important;
  color: var(--am-rose);
}
.am-kpi-tone-danger::before { background: linear-gradient(180deg, var(--am-rose), #e06b5c) !important; }
.am-kpi-tone-danger .am-kpi-icon,
.am-kpi-tone-danger .bg-light-danger {
  background: rgba(192, 57, 43, 0.12) !important;
  color: var(--am-rose) !important;
}
.am-kpi-tone-danger h4 { color: #9b2c20; }

.am-kpi-tone-success {
  background: linear-gradient(160deg, #f5fcf8 0%, var(--am-green-soft) 100%) !important;
  border-color: rgba(31, 138, 91, 0.16) !important;
  color: var(--am-green);
}
.am-kpi-tone-success::before { background: linear-gradient(180deg, var(--am-green), #3cb07a) !important; }
.am-kpi-tone-success .am-kpi-icon,
.am-kpi-tone-success .bg-light-success {
  background: rgba(31, 138, 91, 0.14) !important;
  color: var(--am-green) !important;
}
.am-kpi-tone-success h4 { color: #166b45; }

.am-kpi-tone-info {
  background: linear-gradient(160deg, #f5fafc 0%, var(--am-sky-soft) 100%) !important;
  border-color: rgba(47, 111, 143, 0.14) !important;
  color: var(--am-sky);
}
.am-kpi-tone-info::before { background: linear-gradient(180deg, var(--am-sky), #4a94b5) !important; }
.am-kpi-tone-info .am-kpi-icon,
.am-kpi-tone-info .bg-light-info {
  background: rgba(47, 111, 143, 0.12) !important;
  color: var(--am-sky) !important;
}
.am-kpi-tone-info h4 { color: #245a74; }

.am-kpi-tone-secondary {
  background: linear-gradient(160deg, #f8fafb 0%, var(--am-slate-soft) 100%) !important;
  border-color: rgba(91, 107, 122, 0.14) !important;
  color: var(--am-slate);
}
.am-kpi-tone-secondary::before { background: linear-gradient(180deg, var(--am-slate), #8494a3) !important; }
.am-kpi-tone-secondary .am-kpi-icon,
.am-kpi-tone-secondary .bg-light-secondary {
  background: rgba(91, 107, 122, 0.12) !important;
  color: var(--am-slate) !important;
}
.am-kpi-tone-secondary h4 { color: #445463; }

.bg-light-success { background: var(--am-green-soft) !important; color: var(--am-green) !important; }
.bg-light-warning { background: var(--am-amber-soft) !important; color: var(--am-amber) !important; }
.bg-light-danger { background: var(--am-rose-soft) !important; color: var(--am-rose) !important; }
.bg-light-info { background: var(--am-sky-soft) !important; color: var(--am-sky) !important; }
.bg-light-secondary { background: var(--am-slate-soft) !important; color: var(--am-slate) !important; }

.am-status-bars {
  display: grid;
  gap: 0.9rem;
}

.am-status-bar-row {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.am-status-bar-row:hover {
  background: rgba(26, 122, 109, 0.04);
  transform: translateX(-2px);
}

.am-status-bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
}

.am-bar-pct {
  color: var(--am-ink-faint);
  font-weight: 600;
  margin-inline-start: 0.25rem;
}

.am-status-bar-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(15, 42, 61, 0.06);
  overflow: hidden;
}

.am-status-bar-track span {
  display: block;
  height: 100%;
  width: var(--am-bar, 0%);
  border-radius: inherit;
  background: rgba(26, 122, 109, 0.55);
  animation: amBarGrow 0.65s ease both;
}

.am-status-tone-primary .am-status-bar-track span { background: linear-gradient(90deg, var(--am-teal), var(--am-teal-mid)); }
.am-status-tone-success .am-status-bar-track span { background: linear-gradient(90deg, var(--am-green), #3cb07a); }
.am-status-tone-warning .am-status-bar-track span { background: linear-gradient(90deg, var(--am-amber), #e0a84a); }
.am-status-tone-info .am-status-bar-track span { background: linear-gradient(90deg, var(--am-sky), #4a94b5); }
.am-status-tone-danger .am-status-bar-track span { background: linear-gradient(90deg, var(--am-rose), #e06b5c); }
.am-status-tone-secondary .am-status-bar-track span { background: linear-gradient(90deg, var(--am-slate), #8494a3); }

.am-status-bar-row:hover .am-status-bar-track span {
  filter: brightness(1.05);
}

.am-workload-bars {
  display: grid;
  gap: 0.95rem;
}

.am-workload-row small {
  display: block;
  margin-top: 0.2rem;
  color: var(--am-ink-faint);
  font-size: 0.68rem;
}

.am-workload-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  font-size: 0.82rem;
}

.am-workload-meta strong {
  color: var(--am-teal);
}

.am-workload-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 42, 61, 0.07);
  overflow: hidden;
}

.am-workload-track span {
  display: block;
  height: 100%;
  width: var(--am-bar, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--am-teal-deep), var(--am-teal-mid));
  animation: amBarGrow 0.7s ease both;
}

.am-donut-layout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.1rem 1.25rem;
}

.am-donut-visual {
  flex: 0 0 auto;
  margin-inline: auto;
}

.am-donut-ring {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(15, 42, 61, 0.04);
  animation: amDashFadeIn 0.55s ease both;
}

.am-donut-hole {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(15, 42, 61, 0.06);
}

.am-donut-hole strong {
  font-size: 1.15rem;
  color: var(--am-ink);
  line-height: 1.1;
}

.am-donut-hole small {
  color: var(--am-ink-faint);
  font-size: 0.68rem;
  margin-top: 0.1rem;
}

.am-donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 140px;
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.am-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.am-donut-legend-item:hover {
  background: rgba(26, 122, 109, 0.05);
}

.am-donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
  background: var(--am-teal);
}

.am-donut-tone-primary .am-donut-swatch { background: var(--am-teal); }
.am-donut-tone-success .am-donut-swatch { background: var(--am-green); }
.am-donut-tone-warning .am-donut-swatch { background: var(--am-amber); }
.am-donut-tone-info .am-donut-swatch { background: var(--am-sky); }
.am-donut-tone-danger .am-donut-swatch { background: var(--am-rose); }
.am-donut-tone-secondary .am-donut-swatch { background: var(--am-slate); }
.am-donut-tone-amber .am-donut-swatch { background: var(--am-gold); }

.am-donut-legend-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  font-size: 0.82rem;
}

.am-donut-legend-text small {
  color: var(--am-ink-faint);
  font-size: 0.7rem;
}

.am-donut-legend-empty {
  color: var(--am-ink-faint);
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

.am-side-stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.am-side-stat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--am-border);
  transition: background 0.15s ease;
}

.am-side-stat-list li:last-child {
  border-bottom: 0;
}

.am-side-stat-list li:hover {
  background: rgba(26, 122, 109, 0.05);
}

.am-side-stat-list strong {
  color: var(--am-teal);
}

.am-side-stat-list small {
  display: block;
  color: var(--am-ink-faint);
  font-size: 0.7rem;
}

.am-dashboard .am-action-tile {
  background: linear-gradient(135deg, #fff, var(--am-teal-softer));
  border-color: rgba(26, 122, 109, 0.12);
  transition: transform 0.18s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.18s ease;
}

.am-dashboard .am-action-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 42, 61, 0.07);
  background: linear-gradient(135deg, var(--am-teal-softer), var(--am-teal-soft));
  border-color: rgba(26, 122, 109, 0.28);
}

.am-action-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(26, 122, 109, 0.12);
  color: var(--am-teal);
}

.am-action-tile-icon i {
  font-size: 1.15rem;
  color: inherit;
}

.am-dashboard .am-empty-state {
  background:
    radial-gradient(420px 160px at 50% 0%, rgba(26, 122, 109, 0.08), transparent 70%),
    #fbfcfd;
}

.am-row-warn td:first-child a {
  color: #b45309;
}

.am-dashboard .am-row-warn {
  background: linear-gradient(90deg, rgba(192, 57, 43, 0.05), transparent 55%);
}

@media (max-width: 991.98px) {
  .am-donut-layout {
    justify-content: center;
  }

  .am-donut-legend {
    flex: 1 1 100%;
  }
}

@media (max-width: 575.98px) {
  .am-dash-header {
    margin-bottom: 1.5rem;
  }

  .am-dash-hero {
    min-height: 0;
    gap: 0.9rem;
    padding: 1.2rem 1.15rem 1.3rem;
    padding-inline-start: 1.35rem;
  }

  .am-dash-hero::before {
    top: 10%;
    bottom: 10%;
    width: 3px;
  }

  .am-dash-hero-main {
    align-items: stretch;
    gap: 0.85rem;
  }

  .am-dash-hero-heading {
    margin-bottom: 0.35rem;
  }

  .am-dash-hero-actions {
    width: 100%;
  }

  .am-dash-hero-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }

  .am-dashboard {
    margin: 0;
    padding: 0;
  }

  .am-kpi-ring {
    width: 42px;
    height: 42px;
  }

  .am-donut-ring {
    width: 118px;
    height: 118px;
  }

  .am-donut-hole {
    width: 70px;
    height: 70px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .am-dash-fade,
  .amesbah-kpi .am-kpi-card,
  .am-kpi-icon,
  .am-dashboard .am-action-tile,
  .am-status-bar-track span,
  .am-workload-track span,
  .am-kpi-ring-value,
  .am-donut-ring {
    animation: none !important;
    transition: none !important;
  }

  .am-status-bar-track span,
  .am-workload-track span {
    width: var(--am-bar, 0%);
  }
}

/* Dashboard mini-kanban (dept manager) */
.am-dash-kanban .card-header small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
}

.am-dash-kanban-board {
  padding-bottom: 0.35rem;
  margin: 0 -0.15rem;
}

.am-dash-kanban-col {
  min-width: 260px;
  max-width: 280px;
  max-height: min(62vh, 520px);
  display: flex;
  flex-direction: column;
}

.am-dash-kanban-cards {
  overflow-y: auto;
  overflow-x: hidden;
  padding-left: 0.15rem;
  margin-left: -0.15rem;
  flex: 1 1 auto;
  min-height: 0;
}

.am-dash-kanban-col-0 {
  background: linear-gradient(180deg, #e7f5f2 0%, #eef3f6 100%);
  border-color: rgba(26, 122, 109, 0.18);
}

.am-dash-kanban-col-1 {
  background: linear-gradient(180deg, #e8f1fa 0%, #eef3f6 100%);
  border-color: rgba(47, 128, 180, 0.18);
}

.am-dash-kanban-col-2 {
  background: linear-gradient(180deg, #f7f1e6 0%, #eef3f6 100%);
  border-color: rgba(180, 130, 50, 0.18);
}

.am-dash-kanban-col-3 {
  background: linear-gradient(180deg, #eef2f5 0%, #eef3f6 100%);
  border-color: rgba(91, 107, 122, 0.18);
}

.am-dash-kanban-col-4 {
  background: linear-gradient(180deg, #f5ebe8 0%, #eef3f6 100%);
  border-color: rgba(180, 90, 70, 0.16);
}

.am-dash-kanban .kanban-card.is-overdue {
  border-color: rgba(192, 57, 43, 0.35);
  box-shadow: 0 4px 14px rgba(192, 57, 43, 0.08);
}

.am-dash-pri {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.am-dash-pri-urgent {
  color: #9b1c1c;
  background: rgba(192, 57, 43, 0.12);
}

.am-dash-pri-high {
  color: #9a3412;
  background: rgba(234, 140, 60, 0.18);
}

.am-dash-pri-overdue {
  color: #9b1c1c;
  background: rgba(192, 57, 43, 0.14);
}

.am-dash-kanban .due-overdue {
  color: #c0392b;
  font-weight: 600;
}

.am-dash-kanban-more {
  display: block;
  text-align: center;
  padding: 0.55rem 0.4rem;
  margin-top: 0.15rem;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--am-teal);
  background: rgba(26, 122, 109, 0.08);
  text-decoration: none;
  border: 1px dashed rgba(26, 122, 109, 0.25);
}

.am-dash-kanban-more:hover {
  background: rgba(26, 122, 109, 0.14);
  color: var(--am-teal);
}

.am-dash-kanban-more.is-static {
  cursor: default;
}

@media (max-width: 575.98px) {
  .am-dash-kanban-col {
    min-width: 240px;
    max-width: 260px;
    max-height: 420px;
  }
}

/* —— Reports —— */
.am-reports-filters {
  border: 1px solid rgba(26, 122, 109, 0.12);
  box-shadow: 0 8px 24px rgba(15, 60, 55, 0.04);
}

.am-report-kpi {
  border: 0;
  overflow: hidden;
  height: 100%;
  box-shadow: 0 10px 28px rgba(15, 60, 55, 0.06);
}

.am-report-kpi .card-body {
  position: relative;
  padding: 1rem 0.95rem 0.9rem;
}

.am-report-kpi-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.55rem;
  font-size: 1.05rem;
}

.am-report-kpi-value {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  color: #16352f;
}

.am-report-kpi-label {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #2a4f48;
}

.am-report-kpi-sub {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: #6b8580;
}

.am-report-kpi.tone-teal {
  background: linear-gradient(160deg, #e8f7f3, #f7fbfa);
}
.am-report-kpi.tone-teal .am-report-kpi-icon {
  background: rgba(26, 122, 109, 0.14);
  color: var(--am-teal);
}

.am-report-kpi.tone-green {
  background: linear-gradient(160deg, #e9f8ef, #f7fcf9);
}
.am-report-kpi.tone-green .am-report-kpi-icon {
  background: rgba(34, 140, 90, 0.14);
  color: #1f8a55;
}

.am-report-kpi.tone-amber {
  background: linear-gradient(160deg, #fff6e8, #fffcf7);
}
.am-report-kpi.tone-amber .am-report-kpi-icon {
  background: rgba(196, 140, 40, 0.14);
  color: #b07818;
}

.am-report-kpi.tone-blue {
  background: linear-gradient(160deg, #eaf3fb, #f7fafc);
}
.am-report-kpi.tone-blue .am-report-kpi-icon {
  background: rgba(40, 110, 170, 0.14);
  color: #2a6ea8;
}

.am-report-kpi.tone-rose {
  background: linear-gradient(160deg, #fceef1, #fff9fa);
}
.am-report-kpi.tone-rose .am-report-kpi-icon {
  background: rgba(180, 60, 90, 0.12);
  color: #b03d5c;
}

.am-report-bar + .am-report-bar {
  margin-top: 0.85rem;
}

/* ========== Per-user panel themes (data-am-theme) — whole shell ========== */
html[data-am-theme="mesbah"] {
  --am-teal: #1a7a6d;
  --am-teal-deep: #0f4f5c;
  --am-teal-mid: #2a9a88;
  --am-teal-hover: #15675c;
  --am-teal-soft: #e6f4f1;
  --am-teal-softer: #f3fbf9;
  --am-gold: #c4a35a;
  --am-gold-soft: #f7f1e4;
  --am-surface: #f0f4f7;
  --am-sidebar-bg: #0b3d46;
  --am-sidebar-bg-top: #134e58;
  --am-sidebar-bg-mid: #0d3f48;
  --am-sidebar-bg-bottom: #0a353d;
  --am-sidebar-glow-a: rgba(42, 154, 136, 0.35);
  --am-sidebar-glow-b: rgba(15, 79, 92, 0.55);
  --am-sidebar-border: rgba(255, 255, 255, 0.09);
  --am-sidebar-text: rgba(240, 250, 247, 0.94);
  --am-sidebar-text-muted: rgba(170, 210, 200, 0.72);
  --am-sidebar-caption: rgba(140, 195, 185, 0.55);
  --am-sidebar-active-bg: rgba(90, 190, 170, 0.22);
  --am-sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --am-sidebar-active-text: #ffffff;
  --am-sidebar-accent: #7dd4c4;
  --am-sidebar-accent-soft: rgba(125, 212, 196, 0.28);
  --am-sidebar-well: rgba(255, 255, 255, 0.08);
  --am-sidebar-well-active: rgba(125, 212, 196, 0.22);
  --am-brand-from: #4ec4b0;
  --am-brand-mid: #1f8a7a;
  --am-brand-to: #166b5f;
  --am-primary-rgb: 26, 122, 109;
}

html[data-am-theme="ocean"] {
  --am-teal: #2a6ea8;
  --am-teal-deep: #163a5f;
  --am-teal-mid: #3d8ec4;
  --am-teal-hover: #225a8a;
  --am-teal-soft: #e6f1f8;
  --am-teal-softer: #f2f8fc;
  --am-gold: #6b9bb8;
  --am-gold-soft: #eaf3f8;
  --am-surface: #eef3f7;
  --am-sidebar-bg: #12263a;
  --am-sidebar-bg-top: #1a3a55;
  --am-sidebar-bg-mid: #132d44;
  --am-sidebar-bg-bottom: #0e2336;
  --am-sidebar-glow-a: rgba(61, 142, 196, 0.38);
  --am-sidebar-glow-b: rgba(22, 58, 95, 0.55);
  --am-sidebar-border: rgba(255, 255, 255, 0.09);
  --am-sidebar-text: rgba(236, 246, 255, 0.94);
  --am-sidebar-text-muted: rgba(160, 195, 220, 0.72);
  --am-sidebar-caption: rgba(130, 175, 205, 0.55);
  --am-sidebar-active-bg: rgba(90, 160, 210, 0.24);
  --am-sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --am-sidebar-active-text: #ffffff;
  --am-sidebar-accent: #7eb8e0;
  --am-sidebar-accent-soft: rgba(126, 184, 224, 0.28);
  --am-sidebar-well: rgba(255, 255, 255, 0.08);
  --am-sidebar-well-active: rgba(126, 184, 224, 0.22);
  --am-brand-from: #6eb4e4;
  --am-brand-mid: #2a6ea8;
  --am-brand-to: #1a4a78;
  --am-primary-rgb: 42, 110, 168;
}

html[data-am-theme="forest"] {
  --am-teal: #2f7a4a;
  --am-teal-deep: #1a4a2e;
  --am-teal-mid: #3f9560;
  --am-teal-hover: #27663e;
  --am-teal-soft: #e7f4ec;
  --am-teal-softer: #f3faf6;
  --am-gold: #8a9a4a;
  --am-gold-soft: #f2f5e8;
  --am-surface: #eef4f0;
  --am-sidebar-bg: #143528;
  --am-sidebar-bg-top: #1c4634;
  --am-sidebar-bg-mid: #153a2a;
  --am-sidebar-bg-bottom: #102e22;
  --am-sidebar-glow-a: rgba(63, 149, 96, 0.38);
  --am-sidebar-glow-b: rgba(26, 74, 46, 0.55);
  --am-sidebar-border: rgba(255, 255, 255, 0.09);
  --am-sidebar-text: rgba(236, 250, 242, 0.94);
  --am-sidebar-text-muted: rgba(165, 210, 180, 0.72);
  --am-sidebar-caption: rgba(135, 185, 155, 0.55);
  --am-sidebar-active-bg: rgba(90, 180, 120, 0.24);
  --am-sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --am-sidebar-active-text: #ffffff;
  --am-sidebar-accent: #7dcea0;
  --am-sidebar-accent-soft: rgba(125, 206, 160, 0.28);
  --am-sidebar-well: rgba(255, 255, 255, 0.08);
  --am-sidebar-well-active: rgba(125, 206, 160, 0.22);
  --am-brand-from: #6fcea0;
  --am-brand-mid: #2f7a4a;
  --am-brand-to: #1f5a36;
  --am-primary-rgb: 47, 122, 74;
}

html[data-am-theme="sunset"] {
  --am-teal: #b86a1e;
  --am-teal-deep: #6b3d12;
  --am-teal-mid: #d4892e;
  --am-teal-hover: #9a5818;
  --am-teal-soft: #f8efe4;
  --am-teal-softer: #fcf7f1;
  --am-gold: #c4a35a;
  --am-gold-soft: #f5efe3;
  --am-surface: #f4f0eb;
  --am-sidebar-bg: #3a2818;
  --am-sidebar-bg-top: #4a3420;
  --am-sidebar-bg-mid: #3a2818;
  --am-sidebar-bg-bottom: #2c1e12;
  --am-sidebar-glow-a: rgba(212, 137, 46, 0.38);
  --am-sidebar-glow-b: rgba(107, 61, 18, 0.55);
  --am-sidebar-border: rgba(255, 255, 255, 0.09);
  --am-sidebar-text: rgba(255, 246, 236, 0.94);
  --am-sidebar-text-muted: rgba(220, 190, 150, 0.72);
  --am-sidebar-caption: rgba(200, 165, 120, 0.55);
  --am-sidebar-active-bg: rgba(210, 150, 70, 0.26);
  --am-sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --am-sidebar-active-text: #ffffff;
  --am-sidebar-accent: #e0b070;
  --am-sidebar-accent-soft: rgba(224, 176, 112, 0.28);
  --am-sidebar-well: rgba(255, 255, 255, 0.08);
  --am-sidebar-well-active: rgba(224, 176, 112, 0.22);
  --am-brand-from: #e8b86a;
  --am-brand-mid: #b86a1e;
  --am-brand-to: #7a4514;
  --am-primary-rgb: 184, 106, 30;
}

html[data-am-theme="ruby"] {
  --am-teal: #a0455c;
  --am-teal-deep: #5c2438;
  --am-teal-mid: #b85a72;
  --am-teal-hover: #87384d;
  --am-teal-soft: #f7ebee;
  --am-teal-softer: #fbf5f7;
  --am-gold: #b0896a;
  --am-gold-soft: #f5efe9;
  --am-surface: #f5f0f2;
  --am-sidebar-bg: #3a1f2a;
  --am-sidebar-bg-top: #4a2836;
  --am-sidebar-bg-mid: #3a1f2a;
  --am-sidebar-bg-bottom: #2c1720;
  --am-sidebar-glow-a: rgba(184, 90, 114, 0.38);
  --am-sidebar-glow-b: rgba(92, 36, 56, 0.55);
  --am-sidebar-border: rgba(255, 255, 255, 0.09);
  --am-sidebar-text: rgba(255, 240, 245, 0.94);
  --am-sidebar-text-muted: rgba(215, 170, 185, 0.72);
  --am-sidebar-caption: rgba(195, 145, 165, 0.55);
  --am-sidebar-active-bg: rgba(190, 100, 130, 0.26);
  --am-sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --am-sidebar-active-text: #ffffff;
  --am-sidebar-accent: #e0a0b4;
  --am-sidebar-accent-soft: rgba(224, 160, 180, 0.28);
  --am-sidebar-well: rgba(255, 255, 255, 0.08);
  --am-sidebar-well-active: rgba(224, 160, 180, 0.22);
  --am-brand-from: #d888a0;
  --am-brand-mid: #a0455c;
  --am-brand-to: #6e2e42;
  --am-primary-rgb: 160, 69, 92;
}

html[data-am-theme="charcoal"] {
  --am-teal: #5b6b7a;
  --am-teal-deep: #2a323c;
  --am-teal-mid: #718090;
  --am-teal-hover: #4a5866;
  --am-teal-soft: #eef1f4;
  --am-teal-softer: #f6f8fa;
  --am-gold: #8a9198;
  --am-gold-soft: #f0f2f4;
  --am-surface: #eef1f4;
  --am-sidebar-bg: #1e242b;
  --am-sidebar-bg-top: #2a323c;
  --am-sidebar-bg-mid: #1e242b;
  --am-sidebar-bg-bottom: #161b20;
  --am-sidebar-glow-a: rgba(113, 128, 144, 0.35);
  --am-sidebar-glow-b: rgba(42, 50, 60, 0.55);
  --am-sidebar-border: rgba(255, 255, 255, 0.08);
  --am-sidebar-text: rgba(236, 240, 244, 0.94);
  --am-sidebar-text-muted: rgba(170, 180, 190, 0.72);
  --am-sidebar-caption: rgba(140, 152, 164, 0.55);
  --am-sidebar-active-bg: rgba(140, 155, 170, 0.24);
  --am-sidebar-hover-bg: rgba(255, 255, 255, 0.07);
  --am-sidebar-active-text: #ffffff;
  --am-sidebar-accent: #a8b4c0;
  --am-sidebar-accent-soft: rgba(168, 180, 192, 0.28);
  --am-sidebar-well: rgba(255, 255, 255, 0.07);
  --am-sidebar-well-active: rgba(168, 180, 192, 0.2);
  --am-brand-from: #9aa8b6;
  --am-brand-mid: #5b6b7a;
  --am-brand-to: #3a4652;
  --am-primary-rgb: 91, 107, 122;
}

/* Force Able preset + Bootstrap to follow user theme across the whole UI */
html[data-am-theme] {
  --bs-primary: var(--am-teal);
  --bs-primary-rgb: var(--am-primary-rgb);
  --bs-primary-light: var(--am-teal-soft);
  --bs-link-color: var(--am-teal);
  --bs-link-hover-color: var(--am-teal-hover);
  --pc-sidebar-active-color: var(--am-teal);
}

[data-pc-preset="preset-1"] {
  --bs-primary: var(--am-teal) !important;
  --bs-primary-rgb: var(--am-primary-rgb) !important;
  --bs-primary-light: var(--am-teal-soft) !important;
  --pc-sidebar-active-color: var(--am-teal) !important;
}

[data-pc-preset="preset-1"] .btn-primary,
[data-pc-preset="preset-1"] .text-primary,
[data-pc-preset="preset-1"] .link-primary,
[data-pc-preset="preset-1"] .bg-primary,
[data-pc-preset="preset-1"] .border-primary,
[data-pc-preset="preset-1"] .form-check-input:checked,
[data-pc-preset="preset-1"] .nav-pills .nav-link.active,
[data-pc-preset="preset-1"] .page-item.active .page-link {
  --bs-btn-bg: var(--am-teal);
  --bs-btn-border-color: var(--am-teal);
  --bs-btn-hover-bg: var(--am-teal-hover);
  --bs-btn-hover-border-color: var(--am-teal-hover);
}

[data-pc-preset="preset-1"] .btn-outline-primary {
  --bs-btn-color: var(--am-teal);
  --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--am-teal);
  --bs-btn-hover-bg: var(--am-teal);
  --bs-btn-hover-border-color: var(--am-teal);
  --bs-btn-hover-color: #fff;
  color: var(--am-teal) !important;
  background-color: transparent !important;
  border-color: var(--am-teal) !important;
}

[data-pc-preset="preset-1"] .text-primary,
[data-pc-preset="preset-1"] .link-primary,
.breadcrumb-item a,
a.link-primary {
  color: var(--am-teal) !important;
}

[data-pc-preset="preset-1"] .bg-primary,
[data-pc-preset="preset-1"] .text-bg-primary {
  background-color: var(--am-teal) !important;
}

[data-pc-preset="preset-1"] .bg-light-primary {
  background-color: var(--am-teal-soft) !important;
  color: var(--am-teal) !important;
}

.pc-header .pc-head-link:hover,
.pc-header .pc-head-link.active {
  color: var(--am-teal) !important;
}

.am-mobile-dock a.active,
.am-mobile-dock .dock-primary {
  color: var(--am-teal) !important;
}

.progress-bar.bg-primary,
.progress-bar:not(.bg-success):not(.bg-warning):not(.bg-danger):not(.bg-info) {
  background-color: var(--am-teal) !important;
}

/* Appearance picker */
.am-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.85rem;
}

.am-theme-option {
  margin: 0;
}

.am-theme-swatch-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: start;
  border: 1px solid var(--am-border);
  border-radius: var(--am-radius-sm);
  background: var(--am-card);
  padding: 0.85rem 0.95rem;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  color: inherit;
}

.am-theme-swatch-btn:hover:not(:disabled) {
  border-color: var(--am-teal);
  box-shadow: var(--am-shadow);
  transform: translateY(-1px);
}

.am-theme-option.is-active .am-theme-swatch-btn {
  border-color: var(--am-teal);
  box-shadow: 0 0 0 3px var(--am-teal-soft);
  cursor: default;
}

.am-theme-swatches {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.am-theme-dot {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 42, 61, 0.12);
}

.am-theme-dot.secondary {
  width: 1.15rem;
  height: 1.15rem;
  margin-inline-start: -0.45rem;
  opacity: 0.92;
}

.am-theme-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.am-theme-meta strong {
  font-size: 0.95rem;
  color: var(--am-ink);
}

.am-theme-meta span,
.am-theme-meta em {
  font-size: 0.78rem;
  font-style: normal;
  color: var(--am-ink-muted);
}

.am-theme-option.is-active .am-theme-meta em {
  color: var(--am-teal);
  font-weight: 600;
}

.am-theme-check {
  position: absolute;
  inset-inline-end: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--am-teal);
  font-size: 1.15rem;
}

/* ========== مدیریت زبان‌ها ========== */
.am-lang-stat .am-lang-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--am-ink-muted, #6b7a88);
}
.am-lang-stat .am-lang-stat-num {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--am-ink);
  line-height: 1.15;
  margin-top: 0.15rem;
}
.am-lang-stat.is-active { border-top: 3px solid #2f9e7a; }
.am-lang-stat.is-source { border-top: 3px solid #2f6f8f; }
.am-lang-stat.is-target { border-top: 3px solid #c4a35a; }

.am-lang-grid {
  display: grid;
  gap: 0.9rem;
}
@media (min-width: 992px) {
  .am-lang-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.am-lang-card.is-off {
  opacity: 0.72;
  filter: grayscale(0.15);
}
.am-lang-card-top {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}
.am-lang-avatar {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: linear-gradient(145deg, var(--am-teal-mid, #2a9b8a), var(--am-teal, #1a7a6d));
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.am-lang-switches {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
@media (min-width: 576px) {
  .am-lang-switches {
    grid-template-columns: repeat(3, 1fr);
  }
}
.am-lang-switch {
  margin: 0;
  cursor: pointer;
}
.am-lang-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.am-lang-switch-ui {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--am-border, rgba(15, 42, 61, 0.1));
  background: #fff;
  min-height: 4.2rem;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.am-lang-switch-ui i {
  font-size: 1.05rem;
  color: #8a97a5;
  margin-bottom: 0.15rem;
}
.am-lang-switch-ui strong {
  font-size: 0.88rem;
  color: var(--am-ink);
}
.am-lang-switch-ui em {
  font-style: normal;
  font-size: 0.72rem;
  color: #8a97a5;
}
.am-lang-switch input:checked + .am-lang-switch-ui {
  border-color: var(--am-teal);
  background: var(--am-teal-soft, #e6f4f1);
  box-shadow: 0 0 0 3px rgba(26, 122, 109, 0.12);
}
.am-lang-switch input:checked + .am-lang-switch-ui i,
.am-lang-switch input:checked + .am-lang-switch-ui strong {
  color: var(--am-teal);
}
.am-lang-switch.is-source input:checked + .am-lang-switch-ui {
  border-color: #2f6f8f;
  background: #e8f3f7;
  box-shadow: 0 0 0 3px rgba(47, 111, 143, 0.12);
}
.am-lang-switch.is-source input:checked + .am-lang-switch-ui i,
.am-lang-switch.is-source input:checked + .am-lang-switch-ui strong {
  color: #2f6f8f;
}
.am-lang-switch.is-target input:checked + .am-lang-switch-ui {
  border-color: #b8923f;
  background: #f7f1e4;
  box-shadow: 0 0 0 3px rgba(184, 146, 63, 0.14);
}
.am-lang-switch.is-target input:checked + .am-lang-switch-ui i,
.am-lang-switch.is-target input:checked + .am-lang-switch-ui strong {
  color: #9a7528;
}
.am-lang-switch input:disabled + .am-lang-switch-ui {
  opacity: 0.75;
  cursor: not-allowed;
}
.am-perm-matrix th,
.am-perm-matrix td {
  vertical-align: middle;
}
.am-perm-sticky {
  position: sticky;
  inset-inline-start: 0;
  background: #fff;
  z-index: 1;
  min-width: 14rem;
}

/* ========== دسترسی نقش‌ها ========== */
.am-role-admin-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1rem;
  padding: 0.95rem 1.15rem;
  border-radius: var(--am-radius, 14px);
  background:
    linear-gradient(135deg, rgba(15, 42, 61, 0.92), rgba(26, 122, 109, 0.88));
  color: #fff;
  box-shadow: 0 10px 28px rgba(15, 42, 61, 0.12);
}
.am-role-admin-banner p {
  opacity: 0.88;
  font-size: 0.88rem;
}
.am-role-admin-banner-icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  font-size: 1.25rem;
}
.am-role-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
}
.am-role-cards {
  display: grid;
  gap: 0.95rem;
}
@media (min-width: 768px) {
  .am-role-cards { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1200px) {
  .am-role-cards { grid-template-columns: 1fr 1fr 1fr; }
}
.am-role-card {
  border: 1px solid var(--am-border, rgba(15, 42, 61, 0.1));
  border-radius: var(--am-radius, 14px);
  background: #fff;
  padding: 1rem 1.05rem 1.05rem;
  box-shadow: 0 8px 22px rgba(15, 42, 61, 0.05);
  border-top: 3px solid var(--am-teal, #1a7a6d);
}
.am-role-card.tone-executive { border-top-color: #2f6f8f; }
.am-role-card.tone-finance { border-top-color: #2f9e7a; }
.am-role-card.tone-dept { border-top-color: #5b6b7a; }
.am-role-card.tone-expert { border-top-color: #1a7a6d; }
.am-role-card.tone-registrar { border-top-color: #c4a35a; }
.am-role-card.tone-viewer { border-top-color: #7a8a99; }
.am-role-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.am-role-avatar {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--am-teal-soft, #e6f4f1);
  color: var(--am-teal, #1a7a6d);
  font-size: 1.15rem;
}
.am-role-avatar.lg {
  width: 3.2rem;
  height: 3.2rem;
  font-size: 1.4rem;
  border-radius: 14px;
}
.am-role-card.tone-executive .am-role-avatar { background: #e8f3f7; color: #2f6f8f; }
.am-role-card.tone-finance .am-role-avatar { background: #e8f7f1; color: #2f9e7a; }
.am-role-card.tone-dept .am-role-avatar { background: #eef1f4; color: #5b6b7a; }
.am-role-card.tone-registrar .am-role-avatar { background: #f7f1e4; color: #9a7528; }
.am-role-card.tone-viewer .am-role-avatar { background: #f1f3f5; color: #6b7a88; }
.am-role-card-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.15rem;
  color: var(--am-ink, #0f2a3d);
}
.am-role-code {
  font-size: 0.72rem;
  color: #8a97a5;
  background: #f4f7f9;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
}
.am-role-progress-bar {
  height: 0.45rem;
  border-radius: 999px;
  background: #e8eef2;
}
.am-role-progress-bar .progress-bar {
  background: var(--am-teal, #1a7a6d);
  border-radius: 999px;
}
.am-role-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}
.am-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #f4f7f9;
  color: #5b6b7a;
}
.am-role-chip em {
  font-style: normal;
  opacity: 0.75;
}
.am-role-chip.is-full {
  background: var(--am-teal-soft, #e6f4f1);
  color: var(--am-teal, #1a7a6d);
}
.am-role-chip.is-partial {
  background: #f7f1e4;
  color: #9a7528;
}
.am-role-chip.is-empty {
  opacity: 0.55;
}

.am-perm-matrix-card .card-header {
  border-bottom: 1px solid var(--am-border, rgba(15, 42, 61, 0.08));
}
.am-perm-scroll {
  max-height: min(70vh, 720px);
  overflow: auto;
}
.am-perm-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafb;
  box-shadow: 0 1px 0 rgba(15, 42, 61, 0.06);
}
.am-perm-matrix .am-perm-sticky {
  z-index: 3;
}
.am-perm-matrix thead .am-perm-sticky {
  z-index: 4;
}
.am-perm-role-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.am-perm-group-row td {
  background: #f4f7f9;
  font-weight: 800;
  color: var(--am-ink, #0f2a3d);
  padding: 0.65rem 1rem;
}
.am-perm-label {
  font-weight: 700;
  color: var(--am-ink, #0f2a3d);
  font-size: 0.9rem;
}
.am-perm-key {
  font-size: 0.7rem;
  color: #8a97a5;
}
.am-perm-dot {
  display: inline-flex;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.am-perm-dot.is-on {
  background: rgba(47, 158, 122, 0.12);
  color: #2f9e7a;
}
.am-perm-dot.is-off {
  background: #f1f3f5;
  color: #a0aab4;
}

.am-role-edit-hero {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--am-radius, 14px);
  background: #fff;
  border: 1px solid var(--am-border, rgba(15, 42, 61, 0.1));
  border-top: 3px solid var(--am-teal, #1a7a6d);
  box-shadow: 0 8px 22px rgba(15, 42, 61, 0.05);
}
.am-role-edit-hero.tone-executive { border-top-color: #2f6f8f; }
.am-role-edit-hero.tone-finance { border-top-color: #2f9e7a; }
.am-role-edit-hero.tone-dept { border-top-color: #5b6b7a; }
.am-role-edit-hero.tone-registrar { border-top-color: #c4a35a; }
.am-role-edit-hero.tone-viewer { border-top-color: #7a8a99; }
.am-role-edit-hero.tone-executive .am-role-avatar { background: #e8f3f7; color: #2f6f8f; }
.am-role-edit-hero.tone-finance .am-role-avatar { background: #e8f7f1; color: #2f9e7a; }
.am-role-edit-hero.tone-dept .am-role-avatar { background: #eef1f4; color: #5b6b7a; }
.am-role-edit-hero.tone-registrar .am-role-avatar { background: #f7f1e4; color: #9a7528; }
.am-role-edit-hero.tone-viewer .am-role-avatar { background: #f1f3f5; color: #6b7a88; }
.am-role-edit-hero-main {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}
.am-role-edit-hero-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.65rem;
}
.am-role-live-count {
  text-align: end;
  line-height: 1.2;
}
.am-role-live-count strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--am-teal, #1a7a6d);
}
.am-role-live-count span {
  font-size: 0.78rem;
  color: #6b7a88;
}
.am-perm-edit-grid {
  display: grid;
  gap: 0.95rem;
}
@media (min-width: 992px) {
  .am-perm-edit-grid { grid-template-columns: 1fr 1fr; }
}
.am-perm-group-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--am-teal-soft, #e6f4f1);
  color: var(--am-teal, #1a7a6d);
}
.am-perm-switch-grid {
  display: grid;
  gap: 0.55rem;
}
.am-perm-switch-card {
  margin: 0;
  cursor: pointer;
}
.am-perm-switch-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.am-perm-switch-ui {
  display: block;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--am-border, rgba(15, 42, 61, 0.1));
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.am-perm-switch-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}
.am-perm-switch-top strong {
  font-size: 0.9rem;
  color: var(--am-ink, #0f2a3d);
}
.am-perm-switch-ui code {
  font-size: 0.68rem;
  color: #8a97a5;
}
.am-perm-knob {
  width: 2.4rem;
  height: 1.3rem;
  border-radius: 999px;
  background: #d7dee4;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.am-perm-knob::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  inset-inline-start: 0.15rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 42, 61, 0.2);
  transition: inset-inline-start 0.15s ease;
}
.am-perm-switch-card input:checked + .am-perm-switch-ui {
  border-color: var(--am-teal, #1a7a6d);
  background: var(--am-teal-soft, #e6f4f1);
  box-shadow: 0 0 0 3px rgba(26, 122, 109, 0.1);
}
.am-perm-switch-card input:checked + .am-perm-switch-ui .am-perm-knob {
  background: var(--am-teal, #1a7a6d);
}
.am-perm-switch-card input:checked + .am-perm-switch-ui .am-perm-knob::after {
  inset-inline-start: 1.2rem;
}
.am-role-edit-footer {
  position: sticky;
  bottom: 0.75rem;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--am-border, rgba(15, 42, 61, 0.1));
  box-shadow: 0 -8px 24px rgba(15, 42, 61, 0.08);
  backdrop-filter: blur(8px);
}



/* ========== قراردادها ========== */
.am-contract-mini-stats {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
}
.am-contract-mini-stats i {
  margin-inline-end: 0.15rem;
}
.am-contract-stat .am-contract-stat-num {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--am-ink);
  line-height: 1.2;
  margin-top: 0.2rem;
}
.am-contract-stat.is-active {
  border-top: 3px solid #2f9e7a;
}
.am-contract-stat.is-rejected {
  border-top: 3px solid #c45c5c;
}
.am-dl {
  margin: 0;
}
.am-dl dt {
  font-size: 0.75rem;
  color: var(--am-ink-muted, #6b7a88);
  font-weight: 700;
  margin-top: 0.65rem;
}
.am-dl dt:first-child {
  margin-top: 0;
}
.am-dl dd {
  margin: 0.1rem 0 0;
  font-weight: 600;
  color: var(--am-ink);
}
.am-reject-reason {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: #fdf2f2;
  border: 1px solid rgba(196, 92, 92, 0.25);
  color: #7a2e2e;
  font-size: 0.88rem;
  max-width: 36rem;
}
.am-reject-reason > i {
  font-size: 1.1rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}
.am-row-rejected {
  background: rgba(196, 92, 92, 0.04);
}
.am-book-rows .am-book-row .btn {
  flex: 0 0 auto;
}

/* —— ساختار سازمانی / واحدها —— */
.am-org-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .am-org-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.am-org-stat {
  background: #fff;
  border: 1px solid rgba(20, 40, 60, 0.08);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  border-top: 3px solid #8a9aab;
}
.am-org-stat.is-active { border-top-color: #2f9e7a; }
.am-org-stat.is-manager { border-top-color: #2f6f8f; }
.am-org-stat.is-members { border-top-color: #c4a35a; }
.am-org-stat.is-unassigned { border-top-color: #c47a5a; }
.am-org-stat-label {
  display: block;
  font-size: 0.78rem;
  color: #6b7a88;
  margin-bottom: 0.2rem;
}
.am-org-stat-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--am-ink, #1c2b36);
}
.am-org-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
}
.am-org-search {
  position: relative;
  flex: 1 1 16rem;
  max-width: 28rem;
  display: flex;
  align-items: center;
}
.am-org-search > i {
  position: absolute;
  right: 0.85rem;
  color: #8a9aab;
  pointer-events: none;
}
.am-org-search input {
  width: 100%;
  border: 1px solid rgba(20, 40, 60, 0.12);
  border-radius: 999px;
  padding: 0.55rem 2.4rem 0.55rem 2.2rem;
  background: #fff;
}
.am-org-search-clear {
  position: absolute;
  left: 0.7rem;
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1.3rem;
  text-align: center;
  border-radius: 999px;
  background: #eef1f4;
  color: #5b6b7a;
  text-decoration: none;
  font-size: 1rem;
}
.am-org-hint {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #5b6b7a;
  max-width: 28rem;
}
.am-org-layout {
  display: grid;
  gap: 1rem;
}
@media (min-width: 1100px) {
  .am-org-layout {
    grid-template-columns: minmax(0, 1fr) 17.5rem;
    align-items: start;
  }
}
.am-org-main {
  display: grid;
  gap: 1rem;
}
.am-org-card {
  background: #fff;
  border: 1px solid rgba(20, 40, 60, 0.08);
  border-radius: 14px;
  overflow: hidden;
  border-top: 3px solid #2f6f8f;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.am-org-card.is-off {
  opacity: 0.72;
  border-top-color: #9aa6b2;
}
.am-org-card.is-focus {
  box-shadow: 0 0 0 2px rgba(47, 111, 143, 0.25);
}
.am-org-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 1px solid rgba(20, 40, 60, 0.06);
  background: linear-gradient(180deg, #f7fafc 0%, #fff 100%);
}
.am-org-avatar {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #e8f3f7;
  color: #2f6f8f;
  font-weight: 700;
  flex-shrink: 0;
}
.am-org-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--am-ink, #1c2b36);
}
.am-org-code {
  font-size: 0.75rem;
  background: #eef1f4;
  color: #5b6b7a;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  direction: ltr;
}
.am-org-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #6b7a88;
}
.am-org-meta i { margin-left: 0.2rem; }
.am-org-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-inline-start: auto;
}
.am-org-card-body {
  display: grid;
  gap: 0;
}
@media (min-width: 900px) {
  .am-org-card-body {
    grid-template-columns: minmax(14rem, 0.9fr) minmax(0, 1.3fr);
  }
  .am-org-manager-block {
    border-left: 1px solid rgba(20, 40, 60, 0.06);
  }
}
.am-org-manager-block,
.am-org-members-block {
  padding: 1rem 1.1rem;
}
.am-org-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #7a8a99;
  margin-bottom: 0.65rem;
}
.am-org-person {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: #f7f9fb;
  border: 1px solid transparent;
}
.am-org-person.is-manager {
  background: #eef6f9;
  border-color: rgba(47, 111, 143, 0.18);
}
.am-org-person-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dde5ec;
  color: #3d5160;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.am-org-person.is-manager .am-org-person-avatar {
  background: #d5eaf2;
  color: #2f6f8f;
}
.am-org-empty-manager,
.am-org-empty-members {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px dashed rgba(20, 40, 60, 0.15);
  color: #7a8a99;
  font-size: 0.88rem;
  list-style: none;
}
.am-org-inline-form,
.am-org-add-member {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.am-org-inline-form .form-select,
.am-org-add-member .form-select {
  flex: 1 1 10rem;
  min-width: 0;
}
.am-org-make-manager {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #5b6b7a;
  margin: 0;
  white-space: nowrap;
}
.am-org-member-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-height: 16rem;
  overflow: auto;
}
.am-org-side {
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 1100px) {
  .am-org-side {
    position: sticky;
    top: 1rem;
  }
}
.am-org-side-card {
  background: #fff;
  border: 1px solid rgba(20, 40, 60, 0.08);
  border-radius: 14px;
  padding: 1rem;
}
.am-org-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.am-org-side-head h4 {
  font-size: 0.95rem;
  font-weight: 700;
}
.am-org-side-help {
  background: linear-gradient(160deg, #f4f8fa, #fff);
  border-color: rgba(47, 111, 143, 0.12);
}
.am-org-side-help ol {
  color: #5b6b7a;
  line-height: 1.7;
}
.am-org-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #fff;
  border: 1px dashed rgba(20, 40, 60, 0.18);
  border-radius: 14px;
  color: #6b7a88;
}
.am-org-empty-state > i {
  font-size: 2.2rem;
  color: #2f6f8f;
  display: block;
  margin-bottom: 0.6rem;
}
.am-org-empty-state h3 {
  font-size: 1.15rem;
  color: var(--am-ink, #1c2b36);
  margin-bottom: 0.35rem;
}
.am-org-assign-unassigned .form-select {
  width: 100%;
}

.am-org-section {
  background: #fff;
  border: 1px solid rgba(20, 40, 60, 0.08);
  border-radius: 16px;
  overflow: hidden;
  border-top: 3px solid #2f6f8f;
}
.am-org-section.is-off { opacity: 0.72; border-top-color: #9aa6b2; }
.am-org-section.is-focus { box-shadow: 0 0 0 2px rgba(47, 111, 143, 0.25); }
.am-org-section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #f4f8fb 0%, #fff 100%);
  border-bottom: 1px solid rgba(20, 40, 60, 0.06);
}
.am-org-section-manager {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(20, 40, 60, 0.06);
  background: #fbfcfd;
}
.am-org-desks {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem 1.1rem;
}
.am-org-desk {
  border: 1px solid rgba(20, 40, 60, 0.1);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  border-right: 3px solid #c4a35a;
}
.am-org-desk-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.85rem 0.95rem;
  background: #fcfaf6;
  border-bottom: 1px solid rgba(20, 40, 60, 0.06);
}
.am-org-desk-body {
  display: grid;
  gap: 0.85rem;
  padding: 0.85rem 0.95rem;
}
@media (min-width: 900px) {
  .am-org-desk-body {
    grid-template-columns: minmax(12rem, 0.85fr) minmax(0, 1.25fr);
  }
}
.am-org-kind-pill {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #e8f3f7;
  color: #2f6f8f;
}
.am-org-kind-pill.is-desk {
  background: #f7f1e4;
  color: #9a7528;
}
.am-org-avatar.is-section { background: #e8f3f7; color: #2f6f8f; }
.am-org-avatar.is-desk { background: #f7f1e4; color: #9a7528; }
.am-org-empty-desks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px dashed rgba(20, 40, 60, 0.15);
  border-radius: 12px;
  color: #7a8a99;
  font-size: 0.9rem;
}

/* —— System settings hub —— */
.am-settings { display: grid; gap: 1.25rem; }
.am-settings-chrome {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end;
  padding: 1.1rem 1.25rem; border-radius: 16px;
  background: linear-gradient(135deg, #f3f8fb 0%, #fff 55%, #faf7f0 100%);
  border: 1px solid rgba(20, 40, 60, 0.08);
}
.am-settings-crumb { display: flex; gap: 0.4rem; align-items: center; font-size: 0.82rem; color: #7a8a99; margin-bottom: 0.35rem; }
.am-settings-crumb a { color: #2f6f8f; text-decoration: none; }
.am-settings-title { margin: 0; font-size: 1.45rem; font-weight: 800; color: #1d2b3a; }
.am-settings-sub { margin: 0.25rem 0 0; color: #6b7c8c; font-size: 0.92rem; }
.am-settings-stats {
  display: grid; grid-template-columns: repeat(4, minmax(4.5rem, auto)); gap: 0.65rem;
}
.am-settings-stats > div {
  display: grid; gap: 0.1rem; text-align: center; min-width: 4.75rem;
  padding: 0.55rem 0.7rem; border-radius: 12px; background: #fff;
  border: 1px solid rgba(20, 40, 60, 0.08);
}
.am-settings-stats strong { font-size: 1.05rem; color: #1d2b3a; }
.am-settings-stats span { font-size: 0.72rem; color: #7a8a99; }
.am-settings-layout {
  display: grid; gap: 1rem;
  grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr);
  align-items: start;
}
.am-settings-nav {
  display: grid; gap: 0.3rem; padding: 0.65rem;
  border-radius: 14px; background: #fff; border: 1px solid rgba(20, 40, 60, 0.08);
  position: sticky; top: 1rem;
}
.am-settings-nav > a {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 0.7rem; border-radius: 10px; color: #3a4a5a;
  text-decoration: none; font-weight: 600; font-size: 0.9rem;
}
.am-settings-nav > a i { font-size: 1.05rem; opacity: 0.85; }
.am-settings-nav > a:hover { background: #f4f8fb; color: #2f6f8f; }
.am-settings-nav > a.is-active { background: #e8f3f7; color: #2f6f8f; }
.am-settings-nav-label {
  margin: 0.65rem 0.35rem 0.2rem; font-size: 0.72rem; font-weight: 700;
  color: #9aa6b2; letter-spacing: 0.02em;
}
.am-settings-link {
  display: flex; align-items: flex-start; gap: 0.55rem;
  padding: 0.5rem 0.65rem; border-radius: 10px; color: inherit; text-decoration: none;
}
.am-settings-link:hover { background: #f7f9fb; }
.am-settings-link i { margin-top: 0.15rem; color: #2f6f8f; }
.am-settings-link strong { display: block; font-size: 0.86rem; }
.am-settings-link small { display: block; color: #8a97a5; font-size: 0.75rem; }
.am-settings-card { border-radius: 14px; overflow: hidden; border: 1px solid rgba(20, 40, 60, 0.08); }
.am-settings-card .card-header { background: #fbfcfd; border-bottom: 1px solid rgba(20, 40, 60, 0.06); }
.am-settings-switches { display: grid; gap: 0.85rem; }
.am-settings-switches .form-check { padding: 0.7rem 0.85rem; border-radius: 10px; background: #f7f9fb; margin: 0; }
@media (max-width: 900px) {
  .am-settings-layout { grid-template-columns: 1fr; }
  .am-settings-nav { position: static; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .am-settings-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
}

/* —— Letter compose (/letters/create) —— */
.am-compose {
  display: grid;
  gap: 1rem;
  padding-bottom: 1.5rem;
  animation: amComposeIn 0.35s ease both;
}
@keyframes amComposeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.am-compose-chrome {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
  padding: 1.05rem 1.2rem;
  border-radius: 16px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(196, 163, 90, 0.12), transparent 50%),
    linear-gradient(135deg, #f2f8f6 0%, #fff 48%, #faf8f3 100%);
  border: 1px solid rgba(20, 40, 60, 0.08);
}
.am-compose-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--am-ink-faint);
  margin-bottom: 0.3rem;
}
.am-compose-crumb a { color: var(--am-teal); text-decoration: none; }
.am-compose-crumb a:hover { text-decoration: underline; }
.am-compose-title {
  margin: 0;
  font-size: clamp(1.35rem, 1.15rem + 0.7vw, 1.7rem);
  font-weight: 800;
  color: var(--am-ink);
  letter-spacing: -0.02em;
}
.am-compose-sub {
  margin: 0.3rem 0 0;
  color: var(--am-ink-muted);
  font-size: 0.92rem;
  max-width: 36rem;
}
.am-compose-prefill {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--am-teal-softer);
  border: 1px solid rgba(26, 122, 109, 0.18);
}
.am-compose-prefill-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--am-teal-soft);
  color: var(--am-teal);
  font-size: 1.15rem;
  flex-shrink: 0;
}
.am-compose-prefill-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  flex: 1;
  min-width: 12rem;
  color: var(--am-ink);
  font-size: 0.92rem;
}
.am-compose-prefill-body strong { font-weight: 700; }
.am-compose-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 18.5rem);
  align-items: start;
}
.am-compose-main {
  display: grid;
  gap: 0.9rem;
}
.am-compose-section {
  border: 1px solid rgba(20, 40, 60, 0.08);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(15, 42, 61, 0.03);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.am-compose-section:focus-within {
  border-color: rgba(26, 122, 109, 0.28);
  box-shadow: 0 0 0 3px rgba(26, 122, 109, 0.08);
}
.am-compose-section-head {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.95rem 1.1rem;
  background: linear-gradient(180deg, #f7faf9 0%, #fff 100%);
  border-bottom: 1px solid rgba(20, 40, 60, 0.06);
}
.am-compose-step {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, var(--am-teal-mid), var(--am-teal-deep));
  box-shadow: 0 4px 10px rgba(15, 79, 92, 0.18);
}
.am-compose-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--am-ink);
}
.am-compose-section-head p {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  color: var(--am-ink-muted);
}
.am-compose-section-body { padding: 1.05rem 1.1rem 1.2rem; }
.am-compose-subject {
  font-size: 1.05rem;
  font-weight: 600;
  padding-block: 0.7rem;
}
.am-compose-counter {
  font-size: 0.72rem;
  color: var(--am-ink-faint);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}
.am-compose-counter.is-warn { color: #b45309; font-weight: 700; }
.am-compose-priority {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}
.am-compose-priority-item {
  position: relative;
  display: grid;
  gap: 0.15rem;
  justify-items: start;
  margin: 0;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(20, 40, 60, 0.12);
  background: #fafbfc;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}
.am-compose-priority-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.am-compose-priority-item > i {
  font-size: 1.1rem;
  opacity: 0.75;
}
.am-compose-priority-label {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--am-ink);
}
.am-compose-priority-hint {
  font-size: 0.72rem;
  color: var(--am-ink-faint);
}
.am-compose-priority-item:hover {
  transform: translateY(-1px);
  border-color: rgba(26, 122, 109, 0.35);
}
.am-compose-priority-item.is-checked {
  background: #fff;
  border-color: var(--am-teal);
  box-shadow: 0 0 0 3px rgba(26, 122, 109, 0.12);
}
.am-compose-priority-item.is-checked > i { opacity: 1; color: var(--am-teal); }
.am-compose-priority-item.is-high.is-checked {
  border-color: #c27803;
  box-shadow: 0 0 0 3px rgba(194, 120, 3, 0.14);
}
.am-compose-priority-item.is-high.is-checked > i { color: #c27803; }
.am-compose-priority-item.is-urgent.is-checked {
  border-color: #c2414d;
  box-shadow: 0 0 0 3px rgba(194, 65, 77, 0.14);
}
.am-compose-priority-item.is-urgent.is-checked > i { color: #c2414d; }
.am-compose-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0 0.25rem;
  position: sticky;
  bottom: 0.5rem;
  z-index: 5;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, #f8fafc 28%);
  padding-top: 1rem;
}
.am-compose-submit.is-busy {
  opacity: 0.85;
  pointer-events: none;
}
.am-compose-submit.is-busy .ti-loader-2 {
  animation: amSpin 0.8s linear infinite;
}
@keyframes amSpin {
  to { transform: rotate(360deg); }
}
.am-compose-actions-hint {
  margin-inline-start: auto;
  font-size: 0.8rem;
  color: var(--am-ink-faint);
}
.am-compose-aside {
  display: grid;
  gap: 0.85rem;
  position: sticky;
  top: 1rem;
}
.am-compose-preview-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--am-ink-faint);
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}
.am-compose-preview-card {
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 16px;
  background:
    linear-gradient(165deg, #0f4f5c 0%, #1a7a6d 55%, #15675c 100%);
  color: #f4faf8;
  box-shadow: 0 12px 28px rgba(15, 79, 92, 0.22);
  animation: amComposePreview 0.45s ease 0.08s both;
}
@keyframes amComposePreview {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.am-compose-preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.am-compose-preview-code {
  font-size: 0.75rem;
  opacity: 0.8;
  direction: ltr;
}
.am-compose-preview-card .priority-pill {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}
.am-compose-preview-subject {
  margin: 0 0 0.85rem;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.45;
  min-height: 2.6em;
}
.am-compose-preview-subject.is-empty { opacity: 0.55; font-weight: 600; }
.am-compose-preview-dl {
  display: grid;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.am-compose-preview-dl > div {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  gap: 0.4rem;
  align-items: start;
  font-size: 0.82rem;
}
.am-compose-preview-dl dt {
  margin: 0;
  opacity: 0.7;
  font-weight: 600;
}
.am-compose-preview-dl dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}
.am-compose-preview-dl dd.is-muted { opacity: 0.65; font-weight: 500; }
.am-compose-preview-summary {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  opacity: 0.9;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.am-compose-preview-summary.is-empty { opacity: 0.55; }
.am-compose-tips {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(20, 40, 60, 0.08);
}
.am-compose-tips h3 {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--am-ink);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.am-compose-tips h3 .ti { color: #c4a35a; }
.am-compose-tips ul {
  margin: 0;
  padding-inline-start: 1.1rem;
  color: var(--am-ink-muted);
  font-size: 0.82rem;
  line-height: 1.65;
}
.am-compose-tips li + li { margin-top: 0.35rem; }

@media (max-width: 1100px) {
  .am-compose-layout { grid-template-columns: 1fr; }
  .am-compose-aside { position: static; order: -1; }
  .am-compose-preview-card { max-width: 28rem; }
}
@media (max-width: 720px) {
  .am-compose-priority { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .am-compose-actions {
    position: sticky;
    bottom: 4.25rem;
    margin-inline: -0.25rem;
    padding: 0.75rem 0.25rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: rgba(248, 250, 252, 0.94);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(20, 40, 60, 0.06);
  }
  .am-compose-actions .btn-lg {
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
  }
}

/* ========== Mobile app shell (navbar + sheet + touch UX) ========== */
.am-mobile-menu-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  padding: 0.4rem 0.15rem;
  color: #6b7a88;
  background: transparent;
  border: 0;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 10px;
  width: 100%;
  font-family: inherit;
  cursor: pointer;
}

.am-mobile-menu-btn i { font-size: 1.22rem; }
.am-mobile-menu-btn.active,
.am-mobile-menu-btn:hover {
  color: var(--am-teal);
  background: var(--am-teal-soft);
}

.am-mobile-menu-btn em {
  position: absolute;
  top: 0.15rem;
  inset-inline-end: 16%;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 0.6rem;
  font-style: normal;
  display: grid;
  place-items: center;
}

.am-mobile-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(15, 42, 61, 0.42);
  backdrop-filter: blur(2px);
}

.am-mobile-sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1055;
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -16px 48px rgba(15, 42, 61, 0.18);
  transform: translateY(0);
  animation: amSheetUp 0.28s ease;
}

@keyframes amSheetUp {
  from { transform: translateY(100%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

.am-mobile-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.65rem;
  border-bottom: 1px solid var(--am-border);
}

.am-mobile-sheet-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.am-mobile-sheet-user strong {
  display: block;
  font-size: 0.95rem;
  color: var(--am-ink);
}

.am-mobile-sheet-user span {
  display: block;
  font-size: 0.78rem;
  color: var(--am-ink-muted);
}

.am-mobile-sheet-close {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 10px;
  background: #f3f6f8;
  color: var(--am-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.am-mobile-urgent {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.65rem 1rem 0;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(192, 57, 43, 0.1), rgba(192, 57, 43, 0.04));
  color: #b03a2e;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.am-mobile-sheet-body {
  flex: 1;
  overflow: auto;
  padding: 0.75rem 1rem 1rem;
  -webkit-overflow-scrolling: touch;
}

.am-mobile-section-label {
  margin: 0.65rem 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--am-ink-muted);
  letter-spacing: 0.02em;
}

.am-mobile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.am-mobile-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 4.6rem;
  padding: 0.55rem 0.35rem;
  border-radius: 14px;
  border: 1px solid var(--am-border);
  background: #fafcfd;
  color: var(--am-ink);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
}

.am-mobile-tile i {
  font-size: 1.25rem;
  color: var(--am-teal);
}

.am-mobile-tile.is-active,
.am-mobile-tile:hover {
  border-color: rgba(26, 122, 109, 0.35);
  background: var(--am-teal-soft);
}

.am-mobile-tile-accent {
  background: linear-gradient(180deg, rgba(26, 122, 109, 0.12), rgba(26, 122, 109, 0.04));
}

.am-mobile-tile em,
.am-mobile-tile span + em {
  position: absolute;
  top: 0.35rem;
  inset-inline-end: 0.35rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 0.62rem;
  font-style: normal;
  display: grid;
  place-items: center;
}

.am-mobile-list {
  display: grid;
  gap: 0.35rem;
}

.am-mobile-list a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--am-border);
  background: #fff;
  color: var(--am-ink);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
}

.am-mobile-list a i { color: var(--am-teal); }

.am-mobile-sheet-foot {
  padding: 0.75rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--am-border);
  background: #fff;
}

body.am-mobile-menu-open {
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .amesbah-app .pc-sidebar {
    display: none !important;
  }

  .amesbah-app .pc-container {
    margin-inline: 0 !important;
    width: 100% !important;
  }

  .amesbah-app .pc-content {
    padding-inline: 0.85rem !important;
  }

  .am-mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1025;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 4px 18px rgba(15, 42, 61, 0.06);
  }

  .am-header-brand-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--am-ink);
    max-width: 9.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pc-head-link {
    min-width: 2.5rem;
    min-height: 2.5rem;
    display: grid;
    place-items: center;
  }
}

@media (max-width: 767.98px) {
  .amesbah-app .pc-container {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)) !important;
  }

  .am-mobile-dock {
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 0px));
  }

  .am-mobile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-responsive,
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .card .card-body {
    padding: 0.85rem;
  }

  .btn,
  .form-control,
  .form-select,
  .ts-control {
    min-height: 2.75rem;
  }

  .form-control,
  .form-select,
  .ts-control input {
    font-size: 16px !important;
  }

  .page-header-title h2,
  .ibx-title {
    font-size: 1.15rem !important;
  }

  .row.g-3 > [class*="col-"],
  .row.g-4 > [class*="col-"] {
    margin-bottom: 0.15rem;
  }

  .am-dash-cmd-actions .btn,
  .ibx-chrome-actions .btn {
    flex: 1 1 auto;
  }

  .letter-cmd-actions {
    position: sticky;
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 35;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    margin-inline: -0.5rem;
    padding-inline: 0.5rem;
    border-top: 1px solid var(--am-border);
  }
}

@media print {
  .am-mobile-sheet,
  .am-mobile-sheet-backdrop {
    display: none !important;
  }
}

