/* =====================================================
   SOFIA P2P - Custom Styles (Tailwind Supplement)
   ===================================================== */

/* Full-height root so the proportional UI-scale layer
   (partials/_ui_scale.html) can size <html> to fill the viewport exactly
   under CSS zoom — the app shell uses h-full (100%) off this. */
html, body { height: 100%; }

/* =====================================================
   THEME PALETTES  — the brand color is var-backed (see tailwind.config.js).
   Switching <html data-theme="..."> re-colors every sky and primary utility
   plus the brand hex below instantly. Values are Tailwind palette RGB triples.
   Semantic colors (emerald/rose/amber) are intentionally NOT themed.
   ===================================================== */
:root, [data-theme="sky"] {
  --sky-50:240 249 255; --sky-100:224 242 254; --sky-200:186 230 253; --sky-300:125 211 252; --sky-400:56 189 248; --sky-500:14 165 233; --sky-600:2 132 199; --sky-700:3 105 161; --sky-800:7 89 133; --sky-900:12 74 110; --sky-950:8 47 73;
}
[data-theme="orange"] {
  --sky-50:255 247 237; --sky-100:255 237 213; --sky-200:254 215 170; --sky-300:253 186 116; --sky-400:251 146 60; --sky-500:249 115 22; --sky-600:234 88 12; --sky-700:194 65 12; --sky-800:154 52 18; --sky-900:124 45 18; --sky-950:67 20 7;
}
[data-theme="emerald"] {
  --sky-50:236 253 245; --sky-100:209 250 229; --sky-200:167 243 208; --sky-300:110 231 183; --sky-400:52 211 153; --sky-500:16 185 129; --sky-600:5 150 105; --sky-700:4 120 87; --sky-800:6 95 70; --sky-900:6 78 59; --sky-950:2 44 34;
}
[data-theme="rose"] {
  --sky-50:255 241 242; --sky-100:255 228 230; --sky-200:254 205 211; --sky-300:253 164 175; --sky-400:251 113 133; --sky-500:244 63 94; --sky-600:225 29 72; --sky-700:190 18 60; --sky-800:159 18 57; --sky-900:136 19 55; --sky-950:76 5 25;
}
[data-theme="violet"] {
  --sky-50:245 243 255; --sky-100:237 233 254; --sky-200:221 214 254; --sky-300:196 181 253; --sky-400:167 139 250; --sky-500:139 92 246; --sky-600:124 58 237; --sky-700:109 40 217; --sky-800:91 33 182; --sky-900:76 29 149; --sky-950:46 16 101;
}
[data-theme="amber"] {
  --sky-50:255 251 235; --sky-100:254 243 199; --sky-200:253 230 138; --sky-300:252 211 77; --sky-400:251 191 36; --sky-500:245 158 11; --sky-600:217 119 6; --sky-700:180 83 9; --sky-800:146 64 14; --sky-900:120 53 15; --sky-950:69 26 3;
}
[data-theme="teal"] {
  --sky-50:240 253 250; --sky-100:204 251 241; --sky-200:153 246 228; --sky-300:94 234 212; --sky-400:45 212 191; --sky-500:20 184 166; --sky-600:13 148 136; --sky-700:15 118 110; --sky-800:17 94 89; --sky-900:19 78 74; --sky-950:4 47 46;
}
[data-theme="slate"] {
  --sky-50:248 250 252; --sky-100:241 245 249; --sky-200:226 232 240; --sky-300:203 213 225; --sky-400:148 163 184; --sky-500:100 116 139; --sky-600:71 85 105; --sky-700:51 65 85; --sky-800:30 41 59; --sky-900:15 23 42; --sky-950:2 6 23;
}

/* Workspace / Split View */
.workspace { flex: 1 1 0%; min-height: 0; display: flex; gap: 0.5rem; }
.workspace-left { width: 360px; min-width: 260px; display: flex; flex-direction: column; min-height: 0; }
.workspace-right { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.workspace > .pane { height: 100%; display: flex; flex-direction: column; min-height: 0; }
@media (max-width: 1024px) {
  .workspace { flex-direction: column; }
  .workspace-left { width: 100%; height: auto; max-height: 45vh; }
  .workspace-right { width: 100%; height: auto; max-height: 50vh; }
  .workspace > .pane { height: auto; max-height: 55vh; }
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: #D1D5DB; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: #9CA3AF; }
* { scrollbar-width: thin; scrollbar-color: #D1D5DB transparent; }
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background-color: #D1D5DB; border-radius: 20px; border: 0; background-clip: padding-box; }

/* Toast — top-center, solid colored fill for high-contrast scannability.
   Earlier the toast was a white card with a thin colored left border in the
   top-right corner; users reported it was easy to miss. The redesign:
   • Anchored at top-center (centre of attention, away from CRUD controls).
   • Solid colored background + white text + drop-shadow + light pulse on entry.
   • Larger icon chip with semi-transparent white tint to stay legible. */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast-container > * { pointer-events: auto; }
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 340px;
  max-width: 560px;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: #FFFFFF;
  background: #475569;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35),
              0 0 0 1px rgba(255,255,255,0.06) inset;
  animation: toastDrop 0.4s cubic-bezier(0.22, 1, 0.36, 1),
             toastPulse 0.9s ease 0.4s 1;
}
.toast .toast-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 21px;
  background: rgba(255,255,255,0.22);
  color: #FFFFFF;
  border: 1px solid rgba(255,255,255,0.25);
}
.toast .toast-msg {
  flex: 1;
  line-height: 1.4;
  text-shadow: 0 1px 1px rgba(0,0,0,0.18);
}
.toast.success { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.toast.error   { background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%); }
.toast.info    { background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%); }
.toast.warning { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); }
.toast ion-icon { font-size: 21px; flex-shrink: 0; }
@keyframes toastDrop {
  from { transform: translateY(-40px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0)     scale(1);     opacity: 1; }
}
@keyframes toastPulse {
  0%   { box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35), 0 0 0 0 rgba(255,255,255,0.55); }
  60%  { box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35), 0 0 0 12px rgba(255,255,255,0); }
  100% { box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35), 0 0 0 0 rgba(255,255,255,0); }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}
.loading-overlay.show { display: flex; }
.loading-box {
  background: #fff;
  border-radius: 16px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
  animation: loadingPop 0.25s ease;
}
@keyframes loadingPop {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #E5E7EB;
  border-top-color: rgb(var(--sky-600));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

/* Search Dropdown */
.search-dropdown { position: relative; }
.search-dropdown-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #E5E7EB; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); max-height: 240px; overflow-y: auto; z-index: 100; margin-top: 4px; display: none; }
.search-dropdown-results.show { display: block; }
.search-dropdown-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #F3F4F6; font-size: 13px; }
.search-dropdown-item:hover { background: #F9FAFB; }
.search-dropdown-item:last-child { border-bottom: none; }

/* Spinner */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); width: 90%; max-width: 600px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }

