@import url('./j360-tokens.css?v=b9980a77');
@import url('/css/j360-fonts.css?v=b9980a77');

/* ==========================================================================
   JAVENZI — ENTERPRISE VISUAL DESIGN SYSTEM v4.0
   Unified authoritative stylesheet. Strips legacy "vibecoded" ad-hoc overrides,
   enforces a strict 4px/8px spatial grid, high-contrast WCAG AAA typography,
   lining tabular numerics for construction financials, and dual-theme stability.
   ========================================================================== */


  *, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  input, select, textarea, datalist {
    color-scheme: var(--input-color-scheme);
  }

  /* == Accessible Focus-Visible System == */
  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* == Refined Enterprise Custom Scrollbars == */
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--surface4) transparent;
  }
  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--surface4);
    border-radius: var(--radius-pill);
  }
  ::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
  }

  /* == Tabular Numerics for Financials, Quantities, & Measures == */
  .tabular-nums,
  table td,
  .kpi-value,
  .stat-number,
  .u-stat-val,
  .u-font-mono,
  .text-mono,
  input[type="number"],
  .currency-amount,
  .u-mono,
  .td-number,
  .boq-rate,
  .boq-amount {
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
  }

  /* == Loading Skeletons & Shimmer Animation == */
  @keyframes j360-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
  }

  .skeleton,
  .j360-skeleton {
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    animation: j360-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-xs);
    display: inline-block;
  }

  .skeleton-text {
    height: 12px;
    width: 100%;
    border-radius: var(--radius-xs);
    margin-bottom: 4px;
  }

  .skeleton-title {
    height: 20px;
    width: 50%;
    border-radius: var(--radius-xs);
    margin-bottom: 8px;
  }

  .skeleton-card {
    height: 96px;
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
  }

  .skeleton-row {
    height: 36px;
    width: 100%;
    border-radius: var(--radius-xs);
    margin-bottom: 4px;
  }

  /* == Typography System == */
  .text-h1 { font-family: 'Bebas Neue', sans-serif; font-size: 28px; letter-spacing: 1.5px; line-height: 1.1; color: var(--text); }
  .text-h2 { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 1px; line-height: 1.2; color: var(--text); }
  .text-h3 { font-family: 'DM Sans', sans-serif; font-size: 16px; font-weight: 700; line-height: 1.4; color: var(--text); }
  .text-body { font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 400; line-height: 1.6; color: var(--text); }
  .text-body-strong { font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600; line-height: 1.6; color: var(--text); }
  .text-caption { font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 400; color: var(--text2); }
  .text-small { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
  .text-mono { font-family: 'DM Mono', monospace; font-size: 13px; letter-spacing: -0.2px; }

  .res-subpanel { animation: fadeIn .18s ease; }

  /* ============================================================
     JAVENZI SHELL & GLOBAL LAYOUT
     Authoritative layout definition using design tokens.
     ============================================================ */

  .app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--bg);
    transition: grid-template-columns var(--transition-base);
  }

  /* Collapsed Sidebar State */
  .app-shell.sb-collapsed {
    grid-template-columns: 64px 1fr;
  }

  .sidebar {
    height: 100vh;
    background: var(--surface2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
  }

  .sb-brand {
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .sb-brand-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  /* == Utility Classes == */
  .u-text-accent { color: var(--accent-text, var(--accent)); }
  .u-text-accent2 { color: var(--accent2); }
  .u-text-accent3 { color: var(--accent3); }
  .u-text-red { color: var(--danger); }
  .u-text-amber { color: var(--warning); }
  .u-text-success { color: var(--success); }
  .u-text-info { color: var(--info); }
  
  .u-bg-red-glow { background: rgba(240, 96, 96, 0.1); border-color: rgba(240, 96, 96, 0.3); }
  .u-bg-amber-glow { background: rgba(255, 193, 7, 0.1); border-color: rgba(255, 193, 7, 0.3); }
  .u-bg-accent2-glow { background: rgba(100, 200, 130, 0.1); border-color: rgba(100, 200, 130, 0.3); }
  .u-bg-surface { background: var(--surface); }
  .u-bg-surface2 { background: var(--surface2); }
  .u-bg-surface3 { background: var(--surface3); }

  .u-flex { display: flex; }
  .u-flex-column { display: flex; flex-direction: column; }
  .u-flex-between { display: flex; justify-content: space-between; align-items: flex-start; }
  .u-flex-center { display: flex; justify-content: center; align-items: center; }
  .u-flex-gap-xs { gap: var(--spacing-xs); }
  .u-flex-gap-sm { gap: var(--spacing-sm); }
  .u-flex-gap-md { gap: var(--spacing-md); }
  .u-flex-gap-lg { gap: var(--spacing-lg); }
  .u-flex-wrap { flex-wrap: wrap; }
  .u-flex-1 { flex: 1; }
  .u-items-center { align-items: center; }
  .u-items-end { align-items: flex-end; }
  .u-self-center { align-self: center; }

  .u-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .u-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .u-text-h1 { font-family: 'Bebas Neue', sans-serif; font-size: 32px; letter-spacing: 2px; color: var(--text); }
  .u-text-h2 { font-family: 'Bebas Neue', sans-serif; font-size: 24px; letter-spacing: 1.5px; color: var(--text); }
  .u-text-h3 { font-family: 'Bebas Neue', sans-serif; font-size: 18px; letter-spacing: 1px; color: var(--text); }
  .u-text-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); }
  .u-text-caption { font-size: 11px; color: var(--text3); }
  .u-text-strong { font-weight: 700; color: var(--text); }
  .u-text-sm { font-size: 12px; }
  .u-text-base { font-size: 14px; }
  .u-text-center { text-align: center; }
  
  .u-badge { padding: 4px 10px; border-radius: var(--radius-full); font-size: 10px; font-weight: 700; line-height: 1; }
  .u-badge-outline { border: 1px solid var(--border); color: var(--text2); }
  .u-badge-amber { background: var(--warning); color: var(--bg); }
  .u-badge-red { background: var(--danger); color: white; }

  .u-mt-xs { margin-top: var(--spacing-xs); }
  .u-mt-sm { margin-top: var(--spacing-sm); }
  .u-mt-md { margin-top: var(--spacing-md); }
  .u-mt-lg { margin-top: var(--spacing-lg); }
  .u-mb-xs { margin-bottom: var(--spacing-xs); }
  .u-mb-sm { margin-bottom: var(--spacing-sm); }
  .u-mb-md { margin-bottom: var(--spacing-md); }
  .u-mb-lg { margin-bottom: var(--spacing-lg); }
  .u-ml-xs { margin-left: var(--spacing-xs); }
  .u-mx-auto { margin-left: auto; margin-right: auto; }
  .u-p-sm { padding: var(--spacing-sm); }
  .u-p-md { padding: var(--spacing-md); }
  .u-py-xs { padding-top: var(--spacing-xs); padding-bottom: var(--spacing-xs); }
  .u-py-xl { padding-top: var(--spacing-xl); padding-bottom: var(--spacing-xl); }
  .u-pr-xs { padding-right: var(--spacing-xs); }
  
  .u-rounded-md { border-radius: var(--radius-md); }
  .u-border { border: 1px solid var(--border); }
  .u-opacity-md { opacity: 0.7; }
  .u-block { display: block; }
  .u-line-height-md { line-height: 1.5; }
  .u-max-w-lg { max-width: 600px; }
  .u-min-w-0 { min-width: 0; }
  .u-min-w-sm { min-width: 320px; }
  .u-min-w-md { min-width: 480px; }
  .u-overflow-y { overflow-y: auto; }
  .u-max-h-lg { max-height: 560px; }


  /* == Modal System ==
   * ALL modals must use one of these two classes — never inline rgba() backgrounds.
   * Theme-aware backdrop is driven by --overlay (light/dark) + backdrop-filter.
   * .modal-overlay / .j360-modal-overlay  → HTML-declared overlays (hidden by default, shown via .open)
   * .j360-overlay                         → JS-created overlays (immediately visible on creation)
   * Exception: #j360DocViewerOverlay uses --overlay-doc (intentionally opaque in both themes)
   */
  .modal-overlay,
  .j360-modal-overlay,
  .j360-dialog-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay) !important;
    backdrop-filter: blur(6px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
    z-index: var(--z-modal) !important;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
    overscroll-behavior: contain;
    padding: 20px;
  }
  .modal-overlay.open,
  .j360-modal-overlay.open,
  .j360-dialog-backdrop.open {
    display: flex !important;
  }

  /* Confirmations and compact shared prompts sit above ordinary/nested modals. */
  .j360-dialog-backdrop {
    z-index: var(--z-dialog) !important;
  }

  .j360-dialog-backdrop.j360-backdrop-critical {
    z-index: var(--z-modal-critical) !important;
  }

  /* A declared modal opened from another modal must sit above its parent. */
  .modal-overlay.j360-modal-nested,
  .j360-modal-overlay.j360-modal-nested {
    z-index: var(--z-modal-nested) !important;
  }

  /* JS-created overlays: immediately visible, same frosted backdrop as .modal-overlay */
  .j360-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay) !important;
    backdrop-filter: blur(6px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-nested, 10000);
    overflow-y: auto;
    padding: 20px;
  }

  /* Full-screen loading/spinner overlays */
  .j360-overlay-loader {
    position: fixed;
    inset: 0;
    background: var(--overlay) !important;
    backdrop-filter: blur(6px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-nested, 10000);
    gap: 12px;
  }

  .j360-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    animation: modalSlideIn var(--transition-base) ease forwards;
    overflow: hidden;
  }

  .j360-modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
  }

  .j360-modal-body {
    padding: var(--spacing-xl);
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
  }

  @keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .sb-brand-name {
    font-family: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
    font-size: 20px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text);
    line-height: 1;
  }

  .sb-brand-accent {
    color: var(--text);
  }

  .sb-brand-sub {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text3);
    margin-top: 2px;
  }

  .app-right {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    overflow: clip;
  }

  header, #topbar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 90;
    position: sticky;
    top: 0;
  }

  .main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    background: var(--bg);
    scroll-behavior: smooth;
  }

  .panel {
    display: none;
    flex-direction: column;
    width: 100%;
    animation: panelIn var(--transition-base) ease forwards;
  }

  .panel.active {
    display: flex;
  }

  @keyframes panelIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Responsive Adjustments */
  @media (max-width: 768px) {
    .app-shell {
      grid-template-columns: 1fr;
    }
    .sidebar {
      position: fixed;
      left: 0;
      top: 0;
      bottom: 0;
      width: 280px;
      transform: translateX(-100%);
      transition: transform var(--transition-base);
      box-shadow: var(--neon-glow-soft);
    }
    .sidebar.open {
      transform: translateX(0);
    }
  }

  /* == Nav Styling == */
  .sb-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md) 0;
    scrollbar-width: none;
  }
  .sb-nav::-webkit-scrollbar { display: none; }

  .sb-group {
    padding: var(--spacing-sm) 0;
  }

  .sb-group-label {
    display: block;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text3);
    opacity: 0.8;
  }

  .sb-nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text2);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    position: relative;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
  }

  .sb-nav-item:hover {
    color: var(--text);
    background: var(--surface3);
  }

  .sb-nav-item.active {
    color: var(--text);
    background: var(--sb-active-bg, var(--surface2));
    font-weight: 700;
    border-left: 3px solid var(--accent);
    border-radius: 8px;
  }

  .sb-nav-item.active::before {
    display: none;
  }

  .sb-nav-icon {
    font-size: 20px;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
  }

  .sb-nav-item:hover .sb-nav-icon,
  .sb-nav-item.active .sb-nav-icon {
    opacity: 1;
  }

  /* == Sidebar Bottom == */
  .sb-bottom {
    padding: var(--spacing-md) 0;
    border-top: 1px solid var(--border);
    background: var(--surface2);
  }

  .sb-user-strip {
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
  }

  .sb-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: var(--neon-glow-sm);
  }

  .sb-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
  }

  .sb-user-role {
    font-size: 11px;
    color: var(--text3);
    text-transform: capitalize;
  }

  .sb-theme-btn, .sb-settings-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text2);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
    font-family: inherit;
    font-size: 13px;
  }

  .sb-theme-btn:hover, .sb-settings-btn:hover {
    color: var(--text);
    background: var(--surface3);
  }

  /* == Topbar Elements == */
  .topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
  }

  .topbar-page-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 1px;
    color: var(--text);
    margin-left: var(--spacing-sm);
  }

  .topbar-btn {
    height: 36px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-md);
    border-radius: var(--radius-md);
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .topbar-btn:hover {
    background: var(--surface3);
    color: var(--text);
    border-color: var(--text3);
  }

  .topbar-btn-icon {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .topbar-menu-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text2);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
  }

  .topbar-menu-btn:hover {
    background: var(--surface2);
    color: var(--text);
  }

  .todo-btn-badge {
    background: var(--danger);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
  }

  /* == Section Headers == */
  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-md);
  }

  .section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    letter-spacing: 1.5px;
    color: var(--text);
    line-height: 1;
  }

  .section-sub {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--text3);
    margin-top: 4px;
  }

  /* ============================================================
     JAVENZI PREMIUM COMPONENT LIBRARY
     ============================================================ */

  /* == Premium Cards == */
  .j360-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .j360-card:hover {
    border-color: var(--text3);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }

  .j360-card-premium {
    background: linear-gradient(145deg, var(--surface), var(--surface2));
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
  }

  .j360-card-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    opacity: 0.5;
  }

  .j360-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--spacing-sm);
  }

  /* == Premium Buttons == */
  .j360-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid transparent;
    line-height: 1.2;
  }

  .j360-btn-primary {
    background: var(--accent);
    color: #0d0f0e;
    border-color: var(--accent);
    box-shadow: var(--neon-glow-sm);
  }

  .j360-btn-primary:hover {
    background: #fffb00;
    box-shadow: var(--neon-glow-md);
    transform: translateY(-1px);
  }

  .j360-btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border);
  }

  .j360-btn-secondary:hover {
    background: var(--surface3);
    border-color: var(--text3);
  }

  .j360-btn-ghost {
    background: transparent;
    color: var(--text2);
    border-color: transparent;
  }

  .j360-btn-ghost:hover {
    background: var(--surface2);
    color: var(--text);
  }

  .j360-btn-sm { padding: 5px 10px; font-size: 11px; }

  /* == Premium Inputs == */
  .j360-input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
  }

  .j360-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .j360-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition-base);
    width: 100%;
  }

  .j360-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 2px var(--accent-glow);
  }

  /* == Neon Indicators & Badges == */
  .j360-neon-indicator {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
  }

  .j360-neon-indicator-green { background: var(--success); box-shadow: 0 0 8px var(--success); }
  .j360-neon-indicator-amber { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
  .j360-neon-indicator-red { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

  .j360-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .j360-badge-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text2);
  }

  /* ============================================================
     JAVENZI GUARDIAN AI STYLES
     ============================================================ */

  .guardian-workspace {
    padding: var(--spacing-lg);
  }

  .guardian-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
  }

  .guardian-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    min-width: 0;
  }

  .guardian-icon-box {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--surface3);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .guardian-overview-card {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
  }

  .guardian-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(92px, 1fr));
    gap: var(--spacing-sm);
    flex: 1;
  }

  .guardian-stat-card {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    background: var(--surface2);
    border: 1px solid var(--border);
  }

  .guardian-timeline {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    background: var(--surface2);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
  }

  .guardian-msg {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-start;
  }

  .guardian-msg-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
  }

  .guardian-msg-body {
    flex: 1;
    min-width: 0;
  }

  .guardian-msg-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-sm);
  }

  .guardian-bubble {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text);
  }

  .guardian-bubble-user {
    background: var(--surface2);
  }

  .guardian-bubble-ai {
    background: var(--surface3);
  }

  /* Guardian Markdown Elements */
  .guardian-markdown h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    letter-spacing: 1px;
    color: var(--accent-text);
    margin: var(--spacing-lg) 0 var(--spacing-sm);
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
  }

  .guardian-markdown h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin: var(--spacing-md) 0 var(--spacing-xs);
  }

  .guardian-markdown strong {
    color: var(--text);
    font-weight: 600;
  }

  .guardian-markdown .bullet-row {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: 4px;
    padding-left: 4px;
  }

  .guardian-markdown .bullet-dot {
    color: var(--accent-text);
    font-weight: 700;
  }

  .guardian-markdown .para {
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
  }

  .guardian-markdown .guardian-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-md);
    font-size: 12px;
    line-height: 1.5;
  }

  .guardian-markdown .guardian-table th,
  .guardian-markdown .guardian-table td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
  }

  .guardian-markdown .guardian-table th {
    background: var(--surface2);
    color: var(--accent-text);
    font-weight: 700;
    white-space: nowrap;
  }

  .guardian-markdown .guardian-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
  }

  /* Guardian Cards (Events, Health, Reports) */
  .guardian-event-card, .guardian-health-card, .guardian-report-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .guardian-evidence-wrap {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: var(--spacing-sm);
  }

  .guardian-evidence-tag {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    background: var(--surface2);
    border: 1px solid var(--border);
    font-size: 10px;
    color: var(--text2);
    line-height: 1.2;
    font-weight: 600;
  }

  /* Guardian action strip — the buttons under a reply that hand off to a
     compose modal. Right-aligned because they are the trailing call to action
     on the answer above them, and purple rather than the app's yellow --accent
     because purple is Guardian's own identity colour (the panel header, the
     message icons) and every one of these buttons hands off to an AI drafter.

     Declared here rather than composed from .btn-secondary + utilities because
     the base .btn sets `border: none !important` and .btn-secondary sets
     `background: ... !important`, so tinting either from a utility class or an
     inline style is not possible without piling on more !important. One rule
     that owns both is cheaper to read than that fight. Markup keeps
     `.btn .btn-sm` for layout and sizing only.

     The LABEL deliberately stays at --text and is never tinted: accent-coloured
     button text over a surface fill measures ~2.4:1, half the 4.5:1 WCAG AA
     floor. The accent is carried by the border, the icon and the fill instead,
     which measures label 12.5:1 light / 13.5:1 dark and icon 5.0:1 light /
     4.1:1 dark — both clear of AA. --guardian is deepened for the light theme
     the same way --accent and the supporting palette are. */
  .guardian-action-strip {
    display: flex;
    gap: var(--spacing-xs);
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: var(--spacing-sm);
  }

  /* Selectors are written `.btn.guardian-action-btn` rather than
     `.guardian-action-btn` alone: `.btn { border: none !important }` sits ~3800
     lines further down the file, and between two !important declarations of
     EQUAL specificity the later one wins. Matching .btn as well raises this to
     (0,2,0) so it wins on specificity instead, independent of source order. */
  .btn.guardian-action-btn {
    background: transparent;
    border: 1px solid rgba(var(--guardian-rgb), .45) !important;
    color: var(--text);
  }

  .btn.guardian-action-btn .material-symbols-outlined { color: var(--guardian); }

  .btn.guardian-action-btn:hover {
    background: rgba(var(--guardian-rgb), .14);
    border-color: rgba(var(--guardian-rgb), .7) !important;
  }

  /* An action Guardian actively recommended, as opposed to the always-present
     fallback chip. Same purple, filled instead of outlined. */
  .btn.guardian-action-btn-suggested {
    background: rgba(var(--guardian-rgb), .12);
    border-color: rgba(var(--guardian-rgb), .55) !important;
  }

  .btn.guardian-action-btn-suggested:hover { background: rgba(var(--guardian-rgb), .22); }

  /* Guardian Composer */
  .guardian-composer {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    background: var(--surface2);
    border: 1px solid var(--border);
  }

  .guardian-composer-input-wrap {
    display: flex;
    gap: var(--spacing-md);
    align-items: flex-end;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    background: var(--surface3);
    border: 1px solid var(--border);
  }

  .guardian-composer-textarea {
    flex: 1;
    resize: vertical;
    min-height: 48px;
    max-height: 220px;
    background: transparent;
    border: none;
    padding: 6px 0;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    line-height: 1.5;
  }

  @keyframes guardianDot {
    0%, 60%, 100% { opacity: .15; }
    30% { opacity: 1; }
  }

  /* ============================================================
     JAVENZI MATERIAL SCHEDULE WIZARD STYLES
     ============================================================ */

  .ms-wizard-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border);
  }

  .ms-step {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    opacity: 0.5;
    transition: opacity var(--transition-base);
  }

  .ms-step-active {
    opacity: 1;
  }

  .ms-step-indicator {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: var(--surface3);
    border: 1px solid var(--border);
    color: var(--text3);
    transition: all var(--transition-base);
  }

  .ms-step-active .ms-step-indicator {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    box-shadow: var(--neon-glow-sm);
  }

  .ms-step-done .ms-step-indicator {
    background: var(--accent2);
    border-color: var(--accent2);
    color: var(--bg);
  }

  .ms-step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
  }

  .ms-step-active .ms-step-label {
    color: var(--text);
  }

  /* Column Mapping UI */
  .ms-col-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
  }

  .ms-col-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
  }

  .ms-sample-box {
    font-size: 10px;
    color: var(--text3);
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--surface2);
    border-radius: var(--radius-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-left: 2px solid var(--border);
  }

  .ms-conf-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .ms-conf-high { background: rgba(100, 200, 120, 0.1); color: var(--accent2); border: 1px solid rgba(100, 200, 120, 0.3); }
  .ms-conf-medium { background: rgba(255, 193, 7, 0.1); color: var(--warning); border: 1px solid rgba(255, 193, 7, 0.3); }
  .ms-conf-none { background: var(--surface3); color: var(--text3); border: 1px solid var(--border); }

  .ms-automap-callout {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(100, 200, 120, 0.08);
    border: 1px solid rgba(100, 200, 120, 0.25);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-lg);
    font-size: 12px;
    color: var(--text2);
    animation: fadeIn var(--transition-base) ease forwards;
  }

  /* MFE Panel Overrides */
  .mfe-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-top: 10px;
    margin-bottom: 0;
    overflow: hidden;
  }

  .mfe-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--surface2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background var(--transition-fast);
  }

  .mfe-header:hover {
    background: var(--surface3);
  }

  .mfe-tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
  }

  .mfe-tab-btn {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .mfe-tab-btn:hover {
    color: var(--text);
    background: var(--surface3);
  }

  .mfe-tab-btn.active {
    color: var(--text);
    background: var(--surface);
    font-weight: 700;
    position: relative;
  }
  .mfe-tab-btn.active::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    bottom: -1px;
    height: 3px;
    background: var(--accent);
    border-radius: 999px;
    z-index: 1;
  }
  /* ── Unified Search & Filter Controls ──────────────────────────────────── */
  .search-wrap,
  .filter-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
  }

  .search-wrap .search-icon,
  .filter-wrap .filter-icon {
    position: absolute;
    left: var(--ctrl-icon-left);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--ctrl-icon-size);
    color: var(--text3);
    pointer-events: none;
    user-select: none;
  }

  .filter-wrap .filter-chevron {
    position: absolute;
    right: var(--ctrl-chevron-right);
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--ctrl-chevron-size);
    color: var(--text3);
    pointer-events: none;
    user-select: none;
  }

  .search-wrap input[type="text"],
  .search-wrap input[type="search"] {
    height: var(--ctrl-height);
    padding: var(--ctrl-pad-y) var(--ctrl-pad-r) var(--ctrl-pad-y) var(--ctrl-text-indent);
    border: 1px solid var(--border);
    border-radius: var(--ctrl-radius);
    background: var(--surface2);
    color: var(--text);
    font-size: var(--ctrl-font-size);
    width: 100%;
    transition: border-color .18s, box-shadow .18s;
  }
  .search-wrap input[type="text"]:focus,
  .search-wrap input[type="search"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow2);
    outline: none;
  }

  /* ── Universal Search Clear Button ("x") ────────────────────────────── */
  .search-wrap input[type="text"],
  .search-wrap input[type="search"],
  .j360-search-has-clear {
    padding-right: 32px !important;
  }

  .search-clear-btn {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text3);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin: 0;
    transition: color .15s ease, background .15s ease, transform .12s ease;
    z-index: 2;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .search-clear-btn:hover {
    color: var(--text);
    background: var(--surface3);
  }

  .search-clear-btn:active {
    transform: translateY(-50%) scale(0.9);
  }

  .search-clear-btn.is-visible {
    display: inline-flex !important;
  }

  /* Suppress inconsistent browser-native cancel buttons on search inputs */
  input[type="search"]::-webkit-search-cancel-button,
  input[type="search"]::-webkit-search-decoration,
  input[type="search"]::-webkit-search-results-button,
  input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
  }

  .filter-wrap select {
    height: var(--ctrl-height);
    padding: var(--ctrl-pad-y) var(--ctrl-select-pad-r) var(--ctrl-pad-y) var(--ctrl-text-indent);
    border: 1px solid var(--border);
    border-radius: var(--ctrl-radius);
    background: var(--surface2);
    color: var(--text);
    font-size: var(--ctrl-font-size);
    width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color .18s;
  }
  .filter-wrap select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow2);
    outline: none;
  }

  @media (max-width: 768px) {
    #vaultFilterBar {
      flex-wrap: wrap !important;
    }
    #vaultFilterBar .search-wrap,
    #vaultFilterBar .filter-wrap {
      width: 100% !important;
      max-width: 100% !important;
    }
  }

  /* Full-width variant for form/modal context */
  .filter-wrap--full {
    width: 100%;
    display: flex;
  }

  /* Bare context-switcher select — no icon, no chevron */
  .bare-select {
    height: var(--ctrl-height);
    padding: var(--ctrl-pad-y) var(--ctrl-pad-r);
    border: 1px solid var(--border);
    border-radius: var(--ctrl-radius);
    background: var(--surface2);
    color: var(--text);
    font-size: var(--ctrl-font-size);
    cursor: pointer;
    transition: border-color .18s;
  }
  .bare-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow2);
    outline: none;
  }

  /* == Dashboard == */
  .dash-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:14px;margin-bottom:16px;}
  .dash-kpi{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:16px 18px;display:flex;flex-direction:column;gap:4px;position:relative;overflow:hidden;}
  .dash-kpi::after{content:'';position:absolute;bottom:-18px;right:-12px;width:70px;height:70px;border-radius:50%;opacity:.07;}
  .dash-kpi-label{font-size:11.5px;font-weight:700;letter-spacing:1px;text-transform:uppercase;color:var(--text3);}
  .dash-kpi-value{font-family:'DM Mono',monospace;font-size:22px;font-weight:700;color:var(--text);line-height:1;}
  .dash-kpi-sub{font-size:12px;color:var(--text3);margin-top:2px;}
  .dash-kpi-icon{font-size:28px;position:absolute;right:14px;top:14px;opacity:.18;}
  .dash-section-title{font-size:12px;font-weight:700;letter-spacing:1px;text-transform:uppercase;color:var(--text3);margin:18px 0 8px 0;}
  /* == j360-alert-card — Unified alert card component (v2) ==================
     Replaces the old .dash-alert-row and .alert-box systems.
     Used in: Tender Register strip, Dashboard alerts, Dashboard 7-day panel.
     Structure: [3px accent bar] [icon] [body: ref + client + detail] [chip + snooze btn]
     All colours come from CSS variables — works in both dark and light themes.   */

  /* Outer card wrapper — base styles shared by all types */
  .j360-alert-card {
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;              /* clips the accent bar to the card corners */
    transition: border-color .18s, background .18s;
    cursor: pointer;
    position: relative;
  }
  /* Explicit font-family on the card root ensures all children inherit DM Sans.
     Browsers reset font-family on <button> elements to system UI by default;
     setting it here makes font-family:inherit on .j360ac-snooze reliable. */
  .j360-alert-card { font-family: 'DM Sans', sans-serif; }
  .j360-alert-card:hover { background: var(--surface2); }

  /* Left accent bar — 3px coloured stripe, colour set via inline var per type */
  .j360ac-bar {
    width: 3px;
    flex-shrink: 0;
    /* background-color set inline by buildAlertCard() using type-specific var */
  }

  /* Icon column */
  .j360ac-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    flex-shrink: 0;
    font-size: 18px;
    /* color set inline by buildAlertCard() using type-specific var */
  }

  /* Body: reference + client name + detail line */
  .j360ac-body {
    flex: 1;
    padding: 10px 8px 10px 0;
    min-width: 0;                  /* allows text-overflow:ellipsis to fire */
  }
  .j360ac-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
  }
  /* Structured tender/job references — DM Mono (e.g. TR209/2024/2025/W/01) */
  .j360ac-ref {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
  }
  /* Free-text labels — project names, counts, aggregate titles — DM Sans bold */
  .j360ac-ref-sans {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* Client / title text — explicit DM Sans, not inherited, for cross-browser safety */
  .j360ac-client {
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 360px;
  }
  /* Detail / description sub-line — explicit DM Sans */
  .j360ac-detail {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    color: var(--text2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
  }

  /* Right side: countdown chip + snooze button stacked */
  .j360ac-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
    padding: 10px 12px 10px 8px;
    flex-shrink: 0;
  }

  /* Countdown / label pill chip — explicit DM Sans */
  .j360ac-chip {
    font-family: 'DM Sans', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.03em;
    /* background + color set inline per type */
  }
  .j360ac-chip-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
    /* background set inline per type */
  }

  /* Snooze / dismiss button — font-family:inherit resolves to DM Sans because
     .j360-alert-card now sets it explicitly on the root element above */
  .j360ac-snooze {
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid transparent;   /* border colour set inline per type */
    background: transparent;
    cursor: pointer;
    letter-spacing: 0.02em;
    color: var(--text3);             /* default muted; overridden inline per type */
    opacity: 0;
    transition: opacity .15s, background .15s;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
  }
  /* Reveal snooze button when the parent card is hovered */
  .j360-alert-card:hover .j360ac-snooze { opacity: 1; }
  .j360ac-snooze:hover { background: var(--surface3); }

  /* Action button — always visible, used for hard-resolve actions like "Record cert" */
  .j360ac-action {
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid rgba(104,211,145,.4);
    background: rgba(104,211,145,.12);
    color: var(--accent2);
    cursor: pointer;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    transition: background .15s;
  }
  .j360ac-action:hover { background: rgba(104,211,145,.25); }

  /* == Type-specific colour tokens ==
     Each type adds a modifier class on the outer card for hover border colour.
     The icon colour, bar colour, chip bg/colour are set inline by buildAlertCard(). */
  .j360-alert-card.jac-urgent  { border-color: rgba(240,96,96,.22);   }
  .j360-alert-card.jac-urgent:hover  { border-color: rgba(240,96,96,.4);  }
  .j360-alert-card.jac-warning { border-color: rgba(240,160,32,.22);  }
  .j360-alert-card.jac-warning:hover { border-color: rgba(240,160,32,.4); }
  .j360-alert-card.jac-info    { border-color: rgba(96,184,240,.22);  }
  .j360-alert-card.jac-info:hover    { border-color: rgba(96,184,240,.4); }
  .j360-alert-card.jac-success { border-color: rgba(126,200,160,.22); }
  .j360-alert-card.jac-success:hover { border-color: rgba(126,200,160,.4); }
  /* Light-mode overrides — tinted backgrounds for better contrast on white surfaces */
  [data-theme='light'] .j360-alert-card.jac-urgent  { background: rgba(240,96,96,.04);   }
  [data-theme='light'] .j360-alert-card.jac-warning { background: rgba(240,160,32,.04);  }
  [data-theme='light'] .j360-alert-card.jac-info    { background: rgba(96,184,240,.04);  }
  [data-theme='light'] .j360-alert-card.jac-success { background: rgba(126,200,160,.04); }
  .dash-chart-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;box-shadow:0 1px 4px var(--shadow-card);overflow:hidden;}
  .dash-chart-header{padding:12px 16px;border-bottom:1px solid var(--border);background:var(--surface2);font-size:12px;font-weight:700;color:var(--text2);}
  .dash-chart-body{padding:16px;}
  .dash-bar-row{display:grid;grid-template-columns:120px 1fr 80px;gap:8px;align-items:center;margin-bottom:8px;font-size:12px;}
  .dash-bar{height:10px;border-radius:5px;background:var(--accent);transition:width .5s ease;}
  .dash-bar-track{background:var(--surface2);border-radius:5px;overflow:hidden;height:10px;}
  .dash-tender-row{padding:8px 12px;border-bottom:1px solid var(--border);display:grid;grid-template-columns:1fr auto;gap:8px;align-items:center;font-size:12px;cursor:pointer;transition:background .15s;}
  .dash-tender-row:hover{background:var(--surface2);}
  .dash-project-row{padding:8px 12px;border-bottom:1px solid var(--border);display:grid;grid-template-columns:1fr auto auto;gap:8px;align-items:center;font-size:12px;cursor:pointer;transition:background .15s;}
  .dash-project-row:hover{background:var(--surface2);}
  .dash-mini-tag{padding:2px 8px;border-radius:10px;font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;}

  body{background:var(--bg);color:var(--text);font-family:'DM Sans',sans-serif;font-size:14px;min-height:100vh;}
  html{overflow-x:hidden;}
  header,#topbar{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border);background:var(--bg);}
  .logo{display:flex;align-items:center;gap:12px;}
  .logo-mark{width:36px;height:36px;background:var(--accent);border-radius:8px;display:flex;align-items:center;justify-content:center;font-family:'Bebas Neue',sans-serif;font-size:20px;color:#0d0f0e;}
  .logo-text{font-family:'Bebas Neue',sans-serif;font-size:22px;letter-spacing:2px;}
  .logo-sub{font-size:10px;color:var(--text2);letter-spacing:3px;text-transform:uppercase;margin-top:-4px;}
  .header-badge{background:var(--surface3);border:1px solid var(--border);border-radius:20px;padding:6px 14px;font-size:11px;color:var(--accent);letter-spacing:1px;text-transform:uppercase;font-family:'DM Mono',monospace;}
  /* .app defined in layout section below */
  /* .sidebar defined in layout section */
  .sidebar-section-title{font-size:10px;letter-spacing:2px;text-transform:uppercase;color:var(--text3);font-weight:600;margin-bottom:10px;}
  .config-block{background:var(--surface2);border:1px solid var(--border);border-radius:10px;padding:16px;}
  label{display:block;font-size:12px;color:var(--text2);margin-bottom:6px;font-weight:500;letter-spacing:.5px;}
  input[type="text"],input[type="number"],input[type="password"],input[type="date"],input[type="email"],input[type="tel"],input[type="url"],input[type="search"],select,textarea{width:100%;background:var(--surface3);border:1px solid var(--border);border-radius:6px;padding:8px 10px;color:var(--text);font-family:'DM Sans',sans-serif;font-size:13px;outline:none;transition:border-color .2s;}
  /* Search & filter control resets — must sit after the global input rule above.
     padding uses !important to win the specificity battle against Section 2's
     "padding: 8px 12px !important" at line ~4671 (Block 2 global input reset). */
  .search-wrap input[type="text"],.search-wrap input[type="search"]{height:var(--ctrl-height);padding:var(--ctrl-pad-y) var(--ctrl-pad-r) var(--ctrl-pad-y) var(--ctrl-text-indent) !important;font-size:var(--ctrl-font-size) !important;background:var(--surface2);border-radius:var(--ctrl-radius);}
  .filter-wrap select{height:var(--ctrl-height);padding:var(--ctrl-pad-y) var(--ctrl-select-pad-r) var(--ctrl-pad-y) var(--ctrl-text-indent) !important;font-size:var(--ctrl-font-size) !important;background:var(--surface2);border-radius:var(--ctrl-radius);appearance:none !important;-webkit-appearance:none !important;}
  /* Remove number spinner arrows on BOQ % inputs — sliders are the preferred control */
  input[id^="boqPctInp_"]::-webkit-inner-spin-button,
  input[id^="boqPctInp_"]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
  input[id^="boqPctInp_"] { -moz-appearance:textfield; appearance:textfield; }
  input[id^="boqBatchPctInp_"]::-webkit-inner-spin-button,
  input[id^="boqBatchPctInp_"]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
  input[id^="boqBatchPctInp_"] { -moz-appearance:textfield; appearance:textfield; }
  /* BOQ IPA Slider thumb styling */
  input[id^="boqSlider_"] { -webkit-appearance:none; appearance:none; border:none; padding:0; }
  input[id^="boqSlider_"]::-webkit-slider-runnable-track { height:8px; border-radius:4px; }
  input[id^="boqSlider_"]::-webkit-slider-thumb { -webkit-appearance:none; width:16px; height:16px; border-radius:50%; background:var(--accent); cursor:pointer; border:2px solid var(--surface); box-shadow:0 1px 4px rgba(0,0,0,.3); margin-top:-4px; }
  input[id^="boqSlider_"]::-moz-range-track { height:8px; border-radius:4px; }
  input[id^="boqSlider_"]::-moz-range-thumb { width:16px; height:16px; border-radius:50%; background:var(--accent); cursor:pointer; border:2px solid var(--surface); box-shadow:0 1px 4px rgba(0,0,0,.3); }
  input[type="datetime-local"],input[type="date"],input[type="time"]{color-scheme:var(--input-color-scheme);}
  input[type="checkbox"],input[type="radio"]{width:auto;min-width:0;background:none;border:none;padding:0;border-radius:0;font-size:inherit;outline:revert;transition:none;}
  input:focus,select:focus,textarea:focus{border-color:var(--accent);}
input[type="password"]{font-family:'DM Mono',monospace;letter-spacing:2px;}
  /* .mode-btn defined fully in LEAN HR STYLES section below */
  /* .btn/.btn-primary/.btn-secondary/.btn-danger/.btn-sm consolidated into
     the Section 2 rules (~line 4803) 2026-08 -- those fully superseded
     these via !important + source order, this copy was dead weight.
     .btn-info/.btn-full/.btn:disabled are NOT redeclared there -- kept here. */
  .btn-info{background:transparent;color:var(--info);border:1px solid var(--info);}
  .btn-info:hover{background:var(--info);color:#0d0f0e;}
  .btn-full{width:100%;}
  .btn:disabled{opacity:.4;cursor:not-allowed;transform:none;}
  /* .main defined in layout section */
  .tab{padding:8px 14px;border-radius:7px;font-size:12px;font-weight:500;cursor:pointer;color:var(--text2);transition:all .15s;border:none;background:transparent;white-space:nowrap;flex-shrink:0;}
  .tab.active{background:var(--surface3);color:var(--accent);border:1px solid var(--border);}
  .tab.tab-alert{color:var(--accent3);border:1px solid rgba(240,192,0,.35);background:rgba(240,192,0,.06);}
  .tab.tab-alert-critical{color:var(--danger);border:1px solid rgba(240,96,96,.4);background:rgba(240,96,96,.07);animation:tabAlertPulse 2s ease-in-out infinite;}
  .tab.tab-alert-critical:hover,.tab.tab-alert:hover{background:var(--surface2);}
  @keyframes tabAlertPulse{0%,100%{box-shadow:0 0 0 0 rgba(240,96,96,.35);}50%{box-shadow:0 0 0 5px rgba(240,96,96,0);}}
  @keyframes progressGlowPulse{0%,100%{box-shadow:0 0 0 0 rgba(220,38,38,.6),0 0 8px rgba(220,38,38,.3);}50%{box-shadow:0 0 0 6px rgba(220,38,38,0),0 0 16px rgba(220,38,38,.5);}}
  .btn-progress-due{background:rgba(220,38,38,.15)!important;border-color:rgba(220,38,38,.6)!important;color:#f87171!important;animation:progressGlowPulse 2s ease-in-out infinite!important;font-weight:700!important;}
  .btn-progress-done{background:rgba(80,80,80,.12)!important;border-color:rgba(120,120,120,.3)!important;color:var(--text3)!important;animation:none!important;}
  @keyframes cardProgressPulse{0%,100%{outline:2px solid rgba(220,38,38,.7);outline-offset:0px;box-shadow:inset 0 0 0 1px rgba(220,38,38,.3);}50%{outline:2px solid rgba(220,38,38,.15);outline-offset:4px;box-shadow:inset 0 0 12px rgba(220,38,38,.18);}}
  .card-progress-due{border-color:rgba(220,38,38,.6)!important;outline:2px solid rgba(220,38,38,.7);outline-offset:0px;animation:cardProgressPulse 2s ease-in-out infinite!important;}  .card-progress-due:hover{border-color:rgba(220,38,38,.9)!important;}

  /* Field highlight pulse for Site Possession Date focus */
  @keyframes fieldHighlightPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6), 0 0 8px rgba(220, 38, 38, 0.3); border-color: rgba(220, 38, 38, 0.8) !important; }
    50% { box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.2), 0 0 16px rgba(220, 38, 38, 0.5); border-color: rgba(220, 38, 38, 1) !important; }
  }
  .field-highlight-pulse {
    animation: fieldHighlightPulse 1.5s ease-in-out 3 !important;
    border-color: rgba(220, 38, 38, 0.8) !important;
  }

  /* == Statutory document row — incomplete / pending entry indicator ==
     Softer variant of cardProgressPulse: outline-offset is smaller (2px max)
     so it stays inside the compact card grid without overlapping neighbours,
     and period is 1.6 s (slightly snappier) to feel form-level not alarm-level. */
  @keyframes sdocRowPulse{
    0%,100%{outline:2px solid rgba(220,38,38,.65);outline-offset:0px;box-shadow:inset 0 0 0 1px rgba(220,38,38,.18);}
    50%{outline:2px solid rgba(220,38,38,.12);outline-offset:2px;box-shadow:inset 0 0 8px rgba(220,38,38,.13);}
  }
  .sdoc-row--pending{
    border-color:rgba(220,38,38,.5)!important;
    animation:sdocRowPulse 1.6s ease-in-out infinite;
  }
  .sdoc-row--pending:hover{border-color:rgba(220,38,38,.85)!important;}

  .panel{display:none;flex-direction:column;gap:20px;}
  .panel.active{display:flex;}
  .card{background:var(--surface);border:1px solid var(--border);border-radius:12px;overflow:hidden;}
  .card-header{padding:16px 20px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;background:var(--surface2);}
  .card-title{font-size:13px;font-weight:600;color:var(--text);letter-spacing:.3px;}
  .card-body{padding:20px;}

  /* == ENTERPRISE REGISTER CARD PATTERN (Standardized List & Data Grid) == */
  .register-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px var(--shadow-card);
  }
  .register-card-header {
    padding: 16px 20px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .register-card-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
  }
  .register-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: 1.5px solid var(--border-strong, #090b09);
    color: #090b09;
    flex-shrink: 0;
    font-size: 20px;
    box-shadow: 0 0 0 1px rgba(252,225,1,.2), 0 2px 8px rgba(0,0,0,.08);
  }
  .register-card-icon .j360-icon {
    color: #090b09 !important;
  }
  .register-card-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
    line-height: 1.25;
  }
  .register-card-sub {
    font-size: 11px;
    color: var(--text2);
    margin-top: 3px;
    line-height: 1.4;
  }
  .register-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .register-card-toolbar {
    padding: 10px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .register-bulk-bar {
    padding: 8px 16px;
    background: var(--surface3);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
  }
  .register-card .table-wrap {
    overflow-x: auto;
    background: var(--surface);
  }
  .register-card table tbody tr {
    transition: background 0.15s ease;
  }
  .register-card table tbody tr:hover td {
    background: var(--surface2) !important;
  }
  .register-card .sel-th, .register-card .sel-td {
    width: 38px;
    text-align: center;
    padding-left: 12px;
    padding-right: 6px;
  }
  .register-card .row-num-th, .register-card .row-num-td {
    width: 44px;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: var(--text3);
    text-align: center;
  }

  .table-wrap{overflow-x:auto;}
  table{width:100%;border-collapse:collapse;font-size:12px;}
  th{background:var(--surface2);padding:10px 12px;text-align:left;font-size:10px;font-weight:600;letter-spacing:1px;text-transform:uppercase;color:var(--text2);border-bottom:1px solid var(--border);white-space:nowrap;}
  td{padding:9px 12px;border-bottom:1px solid var(--border);color:var(--text);vertical-align:middle;}
  tr:last-child td{border-bottom:none;}
  tr:hover td{background:var(--surface2);}
  td input{padding:4px 8px;font-size:12px;}
  .rate-category{display:inline-block;padding:2px 8px;border-radius:4px;font-size:10px;font-weight:600;letter-spacing:.5px;text-transform:uppercase;}
  .upload-zone{border:2px dashed var(--border);border-radius:12px;padding:48px 32px;text-align:center;transition:all .2s;cursor:pointer;position:relative;}
  .upload-zone:hover,.upload-zone.dragover{border-color:var(--accent);background:rgba(252,225,1,.03);}
  .upload-zone input[type="file"]{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;}
  /* BOQ import step 1 is a drop target (see _boqWireDropZone) but is not an
     .upload-zone -- it also holds the sheet selector -- so it needs its own
     drag feedback rather than borrowing that class. */
  #boqStep1.dragover{outline:2px dashed var(--accent);outline-offset:-6px;border-radius:12px;background:rgba(252,225,1,.03);}
  .stats-strip{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:16px;}
  .stat-card{background:var(--surface2);border:1px solid var(--border);border-radius:10px;padding:14px 16px;box-shadow:0 1px 4px var(--shadow-card);}
  .stat-label{font-size:11.5px;color:var(--text3);letter-spacing:1px;text-transform:uppercase;}
  .stat-value{font-family:'Bebas Neue',sans-serif;font-size:26px;color:var(--text);letter-spacing:1px;margin-top:2px;}
  .stat-sub{font-size:11px;color:var(--text2);margin-top:2px;}
  .toast-container{position:fixed;bottom:24px;right:24px;display:flex;flex-direction:column;gap:8px;z-index:var(--z-toast);}

  .toast{background:var(--surface2);border:1px solid var(--border);border-radius:8px;padding:12px 16px;font-size:13px;color:var(--text);display:flex;align-items:center;gap:10px;animation:slideIn .3s ease;max-width:340px;box-shadow:0 8px 24px rgba(0,0,0,.4);}
  .toast.success{border-left:3px solid var(--accent2);}
  .toast.error{border-left:3px solid var(--danger);}
  .toast.info{border-left:3px solid var(--accent);}
  .toast.warning{border-left:3px solid var(--accent3);}
  @keyframes slideIn{from{transform:translateX(100%);opacity:0;}to{transform:translateX(0);opacity:1;}}
  .spinner{width:16px;height:16px;border:2px solid var(--surface3);border-top-color:var(--accent);border-radius:50%;animation:spin .7s linear infinite;display:inline-block;}
  @keyframes spin{to{transform:rotate(360deg);}}
  .progress-bar{height:3px;background:var(--surface3);border-radius:2px;overflow:hidden;margin-top:8px;}
  .progress-fill{height:100%;background:var(--accent);border-radius:2px;transition:width .3s;}
  .section-header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;}
  .section-title{font-family:'Bebas Neue',sans-serif;font-size:22px;letter-spacing:1.5px;color:var(--text);}
  .section-sub{font-size:13px;color:var(--text2);margin-top:2px;}
  .empty-state{text-align:center;padding:48px 24px;color:var(--text2);}
  .empty-icon{font-size:48px;margin-bottom:12px;display:block;}
  .empty-title{font-size:16px;font-weight:600;color:var(--text);margin-bottom:6px;}
  
  
  @keyframes pulse{0%,100%{opacity:1;}50%{opacity:.4;}}
  .cat-prelim{background:rgba(124,94,240,.15);color:#a78bfa;}
  .cat-pcsum{background:rgba(168,85,247,.15);color:#c084fc;}
  .cat-substructure{background:rgba(234,179,8,.15);color:#fbbf24;}
  .cat-frame{background:rgba(99,102,241,.15);color:#818cf8;}
  .cat-walling{background:rgba(239,68,68,.15);color:#f87171;}
  .cat-roofing{background:rgba(34,197,94,.15);color:#4ade80;}
  .cat-doors{background:rgba(20,184,166,.15);color:#2dd4bf;}
  .cat-windows{background:rgba(14,165,233,.15);color:#38bdf8;}
  .cat-finishes{background:rgba(249,115,22,.15);color:#fb923c;}
  .cat-floortiles{background:rgba(245,158,11,.15);color:#fbbf24;}
  .cat-walltiles{background:rgba(20,184,166,.15);color:#2dd4bf;}
  .cat-marblegranite{background:rgba(168,85,247,.15);color:#c084fc;}
  .cat-glazing{background:rgba(14,165,233,.15);color:#38bdf8;}
  .cat-plumbing{background:rgba(6,182,212,.15);color:#22d3ee;}
  .cat-electrical{background:rgba(234,179,8,.15);color:#facc15;}
  .cat-firefighting{background:rgba(239,68,68,.2);color:#fca5a5;}
  .cat-external{background:rgba(168,85,247,.15);color:#c084fc;}
  .cat-other{background:rgba(148,163,184,.15);color:#94a3b8;}
  /* Custom BOQ Creator styles */
  .boq-creator-bill{background:var(--surface2);border:1px solid var(--border);border-radius:10px;margin-bottom:16px;overflow:hidden;}
  .boq-creator-bill-header{padding:10px 16px;background:rgba(42,122,79,.15);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:10px;cursor:pointer;}
  .boq-creator-bill-title{font-weight:700;font-size:13px;color:var(--accent2);flex:1;}
  .boq-creator-bill-total{font-size:12px;color:var(--text2);font-family:'DM Mono',monospace;}
  .boq-creator-element{margin:8px 12px;background:var(--surface);border:1px solid var(--border);border-radius:8px;overflow:hidden;}
  .boq-creator-element-header{padding:7px 12px;background:rgba(104,211,145,.06);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px;}
  .boq-creator-element-title{font-weight:600;font-size:12px;color:var(--text1);flex:1;}
  .boq-creator-items table{width:100%;border-collapse:collapse;font-size:12px;}
  .boq-creator-items th{padding:5px 8px;background:var(--surface2);font-size:10px;font-weight:600;color:var(--text3);text-transform:uppercase;letter-spacing:.5px;}
  .boq-creator-items td{padding:4px 6px;border-top:1px solid rgba(255,255,255,.04);}
  .boq-add-btn{background:rgba(42,122,79,.12);border:1px dashed rgba(104,211,145,.3);color:var(--accent2);padding:5px 12px;border-radius:6px;font-size:11px;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all .2s;}
  .boq-add-btn:hover{background:rgba(42,122,79,.25);border-color:var(--accent2);}
  .boq-section-divider{padding:6px 12px;font-size:10px;font-weight:700;color:var(--text3);text-transform:uppercase;letter-spacing:1px;background:var(--surface2);border-bottom:1px solid var(--border);}
  .boq-summary-row{background:rgba(42,122,79,.1);font-weight:700;}
  .rate-cell{font-family:'DM Mono',monospace;font-size:12px;color:var(--text);}
  .amount-cell{font-family:'DM Mono',monospace;font-size:12px;color:var(--accent2);font-weight:500;}
  .conf-bar{height:4px;border-radius:2px;background:var(--surface3);overflow:hidden;margin-top:3px;}
  .ai-reasoning{font-size:11px;color:var(--text2);margin-top:3px;font-style:italic;}
  .status-dot{width:8px;height:8px;border-radius:50%;display:inline-block;margin-right:6px;}
  /* +++ PROJECT DETAIL MODAL — COMPACT TWO-ROW HEADER +++
     Row 1: identity (title + subtitle) + close button
     Row 2: horizontally-scrollable action button strip
     Header height is FIXED regardless of title length     */

  .pd-header {
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    /* position: sticky removed because it is now inside a flex column */
    z-index: 10;
  }
  .pd-body-wrap > *,
  .pd-body-wrap > [data-pd-section] > * {
    flex-shrink: 0;
  }
  .pd-id-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 10px;
    border-bottom: 1px solid var(--border);
    min-height: 0;
  }
  .pd-title-col {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .pd-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 0.8px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    cursor: default;
  }
  .pd-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .pd-title.expanded {
    white-space: normal;
    text-overflow: clip;
  }
  .pd-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text3);
    padding: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: color .15s;
  }
  .pd-expand-btn:hover { color: var(--text2); }
  .pd-subtitle {
    font-size: 11px;
    color: var(--text2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
  }
  .pd-close-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text2);
    display: flex;
    align-items: center;
    transition: border-color .15s, color .15s;
  }
  .pd-close-btn:hover { border-color: var(--accent); color: var(--accent); }
  .pd-btn-strip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 18px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
  }
  .pd-btn-strip::-webkit-scrollbar { display: none; }
  .pd-btn-divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 3px;
  }
  .pd-strip-wrap {
    position: relative;
    overflow: hidden;
  }
  .pd-strip-wrap::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: 32px;
    background: linear-gradient(to right, transparent, var(--surface2));
    pointer-events: none;
  }
  .status-matched{background:var(--accent2);}
  .status-partial{background:var(--accent3);}
  .status-unmatched{background:var(--danger);}
  .status-healthy{background:var(--accent2);}   /* green */
  .status-warning{background:var(--accent3);}   /* amber */
  .status-caution{background:#f97316;}           /* orange */
  .status-critical{background:var(--danger);}   /* red */
  /* Extended status dot variants for cashflow/bid intel health indicators */
  .status-healthy{background:var(--accent2);}   /* green — all good */
  .status-warning{background:var(--accent3);}   /* amber — monitor */
  .status-caution{background:#f97316;}           /* orange — take action */
  .status-critical{background:var(--danger);}   /* red — urgent */
  .status-info{background:var(--info);}         /* blue — informational */
  /* == PROJECT SPECIFIC == */
  .project-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;overflow:hidden;transition:border-color .2s;margin-bottom:14px;}

  /* == MFE Rate Suggester ==================================================== */
  #mfeRateSuggestBar{background:rgba(104,211,145,.07);border:1px solid rgba(104,211,145,.28);border-radius:10px;padding:12px 14px;margin-bottom:12px;display:none;}
  #mfeRateSuggestBar .mfe-rs-title{font-size:10px;font-weight:700;color:var(--accent2);text-transform:uppercase;letter-spacing:1px;margin-bottom:8px;display:flex;align-items:center;gap:6px;}
  .mfe-rs-chip{display:inline-flex;flex-direction:column;gap:2px;background:var(--surface);border:1px solid rgba(104,211,145,.3);border-radius:8px;padding:7px 11px;cursor:pointer;transition:all .15s;min-width:180px;max-width:240px;vertical-align:top;}
  .mfe-rs-chip:hover{border-color:var(--accent2);background:rgba(104,211,145,.1);transform:translateY(-1px);}
  .mfe-rs-chip-name{font-size:11px;font-weight:700;color:var(--text1);line-height:1.3;}
  .mfe-rs-chip-meta{font-size:9px;color:var(--text3);}
  .mfe-rs-chip-mats{font-size:9px;color:var(--accent2);margin-top:2px;}
  .mfe-rs-chip-score{font-size:9px;padding:1px 5px;border-radius:5px;background:rgba(104,211,145,.15);color:var(--accent2);font-weight:700;align-self:flex-start;}
  .mfe-rs-dismiss{font-size:10px;color:var(--text3);cursor:pointer;margin-left:auto;padding:2px 6px;border-radius:5px;border:1px solid var(--border);background:none;}
  .mfe-rs-dismiss:hover{color:var(--text2);border-color:var(--text3);}

  /* == SCHEDULES ENGINE ======================================================= */
  /* margin comes from the single earlier .mfe-panel rule ("MFE Panel Overrides",
     margin-bottom: var(--spacing-md)) -- this rule used to also set margin-top:18px,
     which stacked with that margin-bottom and made this panel's gaps visibly larger
     than every sibling section strip (PC & Provisional Works, Variation Orders, etc). */
  .mfe-panel{background:var(--surface);border:1px solid var(--border);border-radius:10px;margin-top:10px;margin-bottom:0;}
  .mfe-header{padding:11px 16px;background:var(--surface2);display:flex;align-items:center;justify-content:space-between;gap:10px;cursor:pointer;border-bottom:1px solid var(--border);border-radius:9px 9px 0 0;}
  .mfe-body{padding:16px;}
  .mfe-tabs{display:flex;gap:0;border-bottom:1px solid var(--border);margin-bottom:14px;background:var(--surface);position:sticky;top:96px;z-index:9;margin-top:-16px;padding-top:16px;}
  /* Inside the project modal panel the sticky offset and negative margin cause KPI boxes to be
     covered when scrolling — reset to flow positioning for the embedded panel context. */
  .mfe-panel .mfe-tabs{position:static;margin-top:0;padding-top:0;}
  /* .mfe-tab and .mfe-tab.active use unified sub-tab system */
  .mfe-tab.active{box-shadow:none;}
  .mfe-section{display:none;}.mfe-section.active{display:block;}
  .mfe-subnav{display:flex;gap:4px;margin:2px 0 12px;border-bottom:1px solid var(--border);}
  .mfe-subtab{padding:6px 12px;font-size:12px;border:none;border-bottom:2px solid transparent;background:none;color:var(--text3);cursor:pointer;}
  .mfe-subtab.active{color:var(--accent);border-bottom-color:var(--accent);font-weight:700;}
  .mfe-subview{display:none;}.mfe-subview.active{display:block;}
  .mfe-map-row{display:grid;grid-template-columns:minmax(0,1fr) 28px minmax(0,1fr) 28px;gap:6px;align-items:center;padding:7px 0;border-bottom:1px solid var(--border);}
  .mfe-map-row:last-child{border-bottom:none;}
  .mfe-arrow{text-align:center;color:var(--text3);font-size:14px;}
  .mfe-boq-label{font-size:11px;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .mfe-boq-ref{font-size:10px;font-family:'DM Mono',monospace;color:var(--text3);}
  .mfe-formula-sel{width:100%;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:4px 6px;font-size:11px;color:var(--text1);}
  .mfe-task-sel{width:100%;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:4px 6px;font-size:11px;color:var(--text1);}
  .mfe-schedule-table{width:100%;border-collapse:collapse;font-size:11px;}
  .mfe-schedule-table th{padding:6px 8px;text-align:left;background:var(--surface2);font-size:10px;text-transform:uppercase;letter-spacing:.5px;color:var(--text3);border-bottom:1px solid var(--border);}
  .mfe-schedule-table td{padding:6px 8px;border-bottom:1px solid var(--border);}
  .mfe-schedule-table tr:last-child td{border-bottom:none;}
  .mfe-timeline-bar{height:8px;border-radius:4px;background:var(--accent2);opacity:.8;}
  .mfe-stat-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin-bottom:14px;}
  .mfe-stat-grid-4{grid-template-columns:repeat(4,minmax(0,1fr));}
  .mfe-coverage-bar{height:5px;border-radius:3px;background:var(--border,rgba(255,255,255,.12));overflow:hidden;margin-top:4px;}
  .mfe-coverage-fill{height:100%;border-radius:3px;}
  .mfe-coverage-pill{display:inline-flex;align-items:center;gap:4px;font-size:9px;font-weight:700;padding:2px 8px;border-radius:10px;border:1px solid var(--ccol,#22c55e);color:var(--ccol,#22c55e);background:color-mix(in srgb,var(--ccol,#22c55e) 10%,transparent);white-space:nowrap;}
  .mfe-stat{background:var(--surface2);border:1px solid var(--border);border-radius:8px;padding:10px 12px;text-align:center;}
  .mfe-stat-label{font-size:9px;text-transform:uppercase;letter-spacing:.5px;color:var(--text3);margin-bottom:3px;}
  .mfe-stat-value{font-size:14px;font-weight:800;color:var(--accent2);}
  .mfe-formula-card{background:var(--surface2);border:1px solid var(--border);border-radius:8px;padding:10px 12px;margin-bottom:8px;}
  .mfe-formula-title{font-size:12px;font-weight:700;color:var(--text1);margin-bottom:4px;}
  .mfe-formula-meta{font-size:10px;color:var(--text3);margin-bottom:8px;}
  .mfe-material-chip{display:inline-flex;align-items:center;gap:5px;background:rgba(104,211,145,.1);border:1px solid rgba(104,211,145,.25);border-radius:12px;padding:2px 8px;font-size:10px;color:var(--accent2);margin:2px;}
  .mfe-badge{font-size:9px;padding:2px 7px;border-radius:8px;font-weight:700;}
  .mfe-badge-linked{background:rgba(104,211,145,.15);color:var(--accent2);border:1px solid rgba(104,211,145,.3);}
  .mfe-badge-unlinked{background:rgba(240,96,96,.1);color:var(--danger);border:1px solid rgba(240,96,96,.25);}
  .mfe-badge-info{background:rgba(100,180,255,.12);color:var(--info);border:1px solid rgba(100,180,255,.25);}
  /* == MFE additions == */
  .mfe-alert-amber{background:rgba(240,192,96,.07);border:1px solid rgba(240,192,96,.28);border-radius:9px;padding:9px 14px;display:flex;align-items:center;gap:10px;margin-bottom:10px;}
  .mfe-unmap-ribbon{background:rgba(240,192,96,.07);border:1px solid rgba(240,192,96,.28);border-radius:10px;overflow:hidden;margin-bottom:12px;}
  .mfe-unmap-ribbon-hdr{display:flex;align-items:center;gap:10px;padding:9px 14px;background:rgba(240,192,96,.06);border-bottom:1px solid rgba(240,192,96,.18);flex-wrap:wrap;}
  .mfe-unmap-ribbon-body{padding:12px 14px;}
  .mfe-batch-progress{padding:8px 14px;background:rgba(104,211,145,.05);border-top:1px solid rgba(104,211,145,.15);}
  .mfe-batch-progress-bar{height:6px;border-radius:3px;background:var(--border,rgba(255,255,255,.12));overflow:hidden;}
  .mfe-batch-progress-fill{height:100%;border-radius:3px;background:var(--accent2,#68d397);transition:width .3s;}
  /* == Weekly Ordering Calendar == */
  .mfe-cal-week{margin-bottom:16px;border:1px solid var(--border);border-radius:9px;overflow:hidden;}
  .mfe-cal-week-hdr{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:rgba(104,211,145,.07);border-bottom:1px solid var(--border);}
  .mfe-cal-week-badge{font-size:10px;font-weight:800;background:var(--accent2,#68d397);color:#000;padding:2px 8px;border-radius:8px;min-width:48px;text-align:center;}
  .mfe-cal-unscheduled{margin-top:12px;padding:10px 12px;background:rgba(240,192,96,.06);border:1px dashed rgba(240,192,96,.3);border-radius:8px;}
  .mfe-sched-section-hdr{padding:6px 10px;background:rgba(104,211,145,.1);border-radius:6px;font-size:11px;font-weight:700;color:var(--accent2);margin:12px 0 4px;display:flex;align-items:center;justify-content:space-between;}
  .mfe-sched-section-hdr:first-child{margin-top:0;}
  .mfe-sched-totals-hdr{padding:6px 10px;background:rgba(252,225,1,.08);border-radius:6px;font-size:11px;font-weight:700;color:var(--accent);margin:16px 0 4px;border-top:2px solid rgba(252,225,1,.2);}
  .mfe-sched-subtotal td{background:rgba(104,211,145,.06);font-weight:700;font-size:10px;color:var(--accent2);}
  .mfe-sched-grand-total td{background:rgba(252,225,1,.08);font-weight:700;color:var(--accent);}
  .mfe-sched-hidden{opacity:.38;text-decoration:line-through;}
  .mfe-skipped-section{margin-top:10px;border-top:1px solid var(--border);padding-top:8px;}
  .mfe-edit-drawer{background:var(--surface2);border:1px solid var(--border);border-radius:8px;padding:12px 14px;margin-top:8px;}
  .mfe-calc-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;gap:6px;align-items:center;padding:5px 0;border-bottom:1px solid var(--border);font-size:11px;}
  .mfe-calc-row:last-child{border-bottom:none;}
  .mfe-timing-chip{display:inline-block;background:rgba(126,200,160,.12);border:1px solid rgba(126,200,160,.25);border-radius:5px;padding:1px 7px;font-size:9px;color:var(--accent2);margin:1px;}
  .mfe-timing-week{display:inline-block;padding:1px 5px;border-radius:4px;background:rgba(126,200,160,.15);color:var(--accent2);font-size:10px;font-family:'DM Mono',monospace;font-weight:600;}
  .mfe-alert{padding:8px 12px;border-radius:7px;font-size:11px;margin-bottom:10px;display:flex;gap:8px;align-items:flex-start;}
  .mfe-alert-warn{background:rgba(245,124,0,.08);border:1px solid rgba(245,124,0,.25);color:var(--accent3);}
  .mfe-alert-info{background:rgba(100,180,255,.07);border:1px solid rgba(100,180,255,.2);color:var(--info);}
  #mfeFormulaModal .modal-box{width:680px;max-height:90vh;display:flex;flex-direction:column;}
  .formula-lib-row{display:flex;align-items:center;gap:10px;padding:8px 12px;border-bottom:1px solid var(--border);transition:background .15s;cursor:pointer;}
  .formula-lib-row:hover{background:var(--surface3);}
  .formula-lib-row.selected{background:rgba(104,211,145,.08);border-left:3px solid var(--accent2);}

  .project-card:hover{border-color:var(--accent);}
  .project-card-header{padding:16px 20px;background:var(--surface2);display:flex;align-items:center;justify-content:space-between;gap:12px;}
  .project-status-badge{padding:3px 10px;border-radius:12px;font-size:11px;font-weight:700;letter-spacing:1px;text-transform:uppercase;}
  .ps-active{background:var(--accent);color:#090b09;border:1px solid rgba(0,0,0,.15);font-weight:700;}
  .ps-completed{background:rgba(126,200,160,.15);color:var(--accent2);border:1px solid rgba(126,200,160,.3);}
  .ps-delayed{background:rgba(240,96,96,.15);color:var(--danger);border:1px solid rgba(240,96,96,.3);}
  .ps-suspended{background:rgba(240,192,96,.15);color:var(--accent3);border:1px solid rgba(240,192,96,.3);}
  .ps-terminated{background:rgba(148,148,163,.15);color:var(--text3);border:1px solid rgba(148,148,163,.3);}
  .timeline-bar-wrap{background:var(--surface3);border-radius:4px;height:8px;overflow:hidden;position:relative;}
  .timeline-bar-fill{height:100%;border-radius:4px;transition:width .5s;}
  .alert-box{border-radius:8px;padding:12px 16px;font-size:12px;font-family:'DM Sans',sans-serif;display:flex;align-items:flex-start;gap:10px;margin-bottom:8px;}
  .alert-danger{background:rgba(240,96,96,.1);border:1px solid rgba(240,96,96,.3);color:var(--danger);}
  .alert-warning{background:rgba(240,192,96,.1);border:1px solid rgba(240,192,96,.3);color:var(--accent3);}
  .alert-success{background:rgba(126,200,160,.1);border:1px solid rgba(126,200,160,.3);color:var(--accent2);}
  .alert-info{background:rgba(96,184,240,.1);border:1px solid rgba(96,184,240,.3);color:var(--info);}
  /* Modifier: used on containers where alert detail text must wrap (modal calculators). */
  .j360-alerts-inline .j360ac-detail{white-space:normal;overflow:visible;text-overflow:unset;line-height:1.55;}
  .ipc-row-matched{background:rgba(126,200,160,.05);}
  .ipc-row-diff{background:rgba(240,96,96,.05);}
  .ipc-row-warning{background:rgba(240,192,96,.05);}
  .diff-ok{color:var(--accent2);font-weight:600;}
  .diff-warn{color:var(--accent3);font-weight:600;}
  .diff-bad{color:var(--danger);font-weight:600;}
  .grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
  .grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
  .grid-4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
  /* Named grid classes — replaces inline style="grid-template-columns:..." */
  .grid-5{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;}
  .grid-7{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px;}
  .kpi-grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
  .kpi-grid-4{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;}
  .timeline-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:8px;}
  .field-group{margin-bottom:12px;min-width:0;min-inline-size:0;}
  .field-group:last-child{margin-bottom:0;}
  .tag{display:inline-block;padding:2px 8px;border-radius:4px;font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;}
  .tag-eot{background:rgba(96,184,240,.15);color:var(--info);}
  .tag-variation{background:rgba(168,85,247,.15);color:#c084fc;}
  /* .mini-kpi/.mini-kpi-label/.mini-kpi-value consolidated into Section 20
     (~line 5097) 2026-08 -- see the canonical rules there. */
  .mapper-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;}
  ::-webkit-scrollbar{width:6px;height:6px;}
  ::-webkit-scrollbar-track{background:var(--surface);}
  ::-webkit-scrollbar-thumb{background:var(--surface3);border-radius:3px;}
  /* .modal-overlay/.modal-box/.modal-title consolidated into Section 13
     (~line 4920) 2026-08 -- see the canonical rules there. */
  select option{background:var(--surface3);}
  .flex{display:flex;}.items-center{align-items:center;}.gap-2{gap:8px;}.gap-3{gap:12px;}.ml-auto{margin-left:auto;}
  .mt-1{margin-top:4px;}.mt-2{margin-top:8px;}.mt-3{margin-top:12px;}.mt-4{margin-top:16px;}
  .text-accent{color:var(--accent-text, var(--accent));}.text-danger{color:var(--danger);}.text-muted{color:var(--text2);}.font-mono{font-family:'DM Mono',monospace;}
  .fw-bold{font-weight:700;}.text-sm{font-size:11px;}
  hr{border:none;border-top:1px solid var(--border);}
  .w-full{width:100%;}


  /* ++++++++++++++++++++++++++++++++++++++++
     PRINT STYLES
  ++++++++++++++++++++++++++++++++++++++++ */
  @media print {
    @page { size:auto; margin:10mm 8mm; }

    /* Hide UI elements */
    .sidebar, .tabs, .btn, .header-menu-btn, .mobile-bottom-nav,
    #sidebarBackdrop, .toast-container, .upload-zone input,
    .mode-btn, .progress-bar, .spinner, .ai-status,
    .header-badge, .config-block button, .field-group button,
    .card-header button, .section-header button,
    .project-card-header button, .flex.gap-2 button,
    .flex.gap-2 .btn, .flex.gap-3 button {
      display: none !important;
    }

    /* Show main content */
    body { background: white !important; color: black !important; }
    .app { grid-template-columns: 1fr !important; }
    .main { padding: 0 !important; overflow: visible !important; }

    /* Cards styling */
    .card, .project-card, .stat-card, .mini-kpi {
      background: white !important;
      border: 1px solid #ccc !important;
      box-shadow: none !important;
      break-inside: avoid;
      page-break-inside: avoid;
    }

    /* Tables */
    table { font-size: 10pt !important; }
    th { background: #f0f0f0 !important; color: black !important; }
    td { border-bottom: 1px solid #ddd !important; }

    /* Text colors for print */
    .text-accent, .amount-cell { color: #0066cc !important; }
    .text-danger { color: #cc0000 !important; }
    .text-muted { color: #666 !important; }

    /* Section titles */
    .section-title { color: black !important; }
    .card-title { color: #333 !important; }

    /* Timeline bar */
    .timeline-bar-wrap { background: #ddd !important; }
    .timeline-bar-fill { background: #0066cc !important; }

    /* Ensure proper page breaks */
    .project-card { break-before: auto; }
    .card { margin-bottom: 15px !important; }

    /* Header styling */
    header { 
      background: white !important; 
      border-bottom: 2px solid #333 !important;
      position: static !important;
    }
    .logo-mark { background: #333 !important; color: white !important; }
    .logo-text { color: black !important; }

    /* Print header on each page */
    .card::before {
      content: attr(data-title);
      display: block;
      font-weight: bold;
      margin-bottom: 10px;
    }
  }

  /* ++++++++++++++++++++++++++++++++++++++++
     RESPONSIVE — TABLET (≤1024px)
  ++++++++++++++++++++++++++++++++++++++++ */
  @media(max-width:1024px){
    .app{grid-template-columns:220px 1fr;}
    .stats-strip{grid-template-columns:repeat(2,1fr);}
    .grid-4{grid-template-columns:1fr 1fr;}
    .main{padding:20px 20px;}
  }

  /* ++++++++++++++++++++++++++++++++++++++++
     RESPONSIVE — MOBILE (≤768px)
  ++++++++++++++++++++++++++++++++++++++++ */
  @media(max-width:768px){

    /* Header */
    header,#topbar{padding:0 16px;height:52px;}
    /* .topbar-menu-btn is always visible — no override needed */
    .topbar-page-title{font-size:14px;}
    .topbar-datetime{display:none;}
    .logo-sub{display:none;}
    .logo-text{font-size:18px;}
    .header-badge{display:none;}
    .header-menu-btn,.topbar-menu-btn{display:flex !important;}
    /* Dashboard mobile */
    #dashBody{grid-template-columns:1fr !important;}
    .dash-grid{grid-template-columns:repeat(2,1fr);}
/* App layout — sidebar hidden off-canvas */
    .app-shell,.app{display:block;min-height:100vh;}
    .app-right{display:flex;flex-direction:column;min-height:100vh;}
    .sidebar{
      position:fixed;top:0;left:0;bottom:0;width:280px;max-width:90vw;
      transform:translateX(-100%);transition:transform .3s ease;
      z-index:500;overflow-y:auto;padding-bottom:80px;
      background:var(--surface2);
    }
    .sidebar.open{transform:translateX(0);}
    .sidebar-backdrop{
      display:none;
      position:fixed;
      inset:0;
      background:var(--overlay);
      backdrop-filter: blur(6px) saturate(140%);
      -webkit-backdrop-filter: blur(6px) saturate(140%);
      z-index:499;
    }
    .sidebar-backdrop.open{display:block;}

    /* Main area */
    .main{padding:16px 12px;gap:16px;padding-bottom:80px;}

    .tab{white-space:nowrap;padding:8px 12px;font-size:12px;}

    /* Stats strip */
    .stats-strip{grid-template-columns:repeat(2,1fr);gap:8px;}
    /* .stat-value font-size now handled by its own cqw clamp (Section 9) */

    /* Grids collapse to single column */
    .grid-2,.grid-3,.grid-4{grid-template-columns:1fr !important;}

    /* Tables — make scrollable with min widths */
    .table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;}
    table{min-width:560px;}
    th,td{padding:8px 10px;font-size:11px;}

    /* Cards */
    .card-header{flex-wrap:wrap;gap:8px;padding:12px 14px;}
    .card-body{padding:14px;}

    /* Section header */
    .section-header{flex-direction:column;align-items:flex-start;gap:10px;}
    .section-header .btn{width:100%;}

    /* Modals — full screen on mobile */
    .modal-overlay{padding:0;align-items:flex-end;}
    .modal-box{
      width:100% !important;max-width:100% !important;
      border-radius:20px 20px 0 0;max-height:92vh;
      padding:20px 16px 32px;
    }
    .modal-title{font-size:17px;margin-bottom:16px;}

    /* Project cards */
    .project-card-header{flex-wrap:wrap;gap:8px;padding:12px 14px;}

    /* Named grid classes — all collapse to 2 cols on mobile */
    .grid-5,.grid-7,.kpi-grid-3,.kpi-grid-4{grid-template-columns:repeat(2,1fr) !important;}
    .timeline-grid{grid-template-columns:repeat(2,1fr) !important;}
    /* IPC preview grid */
    #ipcCalcGrid{grid-template-columns:1fr 1fr !important;}

    /* Material table inputs */
    .mat-name{width:140px !important;}

    /* BOQ mapper */
    .mapper-grid{grid-template-columns:1fr !important;}

    /* == Touch target minimums (WCAG 2.5.5: 44—44px) == */
    .btn{min-height:44px;padding:10px 16px;}
    .btn.btn-sm{min-height:36px;padding:7px 12px;}
    input,select,textarea{min-height:44px;font-size:16px !important;} /* 16px prevents iOS zoom */
    .field-group label{font-size:13px;margin-bottom:6px;display:block;}

    /* == Cashflow panel mobile == */
    #panel-cashflow .stats-strip{grid-template-columns:1fr 1fr;}
    #panel-cashflow .mini-kpi{padding:12px;}
    #panel-cashflow table{min-width:480px;}

    /* == Modal form grids collapse == */
    .modal-box .grid-2,
    .modal-box [style*="grid-template-columns:1fr 1fr"],
    .modal-box [style*="grid-template-columns: 1fr 1fr"]{
      grid-template-columns:1fr !important;
    }

    /* == Section header buttons stack == */
    .section-header{gap:8px;}

    /* == KPI grids == */
    .kpi-grid-3,.kpi-grid-4{grid-template-columns:1fr 1fr !important;}

    /* == Tab-nav hidden on mobile (bottom nav takes over) == */

    /* == More menu tap targets now handled in mobile-workspace.css == */

    /* Toasts */
    .toast-container{bottom:80px;right:12px;left:12px;}
    .toast{max-width:100%;}

    /* Upload zone */
    .upload-zone{padding:32px 16px;}

    /* Bottom navigation bar */
    .mobile-bottom-nav{display:flex !important;}
  }

  /* ++++++++++++++++++++++++++++++++++++++++
     MOBILE BOTTOM NAVIGATION
  ++++++++++++++++++++++++++++++++++++++++ */
  .mobile-bottom-nav{
    display:none;position:fixed;bottom:0;left:0;right:0;
    background:var(--surface);border-top:1px solid var(--border);
    z-index:300;padding:6px 4px env(safe-area-inset-bottom,0);
    gap:2px;
  }
  .mob-nav-btn{
    flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:2px;padding:6px 2px;background:transparent;border:none;
    color:var(--text3);font-size:9px;font-family:'DM Sans',sans-serif;
    font-weight:500;cursor:pointer;border-radius:8px;transition:all .15s;
    letter-spacing:.3px;text-transform:uppercase;min-width:0;
  }
  .mob-nav-btn .mob-icon{
    font-size:22px;line-height:1;
    font-variation-settings:'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;
  }
  .mob-nav-btn.active{color:var(--accent);}
  .mob-nav-btn.active .mob-icon{filter:drop-shadow(0 0 6px rgba(252,225,1,.5));}

  /* ++++++++++++++++++++++++++++++++++++++++
     MOBILE HAMBURGER BUTTON
  ++++++++++++++++++++++++++++++++++++++++ */
  .header-menu-btn{
    display:none;background:var(--surface3);border:1px solid var(--border);
    border-radius:8px;padding:7px 10px;cursor:pointer;
    color:var(--text);font-size:18px;line-height:1;
    align-items:center;justify-content:center;
  }

  /* ++++++++++++++++++++++++++++++++++++++++
     SMALL PHONE (≤380px) tweaks
  ++++++++++++++++++++++++++++++++++++++++ */
  @media(max-width:380px){
    .stats-strip{grid-template-columns:1fr 1fr;}
    .mob-nav-btn{font-size:8px;}
    .mob-nav-btn .mob-icon{font-size:20px;}
  }

/* ++++++++++++++++++++++++++++++++++++++++
   J360 VECTOR ICON SYSTEM (100% OFFLINE)
   ++++++++++++++++++++++++++++++++++++++++ */
.j360-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
  fill: currentColor;
  flex-shrink: 0;
  pointer-events: none;
  overflow: visible;
}
/* Size scale — matches original material-symbols-outlined visual weights */
.j360-icon.icon-xs { width: 12px !important; height: 12px !important; font-size: 12px; }
.j360-icon.icon-sm { width: 16px !important; height: 16px !important; font-size: 16px; }
.j360-icon.icon-md { width: 18px !important; height: 18px !important; font-size: 18px; }
.j360-icon.icon-lg { width: 24px !important; height: 24px !important; font-size: 24px; }
.btn .j360-icon { width: 1em; height: 1em; margin-right: 4px; vertical-align: middle; }
.btn.btn-icon-only .j360-icon, .btn-icon .j360-icon, .btn-icon-only .j360-icon { margin-right: 0 !important; }

/* Action Button sizing - Standardized 28x28px for table actions (Edit, Delete, View) */
.btn.btn-icon-only,
.btn-icon-only,
.table-action-btn {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: var(--radius-xs, 4px) !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}
.btn.btn-icon-only .j360-icon,
.btn-icon-only .j360-icon,
.table-action-btn .j360-icon {
  margin: 0 !important;
  width: 14px !important;
  height: 14px !important;
}
/* Sidebar nav icons */
.sb-nav-icon.j360-icon { width: 20px !important; height: 20px !important; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 18px;
  vertical-align: middle;
  line-height: 1;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.material-symbols-outlined.filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.material-symbols-outlined > .j360-icon {
  width: 1em;
  height: 1em;
  font-size: inherit;
  color: inherit;
}
/* Safety guard: never show raw text string before SVG is hydrated */
.material-symbols-outlined:not([data-j360-upgraded="true"]) {
  font-size: 0 !important;
  color: transparent !important;
}
.icon-xs { font-size: 12px !important; }
.icon-sm { font-size: 16px !important; }
.icon-md { font-size: 18px !important; }
.icon-lg { font-size: 24px !important; }
.btn .material-symbols-outlined { font-size: 16px; }

/* ++++++++++++++++++++++++++++++++++++++++
   LAYOUT — full-height sidebar, topbar + main on right
   Desktop only (mobile handled below)
   ++++++++++++++++++++++++++++++++++++++++ */
@media (min-width: 769px) {
  /* The outer shell spans full viewport height */
  .app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    height: 100vh;
    overflow: hidden;
    max-width: 100vw;
    transition: grid-template-columns .22s cubic-bezier(.4,0,.2,1);
  }
  /* Collapsed state — icon-only sidebar */
  .app-shell.sb-collapsed {
    grid-template-columns: 62px minmax(0, 1fr);
  }
  /* Sidebar: full height left column */
  .sidebar {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--sb-brand-bg);
    border-right: 1px solid var(--sb-border);
    padding: 0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width .22s cubic-bezier(.4,0,.2,1);
  }
  /* Right column: stacks topbar + main vertically.
     overflow:clip (not hidden) — clip doesn't create a BFC, so position:fixed
     modal overlays inside app-right are not clipped to its bounds and can
     cover the full viewport including the sidebar column.
     z-index:150 > sidebar(z:100) ensures this stacking context paints above
     the sidebar so the modal backdrop covers it. */
  .app-right {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 0;
    overflow: clip;
    background: var(--bg);
    z-index: 150;
  }
  /* Main content: fills remaining height, scrolls independently */
  .main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
  }
}

/* ++++++++++++++++++++++++++++++++++++++++
   LOGIN SCREEN
   ++++++++++++++++++++++++++++++++++++++++ */
#loginScreen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
#loginScreen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center;
  -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 85%);
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}
.login-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 48px;
  width: 380px;
  max-width: 95vw;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 20px 40px -15px rgba(0, 0, 0, 0.12);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-mark {
  width: 64px;
  height: 64px;
  background: var(--accent);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  color: #0d0f0e;
}
.login-error {
  background: rgba(240,96,96,.1);
  border: 1px solid rgba(240,96,96,.3);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  margin-bottom: 12px;
  display: none;
}
.login-error.show { display: block; }
.login-field { margin-bottom: 16px; }
.login-field label { display:block; font-size:11px; font-weight:600; color:var(--text2); margin-bottom:6px; letter-spacing:.5px; text-transform:uppercase; }
.login-field input { width:100%; padding:12px 14px; background:var(--surface2); border:1px solid var(--border); border-radius:10px; color:var(--text); font-size:14px; }
.login-field input:focus { border-color:var(--accent); outline:none; box-shadow:0 0 0 2px rgba(252,225,1,.15); }
.pwd-wrap { position:relative; }
.pwd-wrap input { padding-right:38px !important; }
.pwd-toggle { position:absolute; right:10px; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; color:var(--text3); display:flex; align-items:center; padding:0; transition:color .15s; }
.pwd-toggle:hover { color:var(--text); }
#currentUserBadge { font-size:10px; font-weight:700; padding:3px 10px; border-radius:10px; text-transform:uppercase; letter-spacing:.8px; }
.role-admin       { background:rgba(240,96,96,.15);   color:var(--danger);  border:1px solid rgba(240,96,96,.25); }
.role-qs          { background:rgba(252,225,1,.12);  color:var(--accent);  border:1px solid rgba(252,225,1,.25); }
.role-accountant  { background:rgba(96,184,240,.12);  color:var(--info);    border:1px solid rgba(96,184,240,.25); }
.role-viewer      { background:rgba(138,158,138,.12); color:var(--text2);   border:1px solid rgba(138,158,138,.25); }

/* ++++++++++++++++++++++++++++++++++++++++
   COMMA-FORMATTED AMOUNT INPUTS
   ++++++++++++++++++++++++++++++++++++++++ */
.amount-input-wrap {
  position: relative;
}
.amount-input-wrap input {
  padding-right: 48px;
}
.amount-input-wrap .currency-badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text3);
  font-family: 'DM Mono', monospace;
  letter-spacing: 1px;
  pointer-events: none;
}
.formatted-amount {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text3);
  margin-top: 3px;
}

/* ++++++++++++++++++++++++++++++++++++++++
   BOQ TABLE PRICER (table format)
   ++++++++++++++++++++++++++++++++++++++++ */
.boq-table-input {
  width: 100%;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}
.boq-table-input:focus {
  outline: none;
  border-color: var(--accent);
}
.boq-row-matched { background: rgba(126,200,160,.05) !important; }
.boq-row-unmatched { background: rgba(240,96,96,.05) !important; }
.boq-row-partial { background: rgba(240,192,96,.05) !important; }

/* ++++++++++++++++++++++++++++++++++++++++
   NSSF / WCF CALCULATOR IN OVERHEAD
   ++++++++++++++++++++++++++++++++++++++++ */
.statutory-calc {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  font-size: 12px;
}
.statutory-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.statutory-row:last-child { border-bottom: none; font-weight: 700; color: var(--accent); }

/* ++++++++++++++++++++++++++++++++++++++++
   CASH FLOW ENGINE
   ++++++++++++++++++++++++++++++++++++++++ */
.cashflow-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface3);
  overflow: hidden;
  margin-top: 4px;
}
.cashflow-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ++++++++++++++++++++++++++++++++++++++++
   GLOBAL PRODUCTIVITY PANEL (in sidebar)
   ++++++++++++++++++++++++++++++++++++++++ */
.prod-lookup-panel {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--text2);
}

/* ++++++++++++++++++++++++++++++++++++++++
   MODE BUTTON (used in margin toggle & HR sub-nav)
   ++++++++++++++++++++++++++++++++++++++++ */
.margin-mode-toggle{display:flex;gap:4px;margin-bottom:12px;}
/* == UNIFIED SUB-TAB SYSTEM ========================================
   One container, one button. All sub-tabs everywhere look identical.
   Active state: accent underline. No pill fills. Clean and modern.  */

/* Container */
.subtab-bar,
.u-subtab-bar,
.u-subtab-bar-lg {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  border-radius: 0;
  padding: 0;
  width: 100%;
  margin-bottom: 16px;
}

/* Button — base */
.subtab,
.mode-btn,
.u-subtab,
.u-subtab-lg,
.mfe-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  position: relative;
  margin-bottom: -1px;
  background: transparent;
  color: var(--text3);
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s;
  border-radius: 0;
  letter-spacing: .2px;
}
.subtab:hover,
.mode-btn:hover,
.u-subtab:hover,
.u-subtab-lg:hover,
.mfe-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,.02);
}

/* Active state — bold text + short centered pill underline (Website standard) */
.subtab.active,
.mode-btn.active,
.u-subtab.u-subtab-active,
.u-subtab-lg.u-subtab-active,
.mfe-tab.active {
  color: var(--text);
  background: transparent;
  font-weight: 700;
}
.subtab.active::after,
.mode-btn.active::after,
.u-subtab.u-subtab-active::after,
.u-subtab-lg.u-subtab-active::after,
.mfe-tab.active::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  bottom: -1px;
  height: 3px;
  background: var(--accent);
  border-radius: 999px;
  z-index: 1;
}
.subtab.active svg, .subtab.active .j360-icon,
.mode-btn.active svg, .mode-btn.active .j360-icon,
.u-subtab.u-subtab-active svg, .u-subtab.u-subtab-active .j360-icon,
.u-subtab-lg.u-subtab-active svg, .u-subtab-lg.u-subtab-active .j360-icon,
.mfe-tab.active svg, .mfe-tab.active .j360-icon {
  color: var(--text);
  opacity: 1;
}

/* Green active variant (Projects completed tab) */
.u-subtab-lg.u-subtab-active-green {
  color: var(--accent2);
  background: transparent;
  font-weight: 700;
}
.u-subtab-lg.u-subtab-active-green::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  bottom: -1px;
  height: 3px;
  background: var(--accent2);
  border-radius: 999px;
  z-index: 1;
}

/* Gray active variant (Projects terminated tab) -- neutral "archived" tone */
.u-subtab-lg.u-subtab-active-gray {
  color: var(--text3);
  background: transparent;
  font-weight: 700;
}
.u-subtab-lg.u-subtab-active-gray::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  bottom: -1px;
  height: 3px;
  background: var(--text3);
  border-radius: 999px;
  z-index: 1;
}

/* Compact variant for margin-mode-toggle in settings */
.margin-mode-toggle .mode-btn { flex:1; justify-content:center; padding:6px 10px; font-size:11px; }
.margin-mode-toggle .mode-btn.active { color: var(--text); border-bottom-color: var(--accent); border-bottom-width: 2px; font-weight: 700; }


/* == Multi-select / bulk-delete system =========================== */

/* == Select-all header checkbox cell (in <thead>) == */
.sel-th {
  width: 36px !important;
  min-width: 36px !important;
  padding: 0 8px !important;
  text-align: center !important;
}

/* == Per-row checkbox cell (injected dynamically in select mode) == */
.sel-td {
  width: 36px !important;
  min-width: 36px !important;
  padding: 0 8px !important;
  text-align: center !important;
  vertical-align: middle !important;
}

/* == Permanent slot cell — sits below sel-th; invisible until select-all clicked == */
.sel-td-slot {
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 0 !important;
  border: none !important;
}

/* ================================================================
   UNIFIED CHECKBOX — .jg-check
   Single source of truth for every checkbox in the application.
   Applied to all checkboxes across the platform by default, with
   table header/row centering and custom gold brand accent.
   ================================================================ */
input[type="checkbox"],
input[type="checkbox"].jg-check,
input[type="checkbox"].sel-cb,
input[type="checkbox"].proj-sel-cb,
input[type="checkbox"].ti-cb {
  appearance: none;
  -webkit-appearance: none;
  display: inline-block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  background: var(--surface3);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  vertical-align: middle;
  transition: background .12s, border-color .12s, box-shadow .12s;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}
input[type="checkbox"]:hover,
input[type="checkbox"].jg-check:hover,
input[type="checkbox"].sel-cb:hover,
input[type="checkbox"].proj-sel-cb:hover,
input[type="checkbox"].ti-cb:hover {
  border-color: var(--border-strong, #090b09);
  box-shadow: 0 0 0 2px rgba(9, 11, 9, 0.12);
}
input[type="checkbox"]:checked,
input[type="checkbox"].jg-check:checked,
input[type="checkbox"].sel-cb:checked,
input[type="checkbox"].proj-sel-cb:checked,
input[type="checkbox"].ti-cb:checked {
  background: var(--accent);
  border: 1.5px solid var(--border-strong, #090b09) !important;
}
input[type="checkbox"]:checked::after,
input[type="checkbox"].jg-check:checked::after,
input[type="checkbox"].sel-cb:checked::after,
input[type="checkbox"].proj-sel-cb:checked::after,
input[type="checkbox"].ti-cb:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #0d0f0e;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
input[type="checkbox"]:disabled,
input[type="checkbox"].jg-check:disabled,
input[type="checkbox"].sel-cb:disabled,
input[type="checkbox"].proj-sel-cb:disabled,
input[type="checkbox"].ti-cb:disabled {
  opacity: .4;
  cursor: not-allowed;
}
input[type="checkbox"]:focus-visible,
input[type="checkbox"].jg-check:focus-visible,
input[type="checkbox"].sel-cb:focus-visible {
  box-shadow: 0 0 0 3px rgba(252,225,1,.25);
}
/* indeterminate state — used by select-all header checkboxes */
input[type="checkbox"]:indeterminate,
input[type="checkbox"].jg-check:indeterminate,
input[type="checkbox"].sel-cb:indeterminate,
input[type="checkbox"].proj-sel-cb:indeterminate {
  background: var(--surface3);
  border-color: var(--accent);
}
input[type="checkbox"]:indeterminate::after,
input[type="checkbox"].jg-check:indeterminate::after,
input[type="checkbox"].sel-cb:indeterminate::after,
input[type="checkbox"].proj-sel-cb:indeterminate::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 6px;
  width: 8px;
  height: 2px;
  background: var(--accent);
}
/* AI-context modifier — purple accent for AI feature checkboxes */
input[type="checkbox"].jg-check.jg-check--ai:checked {
  background: #b478ff;
  border-color: #b478ff;
}
input[type="checkbox"].jg-check.jg-check--ai:hover {
  border-color: #b478ff;
  box-shadow: 0 0 0 3px rgba(180,120,255,.15);
}
/* Centering in table cells (.sel-th, .sel-td, .sel-cb) */
.sel-th input[type="checkbox"],
.sel-td input[type="checkbox"],
input[type="checkbox"].sel-cb,
input[type="checkbox"].jg-check.sel-cb {
  display: block;
  margin: 0 auto;
}

/* Selection action bar — dark themed, matches the system */
.sel-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: 1px solid rgba(240,96,96,.15);
  border-radius: 6px 6px 0 0;
  font-size: 12px;
  color: var(--text2);
  animation: selBarIn .15s ease;
  margin: 0;
}
/* When sel-bar is visible, remove top border-radius from adjacent table/card */
.sel-bar + .table-wrap,
.sel-bar + table,
.sel-bar + .card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: none;
}
@keyframes selBarIn {
  from { opacity:0; transform:translateY(-3px); }
  to   { opacity:1; transform:translateY(0); }
}
.sel-bar-count {
  color: var(--accent);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 700;
}
.sel-bar-label { color: var(--text2); font-size: 12px; }
.sel-bar-spacer { flex: 1; }
.sel-bar-clr {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}
.sel-bar-clr:hover { color: var(--text); border-color: var(--text2); background: var(--surface3); }
.sel-bar-act {
  height: 28px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface2);
  color: var(--text);
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border2);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
}
.sel-bar-act:hover { background: var(--surface3); border-color: var(--text2); }
.sel-bar-del {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(240,96,96,.08);
  color: var(--danger);
  border: 1px solid rgba(240,96,96,.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}
.sel-bar-del:hover {
  background: rgba(240,96,96,.2);
  border-color: var(--danger);
}

/* Confirmation modal — fully dark themed */
#jg360ConfirmModal {
  display: none;
}
#jg360ConfirmModal.open { display: flex; }
#jg360ConfirmBox {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 28px 22px;
  width: 360px;
  max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
  transform: scale(.97) translateY(6px);
  transition: transform .18s cubic-bezier(.2,.8,.3,1);
}
#jg360ConfirmModal.open #jg360ConfirmBox {
  transform: scale(1) translateY(0);
}
#jg360ConfirmIcon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: rgba(240,96,96,.08);
  border: 1px solid rgba(240,96,96,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 14px;
}
#jg360ConfirmTitle {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 7px;
}
#jg360ConfirmMsg {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 22px;
  line-height: 1.55;
  /* jgConfirm assigns this via textContent (deliberately — most callers
     interpolate user-supplied names, so innerHTML would be an injection
     vector). textContent escapes markup AND collapses newlines, so a
     multi-line message needs pre-line to keep its line breaks. Existing
     single-line messages are unaffected. */
  white-space: pre-line;
}
#jg360ConfirmBtns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
#jg360ConfirmBtns .btn {
  max-width: 100%;
  white-space: normal;
  text-align: center;
}


