/*
 * Unified Lab Platform - visual polish layer (v1)
 * ------------------------------------------------------------------
 * Presentation only. No selectors here change behavior, element IDs, or markup.
 * Loaded last so it refines the existing design system and module styles.
 * Remove the <link> in index.html to fall back to the previous look instantly.
 */

:root{
  --ulp-ease:cubic-bezier(.2,.7,.2,1);
  --ulp-t-fast:.14s;
  --ulp-t-base:.22s;
  --ulp-ring:0 0 0 3px rgba(62,224,239,.35);
  --ulp-card-border:rgba(105,198,230,.16);
  --ulp-card-border-hover:rgba(105,198,230,.34);
}

/* ---------- Typography ---------- */
html{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
  scroll-padding-top:88px;
}
/* Rendering quality only. Font family, line-height and heading sizes are deliberately left
   untouched: the existing modules are tuned for dense layouts and global changes there
   made cards loose and uneven. */
body{
  text-rendering:optimizeLegibility;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
table,.cc-kpi strong{font-variant-numeric:tabular-nums}
::selection{background:rgba(22,143,255,.35);color:inherit}

/* ---------- Focus and interaction ---------- */
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible{
  outline:2px solid var(--lab-cyan,#3ee0ef);
  outline-offset:2px;
  box-shadow:var(--ulp-ring);
  border-radius:inherit;
}
:where(button,[role="button"],a,select,summary){-webkit-tap-highlight-color:transparent}
/* :where() keeps specificity at zero so existing component transitions always win. */
:where(button,[role="button"]){transition:background-color var(--ulp-t-fast) var(--ulp-ease),border-color var(--ulp-t-fast) var(--ulp-ease),box-shadow var(--ulp-t-base) var(--ulp-ease),opacity var(--ulp-t-fast) var(--ulp-ease)}
:where(button,input,select,textarea):disabled{cursor:not-allowed;opacity:.55}

/* Skip link: hidden until a keyboard user tabs to it. */
.ulp-skip-link{
  position:fixed;inset-block-start:8px;inset-inline-start:8px;z-index:10000;
  padding:10px 16px;border-radius:10px;
  background:#06243d;color:#fff;font-weight:600;text-decoration:none;
  border:1px solid rgba(255,255,255,.3);
  transform:translateY(-200%);
}
.ulp-skip-link:focus{transform:none}
#main-content:focus{outline:none}

/* ---------- Scrollbars (thin, theme aware) ---------- */
*{scrollbar-width:thin;scrollbar-color:rgba(120,170,200,.45) transparent}
*::-webkit-scrollbar{width:10px;height:10px}
*::-webkit-scrollbar-thumb{background:rgba(120,170,200,.38);border-radius:999px;border:2px solid transparent;background-clip:content-box}
*::-webkit-scrollbar-thumb:hover{background:rgba(120,170,200,.6);background-clip:content-box}
*::-webkit-scrollbar-track{background:transparent}

/* ---------- Command center: hero ---------- */
body.cc-shell .cc-hero{
  border:1px solid var(--ulp-card-border);
  box-shadow:0 24px 60px rgba(0,10,22,.28),inset 0 1px 0 rgba(255,255,255,.06);
}
body.cc-shell .cc-hero h2{letter-spacing:-.01em;text-wrap:balance}
body.cc-shell .cc-hero p{max-width:62ch;text-wrap:pretty}
body.cc-shell .cc-hero-action{
  transition:transform var(--ulp-t-base) var(--ulp-ease),background-color var(--ulp-t-fast) var(--ulp-ease),border-color var(--ulp-t-fast) var(--ulp-ease);
}
body.cc-shell .cc-hero-action:hover{
  transform:translateY(-2px);
  background:rgba(255,255,255,.14);
  border-color:rgba(255,255,255,.3);
}

/* ---------- Command center: KPI cards ---------- */
body.cc-shell .cc-kpi{
  border-color:var(--ulp-card-border);
  box-shadow:0 10px 30px rgba(0,10,22,.18),inset 0 1px 0 rgba(255,255,255,.04);
  transition:transform var(--ulp-t-base) var(--ulp-ease),border-color var(--ulp-t-base) var(--ulp-ease);
}
body.cc-shell .cc-kpi:hover{transform:translateY(-2px);border-color:var(--ulp-card-border-hover)}
body.cc-shell .cc-kpi strong{
  font-size:clamp(1.7rem,2.4vw,2.15rem)!important; /* overrides the fixed 2rem!important in the base design system */
  line-height:1.15;
  letter-spacing:-.01em;
  font-weight:700;
}
/* Text-valued status ("Connect" / "Live") should read as a status, not a giant number. */
body.cc-shell .cc-kpi strong#ccStockStatus{
  font-size:clamp(1.1rem,1.5vw,1.35rem)!important;
  line-height:1.5;
  font-weight:600;
  letter-spacing:.01em;
}

/* ---------- Command center: workspace module cards ---------- */
/* Calmer, more clinical palette: same hues, lower saturation, subtle depth. */
body.cc-shell .cc-mod{
  border:1px solid rgba(255,255,255,.1);
  box-shadow:0 14px 34px rgba(0,10,22,.3),inset 0 1px 0 rgba(255,255,255,.12);
  transition:transform var(--ulp-t-base) var(--ulp-ease),box-shadow var(--ulp-t-base) var(--ulp-ease),border-color var(--ulp-t-fast) var(--ulp-ease);
}
body.cc-shell .cc-mod:hover{
  transform:translateY(-3px);
  border-color:rgba(255,255,255,.22);
  box-shadow:0 22px 44px rgba(0,10,22,.38),inset 0 1px 0 rgba(255,255,255,.18);
}
body.cc-shell .cc-mod b{font-size:1.05rem;font-weight:600}
body.cc-shell .cc-mod.stock  {background:linear-gradient(150deg,#1b63bd 0%,#123f7c 100%)}
body.cc-shell .cc-mod.metrics{background:linear-gradient(150deg,#5646a8 0%,#322a78 100%)}
body.cc-shell .cc-mod.micro  {background:linear-gradient(150deg,#8a2d5d 0%,#4f1c3b 100%)}
body.cc-shell .cc-mod.blood  {background:linear-gradient(150deg,#b3374a 0%,#6e1f2c 100%)}
body.cc-shell .cc-mod.equip  {background:linear-gradient(150deg,#12907a 0%,#0a5448 100%)}
body.cc-shell .cc-mod.safety {background:linear-gradient(150deg,#b9801f 0%,#6d4712 100%)}

/* ---------- Command center: boxes, status rows, quick actions ---------- */
body.cc-shell .cc-box{
  border-color:var(--ulp-card-border);
  box-shadow:0 10px 30px rgba(0,10,22,.16),inset 0 1px 0 rgba(255,255,255,.04);
}
body.cc-shell .cc-status{transition:border-color var(--ulp-t-fast) var(--ulp-ease),background-color var(--ulp-t-fast) var(--ulp-ease)}
body.cc-shell .cc-status:hover{border-color:var(--ulp-card-border-hover)}

/* ---------- Shell: sidebar navigation and top bar ---------- */
body.cc-shell .nav button{
  transition:background-color var(--ulp-t-fast) var(--ulp-ease),color var(--ulp-t-fast) var(--ulp-ease),transform var(--ulp-t-fast) var(--ulp-ease);
}
body.cc-shell .nav button:not(.active):hover{background:rgba(255,255,255,.07)}
body.cc-shell .top{border-bottom:1px solid var(--ulp-card-border)}
body.cc-shell .search{transition:border-color var(--ulp-t-fast) var(--ulp-ease),box-shadow var(--ulp-t-base) var(--ulp-ease)}
body.cc-shell .search:focus-within{border-color:var(--lab-cyan,#3ee0ef);box-shadow:var(--ulp-ring)}

/* ---------- Forms and tables (all modules) ---------- */
:where(input,select,textarea){transition:border-color var(--ulp-t-fast) var(--ulp-ease),box-shadow var(--ulp-t-base) var(--ulp-ease)}
:where(input,select,textarea)::placeholder{opacity:.7}
:where(th){font-weight:600}

/* ---------- Small screens ---------- */
@media(max-width:760px){
  body.cc-shell .cc-kpi strong{font-size:1.6rem!important}
  body.cc-shell .cc-kpi strong#ccStockStatus{font-size:1.15rem!important}
  body.cc-shell .cc-mod b{font-size:1rem}
  body.cc-shell .cc-hero h2{text-wrap:balance}
}

/* ---------- Motion preferences and print ---------- */
@media(prefers-reduced-motion:reduce){
  body.cc-shell .cc-mod:hover,body.cc-shell .cc-kpi:hover,body.cc-shell .cc-hero-action:hover{transform:none}
}
@media print{
  *{scrollbar-width:none}
  body.cc-shell .cc-mod,body.cc-shell .cc-kpi,body.cc-shell .cc-box{box-shadow:none}
}

/* ---------- Readability: minimum text size ----------
 * Measured on every page: 40% of visible text was below 10.5px (policies 79%, daily team 60%,
 * safety 50%). These selectors were checked to match only small text, so raising them to 11px
 * never shrinks anything. Icons, arrows and avatars are intentionally excluded.
 */
body .policy-code,
body .policy-page,
body .policy-card-title-en,
body .policy-card-summary-ar,
body .policy-card-summary-en,
body .policy-card-meta,
body .policy-lang-ok,
body .foot,
body .tag,
body .presence-label,
body .presence-value,
body .file-note,
body .lr-stamp,
body .notconfirmed-chip,
body .confirm-btn,
body .busy,
body .off,
body .si-empty,
body .support-pill,
body .shift-scheduled-chip,
body .lr-empty,
body .blood-step-label,
body .tv-muted,
body .role,
body .shift-kicker,
body .shift-nav-next,
body .shift-live,
body .m,
body .e,
body .n,
body .se,
body .sn,
body .shift-empty,
body .shift-more,
body .lr-eyebrow,
body .sv-pill,
body .np-app,
body .np-time,
body .np-foot,
body .qc2-message,
body .bb-ref,
body .bb-stop,
body .bb-close-rule,
body .blood-alert-strip,
body .si-ai-chip,
body .lm-msg,
body .shift-code-badge{font-size:11px}
/* Same rule for elements whose original style uses !important */
html body .lr-stamp,
html body .shift-scheduled-chip,
html body .role,
html body .np-app,
html body .np-time,
html body .np-foot{font-size:11px!important}

/* Readability, part 2: text inside cards and tiles (same validation as above) */
body .policy-card-foot button,
body .gp-ribbon-chip b,
body .device-reg-meta span,
body .temp-shift-table small,
body .person-meta span,
body .person-meta b,
body .foot b,
body .sig-btn b,
body .sig-btn small,
body .ssh-card b,
body .ssh-card small,
body .policy-tabs button,
body .blood-groups button,
body .policy-quick-topics button,
body .team-stat small,
body .si-ph small,
body .si-radar-card b,
body .si-radar-card small,
body .lr-tmeta small,
body .lr-stream span,
body .lr-ring b,
body .lr-ringbox small,
body .person-head small,
body .bb-vision-tags span,
body .temp-month-stat span,
body .lr-ph small,
body .lr-filter button,
body .quick-alert-btn small,
body .bb-step em,
body .bb-step b,
body .bb-step small,
body .si-metric span,
body .si-metric small,
body .tv-stat small,
body .lr-radar span,
body .lr-radar small,
body .qc2-intel-chip span,
body .qc2-intel-chip b,
body .blood-seg button,
body .si-source b,
body .si-source small,
body .policy-source-card b,
body .policy-source-card small,
body .support-pill b,
body .support-pill strong,
body .shift-block-title span,
body .lr-monthbox small,
body .card p,
body .bb-lab-mini b,
body .bb-lab-mini small,
body .policy-progress span,
body .policy-library-total span,
body .kpi-user-main b,
body .kpi-user-main small,
body .cc-head em,
body .shift-now-head small,
body .m b,
body .e b,
body .n b,
body .se b,
body .sn b,
body .sv-top p,
body .sv-top b,
body .lr-now-title span,
body .lr-sign b,
body .lr-sign small,
body .lr-sign span,
body .notice-preview p,
body .push-status span,
body .smart-inventory-embed-head span,
body .smart-inventory-embed-head p,
body .smart-inventory-embed-status b,
body .qc2-proof b,
body .qc2-proof small,
body .qc2-proof span,
body .qc2-intel-title small,
body .blood-operator span,
body .bb-command-brand small,
body .bb-vision-copy small,
body .bb-vision-copy p,
body .bb-section-label b,
body .bb-section-label small,
body .bb-decision-top span,
body .blood-issue-preview span,
body .ssh-title p,
body .sig-head p,
body .sgi-intro small,
body .policy-progress small,
body .policy-library-intro p,
body .policy-smart-head span,
body .policy-smart-head small,
body .policy-searchbox button,
body .policy-list-head b,
body .policy-list-head small,
body .tv-head p,
body .tv-btn small,
body .lm-hero small,
body .lm-head p{font-size:11px}
html body .policy-card-foot button,html body .qc2-proof span{font-size:11px!important}
