/* Outfit & Inter Strategic PPM Stylesheet Core Tokens */

:root {
  /* Armstrong Dematic palette */
  --bg-main: #070a13;
  --bg-secondary: #0c101f;
  --bg-tertiary: #13192e;
  --border-light: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  
  /* Text */
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --brand-blue: #2398d3;
  --brand-blue-deep: #1f5f9f;
  --brand-yellow: #ffc82e;
  --brand-yellow-deep: #f0b322;
  --brand-ink: #101827;

  /* Glimmers */
  --accent-purple: var(--brand-yellow);
  --accent-cyan: var(--brand-blue);
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-red: #ef4444;
  
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Core Settings */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.8rem;
  line-height: 1.45;
  overflow-x: hidden;
  height: 100vh;
}

/* Armstrong Dematic logistics login */
#app-login-screen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100001 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  overflow: hidden !important;
  background:
    linear-gradient(90deg, rgba(10, 18, 28, 0.08), rgba(10, 18, 28, 0.02)),
    url("assets/logistics-login-bg.png") left center / 66% 100% no-repeat,
    #ffffff !important;
  backdrop-filter: none !important;
}

#app-login-screen.login-hidden,
#app-login-screen[style*="display: none"] {
  display: none !important;
}

#app-login-screen::before {
  content: "";
  position: absolute;
  top: -15vh;
  bottom: -15vh;
  left: 41%;
  width: 24vw;
  min-width: 320px;
  border-radius: 50%;
  background: #d1d1d1;
  z-index: 1;
}

#app-login-screen::after {
  content: "";
  position: absolute;
  top: -18vh;
  right: -5vw;
  bottom: -18vh;
  width: 57vw;
  min-width: 720px;
  border-radius: 50% 0 0 50%;
  background: #ffffff;
  z-index: 2;
}

#app-login-screen > .glass-panel {
  position: relative !important;
  z-index: 3 !important;
  width: 520px !important;
  height: 520px !important;
  max-width: none !important;
  padding: 0 !important;
  margin-right: clamp(90px, 11vw, 180px) !important;
  border-radius: 50% !important;
  border: 2px solid #d0d0d0 !important;
  background: #ffffff !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

#app-login-screen > .glass-panel > div:first-child {
  position: fixed;
  right: 58px;
  bottom: 42px;
  z-index: 4;
  margin: 0 !important;
  width: min(360px, 26vw);
}

#app-login-screen .login-company-lockup {
  width: 100%;
  max-width: none;
  margin: 0 auto 2px;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

#app-login-screen > .glass-panel > div:first-child p {
  color: #5f6368 !important;
  font-size: 0.84rem !important;
}

#app-login-form {
  width: 288px !important;
  gap: 16px !important;
  text-align: center !important;
  position: relative;
  z-index: 5;
}

#app-login-form .form-group {
  gap: 0 !important;
}

#app-login-form .form-group label,
#app-login-screen > .glass-panel > p,
#app-login-screen #login-remember-me,
#app-login-screen label[for="login-remember-me"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
}

#app-login-form > div:nth-of-type(3) {
  display: none !important;
}

#app-login-form .form-group input {
  width: 100% !important;
  height: 44px !important;
  padding: 0 44px 0 18px !important;
  border-radius: 999px !important;
  border: 1px solid #cfcfcf !important;
  background: #ffffff !important;
  color: #555 !important;
  font-size: 0.95rem !important;
  box-shadow: none !important;
}

#app-login-form .form-group input::placeholder {
  color: #8c8c8c;
  opacity: 1;
}

#app-login-form .form-group:nth-of-type(2) {
  position: relative;
}

#app-login-form .form-group:nth-of-type(2)::after {
  display: none;
}

#app-login-screen .login-password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 32px;
  height: 32px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  z-index: 6;
}

#app-login-screen .login-password-toggle::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 9px;
  width: 18px;
  height: 12px;
  border: 1.8px solid #666;
  border-radius: 50%;
}

#app-login-screen .login-password-toggle::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 13px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #666;
}

#app-login-screen .login-password-toggle.is-visible::before {
  border-color: var(--brand-blue);
}

#app-login-screen .login-password-toggle.is-visible::after {
  background: var(--brand-blue);
  box-shadow: 0 0 0 14px rgba(35, 152, 211, 0.08);
}

#app-login-form .form-group input:focus {
  border-color: var(--brand-blue) !important;
  box-shadow: 0 0 0 3px rgba(35, 152, 211, 0.12) !important;
}

#app-login-screen .btn-primary {
  width: 100% !important;
  height: 45px !important;
  min-height: 45px !important;
  margin-top: 8px !important;
  border-radius: 999px !important;
  background: #4b98ef !important;
  color: #ffffff !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

#app-login-screen .btn-primary:hover {
  background: #2f82df !important;
  transform: none !important;
}

#app-login-screen .login-error-message {
  display: none;
  min-height: 18px;
  margin-top: -4px;
  color: #d93025;
  font-size: 0.76rem;
  line-height: 1.25;
  text-align: center;
}

#app-login-screen .login-error-message.active {
  display: block;
}

@media (max-width: 980px) {
  #app-login-screen {
    justify-content: center !important;
    background:
      linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)),
      url("assets/logistics-login-bg.png") center / cover no-repeat,
      #ffffff !important;
  }

  #app-login-screen::before,
  #app-login-screen::after {
    display: none;
  }

  #app-login-screen > .glass-panel {
    width: min(86vw, 430px) !important;
    height: min(86vw, 430px) !important;
    margin: 0 !important;
  }

  #app-login-form {
    width: min(280px, 68vw) !important;
  }

  #app-login-screen > .glass-panel > div:first-child {
    right: 50% !important;
    bottom: 24px !important;
    transform: translateX(50%);
    width: min(320px, 76vw);
  }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Space-glass layout */
.glass-panel {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: var(--transition-smooth);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.panel-dark {
  background: rgba(8, 12, 24, 0.7);
  border-color: rgba(255, 255, 255, 0.05);
}

/* Layout Core */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 12px;
  gap: 12px;
}

body.light-theme header.main-header.glass-panel,
header.main-header {
  position: relative;
  z-index: 2000 !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  min-height: 66px;
  flex-shrink: 0;
  overflow: visible !important;
}

#view-workspace > .glass-panel {
  padding: 18px !important;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.brand-company-lockup {
  display: block;
  width: clamp(241px, 17.9vw, 314px);
  height: 35px;
  max-height: 35px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 1px;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

body.light-theme .brand-company-lockup {
  filter: none;
}

body:not(.light-theme) .brand-company-lockup {
  filter: none;
}

.login-company-lockup {
  display: block;
  width: min(420px, 100%);
  height: auto;
  margin: 0 auto 10px;
  background: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.24);
}

.brand-text span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0;
}

.brand-text {
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.role-selector-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

@media (max-width: 1180px) {
  .brand-company-lockup {
    width: min(269px, 29vw);
    height: 32px;
  }

  .header-actions {
    gap: 12px;
  }
}

@media (max-width: 980px) {
  .main-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
    min-height: auto;
  }

  .brand-company-lockup {
    display: none;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }

  .header-actions::-webkit-scrollbar {
    height: 3px;
  }

  .header-actions::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
  }

  .header-actions > * {
    flex-shrink: 0;
  }

  #profile-widget {
    max-width: 100%;
  }

  #profile-email {
    display: inline-block;
    max-width: 128px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}

.role-select {
  background: transparent;
  color: var(--accent-cyan);
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.role-select option {
  background: var(--bg-secondary);
  color: var(--text-main);
}

.user-avatar-glow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--brand-blue-deep));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.profile-avatar-button {
  width: 30px !important;
  height: 30px !important;
  font-size: 0.72rem !important;
  border: none;
  box-shadow: none !important;
  cursor: pointer;
  padding: 0;
}

.profile-avatar-button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.profile-email-hidden {
  display: none !important;
}

.account-menu-panel {
  position: absolute;
  top: 40px;
  right: 0;
  width: 240px;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  z-index: 99999;
}

.account-menu-panel.active {
  display: flex;
}

.account-menu-status {
  font-size: 0.64rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--accent-emerald);
}

.account-menu-email {
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  overflow-wrap: anywhere;
}

.account-menu-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding-top: 4px;
}

.account-menu-actions button {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-main);
  padding: 8px 10px;
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
  text-align: left;
}

.account-menu-actions button:hover {
  border-color: rgba(31, 95, 159, 0.38);
  background: rgba(31, 95, 159, 0.08);
}

body.light-theme .account-menu-panel {
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

/* Console Split Body */
.console-body {
  display: flex;
  flex: 1;
  gap: 16px;
  min-height: 0;
}

.sidebar {
  width: 70px;
  height: calc(100vh - 110px);
  box-sizing: border-box;
  padding: 10px 8px;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

.sidebar:hover {
  width: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.sidebar:hover::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: max-content;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar:not(:hover) .nav-btn,
.sidebar:not(:hover) .nav-btn.active,
.sidebar:not(:hover) .nav-btn:hover {
  color: transparent !important;
}

.sidebar:not(:hover) .sidebar-group-label,
.sidebar:not(:hover) .sidebar-divider {
  display: none !important;
}

.sidebar:not(:hover) .nav-btn svg {
  color: var(--text-muted) !important;
}

.sidebar:not(:hover) .nav-btn.active svg {
  color: var(--accent-cyan) !important;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.nav-btn:hover svg {
  color: #fff;
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 200, 46, 0.14), rgba(35, 152, 211, 0.16));
  border: 1px solid rgba(255, 200, 46, 0.28);
}

.nav-btn.active svg {
  color: var(--accent-cyan);
}

/* Content Port */
.content-viewport {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

.viewport-section {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.viewport-section.active {
  display: flex;
}

/* Manual view — override flex-direction from viewport-section default (active only) */
#view-manual.viewport-section.active {
  flex-direction: row;
  height: calc(100vh - 60px);
  overflow: hidden;
  gap: 0;
  padding: 0;
}

/* User Manual (legacy shell — kept for any remaining references) */
.user-manual-shell {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.user-manual-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.user-manual-header p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: -2px;
  max-width: 820px;
  line-height: 1.4;
}

/* ── Manual doc-style header ───────────────────── */
.manual-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding: 28px 32px 26px;
  margin: -24px -24px 0;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, rgba(35,184,211,0.06) 0%, transparent 60%);
}

.manual-doc-header-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.doc-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-blue);
  opacity: 0.9;
}

.doc-title {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.2;
  color: #e2e8f0;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
}

.doc-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.5;
  margin-top: 2px;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 6px;
}

.meta-item {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.meta-item strong {
  color: #e2e8f0;
  font-weight: 600;
  margin-right: 4px;
}

/* light theme overrides */
body.light-theme .manual-doc-header {
  background: linear-gradient(135deg, rgba(35,152,211,0.07) 0%, transparent 60%);
}

body.light-theme .doc-title,
body.light-theme .meta-item strong {
  color: #0f172a;
}

body.light-theme .doc-eyebrow {
  color: var(--brand-blue-deep);
}

.user-manual-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.manual-query-panel {
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(280px, 0.9fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.12);
}

.manual-query-input-wrap label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.manual-query-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.manual-query-row input {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 0.84rem;
}

.manual-answer-box {
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.25);
  background: rgba(14, 165, 233, 0.08);
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.4;
}

.manual-answer-box strong {
  display: block;
  color: var(--accent-cyan);
  font-size: 0.84rem;
  margin-bottom: 5px;
}

.manual-answer-box ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.manual-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.manual-toc-panel {
  position: sticky;
  top: 12px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.12);
  max-height: calc(100vh - 170px);
  overflow-y: auto;
}

.manual-toc-panel h3 {
  font-size: 0.82rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.manual-toc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manual-toc-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 7px;
  padding: 8px 9px;
  cursor: pointer;
  font-size: 0.76rem;
  line-height: 1.25;
}

.manual-toc-item:hover {
  border-color: rgba(14, 165, 233, 0.28);
  color: var(--text-main);
  background: rgba(14, 165, 233, 0.08);
}

.manual-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manual-section-card {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.1);
}

.manual-section-kicker {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 6px;
}

.manual-section-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--text-main);
}

.manual-section-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 10px;
}

.manual-section-card ol {
  margin: 0;
  padding-left: 20px;
}

.manual-section-card li {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 6px;
}

.manual-empty-state {
  padding: 24px;
  border: 1px dashed var(--border-medium);
  border-radius: 10px;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .manual-query-panel,
  .manual-layout {
    grid-template-columns: 1fr;
  }

  .manual-toc-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .user-manual-shell {
    padding: 16px;
  }

  .manual-query-row {
    grid-template-columns: 1fr;
  }

  .user-manual-actions,
  .user-manual-actions button {
    width: 100%;
  }
}

.view-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
}

/* Portfolio Filters */
.filter-panel {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.filters-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filters-grid select {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.btn-clear {
  background: transparent;
  border: 1px dashed var(--accent-rose);
  color: var(--accent-rose);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-clear:hover {
  background: rgba(244, 63, 94, 0.08);
}

/* KPI Summary Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.kpi-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin: 2px 0;
}

.kpi-indicator {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  align-self: flex-start;
}

.kpi-indicator.positive { background: rgba(16, 185, 129, 0.1); color: var(--accent-emerald); }
.kpi-indicator.neutral { background: rgba(6, 182, 212, 0.1); color: var(--accent-cyan); }
.kpi-indicator.negative { background: rgba(244, 63, 94, 0.1); color: var(--accent-rose); }

/* Left border highlights */
.border-purple { border-left: 3.5px solid var(--accent-purple); }
.border-cyan { border-left: 3.5px solid var(--accent-cyan); }
.border-rose { border-left: 3.5px solid var(--accent-rose); }
.border-emerald { border-left: 3.5px solid var(--accent-emerald); }
.border-amber { border-left: 3.5px solid var(--accent-amber); }
.border-red { border-left: 3.5px solid var(--accent-red); }

/* Charts Layout Grid */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.chart-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Always light card — matches screenshot in both themes */
  background: #111827 !important;
  border: 1px solid rgba(71, 85, 105, 0.72) !important;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28) !important;
  border-radius: 10px !important;
  overflow: hidden !important;
}

.chart-panel h3 {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: #e5f2ff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  /* Steel-blue header strip — matches screenshot */
  background: #172033 !important;
  padding: 10px 16px !important;
  margin: -20px -20px 14px -20px !important;
  border-bottom: 1px solid rgba(56, 189, 248, 0.22) !important;
}

.canvas-wrap {
  position: relative;
  height: 220px;
  width: 100%;
  background: #111827;
  border-radius: 0 0 8px 8px;
}

/* Split Form layouts */
.split-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

.workspace-risks-split {
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.workspace-risks-split .wbs-panel {
  overflow: hidden;
  padding: 0;
}

.risk-panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 20px;
  background: rgba(148, 163, 184, 0.16);
  border-bottom: 1px solid var(--border-medium);
}

.risk-panel-title-row h3 {
  margin: 0;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.workspace-risk-table-container {
  margin: 16px 20px 20px;
  min-height: 190px;
  max-height: min(44vh, 420px);
}

.workspace-issue-table-container {
  margin: 16px 20px 20px;
  min-height: 180px;
  max-height: min(40vh, 380px);
}

#wsub-view-risks .master-toolbar {
  margin: 16px 20px 0;
}

.workspace-risk-table {
  min-width: 1320px;
  --sticky-col-1-width: 340px;
  --sticky-col-2-width: 145px;
}

.workspace-issue-table {
  min-width: 1320px;
  --sticky-col-1-width: 320px;
  --sticky-col-2-width: 110px;
}

.workspace-risk-table th:nth-child(3),
.workspace-risk-table td:nth-child(3) {
  min-width: 430px;
  width: 430px;
}

.workspace-risk-table th:nth-child(4),
.workspace-risk-table td:nth-child(4),
.workspace-risk-table th:nth-child(5),
.workspace-risk-table td:nth-child(5) {
  min-width: 145px;
  width: 145px;
}

.workspace-risk-table th:nth-child(6),
.workspace-risk-table td:nth-child(6),
.workspace-risk-table th:nth-child(7),
.workspace-risk-table td:nth-child(7),
.workspace-risk-table th:nth-child(8),
.workspace-risk-table td:nth-child(8) {
  min-width: 110px;
  width: 110px;
}

.workspace-issue-table th:nth-child(3),
.workspace-issue-table td:nth-child(3) {
  min-width: 450px;
  width: 450px;
}

.workspace-issue-table th:nth-child(4),
.workspace-issue-table td:nth-child(4),
.workspace-issue-table th:nth-child(5),
.workspace-issue-table td:nth-child(5) {
  min-width: 145px;
  width: 145px;
}

.workspace-issue-table th:nth-child(6),
.workspace-issue-table td:nth-child(6),
.workspace-issue-table th:nth-child(7),
.workspace-issue-table td:nth-child(7),
.workspace-issue-table th:nth-child(8),
.workspace-issue-table td:nth-child(8) {
  min-width: 110px;
  width: 110px;
}

.workspace-risk-table td,
.workspace-issue-table td {
  vertical-align: top;
  line-height: 1.4;
}

.workspace-risk-table td:nth-child(1),
.workspace-risk-table td:nth-child(3),
.workspace-issue-table td:nth-child(1),
.workspace-issue-table td:nth-child(3) {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .workspace-risks-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .risk-panel-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-risk-table-container,
  .workspace-issue-table-container,
  #wsub-view-risks .master-toolbar {
    margin-left: 12px;
    margin-right: 12px;
  }
}