/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   JAVENZI DESIGN SYSTEM — CSS UTILITY CLASSES  (v36)
   Single source of truth for typography, color, spacing and layout.
   All repeated inline styles across the app are mapped here.
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

/* == TYPOGRAPHY SCALE ====================================== */
.u-text-xxs  { font-size: 7px; }
.u-text-xs   { font-size: 9px; }
.u-text-sm   { font-size: 11px; }
.u-text-base { font-size: 12px; }
.u-text-md   { font-size: 13px; }
.u-text-lg   { font-size: 14px; }
.u-text-xl   { font-size: 16px; }
.u-text-2xl  { font-size: 18px; }
.u-text-3xl  { font-size: 22px; }
.u-text-4xl  { font-size: 26px; }
.u-text-5xl  { font-size: 28px; }

/* == FONT WEIGHT =========================================== */
.u-weight-normal { font-weight: 400; }
.u-weight-medium { font-weight: 500; }
.u-weight-semi   { font-weight: 600; }
.u-weight-bold   { font-weight: 700; }
.u-weight-black  { font-weight: 800; }

/* == FONT FAMILIES ========================================= */
.u-font-mono    { font-family: 'DM Mono', monospace; }
.u-font-display { font-family: 'Bebas Neue', sans-serif; }
.u-font-body    { font-family: 'DM Sans', sans-serif; }