/* Login blobs */
@keyframes blob { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, -30px) scale(1.08); } 66% { transform: translate(-25px, 25px) scale(0.94); } }
.blob { animation: blob 18s ease-in-out infinite; }
.blob.delay-2 { animation-delay: -6s; }
.blob.delay-3 { animation-delay: -12s; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-10px) rotate(-2deg); } }
.floaty { animation: floaty 6s ease-in-out infinite; }
.bg-grid { background-image: linear-gradient(to right, rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 36px 36px; }

/* App section visibility */
.app-section.hidden { display: none !important; }

/* Alpine — hide x-cloak elements until Alpine initialises */
[x-cloak] { display: none !important; }
#login-screen.hidden { display: none !important; }
#app-shell.hidden { display: none !important; }

/* Form focus ring override for consistency */
input:focus, select:focus, textarea:focus { outline: none; }

/* =====================================================
   NAVIGATION GROUPS
   ===================================================== */
.nav-group-toggle { position: relative; }
.nav-group-toggle.active { background: rgb(var(--sky-50)); color: rgb(var(--sky-700)); }

/* Sidebar nav item — active highlight is synced by app.js syncActiveNav() */
.nav-item { border-left: 2px solid transparent; transition: background 0.12s ease, color 0.12s ease; }
.nav-item:hover { background: #F9FAFB; }
.nav-item.active { background: rgb(var(--sky-50)); color: rgb(var(--sky-700)); border-left-color: rgb(var(--sky-600)); font-weight: 600; }
.nav-item.active ion-icon { color: rgb(var(--sky-600)); }

/* =====================================================
   MASTER PAGES - 2026 Design System
   ===================================================== */

/* Master list card */
.master-card { transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1); border-left: 3px solid transparent; }
.master-card:hover { background: #F9FAFB; transform: translateX(3px); box-shadow: 0 4px 12px rgba(0,0,0,0.04); }
.master-card.active { background: rgb(var(--sky-50)); border-left-color: rgb(var(--sky-600)); box-shadow: 0 2px 8px rgb(var(--sky-600) / 0.10); }

/* Master avatar - gradient circle with initial (high contrast) */
.master-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; flex-shrink: 0; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.master-avatar-orange { background: linear-gradient(135deg, rgb(var(--sky-500)), rgb(var(--sky-600))); }
.master-avatar-blue { background: linear-gradient(135deg, #3B82F6, #2563EB); }
.master-avatar-green { background: linear-gradient(135deg, #10B981, #059669); }
.master-avatar-purple { background: linear-gradient(135deg, #A78BFA, #7C3AED); }
.master-avatar-pink { background: linear-gradient(135deg, #F472B6, #DB2777); }
.master-avatar-teal { background: linear-gradient(135deg, #14B8A6, #0D9488); }
.master-avatar-amber { background: linear-gradient(135deg, #F59E0B, #D97706); }
.master-avatar-rose { background: linear-gradient(135deg, #FB7185, #BE123C); }
.master-avatar-cyan { background: linear-gradient(135deg, #22D3EE, #0891B2); }
.master-avatar-gray { background: linear-gradient(135deg, #9CA3AF, #6B7280); }
.master-avatar-indigo { background: linear-gradient(135deg, #6366F1, #4338CA); }

/* Search input with icon */
.master-search-wrap { position: relative; }
.master-search-wrap ion-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9CA3AF; width: 18px; height: 18px; pointer-events: none; }
.master-search-wrap input { padding-left: 38px; }

/* Backward compat */
.master-section { background: #F9FAFB; border-radius: 14px; padding: 22px; margin-bottom: 14px; border: 1px solid #F3F4F6; }
.master-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.master-section-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.badge-green { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.badge-amber { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; }
.badge-red { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.badge-gray { background: #F3F4F6; color: #4B5563; border: 1px solid #E5E7EB; }
.badge-blue { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }
.master-child-card { background: #fff; border: 1px solid #E5E7EB; border-radius: 10px; padding: 14px 16px; transition: all 0.15s ease; }
.master-child-card:hover { border-color: rgb(var(--sky-600)); box-shadow: 0 2px 8px rgb(var(--sky-600) / 0.06); }

/* =====================================================
   2026 DETAIL CARD DESIGN SYSTEM
   ===================================================== */

/* Detail pane background */
.detail-pane {
  background: linear-gradient(180deg, #FAFAFA 0%, #F3F4F6 100%);
}

/* Hero Banner - Reference Design */
.d-hero {
  background: linear-gradient(135deg, rgb(var(--sky-500)) 0%, #EC4899 60%, #D946EF 100%);
  border-radius: 20px;
  padding: 24px 28px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(236, 72, 153, 0.2);
}
.d-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
  border-radius: 50%;
}
.d-hero::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: -5%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}
.d-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
}
.d-hero-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: rgb(var(--sky-600));
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.d-hero-name { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -0.02em; line-height: 1.2; }
.d-hero-code {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  font-family: 'SF Mono', 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}
.d-hero-meta { font-size: 13px; color: rgba(255,255,255,0.7); font-weight: 500; }
.d-hero-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.d-hero-stat { display: flex; align-items: baseline; gap: 6px; }
.d-hero-stat-value { font-size: 18px; font-weight: 800; color: #fff; }
.d-hero-stat-label { font-size: 12px; color: rgba(255,255,255,0.7); font-weight: 500; }

/* Glass Section Cards - Enhanced */
.d-glass-section {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow:
    0 4px 24px rgba(0,0,0,0.04),
    0 1px 3px rgba(0,0,0,0.02),
    inset 0 1px 0 rgba(255,255,255,0.9);
  position: relative;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.d-glass-section:hover {
  box-shadow:
    0 12px 48px rgba(0,0,0,0.08),
    0 2px 4px rgba(0,0,0,0.02),
    inset 0 1px 0 rgba(255,255,255,0.9);
  transform: translateY(-3px);
}
.d-glass-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  border-radius: 20px 20px 0 0;
}
.d-section-orange::before { background: linear-gradient(90deg, rgb(var(--sky-600)), rgb(var(--sky-500))); }
.d-section-blue::before { background: linear-gradient(90deg, #2563EB, #3B82F6); }
.d-section-green::before { background: linear-gradient(90deg, #059669, #10B981); }
.d-section-purple::before { background: linear-gradient(90deg, #7C3AED, #A78BFA); }
.d-section-pink::before { background: linear-gradient(90deg, #DB2777, #EC4899); }
.d-section-teal::before { background: linear-gradient(90deg, #0D9488, #14B8A6); }
.d-section-amber::before { background: linear-gradient(90deg, #D97706, #F59E0B); }
.d-section-rose::before { background: linear-gradient(90deg, #BE123C, #FB7185); }
.d-section-gray::before { background: linear-gradient(90deg, #6B7280, #9CA3AF); }

/* Section color-tinted backgrounds */
.d-section-orange { background: linear-gradient(135deg, rgba(255,247,237,0.9), rgba(255,255,255,0.95)); }
.d-section-blue { background: linear-gradient(135deg, rgba(239,246,255,0.9), rgba(255,255,255,0.95)); }
.d-section-green { background: linear-gradient(135deg, rgba(236,253,245,0.9), rgba(255,255,255,0.95)); }
.d-section-purple { background: linear-gradient(135deg, rgba(245,243,255,0.9), rgba(255,255,255,0.95)); }
.d-section-pink { background: linear-gradient(135deg, rgba(253,242,248,0.9), rgba(255,255,255,0.95)); }
.d-section-teal { background: linear-gradient(135deg, rgba(240,253,250,0.9), rgba(255,255,255,0.95)); }
.d-section-amber { background: linear-gradient(135deg, rgba(255,251,235,0.9), rgba(255,255,255,0.95)); }
.d-section-rose { background: linear-gradient(135deg, rgba(255,241,242,0.9), rgba(255,255,255,0.95)); }
.d-section-gray { background: linear-gradient(135deg, rgba(249,250,251,0.95), rgba(255,255,255,0.98)); }

/* Section Header inside glass card */
.d-section-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.d-section-icon {
  width: 38px; height: 38px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.d-section-icon-orange { background: linear-gradient(135deg, rgb(var(--sky-500)), rgb(var(--sky-600))); color: #fff; }
.d-section-icon-blue { background: linear-gradient(135deg, #3B82F6, #2563EB); color: #fff; }
.d-section-icon-green { background: linear-gradient(135deg, #10B981, #059669); color: #fff; }
.d-section-icon-purple { background: linear-gradient(135deg, #A78BFA, #7C3AED); color: #fff; }
.d-section-icon-pink { background: linear-gradient(135deg, #F472B6, #DB2777); color: #fff; }
.d-section-icon-teal { background: linear-gradient(135deg, #14B8A6, #0D9488); color: #fff; }
.d-section-icon-amber { background: linear-gradient(135deg, #F59E0B, #D97706); color: #fff; }
.d-section-icon-rose { background: linear-gradient(135deg, #FB7185, #BE123C); color: #fff; }
.d-section-icon-cyan { background: linear-gradient(135deg, #22D3EE, #0891B2); color: #fff; }
.d-section-icon-gray { background: linear-gradient(135deg, #9CA3AF, #6B7280); color: #fff; }

.d-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #374151;
  letter-spacing: -0.01em;
}

/* Field display */
.d-field { position: relative; }
.d-field-label {
  font-size: 10px;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 4px;
}
.d-field-value {
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
  line-height: 1.4;
}
.d-field-value-muted { color: #9CA3AF; }
.d-field-box {
  background: linear-gradient(135deg, #fff, #FAFAFA);
  border: 1px solid rgba(229,231,235,0.7);
  border-radius: 14px;
  padding: 14px 16px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.d-field-box:hover {
  background: #fff;
  border-color: rgb(var(--sky-600) / 0.2);
  box-shadow: 0 4px 16px rgb(var(--sky-600) / 0.06);
  transform: translateY(-1px);
}

/* Modern Grid */
.d-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 640px) { .d-grid { grid-template-columns: 1fr; } }

/* Status Badge with pulse */
.d-badge-pulse {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.d-badge-pulse::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}
.d-badge-pulse-green { background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; }
.d-badge-pulse-green::before { background: #10B981; animation-name: pulse-dot-green; }
@keyframes pulse-dot-green {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}
.d-badge-pulse-gray { background: #F3F4F6; color: #4B5563; border: 1px solid #E5E7EB; }
.d-badge-pulse-gray::before { background: #9CA3AF; animation-name: pulse-dot-gray; }
@keyframes pulse-dot-gray {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(156,163,175,0.4); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(156,163,175,0); }
}
.d-badge-pulse-amber { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; }
.d-badge-pulse-amber::before { background: #F59E0B; animation-name: pulse-dot-amber; }
@keyframes pulse-dot-amber {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(245,158,11,0); }
}
.d-badge-pulse-red { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.d-badge-pulse-red::before { background: #EF4444; animation-name: pulse-dot-red; }
@keyframes pulse-dot-red {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { opacity: 0.7; transform: scale(0.85); box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

/* Chip / Pill for linked items */
.d-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  border: 1px solid #E5E7EB;
  color: #374151;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.d-chip:hover {
  border-color: rgb(var(--sky-600));
  box-shadow: 0 4px 12px rgb(var(--sky-600) / 0.1);
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgb(var(--sky-50)), #FFF);
}
.d-chip-icon {
  width: 18px; height: 18px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}

/* Description / text block */
.d-text-block {
  background: linear-gradient(135deg, #FAFAFA, #F3F4F6);
  border: 1px solid rgba(229,231,235,0.6);
  border-radius: 14px;
  padding: 18px 20px;
  font-size: 14px; line-height: 1.7;
  color: #4B5563;
}

/* Stat mini cards */
.d-stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.d-stat-mini {
  flex: 1; min-width: 140px;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  transition: all 0.25s ease;
}
.d-stat-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.04);
}
.d-stat-mini-value {
  font-size: 18px; font-weight: 800;
  color: #111827; letter-spacing: -0.02em;
}
.d-stat-mini-label {
  font-size: 11px; font-weight: 600;
  color: #9CA3AF; text-transform: uppercase;
  letter-spacing: 0.06em; margin-top: 4px;
}

/* Description / text block */
.d-text-block {
  background: rgba(249,250,251,0.6);
  border: 1px solid rgba(229,231,235,0.5);
  border-radius: 14px;
  padding: 18px 20px;
  font-size: 14px; line-height: 1.7;
  color: #4B5563;
}

/* Icon-only edit button */
.d-edit-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.9);
  border: none;
  color: rgb(var(--sky-600));
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  font-size: 18px;
  margin-left: auto;
}
.d-edit-btn:hover {
  background: #fff;
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Detail wrapper */
.detail-wrapper {
  position: relative;
  padding: 20px;
  /*min-height: 100%;*/
}

/* Progress bar for budgets */
.d-progress-track {
  height: 10px;
  background: linear-gradient(90deg, #F3F4F6, #E5E7EB);
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.d-progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, #10B981, #34D399);
  box-shadow: 0 0 12px rgba(16,185,129,0.3);
}
.d-progress-fill-warning {
  background: linear-gradient(90deg, #F59E0B, #FBBF24);
  box-shadow: 0 0 12px rgba(245,158,11,0.3);
}
.d-progress-fill-danger {
  background: linear-gradient(90deg, #EF4444, #F87171);
  box-shadow: 0 0 12px rgba(239,68,68,0.3);
}

/* Empty state in detail pane */
.d-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100%;
  text-align: center; padding: 48px 24px;
}
.d-empty-icon {
  width: 80px; height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, #F3F4F6, #E5E7EB);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: #9CA3AF;
  margin-bottom: 20px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}

/* Master Modal - 2026 */
.master-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 300;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.master-modal-overlay.show { display: flex; }
.master-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
  width: 100%; max-width: 560px;
  max-height: 88vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: modal-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
/* the modal's <form> must carry the flex chain so the body can scroll */
.master-modal > form {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0; overflow: hidden;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.master-modal-header {
  padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #F1F5F9;
  background: linear-gradient(180deg, #FFFFFF, #FAFAFB);
  flex-shrink: 0;
}
.master-modal-title {
  font-size: 16px; font-weight: 800;
  color: #0F172A; letter-spacing: -0.02em;
}
.master-modal-close {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #F3F4F6;
  border: none;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s ease;
}
.master-modal-close:hover {
  background: #FEE2E2; color: #DC2626;
}
.master-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1; min-height: 0;
}
.master-modal-footer {
  padding: 14px 24px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid #F1F5F9;
  background: #FAFAFB;
  flex-shrink: 0;
}

/* Modal form sections */
.m-form-section { margin-bottom: 20px; }
.m-form-section:last-of-type { margin-bottom: 4px; }
.m-form-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: #94A3B8;
  padding-bottom: 7px; margin-bottom: 12px;
  border-bottom: 1px solid #F1F5F9;
}

/* Form field in modal */
.m-form-group { margin-bottom: 14px; }
.m-form-group:last-child { margin-bottom: 0; }
.m-form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: #374151; margin-bottom: 6px;
}

.m-form-input, .m-form-select, .m-form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  font-size: 14px;
  color: #1F2937;
  background: #FAFAFA;
  transition: all 0.2s ease;
}
.m-form-input:focus, .m-form-select:focus, .m-form-textarea:focus {
  background: #fff;
  border-color: rgb(var(--sky-600));
  box-shadow: 0 0 0 3px rgb(var(--sky-600) / 0.08);
}
.m-form-textarea { resize: vertical; min-height: 80px; }
.m-form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Toggle switch */
.m-toggle-wrap { display: flex; align-items: center; gap: 10px; }
.m-toggle { -webkit-appearance: none; appearance: none; width: 44px; height: 24px; background: #E5E7EB; border-radius: 12px; position: relative; cursor: pointer; transition: all 0.2s ease; flex-shrink: 0; }
.m-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: all 0.2s ease; }
.m-toggle:checked { background: rgb(var(--sky-600)); }
.m-toggle:checked::after { left: 22px; }
.m-toggle-label { font-size: 13px; font-weight: 600; color: #374151; }
/* Compact + tiny toggle sizes for inline use (table rows, row chips). */
.m-toggle.m-toggle-sm { width: 36px; height: 20px; border-radius: 10px; }
.m-toggle.m-toggle-sm::after { width: 16px; height: 16px; top: 2px; left: 2px; }
.m-toggle.m-toggle-sm:checked::after { left: 18px; }
.m-toggle.m-toggle-xs { width: 32px; height: 18px; border-radius: 9px; }
.m-toggle.m-toggle-xs::after { width: 14px; height: 14px; top: 2px; left: 2px; }
.m-toggle.m-toggle-xs:checked::after { left: 16px; }

/* Modal searchable dropdown */
.m-search-select { position: relative; }
.m-search-select-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid #E5E7EB; border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.08); max-height: 220px; overflow-y: auto;
  z-index: 50; display: none;
}
.m-search-select-results.show { display: block; }
.m-search-result-item {
  padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #F3F4F6;
  transition: all 0.15s ease;
}
.m-search-result-item:hover { background: rgb(var(--sky-50)); }
.m-search-result-item:last-child { border-bottom: none; }
.m-selected-detail-card {
  background: linear-gradient(135deg, #F9FAFB, #F3F4F6);
  border: 1px solid #E5E7EB; border-radius: 12px;
  padding: 14px 16px; margin-top: 10px;
}

/* Checkbox list for multiselect */
.m-checkbox-list {
  max-height: 200px; overflow-y: auto;
  border: 1px solid #E5E7EB; border-radius: 12px;
  padding: 8px; background: #FAFAFA;
}
.m-checkbox-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; transition: all 0.15s ease;
}
.m-checkbox-item:hover { background: #F3F4F6; }
.m-checkbox-item input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: rgb(var(--sky-600));
  cursor: pointer; flex-shrink: 0;
}
.m-checkbox-item label {
  font-size: 13px; color: #374151; cursor: pointer;
  flex: 1;
}

/* Curtain Modal (1/3 right panel) */
.curtain-overlay { position: fixed; inset: 0; z-index: 400; display: none; }
.curtain-overlay.show { display: block; }
.curtain-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.curtain-panel { position: absolute; right: 0; top: 0; bottom: 0; width: 420px; max-width: 90vw; background: linear-gradient(180deg, #FAFAFA 0%, #fff 100%); box-shadow: -8px 0 40px rgba(0,0,0,0.15); display: flex; flex-direction: column; animation: curtain-in 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes curtain-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.curtain-header { padding: 20px 24px 16px; border-bottom: 1px solid #F3F4F6; background: #fff; }
.curtain-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.curtain-title { font-size: 18px; font-weight: 800; color: #111827; }
.curtain-close { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #F3F4F6; border: none; color: #6B7280; cursor: pointer; font-size: 20px; transition: all 0.2s ease; }
.curtain-close:hover { background: #FEE2E2; color: #DC2626; }
.curtain-search { position: relative; }
.curtain-search input { width: 100%; padding: 10px 14px 10px 38px; border: 1px solid #E5E7EB; border-radius: 12px; font-size: 14px; background: #FAFAFA; transition: all 0.2s ease; }
.curtain-search input:focus { background: #fff; border-color: rgb(var(--sky-600)); box-shadow: 0 0 0 3px rgb(var(--sky-600) / 0.08); }
.curtain-search ion-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9CA3AF; font-size: 18px; }
.curtain-actions { display: flex; gap: 8px; margin-top: 10px; }
.curtain-action-btn { padding: 5px 12px; border-radius: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; cursor: pointer; border: 1px solid #E5E7EB; background: #fff; color: #6B7280; transition: all 0.15s ease; }
.curtain-action-btn:hover { background: #F3F4F6; border-color: #D1D5DB; }
.curtain-body { flex: 1; overflow-y: auto; padding: 16px 24px; }
.curtain-footer { padding: 16px 24px; border-top: 1px solid #F3F4F6; background: #fff; display: flex; justify-content: space-between; align-items: center; }
.curtain-count { font-size: 13px; color: #6B7280; font-weight: 500; }
.curtain-count span { font-weight: 700; color: #111827; }

/* Curtain Cards */
.curtain-card { background: #fff; border: 1.5px solid #E5E7EB; border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 14px; cursor: pointer; transition: all 0.2s ease; }
.curtain-card:hover { border-color: rgb(var(--sky-300)); box-shadow: 0 4px 16px rgb(var(--sky-600) / 0.08); transform: translateX(4px); }
.curtain-card.selected { background: linear-gradient(135deg, rgb(var(--sky-50)), #FFF); border-color: rgb(var(--sky-600)); box-shadow: 0 4px 16px rgb(var(--sky-600) / 0.1); }
.curtain-card-avatar { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; color: #fff; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.curtain-card-info { flex: 1; min-width: 0; }
.curtain-card-title { font-size: 14px; font-weight: 700; color: #1F2937; letter-spacing: -0.01em; }
.curtain-card-subtitle { font-size: 12px; color: #9CA3AF; margin-top: 3px; font-weight: 500; }
.curtain-toggle { width: 48px; height: 26px; border-radius: 13px; background: #E5E7EB; position: relative; transition: all 0.25s ease; flex-shrink: 0; }
.curtain-toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: all 0.25s ease; }
.curtain-card.selected .curtain-toggle { background: linear-gradient(135deg, rgb(var(--sky-500)), rgb(var(--sky-600))); }
.curtain-card.selected .curtain-toggle::after { left: 25px; }
.curtain-empty { text-align: center; padding: 48px 24px; color: #9CA3AF; }
.curtain-empty-icon { width: 64px; height: 64px; border-radius: 20px; background: #F3F4F6; display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 16px; color: #9CA3AF; }

/* Search trigger button next to dropdown */
.m-search-trigger { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: #F3F4F6; border: 1px solid #E5E7EB; color: #6B7280; cursor: pointer; font-size: 18px; transition: all 0.2s ease; flex-shrink: 0; }
.m-search-trigger:hover { background: rgb(var(--sky-50)); border-color: rgb(var(--sky-600)); color: rgb(var(--sky-600)); }
.m-curtain-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 12px; border-radius: 10px; background: #fff; border: 1px solid #E5E7EB; color: #374151; cursor: pointer; font-size: 13px; transition: all 0.2s ease; }
.m-curtain-trigger:hover { border-color: rgb(var(--sky-600)); }
.m-curtain-trigger span { color: #9CA3AF; }
.m-curtain-trigger.has-value span { color: #374151; }
.m-input-group { display: flex; gap: 8px; align-items: stretch; }
.m-input-group .m-form-input { flex: 1; }

/* Role tags */
.role-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.role-tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; background: linear-gradient(135deg, rgb(var(--sky-50)), #FEF2F2); border: 1px solid rgb(var(--sky-300)); color: rgb(var(--sky-700)); }
.role-tag-remove { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.06); border: none; color: #9CA3AF; cursor: pointer; font-size: 10px; }
.role-tag-remove:hover { background: #FEE2E2; color: #DC2626; }

/* Modal buttons */
.m-btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: linear-gradient(135deg, rgb(var(--sky-500)), rgb(var(--sky-600)));
  color: #fff; border: none; border-radius: 12px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgb(var(--sky-600) / 0.25);
}
.m-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgb(var(--sky-600) / 0.35);
}
.m-btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: #F3F4F6; color: #4B5563;
  border: 1px solid #E5E7EB; border-radius: 12px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
}
.m-btn-secondary:hover { background: #E5E7EB; }

/* =====================================================
   USER MODULE - 2026 ENHANCEMENTS
   ===================================================== */

/* Selected item cards in modal — uniform grid (no uneven flex stretching) */
.m-selected-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.m-selected-card {
  background: linear-gradient(135deg, rgb(var(--sky-50)), #FFF);
  border: 1.5px solid rgb(var(--sky-300));
  border-radius: 14px;
  padding: 11px 13px;
  min-width: 0;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgb(var(--sky-600) / 0.06);
}
.m-selected-card-seq {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgb(var(--sky-600)); color: #fff; font-size: 9px; font-weight: 800;
  margin-right: 5px;
}
.m-selected-card-move {
  width: 20px; height: 20px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: rgb(var(--sky-100)); border: none; color: rgb(var(--sky-700)); cursor: pointer;
  font-size: 12px; transition: background 0.15s ease;
}
.m-selected-card-move:hover { background: rgb(var(--sky-200)); }
.m-selected-card-more {
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; min-width: 120px; min-height: 64px;
}
.m-selected-card-more span { font-size: 15px; font-weight: 800; color: rgb(var(--sky-600)); }
.m-selected-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgb(var(--sky-600) / 0.12);
  border-color: rgb(var(--sky-600));
}
.m-selected-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.m-selected-card-code {
  font-size: 10px;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.m-selected-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #1F2937;
  line-height: 1.3;
}
.m-selected-card-meta {
  font-size: 11px;
  color: #6B7280;
  line-height: 1.4;
  margin-top: 4px;
}
.m-selected-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: #F3E8FF;
  color: #7E22CE;
  margin-top: 6px;
}
.m-selected-card-remove {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.04);
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.m-selected-card-remove:hover {
  background: #FEE2E2;
  color: #DC2626;
}
.m-selected-card-info {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.04);
  border: none;
  color: #3B82F6;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.m-selected-card-info:hover {
  background: #EFF6FF;
  color: #2563EB;
}
.m-selected-card-actions {
  display: flex;
  gap: 4px;
}

/* Info popup modal */
.info-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 500;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.info-modal-overlay.show { display: flex; }
.info-modal {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.15);
  width: 100%; max-width: 480px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.info-modal-header {
  padding: 20px 24px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.info-modal-title {
  font-size: 16px; font-weight: 800; color: #111827;
}
.info-modal-close {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #F3F4F6; border: none; color: #6B7280;
  cursor: pointer; transition: all 0.2s ease;
}
.info-modal-close:hover { background: #FEE2E2; color: #DC2626; }
.info-modal-body {
  padding: 16px 24px 20px;
  overflow-y: auto; flex: 1;
}
.info-modal-section {
  margin-bottom: 16px;
}
.info-modal-section-title {
  font-size: 11px; font-weight: 700; color: #9CA3AF;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.info-modal-item {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #374151;
}
.info-modal-item strong {
  color: #111827;
  font-weight: 600;
}

/* Single select curtain variant */
.curtain-card-single {
  background: #fff;
  border: 1.5px solid #E5E7EB;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.curtain-card-single:hover { border-color: rgb(var(--sky-300)); box-shadow: 0 4px 16px rgb(var(--sky-600) / 0.08); transform: translateX(4px); }
.curtain-card-single.selected { background: linear-gradient(135deg, rgb(var(--sky-50)), #FFF); border-color: rgb(var(--sky-600)); box-shadow: 0 4px 16px rgb(var(--sky-600) / 0.1); }
.curtain-card-single .curtain-radio {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #D1D5DB; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.curtain-card-single.selected .curtain-radio {
  border-color: rgb(var(--sky-600));
  background: rgb(var(--sky-600));
}
.curtain-card-single.selected .curtain-radio::after {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #fff;
}

/* Search trigger input group */
.m-search-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.m-search-input-group .m-form-input {
  flex: 1;
}
.m-search-input-group .m-form-input[readonly] {
  background: #FAFAFA;
  cursor: pointer;
}

/* Filter dropdown */
.filter-dropdown {
  animation: filter-dropdown-in 0.2s ease;
}
@keyframes filter-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sticky detail header */
.detail-sticky-header {
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.detail-sticky-header.is-stuck {
  box-shadow: 0 8px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  border-color: #e2e8f0;
}

/* View section - Linked Access Cards (Master1.png style) */
.v-linked-section {
  margin-bottom: 20px;
}
.v-linked-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.v-linked-section-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.v-linked-section-title {
  font-size: 14px; font-weight: 700; color: #374151;
}
.v-linked-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.v-linked-card {
  background: linear-gradient(135deg, rgb(var(--sky-50)), #FFF);
  border: 1.5px solid rgb(var(--sky-300));
  border-radius: 16px;
  padding: 14px 16px;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgb(var(--sky-600) / 0.06);
}
.v-linked-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgb(var(--sky-600) / 0.12);
  border-color: rgb(var(--sky-600));
}
.v-linked-card-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgb(var(--sky-500)), rgb(var(--sky-600)));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 2px 8px rgb(var(--sky-600) / 0.3);
}
.v-linked-card-code {
  font-size: 10px; font-weight: 700; color: #9CA3AF;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 4px;
  padding-right: 30px;
}
.v-linked-card-name {
  font-size: 14px; font-weight: 700; color: #1F2937;
  line-height: 1.3;
  margin-bottom: 6px;
  padding-right: 30px;
}
.v-linked-card-meta {
  font-size: 11px; color: #6B7280;
  line-height: 1.5;
}
.v-linked-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: #F3E8FF;
  color: #7E22CE;
  margin-top: 6px;
}

/* =====================================================
   SAMPLE.HTML STYLE - Detail View System
   ===================================================== */

/* Dark Hero Header */
.s-hero {
    position: relative;
    overflow: hidden;
    background: #0f172a;
    border-radius: 24px;
    padding-left: 32px;
    padding-right: 32px;
    padding-bottom: 16px;
    padding-top: 16px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    border: 1px solid #1e293b;
}
.s-hero-blur-1 {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 256px;
  height: 256px;
  background: rgba(14,165,233,0.2);
  border-radius: 50%;
  filter: blur(64px);
  pointer-events: none;
}
.s-hero-blur-2 {
  position: absolute;
  bottom: -20px;
  left: 80px;
  width: 160px;
  height: 160px;
  background: rgba(245,158,11,0.1);
  border-radius: 50%;
  filter: blur(32px);
  pointer-events: none;
}
.s-hero-icon {
  width: 64px;
  height: 64px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: rgb(var(--sky-200));
  font-size: 28px;
}
.s-hero-name {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.2;
}
.s-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgb(var(--sky-100));
}
.s-hero-badge-green {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.3);
  color: #6ee7b7;
}

/* White Section Cards */
.s-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 2px 20px rgba(0,0,0,0.02);
  border: 1px solid #f1f5f9;
}
.s-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.s-card-icon {
  padding: 8px;
  background: rgb(var(--sky-50));
  color: rgb(var(--sky-600));
  border-radius: 8px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.s-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

/* Field Grid & Styling */
.s-field-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.s-field-value {
  display: flex;
  align-items: start;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  color: #1e293b;
  line-height: 1.4;
}
.s-field-value ion-icon {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 16px;
  opacity: 0.7;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.s-field-value:hover ion-icon {
  opacity: 1;
}
.s-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px 48px;
}
@media (max-width: 640px) {
  .s-grid { grid-template-columns: 1fr; }
  .s-hero { padding: 24px; }
  .s-card { padding: 24px; }
}

/* Access Matrix Role Cards */
.access-role-card {
  transition: all 0.2s ease;
  border-left: 4px solid transparent;
}
.access-role-card:hover {
  border-left-color: rgb(var(--sky-300));
  background: rgb(var(--sky-50));
}
.access-role-card.active {
  border-left-color: rgb(var(--sky-500));
  background: rgb(var(--sky-50));
  box-shadow: 0 2px 8px rgba(14,165,233, 0.08);
}

/* ============================================================
   SMART ASSIST — Chat-style duplicate suggestion panel
   ============================================================ */

.smart-assist-panel {
  position: fixed;
  /* small symmetric gap from the top-left so the panel doesn't hug the edge */
  top: 16px;
  left: 16px;
  width: 360px;
  max-width: calc(100vw - 32px);
  max-height: 360px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 600;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
  transform: translateY(-20px) scale(0.96);
  opacity: 0;
  pointer-events: none;
}

.smart-assist-panel.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.smart-assist-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgb(var(--sky-600)) 0%, rgb(var(--sky-500)) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.smart-assist-header ion-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.smart-assist-close {
  margin-left: auto;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.15s;
}

.smart-assist-close:hover {
  background: rgba(255,255,255,0.35);
}

.smart-assist-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  background: #fafafa;
}

.smart-assist-query {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.smart-assist-query strong {
  color: #334155;
  font-weight: 600;
}

.smart-assist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.smart-assist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.smart-assist-item:hover {
  border-color: rgb(var(--sky-300));
  background: rgb(var(--sky-50));
  transform: translateX(2px);
}

.smart-assist-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgb(var(--sky-200));
  color: rgb(var(--sky-700));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.smart-assist-item-info {
  flex: 1;
  min-width: 0;
}

.smart-assist-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smart-assist-item-meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.smart-assist-item-similarity {
  font-size: 11px;
  font-weight: 700;
  color: rgb(var(--sky-600));
  background: rgb(var(--sky-50));
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.smart-assist-empty {
  text-align: center;
  padding: 20px 12px;
  color: #94a3b8;
  font-size: 13px;
}

.smart-assist-typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #64748b;
}

.smart-assist-typing .dot {
  width: 5px;
  height: 5px;
  background: rgb(var(--sky-600));
  border-radius: 50%;
  animation: sa-dot-bounce 1.2s infinite ease-in-out;
}

/* Smart Assist content sections — alarms / PR recs / item-level recs */
.smart-assist-section {
  margin-bottom: 12px;
}
.smart-assist-section:last-child { margin-bottom: 0; }
.smart-assist-section-title {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.smart-assist-rec {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.smart-assist-rec:hover {
  border-color: rgb(var(--sky-300));
  background: rgb(var(--sky-50));
  transform: translateX(2px);
}
.smart-assist-level {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgb(var(--sky-100));
  color: rgb(var(--sky-700));
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
}
.smart-assist-item-group {
  padding: 8px 0;
  border-top: 1px solid #f3f4f6;
}
.smart-assist-item-group:first-child {
  border-top: 0;
  padding-top: 0;
}

/* Compact alarm row — one-line per alarm, used by the consolidated Smart Assist panel */
.smart-assist-alarm {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  margin-bottom: 4px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  font-size: 11px;
  color: #374151;
  line-height: 1.35;
}

/* PR dimension cards — uniform height so Location & Account align.
   `height: 100%` makes each card fill its grid cell; combined with `flex-1`
   on the wrapper div it eliminates the trailing-whitespace mismatch when one
   address is taller than the other. */
.pr-dim-card {
  min-height: 130px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.smart-assist-typing .dot:nth-child(2) { animation-delay: 0.15s; }
.smart-assist-typing .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes sa-dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Confirm modal with similar records */
.confirm-similar-records {
  background: rgb(var(--sky-50));
  border: 1px solid rgb(var(--sky-300));
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  max-height: 180px;
  overflow-y: auto;
}

.confirm-similar-records-title {
  font-size: 12px;
  font-weight: 700;
  color: rgb(var(--sky-800));
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.confirm-similar-records-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.confirm-similar-records-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 8px;
  font-size: 12px;
}

.confirm-similar-records-item .name {
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}

.confirm-similar-records-item .match {
  color: rgb(var(--sky-600));
  font-weight: 600;
  font-size: 11px;
}

/* Approval detail similar records section */
.approval-similar-section {
  background: rgb(var(--sky-50));
  border: 1px solid rgb(var(--sky-300));
  border-radius: 10px;
  padding: 14px;
  margin-top: 16px;
}

.approval-similar-section-title {
  font-size: 13px;
  font-weight: 700;
  color: rgb(var(--sky-800));
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.approval-similar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.approval-similar-item:last-child {
  margin-bottom: 0;
}

/* =====================================================
   PR Create — Smart Assist & Table Curtain Selects
   ===================================================== */

/* Compact curtain trigger for table cells */
.m-curtain-trigger.compact {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
}

/* Smart Assist budget calc cards */
.smart-calc-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.smart-calc-card .value {
  font-weight: 700;
  font-size: 13px;
  color: #1F2937;
}
.smart-calc-card .label {
  font-size: 10px;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

/* Price alert inline */
.li-price-alert {
  line-height: 1.2;
}

/* =====================================================
   PR — Lifecycle flowchart + tabbed Detail
   ===================================================== */

.pr-lifecycle {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 2px;
  /* Hide the OS scrollbar — the lifecycle is a visual phase tracker,
     not a scrolling list. Excel-style chevron buttons (below) page the
     strip in either direction; touch + trackpad swipe still works. */
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}
.pr-lifecycle::-webkit-scrollbar { display: none; }
/* Wrapper that pairs left / right paging chevrons around .pr-lifecycle.
   Mirrors .pr-tab-nav-btn but smaller / lighter so it doesn't compete
   with the lifecycle steps visually. */
.pr-lifecycle-nav {
  display: flex; align-items: stretch; gap: 0;
}
.pr-lifecycle-nav .pr-lifecycle-nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; flex-shrink: 0;
  background: #f8fafc; color: #94a3b8; border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-size: 12px;
}
.pr-lifecycle-nav .pr-lifecycle-nav-btn:hover { background: rgb(var(--sky-50)); color: rgb(var(--sky-600)); }
.pr-lifecycle-nav > .pr-lifecycle { flex: 1; min-width: 0; }
.pr-lifecycle-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  flex-shrink: 0;
}
.pr-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 2px solid;
  transition: transform 0.15s ease;
}
.pr-step-circle:hover { transform: scale(1.05); }
.pr-step-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
.pr-lifecycle-line {
  flex: 1;
  height: 2px;
  background: #E5E7EB;
  min-width: 24px;
  margin-bottom: 24px;
  border-radius: 1px;
}
.pr-step-done .pr-step-circle {
  background: linear-gradient(135deg, #10B981, #059669);
  border-color: #059669;
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.25);
}
.pr-step-done .pr-step-label { color: #047857; }
.pr-step-current .pr-step-circle {
  background: linear-gradient(135deg, rgb(var(--sky-500)), rgb(var(--sky-600)));
  border-color: rgb(var(--sky-600));
  color: #fff;
  box-shadow: 0 4px 14px rgb(var(--sky-600) / 0.35);
  animation: prPulse 1.8s ease-in-out infinite;
}
.pr-step-current .pr-step-label { color: rgb(var(--sky-700)); font-weight: 700; }
.pr-step-future .pr-step-circle {
  background: #F3F4F6;
  border-color: #E5E7EB;
  color: #9CA3AF;
}
.pr-step-future .pr-step-label { color: #9CA3AF; }
/* Skipped step — amber dashed circle + exclamation icon. Used when
   the buyer bypassed a stage (e.g. PR → PO direct without an RFX).
   Visually distinct from "done" so the reader doesn't mistake a
   skipped step for a completed one. */
.pr-step-skipped .pr-step-circle {
  background: #FFFBEB;
  border-color: #F59E0B;
  border-style: dashed;
  color: #B45309;
}
.pr-step-skipped .pr-step-label { color: #B45309; font-style: italic; }
.pr-line-done {
  background: linear-gradient(90deg, #10B981, #34D399);
}
.pr-line-skipped {
  background: repeating-linear-gradient(90deg, #F59E0B 0, #F59E0B 4px, transparent 4px, transparent 8px);
  opacity: 0.7;
}
@keyframes prPulse {
  0%, 100% { box-shadow: 0 4px 14px rgb(var(--sky-600) / 0.35); }
  50% { box-shadow: 0 4px 14px rgb(var(--sky-600) / 0.55), 0 0 0 6px rgb(var(--sky-600) / 0.08); }
}

/* Tab strip — Excel-sheet-tab pattern: left/right chevron buttons
   anchor the ends, and the strip in the middle scrolls horizontally
   with the OS scrollbar hidden. This replaces the previous thin
   styled scrollbar — too easy to miss, the user asked for explicit
   click-to-page buttons. */
.pr-tab-nav { /* outer wrapper: btn | strip | btn */ }
.pr-tab-nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; flex-shrink: 0;
  background: #f8fafc;
  color: #64748b;
  border: 0;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  font-size: 14px;
}
.pr-tab-nav-btn:first-child { border-right: 1px solid #e2e8f0; }
.pr-tab-nav-btn:last-child { border-left: 1px solid #e2e8f0; }
.pr-tab-nav-btn:hover { background: rgb(var(--sky-50)); color: rgb(var(--sky-600)); }
.pr-tab-nav-btn:active { background: rgb(var(--sky-100)); }

.pr-tab-strip {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/legacy Edge */
  /* CSS-driven smooth scroll — works for both JS scrollLeft and
     scrollBy() without depending on the `behavior:'smooth'` option,
     which gets dropped under headless / CDP automation. */
  scroll-behavior: smooth;
}
.pr-tab-strip::-webkit-scrollbar { display: none; }  /* WebKit */

.pr-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #64748B;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.pr-tab-btn:hover { color: #334155; background: #F9FAFB; }
.pr-tab-btn.pr-tab-active {
  color: rgb(var(--sky-600));
  border-bottom-color: rgb(var(--sky-600));
  background: linear-gradient(180deg, rgba(255,247,237,0.4), transparent);
}
.pr-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: #F3F4F6;
  color: #6B7280;
  font-size: 10px;
  font-weight: 700;
}
.pr-tab-btn.pr-tab-active .pr-tab-count {
  background: rgb(var(--sky-100));
  color: rgb(var(--sky-700));
}

/* ── Toggle switch ──────────────────────────────────────────────────
   Drop-in replacement for shortlist / on-off checkboxes. Uses a hidden
   real <input type=checkbox> for form-submission compatibility — the
   visual track + thumb are styled siblings driven by :checked.
   Markup:
     <label class="rfq-toggle">
       <input type="checkbox" class="some-class" data-... />
       <span class="rfq-toggle-track"></span>
     </label>                                                            */
.rfq-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}
.rfq-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.rfq-toggle-track {
  position: absolute;
  inset: 0;
  background: #CBD5E1;
  border-radius: 999px;
  transition: background 0.18s ease;
}
.rfq-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform 0.18s ease;
}
.rfq-toggle input:checked + .rfq-toggle-track { background: #7c3aed; }
.rfq-toggle input:checked + .rfq-toggle-track::after { transform: translateX(16px); }
.rfq-toggle input:focus-visible + .rfq-toggle-track {
  box-shadow: 0 0 0 3px rgba(124,58,237,.25);
}
.rfq-toggle input:disabled + .rfq-toggle-track { opacity: 0.5; cursor: not-allowed; }

/* ── Glass morphism helpers ──────────────────────────────────────────
   Applied to large form sections (RFQ Create + Vendor Registration) so the
   cards lift off a soft tinted page background. .glass-card replaces s-card
   styling on opt-in pages; .glass-soft is a lighter variant. */
.glass-card {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow:
    0 6px 28px rgba(15, 23, 42, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.7) inset;
  padding: 16px;
}
.glass-card-soft {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 14px;
}
.glass-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.glass-header-icon {
  width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, rgb(var(--sky-200)), rgb(var(--sky-300)));
  color: rgb(var(--sky-700)); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.glass-header-icon ion-icon { font-size: 16px; }
.glass-header-title { font-weight: 600; font-size: 14px; color: #1f2937; }

/* Page background — neutral surface behind glass cards (no yellow tint) */
.page-glass-bg {
  background: transparent;
  min-height: 100%;
}

/* Themed attachment / file upload button (used in Vendor Reg + RFQ attachments) */
.attach-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 10px;
  background: linear-gradient(135deg, rgb(var(--sky-50)), rgb(var(--sky-100)));
  border: 1px dashed rgb(var(--sky-300)); color: rgb(var(--sky-700));
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .15s ease;
}
.attach-btn:hover { background: linear-gradient(135deg, rgb(var(--sky-100)), rgb(var(--sky-200))); border-style: solid; }
.attach-btn ion-icon { font-size: 14px; }
.attach-input { display: none; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 8px;
  background: #ecfdf5; border: 1px solid #6ee7b7;
  color: #065f46; font-size: 11px;
}
.attach-chip .attach-chip-x { color: #047857; cursor: pointer; }
.attach-chip .attach-chip-x:hover { color: #be123c; }

/* PR Scope of Work — print-ready typography for Quill-rendered HTML */
.pr-sow-content { color: #1F2937; line-height: 1.6; font-size: 14px; }
.pr-sow-content h1 { font-size: 22px; font-weight: 700; margin: 12px 0 8px; color: #0F172A; }
.pr-sow-content h2 { font-size: 18px; font-weight: 700; margin: 10px 0 6px; color: #0F172A; }
.pr-sow-content h3 { font-size: 16px; font-weight: 600; margin: 8px 0 4px; color: #1E293B; }
.pr-sow-content p  { margin: 6px 0; }
.pr-sow-content strong, .pr-sow-content b { font-weight: 700; color: #0F172A; }
.pr-sow-content em, .pr-sow-content i { font-style: italic; }
.pr-sow-content u { text-decoration: underline; }
.pr-sow-content s, .pr-sow-content del { text-decoration: line-through; }
.pr-sow-content ul, .pr-sow-content ol { margin: 8px 0 8px 24px; padding-left: 16px; }
.pr-sow-content ul { list-style: disc; }
.pr-sow-content ol { list-style: decimal; }
.pr-sow-content li { margin: 2px 0; }
.pr-sow-content blockquote {
  border-left: 3px solid rgb(var(--sky-500)); padding: 4px 12px; margin: 8px 0;
  background: rgb(var(--sky-50)); color: rgb(var(--sky-900)); font-style: italic;
}
.pr-sow-content pre, .pr-sow-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #F1F5F9; padding: 2px 6px; border-radius: 4px; font-size: 12px;
}
.pr-sow-content pre { padding: 10px; margin: 8px 0; }
.pr-sow-content a { color: rgb(var(--sky-600)); text-decoration: underline; }
.pr-sow-content .ql-align-center { text-align: center; }
.pr-sow-content .ql-align-right  { text-align: right; }
.pr-sow-content .ql-align-justify{ text-align: justify; }

/* Quill editor sizing inside Create-PR Scope of Work card */
#prScopeOfWorkEditor.ql-container { min-height: 200px; font-size: 14px; }
#prScopeOfWorkEditor + .ql-toolbar,
.ql-toolbar.ql-snow { border-color: #e5e7eb !important; border-radius: 8px 8px 0 0; }
.ql-container.ql-snow { border-color: #e5e7eb !important; border-radius: 0 0 8px 8px; }

/* Alarm modal severity cards */
.alarm-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.alarm-card.error {
  background: #FFF1F2;
  border: 1px solid #FECDD3;
  color: #BE123C;
}
.alarm-card.warning {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #B45309;
}

/* ── Sofia full-screen modal shell ─────────────────────────────────
   Used by PO Items expand, NFA modal, Catalog admin create/edit,
   Catalog bulk-upload, etc. Originally lived inline in po/create.html
   which meant the modal was invisible on any other page (catalog
   manage's "New Catalog" / "Bulk Upload" clicks would silently open
   an unstyled element). Lifted to the global stylesheet so any HTMX
   partial that mounts a `.po-fs-modal` works regardless of which
   route the buyer came from. */
.po-fs-modal { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px); display: none; align-items: stretch; justify-content: center; padding: 24px; }
.po-fs-modal.show { display: flex; }
.po-fs-modal-panel { background: #ffffff; border-radius: 18px; width: 100%; max-width: 1280px; box-shadow: 0 30px 80px rgba(15,23,42,0.35); display: flex; flex-direction: column; overflow: hidden; }
.po-fs-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid #e5e7eb; background: linear-gradient(180deg, rgb(var(--sky-50)) 0%, #ffffff 100%); }
.po-fs-modal-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px; background: #fafafa; }
