/*
 * Generated startup-critical companion for styles-part-11-overflow-guards.css.
 * Run: node scripts/build-startup-critical-styles.js
 * The complete source stylesheet remains the deferred cascade authority.
 */

/*
  File: styles-part-11-overflow-guards.css
  Purpose: Final layout guard layer for long text in navigation and right detail forms.
*/

/* =========================================================
   USER FIX: Long text must not break navigation/detail layout
   ========================================================= */

.sidebar .nav-item,
.sidebar .dashboard-nav-item,
.sidebar .nav-menu-content .nav-item,
.sidebar .nav-menu-content .dashboard-nav-item,
.detail-panel form,
.detail-panel .task-fields,
.detail-panel .inspector-fields,
.detail-panel .form-grid,
#placeholderForm > .form-actions.placeholder-form-actions,
#placeholderForm > .form-actions.placeholder-form-actions .row-data-actions,
#placeholderForm > .form-actions.placeholder-form-actions .document-form-actions {
  min-width: 0 !important;
}

.sidebar .nav-item .menu-text,
.sidebar .dashboard-nav-item .menu-text,
.sidebar .nav-menu-content .menu-text {
  min-width: 0 !important;
  max-width: none !important;
  overflow: visible !important;
  overflow-wrap: anywhere !important;
  text-overflow: clip !important;
  white-space: normal !important;
  word-break: normal !important;
}

.detail-panel label,
.detail-panel input,
.detail-panel textarea,
.detail-panel select {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.detail-panel {
  overflow-x: hidden !important;
  contain: inline-size;
}

.detail-panel *,
.detail-panel *::before,
.detail-panel *::after {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.detail-panel label,
.detail-panel .detail-heading,
.detail-panel .attachment-tools,
.detail-panel .task-fields,
.detail-panel .inspector-fields,
.detail-panel .form-actions,
.detail-panel .placeholder-form-actions {
  overflow-wrap: anywhere !important;
}

.detail-panel p,
.detail-panel small,
.detail-panel output,
.detail-panel .attachment-status,
.detail-panel .field-hint,
.detail-panel .form-hint,
.detail-panel .status-text,
.detail-panel [id$="Status"] {
  display: block;
  width: 100%;
  max-width: 100% !important;
  overflow: hidden !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: normal !important;
  text-overflow: clip !important;
}

.detail-panel input,
.detail-panel textarea,
.detail-panel select {
  inline-size: 100%;
}

.detail-panel textarea.right-detail-wrap-textarea {
  display: block !important;
  width: 100% !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
}

.right-detail-dropdown-popover {
  position: fixed !important;
  z-index: 2147483000 !important;
  display: block !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain !important;
  scrollbar-gutter: stable !important;
  padding: 6px !important;
  border: 1px solid rgba(148, 163, 184, .68) !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, .98) !important;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .2) !important;
}

.right-detail-dropdown-popover[hidden] {
  display: none !important;
}

.right-detail-dropdown-popover::-webkit-scrollbar {
  width: 10px !important;
}

.right-detail-dropdown-popover::-webkit-scrollbar-track {
  border-radius: 999px !important;
  background: rgba(226, 232, 240, .88) !important;
}

.right-detail-dropdown-popover::-webkit-scrollbar-thumb {
  border: 2px solid rgba(255, 255, 255, .96) !important;
  border-radius: 999px !important;
  background: rgba(100, 116, 139, .72) !important;
}

.right-detail-dropdown-option {
  display: block !important;
  width: 100% !important;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 9px 12px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: #0f172a !important;
  font: inherit !important;
  line-height: 1.35 !important;
  text-align: left !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  cursor: pointer !important;
}

.right-detail-dropdown-option:hover,
.right-detail-dropdown-option.is-active {
  background: linear-gradient(135deg, rgba(219, 234, 254, .95), rgba(239, 246, 255, .98)) !important;
  color: #0f3f75 !important;
}

.right-detail-dropdown-empty {
  padding: 12px !important;
  color: #64748b !important;
  font-size: .94rem !important;
}

/* USER FIX: Work Progress progress column must not clip when zoomed. */

.library-panel.work-mode .progress-dashboard,
.library-panel.work-mode .progress-table-header,
.library-panel.work-mode .progress-filter-row,
.library-panel.work-mode .progress-row {
  max-width: none !important;
}

.library-panel.work-mode .progress-dashboard {
  overflow: visible !important;
}

.library-panel.work-mode .progress-table-header > [data-sort-key="completion"],
.library-panel.work-mode .progress-filter-row > [data-work-filter="completion"],
.library-panel.work-mode .progress-row > .progress-completion-cell {
  min-width: 0 !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

.library-panel.work-mode .progress-row > .progress-completion-cell {
  display: grid !important;
  grid-template-columns: minmax(120px, 1fr) minmax(64px, max-content) !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: 12px !important;
  width: 100% !important;
  overflow: visible !important;
  padding: 5px 18px 5px 12px !important;
}

.library-panel.work-mode .progress-completion-track {
  width: 100% !important;
  min-width: 120px !important;
  max-width: none !important;
}

.library-panel.work-mode .progress-completion-percent {
  display: inline-block !important;
  min-width: 64px !important;
  max-width: none !important;
  overflow: visible !important;
  white-space: nowrap !important;
  text-align: right !important;
  font-size: 20px !important;
  line-height: 1 !important;
}

/* Menu 4 status counts open task-code drilldowns. */

.library-panel.work-mode .menu4-progress-count-button:not(.appdatagrid-menu4-progress-count-button) {
  display: inline-grid !important;
  place-items: center !important;
  width: 100% !important;
  min-height: 44px !important;
  padding: 0 10px !important;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  background: transparent !important;
  color: #172033 !important;
  cursor: pointer !important;
  font-family: "Times New Roman", "Khmer OS Siemreap", "Noto Serif Khmer", serif !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-align: center !important;
}

.library-panel.work-mode .menu4-progress-count-button:hover,
.library-panel.work-mode .menu4-progress-count-button:focus-visible {
  border-color: rgba(37, 99, 235, 0.24) !important;
  background: rgba(239, 246, 255, 0.94) !important;
  color: #1d4ed8 !important;
  outline: none !important;
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.08) !important;
}

.library-panel.work-mode .menu4-progress-count-button.is-pending:hover,
.library-panel.work-mode .menu4-progress-count-button.is-pending:focus-visible {
  color: #dc2626 !important;
  background: #fff1f2 !important;
}

.library-panel.work-mode .menu4-progress-count-button.is-ongoing:hover,
.library-panel.work-mode .menu4-progress-count-button.is-ongoing:focus-visible {
  color: #2563eb !important;
  background: #eff6ff !important;
}

.library-panel.work-mode .menu4-progress-count-button.is-completed:hover,
.library-panel.work-mode .menu4-progress-count-button.is-completed:focus-visible {
  color: #16a34a !important;
  background: #f0fdf4 !important;
}

.library-panel.work-mode .menu4-progress-count-button.is-hours:hover,
.library-panel.work-mode .menu4-progress-count-button.is-hours:focus-visible {
  color: #0f766e !important;
  background: #f0fdfa !important;
}

.library-panel.work-mode .appdatagrid-progress-completion-cell {
  display: grid !important;
  grid-template-columns: minmax(120px, 1fr) minmax(56px, max-content) !important;
  align-items: center !important;
  justify-content: stretch !important;
  gap: 10px !important;
  min-height: 34px !important;
  padding: 0 !important;
  overflow: visible !important;
}

.menu4-usage-analytics-strip {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.menu4-usage-analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.menu4-usage-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.menu4-usage-analytics-header h3 {
  margin: 0;
  color: #0f172a;
  font-family: var(--pd-english-ui-font, Inter, system-ui, sans-serif);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
}

.menu4-usage-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.menu4-usage-summary span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid rgba(203, 213, 225, 0.84);
  border-radius: 8px;
  background: #ffffff;
}

.menu4-usage-summary strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.menu4-usage-refresh-button {
  min-height: 30px;
  padding: 6px 10px;
  color: #ffffff;
  background: #0f172a;
  border: 1px solid #0f172a;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.menu4-usage-refresh-button:hover,
.menu4-usage-refresh-button:focus-visible {
  color: #ffffff;
  background: #1d4ed8;
  border-color: #1d4ed8;
  outline: none;
}

.menu4-usage-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(292px, 360px);
  gap: 12px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
  padding: 2px 2px 8px;
}

.menu4-usage-card {
  scroll-snap-align: start;
  display: grid;
  grid-template-rows: auto auto minmax(86px, auto) auto auto;
  gap: 10px;
  min-width: 0;
  min-height: 244px;
  padding: 12px;
  color: #0f172a;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.92);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.menu4-usage-card.is-current {
  border-color: rgba(37, 99, 235, 0.42);
  box-shadow: inset 0 3px 0 #2563eb, 0 1px 2px rgba(15, 23, 42, 0.06);
}

.menu4-usage-card-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.menu4-usage-avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  color: #ffffff;
  background: var(--pd-user-avatar-color, #0f766e);
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.menu4-usage-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu4-usage-avatar i {
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
}

.menu4-usage-avatar.has-avatar-photo,
.menu4-usage-avatar.is-default-avatar {
  background: #ffffff;
}

.menu4-usage-card h4 {
  margin: 0;
  overflow: hidden;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu4-usage-card small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu4-usage-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.menu4-usage-card-metrics span {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 54px;
  padding: 8px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 8px;
  background: #f8fafc;
}

.menu4-usage-card-metrics strong {
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.menu4-usage-card-metrics small {
  color: #64748b;
  font-size: 10px;
  line-height: 1.15;
  white-space: normal;
}

.menu4-usage-menu-share {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  max-height: 104px;
  padding: 2px 5px 2px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: rgba(100, 116, 139, 0.66) rgba(226, 232, 240, 0.72);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  border-radius: 6px;
  outline: none;
}

.menu4-usage-menu-share::-webkit-scrollbar {
  width: 7px;
}

.menu4-usage-menu-share::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.72);
  border-radius: 999px;
}

.menu4-usage-menu-share::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.66);
  border: 1px solid rgba(226, 232, 240, 0.86);
  border-radius: 999px;
}

.menu4-usage-menu-share:focus-visible {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.24);
}

.menu4-usage-menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.menu4-usage-menu-row span {
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu4-usage-menu-row strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.menu4-usage-menu-row i {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 999px;
}

.menu4-usage-menu-row b {
  display: block;
  height: 100%;
  background: #2563eb;
  border-radius: inherit;
}

.menu4-usage-favorite-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.menu4-usage-favorite-buttons span {
  flex: 0 0 100%;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.menu4-usage-favorite-buttons strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 26px;
  padding: 5px 8px;
  overflow: hidden;
  color: #172033;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu4-usage-favorite-buttons em {
  color: #c2410c;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.menu4-usage-card-footer,
.menu4-usage-empty-line {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.menu4-usage-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px;
}

.menu4-usage-pointer-exits {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-height: 22px;
  padding: 4px 7px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
}

.menu4-usage-pointer-exits strong {
  color: #0f172a;
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.menu4-usage-empty-line {
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

@media (max-width: 760px) {
  .menu4-usage-analytics-header {
    align-items: stretch;
    flex-direction: column;
  }

  .menu4-usage-summary {
    justify-content: flex-start;
  }

  .menu4-usage-carousel {
    grid-auto-columns: minmax(260px, 88vw);
  }
}

@media (hover: none) and (pointer: coarse) {
  .menu4-usage-pointer-exits {
    display: none;
  }
}

.menu4-progress-dialog {
  width: min(980px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 48px));
  padding: 0;
  color: var(--ink, #172033);
  background: transparent;
  border: 0;
}

.menu4-progress-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(8px);
}

.menu4-progress-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 24px;
  box-shadow: 0 36px 96px rgba(15, 23, 42, 0.28);
}

.menu4-progress-header,
.menu4-progress-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line, #d8e2ef);
}

.menu4-progress-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line, #d8e2ef);
  border-bottom: 0;
}

.menu4-progress-header small {
  color: #2563eb;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.menu4-progress-header h3 {
  margin: 4px 0 0;
  color: var(--ink, #172033);
  font-size: 24px;
}

.menu4-progress-header p {
  margin: 6px 0 0;
  color: var(--muted, #64748b);
  font-size: 13px;
}

.menu4-progress-summary-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 22px 0;
  padding: 12px 14px;
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: 16px;
  background: rgba(239, 246, 255, 0.84);
}

.menu4-progress-summary-line span {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 900;
}

.menu4-progress-table-wrap {
  min-height: 0;
  margin: 16px 22px;
  overflow: auto;
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
}

.menu4-progress-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.menu4-progress-table th,
.menu4-progress-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line, #d8e2ef);
}

.menu4-progress-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #0f4c81;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  background: #eaf4ff;
}

.menu4-progress-code-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  max-width: 260px;
  padding: 6px 12px;
  overflow: hidden;
  color: #0f4c81;
  background: #eaf4ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.menu4-progress-code-button:hover,
.menu4-progress-code-button:focus-visible {
  color: #ffffff;
  background: #1d4ed8;
  border-color: #1d4ed8;
  outline: none;
}

.menu4-progress-hours-cell {
  color: #0f766e;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.menu4-progress-visit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  color: #172033;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.menu4-progress-visit-button:hover,
.menu4-progress-visit-button:focus-visible {
  color: #ffffff;
  background: #0f172a;
  border-color: #0f172a;
  outline: none;
}

.menu4-progress-officer-cell {
  font-weight: 900;
}

.menu4-progress-empty {
  padding: 20px !important;
  color: var(--muted, #64748b);
  font-weight: 800;
  text-align: center !important;
}

.theme-dark .right-detail-dropdown-popover,
body.dark-theme .right-detail-dropdown-popover,
html[data-theme-mode="dark"] .right-detail-dropdown-popover {
  border-color: rgba(71, 85, 105, .9) !important;
  background: rgba(15, 23, 42, .98) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .45) !important;
}

.theme-dark .right-detail-dropdown-popover::-webkit-scrollbar-track,
body.dark-theme .right-detail-dropdown-popover::-webkit-scrollbar-track,
html[data-theme-mode="dark"] .right-detail-dropdown-popover::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, .9) !important;
}

