/* ==========================================================================
   Ghannam Corporate Field-Sales CMS — Official Brand Theme System
   Option A: Executive Emerald RTL Sidebar + Corporate Surface Tokens
   Compatible with CakePHP 2.6.7, Bootstrap 3 RTL, jQuery 1.11.0, Select2 3.4.6
   ========================================================================== */

:root {
  /* Primary Brand Emerald (Wordmark & Front G Shield) */
  --gh-emerald-900: #063F22;
  --gh-emerald-800: #09522D;
  --gh-emerald-700: #01763B;
  --gh-emerald-600: #03964B;
  --gh-emerald-50:  #ECF8F1;

  /* Corporate Sky Cerulean ("CORPORATE" Pill) */
  --gh-sky-500:     #5AB2E6;
  --gh-sky-600:     #2584C4;
  --gh-sky-50:      #EFF8FF;

  /* Warm Golden Amber (Emblem Shield 2) */
  --gh-amber-500:   #E8B068;
  --gh-amber-700:   #B7791F;
  --gh-amber-50:    #FEF7EC;

  /* Fresh Leaf Lime (Emblem Shield 4) */
  --gh-lime-500:    #A9D259;
  --gh-lime-700:    #5E8C1E;
  --gh-lime-50:     #F4FBEA;

  /* Neutrals & Surfaces */
  --gh-bg:          #F4F7F5;
  --gh-surface:     #FFFFFF;
  --gh-border:      #DCE6E0;
  --gh-text:        #10241B;
  --gh-muted:       #64748B;
  --gh-danger:      #C53030;
  --gh-danger-bg:   #FDEAEA;

  /* Font & Radius */
  --gh-font:        'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --gh-radius:      12px;
  --gh-radius-sm:   8px;
  --gh-shadow:      0 2px 10px rgba(6, 63, 34, 0.06);

  /* Layout Dimensions */
  --gh-sidebar-w:          265px;
  --gh-sidebar-collapsed:  72px;
  --gh-topbar-h:           64px;
}

/* --------------------------------------------------------------------------
   1. Base Typography & RTL Reset
   -------------------------------------------------------------------------- */
html {
  direction: rtl;
}

body.gh-app-body {
  direction: rtl;
  font-family: var(--gh-font) !important;
  background-color: var(--gh-bg) !important;
  color: var(--gh-text);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.gh-app-body h1,
body.gh-app-body h2,
body.gh-app-body h3,
body.gh-app-body h4,
body.gh-app-body h5,
body.gh-app-body h6,
body.gh-app-body button,
body.gh-app-body input,
body.gh-app-body select,
body.gh-app-body textarea,
body.gh-app-body table {
  font-family: var(--gh-font);
}

body.gh-app-body a {
  color: var(--gh-emerald-700);
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

body.gh-app-body a:hover {
  color: var(--gh-emerald-900);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   2. Option A Shell — Right-Side RTL Fixed / Collapsible Emerald Sidebar
   -------------------------------------------------------------------------- */
.gh-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--gh-sidebar-w);
  background: linear-gradient(180deg, #063F22 0%, #09522D 100%);
  color: #FFFFFF;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(6, 63, 34, 0.18);
  transition: width 0.24s cubic-bezier(0.4, 0, 0.2, 1), transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

/* Brand Header inside Sidebar */
.gh-sidebar-brand {
  height: var(--gh-topbar-h);
  min-height: var(--gh-topbar-h);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.12);
}

.gh-brand-link {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #FFFFFF !important;
  text-decoration: none !important;
  min-width: 0;
  flex: 1;
}

.gh-brand-emblem {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 10px;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gh-brand-emblem img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gh-brand-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.gh-brand-titles strong {
  font-size: 15px;
  font-weight: 800;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-brand-titles span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.7px;
  color: var(--gh-sky-500);
  text-transform: uppercase;
  white-space: nowrap;
}

.gh-rail-toggle {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.16s ease, color 0.16s ease;
}

.gh-rail-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
}

/* Quick Menu Search inside Sidebar */
.gh-sidebar-search {
  padding: 12px 12px 8px;
  position: relative;
}

.gh-sidebar-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.gh-sidebar-search-box .gh-search-icon {
  position: absolute;
  right: 11px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
  pointer-events: none;
}

.gh-sidebar-search-input {
  width: 100%;
  height: 36px;
  padding: 4px 32px 4px 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.09);
  color: #FFFFFF !important;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.gh-sidebar-search-input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.gh-sidebar-search-input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--gh-lime-500);
}

.gh-sidebar-search-clear {
  position: absolute;
  left: 8px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  display: none;
}

.gh-sidebar-search-clear:hover {
  color: #FFFFFF;
}

/* Sidebar Scrollable Navigation */
.gh-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 18px;
}

.gh-sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.gh-sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.gh-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gh-nav-item,
.gh-nav-group {
  margin-bottom: 4px;
}

/* Direct Link & Accordion Trigger */
.gh-nav-link,
.gh-nav-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.86) !important;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none !important;
  background: transparent;
  border: none;
  text-align: right;
  cursor: pointer;
  position: relative;
  transition: background 0.16s ease, color 0.16s ease;
}

.gh-nav-link:hover,
.gh-nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #FFFFFF !important;
}

.gh-nav-icon {
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--gh-lime-500);
  transition: color 0.16s ease;
}

.gh-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-nav-arrow {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.58);
  transition: transform 0.2s ease;
}

.gh-nav-group.is-open > .gh-nav-group-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF !important;
}

