/* Shared contrast repair. Important declarations in this layer take precedence
   over legacy unlayered theme rules without changing page structure or controls. */
@layer crm-visibility {
  :root {
    --crm-ink: #1e293b !important;
    --crm-muted: #475569 !important;
    --crm-line: #94a3b8 !important;
    --crm-blue: #172b4d !important;
    --crm-blue-2: #0f766e !important;
    --crm-blue-deep: #172b4d !important;
  }
  :is(.caddesk-tele-dashboard,.caddesk-walkin-dashboard) { --nd-muted: #475569 !important; --nd-line: #94a3b8 !important; }
  .hr-workspace { --hr-muted: #475569 !important; --hr-line: #94a3b8 !important; }
  body { color: #1e293b !important; background-color: #f5f7fa !important; }
  :is(.page-subtitle,.help-text,.muted,.empty-state,.user-summary,.emp-help,.emp-empty,.comm-sub,.comm-note,.comm-meta,.hr-note,.hr-empty,.hr-info-label,.crm-login-subtitle,.crm-login-footer,.crm-login-brand-name span,small) {
    color: #475569 !important;
  }
  :is(.panel,.card,.ad-card,.staff-card,.comm-card,.emp-panel,.hr-record,.hr-kpi) {
    color: #1e293b !important;
    background: #fff !important;
    border-color: #cbd5e1 !important;
  }
  /* Summary cards use one light surface so text never lands on a pale gradient. */
  :is(.cards .card,.ad-cards .ad-card) {
    background: #fff !important;
    color: #172b4d !important;
    border-color: #cbd5e1 !important;
    border-top-color: #0f766e !important;
    box-shadow: 0 4px 14px rgb(23 43 77 / 8%) !important;
  }
  :is(.cards .card,.ad-cards .ad-card) :is(strong,span,small) {
    color: #172b4d !important;
    opacity: 1 !important;
    text-shadow: none !important;
  }
  button > :is(span,strong,small) { color: inherit !important; }
  :is(.btn-primary,.btn-link,.manage-link,.add-enquiry-toggle,.action-card-button,.action-card-stat,.tele-action-card,.walkin-action-card,.hr-action-card,.job-action-card,.emp-action-card,.emp-view,.emp-submit,.hrd-submit,.hrd-download,.sr-submit,.hr-page-action,.portal-scroller-label,.portal-scroller-seen,.top-menu-brand-fallback,.crm-login-button,.crm-login-logo-fallback) {
    background: #0f766e !important;
    color: #fff !important;
    border-color: #0f766e !important;
  }
  :is(.action-card-button,.action-card-stat,.tele-action-card,.walkin-action-card,.hr-action-card,.job-action-card,.emp-action-card,.cross-branch-approval-head) :is(h2,h3,h4,p,span,strong,small,.action-card-title,.action-card-meta) {
    color: #fff !important;
    opacity: 1 !important;
  }
  .hr-action-card .hr-action-count { background: #fff !important; color: #172b4d !important; opacity: 1 !important; }
  /* Noninteractive totals remain light; this fixes the employee count badge. */
  :is(.tele-action-stat,.walkin-action-stat,.hr-action-stat,.job-action-total,.emp-action-stat) {
    background: #e8f4f1 !important;
    color: #172b4d !important;
    border-color: #b8d8d2 !important;
  }
  :is(.tele-action-stat,.walkin-action-stat,.hr-action-stat,.job-action-total,.emp-action-stat) :is(span,strong,small,.emp-action-title,.emp-action-meta,.hr-action-title,.hr-action-meta,.job-action-title,.tele-action-title,.tele-action-meta,.walkin-action-title,.walkin-action-meta) {
    color: #172b4d !important;
  }
  :is(.btn-secondary,.btn-link-secondary,.icon-button,.emp-close,.btn.light) {
    background: #f1f5f9 !important;
    color: #172b4d !important;
    border-color: #94a3b8 !important;
  }
  :is(.btn-danger,.delete-button,button.danger) { background: #b42318 !important; color: #fff !important; }
  :is(.btn-success,.whatsapp-button,.whatsapp-link) { background: #166534 !important; color: #fff !important; }
  :is(.btn-warning,button.warning) { background: #92400e !important; color: #fff !important; }
  :is(input,select,textarea) { color: #1e293b !important; background-color: #fff !important; border-color: #94a3b8 !important; }
  :is(input,textarea)::placeholder { color: #526477 !important; opacity: 1 !important; }
  :is(input[type=checkbox],input[type=radio]) { accent-color: #0f766e !important; }
  :is(button,input,select,textarea):disabled { opacity: 1 !important; color: #475569 !important; background: #e2e8f0 !important; border-color: #94a3b8 !important; cursor: not-allowed !important; }
  :is(button,input,select,textarea):disabled > :is(span,strong,small) { color: #475569 !important; }
  :is(a,button,input,select,textarea,summary,[tabindex]):focus-visible {
    outline: 3px solid #0f766e !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 2px #fff !important;
  }
  :is(.top-menu-header,.header) :is(a,button):focus-visible {
    outline-color: #fff !important;
    box-shadow: 0 0 0 2px #172b4d !important;
  }
  .top-menu-header .requests-menu :is(a,button):focus-visible { outline-color: #0f766e !important; box-shadow: 0 0 0 2px #fff !important; }
  th { color: #172b4d !important; background: #edf2f7 !important; font-size: 12px !important; }
  td { color: #1e293b !important; }
  :is(.pill,.badge,.emp-badge,.hr-badge,.hr-status,.status-pill) { background: #edf2f7 !important; color: #334155 !important; font-size: 12px !important; }
  :is(.priority-hot,.badge.bad,.emp-badge.on_notice,.hr-overdue,.comm-status.off) { background: #fee2e2 !important; color: #991b1b !important; }
  :is(.priority-warm,.badge.warn,.emp-badge.pending_verification,.hr-today) { background: #ffedd5 !important; color: #9a3412 !important; }
  :is(.priority-cold) { background: #e0f2fe !important; color: #075985 !important; }
  :is(.badge.ok,.emp-badge.active,.comm-status.on) { background: #dcfce7 !important; color: #166534 !important; }
  :is(.comm-tabs,.hr-module-nav) a { background: #fff !important; color: #172b4d !important; border-color: #94a3b8 !important; }
  :is(.comm-tabs,.hr-module-nav) a.active { background: #0f766e !important; color: #fff !important; border-color: #0f766e !important; }
  .portal-scroller-type { background: #172b4d !important; color: #fff !important; }
  .portal-scroller-item[data-type=communication] .portal-scroller-type,
  .portal-scroller-item[data-type=branch_transfer] .portal-scroller-type { background: #0f766e !important; }
  .crm-row-actions > button:hover { background: #0f766e !important; color: #fff !important; }
  .crm-row-actions-menu[popover] { background: #fff !important; color: #172b4d !important; }
  .crm-row-actions-menu[popover] a:focus-visible { background: #e8f4f1 !important; color: #0f766e !important; }
  .cross-branch-approval-head { background: #172b4d !important; color: #fff !important; }
  /* Enquiry charts retain their stages and text-only drilldown counts. */
  :is(#teleAnalytics,#walkinNewDashboard) :is(.nd-muted,.nd-description,.nd-kpi-label,.nd-stage-meta) { color: #475569 !important; }
  :is(#teleAnalytics,#walkinNewDashboard) :is(.nd-tab,.nd-button) { background: #fff !important; color: #172b4d !important; border-color: #94a3b8 !important; }
  :is(#teleAnalytics,#walkinNewDashboard) :is(.nd-tab[aria-selected=true],.nd-button.nd-primary,.nd-stage-shape) { background: #172b4d !important; color: #fff !important; }
  :is(#teleAnalytics,#walkinNewDashboard) .nd-stage-shape :is(span,strong,small) { color: #fff !important; }
  :is(#teleAnalytics,#walkinNewDashboard) :is(.nd-stage-name,.nd-conversion-value) { background: transparent !important; color: #0f766e !important; }
  :is(#teleAnalytics,#walkinNewDashboard) .nd-conversion-breakdown > button { background: #f5f7fa !important; color: #172b4d !important; }
  /* Record identifiers remain simple links rather than filled action buttons. */
  :is(.tele-id-view,.walkin-id-button,.adm-batch,.batch-code,[class*="-id-view"],[class*="-id-button"],[class*="-id-link"],[class*="-code-link"]) {
    background: transparent !important; color: #172b4d !important;
  }
  .crm-login-brand { background: #172b4d !important; color: #fff !important; }
  .crm-brand-content :is(h1,p,span,small),.crm-brand-point { color: #fff !important; }
  .crm-login-panel { background: #f5f7fa !important; }
  body.crm-student-portal {
    --cream: #f5f7fa !important; --grey: #94a3b8 !important;
    --charcoal: #172b4d !important; --black: #1e293b !important; --orange: #0f766e !important;
  }
  .crm-student-portal :is(.header,.logo) { background: #172b4d !important; color: #fff !important; }
  .crm-student-portal .nav a.active { background: #0f766e !important; color: #fff !important; }
  .crm-student-portal .btn { background: #0f766e !important; color: #fff !important; }
  .crm-student-portal .btn.light { background: #f1f5f9 !important; color: #172b4d !important; }
  .crm-student-portal .forgot { color: #0f766e !important; }
}



/* Accessibility repair for shared CRM, Inventory and student surfaces.
   Keep important rules in the established layer above legacy theme overrides. */
@layer crm-visibility {
  .inv-nav a {background:#fff!important;color:#172b4d!important;border-color:#64748b!important;}
  .inv-nav a.active,.inv .inv-button.primary {background:#0f766e!important;color:#fff!important;border-color:#0f766e!important;}
  .inv-nav a.active :is(span,strong,small),.inv .inv-button.primary :is(span,strong,small) {color:#fff!important;}
  .inv-nav a:hover:not(.active),.inv .inv-button:not(.primary):hover {background:#e8f4f1!important;color:#172b4d!important;}
  .inv .inv-button:not(.primary) {background:#fff!important;color:#172b4d!important;border-color:#64748b!important;}
  .inv .inv-card {color:#172b4d!important;background:#fff!important;}
  .inv .inv-card :is(strong,span) {color:#172b4d!important;opacity:1!important;}
  :is(.tabs,.batch-tabs) a.active {background:#0f766e!important;color:#fff!important;}
  .crm-skip-link {position:fixed!important;top:8px!important;left:12px!important;z-index:50000!important;transform:translateY(-160%);background:#fff!important;color:#172b4d!important;padding:12px 18px!important;border:2px solid #172b4d!important;border-radius:8px!important;font-weight:700!important;}
  .crm-skip-link:focus {transform:translateY(0)!important;outline:3px solid #0f766e!important;outline-offset:2px!important;}
  #crmMainContent {scroll-margin-top:140px;}
  :is(a,button,input,select,textarea,summary,[tabindex]):focus-visible {outline:3px solid #0f766e!important;outline-offset:3px!important;box-shadow:0 0 0 2px #fff!important;}
  :is(.top-menu-header,.crm-student-portal .header,.crm-student-portal .nav) :is(a,button,summary):focus-visible {outline-color:#fff!important;box-shadow:0 0 0 2px #172b4d!important;}
  .top-menu-header .requests-menu :is(a,button):focus-visible {outline-color:#0f766e!important;box-shadow:0 0 0 2px #fff!important;}
  :is(.top-menu-toggle,.icon-button,.emp-close,.btn,.inv-button,.requests-toggle,summary) {min-height:44px!important;}
  :is(.top-menu-toggle,.icon-button,.emp-close) {min-width:44px!important;}
  :is(input[type=checkbox],input[type=radio]) {width:24px!important;min-width:24px!important;height:24px!important;min-height:24px!important;flex-shrink:0!important;}
  :is(input,select,textarea)[aria-invalid=true] {border:2px solid #b42318!important;}
  :is(.notice.error,.error[role=alert]) {color:#991b1b!important;background:#fef2f2!important;border:1px solid #b42318!important;}
  :is(.table-responsive,.inv-table,[data-crm-table-scroll]) {overflow-x:auto!important;max-width:100%!important;overscroll-behavior-x:contain;}
  :is(.content,.student-shell,.inv-grid)>* {min-width:0;}
  .content :is(h1,h2,h3,p,label) {overflow-wrap:anywhere;}
  .top-menu-nav {flex-wrap:wrap!important;}
  @media(max-width:900px) {
    .top-menu-nav {flex-wrap:nowrap!important;}
    .top-menu-nav.is-open {overflow-y:auto!important;max-height:calc(100dvh - 66px)!important;}
    :is(input,select,textarea) {font-size:16px!important;}
    :is(.comm-tabs,.hr-module-nav,.inv-nav,.batch-tabs,.tabs) {flex-wrap:wrap!important;gap:8px!important;}
    .content :is(.form-actions,.filter-actions) {flex-wrap:wrap!important;}
    .user-summary {white-space:normal!important;overflow-wrap:anywhere!important;}
  }
  @media(prefers-reduced-motion:reduce) {
    *,*::before,*::after {animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important;}
  }
  @media(forced-colors:active) {
    :is(a,button,input,select,textarea,summary,[tabindex]):focus-visible {outline:3px solid Highlight!important;box-shadow:none!important;}
    :is(.inv-nav a.active,.comm-tabs a.active,.hr-module-nav a.active,.tabs a.active,.batch-tabs a.active) {border:2px solid Highlight!important;}
  }
}
