/**
 * TelepharmaSea — Light Blue Theme
 */
:root {
  /* ── Brand ───────────────────────────────────────────── */
  --tps-primary:           #0066CC;
  --tps-primary-rgb:       0, 102, 204;
  --tps-primary-hover:     #0052A3;
  --tps-primary-deep:      #004C99;
  --tps-primary-soft:      #D6EBFA;

  --tps-secondary:         #4DA6FF;
  --tps-secondary-rgb:     77, 166, 255;
  --tps-secondary-deep:      #2E8FE0;
  --tps-secondary-dark:      #1A7FD4;
  --tps-secondary-light:     #7EC4FF;
  --tps-secondary-soft:      #B8DCFA;
  --tps-secondary-bg:        #E3F2FD;
  --tps-secondary-bg-soft:   #F0F8FF;

  /* ── Surfaces & text (light blue tinted) ─────────────── */
  --tps-neutral-bg:        #E8F4FC;
  --tps-neutral-surface:   #F7FBFF;
  --tps-neutral-muted-bg:  #D6EBFA;
  --tps-neutral-line:      #B8D9F0;
  --tps-neutral-text:      #2C3E50;
  --tps-neutral-muted:     #4A6578;

  /* ── Semantic ────────────────────────────────────────── */
  --tps-success:           #28A745;
  --tps-success-hover:     #218838;
  --tps-warning:           #FFC107;
  --tps-danger:            #DC3545;

  /* Legacy aliases */
  --tps-accent:            var(--tps-primary);
  --tps-accent-rgb:        var(--tps-primary-rgb);
  --tps-accent-hover:      var(--tps-primary-hover);
  --tps-accent-deep:       var(--tps-primary-deep);
  --tps-accent-soft:       var(--tps-primary-soft);
  --tps-primary-dark:      var(--tps-primary-hover);
  --tps-primary-deeper:    var(--tps-primary-deep);
  --tps-primary-light:     var(--tps-secondary-light);
  --tps-primary-bg:        var(--tps-secondary-bg);
  --tps-primary-bg-soft:   var(--tps-neutral-bg);

  --tps-surface:           var(--tps-neutral-surface);
  --tps-line:              var(--tps-neutral-line);
  --tps-white:             #ffffff;
  --tps-shell-bg:          var(--tps-neutral-bg);
  --tps-main-bg:           #F0F7FC;
  --tps-border:            rgba(var(--tps-primary-rgb), .16);
  --tps-card-shadow:       0 1px 3px rgba(var(--tps-primary-rgb), .1), 0 4px 16px rgba(var(--tps-primary-rgb), .08);

  --tps-navy:              var(--tps-neutral-text);
  --tps-navy-deep:         #1A252F;

  --tps-font-stack: 'Inter', sans-serif;
  --bs-font-sans-serif: var(--tps-font-stack);
  --bs-body-font-family: var(--tps-font-stack);
  --bs-headings-font-family: var(--tps-font-stack);
  --bs-body-font-size: 0.9375rem;
  --bs-body-line-height: 1.55;
  --bs-headings-font-weight: 600;

  --tps-ocean-gradient: linear-gradient(165deg, #E8F4FC 0%, #F7FBFF 45%, #D6EBFA 100%);
  --tps-topbar-bg:         #1976D2;
  --tps-topbar-gradient:   #1976D2;
  --tps-sidebar-gradient: linear-gradient(180deg, #0066CC 0%, #2889E8 50%, #66B3FF 100%);

  --ocean-deep:   var(--tps-primary-deep);
  --ocean-mid:    var(--tps-primary);
  --ocean-bright: var(--tps-secondary);
  --ocean-foam:   rgba(255,255,255,.15);

  --bs-heading-color:    var(--tps-neutral-text);
  --bs-body-color:       var(--tps-neutral-text);
  --bs-body-bg:          var(--tps-neutral-bg);
  --bs-primary:          var(--tps-primary);
  --bs-primary-rgb:      var(--tps-primary-rgb);
  --bs-link-color:       var(--tps-primary);
  --bs-link-hover-color: var(--tps-primary-deep);
  --bs-success:          var(--tps-success);
  --bs-warning:          var(--tps-warning);
  --bs-danger:           var(--tps-danger);
}

html {
  font-family: var(--tps-font-stack);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--tps-font-stack);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, button, select, textarea, .btn {
  font-family: inherit;
}

/* ══════════════════════════════════════════════════
   OCEAN WAVE ANIMATION
══════════════════════════════════════════════════ */
@keyframes tpsWave1 {
  0%   { transform: translateX(0)    scaleY(1); }
  50%  { transform: translateX(-25%) scaleY(0.85); }
  100% { transform: translateX(-50%) scaleY(1); }
}
@keyframes tpsWave2 {
  0%   { transform: translateX(0)    scaleY(1); }
  50%  { transform: translateX(25%)  scaleY(1.12); }
  100% { transform: translateX(50%)  scaleY(1); }
}
@keyframes tpsWave3 {
  0%   { transform: translateX(-10%) scaleY(0.95); }
  50%  { transform: translateX(15%)  scaleY(1.05); }
  100% { transform: translateX(-10%) scaleY(0.95); }
}
@keyframes tpsBubble {
  0%   { transform: translateY(0)    scale(1);    opacity:.5; }
  100% { transform: translateY(-80px) scale(1.4); opacity:0; }
}

/* ── Water background shell ───────────────────────────────── */
#tpsOceanBg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--tps-ocean-gradient);
}

/* Animated wave layers */
#tpsOceanBg .wave-wrap {
  position: absolute;
  bottom: -10px;
  left: -100%;
  width: 300%;
  height: 180px;
  pointer-events: none;
}
#tpsOceanBg .wave-wrap.w1 {
  animation: tpsWave1 9s ease-in-out infinite;
  opacity: .12;
}
#tpsOceanBg .wave-wrap.w2 {
  bottom: -20px;
  animation: tpsWave2 13s ease-in-out infinite;
  opacity: .08;
}
#tpsOceanBg .wave-wrap.w3 {
  bottom: -30px;
  animation: tpsWave3 17s ease-in-out infinite;
  opacity: .06;
}
#tpsOceanBg .wave-wrap svg {
  width: 100%;
  height: 100%;
}

/* Floating bubbles */
#tpsOceanBg .bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  animation: tpsBubble linear infinite;
}

/* Medicine pill watermark pattern on main content */
#tpsOceanBg .med-pattern {
  position: absolute;
  inset: 0;
  opacity: .025;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cellipse cx='20' cy='20' rx='12' ry='6' fill='none' stroke='%23fff' stroke-width='2' transform='rotate(-35 20 20)'/%3E%3Cline x1='20' y1='14' x2='20' y2='26' stroke='%23fff' stroke-width='1.5' transform='rotate(-35 20 20)'/%3E%3Ccircle cx='60' cy='55' r='8' fill='none' stroke='%23fff' stroke-width='2'/%3E%3Cpath d='M55 55 h10' stroke='%23fff' stroke-width='1.5'/%3E%3Cpath d='M60 50 v10' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════
   AUTHENTICATED APP SHELL  (body.tps-app)
══════════════════════════════════════════════════ */
body.tps-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: transparent;          /* ocean bg is the #tpsOceanBg div */
  color: var(--bs-body-color);
  font-family: var(--tps-font-stack);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: var(--bs-body-font-size);
  line-height: var(--bs-body-line-height);
}

/* Cards — lifted appearance over ocean */
body.tps-app .card {
  border-color: rgba(var(--tps-primary-rgb),.09);
  border-radius: 0.75rem;
  box-shadow: 0 4px 16px rgba(var(--tps-primary-rgb),.13);
}
body.tps-app .card.shadow-sm {
  box-shadow: var(--tps-card-shadow) !important;
}
body.tps-app .card-header {
  font-weight: 600;
  letter-spacing: .01em;
  border-radius: .75rem .75rem 0 0 !important;
}

body.tps-app .form-label,
body.tps-app .col-form-label {
  font-weight: 600;
  color: var(--tps-neutral-text);
  margin-bottom: .35rem;
}

body.tps-app .form-control,
body.tps-app .form-select {
  border-color: rgba(var(--tps-primary-rgb),.16);
  border-radius: .45rem;
}
body.tps-app .form-control:focus,
body.tps-app .form-select:focus {
  border-color: rgba(var(--tps-primary-rgb),.65);
  box-shadow: 0 0 0 .2rem rgba(var(--tps-primary-rgb),.2);
}