.gh-nav-group.is-open > .gh-nav-group-toggle .gh-nav-arrow {
  transform: rotate(-90deg);
  color: var(--gh-lime-500);
}

/* Submenu List */
.gh-nav-sub {
  list-style: none;
  margin: 3px 18px 6px 0;
  padding: 2px 10px 2px 0;
  border-right: 2px solid rgba(169, 210, 89, 0.28);
  display: none;
}

.gh-nav-group.is-open > .gh-nav-sub {
  display: block;
}

.gh-nav-sub li {
  margin-bottom: 2px;
}

.gh-nav-sub a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.78) !important;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.15s ease, color 0.15s ease;
}

.gh-nav-sub a i {
  font-size: 12px;
  width: 16px;
  text-align: center;
  opacity: 0.78;
}

.gh-nav-sub a:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #FFFFFF !important;
}

/* Active Route State */
.gh-nav-link.is-active,
.gh-nav-sub a.is-active {
  background: linear-gradient(90deg, rgba(3, 150, 75, 0.36) 0%, rgba(169, 210, 89, 0.24) 100%) !important;
  color: #FFFFFF !important;
  font-weight: 700;
  box-shadow: inset -3px 0 0 var(--gh-lime-500);
}

.gh-nav-link.is-active .gh-nav-icon,
.gh-nav-sub a.is-active i {
  color: #FFFFFF;
  opacity: 1;
}

.gh-nav-empty {
  display: none;
  padding: 16px 12px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.65);
}

/* Sidebar Footer */
.gh-sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.65);
}

/* Collapsed 72px Icon-Rail Mode (Desktop >= 992px) */
@media (min-width: 992px) {
  body.gh-sidebar-collapsed .gh-sidebar {
    width: var(--gh-sidebar-collapsed);
    overflow: visible;
  }

  body.gh-sidebar-collapsed .gh-sidebar-nav {
    overflow: visible;
    padding: 10px 8px;
  }

  body.gh-sidebar-collapsed .gh-brand-titles,
  body.gh-sidebar-collapsed .gh-sidebar-search,
  body.gh-sidebar-collapsed .gh-nav-label,
  body.gh-sidebar-collapsed .gh-nav-arrow,
  body.gh-sidebar-collapsed .gh-sidebar-footer span {
    display: none !important;
  }

  body.gh-sidebar-collapsed .gh-sidebar-brand {
    justify-content: center;
    padding: 0 6px;
  }

  body.gh-sidebar-collapsed .gh-brand-link {
    display: none;
  }

  body.gh-sidebar-collapsed .gh-nav-link,
  body.gh-sidebar-collapsed .gh-nav-group-toggle {
    justify-content: center;
    padding: 11px 0;
  }

  body.gh-sidebar-collapsed .gh-nav-group {
    position: relative;
  }

  /* Flyout submenu on hover when collapsed */
  body.gh-sidebar-collapsed .gh-nav-group > .gh-nav-sub {
    display: none !important;
    position: absolute;
    top: 0;
    right: 100%;
    margin: 0 6px 0 0;
    padding: 8px;
    width: 235px;
    background: var(--gh-emerald-900);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(6, 63, 34, 0.32);
    z-index: 1060;
  }

  body.gh-sidebar-collapsed .gh-nav-group:hover > .gh-nav-sub {
    display: block !important;
  }

  body.gh-sidebar-collapsed .gh-main-wrap {
    margin-right: var(--gh-sidebar-collapsed);
  }
}

/* --------------------------------------------------------------------------
   3. Sticky 64px White Topbar & Main Content Area
   -------------------------------------------------------------------------- */
.gh-main-wrap {
  margin-right: var(--gh-sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-right 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.gh-topbar {
  position: sticky;
  top: 0;
  height: var(--gh-topbar-h);
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--gh-border);
  box-shadow: 0 1px 6px rgba(6, 63, 34, 0.04);
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 1030;
}

.gh-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.gh-mobile-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--gh-border);
  background: var(--gh-surface);
  color: var(--gh-emerald-800);
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
}

.gh-topbar-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none !important;
}

.gh-topbar-logo img {
  height: 38px;
  width: auto;
  max-width: 155px;
  object-fit: contain;
}

.gh-topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--gh-border);
}

.gh-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--gh-muted);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-breadcrumb a {
  color: var(--gh-muted);
  font-weight: 600;
}

.gh-breadcrumb a:hover {
  color: var(--gh-emerald-700);
}

.gh-breadcrumb .gh-bc-sep {
  color: #CBD5E1;
  font-size: 11px;
}

.gh-breadcrumb .gh-bc-current {
  color: var(--gh-text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.gh-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--gh-sky-50);
  color: var(--gh-sky-600);
  border: 1px solid rgba(37, 132, 196, 0.22);
  font-size: 12px;
  font-weight: 700;
  direction: ltr;
}

.gh-role-badge i {
  color: var(--gh-emerald-700);
}

/* Topbar User Dropdown */
.gh-user-menu {
  position: relative;
}

.gh-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--gh-border);
  background: var(--gh-surface);
  color: var(--gh-text) !important;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none !important;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.gh-user-btn:hover,
.gh-user-menu.open .gh-user-btn {
  border-color: var(--gh-emerald-600);
  box-shadow: 0 2px 8px rgba(1, 118, 59, 0.10);
}

.gh-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gh-emerald-800), var(--gh-emerald-600));
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.gh-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  min-width: 210px;
  background: var(--gh-surface);
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: 0 12px 30px rgba(6, 63, 34, 0.14);
  padding: 6px;
  list-style: none;
  margin: 0;
  display: none;
  z-index: 1050;
  text-align: right;
}

