/* =============================================================
   Design System — DOAE HRCS
   Unified tokens & components (Style Soft)
   ============================================================= */

/* -------------------------------------------------------------
   1. CSS Custom Properties (Tokens)
      NOTE: --ds-* tokens are defined in design-tokens.css
   ------------------------------------------------------------- */

/* -------------------------------------------------------------
   2. Base Reset for ds scope
   ------------------------------------------------------------- */
.ds-scope {
  font-family: var(--ds-font-family-sans-th);
  font-size: var(--ds-font-size-base);
  color: var(--ds-color-gray-900);
  line-height: 1.5;
  box-sizing: border-box;
}
.ds-scope *, .ds-scope *::before, .ds-scope *::after {
  box-sizing: inherit;
}

/* -------------------------------------------------------------
   3. Summary Card
   ------------------------------------------------------------- */
.ds-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--ds-space-md);
  padding: var(--ds-space-lg);
  background: var(--ds-color-bg);
  border-radius: var(--ds-radius-soft);
  box-shadow: var(--ds-shadow-soft);
  margin-bottom: var(--ds-space-lg);
}
.ds-summary-item {
  text-align: center;
  padding: var(--ds-space-md);
  border-radius: var(--ds-radius-soft);
}
/* Summary Card — emp_type background colors */
.ds-summary-svnt {
  background: var(--ds-color-emp-svnt);
  color: var(--ds-color-bg);
}
.ds-summary-svnt .ds-summary-value,
.ds-summary-svnt .ds-summary-label { color: var(--ds-color-bg); }
.ds-summary-svnt .ds-dot { background: rgba(255,255,255,0.6); }

.ds-summary-per {
  background: var(--ds-color-emp-per);
  color: var(--ds-color-bg);
}
.ds-summary-per .ds-summary-value,
.ds-summary-per .ds-summary-label { color: var(--ds-color-bg); }
.ds-summary-per .ds-dot { background: rgba(255,255,255,0.6); }

.ds-summary-gov {
  background: var(--ds-color-emp-gov);
  color: var(--ds-color-bg);
}
.ds-summary-gov .ds-summary-value,
.ds-summary-gov .ds-summary-label { color: var(--ds-color-bg); }
.ds-summary-gov .ds-dot { background: rgba(255,255,255,0.6); }
.ds-summary-value {
  font-size: var(--ds-font-size-2xl);
  font-weight: 700;
  display: block;
}
.ds-summary-label {
  font-size: var(--ds-font-size-sm);
  color: var(--ds-color-gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-xs);
  margin-top: var(--ds-space-xs);
}
.ds-summary-legend {
  padding: 0.75rem var(--ds-space-lg);
  background: var(--ds-color-gray-50);
  border-top: 1px solid var(--ds-color-gray-200);
  border-radius: 0 0 var(--ds-radius-soft) var(--ds-radius-soft);
  font-size: var(--ds-font-size-sm);
  color: var(--ds-color-gray-500);
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-md);
}

/* -------------------------------------------------------------
   4. Personnel Color Dots
   ------------------------------------------------------------- */
.ds-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ds-dot-svnt { background: var(--ds-color-emp-svnt); }
.ds-dot-gov  { background: var(--ds-color-emp-gov); }
.ds-dot-per  { background: var(--ds-color-emp-per); }

/* -------------------------------------------------------------
   5. Org Card (Node)
   ------------------------------------------------------------- */
.ds-org-node {
  background: var(--ds-color-bg);
  border-radius: var(--ds-radius-soft);
  box-shadow: var(--ds-shadow-soft);
  overflow: hidden;
  width: 320px;
  max-width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ds-org-node:hover {
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow-soft-lg);
}

/* Header — color varies by level via data-level */
.ds-org-header {
  padding: 0.75rem var(--ds-space-md);
  color: var(--ds-color-bg);
  font-weight: 600;
  font-size: var(--ds-font-size-base); /* 16px — bumped from 14px for readability */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-sm);
}
.ds-org-node[data-level="1"] .ds-org-header {
  background: var(--ds-color-level-1);
}
.ds-org-node[data-level="2"] .ds-org-header {
  background: var(--ds-color-level-2);
}
.ds-org-node[data-level="3"] .ds-org-header {
  background: var(--ds-color-level-3);
}
.ds-org-node[data-level="4"] .ds-org-header {
  background: var(--ds-color-level-3);
  color: var(--ds-color-bg);
}

.ds-org-name {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  flex: 1;
}
.ds-org-sub-count {
  font-size: var(--ds-font-size-sm); /* 14px — bumped from 12px */
  opacity: 0.85;
  white-space: nowrap;
}

/* Personnel metrics area */
.ds-org-metrics {
  padding: 0.75rem var(--ds-space-md);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-sm);
}
.ds-metric {
  display: flex;
  align-items: center;
  gap: var(--ds-space-sm);
  font-size: var(--ds-font-size-sm);
}
.ds-metric-label {
  color: var(--ds-color-gray-500);
  min-width: 2.5em;
}
.ds-metric-value {
  font-weight: 600;
  color: var(--ds-color-gray-900);
  font-size: var(--ds-font-size-base); /* 16px — bumped from 14px, key data */
}
.ds-metric-direct {
  font-size: var(--ds-font-size-sm); /* 14px — bumped from 12px */
  color: var(--ds-color-gray-400);
  margin-left: auto;
}
.ds-metric-direct::before {
  content: '|';
  margin-right: 4px;
}
.ds-legend-direct-sep::before {
  content: '|';
}