/* PPM Form Elements */
.ppm-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#auth-toggle-btn {
  display: none !important;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.form-group input, .form-group select, .form-group textarea, .role-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition-smooth);
}

.form-group select option,
.role-select option {
  background: var(--bg-secondary);
  color: var(--text-main);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.btn-primary {
  background: var(--brand-blue);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-weight: 600;
  border-radius: 8px;
  min-height: 32px;
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition-smooth);
  box-shadow: 0 0 12px rgba(35, 152, 211, 0.22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: var(--brand-blue-deep);
  box-shadow: 0 0 18px rgba(35, 152, 211, 0.36);
}

.btn-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-medium);
  font-family: var(--font-display);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Scroller Decks */
.proposals-scroller {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 520px;
  padding-right: 6px;
}

.proposal-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proposal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.proposal-card-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}

.status-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.draft { background: rgba(100, 116, 139, 0.1); color: var(--text-secondary); border: 1px solid rgba(100, 116, 139, 0.2); }
.status-badge.submitted { background: rgba(255, 200, 46, 0.12); color: var(--accent-purple); border: 1px solid rgba(255, 200, 46, 0.24); }
.status-badge.under_review { background: rgba(35, 152, 211, 0.1); color: var(--accent-cyan); border: 1px solid rgba(35, 152, 211, 0.22); }
.status-badge.approved { background: rgba(16, 185, 129, 0.1); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-badge.rejected { background: rgba(244, 63, 94, 0.1); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.2); }

.proposal-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.1);
  padding: 8px 12px;
  border-radius: 6px;
}

#view-intake > .split-layout {
  align-items: start;
  grid-template-columns: minmax(520px, 1.08fr) minmax(420px, 0.92fr);
}

#view-intake .proposals-scroller {
  max-height: none;
  overflow: visible;
  padding-right: 0;
  padding-bottom: 14px;
}

#view-intake .proposal-card {
  overflow: visible;
  min-height: max-content;
}

#view-intake .proposal-meta-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

#view-intake .proposal-action-row {
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}

#view-intake .proposal-action-row:empty {
  display: none !important;
}

body.light-theme #view-intake .glass-panel,
body.light-theme #view-intake .proposal-card {
  overflow: visible !important;
}

@media (max-width: 1120px) {
  #view-intake > .split-layout {
    grid-template-columns: 1fr;
  }
}

/* Horizontal lifecycle stages */
.lifecycle-stage-container {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin: 20px 0;
  padding-top: 10px;
  padding-bottom: 12px;
  overflow-x: auto;
}

.lifecycle-stage-container::before {
  content: '';
  position: absolute;
  top: 25px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: var(--border-light);
  z-index: 1;
}

.stage-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 100px;
  cursor: pointer;
  flex-shrink: 0;
}

.stage-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.stage-step.complete .stage-dot {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}

.stage-step.in-progress .stage-dot {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.stage-step.active .stage-dot {
  border-color: #fff;
  transform: scale(1.1);
}

.stage-name-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  margin-top: 8px;
  white-space: nowrap;
}

.stage-step.active .stage-name-label {
  color: var(--text-main);
  font-weight: 700;
}

.stage-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--brand-yellow);
  color: var(--brand-ink) !important;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg-secondary);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.project-pill-checkbox {
  user-select: none;
}

.project-pill-checkbox:hover {
  background: rgba(35, 152, 211, 0.08) !important;
  border-color: var(--brand-blue) !important;
  color: #fff !important;
}

/* Stage Summary Ribbon */
.stage-summary-ribbon {
  display: flex;
  background: rgba(19, 25, 46, 0.45);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  padding: 6px;
  margin: -10px 0 25px 0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  overflow-x: auto;
  align-items: center;
  gap: 6px;
  scrollbar-width: none; /* Hide default scrollbar on Firefox */
  max-height: 80px;
  opacity: 1;
  transform: scaleY(1);
  transform-origin: top;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.stage-summary-ribbon.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
  transform: scaleY(0) !important;
  pointer-events: none !important;
}

.stage-summary-ribbon::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome, Safari, and Opera */
}

body.light-theme .stage-summary-ribbon {
  background: rgba(241, 245, 249, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

/* Ribbon toggle button hover style */
#toggle-ribbon-btn {
  transition: all 0.2s ease;
}
#toggle-ribbon-btn:hover {
  transform: scale(1.03);
}
#toggle-ribbon-btn.ribbon-hidden {
  background: rgba(35, 152, 211, 0.15) !important;
  border-color: rgba(35, 152, 211, 0.3) !important;
  color: var(--brand-blue) !important;
}

.ribbon-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-width: 130px;
  padding: 10px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.ribbon-step:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

body.light-theme .ribbon-step:hover {
  background: rgba(15, 23, 42, 0.04);
}

.ribbon-step.active {
  background: linear-gradient(135deg, var(--brand-blue), #1a7eb3) !important;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(35, 152, 211, 0.4);
  transform: translateY(-1px);
}

.ribbon-step-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  cursor: pointer;
}

.ribbon-step-badge:hover {
  background: rgba(35, 152, 211, 0.28);
  border-color: rgba(35, 152, 211, 0.5);
  color: #ffffff;
}

body.light-theme .ribbon-step-badge {
  background: rgba(15, 23, 42, 0.06);
  border-color: rgba(15, 23, 42, 0.03);
  color: var(--text-muted);
}

.ribbon-step.active .ribbon-step-badge {
  background: rgba(255, 255, 255, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff !important;
}

.ribbon-step-label {
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.01em;
}

body.light-theme .ribbon-step-label {
  color: var(--text-muted);
}

.ribbon-step.active .ribbon-step-label {
  color: #ffffff !important;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.product-card-item {
  padding: 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-medium);
}

.product-card-item:hover {
  transform: translateY(-2px);
  border-color: var(--brand-blue);
  box-shadow: 0 6px 15px rgba(35, 152, 211, 0.15);
}

body.light-theme .product-card-item {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .product-card-item:hover {
  border-color: var(--brand-blue) !important;
  box-shadow: 0 6px 15px rgba(35, 152, 211, 0.15) !important;
}



.lifecycle-gate-detail-row {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  border-top: 1px solid var(--border-light);
  padding-top: 20px;
}

.gate-requirements-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gate-checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.gate-checklist-item input {
  accent-color: var(--accent-emerald);
  width: 16px;
  height: 16px;
}

/* Project Workspace selectors */
.workspace-header {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(620px, 1.28fr);
  align-items: start;
  gap: 20px;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.workspace-heading-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workspace-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-title-row .view-title {
  margin: 0;
}

.workspace-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.35;
}

.workspace-code-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(35, 152, 211, 0.32);
  background: rgba(35, 152, 211, 0.08);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.workspace-context-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.workspace-context-row {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.workspace-context-row-wide {
  flex-wrap: nowrap;
}

.workspace-context-filter-row {
  justify-content: flex-end;
}

.workspace-context-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
}

.workspace-context-field label {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.workspace-context-field .project-selector {
  width: 100%;
  min-width: 0;
}

.workspace-project-field {
  flex: 1 1 420px;
  min-width: 320px;
}

.workspace-context-row > button {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 34px;
}

.project-selector {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  color: #fff;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.workspace-context-bar .project-selector {
  min-height: 34px;
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.32);
}

.workspace-context-bar .project-selector:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(35, 152, 211, 0.12);
}

@media (max-width: 1180px) {
  .workspace-header {
    grid-template-columns: 1fr;
  }

  .workspace-context-row {
    justify-content: flex-start;
  }

  .workspace-context-row-wide {
    flex-wrap: wrap;
  }
}

@media (max-width: 720px) {
  .workspace-context-field {
    align-items: stretch;
    min-width: 100%;
  }

  .workspace-project-field {
    min-width: 100%;
  }
}

.workspace-sub-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.wsub-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.wsub-btn:hover {
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
}

.wsub-btn.active {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 6px 14px rgba(35, 152, 211, 0.22);
}

.workspace-sub-viewport {
  min-height: 250px;
}

.gantt-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.gantt-panel-header h3 {
  margin: 0;
}

.gantt-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.gantt-panel-actions label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.gantt-panel-actions .project-selector {
  min-width: 190px;
  font-size: 0.75rem;
  padding: 4px 8px;
}

.gantt-panel-actions .graph-export-btn {
  position: static;
}

.wsub-section {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.wsub-section.active {
    display: flex;
}

.admin-db-subnav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 6px;
    width: 100%;
    max-width: 100%;
    border-bottom: 1px solid var(--border-light);
}

.admin-db-subnav-btn {
    padding: 6px 14px;
}

.admin-db-subpage {
    width: 100%;
}

.db-network-access-row {
    align-items: center;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: auto minmax(240px, 1fr) auto;
    padding: 9px 10px;
}

.db-network-access-label {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.db-network-access-url {
    color: var(--accent-cyan);
    font-size: 0.78rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.db-network-copy-btn {
    justify-content: center;
    min-width: 72px;
}

#admin-db-page-active.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
}

.active-db-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
}

.active-db-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.active-db-section-title {
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.active-db-catalog-frame {
    max-height: 260px;
    min-height: 118px;
    overflow: auto;
    border-color: var(--border-medium);
    margin-bottom: 2px;
}

.active-db-catalog-table {
    table-layout: fixed;
    min-width: 980px;
}

.active-db-catalog-table th,
.active-db-catalog-table td,
.active-db-catalog-table th:nth-child(1),
.active-db-catalog-table td:nth-child(1),
.active-db-catalog-table th:nth-child(2),
.active-db-catalog-table td:nth-child(2) {
    position: static;
    left: auto;
    z-index: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    box-shadow: none;
}

.active-db-catalog-table th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.active-db-catalog-table th:nth-child(1) { width: 20%; }
.active-db-catalog-table th:nth-child(2) { width: 27%; }
.active-db-catalog-table th:nth-child(3) { width: 20%; }
.active-db-catalog-table th:nth-child(4) { width: 10%; }
.active-db-catalog-table th:nth-child(5) { width: 23%; }

.active-db-catalog-table th:nth-child(5),
.active-db-catalog-table td:nth-child(5) {
    text-align: left;
    vertical-align: middle;
}

.active-db-catalog-table td,
.active-db-catalog-table code {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.active-db-catalog-table td:nth-child(5) .master-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-db-json-frame {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    max-height: min(58vh, 620px);
    min-height: 280px;
    overflow: auto;
    padding: 14px;
}

#admin-database-pre {
    color: var(--accent-cyan);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    margin: 0;
    min-width: 760px;
    white-space: pre;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-light);
  font-size: 0.8rem;
}

.meta-row span { color: var(--text-secondary); }

.plm-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.plm-control-card {
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
  min-height: 104px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.plm-control-card span {
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.plm-control-card strong {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--text-main);
  line-height: 1.1;
}

.plm-control-card small {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.plm-control-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 16px;
}

.plm-action-list,
.plm-signal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.plm-action-item,
.plm-signal-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.plm-action-item strong,
.plm-signal-item strong {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.plm-action-item p,
.plm-signal-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .plm-control-layout {
    grid-template-columns: 1fr;
  }
}

/* Gantt Chart */
.gantt-flow-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gantt-row-line {
  display: grid;
  grid-template-columns: 300px 1fr;
  align-items: center;
  gap: 16px;
}

.gantt-row-line h5 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.35;
  min-width: 0;
}

.gantt-track-lane-wrap {
  height: 24px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.gantt-element-bar {
  height: 14px;
  border-radius: 3px;
  position: absolute;
  top: 4px;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-cyan));
  display: flex;
  align-items: center;
  font-size: 0.62rem;
  color: #fff;
  padding-left: 8px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(6, 182, 212, 0.2);
}

/* Tables */
.table-scrollable-container {
  overflow: auto;
  max-height: min(62vh, 620px);
  border-radius: 8px;
  border: 1px solid var(--border-light);
  position: relative;
}

.ppm-data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.8rem;
  --sticky-col-1-width: 86px;
  --sticky-col-2-width: 240px;
}

.ppm-data-table th, .ppm-data-table td {
  padding: 8px 11px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.ppm-data-table th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  box-shadow: 0 1px 0 var(--border-light);
}

.ppm-data-table th:nth-child(1),
.ppm-data-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 7;
  min-width: var(--sticky-col-1-width);
  width: var(--sticky-col-1-width);
  max-width: var(--sticky-col-1-width);
  background: var(--bg-secondary);
  box-shadow: 2px 0 0 var(--border-medium);
}

.ppm-data-table th:nth-child(2),
.ppm-data-table td:nth-child(2) {
  position: sticky;
  left: var(--sticky-col-1-width);
  z-index: 7;
  min-width: var(--sticky-col-2-width);
  width: var(--sticky-col-2-width);
  max-width: var(--sticky-col-2-width);
  background: var(--bg-secondary);
  box-shadow: 2px 0 0 var(--border-medium);
}

.ppm-data-table th:nth-child(1),
.ppm-data-table th:nth-child(2) {
  z-index: 12;
  background: var(--bg-tertiary);
}

.ppm-data-table:has(#wbs-tasks-tbody) {
  min-width: 1680px;
  --sticky-col-1-width: 60px;
  --sticky-col-2-width: 300px;
}