.theme-dark .right-detail-dropdown-popover::-webkit-scrollbar-thumb,
body.dark-theme .right-detail-dropdown-popover::-webkit-scrollbar-thumb,
html[data-theme-mode="dark"] .right-detail-dropdown-popover::-webkit-scrollbar-thumb {
  border-color: rgba(15, 23, 42, .98) !important;
  background: rgba(148, 163, 184, .78) !important;
}

.theme-dark .right-detail-dropdown-option,
body.dark-theme .right-detail-dropdown-option,
html[data-theme-mode="dark"] .right-detail-dropdown-option {
  color: #e5eefc !important;
}

.theme-dark .right-detail-dropdown-option:hover,
.theme-dark .right-detail-dropdown-option.is-active,
body.dark-theme .right-detail-dropdown-option:hover,
body.dark-theme .right-detail-dropdown-option.is-active,
html[data-theme-mode="dark"] .right-detail-dropdown-option:hover,
html[data-theme-mode="dark"] .right-detail-dropdown-option.is-active {
  background: linear-gradient(135deg, rgba(37, 99, 235, .38), rgba(30, 41, 59, .96)) !important;
  color: #ffffff !important;
}

.theme-dark .right-detail-dropdown-empty,
body.dark-theme .right-detail-dropdown-empty,
html[data-theme-mode="dark"] .right-detail-dropdown-empty {
  color: #94a3b8 !important;
}

#placeholderForm > .form-actions.placeholder-form-actions .document-form-action {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* =========================================================
   USER FIX: Settings dialog content must scroll instead of clipping
   ========================================================= */

.settings-dialog {
  height: min(900px, calc(100vh - 42px)) !important;
  max-height: calc(100vh - 42px) !important;
  overflow: hidden !important;
}

.settings-dialog .settings-panel {
  height: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
}

.settings-dialog .settings-tabs,
.settings-dialog .settings-tab-panel {
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-gutter: stable !important;
}

.settings-dialog .settings-tab-panel {
  align-self: stretch !important;
  max-height: none !important;
  padding-bottom: 42px !important;
  overscroll-behavior: contain !important;
}

.settings-dialog .settings-tab-panel::-webkit-scrollbar,
.settings-dialog .settings-tabs::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

.settings-dialog .settings-tab-panel::-webkit-scrollbar-thumb,
.settings-dialog .settings-tabs::-webkit-scrollbar-thumb {
  border-radius: 999px !important;
  background: rgba(71, 85, 105, .42) !important;
}

.settings-dialog .settings-tab-panel:hover::-webkit-scrollbar-thumb,
.settings-dialog .settings-tabs:hover::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, .68) !important;
}

/* =========================================================
   USER FIX: Data grid body text wraps inside cells
   Overrides the older single-line row rule without changing headers.
   ========================================================= */

.data-grid-scroll > .item-list > .item-row {
  height: auto !important;
  min-height: 52px !important;
  max-height: none !important;
  overflow: visible !important;
  align-items: stretch !important;
}

.data-grid-scroll > .item-list > .item-row > span:not(.table-control-cell),
.data-grid-scroll > .item-list > .item-row > div:not(.table-control-cell) {
  height: auto !important;
  min-height: 52px !important;
  max-height: none !important;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.45 !important;
  align-items: center !important;
  align-content: center !important;
}

.data-grid-scroll > .item-list > .item-row .document-title-cell,
.data-grid-scroll > .item-list > .item-row .item-title,
.data-grid-scroll > .item-list > .item-row .item-title-line,
.data-grid-scroll > .item-list > .item-row .item-title-line > span,
.data-grid-scroll > .item-list > .item-row .legal-reference-cell {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  max-width: 100% !important;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.45 !important;
}

.data-grid-scroll > .item-list > .item-row .item-title,
.data-grid-scroll > .item-list > .item-row .item-title-line {
  width: 100% !important;
  min-width: 0 !important;
}

.data-grid-scroll > .item-list > .item-row .item-title-line > span {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
}

.data-grid-scroll > .item-list > .item-row > .table-control-cell {
  height: auto !important;
  min-height: 52px !important;
  max-height: none !important;
  overflow: visible !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  align-items: center !important;
  justify-content: center !important;
}

/* =========================================================
   USER FIX: Sidebar active rows use consistent left/right layout
   Keeps the active accent bar from shifting text and count spacing.
   ========================================================= */

.sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item) {
  position: relative !important;
  display: grid !important;
  align-items: center !important;
  column-gap: 10px !important;
  width: 100% !important;
  min-height: 38px !important;
  height: auto !important;
  padding: 6px 14px 6px 18px !important;
}

.sidebar .nav-menu-content .nav-item.active:not(.dashboard-nav-item),
.sidebar .menu-two .nav-menu-content .nav-item.active:not(.dashboard-nav-item) {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 12%, #ffffff), rgba(255, 255, 255, 0.48)) !important;
  box-shadow: none !important;
}

.sidebar .nav-menu-content .nav-item.active:not(.dashboard-nav-item)::before,
.sidebar .menu-two .nav-menu-content .nav-item.active:not(.dashboard-nav-item)::before {
  content: "" !important;
  position: absolute !important;
  inset: 0 auto 0 0 !important;
  display: block !important;
  width: 4px !important;
  border-radius: 0 !important;
  background: var(--accent) !important;
}

.sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item) .menu-text {
  display: block !important;
  justify-self: start !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: hidden !important;
  text-align: left !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item) .menu-count {
  justify-self: end !important;
  min-width: 24px !important;
  padding-inline-start: 4px !important;
  text-align: right !important;
  font-variant-numeric: tabular-nums !important;
}

/* =========================================================
   USER FIX: Sidebar labels wrap instead of cutting with ellipsis
   Counts remain fixed on the right while Khmer/English labels use
   as many lines as needed.
   ========================================================= */

.sidebar .nav-menu-content .nav-item,
.sidebar .nav-menu-content .dashboard-nav-item {
  height: auto !important;
  min-height: 44px !important;
  align-items: center !important;
}

.sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item) {
  grid-template-columns: minmax(0, 1fr) auto !important;
  row-gap: 4px !important;
}

.sidebar .nav-menu-content .nav-item .menu-text,
.sidebar .nav-menu-content .dashboard-nav-item .menu-text {
  max-width: none !important;
  min-width: 0 !important;
  overflow: visible !important;
  overflow-wrap: anywhere !important;
  text-overflow: clip !important;
  white-space: normal !important;
  word-break: normal !important;
  line-height: 1.28 !important;
}

.sidebar .nav-menu-content .dashboard-nav-item {
  display: flex !important;
}

.sidebar .nav-menu-content .dashboard-nav-item .nav-icon {
  flex: 0 0 auto !important;
}

.sidebar .nav-menu-content .nav-item .menu-count {
  align-self: center !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* =========================================================
   USER FIX: Top-level sidebar navigation labels must not cut
   at higher zoom. Keep counts fixed on the right and allow
   Khmer/English labels to wrap cleanly inside the left nav.
   ========================================================= */

.sidebar .nav-section[aria-label="Collections"] .nav-item {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  column-gap: 10px !important;
  height: auto !important;
  min-height: 46px !important;
  padding-block: 8px !important;
}

.sidebar .nav-section[aria-label="Collections"] .nav-item .folder-ui-icon {
  display: none !important;
}

.sidebar .nav-section[aria-label="Collections"] .nav-item .menu-text,
.sidebar .sidebar-collapsible-title {
  display: block !important;
  min-width: 0 !important;
  max-width: none !important;
  overflow: visible !important;
  overflow-wrap: anywhere !important;
  text-overflow: clip !important;
  white-space: normal !important;
  word-break: normal !important;
  line-height: 1.32 !important;
}

.sidebar .nav-section[aria-label="Collections"] .nav-item > span:last-child:not(.menu-text):not(.folder-ui-icon):not(.nav-icon) {
  justify-self: end !important;
  min-width: 32px !important;
  padding-inline-start: 8px !important;
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums !important;
}

.sidebar .sidebar-collapsible-summary {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  column-gap: 10px !important;
  height: auto !important;
  min-height: 44px !important;
  padding-block: 7px !important;
}

.sidebar .sidebar-collapsible-count {
  justify-self: end !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* Dark mode consistency fixes. Keep this at the end so it wins over legacy light rules. */

body.dark-theme {
  color-scheme: dark !important;
  --bg: #0f172a !important;
  --panel: #111827 !important;
  --surface: #172033 !important;
  --surface-2: #1f2937 !important;
  --ink: #e5edf7 !important;
  --text: #e5edf7 !important;
  --muted: #a7b4c5 !important;
  --line: #334155 !important;
  --accent: #60a5fa !important;
}

body.dark-theme,
body.dark-theme .app-shell,
body.dark-theme .workspace,
body.dark-theme .library-panel,
body.dark-theme .data-grid-shell,
body.dark-theme .data-grid-scroll,
body.dark-theme .item-list {
  background: #0f172a !important;
  color: #e5edf7 !important;
}

body.dark-theme .top-toolbar,
body.dark-theme .toolbar,
body.dark-theme .app-header,
body.dark-theme .data-grid-toolbar {
  background: #172033 !important;
  border-color: #334155 !important;
  color: #e5edf7 !important;
}

body.dark-theme .sidebar,
body.dark-theme .detail-panel,
body.dark-theme .right-navigation,
body.dark-theme .toolbar-more-panel,
body.dark-theme .settings-panel,
body.dark-theme .settings-content {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #e5edf7 !important;
}

body.dark-theme .table-header,
body.dark-theme .work-table-header,
body.dark-theme .progress-table-header,
body.dark-theme .task-table-header {
  background: linear-gradient(180deg, #1e293b, #172033) !important;
  border-color: #334155 !important;
  color: #e0f2fe !important;
}

body.dark-theme .table-header *,
body.dark-theme .table-header-cell,
body.dark-theme .column-filter-row,
body.dark-theme .column-filter-row *,
body.dark-theme .work-filter-row *,
body.dark-theme .progress-filter-row *,
body.dark-theme .task-filter-row * {
  color: #e0f2fe !important;
  opacity: 1 !important;
}

body.dark-theme .column-filter-row,
body.dark-theme .work-filter-row,
body.dark-theme .progress-filter-row,
body.dark-theme .task-filter-row {
  background: #111827 !important;
  border-color: #334155 !important;
}

body.dark-theme .item-row,
body.dark-theme .work-row,
body.dark-theme .progress-row,
body.dark-theme .task-row {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #dbeafe !important;
}

body.dark-theme .item-row:nth-child(even),
body.dark-theme .work-row:nth-child(even),
body.dark-theme .progress-row:nth-child(even),
body.dark-theme .task-row:nth-child(even) {
  background: #131c2e !important;
}

body.dark-theme .item-row.active,
body.dark-theme .work-row.active,
body.dark-theme .progress-row.active,
body.dark-theme .task-row.active {
  background: #1e3a5f !important;
  box-shadow: inset 4px 0 0 #60a5fa !important;
}

body.dark-theme .item-row *,
body.dark-theme .work-row *,
body.dark-theme .progress-row *,
body.dark-theme .task-row * {
  color: #dbeafe !important;
  opacity: 1 !important;
}

body.dark-theme input,
body.dark-theme textarea,
body.dark-theme select,
body.dark-theme .right-detail-wrap-source,
body.dark-theme .search-box,
body.dark-theme .theme-selector,
body.dark-theme .theme-mode-switch {
  background: #0f172a !important;
  border-color: #475569 !important;
  color: #e5edf7 !important;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
  color: #93a4b8 !important;
}

body.dark-theme button,
body.dark-theme .secondary-action,
body.dark-theme .toolbar-more-summary,
body.dark-theme .theme-palette-button,
body.dark-theme .theme-custom-color-button {
  border-color: #475569 !important;
  color: #e5edf7 !important;
}

body.dark-theme .primary-action,
body.dark-theme #saveButton {
  background: linear-gradient(180deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border-color: #60a5fa !important;
}

body.dark-theme .sidebar-collapsible,
body.dark-theme .nav-menu-group,
body.dark-theme .system-collapsible,
body.dark-theme .nav-item,
body.dark-theme .tag-chip {
  background: #111827 !important;
  border-color: #334155 !important;
  color: #dbeafe !important;
}

body.dark-theme .nav-item.active,
body.dark-theme .tag-chip.active,
body.dark-theme .sidebar-collapsible-content .active {
  background: #1d4ed8 !important;
  color: #ffffff !important;
}

body.dark-theme .sidebar-collapsible-count,
body.dark-theme .nav-count,
body.dark-theme .badge {
  background: #1e293b !important;
  color: #bfdbfe !important;
}

body.dark-theme .toolbar-more-panel {
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42) !important;
}

body.dark-theme .toolbar-more-panel .quick-action-button,
body.dark-theme .toolbar-more-panel button,
body.dark-theme .toolbar-more-panel a {
  background: #172033 !important;
  border-color: #334155 !important;
  color: #e5edf7 !important;
}

body.dark-theme .license-status-toolbar-button {
  background: #172033 !important;
  border-color: #475569 !important;
  color: #e5edf7 !important;
}

body.dark-theme .license-status-toolbar-kicker {
  background: #1e293b !important;
  color: #bfdbfe !important;
}

body.dark-theme .license-status-toolbar-button.is-active .license-status-toolbar-kicker {
  background: #064e3b !important;
  color: #bbf7d0 !important;
}

body.dark-theme .license-status-toolbar-button.is-warning .license-status-toolbar-kicker {
  background: #78350f !important;
  color: #fde68a !important;
}

body.dark-theme .license-status-toolbar-button.is-danger .license-status-toolbar-kicker,
body.dark-theme .license-status-toolbar-button.is-missing .license-status-toolbar-kicker {
  background: #7f1d1d !important;
  color: #fecaca !important;
}

body.dark-theme .license-quick-status-card {
  background: linear-gradient(180deg, #172033, #111827) !important;
  border-color: #475569 !important;
  color: #e5edf7 !important;
}

body.dark-theme .license-quick-close,
body.dark-theme .license-quick-grid > div,
body.dark-theme .license-quick-request-code {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #e5edf7 !important;
}

body.dark-theme .license-quick-grid dd,
body.dark-theme .license-quick-request-code input {
  color: #e5edf7 !important;
}

/* Login static background. Pure presentation layer; authentication flow stays in app.js. */

.app-lock-interactive-grid-layer {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  background:
    radial-gradient(circle at 18% 16%, rgba(37, 99, 235, 0.16), transparent 34%),
    radial-gradient(circle at 82% 20%, rgba(20, 184, 166, 0.10), transparent 34%) !important;
  mix-blend-mode: multiply !important;
}

.app-lock-interactive-grid-canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0.68 !important;
  filter: none !important;
}

.app-lock-overlay {
  background:
    radial-gradient(circle at 16% 12%, rgba(37, 99, 235, 0.18), transparent 32%),
    radial-gradient(circle at 84% 18%, rgba(0, 184, 255, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(241, 247, 255, 0.96), rgba(248, 252, 255, 0.90)) !important;
}

.app-lock-overlay::before,
.app-lock-overlay::after {
  z-index: 1 !important;
}

.app-lock-card.app-lock-card-v2 {
  z-index: 2 !important;
  background: rgba(248, 252, 255, 0.94) !important;
  box-shadow: 0 34px 110px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
  transform: none !important;
  width: min(1120px, calc(100vw - 56px)) !important;
  max-height: min(760px, calc(100vh - 56px)) !important;
  overflow: auto !important;
}

.app-lock-overlay {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100vw !important;
  min-height: 100vh !important;
  box-sizing: border-box !important;
  padding: clamp(18px, 4vh, 44px) clamp(18px, 4vw, 56px) !important;
  overflow: auto !important;
}

.app-lock-form-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 249, 255, 0.94)) !important;
}