/* Local (internal-only) node highlight */
.ds-org-local {
  border: 2px solid var(--ds-color-emp-local);
}
.ds-org-local .ds-org-header {
  background: var(--ds-color-emp-local) !important;
  color: var(--ds-color-bg);
}

/* Actions — always visible */
.ds-org-actions {
  display: flex;
  gap: var(--ds-space-sm);
  padding: 0.75rem var(--ds-space-md);
  border-top: 1px solid var(--ds-color-gray-200);
}

/* -------------------------------------------------------------
   6. Buttons
   ------------------------------------------------------------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ds-space-sm);
  padding: var(--ds-space-sm) var(--ds-space-md);
  border-radius: var(--ds-radius-soft);
  font-family: var(--ds-font-family-sans-th);
  font-size: var(--ds-font-size-sm);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.5;
  height: auto;
}
/* .ds-btn-primary consolidated into the ADR-017 AAA block near end of file. */
.ds-btn-outline {
  background: var(--ds-color-bg);
  color: var(--ds-color-brand);
  border: 1px solid var(--ds-color-brand);
}
.ds-btn-outline:hover {
  background: var(--ds-color-brand-light);
}
.ds-btn-sm {
  padding: var(--ds-space-xs) 0.75rem;
  font-size: var(--ds-font-size-sm); /* 14px — bumped from 12px */
}
.ds-btn-block {
  width: 100%;
}

/* -------------------------------------------------------------
   7. Tabs
   ------------------------------------------------------------- */
.ds-tabs {
  display: flex;
  gap: var(--ds-space-sm);
  margin-bottom: var(--ds-space-lg);
  border-bottom: 2px solid var(--ds-color-gray-200);
  padding-bottom: 0;
}
.ds-tab {
  padding: 0.75rem 1.25rem;
  font-size: var(--ds-font-size-sm);
  font-weight: 500;
  color: var(--ds-color-gray-500);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--ds-font-family-sans-th);
  position: relative;
  transition: color 0.2s ease;
}
.ds-tab:hover {
  color: var(--ds-color-brand);
}
.ds-tab.active {
  color: var(--ds-color-brand);
  font-weight: 600;
}

/* -------------------------------------------------------------
   8. Breadcrumb
   ------------------------------------------------------------- */
.ds-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--ds-space-sm);
  padding: 0.75rem 0;
  font-size: var(--ds-font-size-sm);
  flex-wrap: wrap;
}
/* ADR-017: legacy page-header breadcrumb (renamed from Bootstrap .breadcrumb to clear
   the CI lint) — restore the flex row + no bullets that Bootstrap's .breadcrumb provided. */
.breadcrumb-legacy { display: flex; flex-wrap: wrap; list-style: none; }
.ds-breadcrumb a {
  color: var(--ds-color-brand);
  text-decoration: none;
  transition: color 0.2s ease;
}
.ds-breadcrumb a:hover {
  text-decoration: underline;
}
.ds-breadcrumb-sep {
  color: var(--ds-color-gray-400);
}
.ds-breadcrumb-current {
  color: var(--ds-color-gray-700);
  font-weight: 600;
}

/* -------------------------------------------------------------
   9. Tree Layout (Hybrid Style: Horizontal Top, Vertical Bottom)
   ------------------------------------------------------------- */
.ds-tree-wrapper {
  overflow-x: auto;
  padding: var(--ds-space-xl) 0;
  width: 100%;
}

.ds-tree-hybrid {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0 auto;
}

.ds-tree-root {
  position: relative;
  z-index: 2;
  padding-bottom: var(--ds-space-lg);
}

/* Trunk from root down to the branches */
.ds-tree-root > .ds-tree-node::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: var(--ds-space-lg);
  background-color: var(--ds-color-gray-300);
  transform: translateX(-50%);
}

.ds-tree-branches {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
}

/* --- Horizontal Rows (Level 2) --- */
.ds-tree-row {
  display: flex;
  justify-content: center;
  padding: 0;
  margin: 0;
  list-style: none;
  align-items: start;
  position: relative;
  padding-bottom: var(--ds-space-lg);
}

/* Trunk passing through the row to the next row */
.ds-tree-row::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background-color: var(--ds-color-gray-300);
  transform: translateX(-50%);
  z-index: 0;
}
.ds-tree-row:last-child {
  padding-bottom: 0;
}
.ds-tree-row:last-child::after {
  display: none;
}

.ds-tree-row > li {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  /* Horizontal padding creates the gap between sibling cards, allowing horizontal lines to touch! */
  padding: var(--ds-space-lg) var(--ds-space-xxl) 0;
}

/* Horizontal connectors for row items */
.ds-tree-row > li::before, .ds-tree-row > li::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 2px;
  background-color: var(--ds-color-gray-300);
}
.ds-tree-row > li::before { left: 0; }
.ds-tree-row > li::after { right: 0; }
.ds-tree-row > li:first-child::before { display: none; }
.ds-tree-row > li:last-child::after { display: none; }
.ds-tree-row > li:only-child::before, .ds-tree-row > li:only-child::after { display: none; }

/* --- Responsive Grid (For Sub-Charts with many children) --- */
.ds-tree-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 5rem;
  padding: var(--ds-space-lg) 0 var(--ds-space-xl) 0;
  margin: 0 auto; /* Center the container itself */
  list-style: none;
  align-items: flex-start;
  position: relative;
  width: fit-content; /* Allow it to grow beyond screen width */
}

/* Top horizontal trunk */
.ds-tree-grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 160px; /* Half of min column width */
  right: 160px;
  height: 2px;
  background-color: var(--ds-color-gray-300);
  z-index: 0;
}