/* Document Hub File Vault table — fixed layout to prevent filename overflow */
.ppm-data-table:has(#wo-documents-tbody) {
  table-layout: fixed;
  width: 100%;
}
.ppm-data-table:has(#wo-documents-tbody) th:nth-child(1),
.ppm-data-table:has(#wo-documents-tbody) td:nth-child(1) {
  width: 48%;
  word-break: break-all;
  overflow-wrap: anywhere;
  white-space: normal;
  position: static;
  box-shadow: none;
  min-width: unset;
  max-width: unset;
}
.ppm-data-table:has(#wo-documents-tbody) th:nth-child(2),
.ppm-data-table:has(#wo-documents-tbody) td:nth-child(2) {
  width: 10%;
  white-space: nowrap;
  position: static;
  box-shadow: none;
  min-width: unset;
  max-width: unset;
}
.ppm-data-table:has(#wo-documents-tbody) th:nth-child(3),
.ppm-data-table:has(#wo-documents-tbody) td:nth-child(3) {
  width: 24%;
  word-break: break-word;
  white-space: normal;
  position: static;
  box-shadow: none;
  min-width: unset;
  max-width: unset;
}
.ppm-data-table:has(#wo-documents-tbody) th:nth-child(4),
.ppm-data-table:has(#wo-documents-tbody) td:nth-child(4) {
  width: 18%;
  text-align: center;
  position: static;
  box-shadow: none;
  min-width: unset;
  max-width: unset;
  white-space: nowrap;
}

.ppm-data-table:has(#admin-resources-tbody) {
  --sticky-col-1-width: 130px;
  --sticky-col-2-width: 320px;
}

.admin-resource-add-panel {
  min-width: 0;
  overflow: hidden;
}

.admin-resource-form .form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.admin-resource-form .form-group {
  min-width: 0;
}

.admin-resource-form input,
.admin-resource-form select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.admin-resource-form #admin-res-role {
  max-width: 100%;
}

.admin-risk-phase-table {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}

.admin-risk-phase-table th,
.admin-risk-phase-table td,
.admin-risk-phase-table th:nth-child(1),
.admin-risk-phase-table td:nth-child(1),
.admin-risk-phase-table th:nth-child(2),
.admin-risk-phase-table td:nth-child(2) {
  position: static;
  left: auto;
  z-index: auto;
  box-shadow: none;
  min-width: 0;
  max-width: none;
}

.admin-risk-phase-table th:nth-child(1),
.admin-risk-phase-table td:nth-child(1) {
  width: 75%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.35;
  padding-left: 12px;
  padding-right: 12px;
}

.admin-risk-phase-table tbody tr {
  background: transparent;
}

.admin-risk-phase-table tbody td {
  vertical-align: middle;
}

.admin-risk-phase-table .admin-phase-name-input {
  display: block;
  width: 100%;
  min-width: 0;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.32;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 7px;
  outline: none;
  background: transparent;
  box-sizing: border-box;
  min-height: 30px;
}

.admin-risk-phase-table .admin-phase-name-input:hover,
.admin-risk-phase-table .admin-phase-name-input:focus {
  background: var(--bg-tertiary);
  border-color: rgba(31, 95, 159, 0.45);
  box-shadow: 0 0 0 3px rgba(31, 95, 159, 0.12);
}

.admin-risk-phase-table th:nth-child(2),
.admin-risk-phase-table td:nth-child(2) {
  width: 25%;
  text-align: center;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}

.admin-risk-phase-table td:nth-child(2) .btn-clear {
  max-width: 100%;
  padding: 3px 9px !important;
  font-size: 0.68rem !important;
  line-height: 1.15;
}

.admin-risk-phase-table-frame {
  overflow-x: hidden !important;
}

@media (max-width: 760px) {
  .admin-resource-form .form-row {
    grid-template-columns: 1fr;
  }
}

.ppm-data-table:has(#wbs-tasks-tbody) th:nth-child(2),
.ppm-data-table:has(#wbs-tasks-tbody) td:nth-child(2) {
  white-space: normal;
}

.ppm-data-table.workspace-risk-table th:nth-child(1),
.ppm-data-table.workspace-risk-table td:nth-child(1) {
  min-width: 340px;
  width: 340px;
  max-width: 340px;
}

.ppm-data-table.workspace-risk-table th:nth-child(2),
.ppm-data-table.workspace-risk-table td:nth-child(2) {
  min-width: 145px;
  width: 145px;
  max-width: 145px;
}

.ppm-data-table.workspace-issue-table th:nth-child(1),
.ppm-data-table.workspace-issue-table td:nth-child(1) {
  min-width: 320px;
  width: 320px;
  max-width: 320px;
}

.ppm-data-table.workspace-issue-table th:nth-child(2),
.ppm-data-table.workspace-issue-table td:nth-child(2) {
  min-width: 110px;
  width: 110px;
  max-width: 110px;
}

/* Departmental Risks Table Overrides */
.ppm-data-table.dept-risks-table {
  min-width: 1550px;
  --sticky-col-1-width: 75px;
  --sticky-col-2-width: 110px;
}

.ppm-data-table.dept-risks-table th:nth-child(1),
.ppm-data-table.dept-risks-table td:nth-child(1) {
  min-width: 75px;
  width: 75px;
  max-width: 75px;
  text-align: center;
}

.ppm-data-table.dept-risks-table th:nth-child(2),
.ppm-data-table.dept-risks-table td:nth-child(2) {
  left: 75px;
  min-width: 110px;
  width: 110px;
  max-width: 110px;
  text-align: center;
}

/* Badges for Details Column */
.dept-risks-table .badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.dept-risks-table .badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
}

.dept-risks-table .badge-category {
  background: rgba(14, 165, 233, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.dept-risks-table .badge-severity-critical,
.dept-risks-table .badge-severity-class-a {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.dept-risks-table .badge-severity-high,
.dept-risks-table .badge-severity-class-b {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.dept-risks-table .badge-severity-medium,
.dept-risks-table .badge-severity-class-c {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.dept-risks-table .badge-severity-low {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.dept-risks-table .badge-occurrences {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.dept-risks-table .badge-rca-done {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.dept-risks-table .badge-rca-pending {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.dept-risks-table .ageing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dept-risks-table .ageing-indicator.critical-ageing {
  color: var(--accent-rose);
  font-weight: 600;
}

/* User Avatars */
.dept-risks-table .user-avatar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dept-risks-table .avatar-bubble {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.dept-risks-table .avatar-bubble.unassigned {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border-light);
}

.dept-risks-table .user-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-main);
}

.dept-risks-table .user-name.unassigned {
  color: var(--text-muted);
  font-style: italic;
}

/* CAPA Stepper */
.capa-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
}

.capa-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  gap: 4px;
  transition: all 0.2s ease;
}

.capa-step .step-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-light);
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.capa-step.active .step-circle {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 6px rgba(14, 165, 233, 0.3);
}

.capa-step.active.step-close .step-circle {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
}

.capa-step:hover .step-circle {
  transform: scale(1.15);
  border-color: var(--text-main);
  color: var(--text-main);
}

.capa-step-line {
  flex: 1;
  height: 2px;
  background: var(--border-light);
  margin-top: -14px;
  transition: all 0.2s ease;
}

.capa-step-line.active {
  background: var(--accent-cyan);
}

.capa-step-line.active.line-to-close {
  background: var(--accent-emerald);
}

.capa-step .step-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

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

.capa-step.active.step-close .step-label {
  color: var(--accent-emerald);
}

.btn-icon-delete {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-delete:hover {
  background: var(--accent-rose);
  color: white;
  border-color: var(--accent-rose);
  box-shadow: 0 0 6px rgba(244, 63, 94, 0.3);
}

.ppm-data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

.ppm-data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* WBS layout */
.wbs-panel {
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px;
}

.wbs-panel h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

/* Resource Meter Cards */
.resource-workloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.resource-capacity-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.resource-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.resource-card-profile {
  display: flex;
  gap: 12px;
  align-items: center;
}

.resource-capacity-status-glow {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.resource-capacity-status-glow.available { background: rgba(16, 185, 129, 0.1); color: var(--accent-emerald); }
.resource-capacity-status-glow.loaded { background: rgba(6, 182, 212, 0.1); color: var(--accent-cyan); }
.resource-capacity-status-glow.overloaded { background: rgba(244, 63, 94, 0.1); color: var(--accent-rose); animation: pulse-border 1.5s infinite; }

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.capacity-meter-track {
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.capacity-meter-fill {
  height: 100%;
  background: var(--accent-cyan);
  border-radius: 4px;
  transition: width 0.5s ease-in-out;
}

.capacity-meter-fill.warning { background: var(--accent-amber); }
.capacity-meter-fill.danger { background: var(--accent-rose); }

.resource-allocated-products-list {
  border-top: 1px dashed var(--border-light);
  padding-top: 12px;
}

.resource-allocated-prods-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.resource-product-mini-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Finance Metrics Grid */
.finance-ledger-shell {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.finance-ledger-header {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: end;
}

.finance-ledger-title p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: -2px;
  margin-bottom: 0;
  line-height: 1.35;
}

.finance-ledger-controls {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(260px, 1fr);
  gap: 10px;
  align-items: end;
}

.finance-ledger-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.finance-ledger-controls label span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.finance-ledger-controls .project-selector {
  width: 100%;
  min-width: 0;
  height: 38px;
}

.finance-metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 6px;
}

/* ── Sample-style KPI card ─────────────────────────────── */
.finance-kpi-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  min-height: 80px;
  overflow: hidden;
}

.finance-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.24);
}

/* Circular colored icon */
.finance-kpi-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.finance-kpi-icon--blue   { background: #4F7FFA; color: #fff; }
.finance-kpi-icon--green  { background: #22c55e; color: #fff; }
.finance-kpi-icon--orange { background: #f59e0b; color: #fff; }
.finance-kpi-icon--purple { background: #8b5cf6; color: #fff; }
.finance-kpi-icon--teal   { background: #0d9488; color: #fff; }
.finance-kpi-icon--rose   { background: #e11d48; color: #fff; }

/* Text body */
.finance-kpi-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.finance-kpi-label {
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.finance-kpi-value {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 1.1vw, 1.3rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.finance-kpi-value--cyan    { color: #22d3ee; }
.finance-kpi-value--amber   { color: #fbbf24; }
.finance-kpi-value--emerald { color: #34d399; }
.finance-kpi-value--purple  { color: #a78bfa; }

/* Colored subtitle / percentage line */
.finance-kpi-sub {
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.finance-kpi-sub--blue   { color: #60a5fa; }
.finance-kpi-sub--green  { color: #4ade80; }
.finance-kpi-sub--orange { color: #fb923c; }
.finance-kpi-sub--purple { color: #c084fc; }
.finance-kpi-sub--teal   { color: #2dd4bf; }
.finance-kpi-sub--rose   { color: #fb7185; }

/* Light-theme overrides */
body.light-theme .finance-kpi-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
body.light-theme .finance-kpi-label { color: #64748b; }
body.light-theme .finance-kpi-value { color: #1e293b; }


.finance-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.26), rgba(6, 12, 24, 0.16));
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 14px 16px 15px;
  text-align: left;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-shadow: 0 10px 24px rgba(2, 8, 23, 0.12);
  position: relative;
  overflow: hidden;
}

.finance-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), rgba(16, 185, 129, 0.75));
  opacity: 0.65;
}

.finance-card span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.finance-card-year {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.11);
  border: 1px solid rgba(14, 165, 233, 0.22);
  color: var(--accent-cyan);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 10px;
  white-space: nowrap;
}

.finance-card strong {
  font-family: var(--font-display);
  font-size: clamp(1.18rem, 1.32vw, 1.55rem);
  color: #fff;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.finance-card-note {
  display: block;
  margin-top: 9px;
  font-size: 0.62rem;
  line-height: 1.25;
  color: var(--text-muted);
  max-width: 100%;
}

.finance-ledger-panels {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(620px, 1.42fr);
  gap: 16px;
  align-items: start;
}

.finance-approval-panel,
.finance-monthly-panel {
  min-width: 0;
}

.finance-panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.finance-panel-title-row h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.finance-panel-title-row p {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin: 4px 0 0;
  line-height: 1.35;
  max-width: 660px;
}

.finance-action-btn {
  font-size: 0.75rem;
  padding: 7px 13px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Finance title badge */
.finance-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: 999px;
  padding: 4px 12px 4px 8px;
  margin-bottom: 6px;
  width: fit-content;
}

/* Finance card icon */
.finance-card-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(14, 165, 233, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-cyan);
  opacity: 0.85;
}

/* Icon colors per card type */
.finance-card--budget   .finance-card-icon { color: #38bdf8; background: rgba(56,189,248,0.12); }
.finance-card--forecast .finance-card-icon { color: #22d3ee; background: rgba(34,211,238,0.12); }
.finance-card--actual   .finance-card-icon { color: #fbbf24; background: rgba(251,191,36,0.12); }
.finance-card--variance .finance-card-icon { color: #34d399; background: rgba(52,211,153,0.12); }
.finance-card--benefit  .finance-card-icon { color: #10b981; background: rgba(16,185,129,0.12); }
.finance-card--roi      .finance-card-icon { color: #a78bfa; background: rgba(167,139,250,0.12); }

/* Finance card footer */
.finance-card-footer {
  margin-top: auto;
  padding-top: 10px;
  font-size: 0.63rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Card background tint + top accent bar per tile type */
.finance-card--budget {
  background: linear-gradient(145deg, rgba(56,189,248,0.10) 0%, rgba(15,23,42,0.28) 60%);
  border-color: rgba(56,189,248,0.28);
  box-shadow: 0 8px 24px rgba(56,189,248,0.08), 0 2px 8px rgba(2,8,23,0.18);
}
.finance-card--budget::before {
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, rgba(56,189,248,0.25));
  opacity: 1;
}

.finance-card--forecast {
  background: linear-gradient(145deg, rgba(34,211,238,0.09) 0%, rgba(15,23,42,0.28) 60%);
  border-color: rgba(34,211,238,0.26);
  box-shadow: 0 8px 24px rgba(34,211,238,0.07), 0 2px 8px rgba(2,8,23,0.18);
}
.finance-card--forecast::before {
  height: 3px;
  background: linear-gradient(90deg, #22d3ee, rgba(34,211,238,0.22));
  opacity: 1;
}

.finance-card--actual {
  background: linear-gradient(145deg, rgba(251,191,36,0.10) 0%, rgba(15,23,42,0.28) 60%);
  border-color: rgba(251,191,36,0.28);
  box-shadow: 0 8px 24px rgba(251,191,36,0.08), 0 2px 8px rgba(2,8,23,0.18);
}
.finance-card--actual::before {
  height: 3px;
  background: linear-gradient(90deg, #fbbf24, rgba(251,191,36,0.22));
  opacity: 1;
}

.finance-card--variance {
  background: linear-gradient(145deg, rgba(52,211,153,0.09) 0%, rgba(15,23,42,0.28) 60%);
  border-color: rgba(52,211,153,0.26);
  box-shadow: 0 8px 24px rgba(52,211,153,0.07), 0 2px 8px rgba(2,8,23,0.18);
}
.finance-card--variance::before {
  height: 3px;
  background: linear-gradient(90deg, #34d399, rgba(52,211,153,0.22));
  opacity: 1;
}
/* Danger state when over budget */
.finance-card--variance.finance-card--danger {
  background: linear-gradient(145deg, rgba(248,113,113,0.11) 0%, rgba(15,23,42,0.28) 60%);
  border-color: rgba(248,113,113,0.30);
  box-shadow: 0 8px 24px rgba(248,113,113,0.10), 0 2px 8px rgba(2,8,23,0.18);
}
.finance-card--variance.finance-card--danger::before {
  background: linear-gradient(90deg, #f87171, rgba(248,113,113,0.22));
}
.finance-card--variance.finance-card--danger .finance-card-icon { color: #f87171; background: rgba(248,113,113,0.12); }

.finance-card--benefit {
  background: linear-gradient(145deg, rgba(16,185,129,0.10) 0%, rgba(15,23,42,0.28) 60%);
  border-color: rgba(16,185,129,0.27);
  box-shadow: 0 8px 24px rgba(16,185,129,0.08), 0 2px 8px rgba(2,8,23,0.18);
}
.finance-card--benefit::before {
  height: 3px;
  background: linear-gradient(90deg, #10b981, rgba(16,185,129,0.22));
  opacity: 1;
}

.finance-card--roi {
  background: linear-gradient(145deg, rgba(167,139,250,0.10) 0%, rgba(15,23,42,0.28) 60%);
  border-color: rgba(167,139,250,0.28);
  box-shadow: 0 8px 24px rgba(167,139,250,0.08), 0 2px 8px rgba(2,8,23,0.18);
}
.finance-card--roi::before {
  height: 3px;
  background: linear-gradient(90deg, #a78bfa, rgba(167,139,250,0.22));
  opacity: 1;
}

/* D1 credential status chips */
.d1-cred-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(248,113,113,0.12);
  color: var(--accent-rose);
  border: 1px solid rgba(248,113,113,0.25);
  transition: background 0.2s, color 0.2s;
}

/* Finance tabs navigation */
.finance-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 6px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.finance-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
}

/* Finance tab panels */
.finance-tab-panel {
  display: none;
}

.finance-tab-panel.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Enhanced table */
.finance-enhanced-table td {
  vertical-align: middle;
}

.finance-enhanced-table .ppm-data-table th {
  white-space: nowrap;
}

.finance-toolbar {
  margin-bottom: 12px;
  justify-content: flex-end;
  min-height: 46px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.08);
}

.finance-table-frame {
  margin-top: 0;
  max-height: 420px;
  border-radius: 8px;
}

.finance-table-frame .ppm-data-table {
  min-width: 760px;
}

.finance-table-frame .ppm-data-table th {
  white-space: nowrap;
}

.finance-table-frame .ppm-data-table td {
  vertical-align: middle;
}

@media (max-width: 1500px) {
  .finance-metrics-grid {
    grid-template-columns: repeat(3, minmax(210px, 1fr));
  }
}

@media (max-width: 1180px) {
  .finance-ledger-header,
  .finance-ledger-panels {
    grid-template-columns: 1fr;
  }

  .finance-ledger-controls {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  .finance-ledger-shell {
    padding: 16px;
  }

  .finance-ledger-controls,
  .finance-metrics-grid {
    grid-template-columns: 1fr;
  }

  .finance-panel-title-row {
    align-items: stretch;
  }

  .finance-action-btn {
    width: 100%;
  }
}

/* Modals overlays styling */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 19, 0.6);
  backdrop-filter: blur(8px);
  z-index: 30000;
  display: none;
  overflow-y: auto;
  padding: 20px 10px;
}

.modal-overlay.active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-card {
  width: 500px;
  max-width: 90vw;
  padding: 24px;
  margin: auto;
}

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

/* Mock File Upload Drop Box */
.mock-file-drop-box {
  border: 2px dashed var(--border-medium);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mock-file-drop-box:hover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.02);
  color: #fff;
}

/* System Notifications Wrapper */
.toast-wrapper {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-box {
  padding: 12px 20px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  border-left: 4px solid var(--accent-cyan);
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
  color: #fff;
  font-size: 0.8rem;
  animation: slide-in 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-box.success { border-left-color: var(--accent-emerald); }
.toast-box.error { border-left-color: var(--accent-rose); }
.toast-box.info { border-left-color: var(--accent-purple); }

.form-status-message {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
}

.form-status-message.error {
  border-color: rgba(244, 63, 94, 0.45);
  background: rgba(244, 63, 94, 0.08);
  color: var(--accent-rose);
}

.form-status-message.warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
}

.form-status-message.success {
  border-color: rgba(16, 185, 129, 0.42);
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Status reports logs card */
.status-report-log-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.reports-scroller {
  overflow-y: auto;
  padding-right: 4px;
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.15);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
}

/* Print Stylesheet for dynamic PDF generation support */
@media print {
  body {
    background: #fff;
    color: #000;
  }
  .app-wrapper {
    padding: 0;
  }
  .sidebar, .main-header, .filter-panel, .role-selector-wrap, .btn-primary, .btn-secondary, .btn-clear {
    display: none !important;
  }
  .content-viewport, .viewport-section {
    display: block !important;
  }
  .glass-panel {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    color: #000 !important;
  }
}

/* Premium Light Theme Overrides (Armstrong Dematic-Inspired) */
.light-theme, html.light-theme, body.light-theme {
  --bg-main: #eef2f6; /* Soft light gray-blue background */
  --bg-secondary: #ffffff; /* Clean white cards */
  --bg-tertiary: #f8fafc; /* Subtle light gray backgrounds */
  --border-light: rgba(15, 23, 42, 0.06);
  --border-medium: #cbd5e1; /* Replaced with solid premium gray borders */
  
  --text-main: #1e293b; /* Slate 800 */
  --text-secondary: #475569; /* Slate 600 */
  --text-muted: #64748b; /* Slate 500 */

  --brand-blue: #2398d3;
  --brand-blue-deep: #1f5f9f;
  --brand-yellow: #ffc82e;
  --brand-yellow-deep: #f0b322;
  --brand-ink: #101827;

  /* Armstrong Dematic Accents */
  --accent-purple: var(--brand-yellow-deep);
  --accent-cyan: var(--brand-blue);
  --accent-emerald: #059669; /* Emerald 600 */
  --accent-amber: #f9a459; /* Image Amber/Orange color */
  --accent-rose: #db2777; /* Pink 600 */
  --accent-red: #dc2626; /* Red 600 */
}

/* Card layout mimics */
body.light-theme .glass-panel {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02) !important;
  border-radius: 10px !important;
  overflow: hidden !important;
}

body.light-theme .wbs-panel {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02) !important;
  border-radius: 10px !important;
  padding: 16px !important;
}

/* Stepper Stage Gates Contrast Improvements */
body.light-theme .lifecycle-stage-container::before {
  background: #cbd5e1 !important;
}

body.light-theme .stage-dot {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

body.light-theme .stage-step.complete .stage-dot {
  background: var(--accent-emerald) !important;
  border-color: var(--accent-emerald) !important;
  color: #fff !important;
}

body.light-theme .stage-step.in-progress .stage-dot {
  background: var(--accent-cyan) !important;
  border-color: var(--accent-cyan) !important;
  color: #fff !important;
}

body.light-theme .stage-step.active .stage-dot {
  border-color: var(--brand-blue-deep) !important;
  box-shadow: 0 0 0 3px rgba(35, 152, 211, 0.3) !important;
}

body.light-theme .stage-step.active:not(.complete):not(.in-progress) .stage-dot {
  color: var(--brand-blue-deep) !important;
  background: #ffffff !important;
}

body.light-theme .stage-badge {
  background: var(--brand-yellow) !important;
  color: var(--brand-ink) !important;
  border-color: #ffffff !important;
}


/* Steel-Blue Header Strips Mimic from User Image */
body.light-theme .chart-panel h3 {
  background: #cbdcf0 !important; /* Steel-blue header block */
  color: #1e293b !important;
  padding: 10px 16px !important;
  margin: -20px -20px 14px -20px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1px solid #a2b9d6 !important;
}

body.light-theme .chart-panel {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

body.light-theme .chart-panel .canvas-wrap {
  background: #ffffff !important;
}

body.light-theme .filter-panel h3 {
  background: #cbdcf0 !important;
  color: #1e293b !important;
  padding: 10px 20px !important;
  margin: -16px -20px 14px -20px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  border-bottom: 1px solid #a2b9d6 !important;
  width: calc(100% + 40px) !important;
}

body.light-theme .wbs-panel > div:first-child {
  background: #cbdcf0 !important;
  margin: -16px -16px 14px -16px !important;
  padding: 10px 16px !important;
  border-bottom: 1px solid #a2b9d6 !important;
  border-top-left-radius: 9px !important;
  border-top-right-radius: 9px !important;
}

body.light-theme .wbs-panel > div:first-child h3 {
  color: #1e293b !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  margin: 0 !important;
}

body.light-theme #wsub-view-risks .wbs-panel > .risk-panel-title-row {
  margin: 0 !important;
  padding: 14px 20px !important;
  width: auto !important;
  background: #cbdcf0 !important;
}

/* Tables and grids styling */
body.light-theme .ppm-data-table th {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

body.light-theme .ppm-data-table td {
  background: #ffffff !important;
  color: #1e293b !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .ppm-data-table th:nth-child(1),
body.light-theme .ppm-data-table th:nth-child(2) {
  background: #f1f5f9 !important;
  box-shadow: 2px 0 0 #cbd5e1;
}

body.light-theme .ppm-data-table td:nth-child(1),
body.light-theme .ppm-data-table td:nth-child(2) {
  background: #ffffff !important;
  box-shadow: 2px 0 0 #cbd5e1;
}

body.light-theme .ppm-data-table strong {
  color: #1e293b !important;
}

.admin-risk-phase-table th:nth-child(1),
.admin-risk-phase-table td:nth-child(1),
.admin-risk-phase-table th:nth-child(2),
.admin-risk-phase-table td:nth-child(2),
body.light-theme .admin-risk-phase-table th:nth-child(1),
body.light-theme .admin-risk-phase-table td:nth-child(1),
body.light-theme .admin-risk-phase-table th:nth-child(2),
body.light-theme .admin-risk-phase-table td:nth-child(2) {
  position: static !important;
  left: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  box-shadow: none !important;
}

.admin-risk-phase-table th:nth-child(1),
.admin-risk-phase-table td:nth-child(1),
body.light-theme .admin-risk-phase-table th:nth-child(1),
body.light-theme .admin-risk-phase-table td:nth-child(1) {
  width: 75% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  padding-left: 12px !important;
  padding-right: 12px !important;
}

.admin-risk-phase-table th:nth-child(2),
.admin-risk-phase-table td:nth-child(2),
body.light-theme .admin-risk-phase-table th:nth-child(2),
body.light-theme .admin-risk-phase-table td:nth-child(2) {
  width: 25% !important;
  text-align: center !important;
  border-left: none !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

body.light-theme .gantt-row-line h5 {
  color: #1e293b;
}

body.light-theme .gantt-track-lane-wrap {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .gantt-element-bar {
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.12);
}

body.light-theme select,
body.light-theme input[type="text"],
body.light-theme input[type="password"],
body.light-theme input[type="email"],
body.light-theme textarea,
body.light-theme input[type="date"],
body.light-theme input[type="number"] {
  background: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.02) !important;
}

body.light-theme select option {
  background: #ffffff !important;
  color: #1e293b !important;
}

body.light-theme .modal-card {
  background: #ffffff !important;
  color: #1e293b !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12) !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .modal-card h3 {
  color: #1e293b !important;
}

body.light-theme .modal-card label {
  color: #475569 !important;
}

body.light-theme .modal-card input,
body.light-theme .modal-card select,
body.light-theme .modal-card textarea {
  background: #f8fafc !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .wsub-btn {
  color: #475569;
}

body.light-theme .wsub-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
}

body.light-theme .wsub-btn.active {
  background: var(--brand-blue) !important;
  color: #ffffff !important;
  border: 1px solid var(--brand-blue) !important;
  box-shadow: 0 4px 12px rgba(35, 152, 211, 0.16) !important;
}

body.light-theme .sidebar-nav button {
  color: #000000;
}

body.light-theme .sidebar-nav button.active {
  background: #cbdcf0 !important;
  color: #0284c7 !important;
  border: 1px solid #a2b9d6 !important;
}

body.light-theme .sidebar-nav button.active svg {
  color: #0284c7 !important;
}

body.light-theme .sidebar-nav button:hover {
  background: #f1f5f9;
  color: #000000;
}

body.light-theme .btn-secondary:hover {
  background: #f1f5f9 !important;
}

body.light-theme .btn-primary:hover {
  box-shadow: 0 0 12px rgba(35, 152, 211, 0.2) !important;
}

/* Main text overrides */
body.light-theme .brand-text h1,
body.light-theme .view-title,
body.light-theme h2,
body.light-theme h3,
body.light-theme h4,
body.light-theme h5,
body.light-theme .kpi-card .kpi-value,
body.light-theme .finance-card strong,
body.light-theme .meta-row strong,
body.light-theme .wbs-panel h3,
body.light-theme .admin-list-item span,
body.light-theme .status-report-log-card p strong,
body.light-theme #wo-milestones-list strong {
  color: #000000 !important;
}

body.light-theme p,
body.light-theme .brand-text span,
body.light-theme .role-selector-wrap span,
body.light-theme .kpi-card .kpi-label,
body.light-theme .finance-card span,
body.light-theme .finance-ledger-controls label span,
body.light-theme .finance-ledger-title p,
body.light-theme .finance-panel-title-row p,
body.light-theme .meta-row span {
  color: #000000 !important;
}

body.light-theme .role-select {
  color: #0284c7 !important;
}

body.light-theme #test-stat-total {
  color: #0f2f5f !important;
}

body.light-theme #test-stat-deviated {
  color: #047857 !important;
}

/* Theme contrast safety: never pair pale text with pale surfaces or dark text with dark surfaces. */
body:not(.light-theme) .glass-panel,
body:not(.light-theme) .wbs-panel,
body:not(.light-theme) .kpi-card,
body:not(.light-theme) .project-card-item,
body:not(.light-theme) .status-report-log-card,
body:not(.light-theme) .finance-card,
body:not(.light-theme) .gate-checklist-item {
  color: var(--text-main) !important;
}

body:not(.light-theme) .kpi-label,
body:not(.light-theme) .meta-row span,
body:not(.light-theme) .finance-card span,
body:not(.light-theme) .project-card-item p,
body:not(.light-theme) .status-report-log-card p {
  color: #cbd5e1 !important;
}

body.light-theme .kpi-indicator.positive,
body.light-theme .status-badge.approved {
  background: #dcfce7 !important;
  color: #065f46 !important;
  border-color: #86efac !important;
}

body.light-theme .kpi-indicator.neutral,
body.light-theme .status-badge.under_review {
  background: #e0f2fe !important;
  color: #075985 !important;
  border-color: #7dd3fc !important;
}

body.light-theme .kpi-indicator.negative,
body.light-theme .status-badge.rejected {
  background: #ffe4e6 !important;
  color: #9f1239 !important;
  border-color: #fda4af !important;
}

body.light-theme .status-badge.draft {
  background: #e2e8f0 !important;
  color: #334155 !important;
  border-color: #94a3b8 !important;
}

body.light-theme .status-badge.submitted {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-color: #fbbf24 !important;
}

body:not(.light-theme) .kpi-indicator.positive,
body:not(.light-theme) .status-badge.approved {
  background: rgba(16, 185, 129, 0.16) !important;
  color: #86efac !important;
  border-color: rgba(134, 239, 172, 0.35) !important;
}

body:not(.light-theme) .kpi-indicator.neutral,
body:not(.light-theme) .status-badge.under_review {
  background: rgba(56, 189, 248, 0.16) !important;
  color: #7dd3fc !important;
  border-color: rgba(125, 211, 252, 0.35) !important;
}

body:not(.light-theme) .kpi-indicator.negative,
body:not(.light-theme) .status-badge.rejected {
  background: rgba(244, 63, 94, 0.16) !important;
  color: #fda4af !important;
  border-color: rgba(253, 164, 175, 0.35) !important;
}

body:not(.light-theme) .status-badge.draft {
  background: rgba(148, 163, 184, 0.16) !important;
  color: #cbd5e1 !important;
  border-color: rgba(203, 213, 225, 0.32) !important;
}

body:not(.light-theme) .status-badge.submitted {
  background: rgba(251, 191, 36, 0.16) !important;
  color: #fde68a !important;
  border-color: rgba(253, 230, 138, 0.35) !important;
}

body:not(.light-theme) .master-toolbar-btn,
body:not(.light-theme) .graph-export-btn,
body:not(.light-theme) .btn-secondary {
  background: rgba(15, 23, 42, 0.72) !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
  color: #dbeafe !important;
}

body:not(.light-theme) .master-toolbar-btn:hover,
body:not(.light-theme) .graph-export-btn:hover,
body:not(.light-theme) .btn-secondary:hover {
  background: rgba(56, 189, 248, 0.18) !important;
  border-color: rgba(125, 211, 252, 0.54) !important;
  color: #f8fafc !important;
}

body.light-theme .rpn-high,
body.light-theme .delay-negative {
  color: #b91c1c !important;
}

body.light-theme .rpn-medium {
  color: #92400e !important;
}

body.light-theme .rpn-low,
body.light-theme .delay-positive {
  color: #065f46 !important;
}

body.light-theme .fat-sat-filter-bar button.active {
  color: #083344 !important;
}

body.light-theme .role-selector-wrap,
body.light-theme .theme-toggle-wrap {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .glass-panel:hover {
  border-color: #cbd5e1 !important;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04) !important;
}

body.light-theme .admin-list-item,
body.light-theme .status-report-log-card,
body.light-theme .finance-card,
body.light-theme .gate-checklist-item {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #000000 !important;
}

body.light-theme .finance-card {
  background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07) !important;
}

body.light-theme .finance-card--budget   { background: linear-gradient(145deg, rgba(56,189,248,0.08) 0%, #f8fafc 70%) !important; border-color: rgba(56,189,248,0.35) !important; }
body.light-theme .finance-card--forecast { background: linear-gradient(145deg, rgba(34,211,238,0.07) 0%, #f8fafc 70%) !important; border-color: rgba(34,211,238,0.32) !important; }
body.light-theme .finance-card--actual   { background: linear-gradient(145deg, rgba(251,191,36,0.08) 0%, #f8fafc 70%) !important; border-color: rgba(251,191,36,0.35) !important; }
body.light-theme .finance-card--variance { background: linear-gradient(145deg, rgba(52,211,153,0.07) 0%, #f8fafc 70%) !important; border-color: rgba(52,211,153,0.32) !important; }
body.light-theme .finance-card--benefit  { background: linear-gradient(145deg, rgba(16,185,129,0.07) 0%, #f8fafc 70%) !important; border-color: rgba(16,185,129,0.32) !important; }
body.light-theme .finance-card--roi      { background: linear-gradient(145deg, rgba(167,139,250,0.08) 0%, #f8fafc 70%) !important; border-color: rgba(167,139,250,0.35) !important; }
body.light-theme .finance-card--variance.finance-card--danger { background: linear-gradient(145deg, rgba(248,113,113,0.08) 0%, #f8fafc 70%) !important; border-color: rgba(248,113,113,0.35) !important; }

body.light-theme .finance-card::before {
  opacity: 1;
}

body.light-theme .finance-card-year {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0369a1 !important;
}

body.light-theme .finance-toolbar {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .manual-query-panel,
body.light-theme .manual-toc-panel,
body.light-theme .manual-section-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .manual-answer-box {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0f172a !important;
}

body.light-theme .manual-section-card li,
body.light-theme .manual-section-card p,
body.light-theme .manual-toc-item,
body.light-theme .user-manual-header p {
  color: #0f172a !important;
}

/* ==================== 9. PROJECT DETAIL MAP VIEW ==================== */
.detail-tree-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 0;
}

.product-detail-ribbon-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-detail-ribbon-block {
  display: flex;
  flex-direction: column;
}

.product-detail-ribbon {
  min-height: 92px;
}

.product-detail-ribbon.expanded {
  border-color: rgba(35, 152, 211, 0.45) !important;
}

.product-detail-expanded-tree {
  margin: -4px 0 8px 14px;
  padding-left: 20px;
  border-left: 1px dashed var(--border-medium);
}

.tree-node {
  display: flex;
  flex-direction: column;
  position: relative;
}

.tree-node-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
  position: relative;
  overflow: hidden; /* Prevent ribbon from overflowing rounded corners */
}

.tree-node-header:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-medium);
}

.tree-node-content {
  display: flex;
  flex-direction: column;
  padding-left: 20px;
  margin-left: 26px;
  border-left: 1px dashed var(--border-medium);
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.node-project {
  border: 1px solid rgba(255, 200, 46, 0.25) !important;
  background: linear-gradient(135deg, rgba(255, 200, 46, 0.06), rgba(35, 152, 211, 0.06)) !important;
  box-shadow: 0 0 15px rgba(35, 152, 211, 0.1) !important;
}

.node-project h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

/* Tree Node Ribbon Tiers styles */
.tree-node-ribbon {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-top-left-radius: 9px;
  border-bottom-left-radius: 9px;
}

.project-ribbon {
  background: linear-gradient(180deg, var(--accent-purple), var(--accent-cyan));
  box-shadow: 0 0 10px rgba(35, 152, 211, 0.35);
}

.milestone-ribbon {
  background: var(--accent-purple);
  box-shadow: 0 0 10px rgba(255, 200, 46, 0.35);
}

.task-ribbon {
  background: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.subtask-ribbon {
  background: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.subsubtask-ribbon {
  background: var(--text-muted);
}

/* Background Tints and Borders by levels */
.node-milestone {
  background: rgba(255, 200, 46, 0.05) !important;
  border-color: rgba(255, 200, 46, 0.22) !important;
}

.node-task {
  background: rgba(35, 152, 211, 0.05) !important;
  border-color: rgba(35, 152, 211, 0.2) !important;
}

.node-subtask {
  background: rgba(16, 185, 129, 0.04) !important;
  border-color: rgba(16, 185, 129, 0.15) !important;
}

.node-subsubtask {
  background: rgba(100, 116, 139, 0.04) !important;
  border-color: rgba(100, 116, 139, 0.15) !important;
}

.tree-toggle-arrow {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  user-select: none;
  cursor: pointer;
}

.tree-toggle-arrow.collapsed {
  transform: rotate(-90deg);
}

.tree-node-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.tree-node-progress-bar {
  width: 80px;
  height: 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.tree-node-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
}

/* Light Theme Overrides */
body.light-theme .tree-node-header {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #000000 !important;
}

body.light-theme .tree-node-header:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
}

body.light-theme .tree-node-content {
  border-left-color: #cbd5e1 !important;
}

body.light-theme .node-project {
  background: linear-gradient(135deg, rgba(255, 200, 46, 0.04), rgba(35, 152, 211, 0.04)) !important;
  border-color: rgba(255, 200, 46, 0.26) !important;
}

body.light-theme .node-project h3 {
  color: #000000 !important;
}

body.light-theme .node-milestone {
  background: #fff9e5 !important;
  border-color: #fde68a !important;
}

body.light-theme .node-task {
  background: #eef9ff !important;
  border-color: #bae6fd !important;
}

body.light-theme .node-subtask {
  background: #f0fdf4 !important;
  border-color: #dcfce7 !important;
}

body.light-theme .node-subsubtask {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .tree-node-header span {
  color: #000000 !important;
}

body.light-theme .tree-node-meta span {
  color: #000000 !important;
}

body.light-theme .tree-node-progress-bar {
  background: rgba(0, 0, 0, 0.06) !important;
}

/* WBS Inline Edit inputs */
.inline-table-input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  font-size: 0.72rem;
  padding: 4px 6px;
  border-radius: 4px;
  width: 100%;
  transition: var(--transition-smooth);
  font-family: inherit;
  cursor: pointer;
  box-sizing: border-box;
}

.inline-table-input:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-medium);
}

.inline-table-input:focus {
  background: var(--bg-tertiary);
  border-color: var(--accent-cyan);
  outline: none;
  box-shadow: 0 0 4px rgba(6, 182, 212, 0.3);
}

.inline-table-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text-secondary) !important;
}

body.light-theme .inline-table-input {
  color: #000000;
}

body.light-theme .inline-table-input:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: #cbd5e1;
}

body.light-theme .inline-table-input:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 4px rgba(2, 132, 199, 0.3);
}

body.light-theme .inline-table-input:disabled {
  color: #64748b !important;
}

/* WBS Inline Editable Text Triggers */
.inline-editable-text {
  cursor: pointer;
  font-size: 0.72rem;
  transition: var(--transition-smooth);
  padding: 3px 6px;
  border-radius: 4px;
  display: inline-block;
  text-align: center;
  box-sizing: border-box;
  white-space: nowrap;
}

.inline-editable-text:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.light-theme .inline-editable-text:hover {
  background: rgba(0, 0, 0, 0.04);
}

.assignee-link {
  color: #38bdf8;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.light-theme .assignee-link {
  color: #0284c7;
}

.date-link {
  color: var(--text-main);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.2);
}

body.light-theme .date-link {
  color: #000000;
  text-decoration-color: rgba(0, 0, 0, 0.2);
}

/* WBS Delay Variance Coloring */
.delay-positive {
  color: #f87171;
  font-weight: 600;
  font-size: 0.75rem;
}
body.light-theme .delay-positive {
  color: #dc2626;
}

.delay-negative {
  color: #4ade80;
  font-weight: 600;
  font-size: 0.75rem;
}
body.light-theme .delay-negative {
  color: #16a34a;
}

.delay-zero {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* WBS Summary Dashboard Styles */
.wbs-summary-dashboard-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-smooth);
}
.wbs-summary-dashboard-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-highlight);
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.kpi-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-display);
}
.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.critical-chain-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(239, 68, 68, 0.05);
  border: 1px dashed rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  margin-top: 12px;
  margin-bottom: 16px;
}
.critical-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
body.light-theme .critical-badge {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.2);
}

/* Resource Capacity Heatmap styles */
.capacity-heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
}

.capacity-heatmap-table th {
  padding: 8px 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  text-align: center;
  border-radius: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
}

.capacity-heatmap-table th.clickable-month {
  cursor: pointer;
  transition: var(--transition-smooth);
}

.capacity-heatmap-table th.clickable-month:hover {
  background: var(--border-medium);
  color: var(--text-main);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

.capacity-cell {
  padding: 10px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  transition: var(--transition-smooth);
  cursor: default;
  position: relative;
}

.capacity-cell:hover {
  filter: brightness(1.2);
  transform: scale(1.02);
}

.capacity-cell.available {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
}

.capacity-cell.occupied {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.capacity-cell.overloaded {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

/* Light theme overrides */
body.light-theme .capacity-cell.available {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.2);
  color: #0284c7;
}

body.light-theme .capacity-cell.occupied {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.2);
  color: #16a34a;
}

body.light-theme .capacity-cell.overloaded {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  color: #d97706;
}

.capacity-cell.clickable {
  cursor: pointer;
}

.capacity-cell.clickable:hover {
  filter: brightness(1.25);
  transform: translateY(-1px);
  box-shadow: 0 0 12px currentColor;
}

.task-row-highlighted {
  animation: row-flash 3s ease-out;
}

@keyframes row-flash {
  0% {
    box-shadow: inset 0 0 15px var(--accent-cyan);
    background: rgba(6, 182, 212, 0.2) !important;
  }
  100% {
    box-shadow: inset 0 0 0 transparent;
    background: transparent;
  }
}

.capacity-heatmap-table th.clickable-header {
  cursor: pointer;
  transition: var(--transition-smooth);
}

.capacity-heatmap-table th.clickable-header:hover {
  background: var(--border-medium);
  color: var(--text-main);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

#resources-grid-container {
  width: 100%;
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
}

/* Sticky cells for the capacity heatmap grid */
.capacity-heatmap-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}

/* Add borders to sticky cells since border-spacing is 0 */
.capacity-heatmap-table th,
.capacity-heatmap-table td {
  border: 1px solid var(--border-light);
}

/* Vertically sticky headers by row levels */
.capacity-heatmap-table thead tr:nth-child(1) th {
  position: sticky;
  top: 0px;
  z-index: 10;
  background: var(--bg-tertiary);
}

.capacity-heatmap-table thead tr:nth-child(2) th {
  position: sticky;
  top: 37px;
  z-index: 10;
  background: var(--bg-tertiary);
}

.capacity-heatmap-table thead tr:nth-child(3) th {
  position: sticky;
  top: 74px;
  z-index: 10;
  background: var(--bg-tertiary);
}

.capacity-heatmap-table thead tr:nth-child(4) th {
  position: sticky;
  top: 111px;
  z-index: 10;
  background: var(--bg-tertiary);
}

/* Horizontally sticky first two columns */
.capacity-heatmap-table td:nth-child(1),
.capacity-heatmap-table thead tr:first-child th:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--bg-secondary) !important;
  border-right: 2px solid var(--border-medium);
  min-width: 180px;
  max-width: 180px;
  width: 180px;
  box-sizing: border-box;
}

.capacity-heatmap-table td:nth-child(2),
.capacity-heatmap-table thead tr:first-child th:nth-child(2) {
  position: sticky;
  left: 180px;
  z-index: 5;
  background: var(--bg-secondary) !important;
  border-right: 2px solid var(--border-medium);
  min-width: 150px;
  max-width: 150px;
  width: 150px;
  box-sizing: border-box;
}

/* Sticky intersection cells (thead first two columns need higher z-index than both headers and columns) */
.capacity-heatmap-table thead tr:first-child th:nth-child(1) {
  top: 0;
  z-index: 15;
}

.capacity-heatmap-table thead tr:first-child th:nth-child(2) {
  top: 0;
  z-index: 15;
}

/* Light theme overrides for sticky backgrounds */
body.light-theme .capacity-heatmap-table td:nth-child(1),
body.light-theme .capacity-heatmap-table td:nth-child(2) {
  background: #ffffff !important;
  border-right: 2px solid #cbd5e1;
}

body.light-theme .capacity-heatmap-table thead th {
  background: #cbdcf0 !important;
  color: #1e293b !important;
}

body.light-theme .capacity-heatmap-table thead tr:first-child th:nth-child(1),
body.light-theme .capacity-heatmap-table thead tr:first-child th:nth-child(2) {
  background: #cbdcf0 !important;
  border-right: 2px solid #cbd5e1;
}

/* Master Toolbar & Button Styling */
.master-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--border-medium);
  border-radius: 8px;
  margin-bottom: 12px;
  backdrop-filter: blur(8px);
}

body.light-theme .master-toolbar {
  background: rgba(15, 23, 42, 0.02);
  border: 1px dashed #cbd5e1;
}

.master-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  text-decoration: none;
}

.master-toolbar-btn:hover {
  background: var(--border-light);
  color: var(--text-main);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.15);
}

body.light-theme .master-toolbar-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
}

body.light-theme .master-toolbar-btn:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #0284c7;
}

.graph-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(203, 220, 240, 0.6);
  border: 1px solid #a2b9d6;
  color: #1e4976;
  text-decoration: none;
}

.graph-export-btn:hover {
  background: #b8d0e8;
  color: #0f2d4a;
  border-color: #7ea8cc;
  box-shadow: 0 2px 6px rgba(15, 45, 74, 0.12);
}

body.light-theme .graph-export-btn {
  background: rgba(2, 132, 199, 0.08);
  border: 1px solid rgba(2, 132, 199, 0.25);
  color: #0284c7;
}

body.light-theme .graph-export-btn:hover {
  background: #0284c7;
  color: #ffffff;
}

/* ==================== DIGITAL TWIN PORTFOLIO MAP & ENGINEERING MODULE STYLES ==================== */

.warehouse-svg {
  background: radial-gradient(circle at center, rgba(16, 24, 48, 0.4), rgba(6, 8, 16, 0.8));
  border-radius: 8px;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.equipment-group {
  transition: all 0.3s ease;
  cursor: pointer;
}

.equipment-group:hover {
  filter: drop-shadow(0 0 12px var(--glow-color, rgba(6, 182, 212, 0.6)));
}

.equipment-bg {
  fill: rgba(30, 41, 59, 0.6);
  stroke: rgba(255,255,255,0.1);
  stroke-width: 1.5;
  transition: all 0.3s ease;
}

.equipment-group:hover .equipment-bg {
  stroke: var(--glow-color, #06b6d4);
  fill: rgba(30, 41, 59, 0.85);
}

.equipment-label {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 600;
  fill: #e2e8f0;
  pointer-events: none;
}

.equipment-status-indicator {
  stroke-width: 2;
  transition: all 0.3s ease;
}

/* Status glowing and pulsing states */
.dt-status-green {
  fill: var(--accent-emerald, #10b981);
  stroke: var(--accent-emerald, #10b981);
  animation: pulse-emerald 2s infinite;
}

.dt-status-amber {
  fill: var(--accent-amber, #f59e0b);
  stroke: var(--accent-amber, #f59e0b);
  animation: pulse-amber 2s infinite;
}

.dt-status-red {
  fill: var(--accent-rose, #f43f5e);
  stroke: var(--accent-rose, #f43f5e);
  animation: pulse-rose 2s infinite;
}

.dt-status-muted {
  fill: var(--text-muted, #6b7280);
  stroke: var(--text-muted, #6b7280);
}

@keyframes pulse-emerald {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

@keyframes pulse-amber {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

@keyframes pulse-rose {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* Animations for equipment flows */
.conveyor-belt-flow {
  stroke-dasharray: 6 6;
  animation: conveyor-move 4s linear infinite;
}

@keyframes conveyor-move {
  to {
    stroke-dashoffset: -24;
  }
}

.amr-vehicle {
  animation: amr-bounce 1.5s ease-in-out infinite alternate;
}

@keyframes amr-bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}

.shuttle-crane {
  animation: shuttle-glide 8s ease-in-out infinite;
}

@keyframes shuttle-glide {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(0, 45px); }
}

/* Slide-out details panel elements */
.twin-inspector-header {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.twin-inspector-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.twin-inspector-detail-row span {
  color: var(--text-secondary);
}

.twin-inspector-detail-row strong {
  color: var(--text-main);
}

.digital-twin-subtabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light);
  margin: 4px 0 18px;
  padding-bottom: 10px;
}

.digital-twin-subpanel {
  display: none;
}

.digital-twin-subpanel.active {
  display: block;
}

.digital-twin-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-secondary);
}

.digital-twin-panel-head h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 1rem;
}

.digital-twin-panel-head p {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.4;
}

.digital-twin-health-legend {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--bg-tertiary);
}

.digital-twin-health-legend span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 800;
}

.digital-twin-health-legend div {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-main);
}

.digital-twin-health-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.simulator-workbench {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  min-height: 420px;
}

.simulator-product-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: var(--bg-secondary);
  align-self: start;
}

.simulator-upload-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.simulator-upload-panel h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 1rem;
}

.simulator-upload-panel p {
  margin: -4px 0 4px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.35;
}

.simulator-upload-panel label {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
}

.simulator-upload-panel input[type="file"] {
  font-size: 0.72rem;
  color: var(--text-main);
}

.simulator-empty-state {
  border: 1px dashed var(--border-medium);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.35;
}

.sim-product-tab {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-main);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.18s ease;
}

.sim-product-tab .sim-tab-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.sim-product-tab .sim-remove-btn {
  border: 1px solid rgba(219, 39, 119, 0.45);
  color: var(--accent-rose);
  background: transparent;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.66rem;
  cursor: pointer;
}

.sim-product-tab span {
  font-size: 0.82rem;
  font-weight: 800;
}

.sim-product-tab small {
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1.25;
}

.sim-product-tab.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(33, 102, 165, 0.24);
}

.sim-product-tab.active small {
  color: rgba(255, 255, 255, 0.82);
}

.sim-product-tab .sim-product-name {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.25;
}

.sim-product-tab.active .sim-product-name {
  color: rgba(255, 255, 255, 0.9);
}

.simulator-frame-card {
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  background: var(--bg-primary);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.simulator-frame-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.simulator-table-wrap {
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-primary);
}

.simulator-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 0.74rem;
}

.simulator-table th,
.simulator-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  color: var(--text-main);
  vertical-align: middle;
}

.simulator-table th {
  color: var(--text-secondary);
  font-weight: 800;
  background: var(--bg-secondary);
}

.simulator-table .sim-table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.simulator-table .sim-table-actions button {
  padding: 4px 8px;
  font-size: 0.68rem;
}

.simulator-frame-header h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 0.98rem;
}

.simulator-frame-header p {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 0.74rem;
}

@media (max-width: 900px) {
  .simulator-workbench {
    grid-template-columns: 1fr;
  }

  .simulator-product-tabs {
    align-self: stretch;
  }
}

/* Progress track meters */
.progress-pills-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.progress-pill-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-light);
  padding: 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-pill-box span {
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.progress-pill-box strong {
  font-size: 0.82rem;
  color: var(--text-main);
}

/* Tooltips */
.layout-tooltip {
  position: absolute;
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent-cyan);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.75rem;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 10px 20px rgba(0,0,0,0.5);
  display: none;
  color: #fff;
}

/* CAD Discipline Fading Rules */
.cad-layer-mech .equipment-group:not(.mech) {
  opacity: 0.15;
  filter: grayscale(85%);
  pointer-events: none;
}
.cad-layer-elec .equipment-group:not(.elec) {
  opacity: 0.15;
  filter: grayscale(85%);
  pointer-events: none;
}
.cad-layer-fw .equipment-group:not(.fw) {
  opacity: 0.15;
  filter: grayscale(85%);
  pointer-events: none;
}
.cad-layer-sw .equipment-group:not(.sw) {
  opacity: 0.15;
  filter: grayscale(85%);
  pointer-events: none;
}

/* Simulate active animation modifiers */
.simulating-active .conveyor-belt-flow {
  animation-duration: 1.5s !important;
}
.simulating-active .shuttle-crane {
  animation-duration: 2s !important;
}
.simulating-active .amr-vehicle {
  animation-duration: 0.8s !important;
}

/* Active pulse dot animation */
@keyframes sim-pulse-dot {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 0.8; }
}
#dt-sim-pulse-dot.pulsing {
  display: inline-block !important;
  animation: sim-pulse-dot 1.5s infinite ease-in-out;
}

/* ============================================================
   PHASE 2 — World-Class PPM Feature Styles
   ============================================================ */

/* KPI Strip Grid */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

/* EVM Section */
#wsub-view-evm .evm-baseline-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.8rem;
}

/* FAT/SAT filter buttons */
.fat-sat-filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.fat-sat-filter-bar button.active {
  background: var(--accent-cyan);
  color: #000;
  font-weight: 700;
}

/* Punch List severity colors */
tr[data-severity="Critical"] td:first-child {
  border-left: 3px solid #ef4444;
}
tr[data-severity="Major"] td:first-child {
  border-left: 3px solid var(--accent-amber);
}

/* FMEA RPN heat color classes */
.rpn-high { color: #ef4444; font-weight: 800; }
.rpn-medium { color: var(--accent-amber); font-weight: 700; }
.rpn-low { color: var(--accent-emerald); font-weight: 600; }

/* Skills Matrix proficiency cells */
.skills-matrix-table td select {
  cursor: pointer;
  transition: background 0.15s;
}
.skills-matrix-table td select:hover {
  opacity: 0.85;
}

#skills-matrix-table th,
#skills-matrix-table td {
  color: var(--text-main) !important;
}

#skills-matrix-table thead th {
  background: rgba(31, 95, 159, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.32) !important;
  color: #e5f2ff !important;
}

#skills-matrix-table tbody td {
  background: rgba(15, 23, 42, 0.58) !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
}

#skills-matrix-table .skills-proficiency-select {
  min-width: 92px;
  color: var(--text-main) !important;
}

#skills-matrix-table .skills-proficiency-select option {
  background: var(--bg-secondary);
  color: var(--text-main);
}

body.light-theme #skills-matrix-table thead th {
  background: #cbdcf0 !important;
  border-color: #a2b9d6 !important;
  color: #0f172a !important;
}

body.light-theme #skills-matrix-table tbody td {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #172033 !important;
}

/* Proficiency legend */
.proficiency-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.72rem;
  padding: 8px 0;
}
.proficiency-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.proficiency-legend .legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Roadmap bars */
.roadmap-container {
  overflow-x: auto;
  padding-bottom: 8px;
}
.roadmap-bar {
  transition: opacity 0.15s;
  cursor: pointer;
}
.roadmap-bar:hover {
  opacity: 1 !important;
  filter: brightness(1.15);
}

/* Lessons Learned cards */
#lessons-list .glass-panel {
  transition: border-left-color 0.2s;
  margin-bottom: 10px;
}
#lessons-list .glass-panel:hover {
  border-left-width: 4px;
}

