:root {
  --ama-navy: #042145;
  --ama-green: #43a338;
  --crm-bg: #f4f6f1;
  --crm-bg-deep: #e9efe4;
  --crm-surface-2: #fbfcf9;
  --crm-surface-muted: #f4f6f1;
  --crm-border: #e6eaf0;
  --crm-border-strong: #b9c2d0;
  --crm-text: #10233f;
  --crm-text-muted: #3d4759;
  --crm-text-soft: #5b6674;
  --crm-accent: #398c31;
  --crm-accent-strong: #2d7227;
  --crm-info: #164d82;
  --crm-focus: rgba(67, 163, 56, .18);
  --crm-focus-ring: #398c31;
  --crm-login-cover-glow: rgba(67, 163, 56, .2);
  --crm-login-cover-a: #02182f;
  --crm-login-cover-b: #042145;
  --crm-login-sidebar-bg: #031b38;
  --crm-status-bg: #398c31;
  --bs-primary: #398c31;
  --bs-primary-rgb: 57, 140, 49;
  --bs-link-color: #164d82;
  --bs-link-hover-color: #042145;

  /* Larger, clearer type scale (Cairo reads small at the stock sizes). */
  --text-xs: 0.75rem;
  --text-sm: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.4375rem;
  --text-xxl: 1.875rem;

  --radius-md: 12px;
  --radius-lg: 16px;
}

body {
  font-size: var(--text-sm);
  background:
    radial-gradient(1100px circle at 100% -8%, rgba(67, 163, 56, .07), transparent 55%),
    radial-gradient(900px circle at -5% 100%, rgba(4, 33, 69, .05), transparent 50%),
    var(--crm-bg);
  background-attachment: fixed;
}

.crm-table tbody td,
.form-control,
.form-select,
.btn {
  font-size: var(--text-sm);
}

h1.crm-page-title { font-size: var(--text-xxl); font-weight: 800; letter-spacing: -.01em; }
h2.h5, .crm-section-head h2 { font-size: var(--text-lg); font-weight: 700; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; }
.crm-subtitle { font-weight: 500; }