body.tps-app .table {
  --bs-table-striped-bg: rgba(var(--tps-primary-rgb),.04);
  --bs-table-hover-bg: rgba(var(--tps-primary-rgb),.07);
}
body.tps-app .table thead th {
  font-weight: 700;
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--tps-primary-deep);
  background: var(--tps-primary-soft);
  border-bottom-width: 1px;
  border-bottom-color: var(--tps-neutral-line);
  white-space: nowrap;
}

body.tps-app .modal-content {
  border-radius: .75rem;
  border-color: rgba(var(--tps-primary-rgb),.1);
  box-shadow: 0 12px 40px rgba(var(--tps-primary-rgb),.22);
}
body.tps-app .alert { border-radius: .55rem; }

body.tps-app .tps-page-header--cirm {
  padding-bottom: .5rem;
  border-bottom: 1px solid rgba(var(--tps-primary-rgb),.07);
  margin-bottom: 1.25rem !important;
}
body.tps-app .tps-page-subtitle {
  line-height: 1.45;
  max-width: 36rem;
}

body.tps-app > .app-wrapper {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  min-width: 0;
}
body.tps-app .tps-app-main-col {
  min-height: 0;
  background: var(--tps-shell-bg);
}

/* Docked sidebar */
body.tps-app .tps-sidebar-dock {
  width: var(--tps-sidebar-w-expanded, 260px);
  display: flex;
  flex-direction: column;
  align-self: stretch;
  background: var(--tps-sidebar-bg, var(--tps-sidebar-gradient));
  border-right: 1px solid rgba(var(--tps-primary-rgb),.08) !important;
  box-shadow: 2px 0 16px rgba(var(--tps-primary-rgb),.06);
  transition: width .22s ease;
  overflow-x: hidden;
  overflow-y: hidden;
}
body.tps-app.tps-sidebar-collapsed .tps-sidebar-dock {
  width: var(--tps-sidebar-w-collapsed, 72px);
}

body.tps-app .tps-sidebar-heading         { color: var(--tps-primary-deep); letter-spacing: .02em; white-space: nowrap; }
body.tps-app .tps-sidebar-menu-toggle     { border:0; background:transparent; color:var(--tps-primary-deep) !important; text-decoration:none !important; padding:.75rem 1rem; text-align:left; min-height:2.75rem; border-radius:0; transition:background .12s ease; }
body.tps-app .tps-sidebar-menu-toggle:hover { background: rgba(255,255,255,.5); color:var(--tps-navy) !important; }
body.tps-app .tps-sidebar-menu-toggle:focus-visible { outline:none; box-shadow:inset 0 0 0 2px rgba(var(--tps-primary-rgb),.5); z-index:1; position:relative; }
body.tps-app .tps-sidebar-heading-bar { border-bottom-color:rgba(var(--tps-primary-rgb),.08) !important; }
body.tps-app .tps-sidebar-heading-icon { color:var(--tps-primary-dark); opacity:.95; font-size:1.25rem; line-height:1; }

body.tps-app .tps-sidebar-nav { flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden; }
body.tps-app .tps-sidebar-dock .nav-link { display:flex; align-items:center; gap:.45rem; border-radius:.4rem; color:var(--tps-primary-deep); margin-bottom:2px; font-weight:500; white-space:nowrap; }
body.tps-app .tps-sidebar-dock .nav-link .tps-nav-icon { color:var(--tps-primary-dark); opacity:.95; font-size:1.1rem; }
body.tps-app .tps-sidebar-dock .nav-link:hover { background:rgba(255,255,255,.55); color:var(--tps-navy); }
body.tps-app .tps-sidebar-dock .nav-link.active { background:rgba(var(--tps-primary-rgb),.1); color:var(--tps-navy); font-weight:600; box-shadow:inset 3px 0 0 var(--tps-accent); }

body.tps-app.tps-sidebar-collapsed .tps-sidebar-heading-label { display:none !important; }
body.tps-app.tps-sidebar-collapsed .tps-sidebar-menu-toggle   { justify-content:center; padding-left:.35rem; padding-right:.35rem; }
body.tps-app.tps-sidebar-collapsed .tps-sidebar-heading-bar   { padding:0; }
body.tps-app.tps-sidebar-collapsed .tps-sidebar-dock .nav-link { justify-content:center; padding-left:.35rem; padding-right:.35rem; gap:0; }
body.tps-app.tps-sidebar-collapsed .tps-sidebar-dock .nav-link .tps-nav-label { display:none !important; }
body.tps-app.tps-sidebar-collapsed .tps-sidebar-dock .nav-link.active { box-shadow:none; background:rgba(var(--tps-primary-rgb),.15); }