/* Alert Rules toggle switch track */
.toggle-switch input:checked + span {
  background: var(--accent-cyan) !important;
}

/* Alert log strip */
#alert-log-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
}

/* Performance chart containers */
.perf-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 900px) {
  .perf-charts-row { grid-template-columns: 1fr; }
}

/* Workspace sub-tab scrollable table wrapper */
.wsub-table-scroll {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}
.wsub-table-scroll table {
  min-width: 900px;
}

/* FMEA table needs more room */
#fmea-table-scroll {
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}
#fmea-table-scroll table {
  min-width: 1600px;
}

/* ============================================================
   UX ENHANCEMENT — PHASE 3
   Persistent sidebar, save-sync indicator, interactive cards
   ============================================================ */

/* ——— Sidebar: always-expanded on desktop ——————————————— */
@media (min-width: 981px) {
  .sidebar {
    width: 70px !important;
    height: calc(100vh - 110px) !important;
    box-sizing: border-box !important;
    padding: 10px 8px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: none !important;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .sidebar::-webkit-scrollbar {
    width: 4px;
  }
  .sidebar:hover {
    width: 240px !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(255,255,255,0.2) transparent !important;
  }
  .sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2) !important;
    border-radius: 4px !important;
  }
  .sidebar:not(:hover) .sidebar-group-label,
  .sidebar:not(:hover) .sidebar-divider {
    display: none !important;
  }
  .sidebar:not(:hover) .nav-btn,
  .sidebar:not(:hover) .nav-btn.active,
  .sidebar:not(:hover) .nav-btn:hover {
    color: transparent !important;
  }
  .sidebar:not(:hover) .nav-btn svg {
    color: var(--text-muted) !important;
  }
  .sidebar:not(:hover) .nav-btn.active svg {
    color: var(--accent-cyan) !important;
  }
  .sidebar:hover .nav-btn {
    color: var(--text-secondary) !important;
  }
  .sidebar:hover .nav-btn.active {
    color: #fff !important;
  }
  .nav-btn { font-size: 0.8rem !important; padding: 8px 10px !important; }
  .sidebar-nav { gap: 4px !important; }
  .console-body { gap: 12px !important; }
}