/* Primary CTA button: a bit more presence across the whole app. */
.btn.crm-btn-primary,
.crm-btn-primary {
  background: linear-gradient(180deg, #47a93d 0%, var(--ama-green) 100%);
  border-color: var(--ama-accent-strong, #2d7227);
  box-shadow: 0 2px 6px rgba(57, 140, 49, .25);
  font-weight: 700;
}

.btn.crm-btn-primary:hover,
.crm-btn-primary:hover {
  background: linear-gradient(180deg, #4bb340 0%, #398c31 100%);
  box-shadow: 0 4px 12px rgba(57, 140, 49, .32);
}

/* Friendlier empty states: bigger icon slot, calmer copy. */
.crm-empty-state {
  text-align: center;
  padding: var(--space-8, 2rem) var(--space-4, 1rem);
  color: var(--crm-text-muted);
}

.crm-empty-state strong {
  display: block;
  margin-bottom: .35rem;
  color: var(--crm-text);
  font-size: var(--text-md);
}

body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
}

.crm-brand-mark {
  width: 68px !important;
  height: 68px !important;
  background: transparent url('../brand/ama-mark.png') center / contain no-repeat !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.crm-sidebar .crm-brand {
  min-height: 96px;
  height: auto;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  margin-bottom: 12px;
}

.crm-sidebar {
  padding-inline: 12px;
}

.crm-sidebar .crm-nav {
  flex: 1 1 auto;
}

.crm-sidebar::after {
  content: "\2728  AMA Practice";
  display: block;
  margin: auto 14px 18px;
  padding: 8px 12px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .55);
  text-align: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .09);
}

@media (min-width: 1200px) {
  .crm-sidebar-collapsed .crm-brand-mark {
    display: block !important;
    width: 40px !important;
    height: 40px !important;
  }
}

body.crm-login-page .crm-login-logo-ama {
  width: 112px;
  height: 112px;
  object-fit: contain;
  border-radius: 50%;
}

.crm-sidebar {
  background: linear-gradient(180deg, #06285a 0%, var(--ama-navy) 45%, #021126 100%);
  color: #fff;
  box-shadow: 2px 0 18px rgba(2, 12, 27, .12);
  position: relative;
  isolation: isolate;
}

.crm-sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(360px circle at 85% 0%, rgba(67, 163, 56, .1), transparent 60%);
}

.crm-sidebar .crm-brand,
.crm-sidebar .crm-nav-link,
.crm-sidebar .crm-sidebar-toggle {
  color: rgba(255, 255, 255, .88);
}

.crm-brand-mark {
  filter: drop-shadow(0 0 6px rgba(67, 163, 56, .25));
}

.crm-sidebar .crm-nav-link {
  border-radius: 10px;
  margin: 2px 10px;
  padding-inline: 14px;
  position: relative;
  transition: background-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.crm-sidebar .crm-nav-link:hover {
  background: rgba(255, 255, 255, .08);
  box-shadow: none;
  transform: translateX(-3px);
}

html[dir="rtl"] .crm-sidebar .crm-nav-link:hover {
  transform: translateX(3px);
}

.crm-sidebar .crm-nav-link:hover .crm-nav-icon {
  transform: scale(1.08);
}

.crm-sidebar .crm-nav-link.active {
  background: linear-gradient(135deg, #4bb340, var(--ama-green));
  color: #fff;
  box-shadow: 0 6px 18px rgba(67, 163, 56, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
  font-weight: 700;
}

.crm-sidebar .crm-nav-link.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, .8);
}

.crm-sidebar .crm-nav-link.crm-nav-sub {
  opacity: .82;
  font-size: .875rem;
  padding-inline-start: 30px;
}

.crm-nav-icon-sub {
  font-size: .8em;
  opacity: .85;
}

/* Office KPI cards: color-coded icon + top accent bar per signal type. */
.crm-dashboard-kpi.is-info .crm-dashboard-kpi-icon {
  background: #e5edf7;
  color: var(--crm-info);
}

[data-ama-dashboard] .crm-dashboard-kpi {
  overflow: hidden;
}

[data-ama-dashboard] .crm-dashboard-kpi::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--ama-green);
}

[data-ama-dashboard] .crm-dashboard-kpi.is-danger::before { background: #dc3545; }
[data-ama-dashboard] .crm-dashboard-kpi.is-warning::before { background: #d97706; }
[data-ama-dashboard] .crm-dashboard-kpi.is-success::before { background: var(--ama-green); }
[data-ama-dashboard] .crm-dashboard-kpi.is-info::before { background: var(--crm-info); }

[data-ama-dashboard] .crm-dashboard-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(16, 35, 63, .1);
  border-color: var(--crm-border-strong);
}

.crm-sidebar .crm-nav-link.crm-nav-sub.active {
  opacity: 1;
}

.crm-sidebar .crm-nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  color: inherit;
}