/* Trunk passing through the grid to the next grid (if multiple grids exist) */
.ds-tree-grid::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background-color: var(--ds-color-gray-300);
  transform: translateX(-50%);
  z-index: 0;
}

/* Don't pass through if it's the last grid */
.ds-tree-grid:last-child::after {
  display: none;
}

/* Hide horizontal trunk if there's only 1 child */
.ds-tree-grid:has(> li:only-child)::before {
  display: none;
}



.ds-tree-grid > li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 320px; /* Force strict width to prevent shrinking */
}

/* Vertical drop line. Connects the top horizontal branch to the card header. */
.ds-tree-grid > li::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--ds-space-lg));
  height: var(--ds-space-lg); /* ONLY drops to the top of the card! */
  left: 50%;
  width: 2px;
  background-color: var(--ds-color-gray-300);
  transform: translateX(-50%);
  z-index: 0;
}

/* Vertical drop to row node */
.ds-tree-node {
  position: relative;
  z-index: 2;
}
.ds-tree-row > li > .ds-tree-node::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--ds-space-lg));
  left: 50%;
  width: 2px;
  height: var(--ds-space-lg);
  background-color: var(--ds-color-gray-300);
  transform: translateX(-50%);
  z-index: 1;
}

/* -------------------------------------------------------------
   X. Floating Legend
   ------------------------------------------------------------- */
.ds-floating-legend-container {
  position: fixed;
  bottom: 80px;
  right: 25px;
  z-index: 999;
  transition: all 0.3s ease;
}

.ds-legend-toggle {
  background: white;
  border: 1px solid var(--ds-color-gray-300);
  color: var(--ds-color-gray-700);
  border-radius: 999px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--ds-shadow-soft);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ds-legend-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--ds-shadow-soft-lg);
}

.ds-floating-legend-panel {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-radius: var(--ds-radius-soft);
  box-shadow: var(--ds-shadow-soft-lg);
  padding: 0.75rem var(--ds-space-md);
  width: 280px;
  font-size: var(--ds-font-size-sm);
  border: 1px solid var(--ds-color-gray-200);
}

@media (max-width: 768px) {
  .ds-floating-legend-container {
    right: 0 !important;
  }
  .ds-legend-text {
    display: none;
  }
  .ds-legend-toggle {
    padding: 0 !important;
    width: 48px;
    height: 48px;
    justify-content: center;
    border-radius: 50%;
  }
  .ds-legend-icon {
    font-size: 20px;
    margin: 0;
  }
}

/* --- Vertical Columns (Level 3+) --- */
.ds-tree-col {
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: var(--ds-space-md) auto 0;
  list-style: none;
  position: relative;
  width: 100%;
  max-width: 320px; /* Match parent card max-width to align left edges */
}

.ds-tree-col > li {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: var(--ds-space-md);
  width: 100%;
  padding-left: var(--ds-space-lg); /* Indent children */
  box-sizing: border-box;
}
.ds-tree-col > li:first-child {
  padding-top: 0;
}

/* Horizontal branch from trunk to the card */
.ds-tree-col > li::before {
  content: '';
  position: absolute;
  top: calc(var(--ds-space-md) + 24px); /* Approx vertical center of header */
  left: 0;
  width: var(--ds-space-lg);
  height: 2px;
  background-color: var(--ds-color-gray-300);
}
.ds-tree-col > li:first-child::before {
  top: 24px;
}

/* Vertical trunk dropping from parent's left edge */
.ds-tree-col > li::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background-color: var(--ds-color-gray-300);
  z-index: 0;
}
.ds-tree-col > li:first-child::after {
  /* Reach up to connect to the bottom of the parent card */
  top: calc(-1 * var(--ds-space-md));
}

/* Stop trunk at the last child's horizontal branch */
.ds-tree-col > li:last-child::after {
  bottom: auto;
  height: calc(var(--ds-space-md) + 24px);
}
.ds-tree-col > li:first-child:last-child::after {
  height: calc(var(--ds-space-md) + 24px + var(--ds-space-md));
}

/* -------------------------------------------------------------
   9b. Sub-Chart Nest Folder Tree (Multi-column layout)
   ------------------------------------------------------------- */
.ds-subchart-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ds-space-lg);
  padding-top: var(--ds-space-lg);
  position: relative;
  width: 100%;
}

/* Vertical connector from parent node center */
.ds-subchart-grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: var(--ds-space-lg);
  background-color: var(--ds-color-gray-300);
  transform: translateX(-50%);
}

.ds-subchart-item {
  flex: 1;
  min-width: 280px;
  max-width: 320px;
  position: relative;
}

/* Horizontal line spanning to the next item */
.ds-subchart-item::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--ds-space-lg));
  left: 0;
  width: calc(100% + var(--ds-space-lg));
  height: 2px;
  background-color: var(--ds-color-gray-300);
}

/* Don't span from the last item */
.ds-subchart-item:last-child::before {
  display: none;
}

/* Vertical trunk dropping down to the tree col */
.ds-subchart-item::after {
  content: '';
  position: absolute;
  top: calc(-1 * var(--ds-space-lg));
  left: 0;
  width: 2px;
  height: var(--ds-space-lg);
  background-color: var(--ds-color-gray-300);
}

/* Override .ds-tree-col inside .ds-subchart-item */
.ds-subchart-item .ds-tree-col {
  margin-top: 0;
}

/* Responsive: 1 column on mobile */
@media (max-width: 768px) {
  .ds-subchart-item::before {
    display: none; /* No horizontal lines on mobile */
  }
}

/* -------------------------------------------------------------
   10. Tables & Pagination
   ------------------------------------------------------------- */