/* ——— Sidebar group labels —————————————————————————————— */
.sidebar-group-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px 2px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 0.7;
}
.sidebar-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 8px;
  opacity: 0.5;
}

/* ——— Nav button improvements ——————————————————————————— */
.nav-btn {
  position: relative;
  border-radius: 8px !important;
}
.nav-btn.active {
  background: linear-gradient(120deg, rgba(6,182,212,0.15), rgba(96,165,250,0.1)) !important;
  border: 1px solid rgba(6,182,212,0.28) !important;
  color: #fff !important;
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent-cyan);
  border-radius: 0 3px 3px 0;
}
.nav-btn.active svg { color: var(--accent-cyan) !important; }
.nav-btn:hover {
  background: rgba(6,182,212,0.08) !important;
  color: var(--text-main, #f1f5f9) !important;
}
body.light-theme .nav-btn:hover {
  background: rgba(35,152,211,0.10) !important;
  color: #1e293b !important;
}
body.light-theme .nav-btn {
  color: #334155 !important;
}
body.light-theme .nav-btn.active {
  color: #1e293b !important;
  background: linear-gradient(120deg, rgba(35,152,211,0.18), rgba(96,165,250,0.12)) !important;
  border: 1px solid rgba(35,152,211,0.35) !important;
}
body.light-theme .nav-btn svg { color: #475569 !important; }
body.light-theme .nav-btn.active svg { color: var(--accent-cyan) !important; }
body.light-theme .nav-btn:hover svg { color: var(--accent-cyan) !important; }
body.light-theme .sidebar-group-label { color: #64748b !important; }
body.light-theme .sidebar-divider { background: #cbd5e1 !important; }

/* ——— Save/sync status indicator ———————————————————————— */
#save-status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  transition: all 0.3s;
  min-width: 130px;
  justify-content: center;
}
#save-status-indicator .save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.3s;
}
#save-status-indicator.status-saved   .save-dot { background: #34d399; }
#save-status-indicator.status-saving  .save-dot { background: var(--accent-amber); animation: save-pulse 0.8s infinite; }
#save-status-indicator.status-error   .save-dot { background: #ef4444; }
#save-status-indicator.status-unsaved .save-dot { background: var(--accent-amber); }
#save-status-indicator.status-saved  { border-color: rgba(52,211,153,0.25); }
#save-status-indicator.status-error  { border-color: rgba(239,68,68,0.3); }
@keyframes save-pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ——— Dashboard project quick-cards ———————————————————— */
.project-cards-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
  max-height: 500px;
  opacity: 1;
  transform: scaleY(1);
  transform-origin: top;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-cards-strip.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  transform: scaleY(0) !important;
  pointer-events: none !important;
}

.project-quick-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--border-light);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme .project-quick-card {
  background: rgba(248, 250, 252, 0.8);
  border-color: rgba(15, 23, 42, 0.06);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.03);
}

