/* CA Portal v1.16.39 — Shared Screen Design & Contrast Audit Remediation.
 * CSS ONLY. No route, login, role, tax, bank, billing, salary, database,
 * form field, business status, JavaScript, workflow or button semantics changed.
 * Existing feature-specific layout and semantic colours remain authoritative.
 */
@media screen {
  html body.msa-crystal-ui:is(.portal-context-admin,.portal-context-staff,.portal-context-client,.portal-context-associate,.portal-context-public) {
    --ca-ui-ink: #173f5e;
    --ca-ui-muted: #44647d;
    --ca-ui-accent: #087c95;
    --ca-ui-blue: #135d9d;
    --ca-ui-teal: #087b70;
    --ca-ui-line: #c8dfea;
    --ca-ui-soft: #edf8ff;
    --ca-ui-shadow: 0 9px 28px rgba(19, 65, 107, .10);
    --ca-ui-focus: #006eaa;
    color-scheme: light;
  }

  /* Shared cards: strengthen outlines and depth without overriding existing
     per-module backgrounds, meaning, sizes or click targets. */
  html body.msa-crystal-ui :is(.card,.stat,.form-card,.record-card,.work-form-card,.table-wrap) {
    border-color: var(--ca-ui-line, #c8dfea);
    box-shadow: var(--ca-ui-shadow, 0 9px 28px rgba(19,65,107,.10));
  }
  html body.msa-crystal-ui :is(.card,.stat,.form-card,.record-card,.work-form-card) {
    border-radius: 17px;
  }
  html body.msa-crystal-ui .stats > .stat:nth-child(4n + 1) {
    border-top: 3px solid #1470ab;
    background: linear-gradient(138deg,#fff,#eff8ff);
  }
  html body.msa-crystal-ui .stats > .stat:nth-child(4n + 2) {
    border-top: 3px solid #128977;
    background: linear-gradient(138deg,#fff,#eafbf4);
  }
  html body.msa-crystal-ui .stats > .stat:nth-child(4n + 3) {
    border-top: 3px solid #7850ae;
    background: linear-gradient(138deg,#fff,#f4efff);
  }
  html body.msa-crystal-ui .stats > .stat:nth-child(4n) {
    border-top: 3px solid #a76518;
    background: linear-gradient(138deg,#fff,#fff7e9);
  }
  html body.msa-crystal-ui .stat span,
  html body.msa-crystal-ui .form-card .muted,
  html body.msa-crystal-ui .record-card .muted,
  html body.msa-crystal-ui .work-form-card .muted,
  html body.msa-crystal-ui .table-wrap .muted {
    color: var(--ca-ui-muted, #44647d) !important;
    line-height: 1.5;
  }
  html body.msa-crystal-ui :is(.form-card,.record-card,.work-form-card) :is(h1,h2,h3) {
    color: var(--ca-ui-ink, #173f5e);
    letter-spacing: -.015em;
  }

  /* Navigation: readable active/hover links without moving or hiding menus. */
  html body.msa-crystal-ui .portal-topbar {
    border-bottom: 1px solid #cadee9 !important;
    box-shadow: 0 6px 19px rgba(16, 68, 104, .095) !important;
  }
  html body.msa-crystal-ui .portal-topbar :is(.topnav-link,.topnav-button,.topnav-item) {
    font-weight: 700;
    border-radius: 12px;
  }
  html body.msa-crystal-ui .topnav-menu {
    border: 1px solid #c9e0eb !important;
    box-shadow: 0 18px 38px rgba(16,61,97,.16) !important;
  }
  html body.msa-crystal-ui .topnav-menu a:hover,
  html body.msa-crystal-ui .topnav-menu a:focus-visible {
    background: #e5f7ff !important;
    color: #10476b !important;
  }

  /* Form readability: on screen forms, labels and placeholder text must remain
     visible. No changes to required, readonly, disabled, input values or types. */
  html body.msa-crystal-ui :is(.form-card,.record-card,.work-form-body,.work-form-card) label {
    color: #234862;
    font-weight: 750;
  }
  html body.msa-crystal-ui :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea) {
    border-color: #afcede;
    color: #163f5b;
    caret-color: #106b98;
  }
  html body.msa-crystal-ui :is(input,textarea)::placeholder {
    color: #526e83;
    opacity: 1;
  }
  html body.msa-crystal-ui :is(input,select,textarea):focus-visible {
    outline: 3px solid #1686b4 !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(22,134,180,.10);
  }
  html body.msa-crystal-ui :is(input,select,textarea):disabled {
    color: #435b70;
    background-color: #eef4f8;
    opacity: .82;
  }
  html body.msa-crystal-ui :is(.btn,.btn-small,.btn-secondary,.btn-danger) {
    font-weight: 750;
    border-radius: 10px;
  }
  html body.msa-crystal-ui .btn-secondary {
    background: #e5f2fc !important;
    color: #114d78 !important;
    border: 1px solid #b7d7ec;
  }
  html body.msa-crystal-ui .btn-secondary:hover { background: #d5eaff !important; }
  html body.msa-crystal-ui .btn-danger {
    background: #a92b3c !important;
    color: #fff !important;
    border: 1px solid #8f1d31;
  }
  html body.msa-crystal-ui .btn-danger:hover { background: #8e1f33 !important; }
  html body.msa-crystal-ui :is(a,button,[role=button],summary):focus-visible {
    outline: 3px solid var(--ca-ui-focus, #006eaa) !important;
    outline-offset: 3px;
  }

  /* Common unthemed data registers. A feature's named table style is not
     overridden, preserving GST/ITR/audit semantics and row state colours. */
  html body.msa-crystal-ui .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-color: #9bbecf #f0f8fb;
    scrollbar-width: thin;
  }
  html body.msa-crystal-ui .table-wrap > table:not([class]) thead th {
    background: linear-gradient(112deg,#e6f3ff,#e8faf3) !important;
    color: #234b65 !important;
    border-bottom: 1px solid #c3d9e7;
    font-weight: 800;
  }
  html body.msa-crystal-ui .table-wrap > table:not([class]) tbody tr:nth-child(even) td {
    background-color: rgba(238,247,252,.45);
  }
  html body.msa-crystal-ui .table-wrap > table:not([class]) tbody tr:hover td {
    background-color: #e9f7fc;
  }
  html body.msa-crystal-ui :is(.table-wrap,.record-card) :is(th,td) {
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
  }

  /* Notices and status tags: all text retains meaning without relying on hue. */
  html body.msa-crystal-ui :is(.notice-success,.notice-error,.notice-warning) {
    border-width: 1px;
    border-style: solid;
    line-height: 1.5;
    font-weight: 650;
  }
  html body.msa-crystal-ui .notice-success {
    background-color: #e7f8ee;
    border-color: #a9dec1;
    color: #0e6445;
  }
  html body.msa-crystal-ui .notice-error {
    background-color: #ffedf0;
    border-color: #e4afb8;
    color: #922239;
  }
  html body.msa-crystal-ui .notice-warning {
    background-color: #fff5e2;
    border-color: #e9d29f;
    color: #80520e;
  }
  html body.msa-crystal-ui .tag-muted {
    background: #e8eef4;
    color: #415a72;
  }
  html body.msa-crystal-ui .tag-success {
    background: #dff6e8;
    color: #0b6849;
  }

  /* Popup/dialog surface polish is visual only: no display, position, z-index,
     max-height or overflow rules, which could break feature-specific modals. */
  html body.msa-crystal-ui :is(.fee-modal-card,.msa-modal-card,.simplex-modal-card,.portal-document-modal-card) {
    border: 1px solid #bcdbe8;
    box-shadow: 0 20px 54px rgba(14,55,87,.22);
    background-color: #fff;
  }
  html body.msa-crystal-ui .footer,
  html body.msa-crystal-ui .footer a {
    color: #4d6980;
  }
}

@media screen and (max-width: 700px) {
  html body.msa-crystal-ui :is(.form-card,.record-card,.work-form-card,.card,.stat) {
    border-radius: 14px;
  }
  html body.msa-crystal-ui :is(.form-card,.record-card,.work-form-card) {
    padding-inline: clamp(12px,3.6vw,22px);
  }
  html body.msa-crystal-ui :is(.table-wrap,.ep-table-scroll,.collection-register-scroll) {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
}
@media (prefers-reduced-motion: reduce) {
  html body.msa-crystal-ui :is(.btn,.btn-secondary,.btn-danger,.topnav-link) {
    transition: none !important;
  }
}