/* == LETTER SPACING ======================================== */
.u-tracking-0     { letter-spacing: 0; }
.u-tracking-tight { letter-spacing: .3px; }
.u-tracking       { letter-spacing: .5px; }
.u-tracking-wide  { letter-spacing: .8px; }
.u-tracking-wider { letter-spacing: 1px; }
.u-tracking-xl    { letter-spacing: 1.5px; }
.u-tracking-2xl   { letter-spacing: 2px; }
.u-tracking-3xl   { letter-spacing: 3px; }

/* == TEXT TRANSFORM ======================================== */
.u-uppercase   { text-transform: uppercase; }
.u-lowercase   { text-transform: lowercase; }
.u-capitalize  { text-transform: capitalize; }
.u-normal-case { text-transform: none; }

/* == TEXT ALIGNMENT ======================================== */
.u-text-left   { text-align: left; }
.u-text-center { text-align: center; }
.u-text-right  { text-align: right; }

/* == WHITE SPACE / OVERFLOW ================================ */
.u-nowrap     { white-space: nowrap; }
.u-break-word { word-break: break-word; }
.u-ellipsis   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* == LINE HEIGHT =========================================== */
.u-leading-none   { line-height: 1; }
.u-leading-tight  { line-height: 1.3; }
.u-leading-normal { line-height: 1.5; }
.u-leading-loose  { line-height: 1.7; }