.project-quick-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-cyan);
  box-shadow: 0 12px 24px rgba(6, 182, 212, 0.18);
  background: rgba(30, 41, 59, 0.6);
}

body.light-theme .project-quick-card:hover {
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(6, 182, 212, 0.1);
}

.project-quick-card .pqc-status-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  opacity: 0.85;
}

.project-quick-card .pqc-name {
  font-size: 0.88rem;
  font-weight: 750;
  color: var(--text-main);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-quick-card .pqc-meta {
  font-size: 0.73rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-quick-card .pqc-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  display: inline-block;
  margin-top: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Dashboard Ribbon toggle button styles */
#toggle-dashboard-ribbon-btn {
  transition: all 0.2s ease;
}
#toggle-dashboard-ribbon-btn:hover {
  transform: scale(1.03);
}
#toggle-dashboard-ribbon-btn.ribbon-hidden {
  background: rgba(35, 152, 211, 0.15) !important;
  border-color: rgba(35, 152, 211, 0.3) !important;
  color: var(--brand-blue) !important;
}

/* ——— Better table interactions ———————————————————————— */
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: rgba(6,182,212,0.05) !important; }
.data-table thead th {
  font-size: 0.72rem !important;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ——— Workspace breadcrumb ————————————————————————————— */
#workspace-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-secondary);
  padding-bottom: 4px;
}
#workspace-breadcrumb .crumb-active { color: var(--accent-cyan); font-weight: 600; }

/* ——— Empty state component ———————————————————————————— */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 12px;
  color: var(--text-secondary);
}
.empty-state .empty-icon { font-size: 2.5rem; opacity: 0.4; }
.empty-state .empty-title { font-size: 0.95rem; font-weight: 600; color: var(--text-main); }
.empty-state .empty-sub { font-size: 0.78rem; max-width: 320px; line-height: 1.6; }

/* ——— Sub-tab bar improvements ————————————————————————— */
.wsub-btn {
  border-radius: 6px !important;
  font-size: 0.78rem !important;
  padding: 6px 12px !important;
  transition: all 0.15s !important;
  white-space: nowrap;
}
.wsub-btn.active {
  background: rgba(6,182,212,0.18) !important;
  color: var(--accent-cyan) !important;
  border-color: rgba(6,182,212,0.3) !important;
}
.wsub-btn:hover:not(.active) {
  background: rgba(255,255,255,0.06) !important;
  color: #fff !important;
}
body.light-theme .wsub-btn:hover:not(.active) {
  background: rgba(35,152,211,0.12) !important;
  color: #0f172a !important;
  border-color: rgba(35,152,211,0.32) !important;
}

/* ——— KPI cards interactive ———————————————————————————— */
.kpi-card { transition: transform 0.15s, box-shadow 0.15s !important; }
.kpi-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3) !important;
}

/* â”€â”€ Form focus glow â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.form-input:focus, input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 0 2px rgba(6,182,212,0.15) !important;
}

/* â”€â”€ Scrollbar styling â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* â”€â”€ Field unsaved flash â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@keyframes field-flash {
  0% { box-shadow: 0 0 0 2px rgba(251,191,36,0.6); }
  100% { box-shadow: none; }
}
.field-just-saved { animation: field-flash 1.2s ease-out; }

/* â”€â”€ Responsive: collapse sidebar on small screens â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 980px) {
  .sidebar {
    width: 56px !important;
    height: calc(100vh - 160px) !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar {
    display: none;
  }
  .sidebar:hover { width: 220px !important; }
  .sidebar-group-label { display: none; }
  .sidebar:not(:hover) .sidebar-divider { display: none !important; }
  .sidebar:not(:hover) .nav-btn { color: transparent !important; }
  .sidebar:not(:hover) .nav-btn svg { color: var(--text-muted) !important; }
  .sidebar:not(:hover) .nav-btn.active svg { color: var(--accent-cyan) !important; }
}

/* —— Responsive: dashboard quick cards horizontal scroll —— */
@media (max-width: 768px) {
  .project-cards-strip {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    gap: 12px !important;
    padding-bottom: 8px !important;
    scrollbar-width: thin !important;
  }
  .project-cards-strip::-webkit-scrollbar {
    height: 3px !important;
  }
  .project-cards-strip::-webkit-scrollbar-thumb {
    background: var(--border-medium) !important;
    border-radius: 3px !important;
  }
  .project-quick-card {
    flex: 0 0 220px !important;
  }
}