.gh-user-menu.open .gh-user-dropdown {
  display: block;
}

.gh-user-dropdown-head {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gh-border);
  margin-bottom: 4px;
}

.gh-user-dropdown-head strong {
  display: block;
  font-size: 13px;
  color: var(--gh-text);
}

.gh-user-dropdown-head small {
  color: var(--gh-muted);
  font-size: 11.5px;
}

.gh-user-dropdown li a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--gh-text) !important;
  font-size: 13px;
  font-weight: 600;
}

.gh-user-dropdown li a:hover {
  background: var(--gh-emerald-50);
  color: var(--gh-emerald-800) !important;
}

.gh-user-dropdown li a.gh-logout-link {
  color: var(--gh-danger) !important;
}

.gh-user-dropdown li a.gh-logout-link:hover {
  background: var(--gh-danger-bg);
}

/* Main Page Body */
.gh-content {
  flex: 1;
  padding: 20px 22px 32px;
  max-width: 100%;
}

/* Mobile Slide-Over RTL Drawer (< 992px) */
.gh-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 35, 19, 0.52);
  z-index: 1035;
}

@media (max-width: 991px) {
  .gh-sidebar {
    transform: translateX(100%);
    width: 280px;
  }

  body.gh-mobile-nav-open .gh-sidebar {
    transform: translateX(0);
  }

  body.gh-mobile-nav-open .gh-sidebar-backdrop {
    display: block;
  }

  .gh-rail-toggle {
    display: none;
  }

  .gh-main-wrap {
    margin-right: 0 !important;
  }

  .gh-mobile-toggle {
    display: inline-flex;
  }

  .gh-topbar {
    padding: 0 14px;
  }

  .gh-topbar-divider,
  .gh-role-badge {
    display: none;
  }

  .gh-content {
    padding: 14px 12px 24px;
  }
}

/* --------------------------------------------------------------------------
   4. Cards, Filter Bars, Form Grids & Page Headers
   -------------------------------------------------------------------------- */
.gh-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.gh-page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--gh-emerald-900);
}

.gh-page-title i {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gh-emerald-50);
  color: var(--gh-emerald-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.gh-page-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--gh-muted);
}

.gh-card {
  background: var(--gh-surface);
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: var(--gh-shadow);
  margin-bottom: 18px;
  overflow: visible;
}

.gh-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gh-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFCFB 100%);
  border-radius: var(--gh-radius) var(--gh-radius) 0 0;
  border-top: 3px solid var(--gh-emerald-700);
}

.gh-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--gh-emerald-900);
  display: flex;
  align-items: center;
  gap: 9px;
}

.gh-card-title i {
  color: var(--gh-emerald-700);
  font-size: 16px;
}

.gh-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.gh-card-body {
  padding: 18px 20px;
}

.gh-card-footer {
  padding: 12px 20px;
  background: #F8FAF9;
  border-top: 1px solid var(--gh-border);
  border-radius: 0 0 var(--gh-radius) var(--gh-radius);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Report Filter Bar */
.gh-filter-bar {
  background: #F8FBF9;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius-sm);
  padding: 16px;
  margin-bottom: 18px;
}

.gh-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 14px 16px;
  align-items: end;
}

.gh-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.gh-field label,
.gh-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gh-emerald-900);
  margin: 0;
}

.gh-field-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Responsive Form Grid for CRUD Screens */
.gh-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.gh-form-grid .gh-col-span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 767px) {
  .gh-form-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   5. Buttons, Inputs & Select2 v3.4.6 Corporate Skin
   -------------------------------------------------------------------------- */
.gh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--gh-radius-sm);
  font-family: var(--gh-font);
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.08s ease;
}

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

.gh-btn-primary {
  background: var(--gh-emerald-700) !important;
  border-color: var(--gh-emerald-700) !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 6px rgba(1, 118, 59, 0.18);
}

.gh-btn-primary:hover,
.gh-btn-primary:focus {
  background: var(--gh-emerald-800) !important;
  border-color: var(--gh-emerald-800) !important;
  color: #FFFFFF !important;
}

.gh-btn-sky {
  background: var(--gh-sky-600) !important;
  border-color: var(--gh-sky-600) !important;
  color: #FFFFFF !important;
}

.gh-btn-sky:hover,
.gh-btn-sky:focus {
  background: #1D6FA8 !important;
  color: #FFFFFF !important;
}

.gh-btn-amber {
  background: var(--gh-amber-700) !important;
  border-color: var(--gh-amber-700) !important;
  color: #FFFFFF !important;
}

.gh-btn-outline {
  background: var(--gh-surface) !important;
  border-color: var(--gh-border) !important;
  color: var(--gh-text) !important;
}

.gh-btn-outline:hover,
.gh-btn-outline:focus {
  background: var(--gh-emerald-50) !important;
  border-color: var(--gh-emerald-600) !important;
  color: var(--gh-emerald-800) !important;
}

.gh-btn-danger {
  background: var(--gh-danger-bg) !important;
  border-color: rgba(197, 48, 48, 0.28) !important;
  color: var(--gh-danger) !important;
}

.gh-btn-danger:hover {
  background: var(--gh-danger) !important;
  color: #FFFFFF !important;
}

.gh-btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
}

.gh-btn-xs {
  height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
  border-radius: 6px;
}