/* == TEXT COLORS =========================================== */
.u-text-primary { color: var(--text); }
.u-text-muted2  { color: var(--text2); }
.u-text-muted3  { color: var(--text3); }
.u-text-accent  { color: var(--accent-text, var(--accent)); }
.u-text-green   { color: var(--accent2); }
.u-text-amber   { color: var(--accent3); }
.u-text-red     { color: var(--danger); }
.u-text-blue    { color: var(--info); }
.u-text-white   { color: #fff; }
.u-text-dark    { color: #0d0f0e; }

/* == BACKGROUND COLORS ===================================== */
.u-bg-base        { background: var(--bg); }
.u-bg-surface     { background: var(--surface); }
.u-bg-surface2    { background: var(--surface2); }
.u-bg-surface3    { background: var(--surface3); }
.u-bg-accent      { background: var(--accent); }
.u-bg-accent2     { background: var(--accent2); }
.u-bg-accent3     { background: var(--accent3); }
.u-bg-danger      { background: var(--danger); }
.u-bg-info        { background: var(--info); }
.u-bg-transparent { background: transparent; }
.u-bg-none        { background: none; }
/* Semantic tinted backgrounds */
.u-bg-accent-tint   { background: rgba(252,225,1,.08); }
.u-bg-green-tint    { background: rgba(126,200,160,.08); }
.u-bg-amber-tint    { background: rgba(240,192,96,.08); }
.u-bg-red-tint      { background: rgba(240,96,96,.08); }
.u-bg-blue-tint     { background: rgba(96,184,240,.08); }
.u-bg-green-tint-md { background: rgba(42,122,79,.12); }
.u-bg-green-tint-lg { background: rgba(42,122,79,.15); }

/* == BORDERS =============================================== */
.u-border-none        { border: none; }
.u-border-base        { border: 1px solid var(--border); }
.u-border-accent      { border: 1px solid var(--accent); }
.u-border-green       { border: 1px solid var(--accent2); }
.u-border-amber       { border: 1px solid var(--accent3); }
.u-border-red         { border: 1px solid var(--danger); }
.u-border-blue        { border: 1px solid var(--info); }
.u-border-transparent { border: 1px solid transparent; }
.u-border-t           { border-top: 1px solid var(--border); }
.u-border-b           { border-bottom: 1px solid var(--border); }
.u-border-r           { border-right: 1px solid var(--border); }
.u-border-l           { border-left: 1px solid var(--border); }

/* == BORDER RADIUS ========================================= */
.u-rounded-sm   { border-radius: 3px; }
.u-rounded      { border-radius: 4px; }
.u-rounded-md   { border-radius: 6px; }
.u-rounded-lg   { border-radius: 8px; }
.u-rounded-xl   { border-radius: 10px; }
.u-rounded-2xl  { border-radius: 12px; }
.u-rounded-3xl  { border-radius: 16px; }
.u-rounded-full { border-radius: 9999px; }

/* == MARGIN TOP ============================================ */
.u-mt-0 { margin-top: 0; }
.u-mt-1 { margin-top: 2px; }
.u-mt-2 { margin-top: 4px; }
.u-mt-3 { margin-top: 6px; }
.u-mt-4 { margin-top: 8px; }
.u-mt-5 { margin-top: 12px; }
.u-mt-6 { margin-top: 16px; }
.u-mt-7 { margin-top: 20px; }
.u-mt-8 { margin-top: 24px; }

/* == MARGIN BOTTOM ========================================= */
.u-mb-0 { margin-bottom: 0; }
.u-mb-1 { margin-bottom: 2px; }
.u-mb-2 { margin-bottom: 4px; }
.u-mb-3 { margin-bottom: 6px; }
.u-mb-4 { margin-bottom: 8px; }
.u-mb-5 { margin-bottom: 10px; }
.u-mb-6 { margin-bottom: 12px; }
.u-mb-7 { margin-bottom: 14px; }
.u-mb-8 { margin-bottom: 16px; }
.u-mb-9 { margin-bottom: 20px; }

/* == MARGIN SIDES ========================================== */
.u-ml-auto { margin-left: auto; }
.u-mr-1    { margin-right: 4px; }
.u-mr-2    { margin-right: 8px; }
.u-mx-auto { margin-left: auto; margin-right: auto; }
.u-my-4    { margin-top: 16px; margin-bottom: 16px; }

/* == PADDING =============================================== */
.u-p-0  { padding: 0; }
.u-p-1  { padding: 4px; }
.u-p-2  { padding: 6px 8px; }
.u-p-3  { padding: 8px 10px; }
.u-p-4  { padding: 10px 14px; }
.u-p-5  { padding: 12px; }
.u-p-6  { padding: 14px; }
.u-p-7  { padding: 16px; }
.u-p-8  { padding: 20px; }
.u-p-9  { padding: 24px; }
.u-px-2 { padding-left: 6px; padding-right: 6px; }
.u-px-3 { padding-left: 8px; padding-right: 8px; }
.u-px-4 { padding-left: 10px; padding-right: 10px; }
.u-px-5 { padding-left: 12px; padding-right: 12px; }
.u-py-1 { padding-top: 4px; padding-bottom: 4px; }
.u-py-2 { padding-top: 6px; padding-bottom: 6px; }

/* == DISPLAY =============================================== */
.u-flex         { display: flex; }
.u-inline-flex  { display: inline-flex; }
.u-grid         { display: grid; }
.u-block        { display: block; }
.u-inline-block { display: inline-block; }
.u-hidden       { display: none; }

/* == FLEX DIRECTION ======================================== */
.u-flex-col { flex-direction: column; }
.u-flex-row { flex-direction: row; }

/* == FLEX ALIGNMENT ======================================== */
.u-items-start    { align-items: flex-start; }
.u-items-center   { align-items: center; }
.u-items-end      { align-items: flex-end; }
.u-justify-start  { justify-content: flex-start; }
.u-justify-center { justify-content: center; }
.u-justify-end    { justify-content: flex-end; }
.u-justify-between { justify-content: space-between; }
.u-flex-wrap      { flex-wrap: wrap; }
.u-flex-nowrap    { flex-wrap: nowrap; }

/* == FLEX SIZING =========================================== */
.u-flex-1        { flex: 1; }
.u-flex-2        { flex: 2; }
.u-flex-none     { flex: none; }
.u-flex-shrink-0 { flex-shrink: 0; }
.u-flex-min      { flex: 1; min-width: 0; }

/* == GAP =================================================== */
.u-gap-1 { gap: 2px; }
.u-gap-2 { gap: 4px; }
.u-gap-3 { gap: 6px; }
.u-gap-4 { gap: 8px; }
.u-gap-5 { gap: 10px; }
.u-gap-6 { gap: 12px; }
.u-gap-7 { gap: 14px; }
.u-gap-8 { gap: 16px; }
.u-gap-9 { gap: 20px; }

/* == SIZING ================================================ */
.u-w-full   { width: 100%; }
.u-w-auto   { width: auto; }
.u-w-40     { width: 40px; }
.u-w-80     { width: 80px; }
.u-w-90     { width: 90px; }
.u-h-full   { height: 100%; }
.u-min-w-sm { min-width: 160px; }
.u-min-w-md { min-width: 180px; }
.u-min-w-lg { min-width: 200px; }

/* == OVERFLOW ============================================== */
.u-overflow-hidden { overflow: hidden; }
.u-overflow-auto   { overflow: auto; }
.u-overflow-y-auto { overflow-y: auto; }

/* == GRID COLUMNS ========================================== */
.u-col-span-full { grid-column: 1 / -1; }
.u-col-2         { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.u-col-3         { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.u-col-4         { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.u-col-auto-220  { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); }
.u-col-auto-180  { grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); }

/* == POSITION ============================================== */
.u-relative { position: relative; }
.u-absolute { position: absolute; }
.u-sticky   { position: sticky; }
.u-top-0    { top: 0; }

/* == CURSOR ================================================ */
.u-cursor-pointer { cursor: pointer; }
.u-cursor-default { cursor: default; }
.u-pointer-none   { pointer-events: none; }

/* == VERTICAL ALIGN ======================================== */
.u-va-middle { vertical-align: middle; }
.u-va-top    { vertical-align: top; }
.u-va-bottom { vertical-align: bottom; }

/* == OPACITY =============================================== */
.u-opacity-low    { opacity: .4; }
.u-opacity-medium { opacity: .7; }
.u-opacity-ghost  { opacity: .18; }

/* == TRANSITION ============================================ */
.u-transition       { transition: all .15s; }
.u-transition-color { transition: color .15s, border-color .15s, background .15s; }

/* == Z-INDEX =============================================== */
.u-z-700 { z-index: 700; }
.u-z-500 { z-index: 500; }

/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   COMPONENT UTILITY PATTERNS
   Composite utilities for common recurring UI patterns
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

/* == BADGE ================================================= */
.u-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; letter-spacing: .3px; line-height: 1.5; white-space: nowrap;
}
.u-badge-accent  { background: var(--accent);  color: #0d0f0e; }
.u-badge-green   { background: var(--accent2); color: #0d0f0e; }
.u-badge-amber   { background: var(--accent3); color: #0d0f0e; }
.u-badge-red     { background: var(--danger);  color: #fff; }
.u-badge-info    { background: var(--info);    color: #ffffff !important; }
.u-badge-muted   { background: var(--surface3); color: var(--text2); border: 1px solid var(--border); }
.u-badge-outline-red { background: rgba(240,96,96,.15); color: var(--danger); border: 1px solid rgba(240,96,96,.3); }

/* == OVERLINE LABELS ======================================= */
.u-label-overline {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text3); display: block; margin-bottom: 5px;
}
.u-label-overline-accent {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  line-height: 1.3;
}
.u-label-overline-accent::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--accent, #fce101);
  border: 1.5px solid var(--border-strong, #090b09);
  border-radius: 1px;
  display: inline-block;
  flex-shrink: 0;
}
.u-label-overline-accent .j360-icon {
  color: var(--text2);
  vertical-align: middle;
}

.modal-section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-top: 14px;
  margin-bottom: 10px;
  line-height: 1.3;
}
.modal-section-eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--accent, #fce101);
  border: 1.5px solid var(--border-strong, #090b09);
  border-radius: 1px;
  display: inline-block;
  flex-shrink: 0;
}
.modal-section-eyebrow .j360-icon {
  color: var(--text2);
  vertical-align: middle;
}

/* == INFO / TIP BOXES ====================================== */
.u-info-box {
  background: var(--surface3); border-radius: 6px;
  padding: 10px; font-size: 11px; color: var(--text2);
}
.u-info-box-sm {
  background: var(--surface2); border-radius: 8px;
  padding: 10px; font-size: 11px; color: var(--text2);
}

/* == PANEL CARD ============================================ */
.u-panel-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-bottom: 12px;
  box-shadow: 0 1px 3px var(--shadow-card);
}
.u-panel-card-lg {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px;
  box-shadow: 0 1px 3px var(--shadow-card);
}

/* == SECTION LABEL ========================================= */
.u-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text3); margin-bottom: 14px;
}

/* == INLINE CODE =========================================== */
.u-code {
  font-family: 'DM Mono', monospace; font-size: 12px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface3); color: var(--text2);
}

/* == ROW HELPERS =========================================== */
.u-row         { display: flex; align-items: center; gap: 8px; }
.u-row-wrap    { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.u-row-between { display: flex; align-items: center; justify-content: space-between; }
.u-row-10      { display: flex; align-items: center; gap: 10px; }
.u-row-col     { display: flex; flex-direction: column; gap: 8px; }
.u-row-mt4     { display: flex; gap: 10px; margin-top: 16px; }
.u-row-mt5     { display: flex; gap: 10px; margin-top: 20px; }

/* == SUB-TAB BARS ========================================== */
/* u-subtab styles unified above in .mode-btn section */

/* == DEADLINE ALERT INLINE BADGE =========================== */
.u-deadline-alert {
  display: none; align-items: center; gap: 6px; cursor: pointer;
  background: rgba(240,96,96,.15); border: 1px solid var(--danger);
  border-radius: 8px; padding: 5px 12px;
}
.u-deadline-alert.u-visible { display: flex; }

/* == Site Visit alert badge — amber to distinguish from red deadline badge == */
.u-sitevisit-alert {
  display: none; align-items: center; gap: 6px; cursor: pointer;
  background: color-mix(in srgb, var(--accent3) 15%, transparent);
  border: 1px solid var(--accent3);
  border-radius: 8px; padding: 5px 12px;
}
.u-sitevisit-alert.u-visible { display: flex; }

/* == row-urgent-flash — row highlight animation for focusUrgentTenders() ====
   Applied by JS when the user clicks a deadline or site-visit alert badge.
   Pulses from the accent-yellow highlight colour down to transparent over 1.8 s
   so the user's eye is drawn to the relevant tender row in the Register table.
   Raw rgba() values are required inside @keyframes because CSS custom properties
   cannot be used inside colour functions in keyframe stops in all browsers.
   The yellow (252,225,1) matches --accent exactly; opacity is kept low so the
   row text remains readable in both dark and light themes.                     */
@keyframes urgentRowFlash {
  0%   { background-color: rgba(252, 225, 1, 0.22); }
  50%  { background-color: rgba(252, 225, 1, 0.14); }
  100% { background-color: transparent; }
}
.row-urgent-flash {
  animation: urgentRowFlash 1.8s ease-out forwards;
}

/* == GHOST / CLOSE BUTTON ================================== */
.u-btn-ghost {
  padding: 6px 12px; font-size: 12px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text2); cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: all .15s;
}
.u-btn-ghost:hover { border-color: var(--text2); color: var(--text); }

/* == DIFF / DELTA VALUES =================================== */
.u-diff-pos  { color: var(--accent2); font-weight: 600; }
.u-diff-neg  { color: var(--danger);  font-weight: 600; }
.u-diff-warn { color: var(--accent3); font-weight: 600; }

/* == STAT VALUE OVERRIDES ====================================
   .u-stat-val-lg/md/sm consolidated into Section 26 (~line 5406)
   2026-08 -- see the canonical clamp()-based rules there. */

/* == LD DANGER STAT CARD =================================== */
.u-stat-card-danger {
  border: 1px solid rgba(240,96,96,.35) !important;
  background: rgba(240,96,96,.06) !important;
}

/* == PULSE ================================================= */
.u-pulse { animation: pulse 1.2s infinite; }

/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

/* +=+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++—
   ==  UNIFIED DATE / DATETIME FIELD WRAPPER                       ==
   ==  Wraps every date/datetime-local/time input for consistent   ==
   ==  appearance — calendar icon left, dark color-scheme right.   ==
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
.date-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.date-wrap .di,
.date-wrap svg.di {                          /* calendar icon */
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px !important;
  height: 15px !important;
  font-size: 15px;
  color: var(--text2) !important;
  opacity: .85;
  pointer-events: none;
  z-index: 1;
  line-height: 1;
  transition: color .18s, opacity .18s;
}
/* Safety guard: never show raw text string if a legacy span hasn't been upgraded */
.date-wrap span.di {
  font-size: 0 !important;
  color: transparent !important;
  overflow: hidden;
  width: 15px;
  height: 15px;
  display: inline-block;
}
.date-wrap span.di > svg {
  width: 15px !important;
  height: 15px !important;
  color: var(--text2) !important;
  display: block;
  transition: color .18s;
}
.date-wrap:focus-within .di,
.date-wrap:focus-within svg.di,
.date-wrap:focus-within span.di > svg {
  color: var(--text) !important;
  opacity: 1;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .75;
  transition: opacity .15s ease;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}
.date-wrap input[type="date"],
.date-wrap input[type="datetime-local"],
.date-wrap input[type="time"] {
  width: 100%;
  padding: 8px 10px 8px 34px !important;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  letter-spacing: .2px;
  color-scheme: var(--input-color-scheme);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.date-wrap input[type="date"]:focus,
.date-wrap input[type="datetime-local"]:focus,
.date-wrap input[type="time"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(252,225,1,.1);
}
/* auto-calc readonly variants */
.date-wrap input[readonly] {
  color: var(--accent2) !important;
  border-color: rgba(126,200,160,.4) !important;
  cursor: default;
  opacity: .8;
}
.date-wrap.info-readonly input[readonly] {
  color: var(--info) !important;
  border-color: rgba(96,184,240,.4) !important;
}

/* +=+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++—
   ==  SMART TODO — floating panel + header trigger button         ==
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

/* == header trigger button == */
#todoBtn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
#todoBtn:hover                { border-color: var(--accent);  color: var(--accent); }
#todoBtn.has-due-today        { border-color: var(--accent3); color: var(--accent3); }
#todoBtn.has-assigned         { border-color: var(--danger);  color: var(--danger);
  animation: todoBtnPulse 2.2s ease infinite; }
#todoBtn.has-overdue          { border-color: var(--danger);  color: var(--danger);
  animation: todoBtnPulse 2.2s ease infinite; }
@keyframes todoBtnPulse {
  0%,100% { box-shadow: none; }
  50%     { box-shadow: 0 0 0 3px rgba(240,96,96,.2); }
}
.todo-btn-badge {
  display: none;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 9px;
  line-height: 16px;
  min-width: 16px;
  text-align: center;
}
.todo-btn-badge.show { display: inline-block; }

/* == floating panel == */
#todoPanel {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 66px;
  right: 18px;
  width: 352px;
  max-height: calc(100vh - 80px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.03);
  z-index: 460;
  overflow: hidden;
  animation: todoPanelIn .18s cubic-bezier(.2,.8,.3,1);
}
#todoPanel.open { display: flex; }
@keyframes todoPanelIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)  scale(1);    }
}
@media (max-width: 500px) {
  #todoPanel { right: 8px; left: 8px; width: auto; top: 56px; }
}

/* panel sections */
.tdp-head {
  flex-shrink: 0;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 13px 14px 10px;
}
.tdp-title {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 17px; letter-spacing: 1.5px; color: var(--text);
}
.tdp-close {
  margin-left: auto; background: transparent; border: none;
  color: var(--text3); cursor: pointer; padding: 2px;
  display: flex; align-items: center; border-radius: 4px;
  transition: color .12s;
}
.tdp-close:hover { color: var(--text); }
.tdp-chips { display: flex; gap: 10px; margin-top: 6px; }
.tdp-chip {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text3);
}
.tdp-chip b { font-family: 'DM Mono', monospace; font-size: 12px;
  margin-right: 2px; font-weight: 700; }
.tdp-chip.c-done b { color: var(--accent2); }
.tdp-chip.c-today b { color: var(--accent3); }
.tdp-chip.c-over b  { color: var(--danger); }

/* quick-add bar */
.tdp-add {
  flex-shrink: 0;
  display: flex; gap: 6px;
  padding: 9px 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.tdp-add-input {
  flex: 1; min-width: 0;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px; color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none; transition: border-color .14s;
}
.tdp-add-input:focus { border-color: var(--accent); }
.tdp-add-input::placeholder { color: var(--text3); }
.tdp-add-go {
  background: var(--accent); color: #0d0f0e;
  border: none; border-radius: 7px;
  width: 34px; height: 34px; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .13s, transform .12s; flex-shrink: 0;
}
.tdp-add-go:hover { background: var(--accent-hover); transform: scale(1.06); }
.tdp-detail-toggle {
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 7px; width: 34px; height: 34px;
  cursor: pointer; color: var(--text3); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .13s;
}
.tdp-detail-toggle:hover { border-color: var(--accent2); color: var(--accent2); }
.tdp-detail-toggle.open  { border-color: var(--accent2); color: var(--accent2);
  background: rgba(126,200,160,.08); }

/* detail form */
.tdp-detail {
  flex-shrink: 0;
  display: none;
  flex-direction: column; gap: 8px;
  padding: 10px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.tdp-detail.open { display: flex; }
.tdp-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tdp-flabel {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text3); margin-bottom: 3px;
}
.tdp-fsel, .tdp-fdate {
  width: 100%; background: var(--surface3); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-size: 11px;
  color: var(--text); font-family: 'DM Sans', sans-serif;
  outline: none; color-scheme: var(--input-color-scheme); transition: border-color .14s;
}
.tdp-fsel:focus, .tdp-fdate:focus { border-color: var(--accent); }

/* filter tabs */
.tdp-filters {
  flex-shrink: 0;
  display: flex; gap: 2px; padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}
.tdp-ftab {
  flex: 1; padding: 5px 4px; border-radius: 6px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; cursor: pointer; border: none;
  background: transparent; color: var(--text3);
  font-family: 'DM Sans', sans-serif; transition: all .13s;
}
.tdp-ftab:hover  { background: var(--surface3); color: var(--text2); }
.tdp-ftab.active { background: var(--surface2); color: var(--text);
  border: 1.5px solid var(--accent); font-weight: 700; }

/* task list */
.tdp-list { overflow-y: auto; flex: 1; padding: 4px 0; }
.tdp-list::-webkit-scrollbar { width: 4px; }
.tdp-list::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 2px; }

/* task item */
.todo-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,.025);
  border-left: 3px solid transparent;
  transition: background .1s;
}
.todo-item:hover { background: var(--surface2); }
.todo-item.is-overdue   { border-left-color: var(--danger); }
.todo-item.is-due-today { border-left-color: var(--accent3); }
.todo-item.is-done      { opacity: .45; }
.todo-item.is-done .ti-text { text-decoration: line-through; color: var(--text3); }

/* .ti-cb — aliased to .jg-check (all rules inherited from .jg-check in unified checkbox block above) */