.crm-sidebar .crm-nav-link.active .crm-nav-icon {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.crm-sidebar .crm-nav-icon-sub {
  width: 24px;
  height: 24px;
  background: transparent;
}

.crm-sidebar .crm-nav-link {
  gap: 12px;
  padding-block: 10px;
}

.crm-sidebar-toggle {
  border-radius: 10px !important;
  background: rgba(255, 255, 255, .08) !important;
  border: none !important;
  color: #fff !important;
}

.crm-sidebar-toggle:hover {
  background: rgba(255, 255, 255, .16) !important;
}

/* Visual break before the settings/customize entry at the tail of the nav. */
.crm-nav [data-menu-customize-btn] {
  margin-top: 14px !important;
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding-top: 18px !important;
}

.crm-sidebar .crm-nav-link:hover,
.crm-sidebar .crm-nav-link.active {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  box-shadow: inset -3px 0 0 var(--ama-green);
}

html[dir="rtl"] body {
  text-align: right;
}

html[dir="rtl"] .crm-shell,
html[dir="rtl"] .crm-login-wrap {
  direction: rtl;
}

html[dir="rtl"] .crm-sidebar-toggle {
  margin-right: auto;
  margin-left: 0;
}

html[dir="rtl"] .dropdown-menu {
  text-align: right;
}

html[dir="rtl"] .form-check {
  padding-right: 1.5em;
  padding-left: 0;
}

html[dir="rtl"] .form-check .form-check-input {
  float: right;
  margin-right: -1.5em;
  margin-left: 0;
}

html[dir="rtl"] .modal-header .btn-close {
  margin: -.5rem auto -.5rem -.5rem;
}

html[dir="rtl"] .pagination,
html[dir="rtl"] .breadcrumb {
  direction: rtl;
}

html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[inputmode="numeric"],
html[dir="rtl"] .crm-ltr-value {
  direction: ltr;
  text-align: right;
  unicode-bidi: plaintext;
}

html[dir="rtl"] .crm-kanban-board {
  direction: rtl;
}

html[dir="rtl"] canvas,
html[dir="rtl"] svg {
  direction: ltr;
}

/*
 * Bootstrap 5.3's shipped bootstrap.min.css is the LTR build: its "start/end"
 * utilities compile to physical left/right, not logical properties, so they
 * do not flip under dir="rtl". Re-map the ones this project actually uses.
 */
html[dir="rtl"] .text-start { text-align: right !important; }
html[dir="rtl"] .text-end { text-align: left !important; }

html[dir="rtl"] .float-start { float: right !important; }
html[dir="rtl"] .float-end { float: left !important; }

html[dir="rtl"] .border-start { border-left: 0 !important; border-right: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; }
html[dir="rtl"] .border-end { border-right: 0 !important; border-left: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; }

html[dir="rtl"] .rounded-start { border-radius: 0 !important; border-top-right-radius: var(--bs-border-radius) !important; border-bottom-right-radius: var(--bs-border-radius) !important; }
html[dir="rtl"] .rounded-end { border-radius: 0 !important; border-top-left-radius: var(--bs-border-radius) !important; border-bottom-left-radius: var(--bs-border-radius) !important; }

html[dir="rtl"] .ms-0 { margin-right: 0 !important; margin-left: initial !important; }
html[dir="rtl"] .ms-1 { margin-right: .25rem !important; margin-left: initial !important; }
html[dir="rtl"] .ms-2 { margin-right: .5rem !important; margin-left: initial !important; }
html[dir="rtl"] .ms-3 { margin-right: 1rem !important; margin-left: initial !important; }
html[dir="rtl"] .ms-4 { margin-right: 1.5rem !important; margin-left: initial !important; }
html[dir="rtl"] .ms-5 { margin-right: 3rem !important; margin-left: initial !important; }
html[dir="rtl"] .ms-auto { margin-right: auto !important; margin-left: initial !important; }

html[dir="rtl"] .me-0 { margin-left: 0 !important; margin-right: initial !important; }
html[dir="rtl"] .me-1 { margin-left: .25rem !important; margin-right: initial !important; }
html[dir="rtl"] .me-2 { margin-left: .5rem !important; margin-right: initial !important; }
html[dir="rtl"] .me-3 { margin-left: 1rem !important; margin-right: initial !important; }
html[dir="rtl"] .me-4 { margin-left: 1.5rem !important; margin-right: initial !important; }
html[dir="rtl"] .me-5 { margin-left: 3rem !important; margin-right: initial !important; }
html[dir="rtl"] .me-auto { margin-left: auto !important; margin-right: initial !important; }

html[dir="rtl"] .ps-0 { padding-right: 0 !important; padding-left: initial !important; }
html[dir="rtl"] .ps-1 { padding-right: .25rem !important; padding-left: initial !important; }
html[dir="rtl"] .ps-2 { padding-right: .5rem !important; padding-left: initial !important; }
html[dir="rtl"] .ps-3 { padding-right: 1rem !important; padding-left: initial !important; }
html[dir="rtl"] .ps-4 { padding-right: 1.5rem !important; padding-left: initial !important; }
html[dir="rtl"] .ps-5 { padding-right: 3rem !important; padding-left: initial !important; }

html[dir="rtl"] .pe-0 { padding-left: 0 !important; padding-right: initial !important; }
html[dir="rtl"] .pe-1 { padding-left: .25rem !important; padding-right: initial !important; }
html[dir="rtl"] .pe-2 { padding-left: .5rem !important; padding-right: initial !important; }
html[dir="rtl"] .pe-3 { padding-left: 1rem !important; padding-right: initial !important; }
html[dir="rtl"] .pe-4 { padding-left: 1.5rem !important; padding-right: initial !important; }
html[dir="rtl"] .pe-5 { padding-left: 3rem !important; padding-right: initial !important; }

html[dir="rtl"] .dropdown-menu-end[data-bs-popper] {
  right: auto !important;
  left: 0 !important;
}

html[dir="rtl"] .breadcrumb-item + .breadcrumb-item {
  padding-left: 0 !important;
  padding-right: var(--bs-breadcrumb-item-padding-x, .5rem) !important;
}

html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
  float: right !important;
  padding-right: 0 !important;
  padding-left: var(--bs-breadcrumb-item-padding-x, .5rem) !important;
}