/* Inputs & Selects */
body.gh-app-body .form-control,
body.gh-app-body input[type="text"]:not(.gh-sidebar-search-input),
body.gh-app-body input[type="number"],
body.gh-app-body input[type="email"],
body.gh-app-body input[type="password"],
body.gh-app-body input[type="date"],
body.gh-app-body select.form-control,
body.gh-app-body textarea.form-control {
  height: 38px;
  border-radius: var(--gh-radius-sm) !important;
  border: 1px solid var(--gh-border) !important;
  background-color: #FFFFFF;
  color: var(--gh-text);
  font-size: 13.5px;
  padding: 6px 11px;
  box-shadow: none !important;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

body.gh-app-body textarea.form-control {
  height: auto;
  min-height: 80px;
}

body.gh-app-body select[multiple].form-control {
  height: auto;
  min-height: 110px;
}

body.gh-app-body .form-control:focus,
body.gh-app-body input[type="text"]:not(.gh-sidebar-search-input):focus,
body.gh-app-body input[type="number"]:focus,
body.gh-app-body input[type="password"]:focus {
  border-color: var(--gh-emerald-600) !important;
  box-shadow: 0 0 0 3px rgba(3, 150, 75, 0.12) !important;
  outline: none;
}

/* Remove CakePHP Form->input extra wrapper margin inside gh-field */
.gh-field div.input {
  margin: 0;
  width: 100%;
}

/* Select2 v3.4.6 Corporate Emerald Skin */
body.gh-app-body .select2-container {
  width: 100% !important;
}

body.gh-app-body .select2-container .select2-choice {
  height: 38px !important;
  line-height: 36px !important;
  border-radius: var(--gh-radius-sm) !important;
  border: 1px solid var(--gh-border) !important;
  background: #FFFFFF !important;
  color: var(--gh-text) !important;
  padding: 0 11px 0 28px !important;
  box-shadow: none !important;
}

body.gh-app-body .select2-container.select2-dropdown-open .select2-choice,
body.gh-app-body .select2-container-active .select2-choice {
  border-color: var(--gh-emerald-600) !important;
  box-shadow: 0 0 0 3px rgba(3, 150, 75, 0.12) !important;
}

.select2-drop-active {
  border: 1px solid var(--gh-emerald-600) !important;
  border-radius: 0 0 var(--gh-radius-sm) var(--gh-radius-sm) !important;
  box-shadow: 0 8px 22px rgba(6, 63, 34, 0.14) !important;
}

.select2-results .select2-highlighted {
  background: var(--gh-emerald-700) !important;
  color: #FFFFFF !important;
}

/* --------------------------------------------------------------------------
   Form controls inside filter bars / forms: neutralize legacy Metronic fixed widths
   (.input-large = 320px !important overflowed grid cells and made Select2 jump)
   -------------------------------------------------------------------------- */
body.gh-app-body .gh-field .input-large,
body.gh-app-body .gh-field .input-medium,
body.gh-app-body .gh-field .input-xlarge,
body.gh-app-body .gh-field .input-small,
body.gh-app-body .gh-card .input-large,
body.gh-app-body .gh-card .input-medium,
body.gh-app-body .gh-card .input-xlarge {
  width: 100% !important;
  max-width: 100% !important;
}

body.gh-app-body .gh-field .form-control,
body.gh-app-body .gh-form-grid .form-control {
  height: 38px;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius-sm);
  box-shadow: none;
  font-family: var(--gh-font);
  font-size: 13.5px;
  color: var(--gh-text);
}
body.gh-app-body .gh-field .form-control:focus,
body.gh-app-body .gh-form-grid .form-control:focus {
  border-color: var(--gh-emerald-600);
  box-shadow: 0 0 0 3px rgba(3, 150, 75, 0.12);
}

/* Date range group: input | addon | input with matching radius */
body.gh-app-body .gh-field .input-daterange {
  display: flex !important;
  width: 100% !important;
}
body.gh-app-body .gh-field .input-daterange .form-control {
  flex: 1 1 0;
  min-width: 0;
  /* a 205px grid cell leaves ~83px per input: keep "04/29/2026" fully visible */
  padding-left: 4px !important;
  padding-right: 4px !important;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
  background: #FFFFFF;
}
body.gh-app-body .gh-field .input-daterange .input-group-addon {
  display: flex;
  align-items: center;
  width: auto;
  padding: 0 10px;
  background: var(--gh-emerald-50);
  color: var(--gh-emerald-800);
  border: 1px solid var(--gh-border);
  border-left: 0;
  border-right: 0;
  font-weight: 700;
  font-size: 12.5px;
}
body.gh-app-body .gh-field .input-daterange .form-control:first-child {
  border-radius: 0 var(--gh-radius-sm) var(--gh-radius-sm) 0;
}
body.gh-app-body .gh-field .input-daterange .form-control:last-child {
  border-radius: var(--gh-radius-sm) 0 0 var(--gh-radius-sm);
}