.ti-body { flex: 1; min-width: 0; }
.ti-text  { font-size: 12px; color: var(--text); line-height: 1.4; word-break: break-word; }
.ti-meta  { display: flex; align-items: center; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.ti-pri {
  font-size: 9px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; padding: 1px 5px; border-radius: 3px;
}
.pri-high   { background: rgba(240,96,96,.15);  color: var(--danger); }
.pri-medium { background: rgba(240,192,96,.12); color: var(--accent3); }
.pri-low    { background: rgba(126,200,160,.12);color: var(--accent2); }
.ti-tag {
  font-size: 9px; color: var(--text3);
  background: var(--surface3); border-radius: 3px;
  padding: 1px 5px; border: 1px solid var(--border);
}
.ti-due {
  font-size: 9px; font-family: 'DM Mono', monospace; color: var(--text3);
}
.ti-due.overdue   { color: var(--danger); font-weight: 700; }
.ti-due.due-today { color: var(--accent3); font-weight: 700; }

.ti-actions {
  display: flex; gap: 2px; opacity: 0; transition: opacity .12s; flex-shrink: 0;
}
.todo-item:hover .ti-actions { opacity: 1; }
.ti-act {
  width: 22px; height: 22px; border: none; background: transparent;
  color: var(--text3); border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all .1s;
}
.ti-act:hover      { background: var(--surface3); color: var(--text); }
.ti-act.del:hover  { color: var(--danger); }

/* panel footer */
.tdp-foot {
  flex-shrink: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 7px 12px;
  border-top: 1px solid var(--border); background: var(--surface2);
}
.tdp-foot-hint { font-size: 10px; color: var(--text3); font-style: italic; }
.tdp-clr {
  font-size: 10px; color: var(--text3); background: transparent;
  border: none; cursor: pointer; font-family: 'DM Sans', sans-serif;
  padding: 3px 6px; border-radius: 4px; transition: all .11s;
}
.tdp-clr:hover { color: var(--danger); background: rgba(240,96,96,.08); }

/* empty state */
.tdp-empty { text-align: center; padding: 28px 20px; color: var(--text3); }
.tdp-empty-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.tdp-empty-text { font-size: 11px; line-height: 1.6; }

/* reminder toast (floats above normal toasts) */
#todoRemindToast {
  display: none;
  position: fixed; bottom: 82px; right: 22px;
  width: 290px; background: var(--surface);
  border: 1px solid var(--accent3); border-left: 3px solid var(--accent3);
  border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5); z-index: 9990;
  animation: slideIn .28s ease;
}
#todoRemindToast.show { display: block; }
.trt-title { font-size: 11px; font-weight: 700; color: var(--accent3); margin-bottom: 4px; }
.trt-body  { font-size: 12px; color: var(--text); line-height: 1.4; margin-bottom: 9px; }
.trt-btns  { display: flex; gap: 6px; }

/* +=+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++—
   ==  SIDEBAR LOCK / EDIT SYSTEM                                       ==
   ==  Sections are read-only by default; user must click [Edit] to edit    ==
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

.sb-section {
  margin-bottom: 0;          /* wrapper around title + config-block */
}

/* Section header row — title left, edit/save buttons right */
.sb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sb-section-title {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text3); font-weight: 600;
}
.sb-edit-btn, .sb-save-btn, .sb-cancel-btn {
  display: flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: 5px; border: none; cursor: pointer;
  font-size: 10px; font-weight: 600; letter-spacing: .4px;
  font-family: 'DM Sans', sans-serif; transition: all .14s;
}
.sb-edit-btn {
  background: transparent; color: var(--text3);
  border: 1px solid transparent;
}
.sb-edit-btn:hover { color: var(--accent); border-color: rgba(252,225,1,.3); background: rgba(252,225,1,.06); }
.sb-save-btn {
  background: var(--accent); color: #0d0f0e;
  border: 1px solid var(--accent);
}
.sb-save-btn:hover { background: var(--accent-hover); }
.sb-cancel-btn {
  background: transparent; color: var(--text3);
  border: 1px solid var(--border);
}
.sb-cancel-btn:hover { color: var(--danger); border-color: var(--danger); }
.sb-btn-group { display: flex; gap: 5px; }

/* Read-only state — inputs look like values, labels become compact overline headings */
.sb-section.sb-locked .config-block input,
.sb-section.sb-locked .config-block select,
.sb-section.sb-locked .config-block textarea {
  pointer-events: none;
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: default;
  padding-left: 0 !important;
  padding-top: 1px !important;
  padding-bottom: 4px !important;
  opacity: 1;
  line-height: 1.4;
}
.sb-section.sb-locked .config-block select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
/* In locked mode, labels become compact dim overline headings */
.sb-section.sb-locked .config-block label {
  font-size: 9px !important;
  font-weight: 700 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  color: var(--text3) !important;
  margin-bottom: 1px !important;
  margin-top: 8px !important;
}
.sb-section.sb-locked .config-block label:first-child,
.sb-section.sb-locked .config-block label.mt-2:first-of-type {
  margin-top: 2px !important;
}
.sb-section.sb-locked .config-block input:placeholder-shown {
  color: var(--text3) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  font-style: italic;
}
/* Hide filter icon/chevron in locked state — padding-left:0 on locked selects
   would otherwise cause the absolute-positioned icon to overlap the value text */
.sb-section.sb-locked .filter-wrap .filter-icon,
.sb-section.sb-locked .filter-wrap .filter-chevron { display: none; }

/* Hide mode toggle buttons in locked state */
.sb-section.sb-locked .margin-mode-toggle { display: none; }
.sb-section.sb-locked #sectionMargins     { display: none !important; }
.sb-logo-actions,
.sb-asset-actions {
  display: flex;
}
/* Asset upload buttons hidden in locked state */
.sb-section.sb-locked .sb-logo-actions,
.sb-section.sb-locked .sb-asset-actions   { display: none; }
.sb-section.sb-locked .sb-brand-reset     { display: none; }
/* Logo overlay panel: lock pointer-events; protect checkboxes and labels from
   the generic sb-locked rules that strip backgrounds and uppercase all labels */
.sb-section.sb-locked #logoOverlayOptions { pointer-events: none; }
.sb-section.sb-locked #logoOverlayOptions input[type="checkbox"] {
  background: initial !important;
  border-color: initial !important;
  pointer-events: none;
}
.sb-section.sb-locked #logoOverlayOptions label {
  font-size: 12px !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  color: var(--text) !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
/* Company signatory slot controls hidden in locked state */
.sb-section.sb-locked #signatoryAddBtn       { display: none !important; }
.sb-section.sb-locked .signatory-slot-remove { display: none !important; }
/* External signatory write controls hidden in locked state */
.sb-section.sb-locked #extSigAddBtn { display: none !important; }
.sb-section.sb-locked #extSigForm   { display: none !important; }
/* Statutory documents controls hidden in locked state */
.sb-section.sb-locked .sb-statutory-action { display: none !important; }
.sb-section.sb-locked #statutoryDocsContainer input,
.sb-section.sb-locked #statutoryDocsContainer select {
  pointer-events: none;
  border-color: transparent !important;
  background: transparent !important;
}
/* Show edit hint in locked state */
.sb-locked-hint {
  display: none;
  font-size: 10px; color: var(--text3); font-style: italic;
  margin-top: 6px; text-align: center;
}
.sb-section.sb-locked .sb-locked-hint { display: block; }

/* == Sidebar role-locked sections (non-admin) == */
.sb-role-locked { pointer-events:none; opacity:.55; }
.sb-role-locked .sb-edit-btn,
.sb-role-locked .sb-save-btn,
.sb-role-locked .sb-cancel-btn { display:none !important; }
.sb-role-hidden { display:none !important; }
.sb-role-badge {
  display:inline-flex; align-items:center; gap:3px;
  font-size:9px; font-weight:700; letter-spacing:.6px; text-transform:uppercase;
  padding:1px 6px; border-radius:5px;
  background:rgba(96,184,240,.12); color:var(--info); border:1px solid rgba(96,184,240,.2);
  margin-left:6px;
}

/* == Sync Now button state == */
#syncNowBtn.syncing { opacity:.6; pointer-events:none; }

/* ++ WALKTHROUGH TOUR ++++++++++++++++++++++++++++++++++++++++++++++ */
#tourOverlay {
  display: none;
  position: fixed; inset: 0; z-index: var(--z-dialog, 100100);
}
#tourOverlay.active { display: block; }

/* Dark backdrop container — transparent wrapper for the 4-pane frosted glass layout */
#tourBackdrop {
  display: block !important;
  position: fixed; inset: 0;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none;
  z-index: 1 !important;
}

/* 4-pane backdrop — surrounding top/bottom/left/right frosted glass panes leaving target 100% unblurred */
.tour-backdrop-pane {
  position: fixed;
  background: var(--overlay) !important;
  backdrop-filter: blur(6px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
  pointer-events: auto;
  transition: top .25s ease, left .25s ease, width .25s ease, height .25s ease;
}

/* Spotlight cutout — sits above backdrop, frames the unblurred target with accent border and glow */
#tourSpotlight {
  display: none;
  position: fixed;
  z-index: 2 !important;
  border-radius: 10px;
  box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(252, 225, 1, 0.45);
  pointer-events: auto;
  cursor: pointer;
  transition: top .35s ease, left .35s ease, width .35s ease, height .35s ease;
}

/* Card — always above everything, elevated with architectural blueprint watermark */
#tourCard {
  position: fixed;
  z-index: 10 !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 26px 20px;
  width: 360px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 64px rgba(0,0,0,.45), 0 4px 16px rgba(0,0,0,.25);
  pointer-events: auto;
  transition: top .3s ease, left .3s ease;
  overflow: hidden;
  /* Default: centred */
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
}
#tourCard.positioned { transform: none; }

.tour-card-icon { font-size: 32px; margin-bottom: 10px; line-height: 1; }
.tour-card-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px; letter-spacing: 1px;
  color: var(--text); margin-bottom: 8px;
}
.tour-card-body {
  font-size: 12.5px; color: var(--text2);
  line-height: 1.65; margin-bottom: 20px;
}
.tour-progress { display: flex; gap: 6px; margin-bottom: 16px; align-items: center; }
.tour-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--surface3); transition: all .2s;
  flex-shrink: 0;
}
.tour-dot.active { background: var(--accent); transform: scale(1.3); }
.tour-dot.done   { background: var(--accent2); }

.tour-btn-row { display: flex; gap: 10px; align-items: center; }
.tour-btn-next {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px !important;
  padding: 10px 18px !important;
  border-radius: var(--radius-pill) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer;
  letter-spacing: .25px;
}
.tour-btn-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px !important;
  padding: 10px 16px !important;
  border-radius: var(--radius-pill) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer;
  white-space: nowrap;
}
.tour-step-label {
  font-size: 10px; color: var(--text3); letter-spacing: .5px;
  margin-left: auto; white-space: nowrap; flex-shrink: 0;
  font-weight: 600;
}

/* == Unsaved-changes dot == */
.sb-dirty-dot {
  display: none;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent3);
  margin-left: 4px; flex-shrink: 0;
}
.sb-section.sb-dirty .sb-dirty-dot { display: inline-block; }

/* +=+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++—
   ==  TODO — inline edit row within list                               ==
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
.todo-item.editing { background: var(--surface3); }
.todo-inline-edit {
  display: none;
  flex-direction: column; gap: 6px;
  padding: 8px 12px 10px;
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.todo-inline-edit.open { display: flex; }
.tie-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tie-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 9px; font-size: 12px; color: var(--text);
  font-family: 'DM Sans', sans-serif; outline: none; transition: border-color .14s;
  color-scheme: var(--input-color-scheme);
}
.tie-input:focus { border-color: var(--accent); }
.tie-input-full { grid-column: 1 / -1; }
.tie-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 2px; }
.tie-act {
  padding: 5px 12px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 11px; font-weight: 600; font-family: 'DM Sans', sans-serif;
  transition: all .13s;
}
.tie-save   { background: var(--accent); color: #0d0f0e; }
.tie-save:hover { background: var(--accent-hover); }
.tie-cancel { background: transparent; color: var(--text3); border: 1px solid var(--border); }
.tie-cancel:hover { color: var(--text); border-color: var(--text3); }

/* == Theme toggle button ============================================== */
.sb-theme-btn {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  padding: 9px 16px 9px 18px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--sb-text) !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  text-align: left !important;
  transition: color .15s, background .15s !important;
}
.sb-theme-btn:hover {
  color: var(--text) !important;
  background: var(--sb-hover) !important;
}
.sb-collapsed .sb-theme-btn {
  justify-content: center !important;
  padding: 10px 0 !important;
}
.sb-collapsed .sb-theme-btn .sb-nav-label {
  display: none !important;
}

/* == Row number header cell =========================================== */
th.row-num-th {
  text-align:right;font-size:10px;color:var(--text3);font-weight:600;
  padding:6px 6px;white-space:nowrap;width:32px;
}

/* == Auto-resizing description textarea =============================== */
.auto-desc {
  overflow: hidden !important;
  resize: none !important;
  min-height: 28px;
  width: 100%;
  line-height: 1.5;
  font-family: inherit;
  box-sizing: border-box;
}

/* ============================================================
   SECTION 2 — Design System v2 (overrides Section 1)
   ============================================================ */


/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   JAVENZI — VISUAL DESIGN SYSTEM v3  (id="j360-design-v2")
   ======================================================================
   This is the SECOND and authoritative style block. It intentionally
   overrides CSS Block 1 (the first <style> tag) with deeper, more
   considered values. All rules use !important to guarantee they win
   the cascade regardless of selector specificity.

   "Premium Construction Intelligence" — design philosophy:
     = Deep surfaces: near-black greens vs Block 1's near-black yellows.
       Richer depth, natural to a construction context.
     = Surgical accent discipline: --accent yellow on exactly one focal
       point per screen. Never decorative.
     = Dramatic type scale: Bebas Neue display, DM Sans UI, DM Mono numbers.
     = Chart-first: --chart1-5 palette tuned for legibility in both modes.

   SECTION INDEX:
     0.  Color system (dark + light token redefinition)
     1.  Typography scale
     2.  Header / Topbar
     3.  Sidebar (brand, user strip, nav, collapse, tooltips)
     4.  Unified sub-tab system
     5.  KPI cards
     6.  Cards
     7.  Dashboard chart cards
     8.  Section headers
     9.  Stat cards
    10.  Buttons
    11.  Tables
    12.  Form inputs
    13.  Modals
    14.  Toast notifications
    15.  Project & tender cards
    16.  Chart styling
    17.  Scrollbars
    18.  Badges & chips
    19.  Progress bars
    20.  Mini KPI
    21.  Activity feed
    22.  Section dividers & spacing
        Settings modal
        Sidebar collapse system
        Tooltips
    23.  Approval chip
    24.  Alert bars
    25.  Page transitions & animations
    26.  Utility classes
    27.  Login screen
    28.  Chart.js defaults
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

/* == 1. TYPOGRAPHY SCALE =============================================
   Weight 700 added to DM Sans for bold headings. Three-font system:
     'Bebas Neue'  — display: section titles, logo, modal headings
     'DM Sans'     — UI text: body, buttons, labels, nav items
     'DM Mono'     — numerics: rates, amounts, timestamps, IDs
   ==================================================================== */

body {
  font-family: 'DM Sans', system-ui, sans-serif !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: var(--text) !important;
  background: var(--bg) !important;
}
html { overflow-x: hidden !important; }

/* Overline label — used above KPI values and in section dividers */
.t-label {
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 1.2px !important;
  text-transform: uppercase !important;
  color: var(--text3) !important;
}

/* == 2. HEADER / TOPBAR ==============================================
   Slim 56px sticky bar at the top of the right column (.app-right).
   Position:sticky + top:0 + z-index:100 keeps it visible while main
   content scrolls. 56px matches the sidebar brand strip height exactly.

   .topbar-left    Logo + hamburger + page title
   .topbar-right   Action buttons + user badge (flex-shrink:0 — never clips)
   .topbar-btn     Standard topbar button — ghost, brightens on hover
   .topbar-btn-icon Icon-only variant (less horizontal padding)
   .topbar-datetime Live clock — DM Mono so digits don't shift width
   .logo-mark      30—30 yellow square with a diagonal shine (::after gradient)
                   and an expanding glow ring on hover (box-shadow)
   ==================================================================== */
header, #topbar {
  flex-shrink: 0 !important;
  height: 56px !important;           /* Exact match with sidebar brand strip */
  padding: 0 24px 0 20px !important;
  border-bottom: 1px solid var(--sb-border) !important;
  background: var(--bg) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;           /* Above content, below modals (z:500) */
}
.topbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  min-width: 0 !important;           /* Enables text truncation on narrow screens */
}
/* NOTE: .topbar-menu-btn defined in SIDEBAR COLLAPSE SYSTEM below */

/* Page title — truncates with ellipsis if panel title is long */
.topbar-page-title {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  letter-spacing: .2px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
/* Right group: never shrinks — buttons always fully visible */
.topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
}
/* Live clock: monospace prevents digit-width jitter as seconds change */
.topbar-datetime {
  font-size: 11px !important;
  color: var(--text3) !important;
  font-family: 'DM Mono', monospace !important;
  margin-right: 6px !important;
  letter-spacing: .3px !important;
}
/* Standard topbar button — ghost, brightens on hover */
.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px !important;
  background: var(--surface) !important;
  border: 1px solid var(--sb-border) !important;
  border-radius: 8px !important;
  color: var(--text2) !important;
  font-size: 12px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: background .15s, color .15s, border-color .15s !important;
  white-space: nowrap !important;
}
.topbar-btn[style*="display: none"],
.topbar-btn[style*="display:none"],
.topbar-btn.j360-hidden {
  display: none !important;
}
.topbar-btn:hover {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border-color: var(--border2) !important;
}
/* Icon-only variant — less horizontal padding */
.topbar-btn-icon { padding: 6px 8px !important; }
.topbar-btn .material-symbols-outlined { font-size: 17px !important; }

/* Topbar Offline & Sync Status Indicator Badge */
.topbar-sync-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 5px 10px !important;
  border-radius: 20px !important;
  font-size: 11px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all .2s ease !important;
  user-select: none !important;
}
.topbar-sync-badge .sync-badge-dot {
  width: 7px !important;
  height: 7px !important;
  border-radius: 50% !important;
  display: inline-block !important;
}
.topbar-sync-badge.status-synced {
  background: rgba(42, 122, 79, 0.12) !important;
  color: var(--accent2) !important;
  border: 1px solid rgba(42, 122, 79, 0.3) !important;
}
.topbar-sync-badge.status-synced .sync-badge-dot {
  background: var(--accent2) !important;
  box-shadow: 0 0 6px rgba(42, 122, 79, 0.6) !important;
}
.topbar-sync-badge.status-offline {
  background: rgba(240, 192, 0, 0.12) !important;
  color: var(--accent3, #f0c000) !important;
  border: 1px solid rgba(240, 192, 0, 0.35) !important;
}
.topbar-sync-badge.status-offline .sync-badge-dot {
  background: #f0c000 !important;
  box-shadow: 0 0 6px rgba(240, 192, 0, 0.6) !important;
}
.topbar-sync-badge.status-syncing {
  background: rgba(59, 130, 246, 0.12) !important;
  color: #3b82f6 !important;
  border: 1px solid rgba(59, 130, 246, 0.35) !important;
}
.topbar-sync-badge.status-syncing .sync-badge-dot {
  background: #3b82f6 !important;
  animation: pulse-dot 1s infinite alternate !important;
}
.topbar-sync-badge:hover {
  filter: brightness(1.15) !important;
  transform: translateY(-1px) !important;
}
@keyframes pulse-dot {
  from { opacity: 0.4; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.2); }
}

/* Logo mark: 30—30 yellow square.
   ::after creates a diagonal shine highlight (purely decorative).
   box-shadow on hover expands from 0 to a 5px yellow glow ring. */
.logo-mark {
  width: 30px !important;
  height: 30px !important;
  border-radius: 7px !important;
  background: var(--accent) !important;
  box-shadow: 0 0 0 0 var(--accent-glow2), 0 2px 8px rgba(252,225,1,.2) !important;
  transition: box-shadow .3s !important;
  position: relative !important;
  overflow: hidden !important;
}
/* Diagonal shine — top-left to centre, 25% white opacity */
.logo-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.25) 0%, transparent 60%);
}
/* Glow ring expands on hover */
.logo-mark:hover {
  box-shadow: 0 0 0 5px var(--accent-glow2), 0 4px 16px rgba(252,225,1,.3) !important;
}
.logo-text {
  font-family: 'Bebas Neue', sans-serif !important;
  font-size: 18px !important;
  letter-spacing: 2.5px !important;
  color: var(--text) !important;
}
/* Sub-label: DM Sans — tagline text, not a code or number */
.logo-sub {
  font-size: 8.5px !important;
  letter-spacing: 2px !important;
  color: var(--text3) !important;
  margin-top: -2px !important;
  font-family: 'DM Sans', sans-serif !important;
}

/* == 3. SIDEBAR — full-height, premium design ========================
   Left column of the app shell grid (260px normal / 62px collapsed).

   Structure:
     .sb-brand       56px brand strip — logo icon + wordmark
     .sb-user-strip  User avatar + name + role
     .sb-nav         Scrollable nav (scrollbar hidden)
       .sb-group     Nav group (MAIN, FINANCE, RESOURCES…)
         .sb-group-label  Overline label for the group
         .sb-nav-item     Individual nav button
           .sb-nav-icon   Material Symbol icon
           .sb-nav-label  Text + optional badge
     .sb-bottom      Bottom strip — settings button + theme toggle
   ==================================================================== */
.sidebar {
  background: var(--surface2) !important;
  border-right: 1px solid var(--sb-border) !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
}

/* Brand strip: 56px — matches topbar height for perfect horizontal alignment */
.sb-brand {
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  padding: 0 20px !important;
  height: 56px !important;
  border-bottom: 1px solid var(--sb-border) !important;
  flex-shrink: 0 !important;
  background: var(--sb-brand-bg) !important;
}
/* Brand icon: yellow square with double glow ring */
.sb-brand-icon {
  width: 32px !important;
  height: 32px !important;
  background: var(--accent) !important;
  border-radius: 9px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: 'Bebas Neue', sans-serif !important;
  font-size: 18px !important;
  color: #080a08 !important;         /* Always near-black on yellow           */
  flex-shrink: 0 !important;
  box-shadow: 0 0 0 1px rgba(252,225,1,.25), 0 4px 12px rgba(252,225,1,.15) !important;
  letter-spacing: 0 !important;
}
.sb-brand-name {
  font-family: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif !important;
  font-size: 17px !important;
  letter-spacing: 2.5px !important;
  text-transform: uppercase !important;
  color: var(--text) !important;
  line-height: 1 !important;
  display: block !important;
}
/* Unified brand wordmark: JAVENZI is uniformly solid black (as on the website) */
.sb-brand-accent { color: var(--text) !important; }
.sb-brand-sub {
  font-size: 8.5px !important;
  letter-spacing: 1.8px !important;
  color: var(--text3) !important;
  font-family: 'DM Sans', sans-serif !important;
  margin-top: 2px !important;
  text-transform: uppercase !important;
  display: block !important;
}

/* User strip: shows avatar initials/photo, full name, role.
   Avatar uses low-opacity --accent ring to tie to brand colour. */
.sb-user-strip {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 16px !important;
  margin: 0 8px 4px !important;
  border-radius: 10px !important;
  background: var(--sb-hover) !important;
  border: 1px solid var(--sb-border) !important;
}
.sb-user-avatar {
  width: 34px !important;
  height: 34px !important;
  background: rgba(252,225,1,.15) !important;
  border: 1px solid rgba(252,225,1,.25) !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--accent) !important;
  font-family: 'DM Sans', sans-serif !important;
  flex-shrink: 0 !important;
  letter-spacing: .5px !important;
  overflow: hidden !important;       /* Clips profile photo to circle         */
}
.sb-user-info { flex: 1 !important; min-width: 0 !important; }
.sb-user-name {
  font-size: 11.5px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-family: 'DM Sans', sans-serif !important;
}
/* Role label: DM Sans — user role is a label, not a code */
.sb-user-role {
  font-size: 11px !important;
  color: var(--text3) !important;
  text-transform: uppercase !important;
  letter-spacing: .8px !important;
  font-family: 'DM Sans', sans-serif !important;
  margin-top: 1px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Nav container: fills remaining sidebar height, scrollbar hidden.
   scrollbar-width:none — the nav is rarely tall enough to need scrolling,
   and a visible scrollbar would look cluttered in the 62px collapsed view. */
.sb-nav {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 4px 0 8px !important;
  scrollbar-width: none !important;
}
.sb-nav::-webkit-scrollbar { display: none !important; }

/* Nav groups: padding creates clean breathing room for rounded pill items */
.sb-group { padding: 2px 8px 6px !important; }
/* Group label: 11px DM Sans uppercase — navigation labels use body font */
.sb-group-label {
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 1.5px !important;
  text-transform: uppercase !important;
  color: var(--text3) !important;
  padding: 14px 12px 5px !important;
  display: block !important;
  font-family: 'DM Sans', sans-serif !important;
}

/* Nav items: Company Settings style (rounded pills with clean inset padding) */
.sb-nav-item {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--sb-text) !important;
  background: transparent !important;
  border: none !important;
  border-left: 3px solid transparent !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  position: relative !important;
  transition: color .15s, background .15s, border-color .15s !important;
  text-align: left !important;
  letter-spacing: .1px !important;
  font-family: 'DM Sans', sans-serif !important;
  white-space: nowrap !important;
  margin: 1px 0 !important;
}
.sb-nav-item:hover {
  color: var(--text) !important;
  background: var(--sb-hover) !important;
}
.sb-nav-item.active {
  color: var(--text) !important;
  background: var(--sb-active-bg, var(--surface2)) !important;
  font-weight: 700 !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: 8px !important;
}
.sb-nav-item.active::before {
  display: none !important;
}

/* Nav icons: opacity uses var(--sb-icon-opacity) — theme-aware variable.
   Dark mode: 0.65 (lower; dark surfaces need less).
   Light mode: 0.80 (higher; light surfaces need more to read).
   This replaces the old hardcoded opacity:.5 which was too dim in both modes.
   Active icons are always opacity:1. Hover raises to .95. */
.sb-nav-icon {
  font-size: 18px !important;
  opacity: var(--sb-icon-opacity) !important;  /* .65 dark / .80 light       */
  flex-shrink: 0 !important;
  transition: opacity .15s, color .15s !important;
}
/* SVG icon sizing for sidebar navigation */
.sb-nav-icon.j360-icon {
  width: 20px !important;
  height: 20px !important;
  font-size: 20px;
}
.sb-nav-item:hover .sb-nav-icon { opacity: .95 !important; }
.sb-nav-item.active .sb-nav-icon {
  opacity: 1 !important;
  color: var(--text) !important;
}

/* Nav label: flex:1 fills remaining space, pushing badge right */
.sb-nav-label {
  flex: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.sb-badge { flex-shrink: 0 !important; }
#manualRateBuildBadge,
#rateReqCountBadge {
  color: #ffffff !important;
}

/* Bottom section: settings + theme toggle, fixed to sidebar bottom */
.sb-bottom {
  flex-shrink: 0 !important;
  border-top: 1px solid var(--sb-border) !important;
  padding: 10px 0 12px !important;
}

/* Second .sb-user-strip declaration — bottom placement overrides */
.sb-user-strip {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 18px !important;
  margin-bottom: 4px !important;
}

/* Settings button: same style as .sb-nav-item — visually belongs in nav */
.sb-settings-btn {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
  padding: 9px 16px 9px 18px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--sb-text) !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  transition: color .15s, background .15s !important;
  font-family: 'DM Sans', sans-serif !important;
  margin-bottom: 2px !important;
}
.sb-settings-btn:hover { color: var(--text) !important; background: var(--sb-hover) !important; }
.sb-settings-btn.active { color: var(--text) !important; background: var(--sb-hover) !important; }

/* Settings panel: collapsible company profile in sidebar.
   max-height:60vh with overflow-y:auto allows scrolling if many fields. */
#sbSettingsPanel {
  max-height: 60vh !important;
  overflow-y: auto !important;
  padding: 0 16px 16px !important;
  scrollbar-width: thin !important;
}

/* Keep old sidebar section styles working inside the collapsible */
.sb-section { margin-bottom: 0 !important; }
.config-block {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  padding: 14px !important;
}

/* Prevent .tab.active rule from adding unwanted bottom border to nav items */
.sb-nav-item.tab:not(.active) {
  border-bottom-color: transparent !important;
  background: transparent !important;
}

/* KPI fit-text: JS scales font-size down if value overflows tile width.
   white-space:nowrap prevents wrapping during JS measurement. */
.kpi-fit {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  min-width: 0 !important;
}

/* Activity Feed: fixed-height scrollable list in Dashboard.
   Fade gradient at bottom (.has-overflow::after) signals more content.
   JS adds .has-overflow after render if content exceeds max-height. */