@media (prefers-reduced-motion: reduce) {
  .app-lock-interactive-grid-canvas {
    opacity: 0.58 !important;
    filter: none !important;
  }
}

@media (max-width: 860px) {
  .app-lock-overlay {
    align-items: center !important;
    justify-content: center !important;
    padding: 14px !important;
  }

  .app-lock-card.app-lock-card-v2 {
    width: min(560px, calc(100vw - 28px)) !important;
    max-height: calc(100vh - 28px) !important;
  }
}

/* AppDataGrid compact body actions share the same geometry as static cell badges. */

button.data-row-badge-action {
  appearance: none;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  justify-content: center;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

button.data-row-badge-action:hover {
  border-color: color-mix(in srgb, var(--primary, #2563eb) 42%, var(--border, #dbe4ee));
  background: color-mix(in srgb, var(--primary, #2563eb) 12%, #ffffff);
}

button.data-row-badge-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #2563eb) 24%, transparent);
}

button.data-row-badge-action:disabled {
  cursor: default;
  opacity: 0.58;
}

.training-skill-focus-chip {
  align-items: flex-start;
  border-radius: 16px;
}

.training-skill-focus-chip > .training-skill-focus-pill-list {
  justify-content: flex-start;
}

.training-roster-dialog {
  width: min(1120px, calc(100vw - 40px));
  max-width: min(1120px, calc(100vw - 40px));
  border: 0;
  padding: 0;
  border-radius: 24px;
  background: transparent;
}

.training-skill-focus-dialog {
  width: min(1040px, calc(100vw - 40px));
  max-width: min(1040px, calc(100vw - 40px));
}

.training-roster-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
}

.training-roster-panel {
  overflow: hidden;
  color: var(--ink, #172033);
  background: var(--panel, #fff);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
}

.training-roster-panel header,
.training-roster-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line, #d8e2ef);
}

.training-roster-panel footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line, #d8e2ef);
  border-bottom: 0;
}

.training-roster-panel h3 {
  margin: 0;
  font-size: 24px;
}

.training-roster-panel p,
.training-roster-panel small {
  margin: 2px 0 0;
  color: var(--muted, #64748b);
}

.training-roster-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px 22px 8px;
}

.training-roster-toolbar select {
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink, #172033);
  background: var(--panel, #fff);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 14px;
}

.training-roster-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 22px 14px;
}

.training-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-weight: 900;
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 999px;
}

.training-status-chip strong {
  font-size: 20px;
}

.training-status-chip.is-completed {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.training-status-chip.is-ongoing {
  color: #1d4ed8;
  background: #dbeafe;
  border-color: #93c5fd;
}

.training-status-chip.is-pending {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fca5a5;
}

.training-roster-list {
  display: grid;
  max-height: min(56vh, 560px);
  gap: 12px;
  padding: 0 22px 20px;
  overflow: auto;
}

.training-skill-focus-toolbar {
  grid-template-columns: minmax(140px, .45fr) minmax(220px, 1fr) auto;
}

.training-skill-focus-toolbar input {
  min-height: 46px;
  min-width: 0;
  padding: 0 12px;
  color: var(--ink, #172033);
  background: var(--panel, #fff);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 14px;
}

.training-skill-focus-list {
  display: grid;
  max-height: min(58vh, 580px);
  gap: 12px;
  padding: 0 22px 20px;
  overflow: auto;
}

.training-skill-focus-day {
  display: grid;
  grid-template-columns: minmax(150px, .3fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 14px;
  background: color-mix(in srgb, var(--panel, #fff) 94%, #dbeafe 6%);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 18px;
}

.training-skill-focus-day-label {
  display: grid;
  align-content: center;
  gap: 3px;
}

.training-skill-focus-day-label strong {
  color: #172033;
  font-weight: 900;
}

.training-skill-focus-day-label span {
  color: var(--muted, #64748b);
  font-weight: 700;
}

.training-skill-focus-day textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  padding: 10px 12px;
  color: var(--ink, #172033);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 14px;
  font: inherit;
  line-height: 1.35;
}

.training-roster-row {
  padding: 14px;
  background: color-mix(in srgb, var(--panel, #fff) 94%, var(--accent, #2563eb) 6%);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 18px;
}

.training-roster-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.training-roster-person .training-official-person-chip {
  min-width: 0;
}

.training-roster-remove {
  padding: 6px 12px;
  color: #b91c1c;
  font-weight: 800;
  cursor: pointer;
  background: #fff1f2;
  border: 1px solid #fecaca;
  border-radius: 999px;
}

.training-attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.training-attendance-day {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 12px;
}

.training-roster-note,
.training-roster-empty {
  color: var(--muted, #64748b);
  font-weight: 700;
}

body.dark-theme .training-roster-panel,
body.dark-theme .training-roster-toolbar select,
body.dark-theme .training-skill-focus-toolbar input,
body.dark-theme .training-skill-focus-day textarea {
  color: #e5e7eb;
  background: #111827;
  border-color: rgba(148, 163, 184, 0.28);
}

body.dark-theme .training-roster-row,
body.dark-theme .training-skill-focus-day {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.25);
}

body.dark-theme .training-skill-focus-chip {
  color: #dbeafe;
  background: rgba(30, 64, 175, 0.26);
  border-color: rgba(147, 197, 253, 0.38);
}

body.dark-theme .training-skill-focus-pill,
body.dark-mode .training-skill-focus-pill,
body.dark-theme .app-data-grid [data-menu-official-people-overflow],
body.dark-mode .app-data-grid [data-menu-official-people-overflow] {
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(147, 197, 253, 0.36);
}

body.dark-theme .training-skill-focus-pill.is-more,
body.dark-mode .training-skill-focus-pill.is-more,
body.dark-theme .app-data-grid [data-menu-official-people-overflow],
body.dark-mode .app-data-grid [data-menu-official-people-overflow] {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.32);
}

body.dark-theme .training-attendance-day {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.25);
}

.routine-cell-button,
.routine-status-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  color: #0f766e;
  font: inherit;
  font-weight: 900;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  background: color-mix(in srgb, var(--panel, #fff) 88%, #ccfbf1 12%);
  border: 1px solid color-mix(in srgb, #0f766e 30%, var(--line, #d8e2ef));
  border-radius: 12px;
}

.routine-status-cell {
  color: #1d4ed8;
  background: color-mix(in srgb, var(--panel, #fff) 86%, #dbeafe 14%);
  border-color: color-mix(in srgb, #2563eb 34%, var(--line, #d8e2ef));
}

.routine-cell-button:hover,
.routine-status-cell:hover,
.routine-cell-button:focus-visible,
.routine-status-cell:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.routine-person-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: #0f766e;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.2;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  border-radius: 999px;
}

.routine-people-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 8px;
}

.routine-detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.routine-people-field-row,
.routine-status-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: stretch;
}

.routine-people-field-row input,
.routine-people-field-row textarea,
.routine-status-field-row input {
  width: 100%;
  min-width: 0;
}

.routine-roster-button,
.routine-status-button {
  min-height: 44px;
  align-self: stretch;
  padding-inline: 14px;
  white-space: nowrap;
}

.routine-child-dialog {
  width: min(1120px, calc(100vw - 40px));
  max-width: min(1120px, calc(100vw - 40px));
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 24px;
}

.routine-child-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
}

.routine-child-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 18px 22px 8px;
}

.routine-responsible-list,
.routine-status-list {
  display: grid;
  max-height: min(56vh, 560px);
  gap: 12px;
  padding: 0 22px 20px;
  overflow: auto;
}

.routine-responsible-row,
.routine-status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: color-mix(in srgb, var(--panel, #fff) 92%, #eef6ff 8%);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 18px;
}

.routine-status-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.routine-responsible-row label {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  font-weight: 800;
}

.routine-responsible-row select,
.routine-responsible-row textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink, #172033);
  background: var(--panel, #fff);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 12px;
}

.routine-responsible-row select {
  min-height: 42px;
  padding: 0 10px;
}

.routine-responsible-row textarea {
  min-height: 68px;
  padding: 10px;
  resize: vertical;
}

.routine-row-remove {
  min-height: 42px;
  padding: 0 14px;
  color: #b91c1c;
  font-weight: 900;
  cursor: pointer;
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: 12px;
}

.routine-due-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 22px 10px;
}

.routine-due-tab {
  padding: 8px 12px;
  color: var(--ink, #172033);
  font-weight: 900;
  cursor: pointer;
  background: var(--panel, #fff);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 999px;
}

.routine-due-tab.is-active {
  color: #fff;
  background: #2563eb;
  border-color: #2563eb;
}

.routine-status-row strong,
.routine-status-row small {
  display: block;
  overflow-wrap: anywhere;
}

.routine-status-row small {
  margin-top: 4px;
  color: var(--muted, #64748b);
  font-weight: 700;
}

.routine-complete-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #166534;
  font-weight: 900;
}

body.dark-theme .routine-cell-button,
body.dark-theme .routine-status-cell {
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.28);
}

body.dark-theme .routine-person-chip {
  color: #bbf7d0;
  background: rgba(20, 83, 45, 0.65);
  border-color: rgba(134, 239, 172, 0.35);
}

body.dark-theme .routine-responsible-row,
body.dark-theme .routine-status-row {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.25);
}

body.dark-theme .routine-responsible-row select,
body.dark-theme .routine-responsible-row textarea,
body.dark-theme .routine-due-tab {
  color: #e5e7eb;
  background: #111827;
  border-color: rgba(148, 163, 184, 0.28);
}

.official-profile-row-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 28px;
  padding: 4px 10px;
  color: #0f4c81;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  background: #eef6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
}

.official-profile-row-button:hover,
.official-profile-row-button:focus-visible {
  color: #ffffff;
  background: #1d4ed8;
  border-color: #1d4ed8;
  outline: none;
}

.inspector-profile-detail-actions {
  display: grid;
  margin: 0 0 10px;
}

.official-profile-detail-button {
  width: 100%;
  min-height: 44px;
}

.official-profile-dialog {
  position: fixed;
  inset: auto;
  top: 50%;
  left: 50%;
  width: min(1180px, calc(100vw - 48px));
  max-height: min(880px, calc(100vh - 48px));
  margin: 0;
  padding: 0;
  color: var(--ink, #172033);
  background: transparent;
  border: 0;
  transform: translate(-50%, -50%);
}

.official-profile-dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(8px);
}

.official-profile-panel {
  display: grid;
  max-height: min(880px, calc(100vh - 48px));
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 0%, rgba(59, 130, 246, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 26px;
  box-shadow: 0 36px 96px rgba(15, 23, 42, 0.28);
}

.official-profile-header,
.official-profile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line, #d8e2ef);
}

.official-profile-header-with-photo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.official-profile-title-block {
  min-width: 0;
}

.official-profile-photo-card {
  display: grid;
  grid-template-columns: 108px minmax(120px, 220px);
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.official-profile-photo-frame {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  color: #64748b;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(226, 232, 240, 0.88));
  border: 1px solid rgba(148, 163, 184, 0.46);
  border-radius: 24px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
  cursor: pointer;
}

.official-profile-photo-frame:disabled {
  cursor: default;
  opacity: 0.86;
}

.official-profile-photo-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.official-profile-photo-loading,
.official-profile-photo-empty,
.official-profile-photo-unavailable {
  padding: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.official-profile-photo-meta {
  min-width: 0;
}

.official-profile-photo-meta strong,
.official-profile-photo-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.official-profile-photo-meta strong {
  color: var(--ink, #172033);
  font-size: 17px;
}

.official-profile-photo-meta span {
  margin-top: 5px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.official-profile-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line, #d8e2ef);
  border-bottom: 0;
}

.official-profile-header small {
  color: #2563eb;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.official-profile-header h3,
.official-profile-section h4 {
  margin: 0;
  color: var(--ink, #172033);
}

.official-profile-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.official-profile-section-heading > span {
  min-width: 34px;
  padding: 4px 10px;
  color: #0f4c81;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  background: #eaf4ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
}

.official-profile-header h3 {
  margin-top: 2px;
  font-size: 28px;
}

.official-profile-header p {
  margin: 4px 0 0;
  color: var(--muted, #64748b);
}

.official-profile-stats,
.official-profile-section {
  margin: 16px 22px 0;
}

.official-profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.official-profile-stat {
  min-height: 82px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 18px;
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.07);
}

.official-profile-stat strong {
  display: block;
  color: #0f4c81;
  font-size: 28px;
  line-height: 1;
}

.official-profile-stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.official-profile-stat.is-completed strong {
  color: #16a34a;
}

.official-profile-stat.is-pending strong {
  color: #d97706;
}

.official-profile-stat.is-overdue strong {
  color: #dc2626;
}

.official-profile-section {
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 18px;
}

.official-profile-panel {
  overflow-y: auto;
}

.official-profile-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.official-profile-field {
  min-width: 0;
  padding: 12px;
  background: rgba(241, 245, 249, 0.84);
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 14px;
}

.official-profile-field span,
.official-profile-empty {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.official-profile-field strong {
  display: block;
  min-width: 0;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.official-profile-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.official-profile-chip,
.official-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  font-weight: 900;
  border-radius: 999px;
}

.official-profile-chip {
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
}

.official-status-pill {
  color: #1d4ed8;
  background: #dbeafe;
  border: 1px solid #93c5fd;
}

.official-status-completed {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.official-status-pending {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fca5a5;
}

.official-status-ongoing {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

.official-profile-table-wrap {
  max-height: 330px;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 14px;
}

.official-profile-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.official-profile-table th,
.official-profile-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line, #d8e2ef);
}

.official-profile-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #0f4c81;
  font-size: 12px;
  text-transform: uppercase;
  background: #eaf4ff;
}

.official-profile-open-button {
  min-height: 34px;
  white-space: nowrap;
}

.official-profile-documents-summary {
  margin: 8px 0 0;
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.official-profile-documents-table {
  min-width: 840px;
}

.official-profile-super-section .official-profile-table-wrap {
  max-height: 360px;
}

.official-profile-related-table,
.official-profile-composition-table,
.official-profile-annual-equipment-table {
  min-width: 980px;
}

.official-profile-source-menu {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 180px;
  padding: 3px 8px;
  overflow: hidden;
  color: #0f4c81;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #eaf4ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
}

.official-profile-document-name,
.official-profile-document-path {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.official-profile-document-name {
  color: var(--ink, #172033);
  font-weight: 900;
}

.official-profile-document-path {
  margin-top: 4px;
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 700;
}

body.dark-theme .official-profile-panel {
  color: #e5e7eb;
  background:
    radial-gradient(circle at 8% 0%, rgba(59, 130, 246, 0.18), transparent 28%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.96));
  border-color: rgba(148, 163, 184, 0.28);
}

body.dark-theme .official-profile-header,
body.dark-theme .official-profile-footer,
body.dark-theme .official-profile-section,
body.dark-theme .official-profile-stat,
body.dark-theme .official-profile-field,
body.dark-theme .official-profile-photo-frame,
body.dark-theme .official-profile-table-wrap {
  background: rgba(15, 23, 42, 0.74);
  border-color: rgba(148, 163, 184, 0.25);
}

body.dark-theme .official-profile-header h3,
body.dark-theme .official-profile-section h4,
body.dark-theme .official-profile-field strong,
body.dark-theme .official-profile-photo-meta strong,
body.dark-theme .official-profile-document-name {
  color: #f8fafc;
}

body.dark-theme .official-profile-photo-loading,
body.dark-theme .official-profile-photo-empty,
body.dark-theme .official-profile-photo-unavailable,
body.dark-theme .official-profile-photo-meta span,
body.dark-theme .official-profile-documents-summary,
body.dark-theme .official-profile-document-path {
  color: #cbd5e1;
}

body.dark-theme .official-profile-table th {
  color: #bfdbfe;
  background: #111827;
}

body.dark-theme .official-profile-section-heading > span {
  color: #bfdbfe;
  background: rgba(30, 64, 175, 0.26);
  border-color: rgba(96, 165, 250, 0.42);
}

body.dark-theme .official-profile-source-menu {
  color: #bfdbfe;
  background: rgba(30, 64, 175, 0.26);
  border-color: rgba(96, 165, 250, 0.42);
}

@media (max-width: 760px) {
  .official-profile-header-with-photo {
    grid-template-columns: 1fr auto;
  }

  .official-profile-photo-card {
    grid-column: 1 / -1;
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .official-profile-photo-frame {
    width: 86px;
    height: 86px;
    border-radius: 20px;
  }
}

@media (max-width: 560px) {
  .training-people-field-row,
  .training-roster-toolbar {
    grid-template-columns: 1fr;
  }

  .training-roster-button {
    width: 100%;
  }
}

/* Menu 1 document table: keep virtual rows stable while wrapping long text. */

.item-row.document-row-wrap {
  align-items: stretch !important;
  height: var(--document-row-height, 112px) !important;
  min-height: var(--document-row-height, 112px) !important;
  max-height: var(--document-row-height, 112px) !important;
  overflow: hidden !important;
}

.item-row.document-row-wrap > .document-wrap-cell {
  min-width: 0 !important;
  width: 100% !important;
  max-height: calc(1.35em * 4 + 12px);
  padding: 6px 4px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: normal !important;
  text-align: center !important;
  text-overflow: clip !important;
  line-height: 1.35 !important;
}

.item-row.document-row-wrap .document-title-cell {
  align-items: center !important;
  text-align: center !important;
}

.item-row.document-row-wrap .document-title-cell .item-title-line,
.item-row.document-row-wrap .document-title-cell .item-title-line > span {
  min-width: 0 !important;
  width: 100% !important;
  justify-content: center !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  text-align: center !important;
  line-height: 1.35 !important;
}

.table-header span,
.column-filter-row span,
.column-filter-row input {
  min-width: 0 !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header > span:not(.table-control-cell),
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header > .table-header-cell:not(.table-control-cell) {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  line-height: 1.2 !important;
  text-align: center !important;
}

/* Menu 1 scrolling repair: keep one scroll owner and reserve stable scrollbar space. */

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) {
  overflow: hidden !important;
  min-width: 0 !important;
  min-height: 0 !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-shell {
  display: grid !important;
  grid-template-rows: 44px minmax(0, 1fr) auto !important;
  height: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll {
  grid-row: 2 !important;
  overflow: auto !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  scrollbar-gutter: stable both-edges !important;
  overscroll-behavior: contain !important;
  overflow-anchor: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-toolbar {
  gap: 10px !important;
}

/* Shared bottom pager for menu data tables. */

.data-grid-shell.has-table-pager {
  display: grid !important;
  grid-template-rows: 44px minmax(0, 1fr) auto !important;
  height: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.data-grid-shell.has-table-pager .data-grid-scroll {
  grid-row: 2 !important;
  position: relative !important;
  z-index: 1 !important;
  overflow: auto !important;
  overflow-x: auto !important;
  overflow-y: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  scrollbar-gutter: stable both-edges !important;
  overscroll-behavior: contain !important;
  overflow-anchor: none !important;
}

.document-table-pager-footer {
  grid-row: 3 !important;
  position: relative !important;
  z-index: 60 !important;
  display: flex !important;
  align-items: center !important;
  pointer-events: auto !important;
  isolation: isolate !important;
  min-width: 0 !important;
  min-height: 54px !important;
  padding: 8px 14px !important;
  border-top: 1px solid rgba(148, 163, 184, 0.26) !important;
  background: rgba(255, 255, 255, 0.96) !important;
}

.document-table-pager {
  flex: 1 1 auto !important;
  display: flex !important;
  justify-content: space-between !important;
  pointer-events: auto !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #17395f !important;
  box-shadow: none !important;
  font-family: "Times New Roman", "Khmer OS Siemreap", "Noto Serif Khmer", serif !important;
  font-size: 12px !important;
}

.document-pager-summary {
  flex: 1 1 auto !important;
  min-width: 170px !important;
  overflow: hidden !important;
  font-family: "Times New Roman", "Khmer OS Siemreap", "Noto Serif Khmer", serif !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.document-pager-actions {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.document-pager-controls {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  min-width: 0 !important;
}

.document-pager-controls[hidden] {
  display: none !important;
}

.document-pager-nav {
  display: inline-flex !important;
  align-items: center !important;
  overflow: hidden !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
}

.document-table-pager button {
  display: inline-grid !important;
  place-items: center !important;
  pointer-events: auto !important;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border: 1px solid rgba(148, 163, 184, 0.26) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #174a7c !important;
  cursor: pointer !important;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Arial Unicode MS", Arial, sans-serif !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.document-table-pager .document-pager-toggle {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 3px !important;
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border: 1px solid rgba(59, 130, 246, 0.46) !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 2px 7px rgba(37, 99, 235, 0.08) !important;
}

.document-table-pager .document-pager-toggle span {
  display: block !important;
  width: 15px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: #2f7df6 !important;
}

.document-pager-history {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.document-table-pager .document-pager-history-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0 !important;
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #17395f !important;
  font-family: "Times New Roman", "Khmer OS Siemreap", "Noto Serif Khmer", serif !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
}

.document-table-pager .document-pager-history-button.is-forward {
  min-width: 32px !important;
}

.document-table-pager .document-pager-history-button [aria-hidden="true"] {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Arial Unicode MS", Arial, sans-serif !important;
  font-size: 14px !important;
  line-height: 1 !important;
}

.document-pager-history-text {
  display: none !important;
}

.document-pager-source-hidden {
  display: none !important;
}

.document-pager-nav button {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.document-pager-nav button + button {
  border-left: 1px solid rgba(148, 163, 184, 0.26) !important;
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}

.document-pager-nav button:first-child {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.document-table-pager button:hover:not(:disabled),
.document-table-pager button:focus-visible:not(:disabled) {
  background: #eaf4ff !important;
  color: #0f3d68 !important;
}

.document-table-pager .document-pager-toggle:hover:not(:disabled),
.document-table-pager .document-pager-toggle:focus-visible:not(:disabled) {
  border-color: rgba(37, 99, 235, 0.72) !important;
  background: #eff6ff !important;
}

.document-table-pager button:focus-visible:not(:disabled) {
  box-shadow: inset 0 0 0 2px rgba(14, 116, 144, 0.22) !important;
}

.document-table-pager button:disabled {
  opacity: 0.36 !important;
}

.document-page-number-strip {
}

.document-page-size-label {
  gap: 6px !important;
  height: 36px !important;
  padding: 0 9px !important;
  border: 1px solid rgba(148, 163, 184, 0.34) !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
}

.document-page-size-label select {
  height: 28px !important;
  border: 1px solid rgba(125, 157, 198, 0.34) !important;
  border-radius: 6px !important;
  background: #f8fbff !important;
  color: #0f3d68 !important;
  font: inherit !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

.document-page-size-label select {
  min-width: 64px !important;
  padding: 0 22px 0 8px !important;
}

@media (max-width: 1180px) {
  .document-table-pager-footer {
    padding: 7px 10px !important;
  }

  .document-table-pager {
    font-size: 11px !important;
    gap: 8px !important;
  }

  .document-pager-controls {
    gap: 5px !important;
  }

  .document-table-pager button {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
  }

  .document-table-pager .document-pager-toggle {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
  }

  .document-table-pager .document-pager-history-button,
  .document-table-pager .document-pager-history-button.is-forward {
    min-width: 30px !important;
    width: 30px !important;
  }

  .document-pager-summary {
    min-width: 140px !important;
    font-size: 12px !important;
  }

  .document-page-size-label {
    height: 34px !important;
    font-size: 12px !important;
  }

}

@media (max-width: 900px) {
  .document-table-pager {
    flex-wrap: wrap !important;
  }

  .document-pager-summary {
    flex-basis: 100% !important;
  }

  .document-pager-actions {
    width: 100% !important;
    justify-content: flex-end !important;
  }
}

/* Pager visual refresh: reference-style bottom pagination. */

.document-table-pager-footer {
  min-height: 58px !important;
  padding: 8px 22px !important;
  border-top: 1px solid rgba(226, 232, 240, 0.92) !important;
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.03) !important;
}

.document-table-pager {
  display: grid !important;
  grid-template-columns: minmax(170px, 1fr) auto minmax(116px, 1fr) !important;
  align-items: center !important;
  gap: 12px !important;
  min-height: 38px !important;
  font-family: "Inter", "Segoe UI", "Khmer OS Siemreap", "Noto Sans Khmer", Arial, sans-serif !important;
}

.document-pager-summary {
  justify-self: start !important;
  min-width: 0 !important;
  color: #64748b !important;
  font-family: "Inter", "Segoe UI", "Khmer OS Siemreap", "Noto Sans Khmer", Arial, sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
}

.document-page-number-strip {
  justify-self: center !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  min-width: 0 !important;
}

.document-table-pager .document-page-arrow {
  display: inline-grid !important;
  place-items: center !important;
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  padding: 0 !important;
  border: 1px solid #e5edf7 !important;
  border-radius: 9px !important;
  background: #ffffff !important;
  color: #667085 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035) !important;
  font-family: "Inter", "Segoe UI", "Khmer OS Siemreap", "Noto Sans Khmer", Arial, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.document-table-pager .document-page-arrow {
  color: #94a3b8 !important;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Arial Unicode MS", Arial, sans-serif !important;
  font-size: 20px !important;
  font-weight: 800 !important;
}

.document-table-pager button:hover:not(:disabled),
.document-table-pager button:focus-visible:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent, #2563eb) 26%, #dbe6f3) !important;
  background: #f8fbff !important;
  color: var(--accent-strong, #1d4ed8) !important;
  outline: none !important;
}

.document-table-pager button:disabled {
  background: #ffffff !important;
  color: #cbd5e1 !important;
  cursor: default !important;
  opacity: 1 !important;
}

.document-page-size-label {
  justify-self: end !important;
  display: inline-flex !important;
  align-items: center !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.document-page-size-label select {
  width: 112px !important;
  min-width: 112px !important;
  height: 36px !important;
  padding: 0 28px 0 12px !important;
  border: 1px solid #e5edf7 !important;
  border-radius: 9px !important;
  background-color: #ffffff !important;
  color: #475467 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035) !important;
  font-family: "Inter", "Segoe UI", "Khmer OS Siemreap", "Noto Sans Khmer", Arial, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

@media (max-width: 1180px) {
  .document-table-pager-footer {
    padding: 8px 14px !important;
  }

  .document-table-pager {
    gap: 10px !important;
  }

  .document-table-pager .document-page-arrow {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
  }

  .document-page-size-label select {
    width: 106px !important;
    min-width: 106px !important;
    height: 34px !important;
    padding-left: 10px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 900px) {
  .document-table-pager {
    grid-template-columns: 1fr !important;
    justify-items: stretch !important;
  }

  .document-pager-summary,
  .document-page-number-strip,
  .document-page-size-label {
    justify-self: center !important;
  }
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .column-filter-row,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list {
  width: auto !important;
  max-width: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list {
  min-height: 0 !important;
  overflow-anchor: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll .virtual-row-spacer,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll .virtual-row-layer,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll .virtual-row-layer > .item-row {
  width: auto !important;
  max-width: none !important;
  overflow-anchor: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .document-virtual-spacer {
  flex: 0 0 auto !important;
  pointer-events: none !important;
  overflow-anchor: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header > [data-sort-key] {
  position: relative !important;
  cursor: pointer !important;
  gap: 5px !important;
  padding-right: 20px !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header > [data-sort-key]::after {
  content: none !important;
}

.table-header > [data-sort-key] {
  position: relative !important;
}

.table-header-label-text {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.table-sort-button {
  position: absolute !important;
  top: 50% !important;
  right: 5px !important;
  transform: translateY(-50%) !important;
  flex: 0 0 16px !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  display: inline-grid !important;
  place-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: transparent !important;
  cursor: pointer !important;
}

.table-sort-button::before {
  content: "" !important;
  display: inline-grid !important;
  place-items: center !important;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Arial Unicode MS", Arial, sans-serif !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.table-header > [data-sort-key][aria-sort="ascending"] .table-sort-button::before {
  content: "\25b2" !important;
}

.table-header > [data-sort-key][aria-sort="descending"] .table-sort-button::before {
  content: "\25bc" !important;
}

.table-header > [data-sort-key][aria-sort="ascending"] .table-sort-button,
.table-header > [data-sort-key][aria-sort="descending"] .table-sort-button {
  border-color: rgba(29, 78, 216, 0.88) !important;
  background: #1d4ed8 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12) !important;
  color: #fff !important;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.table-header > [data-sort-key][aria-sort="ascending"] .table-sort-button:hover,
.table-header > [data-sort-key][aria-sort="ascending"] .table-sort-button:focus-visible,
.table-header > [data-sort-key][aria-sort="descending"] .table-sort-button:hover,
.table-header > [data-sort-key][aria-sort="descending"] .table-sort-button:focus-visible {
  border-color: rgba(29, 78, 216, 0.88) !important;
  background: #1d4ed8 !important;
  color: #fff !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .table-clear-button {
  position: relative !important;
  display: inline-grid !important;
  place-items: center !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 1 !important;
  overflow: hidden !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .table-clear-button::before {
  content: "\00d7" !important;
  color: #7a2426 !important;
  font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Arial Unicode MS", Arial, sans-serif !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .table-clear-button:hover::before,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .table-clear-button:focus-visible::before {
  color: #fff !important;
}

/* Login lock must stay centered on every protected app load/reload. */

html.paperdesk-protected-login-required .app-lock-overlay,
body.app-is-locked .app-lock-overlay,
body:has(#appLockOverlay) .app-lock-overlay,
.app-lock-overlay {
  position: fixed !important;
  inset: 0 !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  min-width: 100dvw !important;
  min-height: 100dvh !important;
  display: grid !important;
  place-items: center !important;
  align-content: center !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: clamp(18px, 4vh, 44px) clamp(18px, 4vw, 56px) !important;
}

.app-lock-card.app-lock-card-v2 {
  justify-self: center !important;
  align-self: center !important;
  margin: auto !important;
}

.app-lock-overlay .lock-message {
  font-family: "Khmer OS Siemreap", "Noto Sans Khmer", "Segoe UI", Arial, sans-serif !important;
  text-rendering: optimizeLegibility !important;
  -webkit-font-smoothing: antialiased !important;
}

/* Login lock must not create page/card scrollbars. */

html.paperdesk-protected-login-required,
html.paperdesk-protected-login-required body,
body.app-is-locked {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  scrollbar-width: none !important;
}

html.paperdesk-protected-login-required::-webkit-scrollbar,
html.paperdesk-protected-login-required body::-webkit-scrollbar,
body.app-is-locked::-webkit-scrollbar {
  display: none !important;
}

html.paperdesk-protected-login-required .app-shell,
body.app-is-locked .app-shell,
html.paperdesk-protected-login-required .workspace,
body.app-is-locked .workspace,
html.paperdesk-protected-login-required .content-grid,
body.app-is-locked .content-grid,
html.paperdesk-protected-login-required .library-panel,
body.app-is-locked .library-panel,
html.paperdesk-protected-login-required .data-grid-scroll,
body.app-is-locked .data-grid-scroll {
  overflow: hidden !important;
}

/* USER FIX: Menu 1 table design follows Menu 2 inspector table.
   Keep Menu 1 paging/virtual scroll, but use the same clean table skin. */

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header {
  min-height: 40px !important;
  padding: 6px 10px !important;
  background: #d1effb !important;
  color: var(--ink, #1e2424) !important;
  border-bottom: 1px solid var(--line, #dfe4dd) !important;
  box-shadow: none !important;
  font-family: var(--khmer-table-font, "Noto Sans Khmer", "Khmer OS Siemreap", "Times New Roman", serif) !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 1.45 !important;
  text-transform: uppercase !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header > span:not(.table-control-cell),
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .table-header > .table-header-cell:not(.table-control-cell) {
  min-height: 26px !important;
  padding: 2px 0 !important;
  justify-content: flex-start !important;
  color: var(--ink, #1e2424) !important;
  border-right: 0 !important;
  background: transparent !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  line-height: 1.45 !important;
  text-align: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .column-filter-row {
  top: 40px !important;
  min-height: 40px !important;
  padding: 6px 10px !important;
  background: #f7faf8 !important;
  border-bottom: 1px solid var(--line, #dfe4dd) !important;
  box-shadow: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .column-filter-row > span:not(.table-control-cell),
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .column-filter-row > label,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .column-filter-row > div:not(.table-control-cell) {
  min-height: 28px !important;
  padding: 0 !important;
  border-right: 0 !important;
  background: transparent !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .column-filter-row input,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .column-filter-row select {
  min-height: 28px !important;
  height: 28px !important;
  margin-left: -3px !important;
  padding: 4px 3px !important;
  border: 1px solid #d5dfda !important;
  border-radius: 4px !important;
  background: #ffffff !important;
  color: var(--ink, #1e2424) !important;
  box-shadow: none !important;
  font-family: var(--khmer-table-font, "Noto Sans Khmer", "Khmer OS Siemreap", "Times New Roman", serif) !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  text-align: left !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row {
  background: #ffffff !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line, #dfe4dd) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--ink, #1e2424) !important;
  transform: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row:hover,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.active,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.selected-for-download {
  background: #f1f7f5 !important;
  box-shadow: none !important;
  transform: none !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.pinned-row {
  background: #fbfcff !important;
  box-shadow: inset 3px 0 0 var(--accent, #3333ff) !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.pinned-row.active,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.pinned-row:hover {
  background: #f1f7f5 !important;
}

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row > span:not(.table-control-cell),
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row > div:not(.table-control-cell) {
  border-right: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink, #1e2424) !important;
  font-family: var(--khmer-table-font, "Noto Sans Khmer", "Khmer OS Siemreap", "Times New Roman", serif) !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
  justify-content: flex-start !important;
  text-align: left !important;
}

/* USER FIX: Menu 1 row text reads from the left edge.
   Keep control/preview columns centered, but stop document text cells from
   inheriting the older centered wrapping rules. */

.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.document-row-wrap .document-title-cell,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.document-row-wrap .item-title,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.document-row-wrap .item-title-line,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.document-row-wrap .item-title-line > span,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.document-row-wrap .legal-reference-cell,
.library-panel:not(.inspector-mode):not(.task-mode):not(.work-mode) .data-grid-scroll > .item-list > .item-row.document-row-wrap .document-wrap-cell {
  justify-content: flex-start !important;
  text-align: left !important;
}

/* USER FIX: Left navigation width and drag handle.
   Make the default panel wide enough for one-line labels, keep old saved
   narrow widths from returning after reload, and expose the right edge
   as a practical resize target. */

:root {
  --nav-expanded-width: 340px;
}

.app-shell,
body.holographic-glass-theme .app-shell,
body.vision-blue-theme .app-shell,
body.luxury-silver-theme .app-shell,
body[class$="-theme"] .app-shell {
}

.sidebar,
body.holographic-glass-theme .sidebar,
body.vision-blue-theme .sidebar,
body.luxury-silver-theme .sidebar,
body[class$="-theme"] .sidebar {
  min-width: 300px !important;
  max-width: 680px !important;
  overflow-x: hidden !important;
}

.app-shell:not(.sidebar-collapsed) .sidebar-resize-handle,
body.holographic-glass-theme .app-shell:not(.sidebar-collapsed) .sidebar-resize-handle,
body.vision-blue-theme .app-shell:not(.sidebar-collapsed) .sidebar-resize-handle,
body.luxury-silver-theme .app-shell:not(.sidebar-collapsed) .sidebar-resize-handle,
body[class$="-theme"] .app-shell:not(.sidebar-collapsed) .sidebar-resize-handle {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  touch-action: auto !important;
}

.sidebar-resize-handle::before,
.sidebar-resize-handle::after {
  display: none !important;
  content: none !important;
}

.app-shell.sidebar-collapsed .sidebar-resize-handle {
}

body.sidebar-resizing,
body.sidebar-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sidebar .nav-menu-content .nav-item,
.sidebar .nav-menu-content .dashboard-nav-item,
.sidebar .nav-section[aria-label="Collections"] .nav-item,
.sidebar .sidebar-collapsible-summary {
  min-height: 42px !important;
}

.sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item),
.sidebar .nav-section[aria-label="Collections"] .nav-item,
.sidebar .sidebar-collapsible-summary {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  column-gap: 12px !important;
}

.sidebar .nav-item .menu-text,
.sidebar .dashboard-nav-item .menu-text,
.sidebar .nav-menu-content .menu-text,
.sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item) .menu-text,
.sidebar .nav-section[aria-label="Collections"] .nav-item .menu-text,
.sidebar .sidebar-collapsible-title {
  display: block !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
  overflow-wrap: normal !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  word-break: normal !important;
  line-height: 1.28 !important;
}

html.paperdesk-protected-login-required .app-lock-overlay,
body.app-is-locked .app-lock-overlay,
body:has(#appLockOverlay) .app-lock-overlay,
.app-lock-overlay {
  overflow: hidden !important;
  overflow-y: hidden !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  max-height: 100vh !important;
}

.app-lock-card.app-lock-card-v2 {
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  max-width: min(1120px, calc(100vw - 72px)) !important;
  max-height: calc(100vh - 72px) !important;
}

/* USER FIX: Move Global Search and AI Decision controls into right navigation */

.content-grid.dashboard-mode.global-search-mode,
.content-grid.dashboard-mode.ai-decision-mode {
  grid-template-columns: minmax(0, 1fr) 6px var(--detail-width, 360px) !important;
  gap: 0 !important;
}

.content-grid.dashboard-mode.global-search-mode .library-panel,
.content-grid.dashboard-mode.ai-decision-mode .library-panel {
  border-right: 0 !important;
  border-radius: 22px 0 0 22px !important;
}

.content-grid.dashboard-mode.global-search-mode .resize-handle,
.content-grid.dashboard-mode.ai-decision-mode .resize-handle {
  display: block !important;
  min-height: 0 !important;
  height: 100% !important;
  cursor: col-resize !important;
}

.content-grid.dashboard-mode.global-search-mode .detail-panel,
.content-grid.dashboard-mode.ai-decision-mode .detail-panel {
  display: block !important;
  min-width: 0 !important;
  width: auto !important;
  max-width: none !important;
  border-left: 1px solid var(--line, #d8e2ef) !important;
  border-radius: 0 22px 22px 0 !important;
  overflow: auto !important;
}

.content-grid.dashboard-mode.global-search-mode.detail-collapsed,
.content-grid.dashboard-mode.ai-decision-mode.detail-collapsed {
  grid-template-columns: minmax(0, 1fr) 0 0 !important;
}

.content-grid.dashboard-mode.global-search-mode.detail-collapsed .resize-handle,
.content-grid.dashboard-mode.ai-decision-mode.detail-collapsed .resize-handle {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  pointer-events: none !important;
}

.content-grid.dashboard-mode.global-search-mode.detail-collapsed .detail-panel,
.content-grid.dashboard-mode.ai-decision-mode.detail-collapsed .detail-panel {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  border-left: 0 !important;
  overflow: hidden !important;
}

.global-search-right-panel,
.ai-decision-right-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 100%;
  padding: 18px;
}

.global-search-right-panel[hidden],
.ai-decision-right-panel[hidden] {
  display: none !important;
}

.global-search-right-heading,
.ai-decision-right-heading {
  margin: -4px -4px 0;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line, #d8e2ef);
}

.global-search-right-heading h2,
.ai-decision-right-heading h2 {
  margin: 0;
  color: var(--ink, #172033);
  font-size: 22px;
  line-height: 1.15;
}

.global-search-right-heading span,
.ai-decision-right-heading span {
  color: var(--muted, #64748b);
  font-size: 12px;
  font-weight: 800;
}

.global-search-right-panel .global-search-panel,
.ai-decision-right-panel .ai-decision-panel {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.global-search-right-panel .global-search-main-row,
.ai-decision-right-panel .ai-decision-actions {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
}

.global-search-right-panel .global-search-filter-grid,
.ai-decision-right-panel .ai-decision-filter-grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
  margin-top: 12px !important;
}

.global-search-right-panel .global-search-main-input,
.global-search-right-panel .global-search-filter,
.ai-decision-right-panel .ai-decision-filter,
.ai-decision-right-panel .ai-decision-question {
  display: grid !important;
  gap: 6px !important;
  min-width: 0 !important;
}

.global-search-right-panel .global-search-main-input span,
.global-search-right-panel .global-search-filter span,
.ai-decision-right-panel .ai-decision-filter span,
.ai-decision-right-panel .ai-decision-question span {
  color: var(--muted, #64748b) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

.global-search-right-panel input,
.global-search-right-panel select,
.ai-decision-right-panel input,
.ai-decision-right-panel select,
.ai-decision-right-panel textarea {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  font-size: 14px !important;
}

.ai-decision-right-panel textarea {
  min-height: 150px !important;
  resize: vertical !important;
}

.global-search-right-panel [data-global-clear],
.ai-decision-right-panel [data-ai-analyze],
.ai-decision-right-panel [data-ai-clear] {
  width: 100% !important;
  min-height: 44px !important;
}

.global-search-detail-mode > form,
.ai-decision-detail-mode > form {
  display: none !important;
}

body.dark-theme .global-search-right-heading h2,
body.dark-theme .ai-decision-right-heading h2,
body.dark-mode .global-search-right-heading h2,
body.dark-mode .ai-decision-right-heading h2 {
  color: #e8eef8 !important;
}

/* USER FIX: Fixed floating button dock. Disable old snap/grid positioning so zoom cannot push buttons off track. */

#floatingButtonGroupControls {
  display: none !important;
}

.floating-edge-snap-button,
.floating-edge-snap-button.is-positioned,
.floating-edge-snap-button.is-dragging,
.floating-edge-snap-button.is-edge-ready,
.floating-edge-snap-button.is-grid-adjusting,
.floating-edge-snap-button.is-snapped-left,
.floating-edge-snap-button.is-snapped-right,
.floating-edge-snap-button.is-snapped-top,
.floating-edge-snap-button.is-snapped-bottom,
.floating-settings-btn,
.floating-settings-btn.is-snapped-left,
.floating-settings-btn.is-snapped-right,
.floating-settings-btn.is-snapped-top,
.floating-settings-btn.is-snapped-bottom {
  position: fixed !important;
  top: auto !important;
  right: auto !important;
  bottom: 10px !important;
  transform: none !important;
  border-radius: calc(10px * var(--floating-button-scale, 1)) !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition:
    width 160ms ease,
    height 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease !important;
  z-index: 2200 !important;
}

#floatingRightNavigationButton {
  left: 10px !important;
}

#floatingDownloadButton {
  left: 58px !important;
}

#floatingCopyCiteButton {
  left: 106px !important;
}

#floatingPrintButton {
  left: 154px !important;
}

#floatingDocumentationButton {
  left: 202px !important;
}

#floatingThemeButton {
  left: 250px !important;
}

body.floating-buttons-move-together .floating-edge-snap-button,
body.floating-buttons-locked .floating-edge-snap-button,
.floating-edge-snap-button.is-move-locked {
  cursor: pointer !important;
  transform: none !important;
}

body.floating-buttons-locked .floating-edge-snap-button::before {
  border-style: solid !important;
  opacity: 0.72 !important;
}

/* USER FIX: Draggable right navigation width. The divider is the border handle. */

:root {
  --right-drawer-width-final: var(--detail-width, 420px) !important;
  --right-drawer-push-width: min(var(--right-drawer-width-final), calc(100vw - 260px)) !important;
}

.resize-handle {
  width: 8px !important;
  min-width: 8px !important;
  cursor: col-resize !important;
  touch-action: none !important;
  position: relative !important;
  background: color-mix(in srgb, var(--line, #d8e2ef) 62%, #ffffff) !important;
  border: 0 !important;
  z-index: 12 !important;
}

.resize-handle::before {
  content: "" !important;
  position: absolute !important;
  top: 10px !important;
  bottom: 10px !important;
  left: 3px !important;
  width: 2px !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--muted, #64748b) 38%, transparent) !important;
  opacity: 0.62 !important;
}

.resize-handle:hover::before,
.content-grid.resizing .resize-handle::before,
body.right-navigation-resizing .resize-handle::before {
  left: 2px !important;
  width: 4px !important;
  background: var(--accent, #2563eb) !important;
  opacity: 1 !important;
}

.content-grid.resizing,
body.right-navigation-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

.content-grid:not(.dashboard-mode):not(.detail-collapsed) .resize-handle,
body.right-detail-drawer-open .content-grid:not(.dashboard-mode):not(.detail-collapsed) .resize-handle {
  display: block !important;
  position: fixed !important;
  top: 0 !important;
  right: var(--right-drawer-push-width) !important;
  bottom: 0 !important;
  left: auto !important;
  width: 10px !important;
  min-width: 10px !important;
  height: 100vh !important;
  pointer-events: auto !important;
  z-index: 10055 !important;
  background: transparent !important;
}

.content-grid:not(.dashboard-mode):not(.detail-collapsed) .resize-handle::before,
body.right-detail-drawer-open .content-grid:not(.dashboard-mode):not(.detail-collapsed) .resize-handle::before {
  top: 18px !important;
  bottom: 18px !important;
  left: 4px !important;
}

.content-grid:not(.dashboard-mode):not(.detail-collapsed) .detail-panel,
body.right-detail-drawer-open .content-grid:not(.dashboard-mode):not(.detail-collapsed) .detail-panel,
body:has(.content-grid:not(.dashboard-mode):not(.detail-collapsed)) .content-grid:not(.dashboard-mode):not(.detail-collapsed) .detail-panel {
  width: var(--right-drawer-push-width) !important;
  min-width: min(320px, calc(100vw - 260px)) !important;
  max-width: min(920px, calc(100vw - 260px)) !important;
}

.content-grid.dashboard-mode.global-search-mode,
.content-grid.dashboard-mode.ai-decision-mode {
  grid-template-columns: minmax(0, 1fr) 8px minmax(320px, var(--detail-width, 420px)) !important;
}

.content-grid.dashboard-mode.global-search-mode .resize-handle,
.content-grid.dashboard-mode.ai-decision-mode .resize-handle {
  display: block !important;
  width: 8px !important;
  min-width: 8px !important;
  pointer-events: auto !important;
  background: color-mix(in srgb, var(--line, #d8e2ef) 64%, #ffffff) !important;
}

.content-grid.dashboard-mode.global-search-mode.detail-collapsed,
.content-grid.dashboard-mode.ai-decision-mode.detail-collapsed {
  grid-template-columns: minmax(0, 1fr) 0 0 !important;
}

.content-grid.dashboard-mode.global-search-mode.detail-collapsed .resize-handle,
.content-grid.dashboard-mode.ai-decision-mode.detail-collapsed .resize-handle,
.content-grid.dashboard-mode.global-search-mode.detail-collapsed .detail-panel,
.content-grid.dashboard-mode.ai-decision-mode.detail-collapsed .detail-panel {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  pointer-events: none !important;
}

/* USER FIX: Restore safe floating snap controls without returning to off-screen drag/snap behavior. */

#floatingButtonGroupControls {
  display: grid !important;
}

.floating-button-group-actions .secondary-action[aria-pressed="true"] {
  background: var(--accent-strong, #1d4ed8) !important;
  border-color: var(--accent-strong, #1d4ed8) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent, #2563eb) 30%, transparent) !important;
}

body.floating-buttons-horizontal-dock #floatingRightNavigationButton,
body:not(.floating-buttons-vertical-dock) #floatingRightNavigationButton {
  left: 10px !important;
  bottom: 10px !important;
}

body.floating-buttons-horizontal-dock #floatingDownloadButton,
body:not(.floating-buttons-vertical-dock) #floatingDownloadButton {
  left: 58px !important;
  bottom: 10px !important;
}

body.floating-buttons-horizontal-dock #floatingCopyCiteButton,
body:not(.floating-buttons-vertical-dock) #floatingCopyCiteButton {
  left: 106px !important;
  bottom: 10px !important;
}

body.floating-buttons-horizontal-dock #floatingPrintButton,
body:not(.floating-buttons-vertical-dock) #floatingPrintButton {
  left: 154px !important;
  bottom: 10px !important;
}

body.floating-buttons-horizontal-dock #floatingDocumentationButton,
body:not(.floating-buttons-vertical-dock) #floatingDocumentationButton {
  left: 202px !important;
  bottom: 10px !important;
}

body.floating-buttons-horizontal-dock #floatingThemeButton,
body:not(.floating-buttons-vertical-dock) #floatingThemeButton {
  left: 250px !important;
  bottom: 10px !important;
}

body.floating-buttons-vertical-dock #floatingRightNavigationButton {
  left: 10px !important;
  bottom: 250px !important;
}

body.floating-buttons-vertical-dock #floatingDownloadButton {
  left: 10px !important;
  bottom: 202px !important;
}

body.floating-buttons-vertical-dock #floatingCopyCiteButton {
  left: 10px !important;
  bottom: 154px !important;
}

body.floating-buttons-vertical-dock #floatingPrintButton {
  left: 10px !important;
  bottom: 106px !important;
}

body.floating-buttons-vertical-dock #floatingDocumentationButton {
  left: 10px !important;
  bottom: 58px !important;
}

body.floating-buttons-vertical-dock #floatingThemeButton {
  left: 10px !important;
  bottom: 10px !important;
}

/* USER FIX: Floating buttons remain draggable unless movement is locked. */

.floating-edge-snap-button {
  cursor: grab !important;
  touch-action: none !important;
}

.floating-edge-snap-button.is-dragging {
  cursor: grabbing !important;
}

body.floating-buttons-locked .floating-edge-snap-button,
.floating-edge-snap-button.is-move-locked {
  cursor: pointer !important;
}

.menu3-document-form-version-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 0;
  padding: 0;
  border-radius: 22px;
  background: transparent;
}

.menu3-document-form-version-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
}

.menu3-document-form-version-panel {
  color: var(--ink, #172033);
  background: var(--panel, #ffffff);
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.menu3-document-form-version-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line, #d8e2ef);
}

.menu3-document-form-version-panel h3 {
  margin: 0;
  font-size: 22px;
}

.menu3-document-form-version-panel p {
  margin: 4px 0 0;
  color: var(--muted, #64748b);
}

.menu3-document-form-version-list {
  display: grid;
  gap: 10px;
  padding: 16px 20px 20px;
}

.menu3-document-form-version-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 12px 14px;
  color: var(--ink, #172033);
  background: #f8fbff;
  border: 1px solid var(--line, #d8e2ef);
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
}

.menu3-document-form-version-option strong,
.menu3-document-form-version-option small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu3-document-form-version-option small {
  margin-top: 3px;
  color: var(--muted, #64748b);
}

.menu3-document-form-version-option em {
  color: var(--accent-strong, #1d4ed8);
  font-style: normal;
  font-weight: 900;
}

.menu3-document-form-version-option:hover {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.12);
}

/* USER FIX: Calendar Timeline Sources belong only to Calendar, never Global Search or AI Decision. */

.detail-panel.global-search-detail-mode [data-calendar-right-panel],
.detail-panel.ai-decision-detail-mode [data-calendar-right-panel],
.content-grid.dashboard-mode.global-search-mode [data-calendar-right-panel],
.content-grid.dashboard-mode.ai-decision-mode [data-calendar-right-panel] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* USER FIX: shadcn sidebar-07 style icon collapse for the real app navigation. */

:root {
  --nav-collapsed-width: 3rem;
}

.app-shell,
body.holographic-glass-theme .app-shell,
body.vision-blue-theme .app-shell,
body.luxury-silver-theme .app-shell,
body[class$="-theme"] .app-shell {
  grid-template-columns: var(--pd-responsive-sidebar-column, var(--pd-shadcn-sidebar-width, 280px)) minmax(0, 1fr) !important;
  transition: grid-template-columns 150ms ease-linear !important;
}

.app-shell.sidebar-collapsed,
body.holographic-glass-theme .app-shell.sidebar-collapsed,
body.vision-blue-theme .app-shell.sidebar-collapsed,
body.luxury-silver-theme .app-shell.sidebar-collapsed,
body[class$="-theme"] .app-shell.sidebar-collapsed {
  grid-template-columns: var(--nav-collapsed-width, 3rem) minmax(0, 1fr) !important;
}

.app-shell.sidebar-collapsed .sidebar,
body.holographic-glass-theme .app-shell.sidebar-collapsed .sidebar,
body.vision-blue-theme .app-shell.sidebar-collapsed .sidebar,
body.luxury-silver-theme .app-shell.sidebar-collapsed .sidebar,
body[class$="-theme"] .app-shell.sidebar-collapsed .sidebar {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: var(--nav-collapsed-width, 3rem) !important;
  min-width: var(--nav-collapsed-width, 3rem) !important;
  max-width: var(--nav-collapsed-width, 3rem) !important;
  padding: 0.5rem 0.25rem !important;
  color: var(--sidebar-foreground, #0a0a0a) !important;
  background: var(--sidebar, #fafafa) !important;
  border-right: 0 !important;
  box-shadow: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  translate: none !important;
}

.app-shell.sidebar-collapsed .sidebar > :not(.sidebar-resize-handle),
body[class$="-theme"] .app-shell.sidebar-collapsed .sidebar > :not(.sidebar-resize-handle) {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none !important;
}

.app-shell.sidebar-collapsed .sidebar::before,
.app-shell.sidebar-collapsed .sidebar::after,
body.navigation-collapsed::before,
body.navigation-collapsed::after {
  display: none !important;
  content: none !important;
}

.app-shell.sidebar-collapsed .sidebar-resize-handle {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.app-shell.sidebar-collapsed #addItemButton,
.app-shell.sidebar-collapsed .sidebar-tools,
.app-shell.sidebar-collapsed .tag-panel,
.app-shell.sidebar-collapsed .system-utilization-panel,
.app-shell.sidebar-collapsed #systemUtilizationPanel,
.app-shell.sidebar-collapsed .nav-section[aria-label="Collections"] > h2,
.app-shell.sidebar-collapsed .sidebar-collapsible-summary,
.app-shell.sidebar-collapsed .sidebar-collapsible-count,
.app-shell.sidebar-collapsed .menu-count,
.app-shell.sidebar-collapsed .nav-item > span[id$="Count"],
.app-shell.sidebar-collapsed .nav-item > span:last-child:not(.menu-text):not(.folder-ui-icon):not(.nav-icon) {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-section[aria-label="Collections"] {
  display: grid !important;
  width: 100% !important;
  gap: 0.25rem !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: visible !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-menu-group.sidebar-collapsible {
  display: block !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-menu-group.sidebar-collapsible > .sidebar-collapsible-content.nav-menu-content {
  display: grid !important;
  width: 100% !important;
  max-height: none !important;
  gap: 0.25rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
  overflow-y: visible !important;
  scrollbar-gutter: auto !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-menu-content .nav-item,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .dashboard-nav-item,
.app-shell.sidebar-collapsed .sidebar .nav-section[aria-label="Collections"] .nav-item {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2rem !important;
  min-width: 2rem !important;
  max-width: 2rem !important;
  height: 2rem !important;
  min-height: 2rem !important;
  padding: 0 !important;
  margin: 0 auto !important;
  gap: 0 !important;
  color: var(--sidebar-foreground, #0a0a0a) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: calc(var(--radius, 0.625rem) - 2px) !important;
  box-shadow: none !important;
  text-align: center !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-menu-content .nav-item:hover,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .dashboard-nav-item:hover,
.app-shell.sidebar-collapsed .sidebar .nav-section[aria-label="Collections"] .nav-item:hover {
  color: var(--sidebar-accent-foreground, #171717) !important;
  background: var(--sidebar-accent, #f5f5f5) !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-menu-content .nav-item.active,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .dashboard-nav-item.active,
.app-shell.sidebar-collapsed .sidebar .nav-section[aria-label="Collections"] .nav-item.active {
  color: var(--sidebar-accent-foreground, #171717) !important;
  background: var(--sidebar-accent, #f5f5f5) !important;
  border: 1px solid var(--sidebar-border, #e5e5e5) !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-item.active::before,
.app-shell.sidebar-collapsed .sidebar .dashboard-nav-item.active::before {
  display: none !important;
  content: none !important;
}

.app-shell.sidebar-collapsed .sidebar .folder-ui-icon,
.app-shell.sidebar-collapsed .sidebar .nav-section[aria-label="Collections"] .nav-item .folder-ui-icon,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .nav-item .folder-ui-icon,
.app-shell.sidebar-collapsed .sidebar .nav-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1rem !important;
  min-width: 1rem !important;
  height: 1rem !important;
  margin: 0 !important;
  color: currentColor !important;
  font-size: 1rem !important;
  line-height: 1 !important;
}

.app-shell.sidebar-collapsed .sidebar .folder-ui-icon::before {
  width: 0.9rem !important;
  height: 0.75rem !important;
  margin: 0 !important;
  background: currentColor !important;
}

.app-shell.sidebar-collapsed .sidebar .nav-item .menu-text,
.app-shell.sidebar-collapsed .sidebar .dashboard-nav-item .menu-text,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .menu-text,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item) .menu-text,
.app-shell.sidebar-collapsed .sidebar .nav-section[aria-label="Collections"] .nav-item .menu-text,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .nav-item .menu-text,
.app-shell.sidebar-collapsed .sidebar .nav-menu-content .dashboard-nav-item .menu-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-shell.sidebar-collapsed .sidebar {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.app-shell.sidebar-collapsed .sidebar::-webkit-scrollbar,
.app-shell.sidebar-collapsed .sidebar::-webkit-scrollbar-button {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.app-shell.sidebar-collapsed .toolbar {
  padding-left: 18px !important;
}

.app-shell.sidebar-collapsed .workspace {
  min-width: 0 !important;
  margin-left: 0 !important;
}

body.dark-theme .app-shell.sidebar-collapsed .sidebar,
body.midnight-theme .app-shell.sidebar-collapsed .sidebar,
body.deep-navy-theme .app-shell.sidebar-collapsed .sidebar,
body.charcoal-theme .app-shell.sidebar-collapsed .sidebar,
body.dark-emerald-theme .app-shell.sidebar-collapsed .sidebar {
  color: var(--sidebar-foreground, #fafafa) !important;
  background: var(--sidebar, #171717) !important;
  border-right-color: var(--sidebar-border, rgba(255, 255, 255, 0.1)) !important;
}

body.dark-theme .app-shell.sidebar-collapsed .sidebar .nav-item:hover,
body.midnight-theme .app-shell.sidebar-collapsed .sidebar .nav-item:hover,
body.deep-navy-theme .app-shell.sidebar-collapsed .sidebar .nav-item:hover,
body.charcoal-theme .app-shell.sidebar-collapsed .sidebar .nav-item:hover,
body.dark-emerald-theme .app-shell.sidebar-collapsed .sidebar .nav-item:hover,
body.dark-theme .app-shell.sidebar-collapsed .sidebar .nav-item.active,
body.midnight-theme .app-shell.sidebar-collapsed .sidebar .nav-item.active,
body.deep-navy-theme .app-shell.sidebar-collapsed .sidebar .nav-item.active,
body.charcoal-theme .app-shell.sidebar-collapsed .sidebar .nav-item.active,
body.dark-emerald-theme .app-shell.sidebar-collapsed .sidebar .nav-item.active {
  color: var(--sidebar-accent-foreground, #fafafa) !important;
  background: var(--sidebar-accent, #262626) !important;
  border-color: var(--sidebar-border, rgba(255, 255, 255, 0.1)) !important;
}

.app-shell:not(.sidebar-collapsed) .sidebar .nav-menu-content .nav-item:not(.dashboard-nav-item),
.app-shell:not(.sidebar-collapsed) .sidebar .nav-section[aria-label="Collections"] .nav-item:not(.dashboard-nav-item) {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
}

.app-shell:not(.sidebar-collapsed) .sidebar .nav-section[aria-label="Collections"] .nav-item .folder-ui-icon,
.app-shell:not(.sidebar-collapsed) .sidebar .nav-menu-content .nav-item .folder-ui-icon,
.app-shell:not(.sidebar-collapsed) .sidebar .nav-item .nav-icon {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1rem !important;
  min-width: 1rem !important;
  height: 1rem !important;
  margin: 0 !important;
  color: currentColor !important;
  font-size: 1rem !important;
  line-height: 1 !important;
}

/* USER FIX: Menu 1 shows all items without its own inner scrollbar. */

.app-shell:not(.sidebar-collapsed) .sidebar .nav-menu-group.sidebar-collapsible[data-sidebar-section="menu1"] > .sidebar-collapsible-content.nav-menu-content {
  max-height: none !important;
  overflow: visible !important;
  overflow-y: visible !important;
  scrollbar-gutter: auto !important;
}

/* USER FIX: shadcn SidebarTrigger-style right navigation toggle. */

.panel-arrow-toggle,
.content-grid.detail-collapsed .panel-arrow-toggle,
body[class$="-theme"] .panel-arrow-toggle {
  position: absolute !important;
  top: 10px !important;
  left: -50px !important;
  z-index: 18 !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 40px !important;
  min-width: 40px !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 6px !important;
  color: #171717 !important;
  background: #ffffff !important;
  box-shadow: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  cursor: pointer !important;
}

.panel-arrow-toggle::before,
.content-grid.detail-collapsed .panel-arrow-toggle::before,
body[class$="-theme"] .panel-arrow-toggle::before {
  content: "" !important;
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  border: 1.5px solid currentColor !important;
  border-radius: 3px !important;
  background: linear-gradient(to right, currentColor 0 1.5px, transparent 1.5px 100%) !important;
  box-sizing: border-box !important;
  opacity: 0.95 !important;
  transform: none !important;
}

.panel-arrow-toggle::after,
.content-grid.detail-collapsed .panel-arrow-toggle::after,
body[class$="-theme"] .panel-arrow-toggle::after {
  content: "" !important;
  position: absolute !important;
  top: 8px !important;
  right: -10px !important;
  translate: none !important;
  width: 1px !important;
  height: 16px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #e5e5e5 !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  white-space: normal !important;
  opacity: 1 !important;
  pointer-events: none !important;
  transform: none !important;
  transition: none !important;
}

.panel-arrow-toggle:hover,
.panel-arrow-toggle:focus-visible {
  color: #0a0a0a !important;
  background: #f5f5f5 !important;
}

.panel-arrow-toggle:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.48) !important;
  outline-offset: 2px !important;
}

body.dark-theme .panel-arrow-toggle,
body.midnight-theme .panel-arrow-toggle,
body.deep-navy-theme .panel-arrow-toggle,
body.charcoal-theme .panel-arrow-toggle,
body.dark-emerald-theme .panel-arrow-toggle {
  color: #fafafa !important;
  background: #171717 !important;
}

body.dark-theme .panel-arrow-toggle::after,
body.midnight-theme .panel-arrow-toggle::after,
body.deep-navy-theme .panel-arrow-toggle::after,
body.charcoal-theme .panel-arrow-toggle::after,
body.dark-emerald-theme .panel-arrow-toggle::after {
  background: rgba(255, 255, 255, 0.12) !important;
}

/* shadcn Kbd/ButtonGroup-style action button polish */

:root {
  --pd-shadcn-button-height: 36px;
  --pd-shadcn-button-radius: 10px;
  --pd-shadcn-button-border: var(--input, #d4d4d8);
  --pd-shadcn-button-bg: var(--background, #ffffff);
  --pd-shadcn-button-fg: var(--foreground, #18181b);
  --pd-shadcn-button-muted-bg: var(--muted, #f4f4f5);
  --pd-shadcn-button-ring: color-mix(in srgb, var(--ring, #a1a1aa) 36%, transparent);
}

.primary-action,
.secondary-action,
.document-form-action,
.menu-package-action,
#detailImportExcelButton,
#inspectorImportExcelButton,
#placeholderImportExcelButton,
#workTableImportExcelButton,
#taskTableImportExcelButton,
#inspectorTableImportExcelButton,
.dashboard-header-actions .secondary-action,
.dashboard-builder-toolbar-actions .secondary-action,
.smart-dashboard-toolbar .secondary-action,
.print-actions .primary-action,
.print-actions .secondary-action,
.settings-dialog button:not(.icon-button):not(.theme-palette-button):not(.theme-color-button) {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: var(--pd-shadcn-button-height) !important;
  height: var(--pd-shadcn-button-height) !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 0 14px !important;
  border: 1px solid var(--pd-shadcn-button-border) !important;
  border-radius: var(--pd-shadcn-button-radius) !important;
  background: var(--pd-shadcn-button-bg) !important;
  color: var(--pd-shadcn-button-fg) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
  font-family: var(--pd-english-ui-font) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: nowrap !important;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease !important;
}

.primary-action,
.print-actions .primary-action {
  border-color: var(--primary, #18181b) !important;
  background: var(--primary, #18181b) !important;
  color: var(--primary-foreground, #fafafa) !important;
}

.secondary-action.danger,
.row-delete-action,
#deleteButton,
#deleteInspectorButton,
#deleteWorkItemButton,
.menu3-sub-actions-delete {
  border-color: color-mix(in srgb, var(--destructive, #ef4444) 28%, var(--pd-shadcn-button-border)) !important;
  background: var(--pd-shadcn-button-bg) !important;
  color: var(--destructive, #dc2626) !important;
}

.primary-action:hover,
.secondary-action:hover,
.document-form-action:hover,
.menu-package-action:hover,
.settings-dialog button:not(.icon-button):not(.theme-palette-button):not(.theme-color-button):hover {
  border-color: color-mix(in srgb, var(--primary, #18181b) 24%, var(--pd-shadcn-button-border)) !important;
  background: var(--pd-shadcn-button-muted-bg) !important;
  color: var(--pd-shadcn-button-fg) !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08) !important;
  transform: none !important;
}

.primary-action:hover,
.print-actions .primary-action:hover {
  background: color-mix(in srgb, var(--primary, #18181b) 88%, #ffffff) !important;
  color: var(--primary-foreground, #fafafa) !important;
}

.secondary-action.danger:hover,
.row-delete-action:hover,
#deleteButton:hover,
#deleteInspectorButton:hover,
#deleteWorkItemButton:hover,
.menu3-sub-actions-delete:hover {
  border-color: color-mix(in srgb, var(--destructive, #ef4444) 44%, var(--pd-shadcn-button-border)) !important;
  background: color-mix(in srgb, var(--destructive, #ef4444) 8%, #ffffff) !important;
  color: var(--destructive, #dc2626) !important;
}

.primary-action:focus-visible,
.secondary-action:focus-visible,
.document-form-action:focus-visible,
.menu-package-action:focus-visible,
.settings-dialog button:not(.icon-button):not(.theme-palette-button):not(.theme-color-button):focus-visible {
  outline: none !important;
  border-color: var(--ring, #a1a1aa) !important;
  box-shadow: 0 0 0 3px var(--pd-shadcn-button-ring) !important;
}

.primary-action:disabled,
.secondary-action:disabled,
.document-form-action:disabled,
.menu-package-action:disabled,
.settings-dialog button:not(.icon-button):not(.theme-palette-button):not(.theme-color-button):disabled {
  pointer-events: none !important;
  opacity: 0.5 !important;
}

#itemForm > .form-actions,
#inspectorForm > .form-actions,
#placeholderForm > .form-actions {
  display: inline-flex !important;
  grid-template-columns: none !important;
  width: fit-content !important;
  max-width: 100% !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  background: color-mix(in srgb, var(--background, #ffffff) 92%, transparent) !important;
  border-bottom: 1px solid var(--border, #e4e4e7) !important;
  box-shadow: none !important;
}

#placeholderForm > .form-actions.placeholder-form-actions {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 8px !important;
}

.right-detail-button-group[data-slot="button-group"] {
  display: inline-flex !important;
  width: fit-content !important;
  max-width: 100% !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  border-radius: var(--pd-shadcn-button-radius) !important;
}

#itemForm > .form-actions.right-detail-button-group[data-slot="button-group"],
#inspectorForm > .form-actions.right-detail-button-group[data-slot="button-group"],
#placeholderForm > .form-actions.placeholder-form-actions .right-detail-button-group[data-slot="button-group"] {
  gap: 0 !important;
  align-items: stretch !important;
}

.right-detail-button-group[data-slot="button-group"] > button {
  position: relative !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.right-detail-button-group[data-slot="button-group"] > button:not(:first-child) {
  margin-left: -1px !important;
}

.right-detail-button-group[data-slot="button-group"] > button:first-child {
  border-top-left-radius: var(--pd-shadcn-button-radius) !important;
  border-bottom-left-radius: var(--pd-shadcn-button-radius) !important;
}

.right-detail-button-group[data-slot="button-group"] > button:last-child {
  border-top-right-radius: var(--pd-shadcn-button-radius) !important;
  border-bottom-right-radius: var(--pd-shadcn-button-radius) !important;
}

.right-detail-button-group[data-slot="button-group"] > button:focus-visible {
  z-index: 2 !important;
}

#itemForm > .form-actions > .primary-action,
#inspectorForm > .form-actions > .primary-action,
#placeholderForm > .form-actions > .primary-action,
#itemForm > .form-actions > .secondary-action.danger,
#inspectorForm > .form-actions > .secondary-action.danger,
#placeholderForm > .form-actions > .secondary-action.danger {
  min-height: var(--pd-shadcn-button-height) !important;
  height: var(--pd-shadcn-button-height) !important;
  min-width: 92px !important;
  border-radius: var(--pd-shadcn-button-radius) !important;
  font-size: 14px !important;
}

.document-form-actions {
  display: flex !important;
  width: fit-content !important;
  max-width: 100% !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.document-form-actions .document-form-action {
  min-width: 74px !important;
}

.toolbar-actions-executive,
.dashboard-builder-toolbar-actions,
.smart-dashboard-toolbar,
.print-actions {
  gap: 8px !important;
  align-items: center !important;
}

.toolbar-more-summary {
  list-style: none !important;
}

.toolbar-more-summary::-webkit-details-marker {
  display: none !important;
}

.shadcn-kbd,
[data-slot="kbd"] {
  display: inline-flex !important;
  min-width: 20px !important;
  height: 20px !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 4px !important;
  border-radius: 4px !important;
  background: var(--muted, #f4f4f5) !important;
  color: var(--muted-foreground, #71717a) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  user-select: none !important;
}

body.dark-theme .primary-action,
body.dark-theme .print-actions .primary-action {
  border-color: var(--primary, #fafafa) !important;
  background: var(--primary, #fafafa) !important;
  color: var(--primary-foreground, #18181b) !important;
}

body.dark-theme .secondary-action,
body.dark-theme .document-form-action,
body.dark-theme .menu-package-action,
body.dark-theme .settings-dialog button:not(.icon-button):not(.theme-palette-button):not(.theme-color-button) {
  border-color: var(--input, #3f3f46) !important;
  background: color-mix(in srgb, var(--background, #09090b) 74%, var(--input, #3f3f46)) !important;
  color: var(--foreground, #fafafa) !important;
}

/* USER UPDATE: Pin data to top uses a clean pushpin icon. */

:root {
  --pd-pin-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M5 17h14'/%3E%3Cpath d='M7 9h10'/%3E%3Cpath d='M9 9V4h6v5'/%3E%3Cpath d='M6 17l2-8h8l2 8'/%3E%3C/svg%3E");
  --pd-pin-filled-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M5 17h14'/%3E%3Cpath d='M7 9h10'/%3E%3Cpath d='M9 9V4h6v5'/%3E%3Cpath d='M6 17l2-8h8l2 8Z' fill='%23111827'/%3E%3C/svg%3E");
}

.pin-button {
  display: inline-grid !important;
  place-items: center !important;
  width: 30px !important;
  height: 30px !important;
  border: 1px solid var(--input, #d8e2ef) !important;
  border-radius: 8px !important;
  background: var(--background, #ffffff) !important;
  color: var(--foreground, #111827) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05) !important;
}

.pin-button:hover:not(:disabled),
.pin-button:focus-visible {
  border-color: var(--ring, #94a3b8) !important;
  background: var(--accent, #f8fafc) !important;
  color: var(--foreground, #111827) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring, #94a3b8) 18%, transparent) !important;
}

.pin-button[aria-pressed="true"] {
  border-color: var(--input, #d8e2ef) !important;
  background: var(--background, #ffffff) !important;
  color: var(--foreground, #111827) !important;
}

.pin-button:disabled {
  opacity: 0.48 !important;
  cursor: not-allowed !important;
}

.data-pin-icon {
  position: relative !important;
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  flex: 0 0 16px !important;
  transform: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  background-image: var(--pd-pin-icon) !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 16px 16px !important;
  box-shadow: none !important;
}

.pin-button[aria-pressed="true"] .data-pin-icon,
.data-pin-label .data-pin-icon {
  background-image: var(--pd-pin-filled-icon) !important;
}

.data-pin-label .data-pin-icon {
  width: 14px !important;
  height: 14px !important;
  flex-basis: 14px !important;
  background-size: 14px 14px !important;
}

.data-pin-icon::before,
.data-pin-icon::after {
  content: none !important;
  display: none !important;
}

/* USER UPDATE: pinned rows show the same pushpin marker in the row controls. */

.data-grid-scroll > .item-list > .item-row.pinned-row .row-pin-cell,
.data-grid-scroll > .item-list > .item-row[data-pinned="true"] .row-pin-cell {
  overflow: visible !important;
}

.data-grid-scroll > .item-list > .item-row.pinned-row .row-pin-cell .data-pin-label,
.data-grid-scroll > .item-list > .item-row[data-pinned="true"] .row-pin-cell .data-pin-label {
  display: inline-grid !important;
  place-items: center !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  margin: 0 auto !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.data-grid-scroll > .item-list > .item-row.pinned-row .row-pin-cell .data-pin-row-icon,
.data-grid-scroll > .item-list > .item-row[data-pinned="true"] .row-pin-cell .data-pin-row-icon {
  display: block !important;
  width: 14px !important;
  height: 14px !important;
  color: var(--foreground, #111827) !important;
  fill: currentColor !important;
  stroke: currentColor !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Default Documents startup recovery remains first-paint critical. */

.table-rebuild-fallback {
  display: grid !important;
  min-height: 420px !important;
  width: 100% !important;
  place-items: center !important;
  padding: 32px !important;
}

.table-rebuild-fallback-card {
  width: min(520px, 100%) !important;
  border: 1px solid var(--border, #e5e7eb) !important;
  border-radius: 10px !important;
  background: var(--background, #ffffff) !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08) !important;
  padding: 22px !important;
  text-align: left !important;
}

.table-rebuild-fallback-kicker {
  margin: 0 0 8px !important;
  color: var(--primary, #2563eb) !important;
  font-family: var(--pd-english-ui-font, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

.table-rebuild-fallback-card h2 {
  margin: 0 0 8px !important;
  color: var(--foreground, #111827) !important;
  font-family: var(--pd-english-ui-font, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: 20px !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
}

.table-rebuild-fallback-card p:not(.table-rebuild-fallback-kicker) {
  margin: 0 0 16px !important;
  color: var(--muted-foreground, #64748b) !important;
  font-family: var(--pd-english-ui-font, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}

.table-rebuild-fallback-retry {
  min-height: 36px !important;
  border: 1px solid var(--border, #dbe4f0) !important;
  border-radius: 8px !important;
  background: var(--foreground, #111827) !important;
  color: var(--background, #ffffff) !important;
  font-family: var(--pd-english-ui-font, ui-sans-serif, system-ui, sans-serif) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 0 14px !important;
  cursor: pointer !important;
}

/* USER FIX: Responsive login lock for phone, tablet, desktop, and short screens. */

html.paperdesk-protected-login-required .app-lock-overlay,
body.app-is-locked .app-lock-overlay,
body:has(#appLockOverlay) .app-lock-overlay,
.app-lock-overlay {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100dvw !important;
  min-width: 0 !important;
  max-width: 100dvw !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: 100dvh !important;
  padding: 28px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
}

.app-lock-card.app-lock-card-v2 {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  width: min(1120px, calc(100dvw - 56px)) !important;
  max-width: min(1120px, calc(100dvw - 56px)) !important;
  max-height: calc(100dvh - 56px) !important;
  overflow: hidden !important;
}

.app-lock-window-title {
  display: grid !important;
  grid-template-columns: minmax(72px, 0.8fr) minmax(0, 1.4fr) minmax(34px, 0.8fr) !important;
  align-items: center !important;
  gap: 10px !important;
}

.app-lock-window-title-text {
  min-width: 0 !important;
  overflow: hidden !important;
  text-align: center !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.app-lock-close {
  justify-self: end !important;
}

.app-lock-body {
  grid-template-columns: minmax(0, 0.98fr) minmax(380px, 1.02fr) !important;
  min-height: min(520px, calc(100dvh - 110px)) !important;
  min-width: 0 !important;
}

.app-lock-brand-panel,
.app-lock-form-panel,
.app-lock-title-block,
.app-lock-form-heading,
.app-lock-field,
.app-lock-submit,
.lock-message,
.app-lock-access-note {
  min-width: 0 !important;
}

.app-lock-title-block h2,
.app-lock-title-block p,
.app-lock-form-heading strong,
.lock-message,
.app-lock-submit span {
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}

@media (max-width: 1100px) {
  .app-lock-card.app-lock-card-v2 {
    width: min(980px, calc(100dvw - 40px)) !important;
    max-width: min(980px, calc(100dvw - 40px)) !important;
    max-height: calc(100dvh - 40px) !important;
  }

  .app-lock-body {
    grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr) !important;
    min-height: min(500px, calc(100dvh - 94px)) !important;
  }

  .app-lock-brand-panel,
  .app-lock-form-panel {
    padding: 36px 32px !important;
  }

  .app-lock-logo-ring {
    width: 128px !important;
    height: 128px !important;
  }

  .app-lock-logo {
    width: 96px !important;
    height: 96px !important;
  }
}

@media (max-width: 900px) {
  html.paperdesk-protected-login-required .app-lock-overlay,
  body.app-is-locked .app-lock-overlay,
  body:has(#appLockOverlay) .app-lock-overlay,
  .app-lock-overlay {
    padding: 18px !important;
  }

  .app-lock-card.app-lock-card-v2 {
    width: min(640px, calc(100dvw - 36px)) !important;
    max-width: min(640px, calc(100dvw - 36px)) !important;
    max-height: calc(100dvh - 36px) !important;
    overflow-y: auto !important;
  }

  .app-lock-body {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto !important;
    min-height: 0 !important;
  }

  .app-lock-brand-panel {
    min-height: 260px !important;
    padding: 32px 28px !important;
  }

  .app-lock-title-block h2 {
    white-space: normal !important;
  }

  .app-lock-form-panel {
    padding: 30px 28px 32px !important;
  }
}

@media (max-width: 600px) {
  html.paperdesk-protected-login-required .app-lock-overlay,
  body.app-is-locked .app-lock-overlay,
  body:has(#appLockOverlay) .app-lock-overlay,
  .app-lock-overlay {
    align-items: flex-start !important;
    padding: 10px !important;
  }

  .app-lock-card.app-lock-card-v2 {
    width: calc(100dvw - 20px) !important;
    max-width: calc(100dvw - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    border-radius: 20px !important;
  }

  .app-lock-window-title {
    grid-template-columns: minmax(52px, 0.7fr) minmax(0, 1.6fr) 34px !important;
    min-height: 46px !important;
    padding: 0 12px !important;
    gap: 8px !important;
    font-size: 12px !important;
  }

  .app-lock-window-status {
    min-width: 0 !important;
    gap: 6px !important;
    font-size: 10px !important;
    letter-spacing: 0.06em !important;
  }

  .app-lock-status-dot {
    width: 14px !important;
    height: 14px !important;
    flex-basis: 14px !important;
  }

  .app-lock-live-label {
    display: none !important;
  }

  .app-lock-close {
    width: 30px !important;
    height: 30px !important;
    font-size: 22px !important;
  }

  .app-lock-brand-panel {
    min-height: 178px !important;
    gap: 10px !important;
    padding: 22px 18px !important;
  }

  .app-lock-brand-panel::before {
    inset: 12px !important;
    border-radius: 18px !important;
  }

  .app-lock-brand-panel::after {
    right: -12px !important;
    bottom: 8px !important;
    font-size: 68px !important;
  }

  .app-lock-logo-ring {
    width: 88px !important;
    height: 88px !important;
    border-radius: 24px !important;
  }

  .app-lock-logo-ring::before {
    inset: -5px !important;
    border-radius: 27px !important;
  }

  .app-lock-logo {
    width: 66px !important;
    height: 66px !important;
  }

  .app-lock-kicker {
    padding: 5px 9px !important;
    font-size: 9px !important;
    letter-spacing: 0.08em !important;
  }

  .app-lock-title-block {
    gap: 4px !important;
  }

  .app-lock-title-block h2 {
    margin-top: 2px !important;
    font-size: 17px !important;
    line-height: 1.35 !important;
  }

  .app-lock-line-two,
  .app-lock-line-three {
    font-size: 13px !important;
    line-height: 1.35 !important;
  }

  .app-lock-security-badge {
    display: none !important;
  }

  .app-lock-form-panel {
    gap: 12px !important;
    padding: 22px 18px 24px !important;
  }

  .app-lock-form-heading {
    gap: 4px !important;
    margin-bottom: 2px !important;
  }

  .app-lock-form-heading span {
    font-size: 11px !important;
  }

  .app-lock-form-heading strong {
    font-size: 18px !important;
    line-height: 1.35 !important;
  }

  .app-lock-field {
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    gap: 10px !important;
    min-height: 58px !important;
    padding: 9px 10px !important;
    border-radius: 15px !important;
  }

  .app-lock-field-icon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 13px !important;
  }

  .app-lock-field-label {
    font-size: 12px !important;
  }

  .app-lock-field input {
    min-height: 24px !important;
    font-size: 15px !important;
  }

  .app-lock-eye-button {
    width: 46px !important;
    height: 34px !important;
    border-radius: 11px !important;
    font-size: 11px !important;
  }

  .lock-message {
    min-height: 40px !important;
    padding: 8px 10px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
  }

  .app-lock-submit {
    flex-wrap: wrap !important;
    min-height: 52px !important;
    padding: 8px 14px !important;
    border-radius: 15px !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
  }

  .app-lock-submit small {
    font-size: 9px !important;
  }

  .lock-recovery-button,
  .app-lock-access-note {
    font-size: 11px !important;
  }
}

@media (max-width: 380px) {
  .app-lock-brand-panel {
    min-height: 150px !important;
  }

  .app-lock-line-two,
  .app-lock-line-three {
    display: none !important;
  }

  .app-lock-form-panel {
    padding: 18px 14px 20px !important;
  }

  .app-lock-field {
    grid-template-columns: 34px minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  .app-lock-field-icon {
    width: 34px !important;
    height: 34px !important;
  }
}

@media (max-height: 720px) and (min-width: 901px) {
  .app-lock-card.app-lock-card-v2 {
    max-height: calc(100dvh - 24px) !important;
  }

  .app-lock-body {
    min-height: 430px !important;
  }

  .app-lock-brand-panel,
  .app-lock-form-panel {
    padding-top: 28px !important;
    padding-bottom: 28px !important;
  }

  .app-lock-logo-ring {
    width: 112px !important;
    height: 112px !important;
  }

  .app-lock-logo {
    width: 84px !important;
    height: 84px !important;
  }
}

@media (max-height: 560px) {
  .app-lock-card.app-lock-card-v2 {
    overflow-y: auto !important;
  }

  .app-lock-brand-panel {
    min-height: 132px !important;
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }

  .app-lock-logo-ring {
    width: 72px !important;
    height: 72px !important;
  }

  .app-lock-logo {
    width: 54px !important;
    height: 54px !important;
  }
}

.task-entry-number-field {
  gap: 6px !important;
}

.task-entry-number-guidance {
  color: #475569;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  margin-top: -2px;
}

.task-entry-number-guidance-empty,
.task-entry-number-guidance-available {
  color: #1d4ed8;
}

.task-entry-number-guidance-duplicate,
.task-entry-number-guidance-invalid {
  color: #b91c1c;
}

.task-entry-number-input.task-entry-number-duplicate,
.task-entry-number-input.task-entry-number-invalid,
.task-entry-number-duplicate input,
.task-entry-number-invalid input {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14) !important;
}

span.task-entry-number-duplicate {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 800;
}