.ds-table-soft {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-font-size-sm);
  text-align: left;
}
.ds-table-soft thead th {
  background-color: var(--ds-color-brand-secondary);
  color: var(--ds-color-bg);
  padding: 0.75rem var(--ds-space-md);
  font-weight: 600;
  border-bottom: none;
}
.ds-table-soft tbody td {
  padding: 0.75rem var(--ds-space-md);
  border-bottom: 1px solid var(--ds-color-gray-200);
  vertical-align: middle;
}
.ds-table-soft tbody tr:nth-child(even) {
  background-color: var(--ds-color-gray-50);
}
.ds-table-soft tbody tr:hover {
  background-color: color-mix(in srgb, var(--ds-color-brand) 5%, transparent);
}

.ds-pagination-soft {
  display: inline-flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: var(--ds-space-xs);
}
.ds-pagination-soft li {
  display: inline-block;
}
.ds-pagination-soft li a,
.ds-pagination-soft li span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--ds-space-sm);
  border: 1px solid var(--ds-color-gray-300);
  background-color: var(--ds-color-bg);
  color: var(--ds-color-gray-700);
  font-size: var(--ds-font-size-sm);
  text-decoration: none;
  transition: all 0.2s;
}
.ds-pagination-soft li a:hover {
  background-color: var(--ds-color-gray-50);
  border-color: var(--ds-color-gray-400);
}
.ds-pagination-soft li.active span {
  background-color: var(--ds-color-brand);
  border-color: var(--ds-color-brand);
  color: var(--ds-color-bg);
}
.ds-pagination-soft li.disabled span {
  color: var(--ds-color-gray-400);
  background-color: var(--ds-color-gray-100);
  cursor: not-allowed;
}


/* -------------------------------------------------------------
   11. Card (generic)
   ------------------------------------------------------------- */
.ds-card-soft {
  background: var(--ds-color-bg);
  border-radius: var(--ds-radius-soft);
  box-shadow: var(--ds-shadow-soft);
  padding: var(--ds-space-lg);
  margin-bottom: var(--ds-space-lg);
}

/* -------------------------------------------------------------
   12. Print
   ------------------------------------------------------------- */
.ds-btn-print {
  background: var(--ds-color-gray-100);
  color: var(--ds-color-gray-700);
  border: 1px solid var(--ds-color-gray-200);
}
.ds-btn-print:hover {
  background: var(--ds-color-gray-200);
}

@media print {
  .ds-btn-print,
  .ds-org-actions { display: none !important; }
  .ds-org-node { box-shadow: none; border: 1px solid var(--ds-color-gray-300); }
  .ds-summary { box-shadow: none; border: 1px solid var(--ds-color-gray-300); }
}

/* -------------------------------------------------------------
   13. Responsive
   ------------------------------------------------------------- */
@media (max-width: 768px) {
  .ds-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .ds-org-node {
    min-width: 180px;
    max-width: 100%;
  }

  /* --- Convert Horizontal Grid to Nested Folder Tree --- */
  .ds-tree-branches {
    padding-top: var(--ds-space-md);
  }

  .ds-tree-grid {
    display: flex;
    flex-direction: column;
    gap: 0; /* Fix broken lines between li items */
    padding: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 320px;
  }
  /* Hide old vertical grid line */
  .ds-tree-grid::after {
    display: none;
  }
  /* Connect root to first grid */
  .ds-tree-grid:first-child::before {
    content: '';
    position: absolute;
    top: calc(-1 * var(--ds-space-md));
    left: 0;
    width: 50%;
    right: auto; /* Override desktop right constraint */
    height: 2px;
    background-color: var(--ds-color-gray-300);
    display: block;
    z-index: 0;
  }
  .ds-tree-grid:not(:first-child)::before {
    display: none;
  }

  .ds-tree-grid > li {
    flex: 0 0 auto;
    width: 100%;
    padding-top: var(--ds-space-lg);
    padding-left: var(--ds-space-lg);
    align-items: flex-start;
  }
  .ds-tree-grid > li:first-child {
    padding-top: 0;
  }

  /* Horizontal branch to card */
  .ds-tree-grid > li::before {
    content: '';
    position: absolute;
    top: calc(var(--ds-space-lg) + 24px);
    left: 0;
    width: var(--ds-space-lg);
    height: 2px;
    background-color: var(--ds-color-gray-300);
    transform: none;
  }
  .ds-tree-grid > li:first-child::before {
    top: 24px;
  }

  /* Vertical trunk segment on EACH li */
  .ds-tree-grid > li::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background-color: var(--ds-color-gray-300);
    transform: none;
    z-index: 0;
  }
  /* Reach up to connect to previous grid or top horizontal line */
  .ds-tree-grid > li:first-child::after {
    top: calc(-1 * var(--ds-space-md));
  }
  /* Stop trunk at the last item of the last grid */
  .ds-tree-grid:last-child > li:last-child::after {
    bottom: auto;
    height: calc(var(--ds-space-lg) + 24px);
  }
  .ds-tree-grid:last-child > li:first-child:last-child::after {
    height: calc(var(--ds-space-md) + 24px);
  }
}



/* -------------------------------------------------------------
   15. Form Inputs (Redesign)
   ------------------------------------------------------------- */
.ds-label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--ds-space-sm);
  color: var(--ds-color-gray-700);
  font-size: var(--ds-font-size-base);
}

.ds-input-soft {
  display: block;
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid var(--ds-color-gray-300);
  padding: 0.5rem 0.75rem;
  font-size: var(--ds-font-size-base);
  font-family: inherit;
  color: var(--ds-color-gray-900);
  background-color: var(--ds-color-bg);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, background-color 0.15s ease-in-out;
  min-height: 48px; /* Touch target minimum */
}