.activity-feed-scroll {
  /* No max-height — feed grows with content, card controls overflow */
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--surface4, #2e342d) transparent;
}
.activity-feed-scroll::-webkit-scrollbar { width: 3px; }
.activity-feed-scroll::-webkit-scrollbar-track { background: transparent; }
.activity-feed-scroll::-webkit-scrollbar-thumb { background: var(--surface4, #2e342d); border-radius: 2px; }
.activity-feed-scroll::-webkit-scrollbar-thumb:hover { background: var(--border2, #3a4039); }
.activity-feed-wrap { position: relative; }
/* Bottom fade gradient: hidden until .has-overflow added by JS */
.activity-feed-wrap::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 48px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.activity-feed-wrap.has-overflow::after { opacity: 1; }

/* Activity item: 3-column grid — [28px icon] [content] [timestamp] */
.j360-activity-feed { display: flex; flex-direction: column; }
.j360-activity-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.j360-activity-item:last-child { border-bottom: none; }
/* Coloured icon square — colour indicates event category */
.j360-activity-dot { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.j360-activity-dot svg, .j360-activity-dot .j360-icon { width: 16px !important; height: 16px !important; color: inherit !important; }
.j360-activity-dot.green  { background: rgba(22,163,74,.15);   color: #15803d; }   /* BOQ update     */
.j360-activity-dot.blue   { background: rgba(2,132,199,.15);   color: #0369a1; }   /* Tender/import  */
.j360-activity-dot.yellow { background: rgba(217,119,6,.15);   color: #b45309; }   /* Financial/rate */
.j360-activity-dot.grey   { background: rgba(114,123,116,.15); color: var(--text2); } /* System/misc    */
.j360-activity-dot.red    { background: rgba(220,38,38,.15);   color: #b91c1c; }   /* Alert/overdue  */
.j360-activity-text { font-size: 12px; color: var(--text2); line-height: 1.45; min-width: 0; }
.j360-activity-text strong { color: var(--text); font-weight: 600; }
.j360-activity-time { font-size: 10px; color: var(--text3); white-space: nowrap; padding-top: 2px; flex-shrink: 0; }

/* RBAC tab hiding: MUST come after all .sb-nav-item rules.
   Higher specificity wins the cascade — hides restricted tabs by role. */
.tab.j360-tab-hidden,
.tab.sb-nav-item.j360-tab-hidden,
.sb-group.j360-tab-hidden { display: none !important; }

/* When a .tab element is also an active sidebar item,
   remove the bottom border that .tab.active normally adds */
.sb-nav-item.tab.active {
  border-bottom: none !important;
  background: var(--sb-active-bg, var(--surface2)) !important;
  border-left: 3px solid var(--accent) !important;
  border-radius: 8px !important;
}

/* == 4. UNIFIED SUB-TAB SYSTEM — design-v2 overrides ================
   Overrides Block 1 sub-tab styles with !important. Key differences:
     Hover adds faint yellow tint (rgba(252,225,1,.03)) instead of neutral.
     .margin-mode-toggle .mode-btn becomes pill-shaped (border-radius:6px).
     .tabs BOQ strip keeps its simple full-bleed underline.
   ==================================================================== */
.subtab-bar {
  display: flex !important;
  gap: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin-bottom: 16px !important;
  flex-wrap: wrap !important;
}

/* All sub-tab button variants — unified base */
.mode-btn, .u-subtab, .u-subtab-lg, .mfe-tab, .subtab {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 9px 16px !important;
  border: none !important;
  position: relative !important;
  margin-bottom: -1px !important;    /* Overlap the container border           */
  background: transparent !important;
  color: var(--text3) !important;
  font-size: 12px !important;
  font-family: 'DM Sans', sans-serif !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: color .15s !important;
  border-radius: 0 !important;
  letter-spacing: .2px !important;
}
/* Hover: text brightens + very faint yellow wash */
.mode-btn:hover, .u-subtab:hover, .u-subtab-lg:hover, .mfe-tab:hover, .subtab:hover {
  color: var(--text) !important;
  background: rgba(252,225,1,.03) !important;
}

/* Active: bold contrast text + centered short pill underline indicator (Website standard) */
.mode-btn.active, .u-subtab.u-subtab-active, .u-subtab-lg.u-subtab-active, .mfe-tab.active, .subtab.active {
  color: var(--text) !important;
  background: transparent !important;
  font-weight: 700 !important;
}
.mode-btn.active::after,
.u-subtab.u-subtab-active::after,
.u-subtab-lg.u-subtab-active::after,
.mfe-tab.active::after,
.subtab.active::after {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 38px !important;
  bottom: -1px !important;
  height: 3px !important;
  background: var(--accent) !important;
  border-radius: 999px !important;
  z-index: 1 !important;
}
.mode-btn.active svg, .mode-btn.active .j360-icon,
.u-subtab.u-subtab-active svg, .u-subtab.u-subtab-active .j360-icon,
.u-subtab-lg.u-subtab-active svg, .u-subtab-lg.u-subtab-active .j360-icon,
.mfe-tab.active svg, .mfe-tab.active .j360-icon,
.subtab.active svg, .subtab.active .j360-icon {
  color: var(--text) !important;
  opacity: 1 !important;
}

/* Green active variant — Projects "Completed" tab */
.u-subtab-lg.u-subtab-active-green {
  color: var(--accent2) !important;
  background: transparent !important;
  font-weight: 700 !important;
}
.u-subtab-lg.u-subtab-active-green::after {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 38px !important;
  bottom: -1px !important;
  height: 3px !important;
  background: var(--accent2) !important;
  border-radius: 999px !important;
  z-index: 1 !important;
}

/* Gray active variant — Projects "Terminated" tab */
.u-subtab-lg.u-subtab-active-gray {
  color: var(--text3) !important;
  background: transparent !important;
  font-weight: 700 !important;
}
.u-subtab-lg.u-subtab-active-gray::after {
  content: "" !important;
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: 38px !important;
  bottom: -1px !important;
  height: 3px !important;
  background: var(--text3) !important;
  border-radius: 999px !important;
  z-index: 1 !important;
}

/* Sidebar margin/markup toggle — pill-shaped (not underline) */
.margin-mode-toggle .mode-btn {
  flex: 1 !important;
  justify-content: center !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  border-bottom: none !important;
  border-radius: 6px !important;    /* Pill vs underline                      */
  margin-bottom: 0 !important;
}
.margin-mode-toggle .mode-btn.active {
  background: var(--surface3) !important;
  color: var(--text) !important;
  font-weight: 700 !important;
  border-bottom: none !important;
}
.margin-mode-toggle .mode-btn.active::after {
  display: none !important;
}

/* BOQ sub-tab wrapper */
.tabs {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}

/* == 5. KPI CARDS ====================================================
   Dashboard KPI tiles. Hover lifts card (translateY -2px + shadow).
   ::before creates a top-edge yellow shimmer (standard in design-v2).
   .kpi-delta chips provide period-over-period context.
   ==================================================================== */
/* Dashboard panel is a size container so KPIs and body columns adapt to the
   actual workspace width when the sidebar expands (260px) or collapses (62px),
   not just the outer viewport width. */
#panel-dashboard {
  min-width: 0;
  container-name: dashboard;
  container-type: inline-size;
}

.dash-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
  gap: 10px !important;
}

/* Dashboard KPI strip: minmax(0, 1fr) prevents long TZS values from pushing
   tracks past the container edge. Viewport media queries act as fallbacks for
   older browsers; container queries below govern modern browsers. */
#dashKPIGrid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
@media (max-width: 1360px) { #dashKPIGrid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } }
@media (max-width: 1020px) { #dashKPIGrid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } }
@media (max-width: 720px)  { #dashKPIGrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }

/* Dashboard 3-column body (Left: tenders, Centre: charts/projects, Right: activity).
   Viewport @media fallbacks handle older browsers without container queries. */
.dash-body-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 280px;
  gap: 14px;
  margin-top: 6px;
}
.dash-body-grid > div { min-width: 0; }
@media (max-width: 1200px) {
  .dash-body-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-body-grid > div:last-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .dash-body-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-body-grid > div:last-child { grid-column: auto; }
}

@supports (container-type: inline-size) {
  #dashKPIGrid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .dash-body-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 280px; }
  .dash-body-grid > div:last-child { grid-column: auto; }
  @container dashboard (max-width: 1179px) {
    #dashKPIGrid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  }
  @container dashboard (max-width: 900px) {
    #dashKPIGrid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  }
  @container dashboard (max-width: 640px) {
    #dashKPIGrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  }
  @container dashboard (max-width: 420px) {
    #dashKPIGrid { grid-template-columns: minmax(0, 1fr) !important; }
  }

  @container dashboard (max-width: 959px) {
    .dash-body-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-body-grid > div:last-child { grid-column: 1 / -1; }
  }
  @container dashboard (max-width: 679px) {
    .dash-body-grid { grid-template-columns: minmax(0, 1fr); }
    .dash-body-grid > div:last-child { grid-column: auto; }
  }
}

.dash-kpi {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  padding: 18px 20px 16px !important;
  position: relative !important;
  min-width: 0 !important;
  overflow: clip !important;
  container-name: kpi-card;
  container-type: inline-size;
  transition: border-color .2s ease !important;
  cursor: default !important;
}
/* Top-edge shimmer — standard premium card treatment in design-v2 */
.dash-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(252,225,1,.15), transparent);
}
.dash-kpi:hover {
  border-color: var(--border2) !important;
  transform: none !important;
  box-shadow: none !important;
}
.dash-kpi-icon { font-size: 16px !important; color: var(--text3) !important; opacity: .85 !important; margin-bottom: 10px !important; display: block !important; }
.dash-kpi-label { font-size: 11.5px !important; font-weight: 700 !important; letter-spacing: .8px !important; text-transform: uppercase !important; color: var(--text3) !important; margin-bottom: 6px !important; font-family: 'DM Sans', sans-serif !important; padding-right: 22px; }
/* KPI value: container-relative clamp() keeps large TZS figures inside their
   tile at any column width; no !important on font-size so fitKpiText() can
   step down further for multi-billion TZS values without truncating digits. */
.dash-kpi-value {
  font-size: 22px;
  font-size: clamp(16px, 9.5cqi, 24px);
  font-weight: 700 !important;
  color: var(--text) !important;
  letter-spacing: -0.5px !important;
  line-height: 1.15 !important;
  font-family: 'DM Sans', sans-serif !important;
  margin-bottom: 4px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
  display: block !important;
}
.dash-kpi-sub { font-size: 12px !important; color: var(--text3) !important; font-family: 'DM Sans', sans-serif !important; letter-spacing: .1px !important; }

/* Delta chips: up (green), down (red), neutral (surface) */
.kpi-delta { display: inline-flex !important; align-items: center !important; gap: 2px !important; font-size: 11.5px !important; font-weight: 700 !important; padding: 2px 7px !important; border-radius: 20px !important; margin-top: 6px !important; font-family: 'DM Sans', sans-serif !important; }
.kpi-delta.up      { background: rgba(46,122,80,.12) !important; color: var(--accent2) !important; }
.kpi-delta.down    { background: rgba(240,96,96,.1) !important; color: var(--danger) !important; }
.kpi-delta.neutral { background: var(--surface2) !important;    color: var(--text3) !important;  }

/* == 6. CARDS ========================================================
   Primary container component. card-header is transparent (Block 1 had
   surface2 bg) — cleaner, less banded. Hover brightens border only. */
.card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 8px 24px var(--shadow-card) !important;
  transition: border-color .2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.card:hover {
  border-color: var(--border2) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 12px 32px var(--shadow-card) !important;
}
.card-header { padding: 14px 20px !important; border-bottom: 1px solid var(--border) !important; background: transparent !important; }
.card-title { font-size: 12px !important; font-weight: 600 !important; color: var(--text) !important; letter-spacing: .3px !important; }
.card-body { padding: 20px !important; }

/* Website-aligned architectural drafting blueprint grid watermark */
.blueprint-grid-watermark {
  position: relative;
}
.blueprint-grid-watermark::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: -1px -1px;
  opacity: 0.18;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
  pointer-events: none;
  border-radius: inherit;
}

/* == 7. DASHBOARD CHART CARDS ========================================
   Wraps Chart.js canvases. Same ::before shimmer as KPI tiles.
   position:relative required for the gradient pseudo-element overlay. */
.dash-chart-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  transition: border-color .2s, box-shadow .2s !important;
  position: relative !important;
}
.dash-chart-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 10%, rgba(252,225,1,.08) 50%, transparent 90%);
  pointer-events: none;
}
.dash-chart-card:hover { border-color: var(--border2) !important; box-shadow: 0 4px 28px rgba(0,0,0,.35) !important; }
/* Chart header: DM Sans uppercase — cleaner label for chart titles */
.dash-chart-header {
  padding: 13px 18px !important;
  border-bottom: 1px solid var(--border) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text2) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  letter-spacing: .3px !important;
  text-transform: uppercase !important;
  font-family: 'DM Sans', sans-serif !important;
}
.dash-chart-body { padding: 16px 18px !important; }

/* == 8. SECTION HEADERS ==============================================
   Bebas Neue title + DM Sans sub-label + optional "view all" ghost button.
   DM Mono is for numeric/technical data only — prose subtitles use DM Sans. */
.section-header { display: flex !important; align-items: center !important; justify-content: space-between !important; gap: 12px !important; margin-bottom: 14px; }
.section-title { font-family: 'Bebas Neue', sans-serif !important; font-size: 22px !important; letter-spacing: 1.5px !important; color: var(--text) !important; line-height: 1 !important; }
.section-sub { font-size: 12.5px !important; color: var(--text3) !important; margin-top: 3px !important; letter-spacing: .1px !important; font-family: 'DM Sans', sans-serif !important; }
/* "View all ->" ghost button */
.view-all-btn {
  font-size: 10px !important;
  font-weight: 600 !important;
  color: var(--text3) !important;
  background: none !important;
  border: 1px solid var(--border) !important;
  cursor: pointer !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  letter-spacing: .5px !important;
  text-transform: uppercase !important;
  transition: color .15s, border-color .15s !important;
  font-family: 'DM Sans', sans-serif !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.view-all-btn:hover { color: var(--accent) !important; border-color: var(--accent-dim) !important; }

/* == 9. STAT CARDS (Projects KPI strip) ==============================
   Same lift-on-hover and ::before shimmer as .dash-kpi.
   DM Sans for the value (not DM Mono) — more readable at 24px for
   formatted TZS amounts. container-type:inline-size makes .stat-value's
   cqw-based clamp track this card's own width rather than the viewport,
   so the font shrinks as the grid narrows instead of truncating. */
.stat-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  padding: 16px 18px !important;
  position: relative !important;
  overflow: visible !important;
  box-shadow: 0 2px 8px var(--shadow-card) !important;
  transition: border-color .2s ease !important;
  container-type: inline-size !important;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(252,225,1,.12), transparent);
  pointer-events: none;
}
.stat-card:hover { border-color: var(--border2) !important; transform: none !important; box-shadow: 0 2px 8px var(--shadow-card) !important; }
.stat-label { font-size: 11.5px !important; font-weight: 700 !important; letter-spacing: .8px !important; text-transform: uppercase !important; color: var(--text3) !important; margin-bottom: 6px !important; font-family: 'DM Sans', sans-serif !important; display: block !important; }
/* font-size intentionally NOT !important: the KPI Fit-Text Engine
   (nest-documents.js, KPI_SELECTORS) writes a plain inline font-size
   after measuring actual content width, and per-screen inline overrides
   (dense grids, alert emphasis) must win over this default too. This
   clamp() is only the no-override/no-JS-yet fallback ceiling. */
.stat-value { font-family: 'DM Sans', sans-serif !important; font-size: clamp(14px, 10cqw, 20px); font-weight: 700 !important; color: var(--text); letter-spacing: -0.4px !important; line-height: 1.2 !important; overflow: visible !important; display: block !important; margin-top: 2px !important; word-break: break-word !important; overflow-wrap: anywhere !important; }

/* == 10. BUTTONS =====================================================
   Hierarchy: primary (yellow) > secondary (surface) > danger (red).
   scale(.98) on :active gives a physical press feel.
   btn-file-loaded: amber tint signals a file has been selected.
   ==================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 8px);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background var(--transition-base), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1), border-color var(--transition-base);
  border: 1.5px solid transparent;
  letter-spacing: .2px;
  font-family: 'DM Sans', sans-serif;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }  /* Physical press feel */
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Primary: authentic construction yellow + crisp ink border + tactile architectural elevation */
.btn-primary {
  background: #fce101 !important;
  color: #090b09 !important;
  border: 1.5px solid #090b09 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  padding: 10px 22px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  min-height: 42px !important;
  border-radius: var(--radius-pill) !important;
  letter-spacing: .25px;
  line-height: 1.2;
}
.btn-primary:hover {
  background: #faea46 !important;
  box-shadow: 0 4px 0 #090b09;
  transform: translateY(-1px);
}
.btn-primary:active {
  box-shadow: 0 1px 0 #090b09;
  transform: translateY(1px) scale(.98);
}

/* Floating Back to Top Button */
#backToTopBtn {
  background: #fce101 !important;
  color: #090b09 !important;
  border: 1.5px solid #090b09 !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25) !important;
  transition: opacity .3s ease, transform .15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow .15s ease, background .15s ease !important;
}
#backToTopBtn:hover {
  background: #faea46 !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 0 #090b09, 0 8px 24px rgba(0,0,0,0.25) !important;
}

/* Secondary: surface fill + border + tactile elevation */
.btn-secondary {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border2);
}
.btn-secondary:hover {
  background: var(--surface4);
  border-color: var(--border-strong);
  box-shadow: 0 3px 0 var(--border-strong);
}
.btn-secondary:active {
  box-shadow: 0 1px 0 var(--border-strong);
}

/* File-loaded: amber tint — signals file selected, ready to import */
.btn-file-loaded {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
  box-shadow: none;
}
.btn-file-loaded:hover {
  background: rgba(251,191,36,0.22);
  border-color: var(--warning);
  box-shadow: 0 3px 0 var(--warning);
}
.btn-file-loaded:active {
  box-shadow: 0 1px 0 var(--warning);
}

/* Force hidden compatibility */
.btn.j360-btn-force-hidden      { display: none !important; }
#eotGenerateBtn.j360-btn-force-hidden { display: none !important; }

/* Danger: fills on hover for emphasis */
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover {
  background: rgba(248,113,113,0.22);
  border-color: var(--danger);
  box-shadow: 0 3px 0 var(--danger);
}
.btn-danger:active {
  box-shadow: 0 1px 0 var(--danger);
}

/* Warning: amber accent tint */
.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.btn-warning:hover {
  background: rgba(251,191,36,0.22);
  border-color: var(--warning);
  box-shadow: 0 3px 0 var(--warning);
}
.btn-warning:active {
  box-shadow: 0 1px 0 var(--warning);
}

/* Success: green accent tint */
.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.btn-success:hover {
  background: rgba(16,185,129,0.22);
  border-color: var(--success);
  box-shadow: 0 3px 0 var(--success);
}
.btn-success:active {
  box-shadow: 0 1px 0 var(--success);
}

/* Solid green button (a "take this / generate" decision). --accent2 is a light mint in the dark theme, where white text on it cannot be read, and a deep green in the light
   theme, where dark text cannot: so the text colour follows the theme. Never hard-code white on --accent2. Guard: tests/test-review-estimate-breakdown.js. */
.j360-solid-green,
.j360-btn.j360-solid-green {
  background: var(--accent2);
  color: #0b1d12;
  border: 1px solid transparent;
  font-weight: 600;
}
.j360-solid-green:hover:not(:disabled),
.j360-btn.j360-solid-green:hover:not(:disabled) {
  background: var(--accent2);
  color: #0b1d12;
  filter: brightness(1.08);
}
[data-theme='light'] .j360-solid-green,
[data-theme='light'] .j360-btn.j360-solid-green,
[data-theme='light'] .j360-solid-green:hover:not(:disabled),
[data-theme='light'] .j360-btn.j360-solid-green:hover:not(:disabled) {
  color: #fff;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 11px;
  border-radius: var(--radius-pill);
}
.btn-lg {
  padding: 12px 24px;
  font-size: 14px;
  border-radius: var(--radius-pill);
}

/* == STICKY REGISTER HEADERS ==========================================
   A register can run to hundreds of rows — 495 materials, 536 recipes —
   and once the column headings scroll away the figures lose their
   meaning: six unlabelled money columns on the national price book are
   unreadable. The headings stay put instead.

   WHY THE TABLE SCROLLS RATHER THAN THE PAGE. position:sticky resolves
   against the nearest SCROLL CONTAINER, and .register-card sets
   overflow:hidden (for its rounded corners), which makes the card itself
   one. The header therefore pinned to the top of a card that scrolls
   away with the page, which is no help at all. Measured in Chromium:
   after scrolling .main by 600px the th sat at y=-123, off screen.
   Neither overflow:clip on the card, nor border-collapse:separate, nor
   dropping .table-wrap's transform, nor relaxing .panel's containment
   moved that number — all four were tried and all four left it at -123.

   Giving .table-wrap its own height makes IT the scroll container, and
   the header pins to the top of the rows it labels. Verified: the th
   holds position while the rows scroll beneath it.

   WHY AN EXPLICIT BACKGROUND IS NOT OPTIONAL: a sticky cell is lifted
   out of flow, so a transparent th lets rows scroll visibly underneath.
   th already resolves to --surface2 below; it is restated here because
   this rule is what makes the bleed-through possible, and the two must
   not drift apart.

   z-index 2 — above the rows, far below the modal tier, so a sticky
   header can never rise over an overlay. */
.register-card .table-wrap {
  max-height: 62vh;
  overflow-y: auto;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface2);
}

/* A second header row (grouped columns) pins under the first. */
.table-wrap thead tr:nth-child(2) th { top: 32px; }

/* Print has no scroll container, and a sticky cell can repeat or clip in
   a paged context. */
@media print {
  .register-card .table-wrap { max-height: none; overflow: visible; }
  .table-wrap thead th { position: static; }
}

/* == 11. TABLES ======================================================
   High-density enterprise data grid for construction operators.
   th: 10.5px DM Mono, uppercase, anchored on surface2.
   td: --text primary colour for crisp legibility of financial numbers.
   Hover row: subtle surface4 highlight. */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { padding: 8px 12px; font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--text3); border-bottom: 1px solid var(--border); text-align: left; font-family: 'DM Mono', monospace; background: var(--surface2); }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface4); }  /* Enterprise surface hover */
/* Gantt sticky label column must stay opaque on hover — prevents scrolled content bleeding through */
#wpGanttTable tr:hover td:first-child { background: var(--surface2) !important; }
/* Gantt sticky corner header (Task/Work Section) must stay opaque at all times —
   the global `th { background: transparent !important; }` rule above defeats the
   inline background set in work-programme.js, so once the timeline is scrolled
   horizontally, the week columns scrolled underneath show/bleed through the
   corner label instead of being hidden behind it (the same class of bug the
   td:first-child rule above already fixes for hover, just never applied to
   the header row itself). */
#wpGanttTable thead th:first-child { background: var(--surface2) !important; }
/* Same global `th { padding: 10px 14px !important; }` rule ALSO defeats this cell's inline
   padding:0 (2026-07-29) — the corner header renders ~16px wider than its own sub-column
   content (the flex row of #/Activity/Start/.../Pred/Baseline cells + the drag-resize
   handle), since those are unaffected (they're plain divs, not <th>s) but the <th> itself
   picks up the forced padding on top of its own width:${LABEL_W}px. Visually this makes
   the sticky accent border (drawn on this same <th>) sit noticeably right of the actual
   resize handle it's supposed to align with — confirmed by measuring both in a live
   render (handle center and content-column right edge matched exactly; only the <th>
   itself was off, by exactly the forced padding). */
#wpGanttTable thead th:first-child { padding: 0 !important; }
/* Same leak, the `td` version: the global `td { padding: 10px 14px !important; }` rule
   defeats .wp-task-left-td's inline padding:0 too, shifting that row's inner content
   (and its LABEL_W-anchored accent-border overlay, see work-programme.js) 14px right of
   where the header's matching overlay and the drag handle sit — confirmed by measuring
   all three in a live render (header overlay + handle matched at LABEL_W exactly; the
   row overlay was off by exactly the forced left padding, 14px). */
#wpGanttTable .wp-task-left-td { padding: 0 !important; }

/* == 12. FORM INPUTS =================================================
   background: surface2 (lighter than Block 1's surface3).
   border: border2 (brighter default visibility on deeper design-v2 surfaces).
   Focus: 3px glow ring (vs 2px in Block 1) — more visible. */
input[type="text"], input[type="number"], input[type="password"],
input[type="date"], input[type="email"], input[type="search"],
textarea, select {
  background: var(--surface2) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 8px !important;
  color: var(--text) !important;
  font-size: 12.5px !important;
  padding: 8px 12px !important;
  transition: border-color .15s, box-shadow .15s !important;
  font-family: 'DM Sans', sans-serif !important;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(252,225,1,.08) !important;  /* 3px glow ring */
  outline: none !important;
}
input.j360-input-invalid, select.j360-input-invalid, textarea.j360-input-invalid,
.j360-input-invalid {
  border-color: var(--danger, #f06060) !important;
}
input.j360-input-invalid:focus, select.j360-input-invalid:focus, textarea.j360-input-invalid:focus,
.j360-input-invalid:focus {
  border-color: var(--danger, #f06060) !important;
  box-shadow: 0 0 0 3px rgba(240, 96, 96, 0.18) !important;
}
/* Search & filter controls — override the padding !important above with higher specificity */
.search-wrap input[type="text"],.search-wrap input[type="search"]{padding:var(--ctrl-pad-y) var(--ctrl-pad-r) var(--ctrl-pad-y) var(--ctrl-text-indent) !important;font-size:var(--ctrl-font-size) !important;}
.filter-wrap select{padding:var(--ctrl-pad-y) var(--ctrl-select-pad-r) var(--ctrl-pad-y) var(--ctrl-text-indent) !important;font-size:var(--ctrl-font-size) !important;appearance:none !important;-webkit-appearance:none !important;}

/* Unified Javenzi Dropdowns (Phases 1-3 — Company Settings, Contractor Modals, Panels, Dynamic Modules & Portal):
   Progressively themes both trigger and open picker list in Javenzi tokens via CSS base-select
   while preserving native keyboard/a11y/mobile fallback on older browsers and excluding [multiple]/[size] listboxes. */
@supports (appearance: base-select) {
  select:not([multiple]):not([size]),
  select:not([multiple]):not([size])::picker(select) {
    appearance: base-select !important;
  }
  select:not([multiple]):not([size]) {
    align-items: center;
  }
  select:not([multiple]):not([size])::picker(select) {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border2);
    border-radius: 10px;
    padding: 4px;
    box-shadow: 0 12px 32px var(--shadow-modal);
    margin-top: 4px;
    min-inline-size: anchor-size(width);
    inline-size: max-content;
    max-inline-size: min(460px, 90vw);
  }
  select:not([multiple]):not([size])::picker-icon {
    color: var(--text2);
    flex-shrink: 0;
    transition: transform .16s ease;
  }
  select:not([multiple]):not([size]):open::picker-icon {
    transform: rotate(180deg);
  }
  .filter-wrap select::picker-icon {
    display: none;
  }
  select:not([multiple]):not([size]) option {
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12.5px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    background: transparent;
    cursor: pointer;
  }
  select:not([multiple]):not([size]) option:hover,
  select:not([multiple]):not([size]) option:focus-visible {
    background: var(--surface3);
  }
  select:not([multiple]):not([size]) option:checked {
    background: var(--accent-glow2);
    color: var(--text);
    font-weight: 700;
  }
  select:not([multiple]):not([size]) option::checkmark {
    color: var(--accent-text, var(--text));
  }
  select:not([multiple]):not([size]) optgroup {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text2);
    padding: 6px 8px 2px;
  }
}

/* == 13. MODALS ======================================================
   Canonical modal rules -- formerly split across two merged stylesheet
   "blocks" (one plain, one !important) that redeclared these same
   selectors with drifted values; consolidated 2026-08 into one rule per
   selector so there's a single place to edit modal chrome going forward.
   backdrop-filter:blur(8px) blurs the app behind the modal.
   modal-box: deep shadow + accent-glow ring (subtle brand presence).
   Flex-column modals need overflow:hidden on box — inner body scrolls.
   modal-title: DM Sans 14px (not Bebas Neue) — cleaner for long titles. */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden !important;
  overscroll-behavior: contain;
  padding: 20px;
  background: var(--overlay) !important;
  backdrop-filter: blur(6px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
  z-index: 9999 !important;
}
.modal-overlay.open { display: flex !important; }
.modal-box {
  width: 700px;
  max-width: 95vw;
  padding: 28px;
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 80px var(--shadow-modal), 0 0 0 1px var(--accent-glow) !important;
  max-height: 92vh !important;
  overflow-y: auto !important;
  scrollbar-width: thin !important;
  scrollbar-color: var(--surface3) transparent !important;
}
/* .modal-close — close-icon button used by a couple of modals that never
   had real styling of their own (bare .material-symbols-outlined with no
   hit-area/hover). Modeled on .settings-modal-close, the one close button
   in the app that already had proper hover chrome. */
.modal-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text2);
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--surface3); color: var(--text); }
/* Modal-box size tokens -- pick one instead of inventing a new inline px
   value (2026-08 audit found 19 distinct ad hoc widths across 38 modals).
   sm/md/lg/2xl set width only; max-width:95vw from the base .modal-box rule
   above still applies for mobile safety. .modal-xl is different in kind --
   NOT a width, it's the flex-column/full-bleed "wizard" structural
   treatment (BOQ Import, VO, PC, Project Payment). Those modals keep their
   own width/max-height inline since a column-mapping table legitimately
   needs more room than a payment form; .modal-xl only supplies the shared
   layout mechanics they all need. */
.modal-sm  { width: 480px; }
.modal-md  { width: 600px; }
.modal-lg  { width: 760px; }
.modal-2xl { width: 900px; }
.modal-xl  { display: flex; flex-direction: column; overflow: hidden; }
/* Flex-column modals (import wizard, formula editor): overflow:hidden on box;
   inner body div handles scroll. Prevents double scrollbars. */
.modal-box[style*="flex-direction:column"],
.modal-box.modal-xl,
.modal-box[style*="flex-direction: column"] { overflow: hidden !important; }
/* These modals' title bar is a fixed header sized by its own inline
   padding/border (flush against the scrolling body below), not the roomy
   title+margin-bottom look regular modals use. The unscoped .modal-title
   rule below still forces margin-bottom:20px onto it via !important, which
   the header's inline margin:0 can never win against -- that's the ~20px
   dead gap between the header and the first field. */
.modal-box[style*="flex-direction:column"] .modal-title,
.modal-box[style*="flex-direction: column"] .modal-title,
.modal-box.modal-xl .modal-title {
  margin-bottom: 0 !important;
  padding-bottom: 14px !important;
}
/* .modal-footer was used as a Cancel + confirm action bar in three modals
   (Purchase Order, Supplier, Tax Invoice) but had no rule anywhere, so the
   buttons simply flowed left against the modal edge. Right-aligned with a
   separator, matching the action rows every other modal builds inline. */
.modal-footer {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
  margin-top: 20px !important;
  padding-top: 16px !important;
  border-top: 1px solid var(--border) !important;
}
.modal-title {
  font-size: 14px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: var(--surface) !important;
  font-family: 'DM Sans', sans-serif !important;
  letter-spacing: 0 !important;
  padding-bottom: 16px !important;
  margin-bottom: 20px !important;
  border-bottom: 1px solid var(--border) !important;
}