/* Final theme contrast guard */
body.light-theme .glass-panel,
body.light-theme .chart-panel,
body.light-theme .wbs-panel,
body.light-theme .workspace-ribbon,
body.light-theme .workspace-tab-panel,
body.light-theme .finance-subpage-panel,
body.light-theme .active-db-section,
body.light-theme .database-backend-panel,
body.light-theme .ppm-data-table,
body.light-theme .sample-file-table,
body.light-theme .modal-card,
body.light-theme .filter-panel {
  color: #172033 !important;
}

body.light-theme .glass-panel p,
body.light-theme .glass-panel span,
body.light-theme .chart-panel p,
body.light-theme .chart-panel span,
body.light-theme .wbs-panel p,
body.light-theme .wbs-panel span,
body.light-theme .workspace-ribbon p,
body.light-theme .workspace-ribbon span,
body.light-theme .finance-subpage-panel p,
body.light-theme .finance-subpage-panel span,
body.light-theme .active-db-section p,
body.light-theme .active-db-section span,
body.light-theme .database-backend-panel p,
body.light-theme .database-backend-panel span,
body.light-theme .filter-panel p,
body.light-theme .filter-panel span,
body.light-theme .modal-card p,
body.light-theme .modal-card span {
  color: #334155 !important;
}

body.light-theme .glass-panel h1,
body.light-theme .glass-panel h2,
body.light-theme .glass-panel h3,
body.light-theme .glass-panel h4,
body.light-theme .chart-panel h3,
body.light-theme .wbs-panel h3,
body.light-theme .workspace-ribbon h1,
body.light-theme .workspace-ribbon h2,
body.light-theme .workspace-ribbon h3,
body.light-theme .finance-subpage-panel h3,
body.light-theme .active-db-section h3,
body.light-theme .database-backend-panel h3,
body.light-theme .modal-card h3 {
  color: #0f172a !important;
}

body:not(.light-theme) .glass-panel,
body:not(.light-theme) .chart-panel,
body:not(.light-theme) .wbs-panel,
body:not(.light-theme) .workspace-ribbon,
body:not(.light-theme) .workspace-tab-panel,
body:not(.light-theme) .finance-subpage-panel,
body:not(.light-theme) .active-db-section,
body:not(.light-theme) .database-backend-panel,
body:not(.light-theme) .ppm-data-table,
body:not(.light-theme) .sample-file-table,
body:not(.light-theme) .modal-card,
body:not(.light-theme) .filter-panel {
  color: #e5edf8 !important;
}

body:not(.light-theme) .glass-panel p,
body:not(.light-theme) .glass-panel span,
body:not(.light-theme) .chart-panel p,
body:not(.light-theme) .chart-panel span,
body:not(.light-theme) .wbs-panel p,
body:not(.light-theme) .wbs-panel span,
body:not(.light-theme) .workspace-ribbon p,
body:not(.light-theme) .workspace-ribbon span,
body:not(.light-theme) .finance-subpage-panel p,
body:not(.light-theme) .finance-subpage-panel span,
body:not(.light-theme) .active-db-section p,
body:not(.light-theme) .active-db-section span,
body:not(.light-theme) .database-backend-panel p,
body:not(.light-theme) .database-backend-panel span,
body:not(.light-theme) .filter-panel p,
body:not(.light-theme) .filter-panel span,
body:not(.light-theme) .modal-card p,
body:not(.light-theme) .modal-card span {
  color: #cbd5e1 !important;
}

body:not(.light-theme) .glass-panel h1,
body:not(.light-theme) .glass-panel h2,
body:not(.light-theme) .glass-panel h3,
body:not(.light-theme) .glass-panel h4,
body:not(.light-theme) .chart-panel h3,
body:not(.light-theme) .wbs-panel h3,
body:not(.light-theme) .workspace-ribbon h1,
body:not(.light-theme) .workspace-ribbon h2,
body:not(.light-theme) .workspace-ribbon h3,
body:not(.light-theme) .finance-subpage-panel h3,
body:not(.light-theme) .active-db-section h3,
body:not(.light-theme) .database-backend-panel h3,
body:not(.light-theme) .modal-card h3 {
  color: #f8fafc !important;
}

body.light-theme .status-badge,
body.light-theme .pill,
body.light-theme .mode-badge,
body.light-theme .save-status-indicator,
body.light-theme .db-network-url,
body.light-theme .sample-download-link {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

body:not(.light-theme) .status-badge,
body:not(.light-theme) .pill,
body:not(.light-theme) .mode-badge,
body:not(.light-theme) .save-status-indicator,
body:not(.light-theme) .db-network-url,
body:not(.light-theme) .sample-download-link {
  background-color: rgba(15, 23, 42, 0.78) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.32) !important;
}

body.light-theme .btn-primary,
body.light-theme .nav-btn.active,
body.light-theme .wsub-btn.active,
body.light-theme .finance-tab-btn.active {
  color: #ffffff !important;
}

body:not(.light-theme) .btn-primary,
body:not(.light-theme) .nav-btn.active,
body:not(.light-theme) .wsub-btn.active,
body:not(.light-theme) .finance-tab-btn.active {
  color: #ffffff !important;
}

body.light-theme .btn-primary,
body.light-theme .nav-btn.active,
body.light-theme .wsub-btn.active,
body.light-theme .finance-tab-btn.active {
  background: #1f5f9f !important;
  border-color: #1f5f9f !important;
  color: #ffffff !important;
}

body:not(.light-theme) .btn-primary,
body:not(.light-theme) .nav-btn.active,
body:not(.light-theme) .wsub-btn.active,
body:not(.light-theme) .finance-tab-btn.active {
  background: #1d4ed8 !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

body.light-theme button.btn-primary,
body.light-theme #app-login-form .btn-primary {
  background: #1f5f9f !important;
  background-color: #1f5f9f !important;
  background-image: none !important;
  border-color: #1f5f9f !important;
  color: #ffffff !important;
}

body:not(.light-theme) button.btn-primary,
body:not(.light-theme) #app-login-form .btn-primary {
  background: #1d4ed8 !important;
  background-color: #1d4ed8 !important;
  background-image: none !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

/* Main page navigation blue tab theme */
.sidebar {
  background: linear-gradient(180deg, rgba(8, 29, 46, 0.98) 0%, rgba(7, 24, 39, 0.98) 100%) !important;
  border-color: rgba(96, 165, 250, 0.22) !important;
}

.nav-btn {
  border: 1px solid transparent !important;
  border-radius: 8px !important;
  color: #cbd5e1 !important;
}

.nav-btn:hover {
  background: rgba(56, 189, 248, 0.12) !important;
  border-color: rgba(125, 211, 252, 0.26) !important;
  color: #f8fafc !important;
}

.nav-btn.active {
  background: #1f5f9f !important;
  background-color: #1f5f9f !important;
  background-image: none !important;
  border-color: #1f5f9f !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(31, 95, 159, 0.18) !important;
}

.nav-btn.active::before {
  display: none !important;
}

.nav-btn svg,
.nav-btn:hover svg,
.nav-btn.active svg {
  color: currentColor !important;
}

body.light-theme .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #e7f3fb 100%) !important;
  border-color: #bfd8ea !important;
}

body.light-theme .nav-btn {
  color: #334155 !important;
}

body.light-theme .nav-btn:hover {
  background: rgba(31, 95, 159, 0.08) !important;
  border-color: rgba(31, 95, 159, 0.18) !important;
  color: #174a7d !important;
}

body.light-theme .nav-btn.active {
  background: #1f5f9f !important;
  background-color: #1f5f9f !important;
  background-image: none !important;
  border-color: #1f5f9f !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(31, 95, 159, 0.16) !important;
}

body.light-theme .nav-btn svg,
body.light-theme .nav-btn:hover svg,
body.light-theme .nav-btn.active svg {
  color: currentColor !important;
}

/* live notifications styles */
#notification-bell-btn:hover {
  color: var(--accent-cyan) !important;
  transform: scale(1.05);
}

#notification-list::-webkit-scrollbar {
  width: 4px;
}
#notification-list::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}
#notification-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.notification-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.notification-item:hover {
  background: rgba(6, 182, 212, 0.05);
  border-color: rgba(6, 182, 212, 0.25);
  transform: translateX(2px);
}

.notification-item.unread {
  background: rgba(6, 182, 212, 0.08);
  border-left: 3px solid var(--accent-cyan);
}

.notif-title {
  font-weight: 700;
  font-size: 0.77rem;
  color: var(--text-main);
}

.notif-message {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.notif-time {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
}

/* light theme compatibility overrides */
body.light-theme .notification-item {
  background: rgba(15, 23, 42, 0.01);
  border-color: rgba(15, 23, 42, 0.06);
}
body.light-theme .notification-item:hover {
  background: rgba(6, 182, 212, 0.04);
}
body.light-theme .notification-item.unread {
  background: rgba(6, 182, 212, 0.05);
}

/* mention autocomplete dropdown items */
.mention-item {
  transition: all 0.15s ease;
}
.mention-item.active {
  background: rgba(6, 182, 212, 0.25) !important;
}
.mention-item.hover-active {
  background: rgba(255, 255, 255, 0.06) !important;
}
body.light-theme .mention-item.active {
  background: rgba(6, 182, 212, 0.15) !important;
}
body.light-theme .mention-item.hover-active {
  background: rgba(15, 23, 42, 0.04) !important;
}

/* mention tags inside comments */
.mention-tag {
  transition: all 0.2s ease;
  cursor: pointer;
}
.mention-tag:hover {
  filter: brightness(1.15);
  transform: translateY(-0.5px);
}

.floating-discussion-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 8500;
  font-family: 'Inter', 'Outfit', sans-serif;
  pointer-events: none;
}

.floating-discussion-widget.is-hidden {
  display: none;
}

.floating-discussion-launcher,
.floating-discussion-panel {
  pointer-events: auto;
}

.floating-discussion-launcher {
  min-width: 82px;
  height: 36px;
  border: 1px solid rgba(96, 165, 250, 0.55);
  border-radius: 999px;
  background: linear-gradient(135deg, #1f5f9f 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.34);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.floating-discussion-launcher:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.42);
}

.floating-discussion-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.floating-discussion-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ffffff;
  color: #1f5f9f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  font-weight: 900;
}

.floating-discussion-panel {
  width: min(300px, calc(100vw - 80px));
  height: min(380px, calc(100vh - 96px));
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 26px 72px rgba(0, 0, 0, 0.38);
}

.floating-discussion-widget.is-open .floating-discussion-launcher {
  display: none;
}

.floating-discussion-widget.is-open .floating-discussion-panel {
  display: flex;
}

.floating-discussion-header {
  background: linear-gradient(135deg, #1f5f9f 0%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
}

.floating-discussion-header h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 850;
  color: #ffffff !important;
}

.floating-discussion-header p {
  margin: 2px 0 0;
  font-size: 0.62rem;
  color: #ffffff !important;
}

.floating-discussion-close {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.floating-discussion-project-row {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-secondary);
}

.floating-discussion-project-row label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--text-secondary);
  font-weight: 800;
}

.floating-discussion-project-row select {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-main);
  padding: 6px 8px;
  font-size: 0.7rem;
  font-weight: 650;
}

.floating-discussion-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-primary);
}

.floating-discussion-empty {
  margin: auto;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.4;
  max-width: 260px;
}

.floating-discussion-message {
  display: flex;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-card);
}

.floating-discussion-avatar {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #1f5f9f;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 900;
}

.floating-discussion-message-main {
  flex: 1;
  min-width: 0;
}

.floating-discussion-message-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}

.floating-discussion-author {
  color: var(--text-main);
  font-size: 0.7rem;
  font-weight: 850;
}

.floating-discussion-time {
  color: var(--text-muted);
  font-size: 0.56rem;
  white-space: nowrap;
}

.floating-discussion-body {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.34;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.floating-discussion-form {
  padding: 8px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 6px;
  align-items: flex-end;
  background: var(--bg-secondary);
}

.floating-discussion-form textarea {
  flex: 1;
  min-height: 34px;
  max-height: 72px;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-main);
  padding: 7px 8px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.7rem;
}

.floating-discussion-form button {
  width: 34px;
  height: 34px;
  border: 1px solid #1f5f9f;
  border-radius: 8px;
  background: #1f5f9f;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

body.light-theme .floating-discussion-panel {
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

body.light-theme .floating-discussion-messages {
  background: #f6f8fb;
}

body.light-theme .floating-discussion-message {
  background: #ffffff;
}

@media (max-width: 720px) {
  .floating-discussion-widget {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .floating-discussion-panel {
    width: 100%;
    height: min(380px, calc(100vh - 28px));
  }
}

/* Clear focus outline lines around bell sign button */
#notification-bell-btn,
#notification-bell-btn:focus,
#notification-bell-btn:active,
#notification-bell-btn:focus-visible {
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.view-only-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--border-medium);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 0.86rem;
  font-weight: 700;
}

.view-only-mode input:disabled,
.view-only-mode select:disabled,
.view-only-mode textarea:disabled,
.view-only-mode button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.form-inline-status {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.form-inline-status.error {
  border-color: var(--accent-rose);
  background: color-mix(in srgb, var(--accent-rose) 14%, var(--bg-secondary));
  color: var(--text-main);
}

.form-inline-status.success {
  border-color: var(--accent-emerald);
  background: color-mix(in srgb, var(--accent-emerald) 14%, var(--bg-secondary));
  color: var(--text-main);
}

.form-inline-status.info {
  border-color: var(--accent-cyan);
  background: color-mix(in srgb, var(--accent-cyan) 12%, var(--bg-secondary));
  color: var(--text-main);
}

.permission-parent-row {
  background: color-mix(in srgb, var(--accent-cyan) 10%, var(--bg-secondary));
}

.permission-subpage-row {
  background: var(--bg-card);
}

.permission-page-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
}

.permission-tree-parent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent-cyan);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
}

.permission-tree-branch {
  width: 18px;
  height: 26px;
  border-left: 2px solid var(--border-medium);
  border-bottom: 2px solid var(--border-medium);
  border-bottom-left-radius: 8px;
  flex: 0 0 auto;
}

.perm-all-mode,
.perm-role-mode {
  display: inline-grid;
  grid-template-columns: repeat(3, 32px);
  gap: 3px;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-medium);
  background: var(--bg-secondary);
}

.perm-all-mode {
  grid-template-columns: repeat(3, 34px);
}

.permission-mode-btn {
  width: 32px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  line-height: 1;
  cursor: pointer;
}

.perm-all-mode .permission-mode-btn {
  width: 34px;
}

.permission-mode-btn:hover {
  border-color: var(--accent-cyan);
  background: color-mix(in srgb, var(--accent-cyan) 12%, transparent);
}

.permission-mode-btn.active {
  border-color: var(--accent-cyan);
  background: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(14, 165, 233, 0.22);
}

.permission-mode-group.is-mixed {
  border-style: dashed;
  border-color: var(--accent-amber);
}


/* Commissioning FAT/SAT and Punch List editing */
.commissioning-table-scroll {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-primary);
}

.commissioning-table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}

.commissioning-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 1px 0 var(--border-light);
}

.commissioning-fat-sat-table th:nth-child(1),
.commissioning-fat-sat-table td:nth-child(1) { width: 76px; }
.commissioning-fat-sat-table th:nth-child(2),
.commissioning-fat-sat-table td:nth-child(2) { width: 190px; }
.commissioning-fat-sat-table th:nth-child(3),
.commissioning-fat-sat-table td:nth-child(3) { width: 240px; }
.commissioning-fat-sat-table th:nth-child(4),
.commissioning-fat-sat-table td:nth-child(4) { width: 150px; }
.commissioning-fat-sat-table th:nth-child(5),
.commissioning-fat-sat-table td:nth-child(5) { width: 130px; }
.commissioning-fat-sat-table th:nth-child(6),
.commissioning-fat-sat-table td:nth-child(6) { width: 120px; }
.commissioning-fat-sat-table th:nth-child(7),
.commissioning-fat-sat-table td:nth-child(7) { width: 230px; }
.commissioning-fat-sat-table th:nth-child(8),
.commissioning-fat-sat-table td:nth-child(8) { width: 150px; }
.commissioning-fat-sat-table th:nth-child(9),
.commissioning-fat-sat-table td:nth-child(9) { width: 96px; }