.ds-input-soft:focus {
  border-color: var(--ds-color-brand);
  box-shadow: 0 0 0 0.25rem var(--ds-color-brand-light);
  outline: 0;
}

.ds-input-soft:read-only, .ds-input-soft:disabled {
  background-color: var(--ds-color-gray-100);
  color: var(--ds-color-gray-500);
  cursor: not-allowed;
}

select.ds-input-soft {
  appearance: auto;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* Section 17. Scoped Global UI Override (Sidebar + Navbar) removed per PM request */

/* -------------------------------------------------------------
   16. Radio & Checkbox (replaces legacy .checkbox-fade)
   ------------------------------------------------------------- */
.ds-radio-soft,
.ds-checkbox-soft {
  display: inline-flex;
  align-items: center;
  gap: var(--ds-space-sm);
  cursor: pointer;
  font-size: var(--ds-font-size-base);
  color: var(--ds-color-gray-700);
  padding: var(--ds-space-sm) 0;
  user-select: none;
}
.ds-radio-soft input[type="radio"],
.ds-checkbox-soft input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--ds-color-gray-300);
  background: var(--ds-color-bg);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.ds-radio-soft input[type="radio"] {
  border-radius: 50%;
}
.ds-checkbox-soft input[type="checkbox"] {
  border-radius: 0.375rem;
}
.ds-radio-soft input[type="radio"]:checked {
  border-color: var(--ds-color-brand);
  background: var(--ds-color-bg);
  box-shadow: inset 0 0 0 4px var(--ds-color-brand);
}
.ds-checkbox-soft input[type="checkbox"]:checked {
  border-color: var(--ds-color-brand);
  background: var(--ds-color-brand);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}
.ds-radio-soft input:focus,
.ds-checkbox-soft input:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--ds-color-brand-light);
}
.ds-radio-soft input:disabled,
.ds-checkbox-soft input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================================
   Style Soft — Overrides (merged from design-system-soft.css)
   ============================================================= */


/* -------------------------------------------------------------
   Buttons — Gradient style
   ------------------------------------------------------------- */
/* .ds-btn-primary (gradient) removed — consolidated into the ADR-017 AAA block below. */
.ds-btn-outline {
  border-radius: 999px;
}
.ds-btn-outline:hover {
  background: var(--ds-color-brand-light);
}

/* -------------------------------------------------------------
   Tabs — Pill filled active
   ------------------------------------------------------------- */