/* == Slide-Over Drawer Component ========================================== */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px) saturate(140%);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  z-index: 9999;
  justify-content: flex-end;
  padding: 0;
  transition: opacity 0.2s ease;
}
.drawer-overlay.open,
.drawer-overlay[style*="display: flex"] {
  display: flex !important;
}
.drawer-sheet {
  width: 620px;
  max-width: 92vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 36px rgba(0, 0, 0, 0.45);
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* == Universal sticky header/footer for all modals with a .modal-footer ===
   Any .modal-box containing a .modal-footer automatically gets the
   flex-column layout so the title stays pinned at top and the footer
   stays pinned at bottom, with only the .modal-body scrolling.
   This is the same pattern the Tender Modal (modal-xl) uses manually;
   :has() generalises it to every modal without touching each one's HTML
   class list. Requires Chrome 105+/Safari 15.4+/Firefox 121+. */
.modal-box:has(.modal-footer) {
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.modal-box:has(.modal-footer) > .modal-title {
  flex-shrink: 0 !important;
  margin-bottom: 0 !important;
  padding-bottom: 14px !important;
}
.modal-box:has(.modal-footer) > .modal-footer {
  flex-shrink: 0 !important;
  margin-top: 0 !important;
  padding: 16px 24px !important;
}
/* .modal-body — scrollable middle section between pinned title & footer.
   Wraps everything that should scroll. flex:1 + min-height:0 are both
   required for the flex child to actually constrain its height and scroll
   instead of stretching the parent past max-height. */
.modal-body {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  padding: 20px 24px !important;
  min-height: 0 !important;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}

/* ==========================================================================
   PHASE 1: UNIFIED JAVENZI MODAL DESIGN SYSTEM
   Standardized 3-tier architecture (pinned header, scrollable body, pinned footer),
   consistent 2-tier context headers, top document upload banners, and backdrop controls.
   ========================================================================== */
.j360-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay) !important;
  backdrop-filter: blur(6px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
  z-index: 9999 !important;
  align-items: center;
  justify-content: center;
  overflow: hidden !important;
  overscroll-behavior: contain;
  padding: 16px;
  box-sizing: border-box;
}
.j360-modal-overlay.open,
.j360-modal-overlay.active,
.j360-modal-overlay[style*="display: flex"] {
  display: flex !important;
}

.j360-modal-box,
.j360-modal-container {
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 18px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--accent-glow) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  max-height: 92vh !important;
  width: 100%;
  padding: 20px 22px !important;
  gap: 14px !important;
  animation: j360ModalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

@keyframes j360ModalIn {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Standard Modal Sizes */
.j360-modal-box.modal-sm, .j360-modal-container.modal-sm { max-width: 480px; }
.j360-modal-box.modal-md, .j360-modal-container.modal-md { max-width: 640px; }
.j360-modal-box.modal-lg, .j360-modal-container.modal-lg { max-width: 780px; }
.j360-modal-box.modal-xl, .j360-modal-container.modal-xl { max-width: 1080px; }
.j360-modal-box.modal-full, .j360-modal-container.modal-full { max-width: 95vw; height: 92vh; }

/* 1. Inset Rectangular Colored Capsule Header */
.j360-modal-header {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  padding: 12px 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-shrink: 0 !important;
  gap: 12px;
  box-sizing: border-box;
  width: 100% !important;
}
.j360-modal-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.j360-modal-icon {
  width: 36px !important;
  height: 36px !important;
  border-radius: 10px !important;
  background: var(--accent) !important;
  border: 1.5px solid var(--border-strong, #090b09) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #090b09 !important;
  flex-shrink: 0 !important;
  box-shadow: 0 0 0 1px rgba(252,225,1,.2), 0 2px 8px rgba(0,0,0,.08) !important;
}
.j360-modal-icon .material-symbols-outlined,
.j360-modal-icon .j360-icon,
.j360-modal-icon svg {
  color: #090b09 !important;
  font-size: 20px !important;
}
.j360-modal-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  margin: 0 !important;
  line-height: 1.3 !important;
  letter-spacing: 0 !important;
  font-family: 'DM Sans', sans-serif !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}
.j360-modal-subtitle {
  font-size: 11.5px !important;
  color: var(--text2) !important;
  margin: 2px 0 0 0 !important;
  line-height: 1.3 !important;
  font-weight: 400 !important;
}
.j360-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.j360-modal-close:hover {
  background: var(--surface3);
  color: var(--text);
}

/* 2. Scrollable Body (Indented inside Header and Footer capsules with extra left/right padding) */
.j360-modal-body {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  padding: 6px 18px !important;
  min-height: 0 !important;
  display: block !important;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
  box-sizing: border-box;
}
.j360-modal-body > * {
  box-sizing: border-box;
}

/* 3. Top Supporting Document / Proof Banner */
.j360-modal-doc-banner {
  background: rgba(42, 122, 79, 0.06);
  border: 1px dashed rgba(42, 122, 79, 0.32);
  border-radius: 10px;
  padding: 13px 16px;
  box-sizing: border-box;
}
#trmSuggestionPanel {
  margin-top: 10px !important;
  margin-bottom: 0 !important;
}
.j360-modal-doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.j360-modal-doc-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.j360-modal-doc-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
}
.j360-modal-doc-sub {
  font-size: 11px;
  color: var(--text2);
}
.j360-modal-doc-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11.5px;
}
.j360-modal-doc-name {
  flex: 1;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 4. Inset Rectangular Colored Capsule Footer (Straight edges, NO curved corners) */
.j360-modal-footer {
  padding: 12px 18px !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  background: var(--surface2) !important;
  flex-shrink: 0 !important;
  margin-top: auto !important;
  box-sizing: border-box;
  width: 100% !important;
}
.j360-modal-footer-meta {
  margin-right: auto;
  font-size: 11.5px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.j360-modal-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* == MODAL STEP BARS & WIZARDS == */
.modal-step-bar, #boqStepBar {
  display: flex !important;
  gap: 0 !important;
  padding: 0 var(--space-6) !important;
  background: var(--surface2) !important;
  border-bottom: 1px solid var(--border) !important;
  flex-shrink: 0 !important;
}

.modal-step, .boq-step {
  padding: 10px 18px 8px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--text3) !important;
  border-bottom: 2px solid transparent !important;
  cursor: pointer !important;
  text-transform: uppercase !important;
  letter-spacing: 0.8px !important;
  transition: color var(--transition-base), border-color var(--transition-base) !important;
}

.modal-step:hover, .boq-step:hover {
  color: var(--text2) !important;
}

.modal-step.active, .modal-step-active, .boq-step.boq-step-active {
  color: var(--text) !important;
  border-bottom: 3px solid var(--accent) !important;
  font-weight: 700 !important;
}

/* Upload Dropzones */
.upload-dropzone {
  text-align: center;
  padding: 36px 20px;
  border-radius: var(--radius-md);
  transition: background var(--transition-base), border-color var(--transition-base);
}

.upload-dropzone-icon {
  width: 64px;
  height: 64px;
  background: var(--surface2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--accent);
  transition: border-color var(--transition-base);
}

.upload-dropzone:hover .upload-dropzone-icon {
  border-color: var(--accent);
}

/* == 14. TOAST NOTIFICATIONS =========================================
   backdrop-filter:blur(6px) — frosted glass feel.
   toastIn: slides up + scales in (vs Block 1's slide-from-right).
   border2 for better visibility against blurred surface behind.
   z-index:10001 — must stay above the z-index:10000 Correspondence
   compose/log modals (correspondence.js) so upload-progress/error toasts
   stay visible while those modals are still open. */
/* NOTE: this duplicates the .toast-container rule earlier in this file and,
   being !important, is the one that actually wins. Both now point at the
   same token so they cannot disagree about stacking again -- the earlier
   rule silently losing is why toasts stayed buried at 10001 even after the
   layer scale landed. */
.toast-container { position: fixed !important; bottom: 24px !important; right: 24px !important; z-index: var(--z-toast) !important; display: flex !important; flex-direction: column !important; gap: 8px !important; }
.toast {
  background: var(--surface3) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  font-size: 12.5px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.5) !important;
  backdrop-filter: blur(6px) !important;
  max-width: 340px !important;
  animation: toastIn .2s ease !important;
}
/* Slides up + scales in from slightly below (vs Block 1's slide from right) */
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.success { border-left: 3px solid var(--accent) !important; }
.toast.error   { border-left: 3px solid var(--danger) !important; }
.toast.warning { border-left: 3px solid var(--accent3) !important; }
.toast.info    { border-left: 3px solid var(--info) !important; }

/* == 15. PROJECT & TENDER CARDS ======================================
   Lift-on-hover. overflow:hidden clips any decorative pseudo-elements. */
.project-card, .tender-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  padding: 18px 20px !important;
  transition: border-color .2s, box-shadow .2s, transform .2s !important;
  position: relative !important;
  overflow: hidden !important;
}
.project-card:hover, .tender-card:hover { border-color: var(--border2) !important; box-shadow: 0 4px 24px rgba(0,0,0,.3) !important; transform: translateY(-2px) !important; }
.project-status-badge { font-size: 11px !important; font-weight: 700 !important; letter-spacing: .5px !important; text-transform: uppercase !important; padding: 3px 9px !important; border-radius: 20px !important; font-family: 'DM Sans', sans-serif !important; }
.ps-active    { background: var(--accent) !important; color: #090b09 !important; border: 1px solid rgba(0,0,0,.15) !important; font-weight: 700 !important; }
.ps-completed { background: rgba(126,200,160,.1) !important; color: var(--accent2) !important; border: 1px solid rgba(126,200,160,.2) !important; }
.ps-waiting   { background: rgba(240,192,96,.1) !important;  color: var(--accent3) !important; border: 1px solid rgba(240,192,96,.2) !important; }
.ps-suspended { background: rgba(240,96,96,.1) !important;   color: var(--danger) !important;  border: 1px solid rgba(240,96,96,.2) !important; }
.ps-delayed   { background: rgba(240,96,96,.1) !important;   color: var(--danger) !important;  border: 1px solid rgba(240,96,96,.2) !important; }
.ps-terminated { background: rgba(148,148,163,.12) !important; color: var(--text3) !important; border: 1px solid rgba(148,148,163,.25) !important; }

/* == 16. CHART STYLING ===============================================
   Chart.js colours/grid/fonts set in setChartDefaults() in main JS.
   CSS only handles container rounding. */
.dash-chart-body canvas { border-radius: 4px !important; }

/* == 17. SCROLLBARS ==================================================
   Slim 4px. Transparent track, surface3 thumb.
   Also removes number input spinners app-wide (sliders preferred). */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface4); }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
input[type=number] { -moz-appearance:textfield; appearance:textfield; }

/* == 18. BADGES & CHIPS ==============================================
   Unified semantic badge and status chip tokens across Javenzi.
   WCAG AAA calibrated: subtle tinted background, crisp border, high-contrast text. */
.badge, .chip, .u-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: .2px;
  font-family: 'DM Sans', sans-serif;
  border: 1px solid transparent;
  white-space: nowrap;
}

.u-badge-green, .badge-success, .status-healthy {
  background: var(--success-bg) !important;
  color: var(--success-text) !important;
  border-color: var(--success-border) !important;
}

.u-badge-amber, .badge-warning, .status-warning, .status-caution {
  background: var(--warning-bg) !important;
  color: var(--warning-text) !important;
  border-color: var(--warning-border) !important;
}

.u-badge-red, .badge-danger, .status-critical, .status-unmatched {
  background: var(--danger-bg) !important;
  color: var(--danger-text) !important;
  border-color: var(--danger-border) !important;
}

.u-badge-info, .badge-info, .status-info {
  background: var(--info-bg) !important;
  color: var(--info-text) !important;
  border-color: var(--info-border) !important;
}

.u-badge-accent, .badge-accent {
  background: var(--accent-glow2) !important;
  color: var(--accent) !important;
  border-color: rgba(252,225,1,0.3) !important;
}

.u-badge-muted, .badge-neutral {
  background: var(--surface3) !important;
  color: var(--text2) !important;
  border-color: var(--border) !important;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.role-admin      { background: var(--danger-bg);  color: var(--danger-text);  border: 1px solid var(--danger-border); }
.role-qs         { background: var(--accent-glow2); color: var(--accent);       border: 1px solid rgba(252,225,1,0.3); }
.role-accountant { background: var(--info-bg);    color: var(--info-text);    border: 1px solid var(--info-border); }
.role-viewer     { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }

/* == 19. PROGRESS BARS ===============================================
   Fill gradient: green -> yellow (left to right) — "completion energy".
   Transitions on width create smooth animated fill on page load. */
.timeline-bar-wrap { background: var(--surface3) !important; border-radius: 4px !important; overflow: hidden !important; height: 5px !important; }
.timeline-bar-fill { height: 100% !important; border-radius: 4px !important; background: linear-gradient(90deg, var(--accent2), var(--accent)) !important; transition: width .4s ease !important; }

/* == 20. MINI KPI (inside cards) =====================================
   Compact metric tile for project detail panels and financial sections.
   ::before shimmer consistent with stat-card. container-type:inline-size
   makes .mini-kpi-value's cqw-based clamp (Section 26) track this tile's
   own rendered width -- not the viewport -- so amounts shrink as the
   grid column narrows (6-up KPI row, mobile stacking, etc). nowrap is
   intentionally NOT set: overflow-wrap:anywhere is the last-resort net
   for the rare value the clamp floor still can't fit on one line. */
.mini-kpi {
  background: var(--surface2) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  position: relative !important;
  overflow: hidden !important;
  transition: border-color .2s !important;
  container-type: inline-size !important;
}
.mini-kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(252,225,1,.08), transparent);
  pointer-events: none;
}
.mini-kpi-label { font-size: 11px !important; font-weight: 700 !important; letter-spacing: .6px !important; text-transform: uppercase !important; color: var(--text3) !important; font-family: 'DM Sans', sans-serif !important; }
/* font-size intentionally NOT !important -- see .stat-value above; the
   KPI Fit-Text Engine and any per-tile inline override must win. Ceiling
   raised 18->22px: the engine now shrinks long values on a per-value
   basis, so short/typical amounts can render larger by default. */
.mini-kpi-value { font-family: 'DM Sans', sans-serif !important; font-size: clamp(12px, 11cqw, 22px); font-weight: 700 !important; color: var(--text) !important; letter-spacing: -0.3px !important; line-height: 1.2 !important; margin-top: 2px !important; overflow: visible !important; display: block !important; word-break: break-word !important; overflow-wrap: anywhere !important; }

/* == 22. COMPACT PROJECT GRID ========================================
   2-column grid replacing the single-column tall card layout.
   Each proj-card-compact is ~220px tall, showing the critical KPIs
   at a glance. Full detail is always one click away via openProjectDetail(). */
.proj-group-section { margin-bottom: 20px; }
.proj-group-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; margin-bottom: 10px; user-select: none;
  transition: background .15s, border-color .15s;
}
.proj-group-hdr:hover { background: var(--surface3); border-color: var(--border2); }
.pgh-left { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.pgh-left strong { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; }
.pgh-badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 12px; flex-shrink: 0; }
.pgh-agg { font-size: 11px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.pgh-chevron { font-size: 18px; color: var(--text3); flex-shrink: 0; transition: transform .2s; }

.proj-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 4px;
}
.proj-card-compact {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
}
.proj-card-compact:hover {
  border-color: var(--accent); box-shadow: 0 4px 20px rgba(0,0,0,.25);
  transform: translateY(-2px);
}
.pcg-top { padding: 14px 14px 10px; flex: 1; }
.pcg-name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.pcg-name {
  font-weight: 700; font-size: 13px; line-height: 1.35; color: var(--text); flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pcg-view-icon { font-size: 14px !important; color: var(--text3); flex-shrink: 0; margin-top: 2px; opacity: .6; }
.proj-card-compact:hover .pcg-view-icon { opacity: 1; color: var(--accent); }
.pcg-sub { font-size: 11px; color: var(--text2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcg-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.pcg-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; padding: 0 14px 10px; }
.pcg-kpi { background: var(--surface2); border-radius: 7px; padding: 7px 9px; border: 1px solid var(--border); }
.pcg-kpi-label { font-size: 9px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text3); }
.pcg-kpi-val { font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcg-progress { margin: 0 14px 10px; }
.pcg-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px 12px; gap: 8px;
  border-top: 1px solid var(--border); margin-top: auto;
}
.pcg-days { font-size: 11px; font-weight: 600; white-space: nowrap; }
.pcg-actions { display: flex; gap: 4px; flex-shrink: 0; }

@media (max-width: 900px) {
  .proj-grid { grid-template-columns: 1fr; }
  .pgh-agg { display: none; }
}

/* == 21. ACTIVITY FEED ITEMS =========================================
   .notif-item: simpler list variant for dashboard notifications panel.
   .notif-dot: tiny (6px) but its yellow box-shadow glow makes it feel
   like a live indicator light — signals unread/new item. */
.notif-item { display: flex !important; align-items: flex-start !important; gap: 10px !important; padding: 10px 0 !important; border-bottom: 1px solid var(--border) !important; }
.notif-item:last-child { border-bottom: none !important; }
.notif-dot { width: 6px !important; height: 6px !important; border-radius: 50% !important; background: var(--accent) !important; margin-top: 5px !important; flex-shrink: 0 !important; box-shadow: 0 0 6px var(--accent) !important; }
.notif-text { font-size: 12px !important; color: var(--text2) !important; line-height: 1.5 !important; }
.notif-time { font-size: 11px !important; color: var(--text3) !important; font-family: 'DM Sans', sans-serif !important; white-space: nowrap !important; }

/* == 22. SECTION DIVIDERS & SPACING =================================
   Tighter gaps than Block 1: 20px->18px panels, 12px->10px stats strip. */
.panel { gap: 18px !important; }
.stats-strip { gap: 10px !important; }

/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   SETTINGS MODAL
   Two-column layout: 188px left nav + scrollable right content pane.
   Non-admin mode: nav hidden, content full-width (via .non-admin-mode).
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

/* Hide admin-only content for non-admin users while keeping personal navigation (Profile, Notifications, Security) accessible */
.settings-modal-box.non-admin-mode .admin-only-section { display: none !important; }

/* Outer box: flex column so header + body stack */
.settings-modal-box {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  width: 860px !important;
  max-width: 96vw !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;       /* Inner panes handle their own scroll   */
  box-shadow: 0 24px 64px rgba(0,0,0,.6) !important;
}

/* Header: icon + title/sub on left, close button on right */
.settings-modal-header {
  background: var(--surface2) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 24px !important;
  flex-shrink: 0 !important;
}
.settings-modal-title-wrap { display: flex !important; align-items: center !important; gap: 14px !important; }
/* Yellow icon square with glow ring */
.settings-modal-icon { width: 38px !important; height: 38px !important; background: var(--accent) !important; border: 1.5px solid var(--border-strong, #090b09) !important; border-radius: 10px !important; display: flex !important; align-items: center !important; justify-content: center !important; flex-shrink: 0 !important; box-shadow: 0 0 0 1px rgba(252,225,1,.2), 0 4px 12px rgba(252,225,1,.12) !important; }
.settings-modal-title { font-size: 16px !important; font-weight: 700 !important; color: var(--text) !important; letter-spacing: .2px !important; }
.settings-modal-sub { font-size: 12.5px !important; color: var(--text3) !important; margin-top: 2px !important; font-family: 'DM Sans', sans-serif !important; letter-spacing: .1px !important; }
.settings-modal-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
}
.settings-header-status {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(126,200,160,.32);
  background: rgba(126,200,160,.11);
  color: var(--accent2);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .2px;
}
.settings-modal-close { width: 32px !important; height: 32px !important; background: var(--surface2) !important; border: 1px solid var(--border) !important; border-radius: 8px !important; display: flex !important; align-items: center !important; justify-content: center !important; cursor: pointer !important; color: var(--text2) !important; transition: background .15s, color .15s !important; flex-shrink: 0 !important; }
.settings-modal-close:hover { background: var(--surface3) !important; color: var(--text) !important; }
.settings-modal-close .material-symbols-outlined { font-size: 18px !important; }

/* Shared persistent modal footer for Company Settings */
.settings-modal-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 13px 24px !important;
  background: var(--surface2) !important;
  border-top: 1px solid var(--border) !important;
  flex-shrink: 0 !important;
}
.settings-modal-footer-hint {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  font-size: 12px !important;
  color: var(--text3) !important;
  min-width: 0 !important;
}
.settings-modal-footer-actions {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
}
.settings-modal-footer-actions .btn {
  min-width: 104px;
}

/* Two-column body: flex row */
.settings-modal-body { display: flex !important; flex: 1 !important; overflow: hidden !important; min-height: 0 !important; }

/* Left nav panel */
.settings-nav { width: 188px !important; flex-shrink: 0 !important; border-right: 1px solid var(--border) !important; background: var(--settings-nav-bg) !important; padding: 12px 8px !important; display: flex !important; flex-direction: column !important; gap: 2px !important; overflow-y: auto !important; overscroll-behavior: contain !important; }
/* Rounded nav items (unlike sidebar's full-bleed) */
.settings-nav-item { display: flex !important; align-items: center !important; gap: 9px !important; width: 100% !important; padding: 9px 12px !important; background: transparent !important; border: none !important; border-radius: 8px !important; cursor: pointer !important; color: var(--sb-text) !important; font-size: 12.5px !important; font-family: 'DM Sans', sans-serif !important; font-weight: 500 !important; text-align: left !important; transition: background .12s, color .12s !important; white-space: nowrap !important; }
.settings-nav-item .material-symbols-outlined { font-size: 16px !important; opacity: .7 !important; flex-shrink: 0 !important; }
.settings-nav-item:hover { background: var(--sb-hover) !important; color: var(--text) !important; }
.settings-nav-item.active { background: var(--sb-active-bg, rgba(0,0,0,0.04)) !important; color: var(--text) !important; font-weight: 700 !important; border-left: 3px solid var(--accent) !important; }
.settings-nav-item.active .material-symbols-outlined { opacity: 1 !important; color: var(--text) !important; }

/* Right content pane: scrolls independently */
.settings-content-pane { flex: 1 !important; overflow-y: auto !important; overscroll-behavior: contain !important; padding: 24px 28px !important; min-width: 0 !important; }

/* Sections: JS shows .active, hides rest */
.settings-section { display: none !important; }
.settings-section.active { display: block !important; }
.settings-section-title { display: flex !important; align-items: center !important; gap: 10px !important; font-size: 14px !important; font-weight: 700 !important; color: var(--text) !important; margin-bottom: 20px !important; padding-bottom: 12px !important; border-bottom: 1px solid var(--border) !important; }
.settings-section-title .material-symbols-outlined { font-size: 18px !important; color: var(--accent) !important; }

/* Config blocks inside settings — generous sizing */
.settings-content-pane .config-block { background: var(--surface2) !important; border: 1px solid var(--border) !important; border-radius: 12px !important; padding: 18px 20px !important; margin-bottom: 16px !important; }
.settings-content-pane label { font-size: 13px !important; color: var(--text2) !important; font-weight: 600 !important; letter-spacing: .3px !important; margin-bottom: 6px !important; display: block !important; }
.settings-content-pane label.doc-btn,
.settings-content-pane .doc-upload-label {
  display: inline-flex !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  margin-bottom: 0 !important;
  line-height: 1 !important;
  cursor: pointer !important;
}
.settings-content-pane label.doc-btn-sm,
.settings-content-pane .doc-upload-label.doc-btn-sm {
  font-size: 9.5px !important;
  height: 20px !important;
}
.settings-content-pane input[type="text"], .settings-content-pane input[type="email"], .settings-content-pane input[type="number"], .settings-content-pane input[type="password"], .settings-content-pane select { width: 100% !important; margin-bottom: 4px !important; }
/* Two-column grid for paired fields (e.g. TIN + VRN side by side) */
.settings-field-row { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px !important; }
/* Eliminate redundant duplicate sub-headers and duplicate inline footers inside the modal content pane (primary Edit / Save controls live in the shared modal footer) */
.settings-content-pane .sb-section-head,
.settings-content-pane .sidebar-section-title:not(#supportAccessTitle),
.settings-content-pane .sb-company-footer,
#ssec-profile #saveProfileBtn,
#ssec-orgchart > div:last-child {
  display: none !important;
}
.settings-content-pane .sb-locked-hint { display: none !important; }
.settings-content-pane .sb-company-status {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(126,200,160,.26);
  background: rgba(126,200,160,.09);
  color: var(--accent2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2px;
}
.settings-content-pane .sb-company-status .material-symbols-outlined { font-size: 14px; }
.settings-content-pane .sb-company-footer {
  display: none;
  position: sticky;
  bottom: -28px;
  margin: 20px -28px -28px;
  padding: 16px 28px 22px;
  background: rgba(18, 18, 14, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.3);
  z-index: 10;
}
[data-theme='light'] .settings-content-pane .sb-company-footer {
  background: rgba(255, 255, 255, 0.88);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.08);
}
.settings-content-pane .sb-company-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.settings-content-pane .sb-company-footer .btn { min-width: 118px; }

/* Settings button chevron hidden */
.sb-settings-chv { display: none !important; }

/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   SIDEBAR COLLAPSE SYSTEM
   JS toggles .sb-collapsed on .app-shell. Grid column transitions 260px->62px.
   Collapsed: text hidden, icons centred/larger, tooltips on hover.
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */

/* Hamburger/toggle button in topbar */
.topbar-menu-btn { display: flex !important; align-items: center !important; justify-content: center !important; width: 34px !important; height: 34px !important; background: transparent !important; border: 1px solid var(--sb-border) !important; border-radius: 8px !important; color: var(--text2) !important; cursor: pointer !important; transition: background .15s, color .15s, border-color .15s !important; flex-shrink: 0 !important; }
.topbar-menu-btn:hover { background: var(--surface2) !important; color: var(--text) !important; border-color: var(--border2) !important; }
.topbar-menu-btn .material-symbols-outlined { font-size: 19px !important; transition: transform .22s cubic-bezier(.4,0,.2,1) !important; }

/* Outer shell and sidebar collapse */
.app-shell.sb-collapsed { grid-template-columns: 62px minmax(0, 1fr) !important; }
.sb-collapsed .sidebar { width: 62px !important; }

/* Brand strip: centred, text hidden */
.sb-collapsed .sb-brand { justify-content: center !important; padding: 0 !important; height: 56px !important; }
.sb-collapsed .sb-brand-text { display: none !important; }
.sb-collapsed .sb-brand-icon { margin: 0 auto !important; }

/* Group labels hidden */
.sb-collapsed .sb-group-label { display: none !important; }

/* Nav items: centred, icon only */
.sb-collapsed .sb-nav-item { justify-content: center !important; padding: 10px 0 !important; position: relative !important; }
.sb-collapsed .sb-nav-label { display: none !important; }
/* Icons: 20px (larger than normal 18px since they're the only affordance).
   Uses theme-aware --sb-icon-opacity variable. Active always at 1. */
.sb-collapsed .sb-nav-icon { opacity: var(--sb-icon-opacity) !important; font-size: 20px !important; }
.sb-collapsed .sb-nav-item.active .sb-nav-icon { opacity: 1 !important; }
/* Active bar: 8px inset (vs 6px normal) for proportion in smaller space */
.sb-collapsed .sb-nav-item.active::before { top: 8px !important; bottom: 8px !important; }

/* Tighter group padding when collapsed */
.sb-collapsed .sb-group { padding: 2px 0 !important; }

/* User strip: avatar only */
.sb-collapsed .sb-user-strip { justify-content: center !important; padding: 8px 0 !important; margin: 0 4px 4px !important; background: transparent !important; border-color: transparent !important; }
.sb-collapsed .sb-user-info { display: none !important; }

/* Settings button: icon only */
.sb-collapsed .sb-settings-btn { justify-content: center !important; padding: 10px 0 !important; }
.sb-collapsed .sb-settings-btn .sb-nav-label { display: none !important; }

/* P&L sub-view: flex-direction only (display managed by switchFinView via JS) */
#finview-pl-content { flex-direction: column; gap: 16px; }

/* == 23. APPROVAL CHIP ===============================================
   Amber-tinted clickable chip in Dashboard for pending approvals. */
.j360-approval-chip { background: rgba(240,192,96,.08) !important; border: 1px solid rgba(240,192,96,.25) !important; border-radius: 10px !important; padding: 10px 14px !important; font-size: 11.5px !important; cursor: pointer !important; transition: background .15s !important; display: flex !important; align-items: center !important; gap: 8px !important; }
.j360-approval-chip:hover { background: rgba(240,192,96,.15) !important; }

/* == 24. ALERT BARS ==================================================
   Inline permanent banners (vs ephemeral toasts). Danger/warning/info. */
.dash-alert { border-radius: 10px !important; padding: 10px 14px !important; font-size: 12px !important; display: flex !important; align-items: center !important; gap: 10px !important; margin-bottom: 6px !important; }
.dash-alert-danger  { background: rgba(240,96,96,.08) !important;  border: 1px solid rgba(240,96,96,.2) !important;  color: var(--danger) !important; }
.dash-alert-warning { background: rgba(240,192,96,.08) !important; border: 1px solid rgba(240,192,96,.2) !important; color: var(--accent3) !important; }
.dash-alert-info    { background: rgba(96,184,240,.08) !important; border: 1px solid rgba(96,184,240,.2) !important; color: var(--info) !important; }

/* == 25. PAGE TRANSITIONS & ANIMATIONS ===============================
   panelIn: fades in + slides up 6px. 0.18s — instant but visible.
   fadeIn: opacity only — used by Resources sub-panels.
   spin: 360° rotation — used by .spinner loading indicators. */
.panel.active { animation: panelIn .18s ease !important; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin    { to { transform: rotate(360deg); } }
.spin, .spinner   { display: inline-block; animation: spin .85s linear infinite; }

/* == 26. UTILITY CLASSES (design-v2 additions) =======================
   Supplements Block 1 u-* classes. Key additions:
   .u-stat-val-lg/md/sm: clamp() fluid font sizing, keyed to the
   nearest container-type:inline-size ancestor (.stat-card/.mini-kpi)
   via cqw units, prevents TZS amounts overflowing/truncating in KPI
   tiles as the tile's own column narrows -- independent of viewport.
   lg/md/sm set the ceiling for hero vs secondary/compact stat variants;
   the base .stat-value/.mini-kpi-value clamp already covers the
   default case, so these are opt-in size overrides only.
   .u-stat-card-danger: red-tinted variant for LD/overdue warnings. */
.u-text-sm    { font-size: 11px !important; }
.u-text-xs    { font-size: 10px !important; }
.u-text-muted { color: var(--text2) !important; }
.u-text-muted2{ color: var(--text3) !important; }
.u-text-muted3{ color: var(--text3) !important; }
.u-text-accent{ color: var(--accent-text, var(--accent)) !important; }
.u-text-green { color: var(--accent2) !important; }
.u-text-amber { color: var(--accent3) !important; }
.u-text-red   { color: var(--danger) !important; }
.u-text-blue  { color: var(--info) !important; }
.u-font-mono  { font-family: 'DM Mono', monospace !important; }
/* Fluid stat values — clamp(min, container-relative cqw, max) */
.u-stat-val-lg{ font-size: clamp(13px, 9cqw, 20px) !important; font-family: 'DM Sans', sans-serif !important; }
.u-stat-val-md{ font-size: clamp(11px, 7cqw, 16px) !important; font-family: 'DM Sans', sans-serif !important; }
.u-stat-val-sm{ font-size: clamp(10px, 6cqw, 13px) !important; font-family: 'DM Sans', sans-serif !important; }
.u-stat-card-danger { border-color: rgba(240,96,96,.3) !important; background: rgba(240,96,96,.04) !important; }

/* == 27. LOGIN SCREEN ================================================
   400px card (vs Block 1's 380px). ::before top shimmer — same premium
   card treatment as stat/KPI cards. Labels: DM Mono for technical feel.
   Logo-mark: strong yellow glow box-shadow — primary brand on screen. */
.login-card {
  background: var(--surface) !important;
  border: 1px solid var(--border2) !important;
  border-radius: 20px !important;
  padding: 44px 48px !important;
  width: 400px !important;
  max-width: 95vw !important;
  box-shadow: 0 40px 100px var(--shadow-modal), 0 0 0 1px var(--accent-glow) !important;
  position: relative !important;
  overflow: hidden !important;
}
/* Top-edge shimmer — same treatment as stat/KPI cards */
.login-card::before {
  content: '';
  position: absolute;
  top: -1px; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(252,225,1,.4), transparent);
}
.login-logo { text-align: center; margin-bottom: 32px; }
/* Logo mark: strong glow for prominence on the login screen */
.login-logo-mark { width: 58px !important; height: 58px !important; background: var(--accent) !important; border-radius: 14px !important; display: flex !important; align-items: center !important; justify-content: center !important; margin: 0 auto 14px !important; font-family: 'Bebas Neue', sans-serif !important; font-size: 28px !important; color: #0a0c0a !important; box-shadow: 0 8px 32px rgba(252,225,1,.25) !important; }
.login-error { background: rgba(240,96,96,.08) !important; border: 1px solid rgba(240,96,96,.25) !important; color: var(--danger) !important; border-radius: 8px !important; padding: 10px 14px !important; font-size: 12.5px !important; line-height: 1.45 !important; white-space: pre-line !important; display: none !important; margin-bottom: 14px !important; }
.login-error.show { display: block !important; }
.login-field { margin-bottom: 16px !important; }
/* Labels: DM Mono uppercase — technical credential-entry feel */
.login-field label { font-size: 11px !important; font-weight: 700 !important; letter-spacing: .8px !important; text-transform: uppercase !important; color: var(--text3) !important; margin-bottom: 6px !important; font-family: 'DM Sans', sans-serif !important; }

/* == 28. CHART.JS GLOBAL DEFAULTS ====================================
   Chart.js colours/grid/fonts/tick sizes set programmatically in
   setChartDefaults() in the main JS block. CSS only ensures display:block
   on canvas (removes browser inline-display 4px phantom gap). */
.dash-chart-body canvas { display: block !important; }

/* == 29. BOOT VEIL ====================================================
   Full-screen overlay shown immediately on page load, dismissed by JS
   once BOTH boot phases report done (see _j360TryFinishBoot() in
   jenga360.main.js). Prevents empty KPIs, icon-text flash, and premature
   banners from ever being visible. Fades out in 0.35s.
   z-index is deliberately above every other startup-time full-screen
   element (login screen 9999, force-password-change 99997, setup wizard
   99998) so none of them can flash through underneath while both boot
   phases are still racing to finish -- the veil only ever loses to
   itself being explicitly faded out. */
#j360-boot-veil {
  position: fixed;
  inset: 0;
  z-index: var(--z-boot-veil);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: opacity 0.35s ease;
}
#j360-boot-veil::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center;
  -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 85%);
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.45) 55%, transparent 85%);
  pointer-events: none;
  z-index: 0;
}
#j360-boot-veil.j360-boot-ready {
  opacity: 0;
  pointer-events: none;
}
.j360-boot-logo {
  height: 96px;
  width: auto;
  max-height: 96px;
  max-width: 240px;
  object-fit: contain;
  margin-bottom: 6px;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  position: relative;
  z-index: 1;
}
.j360-boot-wordmark {
  font-family: 'Bebas Neue', 'Arial Narrow', Impact, sans-serif;
  font-size: 44px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1;
  user-select: none;
  position: relative;
  z-index: 1;
}
.j360-boot-tagline {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text3);
  margin-top: -6px;
  user-select: none;
  position: relative;
  z-index: 1;
}
.j360-boot-spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--surface3);
  border-top-color: var(--accent, #fce101);
  border-radius: 50%;
  animation: j360-veil-spin 0.75s linear infinite;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
@keyframes j360-veil-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   PERFORMANCE OPTIMIZATION LAYER — Phase 1 (2026-05-05)
   Applied by Antigravity architectural audit.
   All properties are purely additive — no visual regressions possible.
   ========================================================================== */

/* == 1. Main scroll container — GPU compositing & Blueprint Grid =========
   translateZ(0) promotes .main to its own compositor layer so scrolling
   never triggers a full-page repaint. overscroll-behavior prevents scroll
   chaining that causes parent layout recalculation.
   The ::before pseudo-element renders the website's signature architectural
   drafting grid fading down across the top 520px hero area of every screen. */
:root, [data-theme='dark'] {
  --grid-line: rgba(255, 255, 255, 0.08);
}
[data-theme='light'] {
  --grid-line: rgba(15, 18, 15, 0.09);
}

.main {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  overscroll-behavior: contain;
  /* Remove smooth scroll — it causes jank on programmatic switchTab() calls
     that reset scrollTop to 0. Instant scroll is faster for tab switching. */
  scroll-behavior: auto !important;
  position: relative;
}

.main::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 520px;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Modal header blueprint watermark across all dialog standards */
.modal-box,
.j360-modal-box,
.j360-modal-container,
.j360-modal,
.settings-modal-box,
.td-modal-container,
.modal-card,
#jg360ConfirmBox,
#jgPromptBox,
#jgPromptModal > div,
#onboardingOverlay > div,
#tourCard,
#changePinModal > div,
#modal-contractor-offline-pin > div {
  position: relative;
}