body.tps-app .tps-topbar {
  background: var(--tps-topbar-gradient);
  border-bottom: 1px solid rgba(255,255,255,.12) !important;
  box-shadow: 0 1px 8px rgba(21,101,192,.25);
  color: #fff;
}
body.tps-app .tps-topbar-page-title { color:#fff; max-width:min(42vw,14rem); }
body.tps-app .tps-topbar-mobile-title { color:#fff; }
body.tps-app .tps-topbar-user { color:rgba(255,255,255,.85); }
body.tps-app .tps-topbar-title-icon { color:#fff; opacity:.9; }

/* Notification bell (admin / pharmacist / ship officer) */
.tps-notif-bell-wrap {
  position: relative;
  margin-right: .75rem;
  flex-shrink: 0;
}
.tps-notif-bell {
  color: var(--tps-neutral-muted) !important;
  font-size: 1.25rem;
  line-height: 1;
  text-decoration: none !important;
}
.tps-topbar .tps-notif-bell {
  color: rgba(255, 255, 255, .92) !important;
}
.tps-topbar .tps-notif-bell:hover {
  color: #fff !important;
}
.tps-notif-bell:hover { color: var(--tps-primary-deep) !important; }
.tps-notif-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--tps-danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 2px solid rgba(255, 255, 255, .95);
}
.tps-notif-bell-wrap .dropdown-menu.tps-notif-panel {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  left: auto;
  bottom: auto;
  transform: none;
  margin: 0;
  width: min(22rem, calc(100vw - 1rem));
  max-width: calc(100vw - 1rem);
  max-height: min(20rem, calc(100vh - 4rem));
  box-sizing: border-box;
  z-index: 1200;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: .5rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  overflow: hidden;
}
.tps-notif-panel__hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-width: 0;
  padding: .6rem .75rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.tps-notif-panel__title {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--tps-secondary-deep);
  margin: 0;
  white-space: nowrap;
}
.tps-notif-mark-all,
.tps-notif-panel__hdr .btn-link {
  color: var(--tps-accent) !important;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none !important;
}
.tps-notif-mark-all:hover,
.tps-notif-panel__hdr .btn-link:hover {
  color: var(--tps-accent-hover) !important;
  text-decoration: underline !important;
}
.tps-notif-panel__body {
  max-height: min(16rem, calc(100vh - 8rem));
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.tps-notif-item {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  padding: .65rem .75rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s ease;
  min-width: 0;
}
.tps-notif-item:last-child { border-bottom: none; }
.tps-notif-item:hover { background: #f8fafc; }
.tps-notif-item--unread { background: #f0f7ff; }
.tps-notif-item--unread:hover { background: #e8f2fc; }
.tps-notif-item__icon {
  color: var(--tps-danger);
  font-size: .95rem;
  margin-top: .15rem;
  flex-shrink: 0;
  line-height: 1;
}
.tps-notif-item__text {
  min-width: 0;
  flex: 1 1 auto;
}
.tps-notif-item__text strong {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--tps-neutral-text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.tps-notif-item__text .small {
  font-size: .72rem !important;
  line-height: 1.4;
  color: var(--tps-neutral-muted) !important;
  margin-top: .15rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tps-notif-panel__body > .text-muted {
  color: var(--tps-neutral-muted) !important;
  font-size: .78rem;
}
@media (min-width:576px) { body.tps-app .tps-topbar-page-title { max-width:min(55vw,28rem); } }


body.tps-app .tps-btn-logout { border-radius:2rem; padding:.35rem 1rem; font-weight:600; font-size:.8rem; color:var(--tps-neutral-muted); background:#e2e8f0; border:1px solid transparent; }
body.tps-app .tps-btn-logout:hover { color:var(--tps-navy-deep); background:#cbd5e1; }

body.tps-app .tps-main-area  { background:var(--tps-shell-bg); overflow:auto; }
body.tps-app .tps-main-inner { max-width:100%; margin:0 auto; }

body.tps-app .tps-page-title      { color:var(--tps-navy); letter-spacing:-.02em; }
body.tps-app .tps-page-title-icon { font-size:1.35rem; color:var(--tps-accent); opacity:.95; line-height:1; }
body.tps-app .tps-topbar-title-icon { font-size:1.05rem; color:#fff; opacity:.9; }

body.tps-app .tps-stat-card__icon  { line-height:1; opacity:.92; }
body.tps-app .tps-panel-card__accent { line-height:1; margin-top:.125rem; }
body.tps-app .tps-stat-card { border-radius:.75rem; transition:box-shadow .15s ease,transform .15s ease; }
body.tps-app .tps-stat-card:hover { box-shadow:0 .5rem 1.75rem rgba(var(--tps-primary-rgb),.14) !important; transform:translateY(-1px); }
body.tps-app .tps-stat-card .display-6 { font-size:clamp(1.85rem,4vw,2.35rem); letter-spacing:-.03em; }

body.tps-app .tps-panel-card        { border-radius:.75rem; }
body.tps-app .tps-panel-card__header { border-radius:.75rem .75rem 0 0; color:var(--tps-navy); }
body.tps-app .tps-badge-soft        { background:var(--tps-primary-bg); color:var(--tps-primary-deep); font-weight:600; }

body.tps-app .btn-primary { background-color:var(--tps-primary); border-color:var(--tps-primary); color:var(--tps-white); font-weight:600; }
body.tps-app .btn-primary:hover,
body.tps-app .btn-primary:focus { background-color:var(--tps-primary-hover); border-color:var(--tps-primary-hover); color:var(--tps-white); }

body.tps-app .btn-outline-danger { color:#b02a37; border-color:rgba(176,42,55,.35); }
body.tps-app .btn-outline-danger:hover { color:#fff; background:#b02a37; border-color:#b02a37; }

.row-expiry-urgent    { background-color:rgba(220,53,69,.12) !important; }
.row-expiry-soon      { background-color:rgba(25,135,84,.15) !important; }
.row-expiry-below-min { background-color:rgba(110,20,40,.2) !important; border-left:4px solid #6e1428 !important; }

.tps-expiry-cell {
  display: inline-block;
  padding: .1rem .35rem;
  border-radius: .2rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tps-expiry-cell.tps-expiry-urgent {
  background-color: rgba(220, 53, 69, .18);
  color: #b02a37;
  font-weight: 600;
}
.tps-expiry-cell.tps-expiry-soon {
  background-color: rgba(25, 135, 84, .2);
  color: #146c43;
  font-weight: 600;
}
.tps-ci-section-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--tps-navy, #1a3a52);
  margin: 0 0 .5rem;
  text-align: center;
}
.tps-ci-section + .tps-ci-section { margin-top: 1.25rem; }

body.tps-app .tps-drop-zone          { background:rgba(248,250,252,.95); cursor:pointer; }
body.tps-app .tps-drop-zone.tps-drop-zone--drag { border-color:var(--tps-accent) !important; background:rgba(var(--tps-primary-rgb),.08); }

/* ── App banner ──────────────────────────────────────────── */
.tps-app-banner { flex-shrink:0; background:linear-gradient(180deg,var(--tps-primary-bg) 0%,var(--tps-surface) 100%); border-bottom:1px solid var(--tps-line); box-shadow:none; }
.tps-app-banner__inner { max-width:1440px; margin:0 auto; padding:.65rem clamp(.5rem,2.5vw,1.25rem); display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:.5rem; }
.tps-app-banner__left   { justify-self:start; min-width:0; }
.tps-app-banner__center { justify-self:center; max-width:min(100vw - 180px,42rem); min-width:0; }
.tps-app-banner__right  { justify-self:end; min-width:0; }
.tps-app-banner__logo-link { color:inherit; }
.tps-app-banner__logo-link:hover .tps-app-banner__logo,
.tps-app-banner__logo-link:hover .tps-app-banner__logo-fallback { box-shadow:0 3px 10px rgba(var(--tps-primary-rgb),.14); }
.tps-app-banner__logo-link:focus-visible { outline:none; box-shadow:0 0 0 3px rgba(var(--tps-primary-rgb),.45); border-radius:.65rem; }
.tps-app-banner__logo { width:48px; height:48px; object-fit:contain; border-radius:.5rem; box-shadow:0 1px 4px rgba(var(--tps-primary-rgb),.1); transition:box-shadow .15s ease; }
.tps-app-banner__logo-fallback { width:48px; height:48px; transition:box-shadow .15s ease; }
.tps-app-banner__med-emblem { width:48px; height:48px; border-radius:.5rem; background:#fff; border:1px solid rgba(var(--tps-primary-rgb),.1); box-shadow:0 1px 4px rgba(var(--tps-primary-rgb),.08); }
.tps-app-banner__med-icon { font-size:1.65rem; color:var(--tps-accent); line-height:1; }
.tps-app-banner__title   { font-weight:800; font-size:clamp(1.35rem,3vw,1.85rem); letter-spacing:-.02em; line-height:1.15; color:var(--tps-navy); text-wrap:balance; }
.tps-app-banner__tagline { font-size:.8rem; font-weight:600; color:#476985; line-height:1.3; margin-top:.1rem; }

.tps-app-banner__logo--cirm,
.tps-app-banner__logo--servizi { width:auto; max-width:min(140px,36vw); max-height:clamp(44px,11vw,64px); height:auto; object-fit:contain; }
.tps-app-banner__med-emblem--logo { width:auto; min-width:3.5rem; max-width:min(148px,38vw); height:auto; min-height:3rem; background:transparent; border:none; box-shadow:none; }
.tps-app-banner__med-emblem--logo .tps-app-banner__logo--servizi { max-width:100%; }

@media (max-width:575.98px) {
  .tps-app-banner__inner  { padding:.5rem 1rem; gap:.35rem; }
  .tps-app-banner__center { max-width:min(100vw - 120px,36rem); }
  .tps-app-banner__tagline { display:none; }
  .tps-app-banner__med-emblem:not(.tps-app-banner__med-emblem--logo),
  .tps-app-banner__logo:not(.tps-app-banner__logo--cirm):not(.tps-app-banner__logo--servizi),
  .tps-app-banner__logo-fallback { width:42px; height:42px; }
  .tps-app-banner__logo--cirm,
  .tps-app-banner__logo--servizi { max-width:min(100px,32vw); max-height:44px; }
  .tps-app-banner__med-emblem--logo { min-height:2.5rem; max-width:min(108px,34vw); }
  .tps-app-banner__med-icon { font-size:1.45rem; }
}

/* ══════════════════════════════════════════════════
   AUTH PAGES  (login / forgot-password / etc.)
══════════════════════════════════════════════════ */
body.tps-auth-page {
  min-height: 100vh;
  margin: 0;
  color: var(--bs-body-color);
  background: transparent;
  font-family: var(--tps-font-stack);
  font-size: var(--bs-body-font-size);
  line-height: var(--bs-body-line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.tps-auth-page .tps-auth-body { background: var(--tps-neutral-bg) !important; }
.tps-auth-page .tps-auth-wrap { position:relative; z-index:1; }

/* Login / auth ocean + medical decorative background */
#tpsOceanBg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--tps-ocean-gradient);
}
#tpsOceanBg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 12% 18%, rgba(var(--tps-primary-rgb), .14) 0%, transparent 68%),
    radial-gradient(ellipse 50% 40% at 88% 78%, rgba(var(--tps-accent-rgb), .12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 35% at 72% 12%, rgba(26, 127, 212, .08) 0%, transparent 65%);
  pointer-events: none;
}
.tps-auth-med-pattern {
  position: absolute;
  inset: 0;
  opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%230066CC' stroke-width='1.4' opacity='.22'%3E%3Crect x='12' y='24' width='32' height='14' rx='7'/%3E%3Cline x1='28' y1='24' x2='28' y2='38'/%3E%3Cellipse cx='88' cy='36' rx='14' ry='7' transform='rotate(-28 88 36)'/%3E%3Ccircle cx='130' cy='28' r='9'/%3E%3Cline x1='130' y1='22' x2='130' y2='34'/%3E%3Cline x1='124' y1='28' x2='136' y2='28'/%3E%3C/g%3E%3Cpolyline points='8,118 22,118 30,96 40,132 50,108 68,108' fill='none' stroke='%231A7FD4' stroke-width='1.6' opacity='.2'/%3E%3Cpath d='M98 108h10v10h10v-10h10v-10h-10V88h-10v10H98z' fill='%230066CC' opacity='.12'/%3E%3Crect x='118' y='118' width='22' height='22' rx='4' fill='none' stroke='%230066CC' stroke-width='1.2' opacity='.18'/%3E%3Cpath d='M124 128h10M129 123v10' stroke='%230066CC' stroke-width='1.2' opacity='.18'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
}
.tps-auth-med-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.tps-auth-med-icons i {
  position: absolute;
  color: rgba(var(--tps-primary-rgb), .11);
  line-height: 1;
  animation: tps-auth-med-float 9s ease-in-out infinite;
}
.tps-auth-med-icons i:nth-child(odd) { color: rgba(26, 127, 212, .13); }
.tps-auth-med-icons i:nth-child(3n) { animation-duration: 11s; animation-direction: reverse; }
.tps-auth-med-icons i:nth-child(1)  { top: 8%;  left: 6%;   font-size: 2.4rem; transform: rotate(-18deg); }
.tps-auth-med-icons i:nth-child(2)  { top: 14%; right: 8%;  font-size: 3rem;   transform: rotate(12deg); animation-delay: -2s; }
.tps-auth-med-icons i:nth-child(3)  { top: 28%; left: 14%;  font-size: 2rem;   transform: rotate(8deg); animation-delay: -4s; }
.tps-auth-med-icons i:nth-child(4)  { top: 38%; right: 18%; font-size: 2.6rem; transform: rotate(-6deg); animation-delay: -1s; }
.tps-auth-med-icons i:nth-child(5)  { top: 52%; left: 5%;   font-size: 2.8rem; transform: rotate(15deg); animation-delay: -3s; }
.tps-auth-med-icons i:nth-child(6)  { top: 62%; right: 6%;  font-size: 2.2rem; transform: rotate(-12deg); animation-delay: -5s; }
.tps-auth-med-icons i:nth-child(7)  { top: 72%; left: 20%;  font-size: 2.5rem; transform: rotate(5deg); animation-delay: -2.5s; }
.tps-auth-med-icons i:nth-child(8)  { top: 78%; right: 22%; font-size: 3.2rem; transform: rotate(-8deg); animation-delay: -6s; }
.tps-auth-med-icons i:nth-child(9)  { top: 22%; left: 42%;  font-size: 1.8rem; transform: rotate(20deg); animation-delay: -1.5s; }
.tps-auth-med-icons i:nth-child(10) { top: 48%; right: 38%; font-size: 2.1rem; transform: rotate(-15deg); animation-delay: -4.5s; }
.tps-auth-med-icons i:nth-child(11) { top: 86%; left: 38%;  font-size: 2.3rem; transform: rotate(10deg); animation-delay: -3.5s; }
.tps-auth-med-icons i:nth-child(12) { top: 6%;  left: 55%;  font-size: 1.9rem; transform: rotate(-22deg); animation-delay: -7s; }
.tps-auth-med-icons i:nth-child(13) { top: 58%; left: 48%;  font-size: 1.7rem; transform: rotate(6deg); animation-delay: -2.2s; }
.tps-auth-med-icons i:nth-child(14) { top: 32%; right: 42%; font-size: 2rem; transform: rotate(-10deg); animation-delay: -5.5s; }
.tps-auth-med-icons i:nth-child(15) { top: 44%; left: 28%;  font-size: 1.6rem; transform: rotate(14deg); animation-delay: -1.8s; }
.tps-auth-med-icons i:nth-child(16) { top: 68%; right: 48%; font-size: 2.4rem; transform: rotate(-5deg); animation-delay: -4.2s; }
@keyframes tps-auth-med-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
@media (prefers-reduced-motion: reduce) {
  .tps-auth-med-icons i { animation: none; }
}
.tps-auth-page .tps-auth-body.tps-auth-body--ocean { background: transparent !important; }
.tps-auth-page .tps-auth-wrap--center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.tps-auth-page .tps-auth-card--glass {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(247, 251, 255, .96) !important;
  border-radius: 1rem !important;
}
.tps-auth-page .tps-auth-card--glass .card-body { padding: 2rem !important; }
.tps-auth-page .tps-login-header {
  background: linear-gradient(135deg, var(--tps-primary-deep), var(--tps-primary));
  border-radius: .9rem .9rem 0 0;
  padding: 1.4rem 2rem 1.2rem;
}
.tps-auth-page .tps-login-header .bi { font-size: 1.6rem; opacity: .9; }
.tps-auth-page .tps-login-header h1 {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .3);
  font-size: 1.25rem;
}

.tps-auth-page .tps-auth-page-title  { color:var(--tps-secondary-deep); font-weight:700; }
.tps-auth-page .tps-auth-home-link   { color:var(--tps-accent); text-decoration:none; }
.tps-auth-page .tps-auth-home-link:hover { color:var(--tps-secondary-deep); text-decoration:underline; }
.tps-auth-page .tps-auth-secondary-link { color:var(--tps-neutral-muted); }
.tps-auth-page .tps-auth-secondary-link:hover { color:var(--tps-navy); }

.tps-auth-page .card.tps-auth-card { border:1px solid rgba(var(--tps-primary-rgb),.14); border-radius:.75rem; box-shadow:0 .75rem 2.5rem rgba(var(--tps-primary-rgb),.12); overflow:hidden; }
.tps-auth-page .card.tps-auth-card .card-body { background:var(--tps-neutral-surface); color:var(--bs-body-color); }
.tps-auth-page .tps-auth-card .form-label { color:var(--tps-neutral-muted); }
.tps-auth-page .tps-auth-card a:not(.btn) { color:var(--tps-accent); }
.tps-auth-page .tps-auth-card a:not(.btn):hover { color:var(--tps-secondary-deep); }

.tps-cirm-input { background:var(--tps-primary-soft) !important; border:1px solid var(--tps-neutral-line) !important; border-radius:.5rem !important; padding:.6rem .85rem; }
.tps-cirm-input:focus { border-color:var(--tps-accent) !important; box-shadow:0 0 0 .2rem rgba(var(--tps-accent-rgb),.22); }

.tps-site-footer { color:var(--tps-neutral-muted); background:transparent; }
.tps-auth-page .tps-auth-footer { color:#000; text-shadow:none; font-weight:500; }

/* ── Install page ────────────────────────────────────────── */
body.tps-install-page { min-height:100vh; margin:0; background:transparent; color:var(--bs-body-color); font-family:var(--tps-font-stack); font-size:var(--bs-body-font-size); line-height:var(--bs-body-line-height); -webkit-font-smoothing:antialiased; }
body.tps-install-page .tps-install-body { background:rgba(245,248,251,.9); }
body.tps-install-page .tps-install-panel { background:var(--tps-white); border-radius:.5rem; border:1px solid rgba(var(--tps-primary-rgb),.12); box-shadow:var(--tps-card-shadow); padding:2rem; }
body.tps-install-page h1 { color:var(--tps-navy); font-weight:700; }

/* ══════════════════════════════════════════════════
   CIRM-STYLE PORTAL
══════════════════════════════════════════════════ */
body.tps-app-cirm { min-height:100vh; }
body.tps-app-cirm > .tps-contact-ribbon { flex-shrink:0; }

.tps-contact-ribbon { background:linear-gradient(180deg,#0b4f8c 0%,#083a66 100%); border-bottom:3px solid rgba(255,255,255,.35); box-shadow:0 2px 0 rgba(0,0,0,.08); position:relative; }
.tps-contact-ribbon::after { content:""; display:block; height:6px; background:repeating-linear-gradient(90deg,rgba(255,255,255,.12) 0 4px,transparent 4px 8px); opacity:.9; }
.tps-contact-ribbon__link:hover { text-decoration:underline !important; }

.tps-portal-header { flex-shrink:0; box-shadow:0 2px 10px rgba(var(--tps-primary-rgb),.06); }
.tps-cirm-logos-strip { background:linear-gradient(180deg,#f5f9fc 0%,#e8f2f9 100%); border-bottom:1px solid rgba(11,79,140,.12); }
.tps-cirm-logos-strip__inner { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:clamp(.5rem,2vw,1rem); width:100%; min-height:3.25rem; }
.tps-cirm-logo-slot--left  { justify-self:start; }
.tps-cirm-logo-slot--right { justify-self:end; }
.tps-cirm-brand-text { justify-self:center; max-width:min(22rem,88vw); }
.tps-cirm-logo-img { height:auto; width:auto; max-height:clamp(52px,10vw,76px); object-fit:contain; flex-shrink:0; }
.tps-cirm-logo-img--official { max-width:min(200px,38vw); }
.tps-cirm-logo-img--servizi  { max-width:min(240px,48vw); }

@media (max-width:575.98px) {
  .tps-cirm-logos-strip__inner { grid-template-columns:1fr 1fr; grid-template-rows:auto auto; gap:.5rem .75rem; }
  .tps-cirm-logo-slot--left  { grid-column:1; grid-row:1; justify-self:start; }
  .tps-cirm-logo-slot--right { grid-column:2; grid-row:1; justify-self:end; }
  .tps-cirm-brand-text { grid-column:1/-1; grid-row:2; justify-self:center; max-width:100%; }
}

.tps-cirm-brand-name    { font-size:clamp(1.35rem,3.5vw,1.85rem); letter-spacing:-.02em; color:var(--tps-navy); line-height:1.15; }
.tps-cirm-brand-tagline { color:#476985; font-weight:600; margin-top:.15rem; }
.tps-portal-header__title { color:#0b4f8c; font-size:clamp(1.85rem,4.2vw,2.5rem); letter-spacing:-.02em; }

.tps-portal-avatar { width:52px; height:52px; border-radius:.35rem; background:linear-gradient(145deg,#5b8cc9 0%,#2d5a8c 100%); color:#fff; font-weight:700; font-size:1rem; display:flex; align-items:center; justify-content:center; box-shadow:0 2px 8px rgba(11,79,140,.25); border:2px solid rgba(255,255,255,.85); }

.tps-portal-util__link { display:inline-flex; align-items:center; gap:.35rem; font-size:.78rem; font-weight:600; color:var(--tps-neutral-text); text-decoration:none; padding:.25rem .4rem; border-radius:.35rem; }
.tps-portal-util__link:hover { background:#f1f5f9; color:var(--tps-navy); }
.tps-portal-util__link--danger:hover { background:#fef2f2; color:#b91c1c; }
.tps-portal-login-line { border-color:rgba(var(--tps-primary-rgb),.08) !important; }

.tps-portal-tabs { flex-shrink:0; background:linear-gradient(180deg,#dfe8f2 0%,#d2dde9 100%); border-bottom:1px solid rgba(var(--tps-primary-rgb),.12); }
.tps-portal-tabs__scroll { scrollbar-width:thin; }
.tps-portal-tab { padding:.55rem 1rem; border-radius:.4rem .4rem 0 0; color:var(--tps-primary-deep); font-size:.88rem; font-weight:600; border:1px solid transparent; border-bottom:none; margin-bottom:-1px; }
.tps-portal-tab:hover { background:rgba(255,255,255,.55); color:var(--tps-navy); }
.tps-portal-tab.active { background:#fff; color:var(--tps-navy); border-color:rgba(var(--tps-primary-rgb),.12); border-bottom-color:#fff; box-shadow:inset 0 -3px 0 var(--tps-accent); }
.tps-portal-tab i { opacity:.9; color:#0b4f8c; }
.tps-portal-tab.active i { color:var(--tps-accent-hover); }

.tps-ship-chest-strip { flex-shrink:0; background:#f6f9fc; }

body.tps-app-cirm .tps-main-area--cirm { background:var(--tps-shell-bg); overflow:auto; }
body.tps-app-cirm .tps-page-header--cirm .tps-page-title { font-size:clamp(1.05rem,2.2vw,1.35rem); color:var(--tps-navy); }
body.tps-app-cirm .tps-page-title-icon { font-size:1.15rem; }

/* ── Admin / portal shell (clean surfaces) ─────────────── */
.tps-main .card,
.tps-main-area .card {
  background: var(--tps-surface);
  border: 1px solid var(--tps-line) !important;
  border-radius: .625rem;
  box-shadow: var(--tps-card-shadow);
}
.tps-main .card-header,
.tps-main-area .card-header {
  background: var(--tps-secondary-bg) !important;
  color: var(--tps-secondary-deep);
  border-bottom: 1px solid var(--tps-line) !important;
  padding: .65rem 1rem;
}
.tps-main .card-footer {
  background: var(--tps-neutral-muted-bg) !important;
  border-top: 1px solid var(--tps-line) !important;
}
.tps-main .form-control,
.tps-main .form-select,
.tps-main-area .form-control,
.tps-main-area .form-select {
  border-color: var(--tps-line);
  border-radius: .4rem;
  font-size: .875rem;
}
.tps-main .form-control:focus,
.tps-main .form-select:focus,
.tps-main-area .form-control:focus,
.tps-main-area .form-select:focus {
  border-color: var(--tps-primary);
  box-shadow: 0 0 0 .2rem rgba(var(--tps-primary-rgb), .16);
}
.tps-main .table,
.tps-main-area .table {
  --bs-table-striped-bg: rgba(var(--tps-primary-rgb), .04);
  --bs-table-hover-bg: rgba(var(--tps-primary-rgb), .07);
  margin-bottom: 0;
}
.tps-main .table thead th,
.tps-main-area .table thead th {
  background: var(--tps-secondary-bg) !important;
  color: var(--tps-secondary-deep);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--tps-line) !important;
  white-space: nowrap;
}
.tps-main .table tbody td,
.tps-main-area .table tbody td {
  border-color: var(--tps-line);
  vertical-align: middle;
}
.tps-main .btn-primary,
.tps-main-area .btn-primary {
  background-color: var(--tps-primary);
  border-color: var(--tps-primary-hover);
}
.tps-main .btn-primary:hover,
.tps-main-area .btn-primary:hover {
  background-color: var(--tps-primary-hover);
  border-color: var(--tps-primary-deep);
}
.tps-main .btn-outline-secondary,
.tps-main-area .btn-outline-secondary {
  border-color: var(--tps-line);
  color: var(--tps-secondary-deep);
}
.tps-main .text-primary,
.tps-main-area .text-primary {
  color: var(--tps-accent) !important;
}
.tps-med-card .btn-link.text-success,
.tps-med-table .btn-link.text-success {
  color: var(--tps-accent) !important;
}

/* ── Pharmacy inventory table (simple, full-width) ───────── */
.tps-med-card {
  border-radius: .5rem;
  max-width: 100%;
  min-width: 0;
  background: var(--tps-neutral-surface);
  border: 1px solid var(--tps-neutral-line) !important;
}
.tps-med-toolbar {
  border-color: var(--tps-neutral-line) !important;
  background: var(--tps-primary-soft) !important;
}
.tps-med-card .card-header.tps-med-toolbar.bg-white,
.tps-med-card .card-header.tps-med-toolbar {
  background: var(--tps-primary-soft) !important;
}
.tps-med-card .card-footer,
.tps-med-card .card-footer.bg-white {
  background: var(--tps-neutral-surface) !important;
  border-color: var(--tps-neutral-line) !important;
}
.tps-flag-emoji { font-size: 1.35rem; line-height: 1; }
.tps-med-btn-refresh,
.tps-med-btn-xls {
  width: 2.15rem;
  height: 2.15rem;
  flex-shrink: 0;
}
.tps-med-btn-refresh {
  background: var(--tps-success) !important;
  border: none !important;
}
.tps-med-btn-refresh:hover { background: var(--tps-success-hover) !important; }
.tps-med-btn-xls {
  background: #fff !important;
  border-color: var(--tps-success) !important;
  color: var(--tps-success) !important;
}
.tps-med-btn-xls:hover {
  background: rgba(40, 167, 69, .1) !important;
  color: var(--tps-success-hover) !important;
}
.tps-med-table-scroll,
.tps-med-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tps-med-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: .7rem;
  margin-bottom: 0;
  border-collapse: collapse;
  --tps-med-grid: #b8c8d4;
  --bs-table-striped-bg: #fff;
  --bs-table-hover-bg: rgba(var(--tps-primary-rgb), .06);
  --bs-table-bg: #fff;
  background: #fff;
}
.tps-med-table col.tps-med-col-id { width: 2.4rem; }
.tps-med-table col.tps-med-col-principle { width: 10%; }
.tps-med-table col.tps-med-col-form { width: 10%; }
.tps-med-table col.tps-med-col-atc { width: 6.5%; }
.tps-med-table col.tps-med-col-ship,
.tps-med-table col.med-col-ship,
.tps-med-table col.dev-col-ship,
.tps-med-table col.ci-col-ship { width: 0; }
.tps-med-table col.tps-med-col-ship:not(.d-none),
.tps-med-table col.med-col-ship:not(.d-none),
.tps-med-table col.dev-col-ship:not(.d-none),
.tps-med-table col.ci-col-ship:not(.d-none) { width: 7%; }
.tps-med-table col.tps-med-col-code { width: 3.75rem; }
.tps-med-table col.tps-med-col-num { width: 3.5rem; }
.tps-med-table col.tps-med-col-onboard { width: 3.85rem; }
.tps-med-table col.tps-dev-col-qty { width: 3.5rem; }
.tps-med-table col.tps-dev-col-exp { width: 6.5%; }
.tps-med-table col.tps-med-col-batch { width: 11.5%; }
.tps-med-table col.tps-med-col-loc { width: 7.5%; }
.tps-med-table col.tps-med-col-notes { width: 13%; }
.tps-med-table col.tps-med-col-cirm { width: 4.5%; }
.tps-med-table col.tps-med-col-act { width: 1.75rem; }
.tps-med-table--no-cirm col.tps-med-col-notes { width: 17.5%; }
.tps-med-table--no-cirm col.tps-med-col-loc { width: 8.5%; }
.tps-med-table--no-cirm col.tps-med-col-batch { width: 12.5%; }
.tps-med-table--no-cirm col.tps-med-col-principle { width: 12%; }
.tps-med-table > :not(caption) > * > * {
  border: 1px solid var(--tps-med-grid) !important;
}
.tps-med-table thead th {
  font-size: .625rem;
  font-weight: 600;
  padding: .38rem .28rem;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  color: #2c3e50;
  background: #e9ecef !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.tps-med-table thead th.tps-med-th-wrap {
  white-space: normal;
  word-break: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.15;
  hyphens: none;
  font-size: .6rem;
}
.tps-main .tps-med-table thead th,
.tps-main-area .tps-med-table thead th {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none !important;
  letter-spacing: 0 !important;
  background: #e9ecef !important;
  color: #2c3e50;
}
.tps-main .tps-med-table thead th.tps-med-th-wrap,
.tps-main-area .tps-med-table thead th.tps-med-th-wrap {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.tps-med-table tbody td {
  padding: .32rem .28rem;
  vertical-align: middle;
  color: var(--tps-neutral-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #fff;
}
.tps-med-table.table-striped > tbody > tr:nth-of-type(even) > * {
  --bs-table-bg-type: #f8fafb;
  background-color: #f8fafb;
}
.tps-med-table.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: rgba(var(--tps-primary-rgb), .06);
}
.tps-med-table tbody td.tps-med-col-notes,
.tps-med-table tbody td.tps-med-col-cirm {
  white-space: normal;
  vertical-align: top;
  overflow: hidden;
}
.tps-med-cell-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  line-height: 1.35;
}
.tps-med-cell-clamp--notes {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}
.tps-med-table thead th.tps-med-col-id,
.tps-med-table tbody td.tps-med-col-id {
  width: 1.2rem;
  min-width: 1.2rem;
  max-width: 1.2rem;
  padding-left: .08rem !important;
  padding-right: .08rem !important;
  text-align: center;
}
.tps-med-table thead th.tps-med-col-id {
  font-size: .58rem;
}
.tps-med-table tbody .tps-med-col-id {
  font-size: .65rem;
  color: var(--tps-neutral-muted);
}
.tps-med-table thead th.tps-med-col-num,
.tps-med-table tbody td.tps-med-col-num,
.tps-med-table thead th.tps-med-col-onboard,
.tps-med-table tbody td.tps-med-col-onboard {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tps-med-table thead th.tps-med-col-atc,
.tps-med-table tbody td.tps-med-col-atc {
  width: 6.5%;
  min-width: 4.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tps-med-table thead th.tps-med-col-code,
.tps-med-table tbody td.tps-med-col-code {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pharmacy category view (Medicines / Equipments): tighter Id & code, wider name */
.tps-pharm-category-view .tps-med-table col.tps-med-col-id { width: 1.5rem; }
.tps-pharm-category-view .tps-med-table col.tps-med-col-code { width: 2.25rem; }
.tps-pharm-category-view .tps-med-table col.tps-med-col-principle { width: 15%; }
.tps-pharm-category-view .tps-med-table thead th.tps-med-col-id,
.tps-pharm-category-view .tps-med-table tbody td.tps-med-col-id {
  width: 1rem;
  min-width: 1rem;
  max-width: 1rem;
}
.tps-pharm-category-view .tps-med-table thead th.tps-med-col-code,
.tps-pharm-category-view .tps-med-table tbody td.tps-med-col-code {
  max-width: 2.25rem;
}
.tps-pharm-category-view .tps-med-table thead th.tps-med-col-principle,
.tps-pharm-category-view .tps-med-table tbody td.tps-med-col-principle {
  min-width: 8rem;
}

/* Pharmacy inventory filters: category + A–Z */
.pharm-inv-filter-bar {
  background: var(--tps-neutral-surface, #F7FBFF);
  border-left: 1px solid var(--tps-neutral-line, #E2E8F0);
  border-right: 1px solid var(--tps-neutral-line, #E2E8F0);
  border-bottom: 1px solid var(--tps-neutral-line, #E2E8F0);
  padding: .45rem .55rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .75rem;
}
.pharm-inv-filter-bar--inline {
  border: 1px solid var(--tps-neutral-line, #E2E8F0);
  border-radius: .5rem;
  margin-bottom: .5rem;
}
.pharm-inv-filter-bar__group {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex-shrink: 0;
}
.pharm-inv-filter-bar__group label,
.pharm-alpha-bar__label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--tps-secondary-dark, #1A7FD4);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0;
  white-space: nowrap;
}
.pharm-inv-filter-bar__group select {
  border: 1px solid var(--tps-neutral-line, #B8D9F0);
  border-radius: .375rem;
  padding: .32rem .7rem;
  font-size: .845rem;
  color: var(--tps-neutral-text, #2C3E50);
  background: #fff;
  min-width: 200px;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.pharm-inv-filter-bar__group select:focus {
  border-color: var(--tps-accent);
  box-shadow: 0 0 0 .2rem rgba(var(--tps-primary-rgb, 0, 102, 204), .16);
  outline: none;
}
.pharm-alpha-bar {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex: 1;
  min-width: 0;
}
.pharm-alpha-bar__letters {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  min-width: 0;
}
.pharm-alpha-btn {
  border: 1px solid var(--tps-neutral-line, #B8D9F0);
  background: #fff;
  color: var(--tps-neutral-text, #2C3E50);
  border-radius: .3rem;
  padding: .12rem .38rem;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.35;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.pharm-alpha-btn:hover {
  border-color: var(--tps-accent);
  color: var(--tps-accent);
}
.pharm-alpha-btn.active {
  background: var(--tps-accent);
  border-color: var(--tps-accent);
  color: #fff;
}

/* Equipments table: narrow qty columns, wider expiry & C.I.R.M. notes */
#devTable col.tps-med-col-num { width: 2.35rem; }
#devTable col.tps-med-col-onboard { width: 2.55rem; }
#devTable col.tps-dev-col-qty { width: 2.35rem; }
#devTable col.tps-dev-col-exp { width: 10%; }
#devTable col.tps-med-col-cirm { width: 10%; }
#devTable thead th.tps-med-col-num,
#devTable tbody td.tps-med-col-num,
#devTable thead th.tps-med-col-onboard,
#devTable tbody td.tps-med-col-onboard,
#devTable thead th.tps-dev-col-qty,
#devTable tbody td.tps-dev-col-qty {
  max-width: 2.75rem;
  padding-left: .12rem !important;
  padding-right: .12rem !important;
}
#devTable thead th.tps-dev-col-exp,
#devTable tbody td.tps-dev-col-exp {
  min-width: 6.25rem;
}
#devTable thead th.tps-med-col-cirm,
#devTable tbody td.tps-med-col-cirm {
  min-width: 7rem;
}

.tps-med-table .tps-med-col-onboard { white-space: nowrap; }
.tps-med-table tbody td.tps-med-col-loc {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tps-med-table .tps-med-col-cirm { text-align: left; }
.tps-med-table thead th.tps-med-col-act,
.tps-med-table tbody td.tps-med-col-act {
  width: 1.75rem;
  min-width: 1.75rem;
  max-width: 1.75rem;
  padding-left: .2rem !important;
  padding-right: .2rem !important;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}
.tps-med-table tbody td.tps-med-col-act .btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  overflow: visible;
}
.tps-med-table .tps-med-col-principle,
.tps-med-table .tps-med-col-form {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tps-med-table tbody td.tps-med-col-batch {
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  line-height: 1.35;
  vertical-align: top;
  padding-top: .35rem;
  padding-bottom: .35rem;
}
.tps-med-table .btn-link {
  font-size: inherit;
  padding: 0 !important;
  vertical-align: baseline;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}
.tps-med-table .btn-link.tps-med-open,
.tps-med-table .tps-med-link {
  color: var(--tps-primary);
  text-decoration: none;
  font-weight: 600;
}
.tps-med-table .btn-link.tps-med-open:hover,
.tps-med-table .tps-med-link:hover {
  color: var(--tps-primary-deep);
  text-decoration: underline;
}
.tps-med-qty-alert {
  background-color: #c82333 !important;
  color: #fff !important;
  font-weight: 700;
}
.tps-med-table .tps-med-col-act .btn-link.text-warning { color: var(--tps-warning) !important; }
.tps-med-batch-cell {
  font-size: inherit;
  line-height: 1.35;
  white-space: normal;
  min-width: 0;
}
.tps-med-batch-cell .tps-med-batch-add-row {
  text-align: right;
  margin-bottom: .15rem;
}
.tps-med-batch-cell .tps-med-batch-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  padding: .2rem 0;
  border-bottom: 1px solid rgba(var(--tps-primary-rgb), .08);
  min-width: 0;
}
.tps-med-batch-cell .tps-med-batch-line:last-child { border-bottom: none; }
.tps-med-batch-cell .tps-med-batch-line__qty {
  flex: 1 1 auto;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.tps-med-batch-cell .tps-med-batch-line__actions {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  flex-shrink: 0;
}
.tps-med-batch-cell .btn-link {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  padding: .1rem !important;
  max-width: none;
  overflow: visible;
}
.tps-med-batch-cell .btn-link.text-primary { color: var(--tps-primary) !important; }
.tps-maintab-body {
  overflow-x: hidden;
  max-width: 100%;
  padding: .75rem !important;
  background: var(--tps-neutral-surface);
  border-color: var(--tps-neutral-line);
}
.tps-maintab-body .tps-med-card {
  width: 100%;
}
.tps-maintab-body .tps-med-table-scroll {
  overflow-x: auto;
}

/* ── Checklist ────────────────────────────────────────────── */
.tps-chk-table { --tps-chk-rule:rgba(var(--tps-primary-rgb),.12); border-collapse:collapse; font-size:.9375rem; }
.tps-chk-table thead th { font-weight:600; color:var(--tps-navy,#002147); padding:.9rem 1rem; border:none; border-bottom:1px solid var(--tps-chk-rule); background:transparent; }
.tps-chk-table tbody td { padding:.9rem 1rem; border:none; border-bottom:1px solid var(--tps-chk-rule); vertical-align:middle; }
.tps-chk-table tbody tr:last-child td { border-bottom:1px solid var(--tps-chk-rule); }

.tps-chk-modal__header { background:var(--tps-navy,#002147) !important; flex-shrink:0; }
.tps-chk-modal__sheet  { --tps-chk-sheet-border:rgba(var(--tps-primary-rgb),.08); border-color:var(--tps-chk-sheet-border) !important; box-shadow:0 .125rem .75rem rgba(var(--tps-primary-rgb),.06) !important; }
.tps-chk-modal__qa-wrap { min-height:0; }
.tps-chk-modal__review-bar { position:sticky; top:0; z-index:6; background:var(--tps-primary-bg); flex-shrink:0; }

.tps-chk-modal--report .tps-chk-modal__meta { background:#f8f9fb !important; }
.tps-chk-modal--report.tps-chk-modal--readonly .form-control:read-only,
.tps-chk-modal--report.tps-chk-modal--readonly .form-select:disabled { background:#fff !important; border-color:rgba(var(--tps-primary-rgb),.12); color:var(--bs-body-color); }

.tps-chk-modal--report .tps-chk-report-answer { display:inline-flex; align-items:center; justify-content:center; min-width:3.25rem; padding:.28rem .75rem; border-radius:2rem; font-size:.8125rem; font-weight:700; letter-spacing:.03em; line-height:1.2; white-space:nowrap; box-shadow:0 1px 0 rgba(var(--tps-primary-rgb),.06); }
.tps-chk-modal--report .tps-chk-report-answer--yes { background:rgba(25,135,84,.14); color:#0f5132; border:1px solid rgba(25,135,84,.35); }
.tps-chk-modal--report .tps-chk-report-answer--no  { background:rgba(220,53,69,.12);  color:#842029; border:1px solid rgba(220,53,69,.35); }
.tps-chk-modal--report .tps-chk-report-answer--na  { background:rgba(108,117,125,.12); color:#495057; border:1px solid rgba(108,117,125,.28); }
.tps-chk-modal--report .tps-chk-modal__yn-table tbody tr:nth-child(even) { background:rgba(var(--tps-primary-rgb),.04); }
.tps-chk-modal__yn-answer { min-width:4rem; }
#chkModalSummaryStrip { flex-shrink:0; }

.tps-chk-editor-page .tps-chk-editor-shell { max-width:1200px; margin-left:auto; margin-right:auto; }
body.tps-app .tps-chk-editor-page .card-footer { position:sticky; bottom:0; z-index:1010; box-shadow:0 -.35rem 1rem rgba(var(--tps-primary-rgb),.08); }
.tps-chk-editor__qa { min-height:40vh; }
#chkPageEditor .tps-chk-modal__header { border-radius:0; }

.tps-chk-report-page .tps-chk-report-freetext { color:#6f42c1; font-style:italic; font-size:.9rem; }
.tps-chk-modal--readonly .form-check-input:disabled { opacity:1 !important; }
.tps-chk-modal--readonly .form-check-input[type="radio"]:disabled:checked    { background-color:var(--bs-primary); border-color:var(--bs-primary); }
.tps-chk-modal--readonly .form-check-input[type="checkbox"]:disabled:checked { background-color:var(--bs-primary); border-color:var(--bs-primary); }

.tps-chk-modal__grid { --tps-chk-muted:#5c6c7d; width:100%; border-collapse:separate; border-spacing:0; font-size:.9375rem; }
.tps-chk-modal__grid td,
.tps-chk-modal__grid th { border:none; vertical-align:middle; }

.tps-chk-modal__section .tps-chk-modal__section-num   { background:var(--tps-navy,#002147) !important; color:#fff; font-weight:700; white-space:nowrap; width:3.5rem; padding:.75rem .85rem; border:none; }
.tps-chk-modal__section .tps-chk-modal__section-title { background:var(--tps-navy,#002147) !important; color:#fff; font-weight:600; letter-spacing:.02em; padding:.75rem 1rem .75rem 0; border:none; }
.tps-chk-modal__part + .tps-chk-modal__part > tr.tps-chk-modal__section > td { box-shadow:0 -.625rem 0 0 var(--bs-secondary-bg,#e9ecef); }

.tps-chk-modal__subsection .tps-chk-modal__q-num    { color:var(--tps-navy,#002147); font-weight:400; font-size:.8125rem; width:3.5rem; padding:.85rem .85rem .5rem; vertical-align:top; background:rgba(var(--tps-primary-rgb),.04); border-bottom:1px solid rgba(var(--tps-primary-rgb),.06); }
.tps-chk-modal__subsection .tps-chk-modal__q-prompt { font-weight:400; line-height:1.45; padding:.85rem 1rem .5rem 0; vertical-align:top; background:rgba(var(--tps-primary-rgb),.04); border-bottom:1px solid rgba(var(--tps-primary-rgb),.06); }
.tps-chk-modal__subsection--with-yn .tps-chk-modal__q-num    { vertical-align:middle; padding-top:.75rem; padding-bottom:.75rem; }
.tps-chk-modal__subsection--with-yn .tps-chk-modal__q-prompt { vertical-align:middle; padding:.75rem 1rem .75rem 0; }
.tps-chk-modal__yn-inline-cell { width:1%; white-space:nowrap; vertical-align:middle; text-align:right; background:rgba(var(--tps-primary-rgb),.03); border-bottom:1px solid rgba(var(--tps-primary-rgb),.06); padding:.5rem .85rem; }
.tps-chk-modal__yn-row--inline .form-check-label { font-weight:500; }

.tps-chk-modal__merged-follow-inner { padding:.5rem .85rem .85rem; background:#fff; border-bottom:1px solid rgba(var(--tps-primary-rgb),.08); }
.tps-chk-modal__merged-follow-inner > .form-label:first-child { margin-top:0 !important; }
.tps-chk-modal__paragraph-with-yn .tps-chk-modal__para-cell { background:rgba(var(--tps-primary-rgb),.02); border-bottom:1px solid rgba(var(--tps-primary-rgb),.06); padding:.65rem 1rem .65rem .85rem; vertical-align:middle; }

.tps-chk-modal__block .tps-chk-modal__block-inner { padding:.5rem 0 1rem 0; border-bottom:1px solid rgba(var(--tps-primary-rgb),.08); }
.tps-chk-modal__block--table .tps-chk-modal__block-inner { padding-top:.35rem; padding-bottom:1rem; }
.tps-chk-modal__yn-row .form-check-label { font-size:.9375rem; padding-top:.1rem; }

.tps-chk-modal__subhead-tr .tps-chk-modal__subhead-cell { padding:1.25rem 0 .35rem; border-bottom:none; }
.tps-chk-modal__subhead    { font-size:1rem; font-weight:700; color:var(--tps-navy,#002147); }
.tps-chk-modal__subhead-sm { font-size:.9375rem; font-weight:700; color:var(--tps-navy,#002147); }
.tps-chk-modal__para-tr .tps-chk-modal__para-cell { padding:.35rem 0 0; }
.tps-chk-modal__para { font-size:.9375rem; font-weight:400; color:var(--tps-chk-muted,#5c6c7d); line-height:1.5; }

.tps-chk-modal__yn-table { --bs-table-bg:transparent; border:1px solid rgba(var(--tps-primary-rgb),.1); border-radius:.375rem; overflow:hidden; }
.tps-chk-modal__yn-table tbody tr + tr th,
.tps-chk-modal__yn-table tbody tr + tr td { border-top:1px solid rgba(var(--tps-primary-rgb),.08); }
.tps-chk-modal__yn-label { font-weight:400; padding:.55rem .85rem; background:rgba(var(--tps-primary-rgb),.03); }
.tps-chk-modal__yn-cell  { text-align:center; width:4.5rem; padding:.45rem .5rem; background:#fff; }

.tps-chk-modal--report .tps-chk-modal__yn-row--report { min-height:2.35rem; padding:.15rem 0; }
.tps-chk-modal--report .tps-chk-modal__block .tps-chk-modal__block-inner { padding:.35rem 0 .75rem; }
.tps-chk-modal--report tr.tps-chk-modal__subsection + tr.tps-chk-modal__block .tps-chk-modal__block-inner { padding-top:.35rem; margin-top:0; border-top:1px solid rgba(var(--tps-primary-rgb),.07); }
.tps-chk-modal--report tr.tps-chk-modal__subsection + tr.tps-chk-modal__block--table .tps-chk-modal__block-inner { border-top:none; }
.tps-chk-modal--report .tps-chk-modal__subsection .tps-chk-modal__q-num,
.tps-chk-modal--report .tps-chk-modal__subsection .tps-chk-modal__q-prompt { padding-top:.65rem; padding-bottom:.45rem; }
.tps-chk-modal--report .tps-chk-modal__block--table .tps-chk-modal__block-inner { padding-top:.5rem; border-top:none; }
.tps-chk-modal--report .tps-chk-modal__block-inner .form-label.small { margin-top:.65rem; margin-bottom:.2rem; font-weight:600; color:var(--tps-neutral-muted); }
.tps-chk-modal--report .tps-chk-report-freetext--block { color:var(--bs-body-color); font-style:normal; font-weight:500; font-size:.9rem; padding:.4rem .85rem; background:rgba(var(--tps-primary-rgb),.035); border:1px solid rgba(var(--tps-primary-rgb),.1); border-radius:.4rem; text-align:right; }
.tps-chk-report-sheet.tps-chk-modal--report { border:1px solid rgba(var(--tps-primary-rgb),.16) !important; box-shadow:0 .35rem 1.15rem rgba(var(--tps-primary-rgb),.08) !important; }
.tps-chk-modal--report .tps-chk-modal__yn-table { border-color:rgba(var(--tps-primary-rgb),.12); box-shadow:0 1px 3px rgba(var(--tps-primary-rgb),.05); }
.tps-chk-modal--report .tps-chk-modal__yn-answer .tps-chk-report-answer { margin-left:auto; }

/* ── Fresh checklist question layout ──────────────────────── */
.chk-sheet { overflow:hidden; }
.chk-section { border-bottom:2px solid rgba(var(--tps-primary-rgb),.08); }
.chk-section:last-child { border-bottom:none; }
.chk-section-hdr { display:flex; align-items:center; gap:.75rem; background:var(--tps-navy,#002147); color:#fff; font-weight:600; font-size:.9375rem; letter-spacing:.02em; padding:.7rem 1rem; }
.chk-section-num { font-weight:700; flex-shrink:0; min-width:2.5rem; }

.chk-qrow { display:flex; align-items:center; gap:.5rem; padding:.7rem 1rem; border-bottom:1px solid rgba(var(--tps-primary-rgb),.06); background:rgba(var(--tps-primary-rgb),.02); }
.chk-qrow:nth-child(even) { background:#fff; }
.chk-qrow:last-child { border-bottom:none; }
.chk-qrow--indent { padding-left:2rem; background:#fff; }
.chk-qrow--indent:nth-child(even) { background:rgba(var(--tps-primary-rgb),.02); }
.chk-qrow--para .chk-qtext { font-style:italic; color:#5c6c7d; font-size:.875rem; }

.chk-qnum  { flex-shrink:0; width:2.75rem; font-size:.78rem; font-weight:500; color:#6c757d; }
.chk-qtext { flex:1; font-size:.9rem; font-weight:400; line-height:1.45; }
.chk-qtext--note { color:#5c6c7d; font-style:italic; }

.chk-yn-pair { display:flex; align-items:center; gap:.5rem; flex-shrink:0; white-space:nowrap; }
.chk-yn-lbl  { display:inline-flex; align-items:center; gap:.3rem; font-size:.85rem; font-weight:500; cursor:pointer; padding:.25rem .5rem; border-radius:.3rem; border:1px solid rgba(var(--tps-primary-rgb),.15); background:#fff; transition:background .12s,border-color .12s; user-select:none; }
.chk-yn-lbl:has(input:checked) { background:rgba(var(--tps-primary-rgb),.08); border-color:var(--tps-navy,#002147); }
.chk-yn-radio { accent-color:var(--tps-navy,#002147); }
.chk-yn-pair-empty { width:6rem; flex-shrink:0; }

.chk-tyn-group { border-top:1px solid rgba(var(--tps-primary-rgb),.06); }
.chk-tyn-group .chk-qrow:first-child { border-top:none; }

.chk-subhead { padding:.85rem 1rem .35rem; font-weight:700; color:var(--tps-navy,#002147); }
.chk-subhead--lv4,
.chk-subhead--lv5,
.chk-subhead--lv6 { font-size:.9rem; font-weight:600; padding-top:.65rem; padding-bottom:.2rem; }

.chk-qnote { padding:.45rem 1rem .45rem 3.75rem; font-size:.875rem; color:#5c6c7d; font-style:italic; border-bottom:1px solid rgba(var(--tps-primary-rgb),.05); }

.chk-pill { display:inline-flex; align-items:center; justify-content:center; min-width:3.25rem; padding:.25rem .75rem; border-radius:2rem; font-size:.8rem; font-weight:700; letter-spacing:.03em; white-space:nowrap; border:1px solid transparent; }
.chk-pill--yes { background:rgba(25,135,84,.14); color:#0f5132; border-color:rgba(25,135,84,.35); }
.chk-pill--no  { background:rgba(220,53,69,.12);  color:#842029; border-color:rgba(220,53,69,.35); }
.chk-pill--na  { background:rgba(108,117,125,.12); color:#495057; border-color:rgba(108,117,125,.28); }