.ds-tabs {
  border-bottom: none;
  gap: var(--ds-space-sm);
  background: var(--ds-color-gray-100);
  border-radius: 999px;
  padding: var(--ds-space-xs);
  display: inline-flex;
}
.ds-tab {
  border-radius: 999px;
  padding: var(--ds-space-sm) 1.25rem;
}
.ds-tab.active {
  background: var(--ds-color-brand);
  color: var(--ds-color-bg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.ds-tab:hover:not(.active) {
  background: var(--ds-color-gray-200);
}

/* -------------------------------------------------------------
   Cards — Borderless with soft shadow
   ------------------------------------------------------------- */
.ds-org-node {
  border: none;
  border-radius: var(--ds-radius-soft);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
}
.ds-card-soft {
  border: none;
  border-radius: var(--ds-radius-soft);
}
/* Personnel Card nodes — match shadow with main Org Chart nodes */
.ds-tree-node .ds-card-soft,
.ds-tree-root .ds-card-soft,
.ds-tree-col .ds-card-soft {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
}
.ds-summary {
  border: none;
  border-radius: var(--ds-radius-soft);
}
/* Gradient headers per level removed per user request */
.ds-org-header {
  border-radius: var(--ds-radius-soft) var(--ds-radius-soft) 0 0;
}
.ds-org-name {
  white-space: normal;
  overflow: visible;
  line-height: 1.4;
}

/* -------------------------------------------------------------
   Org Card — Horizontal layout (Inline)
   ------------------------------------------------------------- */
.ds-tree-grid > li {
  flex: 0 0 auto; /* Allow node to expand width */
  min-width: 320px;
}

.ds-org-metrics {
  flex-direction: row;
  justify-content: center;
  gap: var(--ds-space-sm);
}

/* Metric items with colored outline */
.ds-metric {
  padding: var(--ds-space-xs) var(--ds-space-sm);
  border-radius: var(--ds-radius-lg);
  flex: 1;
  justify-content: center;
  background-color: transparent;
}
.ds-metric-svnt { border: 2px solid var(--ds-color-emp-svnt); }
.ds-metric-gov { border: 2px solid var(--ds-color-emp-gov); }
.ds-metric-per { border: 2px solid var(--ds-color-emp-per); }

.ds-org-node .ds-dot,
.ds-org-node .ds-metric-label {
  display: none;
}

.ds-metric-direct {
  color: var(--ds-color-gray-500);
  margin-left: var(--ds-space-xs);
}
.ds-metric-direct::before {
  content: '|';
  margin-right: 4px;
}
.ds-legend-direct-sep::before {
  content: '|';
}

/* -------------------------------------------------------------
   Summary Card — Softer appearance
   ------------------------------------------------------------- */
.ds-summary-item {
  background: var(--ds-color-gray-50);
  border-radius: var(--ds-radius-soft);
  padding: 1.25rem;
}
.ds-summary-value {
  background: linear-gradient(135deg, var(--ds-color-brand), var(--ds-color-brand-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* Summary Card — emp_type colored backgrounds override */
.ds-summary-item.ds-summary-svnt {
  background: var(--ds-color-emp-svnt);
}
.ds-summary-item.ds-summary-per {
  background: var(--ds-color-emp-per);
}
.ds-summary-item.ds-summary-gov {
  background: var(--ds-color-emp-gov);
}
.ds-summary-item.ds-summary-svnt .ds-summary-value,
.ds-summary-item.ds-summary-per .ds-summary-value,
.ds-summary-item.ds-summary-gov .ds-summary-value {
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: var(--ds-color-bg);
  background-clip: unset;
  color: var(--ds-color-bg);
}
.ds-summary-item.ds-summary-svnt .ds-summary-label,
.ds-summary-item.ds-summary-per .ds-summary-label,
.ds-summary-item.ds-summary-gov .ds-summary-label {
  color: rgba(255,255,255,0.9);
}

/* -------------------------------------------------------------
   Tables & Pagination (Soft Style)
   ------------------------------------------------------------- */
.ds-table-soft thead th {
  background: var(--ds-color-brand-secondary);
  border-bottom: none;
}
.ds-table-soft tbody tr:hover {
  background-color: rgba(0, 148, 255, 0.05);
}

.ds-pagination-soft li a,
.ds-pagination-soft li span {
  border-radius: 50%;
  border: none;
  background-color: transparent;
  color: var(--ds-color-gray-500);
}
.ds-pagination-soft li a:hover {
  background-color: var(--ds-color-gray-100);
  color: var(--ds-color-brand);
}
.ds-pagination-soft li.active span {
  background: var(--ds-color-brand);
  color: var(--ds-color-bg);
  box-shadow: 0 4px 10px rgba(0, 148, 255, 0.2);
}

/* -------------------------------------------------------------
   Breadcrumb — Rounded pill links
   ------------------------------------------------------------- */
.ds-breadcrumb a {
  padding: var(--ds-space-xs) 0.75rem;
  background: var(--ds-color-brand-light);
  border-radius: 999px;
  color: var(--ds-color-brand);
}
.ds-breadcrumb a:hover {
  background: var(--ds-color-brand-medium);
  text-decoration: none;
}

/* -------------------------------------------------------------
   Local node — Softer pink highlight
   ------------------------------------------------------------- */
.ds-org-local {
  border: none;
  background: linear-gradient(135deg, #FDF2F8, #FCE7F3);
}
.ds-org-local .ds-org-header {
  background: linear-gradient(135deg, var(--ds-color-emp-local), #F472B6) !important;
}

/* -------------------------------------------------------------
   Hover micro-animation
   ------------------------------------------------------------- */
.ds-org-node:hover {
  transform: translateY(-4px);
}

/* -------------------------------------------------------------
   Form Inputs (Soft Style)
   ------------------------------------------------------------- */
.ds-input-soft {
  border-radius: var(--ds-radius-soft);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) inset;
}

.ds-input-soft:focus {
  box-shadow: 0 4px 14px color-mix(in srgb, var(--ds-color-brand) 20%, transparent), 0 0 0 1px var(--ds-color-brand);
  border-color: var(--ds-color-brand);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .ds-input-soft:focus {
    box-shadow: 0 4px 14px rgba(0, 148, 255, 0.15), 0 0 0 1px var(--ds-color-brand);
  }
}

/* Scoped Global UI removed per PM request */

/* ============================================================
   ADR-017 — Style Soft for Blade atoms/molecules (Batch 0)
   Adds: full .ds-btn variant set (AAA-verified), .ds-select-soft,
   .ds-field (soft form-group), .ds-modal-soft. Reference:
   public/design-system-v2-preview/. Filled buttons use bold labels
   so white text qualifies as "large text" (≥4.5:1 = AAA-large).
   ============================================================ */

/* ---- Buttons: AAA fix + full variant set ---- */
/* Single source of truth for .ds-btn-primary (consolidated from 3 prior defs):
   AAA brand-dark fill (white ≈4.69:1) + bold (large-text → AAA) + pill + soft glow hover. */
.ds-btn-primary { background: var(--ds-color-brand-dark); color: var(--ds-color-bg); font-weight: 700; border-radius: 999px; }
.ds-btn-primary:hover { background: color-mix(in srgb, var(--ds-color-brand) 60%, black); color: var(--ds-color-bg); box-shadow: 0 4px 14px color-mix(in srgb, var(--ds-color-brand) 40%, transparent); }
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .ds-btn-primary:hover { box-shadow: 0 4px 14px rgba(0, 148, 255, 0.35); background: var(--ds-color-brand-dark); }
}
.ds-btn-secondary { background: var(--ds-color-gray-100); color: var(--ds-color-gray-700); border: 1px solid var(--ds-color-gray-300); }
.ds-btn-secondary:hover { background: var(--ds-color-gray-200); }
.ds-btn-success, .ds-btn-save { background: #15803D; color: var(--ds-color-bg); font-weight: 700; }   /* white ≈4.54:1 */
.ds-btn-success:hover, .ds-btn-save:hover { background: #166534; }
.ds-btn-danger, .ds-btn-delete { background: #B91C1C; color: var(--ds-color-bg); font-weight: 700; }  /* white ≈5.9:1 */
.ds-btn-danger:hover, .ds-btn-delete:hover { background: #991B1B; }
.ds-btn-warning { background: #B45309; color: var(--ds-color-bg); font-weight: 700; }                 /* white ≈5.0:1 (dark amber, not yellow) */
.ds-btn-warning:hover { background: #92400E; }
.ds-btn-info { background: #0E7490; color: var(--ds-color-bg); font-weight: 700; }                    /* white ≈4.9:1 */
.ds-btn-info:hover { background: #155E75; }
.ds-btn-dark { background: var(--ds-color-gray-900); color: var(--ds-color-bg); font-weight: 700; }
.ds-btn-dark:hover { background: #000; }
.ds-btn-light { background: var(--ds-color-gray-100); color: var(--ds-color-gray-900); border: 1px solid var(--ds-color-gray-200); }
.ds-btn-light:hover { background: var(--ds-color-gray-200); }
.ds-btn-cancel { background: var(--ds-color-bg); color: var(--ds-color-gray-700); border: 1px solid var(--ds-color-gray-300); }
.ds-btn-cancel:hover { background: var(--ds-color-gray-100); }
.ds-btn:focus, .ds-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-color-brand) 35%, transparent); }
.ds-btn:disabled, .ds-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---- Select (matches .ds-input-soft) ---- */
.ds-select-soft {
  display: block; width: 100%;
  border-radius: .375rem;
  border: 1px solid var(--ds-color-gray-300);
  padding: .5rem 2.5rem .5rem .75rem;
  font-size: var(--ds-font-size-base); font-family: inherit;
  color: var(--ds-color-gray-900); background-color: var(--ds-color-bg);
  min-height: 48px;
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center;
}
.ds-select-soft:focus { outline: none; border-color: var(--ds-color-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-color-brand) 35%, transparent); }
.ds-select-soft:disabled { background-color: var(--ds-color-gray-100); color: var(--ds-color-gray-500); cursor: not-allowed; }
.ds-select-soft.is-invalid { border-color: var(--ds-color-danger); }

/* ---- Form field (soft form-group; replaces Bootstrap col grid) ---- */
.ds-field { margin-bottom: var(--ds-space-lg); }
.ds-field > .ds-label { margin-bottom: var(--ds-space-sm); }
.ds-field .req { color: var(--ds-color-danger); margin-left: 2px; }
.ds-field-help { font-size: var(--ds-font-size-sm); color: var(--ds-color-gray-700); margin-top: 6px; } /* AAA: gray-700 ≈10:1 */
.ds-field-error { font-size: var(--ds-font-size-sm); color: var(--ds-color-danger); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.ds-field.is-invalid .ds-label { color: var(--ds-color-danger); }
.ds-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 var(--ds-space-lg); }

/* ---- Modal (soft dialog shell) ---- */
.ds-modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: var(--ds-z-modal, 1050); }
.ds-modal-backdrop.open, .ds-modal-backdrop.show { display: flex; }
.ds-modal-soft { background: var(--ds-color-bg); border-radius: var(--ds-radius-soft); box-shadow: var(--ds-shadow-soft-lg); width: 100%; max-width: 520px; overflow: hidden; animation: dsModalIn .22s cubic-bezier(.22,1,.36,1); }
@keyframes dsModalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ds-modal-soft { animation: none; } }
.ds-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: var(--ds-space-lg) var(--ds-space-lg) var(--ds-space-md); }
.ds-modal-head h3 { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--ds-color-gray-900); }
.ds-modal-close { border: none; background: var(--ds-color-gray-100); color: var(--ds-color-gray-700); width: 34px; height: 34px; border-radius: 999px; font-size: 1.1rem; cursor: pointer; line-height: 1; transition: background .15s ease; }
.ds-modal-close:hover { background: var(--ds-color-gray-200); }
.ds-modal-close:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-color-brand) 35%, transparent); }
.ds-modal-body { padding: 0 var(--ds-space-lg) var(--ds-space-md); color: var(--ds-color-gray-700); }
.ds-modal-foot { display: flex; justify-content: flex-end; gap: var(--ds-space-sm); padding: var(--ds-space-md) var(--ds-space-lg) var(--ds-space-lg); }

/* ============================================================
   ADR-017 Batch 2.5 — Style Soft component set 2
   feedback (alert/toast), pills (badge/chip/tag), indicators
   (progress/spinner/avatar), divider, empty-state, page-header,
   tooltip, dropdown. AAA tints (100/800 ≈7:1). No side-stripe.
   ============================================================ */

/* ---- Alert (soft tint + full border, AAA 100/800 pairs) ---- */
.ds-alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: .75rem; border: 1px solid; font-size: var(--ds-font-size-sm); line-height: 1.5; }
.ds-alert > i { font-size: 1.05rem; margin-top: 1px; }
.ds-alert b { font-weight: 700; }
.ds-alert-info { background: #E0F2FE; border-color: #BAE6FD; color: #075985; }
.ds-alert-success { background: #DCFCE7; border-color: #BBF7D0; color: #166534; }
.ds-alert-warning { background: #FEF3C7; border-color: #FDE68A; color: #92400E; }
.ds-alert-danger { background: #FEE2E2; border-color: #FECACA; color: #991B1B; }

/* ---- Pills: badge / status / chip / tag ---- */
.ds-badge-soft { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; line-height: 1.4; }
.ds-badge-soft.is-draft, .ds-badge-soft.is-canceled { background: var(--ds-color-gray-200); color: var(--ds-color-gray-700); }
.ds-badge-soft.is-pending { background: #FEF3C7; color: #92400E; }
.ds-badge-soft.is-approved { background: #DCFCE7; color: #166534; }
.ds-badge-soft.is-rejected { background: #FEE2E2; color: #991B1B; }
.ds-chip-soft { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 500; padding: 5px 12px; border-radius: 999px; background: var(--ds-color-gray-100); color: var(--ds-color-gray-700); border: 1px solid var(--ds-color-gray-200); }
.ds-chip-soft .x { cursor: pointer; color: var(--ds-color-gray-500); font-weight: 700; line-height: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 20px; min-height: 20px; margin: -4px -6px -4px 0; padding: 4px 6px; border-radius: 999px; } /* P2 fix: larger touch target */
.ds-chip-soft .x:hover { color: var(--ds-color-gray-900); background: var(--ds-color-gray-200); }
.ds-tag-soft { display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 6px; background: var(--ds-color-brand-light); color: #005490; }
.ds-tag-soft.ds-tag--xs { font-size: .62rem; padding: 1px 7px; }
.ds-tag-soft.ds-tag--md { font-size: .8rem; padding: 3px 11px; }

/* ---- Toast (soft card + soft-lg shadow) ---- */
.ds-toast { display: flex; gap: 12px; align-items: flex-start; max-width: 380px; padding: 14px 16px; border-radius: .75rem; background: var(--ds-color-bg); box-shadow: var(--ds-shadow-soft-lg); border: 1px solid var(--ds-color-gray-200); }
.ds-toast .ic { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; flex: none; color: #fff; }
.ds-toast.is-success .ic { background: #16a34a; }
.ds-toast.is-danger .ic { background: #dc2626; }
.ds-toast.is-info .ic { background: var(--ds-color-brand-dark); }
.ds-toast .body { font-size: var(--ds-font-size-sm); color: var(--ds-color-gray-700); }
.ds-toast .body b { display: block; color: var(--ds-color-gray-900); margin-bottom: 2px; }

/* ---- Indicators: progress / spinner / avatar ---- */
.ds-progress { height: 10px; border-radius: 999px; background: var(--ds-color-gray-200); overflow: hidden; }
.ds-progress-bar { height: 100%; border-radius: 999px; background: var(--ds-color-brand); transition: width .3s ease; }
.ds-spinner-soft { width: 28px; height: 28px; border-radius: 999px; border: 3px solid var(--ds-color-gray-200); border-top-color: var(--ds-color-brand); animation: dsspin .7s linear infinite; }
@keyframes dsspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ds-spinner-soft { animation-duration: 2s; } }
.ds-avatar { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; background: var(--ds-color-brand-dark); }
.ds-avatar-group { display: flex; }
.ds-avatar-group .ds-avatar { border: 2px solid var(--ds-color-bg); margin-left: -10px; }
.ds-avatar-group .ds-avatar:first-child { margin-left: 0; }

/* ---- Divider ---- */
.ds-divider-soft { height: 1px; background: var(--ds-color-gray-200); border: 0; margin: 8px 0; }

/* ---- Empty state ---- */
.ds-empty { text-align: center; padding: 48px 24px; color: var(--ds-color-gray-700); }
.ds-empty .ic { width: 64px; height: 64px; border-radius: 999px; background: var(--ds-color-gray-100); display: grid; place-items: center; margin: 0 auto 16px; color: var(--ds-color-gray-400); font-size: 1.6rem; }
.ds-empty h4 { margin: 0 0 4px; color: var(--ds-color-gray-900); font-weight: 700; font-size: 1.05rem; }
.ds-empty p { margin: 0 0 16px; font-size: var(--ds-font-size-sm); }

/* ---- Page header ---- */
.ds-page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 16px; border-bottom: 1px solid var(--ds-color-gray-200); }
.ds-page-header .crumb { font-size: .78rem; color: var(--ds-color-gray-700); margin-bottom: 4px; }
.ds-page-header h1 { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--ds-color-gray-900); }
.ds-page-header-actions { display: flex; gap: var(--ds-space-sm); align-items: center; flex-wrap: wrap; }

/* ---- Tooltip (CSS; hover + focus for a11y) ---- */
.ds-tip { position: relative; display: inline-flex; }
.ds-tip .tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: var(--ds-color-gray-900); color: #fff; font-size: .72rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s ease; z-index: var(--ds-z-tooltip, 1070); }
.ds-tip:hover .tip, .ds-tip:focus-within .tip { opacity: 1; } /* P2 fix: focus-within for keyboard a11y */

/* ---- Dropdown menu (soft-lg shadow; escape overflow at call-site via position:fixed/portal) ---- */
.ds-dropdown { background: var(--ds-color-bg); border-radius: .75rem; box-shadow: var(--ds-shadow-soft-lg); border: 1px solid var(--ds-color-gray-200); padding: 6px; min-width: 200px; }
.ds-dropdown a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: .5rem; color: var(--ds-color-gray-700); text-decoration: none; font-size: var(--ds-font-size-sm); }
.ds-dropdown a:hover { background: var(--ds-color-gray-100); color: var(--ds-color-gray-900); }
.ds-dropdown a.is-danger { color: #991B1B; }
.ds-dropdown a.is-danger:hover { background: #FEE2E2; }
.ds-dd-sep { height: 1px; background: var(--ds-color-gray-200); margin: 6px 4px; }

/* ---- Structural components (modal/form-group): CSS-only soft, no markup/JS change ---- */
/* Soft-ify ALL Bootstrap modals app-wide (cosmetic; .modal/.modal-content classes,
   data-dismiss, AJAX content-class hooks all untouched). Loaded after bootstrap.css. */
.modal-content { border-radius: var(--ds-radius-soft); box-shadow: var(--ds-shadow-soft-lg); border: 0; }
.modal-header, .modal-footer { border-color: var(--ds-color-gray-200); }
/* form-group: soften label to AAA gray-700 while keeping the Bootstrap col grid. */
.ds-form-group .col-form-label, .ds-form-group > label { color: var(--ds-color-gray-700); font-weight: 600; }