.table-responsive::after,
.crm-table-wrap::after {
  content: "مرّر أفقياً لعرض المزيد" !important;
}

/* Collapsible kanban-style filter bars (Tasks / Kanban / Projects) — see
   filters.js initCollapsibleFilterBars(). Hides every filter except search,
   the quick due-date buttons and the result summary until expanded. */
.crm-kanban-filters.is-collapsed > div:not(.crm-kanban-search):not(.crm-kanban-due-filters):not(.crm-kanban-filter-summary):not(.crm-filters-view-actions):not(.crm-kanban-tag-filter-area) {
  display: none !important;
}

.crm-filters-card.is-collapsed .crm-filters-extra-field {
  display: none !important;
}

.crm-filters-toggle {
  order: 1;
}

/* Filter/toolbar bars sit above whatever content follows them (KPI cards,
   tables, ...) so their searchable-select flyouts never get painted under
   later page content, even when that content creates its own stacking
   context (e.g. via a hover transform). */
.crm-toolbar-surface,
.crm-filters-card,
.crm-kanban-filters {
  position: relative;
  z-index: 40;
}

.crm-searchable-dropdown {
  z-index: 4000 !important;
}

/* ---------------------------------------------------------------------
   General visual polish: consistent elevation, accessible focus rings,
   smoother interactive states across cards, buttons, badges and tables.
   --------------------------------------------------------------------- */

.crm-card,
.card {
  border: 1px solid var(--crm-border-strong) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: 0 1px 2px rgba(16, 35, 63, .05), 0 6px 18px rgba(16, 35, 63, .06);
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}

/* Section cards that carry a form/action get a small brand-colored left
   accent (right in RTL) so they read as distinct "do something" panels
   next to plain list/table cards. */
.crm-card:has(> form),
form.crm-card {
  border-inline-start: 3px solid var(--ama-green) !important;
}

.crm-badge {
  letter-spacing: .01em;
}

.btn,
.crm-btn,
.form-control,
.form-select,
.crm-searchable-select input,
a.nav-link {
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.btn:active,
.crm-btn:active {
  transform: translateY(1px);
}

/* Accessible focus ring in the brand color, visible on every interactive
   element (not just links) for keyboard navigation. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.crm-btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ama-green);
  outline-offset: 2px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ama-green);
  box-shadow: 0 0 0 3px var(--crm-focus, rgba(67, 163, 56, .18));
}

/* Thin, unobtrusive themed scrollbars (WebKit + Firefox). */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--crm-border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--crm-border-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--crm-text-muted);
  background-clip: padding-box;
}