/* Select2 3.4.6: fixed full width, never grows with the chosen text */
body.gh-app-body .select2-container,
body.gh-app-body .form-control.select2-container {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}
body.gh-app-body .select2-container .select2-choice {
  display: flex !important;
  align-items: center;
  overflow: hidden;
  font-family: var(--gh-font);
  font-size: 13.5px;
  font-weight: 600;
}
body.gh-app-body .select2-container .select2-choice .select2-chosen {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: right;
}
body.gh-app-body .select2-container .select2-choice > .select2-chosen + .select2-search-choice-close,
body.gh-app-body .select2-container .select2-choice abbr {
  top: 50% !important;
  margin-top: -6px;
}
body.gh-app-body .select2-container .select2-choice .select2-arrow {
  width: 26px !important;
  border: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
}
body.gh-app-body .select2-container .select2-choice .select2-arrow b {
  background-position: 0 6px !important;
}
body.gh-app-body .select2-container.select2-container-disabled .select2-choice {
  background: #F1F5F3 !important;
  color: var(--gh-muted) !important;
  cursor: not-allowed;
}
/* Legacy plugins-rtl.css forced 120px on drop-above lists */
body.gh-app-body .select2-drop.select2-drop-above.select2-drop-active {
  width: auto !important;
  min-width: 220px;
}
/* Must stay above Select2's own #select2-drop-mask (z-index 9998), otherwise the
   mask swallows mouse clicks and options can only be chosen by keyboard. */
body.gh-app-body .select2-drop {
  z-index: 10000 !important;
  font-family: var(--gh-font);
  font-size: 13.5px;
  border-radius: 0 0 var(--gh-radius-sm) var(--gh-radius-sm) !important;
}
body.gh-app-body .select2-drop .select2-search input {
  height: 34px !important;
  border: 1px solid var(--gh-border) !important;
  border-radius: 6px !important;
  font-family: var(--gh-font);
}
body.gh-app-body .select2-results li {
  padding: 2px 4px;
}

/* Inline client-side validation messages */
.gh-field-error {
  display: block;
  margin-top: 4px;
  color: var(--gh-danger);
  font-size: 12px;
  font-weight: 700;
}
body.gh-app-body .gh-field.has-gh-error .form-control,
body.gh-app-body .gh-field.has-gh-error .select2-choice {
  border-color: var(--gh-danger) !important;
  background: #FFFBFB !important;
}

/* Page header actions (e.g. "إضافة") */
.gh-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.gh-page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.gh-form-grid .gh-field-full {
  grid-column: 1 / -1;
}
@media (max-width: 767px) {
  .gh-form-grid { grid-template-columns: minmax(0, 1fr); }
}
/* --------------------------------------------------------------------------
   Maps screens: the map fills a positioned shell, control panels float inside
   it (physical left so they never sit under the RTL sidebar or Google's
   fullscreen/zoom controls on the right)
   -------------------------------------------------------------------------- */
.gh-map-shell {
  position: relative;
  /* viewport - topbar(64) - content padding - page head */
  height: calc(100vh - 190px);
  min-height: 460px;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius);
  box-shadow: var(--gh-shadow);
  overflow: hidden;
  background: #E8EFEA;
}
.gh-map-shell > #googlemaps {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 0;
}
.gh-map-panel {
  position: absolute;
  z-index: 5;
  top: 12px;
  left: 12px;
  width: 320px;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 24px);
  overflow: auto;
  direction: rtl;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--gh-border);
  border-top: 4px solid var(--gh-emerald-700);
  border-radius: var(--gh-radius);
  box-shadow: 0 12px 30px rgba(6, 63, 34, 0.22);
  padding: 14px;
  color: var(--gh-text);
}
.gh-map-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--gh-emerald-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.gh-map-panel .gh-field { margin-bottom: 10px; }
.gh-map-panel .gh-btn { width: 100%; justify-content: center; }
.gh-map-readout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 8px 0 12px;
  padding: 8px 10px;
  background: var(--gh-emerald-50);
  border-radius: var(--gh-radius-sm);
  font-size: 12px;
}
.gh-map-readout dt { font-weight: 800; color: var(--gh-emerald-900); }
.gh-map-readout dd { margin: 0; direction: ltr; text-align: right; word-break: break-word; }
.gh-map-msg {
  display: none;
  margin-top: 8px;
  color: var(--gh-danger);
  font-size: 12px;
  font-weight: 700;
}
.gh-map-msg.is-on { display: block; }
.gh-map-stat {
  position: absolute;
  z-index: 5;
  left: 12px;
  bottom: 24px;
  direction: rtl;
  background: var(--gh-emerald-900);
  color: #FFFFFF;
  border-radius: var(--gh-radius);
  box-shadow: 0 10px 26px rgba(6, 63, 34, 0.35);
  padding: 10px 16px;
  font-weight: 800;
}
.gh-map-stat strong { font-size: 20px; color: #C9F27B; }
.gh-map-stat small { display: block; font-size: 10.5px; font-weight: 600; opacity: 0.8; }
@media (max-width: 767px) {
  .gh-map-shell { height: calc(100vh - 64px - 32px); }
  .gh-map-panel { width: auto; right: 12px; }
}

/* CakePHP 'type' => 'date' renders 3 selects (day/month/year): keep them on one row */
.gh-date-triple {
  display: flex;
  gap: 8px;
  direction: ltr;
}
.gh-date-triple select.form-control {
  flex: 1 1 0;
  min-width: 0;
}
.gh-required {
  color: var(--gh-danger);
  font-weight: 800;
  margin-inline-start: 2px;
}
.gh-field-hint {
  display: block;
  margin-top: 4px;
  color: var(--gh-muted);
  font-size: 12px;
}
body.gh-app-body .gh-field input[readonly].form-control {
  background: #F4F7F5;
  color: var(--gh-emerald-900);
  font-weight: 700;
}
.gh-readonly-value {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  background: #F4F7F5;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius-sm);
  font-weight: 700;
  color: var(--gh-emerald-900);
}

/* Plain (non-DataTables) form table: all rows stay in the DOM so they are submitted */
table.gh-plain-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.gh-plain-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--gh-emerald-800);
  color: #FFFFFF;
  font-weight: 700;
  padding: 10px 12px;
  text-align: center;
}
table.gh-plain-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid #EEF3F0;
  vertical-align: middle;
}
table.gh-plain-table tbody tr:hover td { background: var(--gh-emerald-50); }
table.gh-plain-table tbody tr.is-checked td { background: #F3FBF6; }
table.gh-plain-table .form-control { height: 34px; max-width: 120px; margin: 0 auto; text-align: center; }

/* Customer checklist (plans / territory assignment) */
.gh-checklist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.gh-checklist {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--gh-border);
  border-radius: var(--gh-radius-sm);
  background: #FFFFFF;
}
.gh-checklist:empty::before {
  content: attr(data-empty);
  display: block;
  padding: 22px 14px;
  text-align: center;
  color: var(--gh-muted);
  font-size: 13px;
}
.gh-checklist label.gh-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #EEF3F0;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.gh-checklist label.gh-check-item:hover { background: var(--gh-emerald-50); }
.gh-checklist label.gh-check-item input { margin: 0; flex: 0 0 auto; }
/* Grouped checklist (e.g. products by company) */
.gh-checklist .gh-check-group {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--gh-emerald-50);
  border-bottom: 1px solid var(--gh-border);
  color: var(--gh-emerald-900);
  font-weight: 800;
  font-size: 13px;
}
.gh-checklist .gh-check-group label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.gh-check-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--gh-emerald-800);
}
.gh-spinner-inline {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--gh-muted);
  font-size: 12.5px;
}
.gh-spinner-inline.is-on { display: inline-flex; }