.commissioning-punch-table th:nth-child(1),
.commissioning-punch-table td:nth-child(1) { width: 150px; }
.commissioning-punch-table th:nth-child(2),
.commissioning-punch-table td:nth-child(2) { width: 300px; }
.commissioning-punch-table th:nth-child(3),
.commissioning-punch-table td:nth-child(3) { width: 120px; }
.commissioning-punch-table th:nth-child(4),
.commissioning-punch-table td:nth-child(4) { width: 150px; }
.commissioning-punch-table th:nth-child(5),
.commissioning-punch-table td:nth-child(5) { width: 150px; }
.commissioning-punch-table th:nth-child(6),
.commissioning-punch-table td:nth-child(6) { width: 130px; }
.commissioning-punch-table th:nth-child(7),
.commissioning-punch-table td:nth-child(7) { width: 140px; }
.commissioning-punch-table th:nth-child(8),
.commissioning-punch-table td:nth-child(8) { width: 150px; }
.commissioning-punch-table th:nth-child(9),
.commissioning-punch-table td:nth-child(9) { width: 96px; }

.commissioning-table td {
  vertical-align: top;
}

.commissioning-cell-input,
.commissioning-date-input,
.commissioning-select,
.commissioning-cell-textarea {
  width: 100%;
  min-width: 0;
  border-radius: 7px;
}

.commissioning-cell-input,
.commissioning-date-input,
.commissioning-select {
  padding: 5px 7px;
  font-size: 0.78rem;
}

.commissioning-cell-textarea {
  min-height: 46px;
  max-height: 120px;
  resize: vertical;
  padding: 6px 8px;
  font-size: 0.78rem;
  line-height: 1.3;
  white-space: pre-wrap;
}

.commissioning-result-select {
  color: var(--result-color);
  font-weight: 700;
}

.commissioning-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-primary);
}

.commissioning-type-pill.fat { background: rgba(96, 165, 250, 0.22); }
.commissioning-type-pill.sat { background: rgba(167, 139, 250, 0.22); }
.commissioning-signed {
  display: inline-block;
  color: var(--accent-emerald);
  font-size: 0.75rem;
  font-weight: 700;
}
.commissioning-muted {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}
.commissioning-action-btn,
.commissioning-delete-btn {
  padding: 4px 8px !important;
  font-size: 0.72rem !important;
  white-space: nowrap;
}
.commissioning-delete-btn { color: #ef4444 !important; }
.commissioning-severity-critical { color: #ef4444 !important; font-weight: 700; }
.commissioning-severity-major { color: var(--accent-amber) !important; font-weight: 700; }

/* Durable synchronization status */
:root {
  --sync-panel-bg: #0f172a;
  --sync-surface-bg: #1e293b;
  --sync-surface-hover: #263449;
  --sync-border: rgba(148, 163, 184, .28);
  --sync-border-soft: rgba(148, 163, 184, .18);
  --sync-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  --sync-backdrop: rgba(2, 6, 23, .72);
  --sync-action-text: #a5f3fc;
  --sync-action-bg: rgba(8, 145, 178, .16);
  --sync-action-border: rgba(34, 211, 238, .38);
  --sync-warning-text: #fde68a;
  --sync-warning-bg: rgba(120, 53, 15, .48);
  --sync-warning-border: rgba(251, 191, 36, .38);
  --sync-error-text: #fda4af;
  --sync-error-bg: rgba(136, 19, 55, .18);
  --sync-error-border: rgba(251, 113, 133, .34);
  --sync-neutral-dot: #94a3b8;
}
body.light-theme {
  --sync-panel-bg: #ffffff;
  --sync-surface-bg: #f8fafc;
  --sync-surface-hover: #f1f5f9;
  --sync-border: #cbd5e1;
  --sync-border-soft: #e2e8f0;
  --sync-shadow: 0 24px 70px rgba(15, 23, 42, .2);
  --sync-backdrop: rgba(15, 23, 42, .38);
  --sync-action-text: #075985;
  --sync-action-bg: #e0f2fe;
  --sync-action-border: #7dd3fc;
  --sync-warning-text: #92400e;
  --sync-warning-bg: #fffbeb;
  --sync-warning-border: #fcd34d;
  --sync-error-text: #be123c;
  --sync-error-bg: #fff1f2;
  --sync-error-border: #fda4af;
  --sync-neutral-dot: #64748b;
}
.unified-sync-compatibility-source {
  display: none !important;
}
#save-status-indicator,
#mode-label {
  display: none !important;
}
.sync-status-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--sync-border);
  border-radius: 999px;
  color: var(--text-main);
  background: var(--sync-panel-bg);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
  cursor: pointer;
  font: inherit;
  font-size: .78rem;
}
.sync-status-button:hover { background: var(--sync-surface-hover); }
.sync-status-button:focus-visible,
.sync-panel-header button:focus-visible,
.sync-operation-actions button:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.sync-status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-emerald); box-shadow: 0 0 10px color-mix(in srgb, var(--accent-emerald) 55%, transparent); }
.sync-status-button[data-state="saving"] .sync-status-dot,
.sync-status-button[data-state="pending"] .sync-status-dot,
.sync-status-button[data-state="uploading"] .sync-status-dot,
.sync-status-button[data-state="verifying"] .sync-status-dot,
.sync-status-button[data-state="reconnecting"] .sync-status-dot { background: var(--accent-amber); animation: sync-pulse 1.2s ease-in-out infinite; }
.sync-status-button[data-state="offline"] .sync-status-dot { background: var(--sync-neutral-dot); box-shadow: none; }
.sync-status-button[data-state="conflict"] .sync-status-dot,
.sync-status-button[data-state="failed"] .sync-status-dot { background: var(--accent-rose); box-shadow: 0 0 10px color-mix(in srgb, var(--accent-rose) 50%, transparent); }
.sync-status-count { min-width: 18px; padding: 1px 5px; border: 1px solid var(--sync-warning-border); border-radius: 999px; background: var(--sync-warning-bg); color: var(--sync-warning-text); text-align: center; }
@keyframes sync-pulse { 50% { opacity: .42; transform: scale(.82); } }
.sync-status-panel { width: min(680px, calc(100vw - 28px)); max-height: min(78vh, 760px); padding: 0; border: 1px solid var(--sync-border); border-radius: 16px; color: var(--text-main); background: var(--sync-panel-bg); box-shadow: var(--sync-shadow); }
.sync-status-panel::backdrop { background: var(--sync-backdrop); backdrop-filter: blur(4px); }
.sync-panel-header { display: flex; justify-content: space-between; gap: 20px; padding: 20px; border-bottom: 1px solid var(--sync-border-soft); }
.sync-panel-header h2 { margin: 0 0 5px; color: var(--text-main); font-size: 1.05rem; }
.sync-panel-header p { margin: 0; color: var(--text-secondary); font-size: .84rem; }
.sync-panel-header button { align-self: flex-start; width: 34px; height: 34px; border: 1px solid transparent; border-radius: 8px; color: var(--text-secondary); background: transparent; font-size: 1.5rem; cursor: pointer; }
.sync-panel-header button:hover { border-color: var(--sync-border); color: var(--text-main); background: var(--sync-surface-hover); }
.sync-dashboard-summary { display: flex; align-items: center; gap: 10px; margin: 16px 20px 0; padding: 11px 13px; border: 1px solid var(--sync-border-soft); border-radius: 10px; background: var(--sync-surface-bg); }
.sync-dashboard-summary > div { display: grid; gap: 2px; }
.sync-dashboard-summary strong { color: var(--text-main); font-size: .82rem; }
.sync-dashboard-summary small { color: var(--text-secondary); font-size: .74rem; }
.sync-dashboard-summary[data-state="saving"] .sync-status-dot,
.sync-dashboard-summary[data-state="pending"] .sync-status-dot,
.sync-dashboard-summary[data-state="reconnecting"] .sync-status-dot { background: var(--accent-amber); animation: sync-pulse 1.2s ease-in-out infinite; }
.sync-dashboard-summary[data-state="failed"] .sync-status-dot { background: var(--accent-rose); }
.sync-dashboard-summary[data-state="offline"] .sync-status-dot { background: var(--sync-neutral-dot); box-shadow: none; }
.sync-progress-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: stretch; margin: 12px 20px 0; }
.sync-metric { display: grid; gap: 4px; min-width: 0; padding: 10px 12px; border: 1px solid var(--sync-border-soft); border-radius: 10px; background: var(--sync-surface-bg); }
.sync-metric span { color: var(--text-secondary); font-size: .68rem; }
.sync-metric strong { color: var(--text-main); font-size: .86rem; overflow-wrap: anywhere; }
#sync-cancel-all { padding: 8px 12px; border: 1px solid var(--sync-error-border); border-radius: 10px; color: var(--sync-error-text); background: var(--sync-error-bg); cursor: pointer; font-weight: 700; }
#sync-cancel-all:hover { filter: brightness(.96); }
#sync-cancel-all:disabled { cursor: wait; opacity: .6; }
.sync-progress-track { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 999px; background: var(--sync-border-soft); }
.sync-progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald)); transition: width .35s ease; }
.sync-recovery-notice { margin: 16px 20px 0; padding: 11px 13px; border: 1px solid var(--sync-warning-border); border-radius: 10px; color: var(--sync-warning-text); background: var(--sync-warning-bg); }
.sync-operation-list { display: grid; gap: 10px; padding: 16px 20px 22px; overflow: auto; }
.sync-operation { --sync-state-accent: var(--accent-cyan); padding: 13px; border: 1px solid var(--sync-border-soft); border-left: 3px solid var(--sync-state-accent); border-radius: 12px; background: var(--sync-surface-bg); }
.sync-operation[data-state="saving"],
.sync-operation[data-state="sending"],
.sync-operation[data-state="uploading"],
.sync-operation[data-state="pending"],
.sync-operation[data-state="retry_scheduled"],
.sync-operation[data-state="cancel_requested"] { --sync-state-accent: var(--accent-amber); }
.sync-operation[data-state="offline"] { --sync-state-accent: var(--sync-neutral-dot); }
.sync-operation[data-state="conflict"],
.sync-operation[data-state="failed"],
.sync-operation[data-state="requires_user_action"] { --sync-state-accent: var(--accent-rose); }
.sync-operation[data-state="synced"],
.sync-operation[data-state="committed"],
.sync-operation[data-state="cancelled"] { --sync-state-accent: var(--accent-emerald); }
.sync-operation > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.sync-operation strong { color: var(--text-main); }
.sync-operation span, .sync-operation small { color: var(--text-secondary); }
.sync-operation small { display: block; margin-top: 7px; overflow-wrap: anywhere; }
.sync-operation p { margin: 9px 0 0; padding: 8px 10px; border: 1px solid var(--sync-error-border); border-radius: 8px; color: var(--sync-error-text); background: var(--sync-error-bg); font-size: .82rem; }
.sync-operation-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.sync-operation-actions button { padding: 6px 10px; border: 1px solid var(--sync-action-border); border-radius: 8px; color: var(--sync-action-text); background: var(--sync-action-bg); cursor: pointer; font-weight: 600; }
.sync-operation-actions button:hover { filter: brightness(.96); }
.sync-operation-actions button[data-sync-action="review"] { border-color: var(--sync-warning-border); color: var(--sync-warning-text); background: var(--sync-warning-bg); }
.sync-operation-actions button[data-sync-action="cancel"] { border-color: var(--sync-error-border); color: var(--sync-error-text); background: var(--sync-error-bg); }
.sync-empty { padding: 28px; color: var(--text-secondary); text-align: center; }
body.has-unsynced-changes::after { content: "Unsynchronized changes are safely stored on this device"; position: fixed; z-index: 9000; right: 16px; bottom: 16px; max-width: 360px; padding: 9px 12px; border: 1px solid var(--sync-warning-border); border-radius: 9px; color: var(--sync-warning-text); background: var(--sync-warning-bg); box-shadow: 0 12px 30px rgba(0, 0, 0, .25); font-size: .78rem; }
@media (max-width: 720px) { .sync-status-label { display: none; } .sync-progress-overview { grid-template-columns: 1fr 1fr; } #sync-cancel-all { grid-column: 1 / -1; } body.has-unsynced-changes::after { left: 12px; right: 12px; text-align: center; } }
/* Append-only module entry registers */
.module-history-panel { margin-top: 16px; padding: 0; overflow: hidden; border: 1px solid var(--border-medium); background: var(--bg-secondary); }
.module-history-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--border-light); }
.module-history-header h3, .module-entry-heading h3 { margin: 0; color: var(--text-main); font-size: 1rem; }
.module-history-header p, .module-entry-heading p { margin: 4px 0 0; color: var(--text-secondary); font-size: .76rem; line-height: 1.45; }
.module-history-actions, .module-history-entry-actions, .module-entry-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.module-history-actions button, .module-history-entry-actions button, .module-history-entry-actions a { font-size: .72rem; padding: 6px 10px; text-decoration: none; }
.module-history-list { display: grid; gap: 10px; padding: 14px 20px 20px; }
.module-history-entry { display: grid; grid-template-columns: 105px minmax(220px, 1fr) auto; gap: 14px; align-items: center; padding: 13px; border: 1px solid var(--border-light); border-left: 3px solid var(--accent-cyan); border-radius: 10px; background: var(--bg-tertiary); }
.module-history-version { display: grid; gap: 4px; }
.module-history-version strong { color: var(--accent-cyan); font-size: 1rem; }
.module-history-version span, .module-history-copy small { color: var(--text-muted); font-size: .68rem; }
.module-history-copy h4 { margin: 0; color: var(--text-main); font-size: .84rem; }
.module-history-copy p { margin: 4px 0; color: var(--text-secondary); font-size: .75rem; }
.module-history-empty { padding: 24px; color: var(--text-secondary); text-align: center; font-size: .78rem; }
.module-entry-dialog { width: min(620px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--border-medium); border-radius: 14px; color: var(--text-main); background: var(--bg-secondary); box-shadow: 0 24px 80px rgba(0,0,0,.42); }
.module-entry-dialog::backdrop { background: rgba(2, 6, 23, .65); backdrop-filter: blur(4px); }
.module-entry-form { display: grid; gap: 14px; padding: 20px; }
.module-entry-heading { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.module-entry-heading .module-entry-close { width: 34px; height: 34px; border: 1px solid transparent; border-radius: 8px; color: var(--text-secondary); background: transparent; cursor: pointer; font-size: 1.4rem; }
.module-entry-heading .module-entry-close:hover { border-color: var(--border-medium); color: var(--text-main); background: var(--bg-tertiary); }
.module-entry-form label { display: grid; gap: 6px; color: var(--text-secondary); font-size: .75rem; font-weight: 600; }
.module-entry-form .form-input { width: 100%; color: var(--text-main); background: var(--bg-tertiary); border: 1px solid var(--border-medium); }
.module-entry-assurance { margin: 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--accent-emerald) 40%, transparent); border-radius: 8px; color: var(--text-secondary); background: color-mix(in srgb, var(--accent-emerald) 9%, var(--bg-secondary)); font-size: .72rem; line-height: 1.5; }
body.light-theme .module-history-panel, body.light-theme .module-entry-dialog { background: #fff; }
body.light-theme .module-history-entry { border-color: #e2e8f0; border-left-color: var(--accent-cyan); background: #f8fafc; }
body.light-theme .module-entry-dialog::backdrop { background: rgba(15, 23, 42, .38); }
@media (max-width: 760px) { .module-history-header, .module-history-entry { grid-template-columns: 1fr; display: grid; } .module-history-actions, .module-history-entry-actions { justify-content: flex-start; } }