.modal-box::before,
.j360-modal-box::before,
.j360-modal-container::before,
.j360-modal::before,
.settings-modal-box::before,
.td-modal-container::before,
.modal-card::before,
#jg360ConfirmBox::before,
#jgPromptBox::before,
#jgPromptModal > div::before,
#onboardingOverlay > div::before,
#tourCard::before,
#changePinModal > div::before,
#modal-contractor-offline-pin > div::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 36px 36px;
  background-position: -1px -1px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.4) 65%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.4) 65%, transparent 100%);
  pointer-events: none;
  border-radius: inherit;
  z-index: 1;
}

#jg360ConfirmBox > *,
#jgPromptBox > *,
#jgPromptModal > div > *,
#onboardingOverlay > div > *,
#tourCard > *,
#changePinModal > div > *,
#modal-contractor-offline-pin > div > *,
.j360-modal-header > *,
.modal-header > *,
.modal-box > *,
.j360-modal-box > *,
.j360-modal-container > * {
  position: relative;
  z-index: 2;
}

/* == Light-Mode Accessibility & Contrast Defense ==========================
   In light mode, the authentic construction yellow (--accent: #fce101) has
   a low contrast ratio (~1.2:1) when applied as text or icon color against
   light surfaces. Text and standalone icons specifying color:var(--accent)
   are automatically remapped to high-contrast warm amber (--accent3: #d97706)
   to ensure crisp AAA readability across all light screens. */
[data-theme='light'] [style*='color:var(--accent'],
[data-theme='light'] [style*='color: var(--accent'],
[data-theme='light'] [style*='color:var(--accent)'],
[data-theme='light'] [style*='color: var(--accent)'],
[data-theme='light'] [style*='color:var(--accent);'],
[data-theme='light'] [style*='color: var(--accent);'],
[data-theme='light'] .u-text-accent,
[data-theme='light'] .role-qs,
[data-theme='light'] .statutory-row:last-child,
[data-theme='light'] .settings-section-title .material-symbols-outlined,
[data-theme='light'] #sbTooltipIcon {
  color: var(--accent3) !important;
}

/* == 2. Panel paint isolation ============================================
   contain:layout style prevents a panel's internal changes (table rebuilds,
   KPI re-renders) from triggering style recalculation outside the panel.
   This eliminates the "cascade repaint" that causes tab-switch freezing. */
.panel {
  contain: layout style;
  position: relative;
  z-index: 1;
}

/* Inactive panels are display:none — zero rendering cost.
   Active panels get their own stacking context to batch all their paints. */
.panel.active {
  contain: layout style;
  isolation: isolate;
}

/* == 3. Table scroll containers =========================================
   overflow-anchor:none prevents the browser from doing expensive
   scroll-anchor calculations every time a table row is added/removed.
   This is the primary cause of scroll jank in the Rate Library.
   translate3d(0,0,0) keeps the scroll area on the GPU compositor. */
.table-wrap {
  overflow-anchor: none;
  transform: translate3d(0, 0, 0);
  -webkit-overflow-scrolling: touch;
}

/* Full-screen workspaces & modal scroll areas: disable browser scroll anchoring
   and isolate layout containment so nearby DOM updates never nudge scrollTop. */
#tboqOverlay,
#wpOverlay {
  contain: layout style;
}
#tboqScrollWrap,
#tboqWPEScroll,
#wpOverlay [style*="overflow"],
.j360-modal-body,
.modal-body,
.j360-scroll-stable {
  overflow-anchor: none;
}

/* == 4. Table row hover — contain repaint to the row only ==============
   Without this, hovering a row triggers a full-table repaint because the
   browser doesn't know the change is row-scoped. contain:layout style
   tells the engine the change cannot affect surrounding elements. */
tr {
  contain: layout;
}

/* == 5. Sidebar nav containment =========================================
   The sidebar has 15+ nav items with hover effects. Containing it
   prevents sidebar interactions from triggering main-panel repaints. */
.sb-nav, .sidebar {
  contain: layout;
}

/* == 6. Modal overlays — isolated GPU layer ============================
   Modals slide in over the main content. GPU compositing ensures the
   overlay animation doesn't repaint the content behind it. */
.modal-overlay {
  will-change: opacity;
}
.modal-overlay.open {
  will-change: auto; /* release hint after animation completes */
}

/* == 6b. Sidebar backdrop when any modal is open =======================
   contain:layout paint (rule 5 above) promotes .sidebar to its own GPU
   compositor layer. That layer can paint above position:fixed modal
   backdrops regardless of z-index — a compositor ordering issue, not a
   CSS specificity one. Fix from inside the sidebar's own layer: show a
   full-cover ::after overlay whenever any .modal-overlay is open.
   contain:layout makes .sidebar the containing block for absolutely-
   positioned children, so inset:0 covers it exactly. z-index:10000 puts
   the overlay above all sidebar nav items within that same context.     */
/* == 6b. Sidebar backdrop — [DEPRECATED] unified z-index covers everything == */


/* == 7. Card components — layout containment ===========================
   .card is used extensively across all panels. Containing it means that
   content changes inside a card (e.g. KPI values updating) don't trigger
   layout recalculation of sibling cards. */
.card {
  contain: layout style;
}

/* == 8. Stats strips — contain grid reflows ============================
   Grid children reflow is expensive when values change. Containing the
   strip means each stat-card update is isolated. */
.stats-strip {
  contain: layout;
}

/* == 9. Toast container — GPU layer ====================================
   Toasts appear in a fixed position — promoting to compositor layer
   means they animate without touching the main-thread paint queue. */
.toast-container {
  will-change: transform;
  transform: translateZ(0);
}

/* == 10. Scroll behavior on sub-panels =================================
   All sub-panels that contain their own scroll areas benefit from
   explicit GPU compositing for smooth scrolling. */
.res-subpanel,
[id^="panel-"] > .card,
[id^="res-panel-"] {
  overflow-anchor: none;
}

/* Settings Modal: Reset Button Visibility */
#sb-company.sb-locked #sbBrandReset { display: none !important; }

/* ================================================================
   COMPOSE MODAL SCAFFOLD — .cm-*
   Shared chrome for every "draft a document, or file one written
   outside Javenzi" modal (see public/js/modules/compose-modal.js).

   These values are a faithful lift of the inline styles the New
   Letter to Client modal carried before extraction — the migration's
   acceptance test is that that modal renders identically — so change
   them only with that modal open in front of you.

   Why classes rather than the inline styles they replace: the same
   ~40 declarations were about to be pasted into the EOT modal, and
   from there into VO and PC. Inline styles also outrank every theme
   rule, which is what made the old modal immune to restyling.
   ================================================================ */

.cm-overlay {
  position: fixed; inset: 0; z-index: 10000 !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  padding: 16px; overflow: hidden;
  background: var(--overlay) !important;
  backdrop-filter: blur(6px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(6px) saturate(140%) !important;
  box-sizing: border-box;
}

/* z-index 10000 sits deliberately above .modal-overlay's 9999 !important,
   so a compose modal opened from inside the Tender modal (same class,
   9999) renders on top of it rather than behind. */
.cm-box {
  width: 100%;
  margin: auto;
  box-sizing: border-box;
}

.cm-head {
  border-bottom: 1px solid var(--border);
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between;
}
.cm-head-title { font-size: 16px; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; }
.cm-head-sub   { font-size: 12px; color: var(--text2); margin-top: 3px; }
.cm-x          { background: none; border: none; cursor: pointer; color: var(--text3); padding: 0; line-height: 1; }

.cm-body {
  padding: 8px 18px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  overflow-y: auto !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}
.cm-foot {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.cm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
/* Bottom-align a row that pairs a labelled input with a self-labelling block
   (an upload slot carries its heading inside its own border, so its box starts
   a label's height higher than the input beside it). */
.cm-grid-end { align-items: end; }
/* A slot that only gets a gap once it has something in it. An empty container
   with a static margin still contributes that margin to its cell's height,
   which silently offsets the field beside it in a bottom-aligned row. */
.cm-gap-when-filled:not(:empty) { margin-top: 6px; }

.cm-label      { font-size: 11px; color: var(--text3); display: block; margin-bottom: 4px; }
.cm-label-note { font-weight: 400; }
.cm-hint       { font-size: 10px; color: var(--text3); margin-top: 6px; }
.cm-meta       { font-size: 10px; color: var(--text3); margin-top: 6px; }

.cm-input {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface2); color: var(--text);
  font-size: 12px; box-sizing: border-box;
  font-family: inherit;
}
.cm-textarea { padding: 9px 10px; resize: vertical; }
.cm-file     { width: 100%; padding: 7px 0; font-size: 12px; color: var(--text); }

/* Uppercase rule dividing a long form into named sections (EOT Request
   Details / Client Response). Colour is set per-instance by the config. */
.cm-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--info);
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
  margin: 4px 0 0;
}
.cm-section-note { font-size: 9px; font-weight: 400; color: var(--text3); text-transform: none; letter-spacing: 0; }

/* Mode toggle ("Log a letter already sent") — align-items:flex-start because
   its two-line hint would otherwise drag the checkbox to the block's centre.
   The AI toggle is a single line, hence centre. */
.cm-toggle {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
}
.cm-toggle-ai    { align-items: center; }
.cm-toggle-ai .cm-hint { margin-top: 0; }
.cm-toggle-label {
  font-size: 12px; color: var(--text); font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}

/* display:inline-flex lives here, not inline, so the visibility pass can
   restore a hidden button with style.display='' and get the right value
   back. The old hand-rolled version had to remember 'flex' vs 'inline-flex'
   per button and got it wrong at least once. */
.cm-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; font-size: 13px; font-weight: 700;
  border-radius: var(--radius-pill); cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), background var(--transition-base), box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: .2px;
}
.cm-btn-ghost {
  font-weight: 600;
  border: 1.5px solid var(--border2);
  background: var(--surface3);
  color: var(--text);
  border-radius: var(--radius-pill);
}
.cm-btn-ghost:hover {
  background: var(--surface4);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.cm-btn-primary {
  background: #fce101 !important;
  color: #090b09 !important;
  border: 1.5px solid #090b09 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  border-radius: var(--radius-pill) !important;
}
.cm-btn-primary:hover {
  background: #faea46 !important;
  box-shadow: 0 4px 0 #090b09 !important;
  transform: translateY(-1px);
}
.cm-btn-draft {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning, #f59e0b);
  border: 1.5px solid var(--warning-border, rgba(245, 158, 11, 0.4));
  font-weight: 600;
  border-radius: var(--radius-pill);
}
.cm-btn-draft:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: var(--warning, #f59e0b);
  transform: translateY(-1px);
}
.cm-btn-ai {
  background: var(--info) !important;
  color: #fff !important;
  border: 1.5px solid rgba(0,0,0,0.3) !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  border-radius: var(--radius-pill) !important;
}
.cm-btn-ai:hover {
  filter: brightness(1.1);
  box-shadow: 0 3px 8px rgba(96,165,250,0.35);
  transform: translateY(-1px);
}
.cm-btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid transparent;
}
.cm-btn-danger:hover {
  filter: brightness(1.1);
}
.cm-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.cm-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.cm-photo-add {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border: 2px dashed var(--border); border-radius: 8px;
  cursor: pointer; color: var(--text3); font-size: 12px;
  transition: border-color .15s;
}
.cm-photo-add:hover { border-color: var(--accent); }

@media (max-width: 560px) {
  .cm-grid { grid-template-columns: 1fr !important; }
  .cm-foot { flex-wrap: wrap; }
}

/* == DOCUMENT UPLOAD / VIEW — shared infrastructure ====================
   Markup emitted by public/js/core/doc-upload.js. Replaces ~63 blocks of
   hand-written inline styles that had drifted into five different upload
   shapes and four copies of the same attachment slot.

   Deliberately NOT built on .btn: the base .btn sets `border: none !important`
   (see the note at ~line 1026), which would silently kill every bordered
   variant below and is the same trap that made .btn-info render flat. These
   carry their own borders and win no specificity battles.

   input[type="file"] is absent from both global input resets (Block 1 ~1596
   and Block 12 ~4966), so nothing here is fighting an !important. */

/* -- Buttons ---------------------------------------------------------- */
/* -- Size scale --------------------------------------------------------
   Two sizes, chosen by CONTEXT rather than by eye, so the same action cannot
   be three heights in three places:

     .doc-btn      (26px) — the document is the SUBJECT of the block it sits
                            in: an attachment slot, a card, a form field.
     .doc-btn-sm   (20px) — the document is one ATTRIBUTE of a dense row: a
                            register table, a payments row, a merge queue.

   Height is declared, not inferred from padding. It was inferred before, and
   the icon silently broke it — see the note on .doc-btn-icon below. */
.doc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 26px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  white-space: nowrap; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.doc-btn:hover:not(:disabled) { border-color: var(--border2); background: var(--surface2); }
.doc-btn:disabled { opacity: .35; cursor: not-allowed; }

/* !important is load-bearing, not decoration. Google's Material Symbols
   stylesheet is linked AFTER jenga360.css (jenga360.html line 64 vs 17) and
   sets `.material-symbols-outlined { font-size: 24px }` at the same
   specificity as any plain rule here — so it wins, and every icon in these
   buttons rendered at 24px instead of 12px, inflating a 26px button to 34px.
   That is why the app's own .icon-xs/.icon-sm/.icon-md all carry !important
   too. A plain font-size on a Material icon in this codebase is a no-op. */
.doc-btn-icon { font-size: 13px !important; line-height: 1 !important; }

/* View — the action a reader is looking for, so it carries the accent */
.doc-btn-view { color: var(--info); }
.doc-btn-view:hover:not(:disabled) { border-color: rgba(100,180,255,.5); }

/* Upload / Replace on an empty slot — green, the app's "add" colour.

   Its own token rather than var(--accent2): at this size (10.5px, bold) the
   text needs 4.5:1, and light theme's --accent2 (#2e7a50) measures 4.46:1 on
   --surface2 — a real miss, not a rounding one. #2a6e48 measures 5.24:1 there.
   Dark theme keeps --accent2 unchanged (9.33:1), so the two themes are set
   independently instead of one being compromised to suit the other. */
:root, [data-theme='dark'] { --doc-upload-fg: var(--accent2); }
[data-theme='light']       { --doc-upload-fg: #2a6e48; }
.doc-btn-upload { color: var(--doc-upload-fg); background: var(--surface2); font-weight: 800; padding: 0 11px; }
.doc-btn-upload:hover:not(:disabled) { border-color: rgba(126,200,160,.5); }

.doc-btn-danger { color: var(--danger); border-color: rgba(240,96,96,.4); }
.doc-btn-danger:hover:not(:disabled) { border-color: rgba(240,96,96,.75); background: rgba(240,96,96,.08); }

.doc-btn-primary { background: var(--accent); color: #0d0f0e; border-color: var(--accent); font-weight: 800; }
.doc-btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Registers label a document by WHAT IT IS (Request / Approval / IPA / IPC /
   Slip) rather than by what the button does, and colour carries that meaning.
   The tint is a custom property so those rows keep their colour coding while
   sharing one size, shape and border treatment with every other document
   control: `style="--doc-btn-tint: var(--info)"`. Colour stays a signal; the
   geometry stops being one. */
.doc-btn-tinted { color: var(--doc-btn-tint, var(--text2)); border-color: var(--doc-btn-tint, var(--border)); }
.doc-btn-tinted:hover:not(:disabled) { background: var(--surface2); border-color: var(--doc-btn-tint, var(--border2)); }

/* The dense-row size. */
.doc-btn-sm { height: 20px; padding: 0 7px; font-size: 9.5px; }
.doc-btn-sm .doc-btn-icon { font-size: 12px !important; }

/* Icon-only buttons take the height of whatever size they are paired with, so
   a row's View / Move / Remove controls line up instead of the labelled one
   standing 9px taller than its neighbours. */
.doc-btn-icon-only { padding: 0; width: 26px; gap: 0; }
.doc-btn-sm.doc-btn-icon-only { width: 20px; }

/* -- Attachment slot --------------------------------------------------- */
.doc-slot {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface2);
}
.doc-slot-empty { border-style: dashed; background: var(--surface); }
/* Stacked slots (the Project Documents strip) need breathing room; a lone slot
   inside a modal's own gap-spaced column must not gain a stray margin, hence
   the adjacent-sibling selector rather than a blanket margin-bottom. */
.doc-slot + .doc-slot { margin-top: 8px; }
.doc-slot-icon { font-size: 18px; color: var(--text3); flex: none; }
.doc-slot-icon-on { color: var(--accent2); }
.doc-slot-main { flex: 1; min-width: 0; }
/* --text2, not --text3: these lines are load-bearing -- the kicker names the
   document TYPE and the empty text states whether anything is attached -- and
   --text3 is reserved for content the reader loses nothing by missing (see the
   --text3 rule in the token block). This is the rule applied, not a local
   workaround: --text3 clears 3:1 for large text and non-text UI, not 4.5:1 for
   labels at this size. */
.doc-slot-kicker {
  font-size: 10px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .6px;
}
.doc-slot-name {
  font-size: 11px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-slot-empty-text { font-size: 10px; color: var(--text2); }
.doc-slot-sub { color: var(--text2); font-weight: 400; }
/* A slot that exists but is not yet applicable — e.g. a Completion Certificate
   before the contract period ends. Dimmed rather than hidden: the reader needs
   to know the slot is there and why it cannot be filled yet. */
.doc-slot-disabled { opacity: .55; }

/* -- Pending (not-yet-saved) file list ---------------------------------- */
.doc-pending-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; margin-top: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 7px;
}
.doc-pending-clip { font-size: 15px; color: var(--text3); flex: none; }
.doc-pending-name {
  flex: 1; min-width: 0;
  font-size: 11px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-pending-note { color: var(--text2); font-weight: 400; }
.doc-pending-preview { margin-top: 8px; }

/* -- Label-wrapped trigger ---------------------------------------------
   <label class="doc-btn doc-btn-upload doc-upload-label"> around a hidden
   input. Preferred over a button + .click() where the markup allows it: the
   label needs no JS, and it stays keyboard-reachable through the input it
   labels. Same painted result as .doc-btn either way, which is the point --
   a reader should not be able to tell which mechanism a given trigger used. */
.doc-upload-label { margin: 0; cursor: pointer; }

/* -- File picker --------------------------------------------------------
   The replacement for the browser's native file widget. The input is taken
   out of the visual flow but stays focusable and functional; the trigger,
   the filename readout and the pre-save View sit in its place.

   The input is NOT display:none — that would make it unreachable by keyboard
   and, in some browsers, refuse .click() entirely. It is clipped to a 1px box
   instead, the standard visually-hidden treatment for a control that must
   still work. */
.doc-picker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-picker-input {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
/* Focusing the hidden input (Tab) must show the trigger as focused, or the
   keyboard path becomes invisible. */
.doc-picker-input:focus-visible + .doc-btn {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(252,225,1,.15);
}
.doc-picker-name {
  flex: 1; min-width: 0;
  font-size: 11px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-picker-name.is-set { color: var(--text); font-weight: 600; }

/* Narrow screens: the slot's three trailing buttons would squeeze the
   filename to nothing, so the controls wrap onto their own line. */
@media (max-width: 560px) {
  .doc-slot { flex-wrap: wrap; }
  .doc-slot-main { flex: 1 0 100%; order: -1; }
}

/* The same treatment, opt-in, for a slot in a narrow CONTAINER on a wide
   screen -- the media query above cannot see that case. A slot inside one
   column of the IPC modal's two-column grid leaves its label and filename
   about 70px once View/Replace/Remove have taken their share, which turns a
   real filename ("INTERIM PAYMENT APPLICATION - MOSHI MC_new 2.pdf") into an
   ellipsis. Pass className:'doc-slot-stacked' to docSlotHtml() when the slot
   sits in a column rather than across the full width of a form. */
.doc-slot-stacked { flex-wrap: wrap; max-width: 100%; min-width: 0; min-inline-size: 0; }
.doc-slot-stacked .doc-slot-main { flex: 1 1 100%; max-width: 100%; min-width: 0; min-inline-size: 0; order: -1; }

/* ==========================================================================
   System-Wide Anti-Squeeze Guard for CSS Grids & Form Controls
   Prevents long filenames (.doc-slot), long <select> options, or nowrap text
   from expanding one grid column and crushing sibling fields across all
   modals, settings panes, and workspace panels.
   ========================================================================== */
.grid-2 > *, .grid-3 > *, .grid-4 > *, .grid-5 > *, .grid-7 > *,
.u-grid-2 > *, .u-grid-3 > *, .u-col-2 > *, .u-col-3 > *, .u-col-4 > *,
.kpi-grid-3 > *, .kpi-grid-4 > *, .timeline-grid > *, .stats-strip > *,
.mfe-stat-grid > *, .tdp-detail-grid > *, .tie-row > *, .cm-grid > *,
.cm-photo-grid > *, .settings-field-row > *,
.j360-modal-body [style*="display:grid"] > *,
.j360-modal-body [style*="display: grid"] > *,
.modal-box [style*="display:grid"] > *,
.modal-box [style*="display: grid"] > *,
.form-group,
.filter-wrap,
.search-wrap,
.doc-slot {
  min-width: 0;
  min-inline-size: 0;
}

.doc-slot {
  max-width: 100%;
}

.field-group input:not([type="checkbox"]):not([type="radio"]),
.field-group select,
.field-group textarea,
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea,
.settings-field-row input:not([type="checkbox"]):not([type="radio"]),
.settings-field-row select,
.filter-wrap select {
  max-width: 100%;
  min-width: 0;
  min-inline-size: 0;
}

.field-group select:not([multiple]):not([size]),
.form-group select:not([multiple]):not([size]),
.settings-field-row select:not([multiple]):not([size]),
.filter-wrap select:not([multiple]):not([size]) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Work Programme Out-of-Sequence Row Pulse Highlight */
@keyframes wpOosHighlightPulse {
  0% { background-color: rgba(245, 158, 11, 0.35); }
  50% { background-color: rgba(245, 158, 11, 0.18); }
  100% { background-color: transparent; }
}
.wp-row-oos-pulse {
  animation: wpOosHighlightPulse 2s ease-out;
}

/* Work Programme Dropdown Menus — enforce vertical layout for action links */
.wp-dropdown-menu {
  flex-direction: column;
}
.wp-dropdown-menu[style*="display: none"],
.wp-dropdown-menu[style*="display:none"] {
  display: none !important;
}
.wp-dropdown-menu a {
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box !important;
  align-items: center;
  clear: both;
}
.wp-dropdown-menu a[style*="display: none"],
.wp-dropdown-menu a[style*="display:none"] {
  display: none !important;
}

/* User Management Permission Matrix Sticky Header */
.um-matrix-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 11px;
}
.um-matrix-table thead th {
  position: sticky !important;
  top: -6px !important;
  z-index: 25 !important;
  background: var(--surface2) !important;
  border-bottom: 2px solid var(--border) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
}
.um-matrix-table td {
  border-bottom: 1px solid var(--border);
}

/* User Management — Linked Projects Multi-Select Dropdown */
.um-proj-select-wrap {
  position: relative;
  width: 100%;
}
.um-proj-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 38px;
  padding: 8px 12px;
  background: var(--input-bg, var(--surface));
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}
.um-proj-select-btn:hover {
  border-color: var(--accent);
}
.um-proj-select-btn:focus-visible {
  outline: 2px solid var(--accent);
}
.um-proj-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
}
.um-proj-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent-glow2);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 12px;
}
.um-proj-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 280px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-modal, 0 12px 32px rgba(0, 0, 0, 0.25));
  z-index: var(--z-popover, 100060);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.um-proj-dropdown-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.um-proj-search-input {
  width: 100%;
  height: 30px;
  padding: 4px 8px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  outline: none;
}
.um-proj-search-input:focus {
  border-color: var(--accent);
}
.um-proj-quick-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-size: 11px;
}
.um-proj-action-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.um-proj-action-link:hover {
  text-decoration: underline;
}
.um-proj-list {
  max-height: 190px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.um-proj-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}
.um-proj-item:hover {
  background: var(--surface2);
}
.um-proj-item input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}
.um-proj-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.um-proj-item-sub {
  font-size: 10.5px;
  color: var(--text3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  line-height: 1.35;
}
.um-proj-item-client {
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.um-proj-sep {
  color: var(--text3);
  opacity: 0.5;
  font-size: 9px;
  user-select: none;
}
.um-proj-item-ref {
  color: var(--text2);
  font-weight: 500;
}
.um-proj-item-status {
  color: var(--text3);
}