/* Bootstrap Datepicker: float above sidebar/topbar, branded card look */
.datepicker.dropdown-menu {
  z-index: 1080 !important;
  padding: 8px !important;
  min-width: 250px;
  background: var(--gh-surface) !important;
  border: 1px solid var(--gh-border) !important;
  border-radius: var(--gh-radius-sm) !important;
  box-shadow: 0 10px 28px rgba(6, 63, 34, 0.16) !important;
  font-family: var(--gh-font) !important;
}
.datepicker table { width: 100%; }
.datepicker table tr td,
.datepicker table tr th {
  width: 34px !important;
  height: 32px !important;
  border-radius: 6px !important;
  font-size: 13px;
  text-align: center;
}
.datepicker thead tr:first-child th.datepicker-switch {
  color: var(--gh-emerald-800);
  font-weight: 800;
}
.datepicker thead tr:first-child th:hover,
.datepicker table tr td.day:hover,
.datepicker table tr td span:hover {
  background: var(--gh-emerald-50) !important;
  color: var(--gh-emerald-800) !important;
}
.datepicker thead th.dow {
  color: var(--gh-muted);
  font-weight: 700;
  font-size: 12px;
}
.datepicker table tr td.old,
.datepicker table tr td.new { color: #B8C4BD !important; }
.datepicker table tr td.today,
.datepicker table tr td.today:hover {
  background: var(--gh-amber-50) !important;
  color: var(--gh-amber-700) !important;
  font-weight: 800;
}
.datepicker table tr td span.active,
.datepicker table tr td span.active:hover {
  background: var(--gh-emerald-700) !important;
  border-color: var(--gh-emerald-700) !important;
  color: #FFFFFF !important;
}

/* Bootstrap Datepicker Header Override */
.datepicker table tr td.active,
.datepicker table tr td.active:hover,
.datepicker table tr td.active.disabled {
  background: var(--gh-emerald-700) !important;
  border-color: var(--gh-emerald-700) !important;
}

/* --------------------------------------------------------------------------
   6. Badges & Visit.kind (1..4) Activity Blocks (For Master-Detail Reports)
   -------------------------------------------------------------------------- */
.gh-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.gh-badge-emerald,
.gh-kind-1 {
  background: var(--gh-emerald-50);
  color: var(--gh-emerald-700);
  border: 1px solid rgba(1, 118, 59, 0.22);
}

.gh-badge-sky,
.gh-kind-2 {
  background: var(--gh-sky-50);
  color: var(--gh-sky-600);
  border: 1px solid rgba(37, 132, 196, 0.22);
}

.gh-badge-amber,
.gh-kind-3 {
  background: var(--gh-amber-50);
  color: var(--gh-amber-700);
  border: 1px solid rgba(183, 121, 31, 0.24);
}

.gh-badge-lime,
.gh-kind-4 {
  background: var(--gh-lime-50);
  color: var(--gh-lime-700);
  border: 1px solid rgba(94, 140, 30, 0.24);
}

.gh-badge-muted {
  background: #F1F5F9;
  color: var(--gh-muted);
  border: 1px solid #E2E8F0;
}

.gh-badge-danger {
  background: var(--gh-danger-bg);
  color: var(--gh-danger);
  border: 1px solid rgba(197, 48, 48, 0.22);
}

/* Semantic Multi-Line Visit Activity Blocks (Replaces Nested .TGtable) */
.gh-activity-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.gh-activity-block {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  line-height: 1.5;
  border-right: 3px solid var(--gh-emerald-600);
  background: var(--gh-emerald-50);
  color: var(--gh-text);
}

.gh-activity-block.kind-1 {
  border-right-color: var(--gh-emerald-600);
  background: var(--gh-emerald-50);
}

.gh-activity-block.kind-2 {
  border-right-color: var(--gh-sky-600);
  background: var(--gh-sky-50);
}

.gh-activity-block.kind-3 {
  border-right-color: var(--gh-amber-700);
  background: var(--gh-amber-50);
}

.gh-activity-block.kind-4 {
  border-right-color: var(--gh-lime-700);
  background: var(--gh-lime-50);
}

.gh-activity-head {
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 2px;
  display: inline-block;
}

.gh-activity-block.kind-1 .gh-activity-head { color: var(--gh-emerald-700); }
.gh-activity-block.kind-2 .gh-activity-head { color: var(--gh-sky-600); }
.gh-activity-block.kind-3 .gh-activity-head { color: var(--gh-amber-700); }
.gh-activity-block.kind-4 .gh-activity-head { color: var(--gh-lime-700); }

.gh-activity-line {
  display: block;
  padding: 1px 0;
  font-weight: 600;
}

.gh-activity-comment {
  display: block;
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px dashed rgba(16, 36, 27, 0.12);
  color: #334155;
  font-size: 12px;
}

/* Summary Stat Strip above Report Tables */
.gh-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.gh-stat-pill {
  flex: 1 1 170px;
  background: var(--gh-surface);
  border: 1px solid var(--gh-border);
  border-right: 4px solid var(--gh-emerald-700);
  border-radius: var(--gh-radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gh-stat-pill.sky   { border-right-color: var(--gh-sky-600); }

/* English (LTR) report pages: <div class="gh-ltr-page" dir="ltr"> around the page body */
.gh-ltr-page { direction: ltr; text-align: left; }
.gh-ltr-page .gh-stat-pill {
  border-right-width: 1px;
  border-left: 4px solid var(--gh-emerald-700);
}
.gh-ltr-page .gh-stat-pill.sky   { border-right-color: var(--gh-border); border-left-color: var(--gh-sky-600); }
.gh-ltr-page .gh-stat-pill.amber { border-right-color: var(--gh-border); border-left-color: var(--gh-amber-700); }
.gh-ltr-page .gh-stat-pill.lime  { border-right-color: var(--gh-border); border-left-color: var(--gh-lime-700); }
.gh-stat-pill.amber { border-right-color: var(--gh-amber-700); }
.gh-stat-pill.lime  { border-right-color: var(--gh-lime-700); }

.gh-stat-pill small {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gh-muted);
}

.gh-stat-pill strong {
  font-size: 18px;
  font-weight: 800;
  color: var(--gh-text);
}

/* --------------------------------------------------------------------------
   7. Flash Messages & Legacy Metronic Red/Purple Neutralization
   -------------------------------------------------------------------------- */
#flashMessage,
.success-message,
.error-message {
  border-radius: var(--gh-radius-sm) !important;
  padding: 12px 16px !important;
  margin-bottom: 16px !important;
  font-weight: 700;
  font-size: 13.5px;
  background-image: none !important;
  box-shadow: var(--gh-shadow) !important;
  border-width: 1px !important;
  border-right-width: 4px !important;
}

.success-message {
  background-color: var(--gh-emerald-50) !important;
  border-color: rgba(1, 118, 59, 0.25) !important;
  border-right-color: var(--gh-emerald-700) !important;
  color: var(--gh-emerald-900) !important;
}

.error-message {
  background-color: var(--gh-danger-bg) !important;
  border-color: rgba(197, 48, 48, 0.25) !important;
  border-right-color: var(--gh-danger) !important;
  color: var(--gh-danger) !important;
}

/* Neutralize any residual Metronic red/purple/steel-blue portlets or buttons */
body.gh-app-body .portlet.box.red,
body.gh-app-body .portlet.box.blue,
body.gh-app-body .portlet.box.green,
body.gh-app-body .portlet.box.purple {
  border: 1px solid var(--gh-border) !important;
  border-radius: var(--gh-radius) !important;
  box-shadow: var(--gh-shadow) !important;
  background: var(--gh-surface) !important;
  overflow: hidden;
}

body.gh-app-body .portlet.box.red > .portlet-title,
body.gh-app-body .portlet.box.blue > .portlet-title,
body.gh-app-body .portlet.box.purple > .portlet-title {
  background: linear-gradient(90deg, var(--gh-emerald-800), var(--gh-emerald-900)) !important;
  border-bottom: 1px solid var(--gh-border) !important;
  padding: 12px 18px !important;
}

body.gh-app-body .btn.red,
body.gh-app-body .btn-primary,
body.gh-app-body .btn.green {
  background-color: var(--gh-emerald-700) !important;
  border-color: var(--gh-emerald-700) !important;
  color: #FFFFFF !important;
  border-radius: var(--gh-radius-sm) !important;
  font-weight: 700;
}

body.gh-app-body .btn.red:hover,
body.gh-app-body .btn-primary:hover {
  background-color: var(--gh-emerald-800) !important;
  border-color: var(--gh-emerald-800) !important;
}

body.gh-app-body .TFtable {
  width: 100%;
  border-collapse: collapse;
}

body.gh-app-body .TFtable th {
  background: var(--gh-emerald-900) !important;
  color: #FFFFFF !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  padding: 10px 12px !important;
}

body.gh-app-body .TFtable td {
  border: 1px solid var(--gh-border) !important;
  padding: 9px 12px !important;
}

body.gh-app-body .TFtable tr:nth-child(odd) {
  background: #FFFFFF;
}

body.gh-app-body .TFtable tr:nth-child(even) {
  background: #F8FBF9;
}

/* Print Helper */
@media print {
  .gh-sidebar,
  .gh-topbar,
  .gh-sidebar-backdrop,
  .gh-filter-bar,
  .avoid-this,
  .avoid-print,
  .no-print {
    display: none !important;
  }

  .gh-main-wrap {
    margin: 0 !important;
  }

  .gh-content {
    padding: 0 !important;
  }

  .gh-card {
    border: none !important;
    box-shadow: none !important;
  }
}

/* --------------------------------------------------------------------------
   Rep distance: day timeline + route map pop-up (js/gh-rep-distance.js)
   -------------------------------------------------------------------------- */
.gh-route-modal { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; background: rgba(6, 35, 19, 0.55); padding: 16px; }
.gh-route-modal.is-open { display: flex; }
.gh-route-dialog { width: min(1280px, 100%); height: min(800px, 100%); background: #FFFFFF; border-radius: var(--gh-radius); box-shadow: 0 24px 60px rgba(6, 63, 34, 0.35); display: flex; flex-direction: column; overflow: hidden; }
.gh-route-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--gh-border); }
.gh-route-head strong { display: block; font-size: 15px; color: var(--gh-emerald-900); }
.gh-route-head small { color: var(--gh-muted); font-weight: 700; }
.gh-route-body { flex: 1 1 auto; display: flex; min-height: 0; }
.gh-route-timeline { flex: 0 0 440px; max-width: 48%; overflow: auto; border-inline-end: 1px solid var(--gh-border); }
.gh-route-timeline td { font-size: 12.5px; vertical-align: top; }
.gh-route-timeline tr.gh-stop { cursor: pointer; }
.gh-route-timeline tr.gh-stop:hover td { background: var(--gh-emerald-50); }
.gh-route-timeline tr.gh-stop-off td { color: var(--gh-muted); }
.gh-route-timeline .gh-badge { font-size: 10.5px; padding: 1px 6px; margin-top: 3px; }
#ghRouteMap { flex: 1 1 auto; min-height: 300px; }
.gh-route-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 16px; font-size: 12px; font-weight: 700; border-top: 1px solid var(--gh-border); }
.gh-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50% !important; vertical-align: middle; margin-inline-end: 4px; }
/* legacy Metronic CSS forces border-radius 0 */
.gh-route-pin { width: 26px; height: 26px; border-radius: 50% !important; color: #FFFFFF; font: 800 12px/22px Tahoma, Arial, sans-serif; text-align: center; border: 2px solid #FFFFFF; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.gh-stop-num { display: inline-block; min-width: 22px; height: 22px; border-radius: 50% !important; color: #FFFFFF; font-weight: 800; font-size: 11px; line-height: 22px; text-align: center; }
@media (max-width: 900px) {
  .gh-route-body { flex-direction: column-reverse; }
  .gh-route-timeline { flex: 0 0 40%; max-width: none; border-inline-end: 0; border-top: 1px solid var(--gh-border); }
}

/* Risk score bar (reports/visits_fraud) */
.gh-risk { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.gh-risk-bar { flex: 1 1 auto; height: 8px; border-radius: 4px !important; background: #EEF3F0; overflow: hidden; }
.gh-risk-bar > i { display: block; height: 100%; border-radius: 4px !important; }
.gh-risk-reasons { margin: 0; padding-inline-start: 16px; font-size: 12.5px; }
.gh-risk-reasons li { margin: 2px 0; }

/* Route pop-up: rep's days list (accordion) + suspicious-visit highlight */
.gh-route-timeline .gh-stops-table { width: 100%; }
.gh-route-timeline tr.gh-stop.is-focus td { background: #FEF9C3; }
.gh-route-timeline tr.gh-stop-flagged td { background: #FEF2F2; }
.gh-stop-flag { margin-top: 5px; padding: 4px 8px; border-inline-start: 3px solid #dc2626; background: #FFFFFF; border-radius: 6px; }
.gh-stop-flag .gh-risk-reasons { font-size: 11.5px; margin-top: 3px; }
.gh-dot-flag { background: #FFFFFF; box-shadow: 0 0 0 3px #dc2626 inset; }
.gh-day { border-bottom: 1px solid var(--gh-border); }
.gh-day-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.gh-day-head:hover { background: var(--gh-emerald-50); }
.gh-day.is-active > .gh-day-head { background: var(--gh-emerald-50); box-shadow: inset -4px 0 0 var(--gh-emerald-700, #047857); }
.gh-day-caret { color: var(--gh-muted); transition: transform .15s; font-size: 11px; }
.gh-day.is-active .gh-day-caret { transform: rotate(-90deg); color: var(--gh-emerald-800); }
.gh-day-main { flex: 1 1 auto; min-width: 0; }
.gh-day-main strong { color: var(--gh-emerald-900); }
.gh-day-main small, .gh-day-meta { color: var(--gh-muted); font-size: 12px; font-weight: 700; }
.gh-day-nums { text-align: center; min-width: 46px; line-height: 1.15; }
.gh-day-nums b { display: block; font-size: 14px; color: var(--gh-emerald-800); }
.gh-day-nums small { color: var(--gh-muted); font-size: 10.5px; }
.gh-day-road b { color: var(--gh-sky-600); }
.gh-day-stops:empty { display: none; }
.gh-day-stops { padding: 0 0 8px; background: #FAFCFB; }
/* Clickable report rows that open the pop-up */
tr.gh-row-click { cursor: pointer; }
tr.gh-row-click:hover td { background: var(--gh-emerald-50) !important; }
#repsDistanceTable tr.dtrg-group { cursor: pointer; }