.crm-sidebar .nav-link {
  border-radius: 10px;
  margin: 2px 8px;
}

/* Clearer table shape sitewide: more breathing room per row, a firmer
   header edge and light zebra striping so rows are easy to scan. */
.crm-table thead th {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--crm-border-strong);
}

.crm-table tbody td {
  padding: 0.9rem 1rem;
}

.crm-table tbody tr:nth-child(even) td {
  background: var(--color-neutral-50, #f5f8f7);
}

.crm-table tbody tr:hover td {
  background: var(--color-neutral-100, #eef2f0);
}

/* Tables that sit inside a card should share its rounded corners instead of
   poking square edges out of a rounded box. */
.crm-card.p-0:has(.crm-table),
.crm-card.p-0.table-responsive {
  overflow: hidden;
}

.crm-table thead th {
  font-weight: 700;
  letter-spacing: .03em;
}

.crm-table tbody td {
  vertical-align: middle;
}

body {
  line-height: 1.65;
}

.crm-page-title,
h1, h2, h3, h4, h5, h6 {
  line-height: 1.35;
}

/* Client documents "folders" grid */
.crm-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.crm-folder-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--crm-border);
  border-radius: 12px;
  background: var(--crm-surface, #fff);
  text-align: right;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.crm-folder-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(16, 35, 63, .08);
  border-color: var(--crm-border-strong);
}

.crm-folder-icon {
  font-size: 1.6rem;
  color: var(--ama-green);
}

.crm-folder-name {
  font-weight: 700;
  color: var(--crm-text);
}

.crm-folder-meta {
  font-size: .8125rem;
  color: var(--crm-text-muted);
}

.crm-folder-warning {
  color: #b45309;
  font-weight: 600;
}

.crm-rich-editor {
  overflow-y: auto;
  line-height: 1.7;
}

.crm-rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--crm-text-soft);
}

.crm-rich-toolbar .btn.active,
.crm-rich-toolbar .btn:focus {
  background: var(--ama-green);
  color: #fff;
  border-color: var(--ama-green);
}

.crm-language-switch {
  direction: ltr;
  min-width: 2.75rem;
  font-weight: 700;
  color: var(--ama-navy, #042145);
}

/* Human resources workspace */
.crm-hr-page .crm-hr-kpi {
  display: flex;
  min-height: 132px;
  flex-direction: column;
  gap: .45rem;
  justify-content: center;
  border-top: 3px solid var(--ama-green, #16775b);
}

.crm-hr-kpi > i {
  color: var(--ama-green, #16775b);
  font-size: 1.2rem;
}

.crm-hr-kpi > span {
  color: var(--crm-text-muted);
  font-size: .78rem;
}

.crm-hr-kpi > strong {
  color: var(--ama-navy, #042145);
  font-size: 1.45rem;
  line-height: 1.1;
}

.crm-employee-profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.crm-clock-card {
  display: grid;
  place-items: center;
  text-align: center;
}

.crm-clock-state {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.crm-clock-state > i {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: .75rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(22, 119, 91, .1);
  color: var(--ama-green, #16775b);
  font-size: 1.55rem;
}

.crm-clock-state.is-out > i {
  background: rgba(148, 163, 184, .14);
  color: var(--crm-text-muted);
}

.crm-rank-badge {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--ama-navy, #042145);
  color: #fff;
  font-weight: 800;
}

.crm-task-incentive-card {
  border-inline-start: 3px solid #d7a529;
}

.crm-task-incentive-card [data-task-incentive-content] > .d-flex strong {
  color: var(--ama-navy, #042145);
  font-size: 1.2rem;
}

@media (max-width: 767.98px) {
  .crm-hr-page .crm-section-head,
  .crm-hr-page .crm-page-head {
    align-items: stretch;
  }

  .crm-hr-page .crm-section-head > .d-flex,
  .crm-hr-page .crm-page-actions {
    flex-wrap: wrap;
  }
}
