/**
 * TDS UI Renewal — intranet-wide frosted glass + denser work lists
 * Load after tds-global.css / tds-components.css
 */

/* ── Utilities: comparable numbers ── */
body.tds-theme .tds-num,
body.tds-theme .tds-highlight__value,
body.tds-theme .stats-card-value,
body.tds-theme .kpi-card-value,
body.tds-theme .dash-kpi-card__value,
body.tds-theme .dash-kpi-card__extra,
body.tds-theme .dash-data-table__amount,
body.tds-theme .dash-data-table__num,
body.tds-theme .client-dash-prepaid__amount,
body.tds-theme .dashboard-metric-large-value,
body.tds-theme .dashboard-metric-value,
body.tds-theme .dashboard-quick-stat-value,
body.tds-theme .table .tds-num,
body.tds-theme td.tds-num,
body.tds-theme th.tds-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

body.tds-theme .tds-num--end,
body.tds-theme td.tds-num--end,
body.tds-theme th.tds-num--end,
body.tds-theme .table th.tds-num--end,
body.tds-theme .table td.tds-num--end,
body.tds-theme .table .money,
body.tds-theme .table .amount,
body.tds-theme .table .price,
body.tds-theme .table .currency {
  text-align: right !important;
}

body.tds-theme .tds-num--center {
  text-align: center;
}

/* ── Page: silver-white + ONE neutral luminance boundary crossing sidebar/panels ── */
html.tds-theme,
body.tds-theme {
  background-color: var(--tds-bg-page-base, #F5F5F6);
  background-image:
    linear-gradient(
      118deg,
      var(--tds-bg-page-bright, #FCFCFD) 0%,
      var(--tds-bg-page-bright, #FCFCFD) 38%,
      var(--tds-bg-page-wash, #ECECEE) 52%,
      var(--tds-bg-page-base, #F5F5F6) 72%,
      var(--tds-bg-page-base, #F5F5F6) 100%
    );
  background-attachment: fixed;
  color: var(--tds-text-primary, #191f28);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.tds-theme .app-container,
body.tds-theme .app-main,
body.tds-theme .page-content,
body.tds-theme .dashboard-shell,
body.tds-theme .dashboard-shell--tds {
  background: transparent !important;
  background-color: transparent !important;
}

/* Shared frosted glass recipe (bg alpha only — never opacity on whole node) */
body.tds-theme .tds-glass,
body.tds-theme .header,
body.tds-theme .header-dropdown-menu,
body.tds-theme .dropdown-menu,
body.tds-theme .notification-sidebar,
body.tds-theme .sidebar,
body.tds-theme .tds-panel,
body.tds-theme .tds-panel--glass-hero,
body.tds-theme .dashboard-card,
body.tds-theme .dashboard-card-full,
body.tds-theme .dashboard-shell--tds .tds-section:not(.tds-section--flat),
body.tds-theme .dashboard-shell--tds .tds-section--schedule,
body.tds-theme .dashboard-shell--tds .tds-highlight,
body.tds-theme .card,
body.tds-theme .stats-card,
body.tds-theme .kpi-card,
body.tds-theme .vault-card,
body.tds-theme .progress-stage-card,
body.tds-theme .progress-project-card,
body.tds-theme .client-list-card,
body.tds-theme .progress-page-header,
body.tds-theme .progress-timeline-section,
body.tds-theme .stages-timeline-horizontal,
body.tds-theme .login-box,
body.tds-theme .register-box,
body.tds-theme .client-dash-hero,
body.tds-theme .client-dash-shortcut,
body.tds-theme .client-dash-prepaid,
body.tds-theme .client-dash-empty-panel,
body.tds-theme .order-card,
body.tds-theme .pp-order-card,
body.tds-theme .resource-card,
body.tds-theme .tds-resource-card,
body.tds-theme .customer-resource-card,
body.tds-theme .event-card,
body.tds-theme .payment-info-card,
body.tds-theme .login-card,
body.tds-theme .register-card {
  background-color: var(--tds-glass-bg-fallback, rgba(255, 255, 255, 0.88));
  border: 1px solid var(--tds-glass-edge, rgba(229, 232, 235, 0.4));
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.tds-theme .header {
    background-color: var(--tds-glass-bg, rgba(255, 255, 255, 0.55));
    -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    border-bottom: 1px solid rgba(220, 222, 226, 0.45);
    box-shadow: var(--tds-glass-shadow);
  }

  /* Menus / notify: slightly stronger glass so underlying text doesn't bleed */
  body.tds-theme .header-dropdown-menu.active,
  body.tds-theme .dropdown-menu:not(.tds-opaque),
  body.tds-theme .header-dropdown-menu,
  body.tds-theme .notification-sidebar {
    background-color: var(--tds-glass-bg-strong, rgba(255, 255, 255, 0.78));
    -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    border: 1px solid rgba(220, 222, 226, 0.4);
    box-shadow: var(--tds-glass-shadow);
  }

  /* Continuous sidebar glass sheet */
  body.tds-theme .sidebar {
    background-color: var(--tds-glass-bg-sidebar, rgba(255, 255, 255, 0.5));
    -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    border-right: 1px solid rgba(220, 222, 226, 0.4);
    box-shadow:
      4px 0 24px rgba(15, 23, 42, 0.04),
      1px 0 0 rgba(255, 255, 255, 0.7) inset;
  }

  /* Major first-screen surfaces — glass fill + thickness (no full white stroke box) */
  body.tds-theme .tds-panel,
  body.tds-theme .tds-panel--glass-hero,
  body.tds-theme .dashboard-card,
  body.tds-theme .dashboard-card-full,
  body.tds-theme .dashboard-shell--tds .tds-section:not(.tds-section--flat),
  body.tds-theme .dashboard-shell--tds .tds-section--schedule,
  body.tds-theme .dashboard-shell--tds .tds-highlight,
  body.tds-theme .card,
  body.tds-theme .stats-card,
  body.tds-theme .kpi-card,
  body.tds-theme .vault-card,
  body.tds-theme .progress-stage-card,
  body.tds-theme .progress-project-card,
  body.tds-theme .client-list-card,
  body.tds-theme .progress-page-header,
  body.tds-theme .progress-timeline-section,
  body.tds-theme .stages-timeline-horizontal,
  body.tds-theme .login-box,
  body.tds-theme .register-box,
  body.tds-theme .client-dash-hero,
  body.tds-theme .client-dash-shortcut,
  body.tds-theme .client-dash-prepaid,
  body.tds-theme .client-dash-empty-panel,
  body.tds-theme .order-card,
  body.tds-theme .pp-order-card,
  body.tds-theme .resource-card,
  body.tds-theme .tds-resource-card,
  body.tds-theme .customer-resource-card,
  body.tds-theme .event-card,
  body.tds-theme .payment-info-card,
  body.tds-theme .login-card,
  body.tds-theme .register-card,
  body.tds-theme .page-actions.tds-filter-bar,
  body.tds-theme .tds-filter-bar--capsule,
  body.tds-theme .progress-list-filter-bar {
    background-color: var(--tds-glass-bg-panel, rgba(255, 255, 255, 0.48));
    -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    border: 1px solid rgba(220, 222, 226, 0.35);
    box-shadow: var(--tds-glass-shadow);
    border-radius: var(--tds-radius-xl, 1.25rem);
  }

  body.tds-theme .dashboard-shell--tds .tds-highlight {
    border-radius: var(--tds-radius-lg, 1rem);
  }
}

/* Sidebar chrome: one continuous sheet — no group fill breaks */
body.tds-theme .sidebar .sidebar-logo-section,
body.tds-theme .sidebar .sidebar-user-info,
body.tds-theme .sidebar .sidebar-footer,
body.tds-theme .sidebar .sidebar-menu,
body.tds-theme .sidebar .menu-section,
body.tds-theme .sidebar .menu-section-body,
body.tds-theme .sidebar .menu-section-body-inner,
body.tds-theme .sidebar .vl-family summary,
body.tds-theme .sidebar .vl-family nav {
  background: transparent !important;
  background-color: transparent !important;
}

body.tds-theme .sidebar .menu-item:hover,
body.tds-theme .sidebar .menu-section-toggle:hover,
body.tds-theme .sidebar .vl-family nav a[href]:hover,
body.tds-theme .sidebar .vl-family nav a[href]:focus-visible {
  background-color: rgba(249, 250, 251, 0.45) !important;
}

/* Selected menu: brand blue text + soft neutral chip (not sky wash) */
body.tds-theme .sidebar .menu-item.active {
  background-color: rgba(255, 255, 255, 0.72) !important;
  color: var(--tds-blue600, #2272eb) !important;
}

/* Header text/icons stay high-contrast over scrolled content */
body.tds-theme .header,
body.tds-theme .header a,
body.tds-theme .header button,
body.tds-theme .header .header-notification,
body.tds-theme .header .header-user-info {
  color: var(--tds-text-primary, #191f28);
}

body.tds-theme .header .header-logo {
  color: var(--tds-blue500, #3182f6);
}

body.tds-theme .header-dropdown-menu {
  border-radius: var(--tds-radius-lg, 1rem);
  overflow: hidden;
}

body.tds-theme .header-dropdown-item {
  color: var(--tds-text-primary, #191f28);
  font-size: var(--tds-typo6-size, 0.9375rem);
  font-weight: 500;
}

body.tds-theme .header-dropdown-item:hover {
  background-color: rgba(249, 250, 251, 0.72);
  color: var(--tds-blue600, #2272eb);
}

/* Nested chips inside panels/sections — top-level dashboard surfaces use full glass above */
body.tds-theme .tds-panel .tds-section:not(.tds-section--flat),
body.tds-theme .tds-panel .tds-highlight,
body.tds-theme .dashboard-shell--tds .tds-section .tds-schedule-item,
body.tds-theme .dashboard-shell--tds .tds-panel .dashboard-stat-item-card-vertical,
body.tds-theme .dash-kpi-card,
body.tds-theme .dash-chart-card,
body.tds-theme .dash-data-table-wrap,
body.tds-theme .dash-monthly-table-wrap {
  background-color: rgba(255, 255, 255, 0.28) !important;
  border: 1px solid rgba(229, 232, 235, 0.35);
  box-shadow: none;
}

/* Tables: subtle hairlines over glass, not solid white cells */
body.tds-theme .tds-panel .table,
body.tds-theme .dashboard-card .table,
body.tds-theme .tds-table-scroll,
body.tds-theme .table-responsive {
  background: transparent;
}

body.tds-theme .table thead,
body.tds-theme .tds-panel .table thead,
body.tds-theme .dashboard-card .table thead {
  background: rgba(249, 250, 251, 0.45);
}

body.tds-theme .table tbody tr,
body.tds-theme .table tbody td {
  background: transparent;
  border-bottom: 1px solid rgba(229, 232, 235, 0.55);
}

body.tds-theme .table tbody tr:hover td {
  background: rgba(249, 250, 251, 0.35);
}

/* Form / search / select triggers — shared glass control (not opaque white slabs) */
body.tds-theme .form-control:not(textarea):not([type="file"]):not([type="checkbox"]):not([type="radio"]),
body.tds-theme .page-actions .form-control,
body.tds-theme .tds-filter-bar .form-control,
body.tds-theme .tds-search-row .form-control,
body.tds-theme input[type="search"].form-control,
body.tds-theme .page-actions input[type="search"],
body.tds-theme .tds-select__trigger {
  background-color: var(--tds-glass-bg-control, rgba(255, 255, 255, 0.55));
  border-color: var(--tds-glass-edge, rgba(220, 222, 226, 0.55));
  box-shadow: var(--tds-glass-control-shadow);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.tds-theme .form-control:not(textarea):not([type="file"]):not([type="checkbox"]):not([type="radio"]),
  body.tds-theme .page-actions .form-control,
  body.tds-theme .tds-filter-bar .form-control,
  body.tds-theme .tds-search-row .form-control,
  body.tds-theme input[type="search"].form-control,
  body.tds-theme .page-actions input[type="search"],
  body.tds-theme .tds-select__trigger {
    -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(12px);
    backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(12px);
  }
}

body.tds-theme textarea.form-control {
  background-color: var(--tds-glass-bg-control, rgba(255, 255, 255, 0.55));
  border-color: var(--tds-glass-edge, rgba(220, 222, 226, 0.55));
}

/* Tab-only filter bars → compact glass capsule (not full-width slab) */
body.tds-theme .progress-list-filter-bar,
body.tds-theme .page-actions.tds-filter-bar:has(> .tds-segmented):not(:has(.form-control)):not(:has(.tds-search-row)):not(:has(input)):not(:has(select)),
body.tds-theme .tds-filter-bar--capsule {
  width: auto !important;
  max-width: max-content !important;
  display: inline-flex !important;
  flex-wrap: wrap !important;
  padding: 0.35rem 0.4rem !important;
  margin: 0 0 1.25rem !important;
  border-radius: 999px !important;
  background: var(--tds-glass-bg-panel, rgba(255, 255, 255, 0.48)) !important;
  border: 1px solid var(--tds-glass-border, rgba(255, 255, 255, 0.78)) !important;
  box-shadow: var(--tds-glass-shadow) !important;
}

body.tds-theme .progress-list-filter-bar .tds-segmented,
body.tds-theme .progress-list-filter-bar .tds-seg,
body.tds-theme .tds-filter-bar--capsule .tds-segmented,
body.tds-theme .tds-filter-bar--capsule .tds-seg,
body.tds-theme .page-actions.tds-filter-bar:has(> .tds-segmented):not(:has(.form-control)):not(:has(.tds-search-row)):not(:has(input)):not(:has(select)) > .tds-segmented,
body.tds-theme .page-actions.tds-filter-bar:has(> .tds-seg):not(:has(.form-control)):not(:has(.tds-search-row)):not(:has(input)):not(:has(select)) > .tds-seg {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  gap: var(--tds-toggle-track-gap, 0.15rem);
  max-width: none;
}

body.tds-theme .progress-list-filter-bar .tds-segmented__item,
body.tds-theme .progress-list-filter-bar .tds-seg__item,
body.tds-theme .tds-filter-bar--capsule .tds-segmented__item,
body.tds-theme .tds-filter-bar--capsule .tds-seg__item {
  border-radius: var(--tds-toggle-item-radius, 999px);
  padding: var(--tds-toggle-item-pad-y, 0.45rem) var(--tds-toggle-item-pad-x, 0.95rem);
}

/* Active chip — opaque white + brand blue + elevation (shared tokens) */
body.tds-theme .progress-list-filter-bar .tds-segmented__item.is-active,
body.tds-theme .progress-list-filter-bar .tds-seg__item.is-active,
body.tds-theme .tds-filter-bar--capsule .tds-segmented__item.is-active,
body.tds-theme .tds-filter-bar--capsule .tds-seg__item.is-active,
body.tds-theme .progress-list-filter-bar .tds-segmented__item[aria-selected="true"],
body.tds-theme .tds-filter-bar--capsule .tds-segmented__item[aria-selected="true"] {
  background: var(--tds-toggle-active-bg, #ffffff) !important;
  color: var(--tds-toggle-active-color, var(--tds-blue700)) !important;
  font-weight: var(--tds-toggle-active-weight, 700) !important;
  border-color: var(--tds-toggle-active-border, transparent) !important;
  box-shadow: var(--tds-toggle-active-shadow) !important;
  outline: none !important;
}

/* Modals / dialogs: slightly stronger frosted glass */
body.tds-theme .tds-dialog,
body.tds-theme .modal-content,
body.tds-theme .modal-overlay .modal,
body.tds-theme .modal.active .modal-content {
  background-color: var(--tds-glass-bg-modal, rgba(255, 255, 255, 0.82));
  border: 1px solid var(--tds-glass-border, rgba(255, 255, 255, 0.78));
  box-shadow: var(--tds-shadow-elevated, 0 16px 48px rgba(2, 9, 19, 0.12));
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.tds-theme .tds-dialog,
  body.tds-theme .modal-content,
  body.tds-theme .modal-overlay .modal,
  body.tds-theme .modal.active .modal-content {
    -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 140%)) blur(var(--tds-glass-blur, 20px));
    backdrop-filter: saturate(var(--tds-glass-saturate, 140%)) blur(var(--tds-glass-blur, 20px));
  }
}

/* ── Denser work lists ── */
body.tds-theme .page-actions,
body.tds-theme .tds-filter-bar,
body.tds-theme .page-actions.tds-filter-bar {
  padding: var(--tds-filter-bar-pad-y, 0.625rem) var(--tds-filter-bar-pad-x, 0.875rem) !important;
  margin: 0 0 0.75rem !important;
  gap: 0.375rem !important;
}

body.tds-theme .page-actions .form-control,
body.tds-theme .tds-filter-bar .form-control,
body.tds-theme .page-actions input.form-control,
body.tds-theme .page-actions select.form-control,
body.tds-theme .page-actions input[type="text"],
body.tds-theme .page-actions input[type="search"],
body.tds-theme .page-actions input[type="date"],
body.tds-theme .page-actions input[type="month"],
body.tds-theme .page-actions select,
body.tds-theme .page-actions .btn,
body.tds-theme .tds-filter-bar .btn,
body.tds-theme .page-actions a.btn,
body.tds-theme .page-actions button.btn {
  height: var(--tds-filter-control-h, 2.25rem) !important;
  min-height: var(--tds-filter-control-h, 2.25rem) !important;
  max-height: var(--tds-filter-control-h, 2.25rem) !important;
}

body.tds-theme .tds-panel__header,
body.tds-theme .dashboard-card-header {
  padding: 0.875rem 1rem 0.5rem;
}

body.tds-theme .tds-panel__title,
body.tds-theme .dashboard-card-title {
  font-size: var(--tds-typo4-size, 1.25rem);
  line-height: var(--tds-typo4-line, 1.8125rem);
  font-weight: 600;
  margin: 0;
}

body.tds-theme .tds-panel__body,
body.tds-theme .dashboard-card-body {
  padding: 0.25rem 1rem 1rem;
}

body.tds-theme .tds-panel__body--flush {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

body.tds-theme .table th,
body.tds-theme .table thead th,
body.tds-theme .tds-panel .table thead th,
body.tds-theme .dashboard-card .table thead th {
  padding: 0.5rem var(--tds-list-cell-pad-x, 0.75rem);
  font-size: 0.75rem;
  line-height: 1.2;
}

body.tds-theme .table td,
body.tds-theme .table tbody td,
body.tds-theme .tds-panel .table tbody td,
body.tds-theme .dashboard-card .table tbody td {
  padding: var(--tds-list-cell-pad-y, 0.5625rem) var(--tds-list-cell-pad-x, 0.75rem);
  font-size: 0.875rem;
  line-height: 1.35;
}

body.tds-theme .table tbody td .btn-sm {
  height: 1.875rem;
  min-height: 1.875rem;
  padding: 0 0.625rem;
  font-size: 0.75rem;
}

/* Long Korean titles: ellipsis without breaking row density */
body.tds-theme .table td.tds-cell--clip {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tds-theme .tds-list-row__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status: color + text (badges keep text; tighten chip) */
body.tds-theme .badge,
body.tds-theme .tds-badge,
body.tds-theme .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  line-height: 1.2;
  vertical-align: middle;
}

/* ── Buttons: concise states ── */
body.tds-theme .btn:disabled,
body.tds-theme .btn[disabled],
body.tds-theme .btn.is-loading {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

body.tds-theme .btn.is-loading {
  position: relative;
  color: transparent !important;
}

body.tds-theme .btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tds-btn-spin 0.7s linear infinite;
}

body.tds-theme .btn-secondary.is-loading::after,
body.tds-theme .btn-outline.is-loading::after,
body.tds-theme .btn-ghost.is-loading::after {
  border-color: rgba(78, 89, 104, 0.25);
  border-top-color: var(--tds-grey700, #4e5968);
}

@keyframes tds-btn-spin {
  to { transform: rotate(360deg); }
}

/* ── Inputs: error ── */
body.tds-theme .form-control.is-invalid,
body.tds-theme .form-control.has-error,
body.tds-theme .form-control[aria-invalid="true"] {
  border-color: var(--tds-red500, #f04452) !important;
  box-shadow: 0 0 0 3px rgba(240, 68, 82, 0.12);
}

body.tds-theme .form-error,
body.tds-theme .invalid-feedback,
body.tds-theme .field-error {
  display: block;
  margin-top: 0.25rem;
  font-size: var(--tds-typo7-size, 0.8125rem);
  line-height: var(--tds-typo7-line, 1.21875rem);
  color: var(--tds-red600, #e42939);
}

/* ── Dashboard hierarchy: actionable lists first density ── */
body.tds-theme .dashboard-shell--tds .tds-list-row {
  padding: var(--tds-list-row-pad-y, 0.625rem) var(--tds-space-lg, 1.25rem);
  min-height: var(--tds-list-row-min-h, 2.75rem);
  gap: var(--tds-space-sm, 0.5rem);
}

body.tds-theme .dashboard-shell--tds .tds-list-row__title {
  font-size: var(--tds-typo6-size, 0.9375rem);
  line-height: var(--tds-typo6-line, 1.40625rem);
  font-weight: 600;
}

body.tds-theme .dashboard-shell--tds .tds-list-header {
  padding: 0.875rem 1.25rem 0.375rem;
}

body.tds-theme .dashboard-shell--tds .tds-list-header__title {
  font-size: var(--tds-typo4-size, 1.25rem);
  line-height: var(--tds-typo4-line, 1.8125rem);
  font-weight: 600;
}

/* Legacy dashboard-list panels (최근 업무 / 내 승인 요청 등) — match list-header + list-row */
body.tds-theme .dashboard-shell--tds .tds-panel__header,
body.tds-theme .dashboard-shell--tds .dashboard-card-header {
  padding: 0.875rem 1.25rem 0.375rem;
}

body.tds-theme .dashboard-shell--tds .tds-panel__title,
body.tds-theme .dashboard-shell--tds .dashboard-card-title {
  font-size: var(--tds-typo4-size, 1.25rem);
  line-height: var(--tds-typo4-line, 1.8125rem);
  font-weight: 600;
  margin: 0;
}

body.tds-theme .dashboard-shell--tds .tds-panel__body,
body.tds-theme .dashboard-shell--tds .dashboard-card-body {
  padding: 0.25rem 1.25rem 0.875rem;
}

body.tds-theme .dashboard-shell--tds .dashboard-list-item {
  padding: var(--tds-list-row-pad-y, 0.625rem) 0;
  gap: 0.125rem;
}

body.tds-theme .dashboard-shell--tds .dashboard-list-title {
  font-size: var(--tds-typo6-size, 0.9375rem);
  line-height: var(--tds-typo6-line, 1.40625rem);
  font-weight: 600;
  margin-bottom: 0;
}

body.tds-theme .dashboard-shell--tds .dashboard-list-subtitle {
  font-size: var(--tds-typo7-size, 0.8125rem);
  line-height: var(--tds-typo7-line, 1.21875rem);
  margin-top: 0.125rem;
}

body.tds-theme .dashboard-shell--tds .tds-highlight__value {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

body.tds-theme .dashboard-shell--tds .tds-highlight {
  padding: 0.875rem 1rem;
}

body.tds-theme .dashboard-shell--tds .tds-top {
  margin-bottom: var(--tds-space-md, 1rem);
}

body.tds-theme .dashboard-shell--tds .tds-quick-nav-section {
  margin-bottom: var(--tds-space-md, 1rem);
}

/* Page title / desc / first content — unified left baseline + spacing */
body.tds-theme .page-header-with-actions,
body.tds-theme .app-main > .page-header {
  margin-bottom: 1.25rem; /* desc ↔ first content ~20–24px */
  padding-left: 0;
  padding-right: 0;
}

body.tds-theme .page-header-text,
body.tds-theme .page-header-left {
  max-width: 48rem;
}

body.tds-theme .page-title {
  font-size: var(--tds-typo3-size, 1.375rem);
  line-height: var(--tds-typo3-line, 1.9375rem);
  margin: 0 0 0.35rem; /* title ↔ desc 4–8px */
}

body.tds-theme .page-description {
  margin: 0;
  max-width: 42rem;
}

body.tds-theme .app-main {
  padding: var(--tds-space-lg, 1.25rem);
  padding-top: calc(var(--tds-space-lg, 1.25rem) + var(--tds-safe-top));
  padding-bottom: calc(var(--tds-space-lg, 1.25rem) + var(--tds-safe-bottom));
}

body.tds-theme .page-content.tds-page,
body.tds-theme .page-content {
  padding-left: 0;
  padding-right: 0;
}

/* Same-group cards 12–16px; sections 24–32px */
body.tds-theme .tds-panel + .tds-panel,
body.tds-theme .dashboard-card + .dashboard-card,
body.tds-theme .progress-project-list {
  margin-top: 0;
}

body.tds-theme .progress-project-list {
  gap: 0.875rem;
}

body.tds-theme .tds-page > .tds-panel,
body.tds-theme .page-content > .tds-panel {
  margin-bottom: 1.5rem;
}

/* Empty states stay consistent with skeleton system */
body.tds-theme .tds-empty,
body.tds-theme .empty-state {
  padding: 2rem 1rem;
  color: var(--tds-text-tertiary, #8b95a1);
  font-size: var(--tds-typo6-size, 0.9375rem);
  text-align: center;
}

body.tds-theme .tds-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255, 255, 255, 0.35);
}

body.tds-theme .tds-pagination-wrap {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

body.tds-theme a.tds-link-order {
  color: var(--tds-blue500, #3182f6);
  text-decoration: underline;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

body.tds-theme a.tds-link-order:hover {
  color: var(--tds-blue600, #2272eb);
}

/* ── Mobile: frequent actions + reachable columns ── */
@media (max-width: 768px) {
  body.tds-theme .app-main {
    padding: 0.5rem;
    padding-top: calc(0.5rem + var(--tds-safe-top));
    padding-bottom: calc(0.5rem + var(--tds-safe-bottom));
  }

  body.tds-theme .page-actions,
  body.tds-theme .tds-filter-bar,
  body.tds-theme .page-actions.tds-filter-bar {
    padding: 0.5rem !important;
    margin-bottom: 0.5rem !important;
  }

  body.tds-theme .tds-panel__header,
  body.tds-theme .dashboard-card-header {
    padding: 0.75rem 0.75rem 0.25rem;
  }

  body.tds-theme .tds-panel__body,
  body.tds-theme .dashboard-card-body {
    padding: 0.25rem 0.5rem 0.75rem;
  }

  /* Comparison tables: horizontal scroll, keep all columns */
  body.tds-theme .tds-panel__body[style*="overflow"],
  body.tds-theme .dashboard-card-body[style*="overflow"],
  body.tds-theme .table-wrapper,
  body.tds-theme .tds-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.tds-theme .table {
    min-width: 40rem;
  }

  /* Row-oriented lists: stack meta under title */
  body.tds-theme .dashboard-shell--tds .tds-list-row {
    align-items: flex-start;
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  body.tds-theme .dashboard-shell--tds .tds-list-row__right {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
  }

  body.tds-theme .page-actions .tds-filter-bar__actions,
  body.tds-theme .page-actions .tds-filter-bar-buttons,
  body.tds-theme .page-actions .vendors-filter-actions,
  body.tds-theme .page-actions .tasks-page-actions-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.375rem !important;
  }

  body.tds-theme .page-actions .tds-filter-bar__actions .btn,
  body.tds-theme .page-actions .tds-filter-bar-buttons .btn {
    flex: 1 1 auto !important;
  }
}

@media (min-width: 1440px) {
  body.tds-theme .app-main {
    padding-left: var(--tds-space-2xl, 2rem);
    padding-right: var(--tds-space-2xl, 2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.tds-theme .btn.is-loading::after {
    animation: none;
  }

  body.tds-theme .header,
  body.tds-theme .header-dropdown-menu,
  body.tds-theme .notification-sidebar,
  body.tds-theme .sidebar,
  body.tds-theme .tds-panel,
  body.tds-theme .dashboard-card,
  body.tds-theme .card,
  body.tds-theme .page-actions.tds-filter-bar,
  body.tds-theme .tds-dialog,
  body.tds-theme .modal-content {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: var(--tds-glass-bg-fallback, rgba(255, 255, 255, 0.88));
  }
}

body.tds-theme .card .card-header,
body.tds-theme .card .card-body {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  background: transparent;
}

body.tds-theme .card .card-body {
  padding-left: 0.875rem;
  padding-right: 0.875rem;
}

/* Auto tabular numerals + right-align money columns */
body.tds-theme .table td.text-right,
body.tds-theme .table th.text-right,
body.tds-theme .table td[style*="text-align: right"],
body.tds-theme .table td[style*="text-align:right"],
body.tds-theme .table th[style*="text-align: right"],
body.tds-theme .table th[style*="text-align:right"],
body.tds-theme .amount,
body.tds-theme .money,
body.tds-theme .price,
body.tds-theme .currency,
body.tds-theme .sidebar-client-prepaid .tds-num,
body.tds-theme .client-dash-prepaid__amount,
body.tds-theme time,
body.tds-theme .date,
body.tds-theme .datetime {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Common KR money labels — right + tabular without per-page markup */
body.tds-theme .table th.tds-num--end,
body.tds-theme .table td.tds-num--end,
body.tds-theme .table td.money,
body.tds-theme .table th.money,
body.tds-theme .table td[data-label="공급가액"],
body.tds-theme .table td[data-label="부가세"],
body.tds-theme .table td[data-label="총액"],
body.tds-theme .table td[data-label="금액"],
body.tds-theme .table td[data-label="합계"],
body.tds-theme .table td[data-label="단가"],
body.tds-theme .table td[data-label="결제금액"],
body.tds-theme .table td[data-label="정산금액"],
body.tds-theme .table th[data-label="공급가액"],
body.tds-theme .table th[data-label="부가세"],
body.tds-theme .table th[data-label="총액"],
body.tds-theme .table thead th.tds-num--end {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

body.tds-theme .table-responsive,
body.tds-theme .tds-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: transparent;
}

/* Overlay dim + light blur; dialog itself uses stronger glass above */
body.tds-theme .modal-overlay,
body.tds-theme .tds-dialog-overlay {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background-color: rgba(15, 23, 42, 0.28);
}

/* Status chips: keep text readable with color */
body.tds-theme .badge,
body.tds-theme .tds-badge,
body.tds-theme .status-badge {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Select async placeholders */
body.tds-theme select option:disabled {
  color: var(--tds-text-tertiary, #8b95a1);
}

/* Auth / standalone — same silver-white base (no blue wash) */
body.tds-theme .login-container,
body.tds-theme .register-container {
  background:
    linear-gradient(
      118deg,
      var(--tds-bg-page-bright, #FCFCFD) 0%,
      var(--tds-bg-page-bright, #FCFCFD) 40%,
      var(--tds-bg-page-wash, #ECECEE) 55%,
      var(--tds-bg-page-base, #F5F5F6) 100%
    ) !important;
}

/* Dense list feel for remaining dashboard-card grids */
body.tds-theme .dashboard-card .dashboard-card-header {
  padding: 0.875rem 1rem 0.375rem;
}

body.tds-theme .dashboard-card .dashboard-card-body {
  padding: 0.25rem 0.75rem 0.875rem;
}

body.tds-theme .dashboard-card .dashboard-card-title {
  font-size: var(--tds-typo4-size, 1.25rem);
  line-height: var(--tds-typo4-line, 1.8125rem);
}

/* Pagination + empty defaults when pages forget wrappers */
body.tds-theme .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
}

body.tds-theme .tds-empty p,
body.tds-theme .empty-state p {
  margin: 0.35rem 0 0;
  color: var(--tds-text-tertiary, #8b95a1);
}

/* ═══════════════════════════════════════════
   Glass scrollbars (webkit + Firefox)
   ═══════════════════════════════════════════ */
html.tds-theme,
body.tds-theme,
body.tds-theme .sidebar,
body.tds-theme .app-main,
body.tds-theme .page-content,
body.tds-theme .tds-panel,
body.tds-theme .tds-panel__body,
body.tds-theme .tds-table-scroll,
body.tds-theme .table-responsive,
body.tds-theme .modal-content,
body.tds-theme .tds-dialog,
body.tds-theme .notification-sidebar,
body.tds-theme .header-dropdown-menu,
body.tds-theme .tds-select__menu {
  scrollbar-width: thin;
  scrollbar-color: var(--tds-scroll-thumb, rgba(180, 184, 190, 0.55)) var(--tds-scroll-track, rgba(245, 245, 246, 0.55));
}

html.tds-theme::-webkit-scrollbar,
body.tds-theme::-webkit-scrollbar,
body.tds-theme *::-webkit-scrollbar {
  width: var(--tds-scroll-size, 8px);
  height: var(--tds-scroll-size, 8px);
}

html.tds-theme::-webkit-scrollbar-track,
body.tds-theme::-webkit-scrollbar-track,
body.tds-theme *::-webkit-scrollbar-track {
  background: var(--tds-scroll-track, rgba(245, 245, 246, 0.55));
  border-radius: 999px;
}

html.tds-theme::-webkit-scrollbar-thumb,
body.tds-theme::-webkit-scrollbar-thumb,
body.tds-theme *::-webkit-scrollbar-thumb {
  background: var(--tds-scroll-thumb, rgba(180, 184, 190, 0.55));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

html.tds-theme::-webkit-scrollbar-thumb:hover,
body.tds-theme::-webkit-scrollbar-thumb:hover,
body.tds-theme *::-webkit-scrollbar-thumb:hover {
  background: var(--tds-scroll-thumb-hover, rgba(140, 146, 156, 0.7));
  background-clip: padding-box;
}

html.tds-theme::-webkit-scrollbar-corner,
body.tds-theme *::-webkit-scrollbar-corner {
  background: transparent;
}

/* Kill leftover sky-blue table/card fills showing through glass */
body.tds-theme .table thead,
body.tds-theme .table thead th,
body.tds-theme .tds-panel .table thead th {
  background: rgba(245, 245, 246, 0.55) !important;
}

body.tds-theme .table tbody tr:hover td,
body.tds-theme .table tbody tr:hover {
  background: rgba(245, 245, 246, 0.65) !important;
}

body.tds-theme .menu-item.active {
  background-color: rgba(255, 255, 255, 0.72) !important;
  color: var(--tds-blue600, #2272eb) !important;
}

body.tds-theme .menu-item.active .menu-icon {
  color: var(--tds-blue500, #3182f6) !important;
}

/* ═══════════════════════════════════════════
   Custom select (replaces native <select> UI)
   ═══════════════════════════════════════════ */
body.tds-theme select.tds-select-native {
  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;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Brief fallback before JS upgrades */
body.tds-theme select:not(.tds-select-native):not([data-tds-select="off"]) {
  -webkit-appearance: none;
  appearance: none;
  background-color: rgba(255, 255, 255, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7684' d='M1.4 1.2L6 5.8l4.6-4.6 1.2 1.2L6 8.2 0.2 2.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem !important;
}

body.tds-theme .tds-select {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  min-width: 0;
  width: auto;
  max-width: 100%;
  vertical-align: middle;
  box-sizing: border-box;
}

/* Forms/modals: full-bleed. Filter bars use --fit (content width) instead. */
body.tds-theme .tds-select--block,
body.tds-theme .form-group .tds-select {
  width: 100%;
  flex: 1 1 auto;
}

body.tds-theme .tds-select.tds-select--fit,
body.tds-theme .page-actions .tds-select.tds-select--fit,
body.tds-theme .tds-filter-bar .tds-select.tds-select--fit {
  width: auto;
  flex: 0 1 auto;
  min-width: var(--tds-select-fit, 5.5rem);
  max-width: min(100%, 28rem);
}

body.tds-theme .tds-select__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  height: var(--tds-filter-control-h, 2.25rem);
  min-height: var(--tds-filter-control-h, 2.25rem);
  max-height: var(--tds-filter-control-h, 2.25rem);
  padding: 0 0.75rem 0 0.875rem;
  border-radius: var(--tds-radius-md, 0.75rem);
  border: 1px solid var(--tds-glass-edge, rgba(220, 222, 226, 0.55));
  background: var(--tds-glass-bg-control, rgba(255, 255, 255, 0.55));
  color: var(--tds-text-primary, #191f28);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--tds-glass-control-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

body.tds-theme .tds-select__trigger:hover {
  border-color: var(--tds-grey300, #d1d6db);
}

body.tds-theme .tds-select.is-open .tds-select__trigger,
body.tds-theme .tds-select__trigger:focus {
  outline: none;
  border-color: var(--tds-blue500, #3182f6);
  box-shadow: var(--tds-shadow-focus, 0 0 0 3px rgba(49, 130, 246, 0.15));
}

body.tds-theme .tds-select.is-disabled .tds-select__trigger {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(245, 245, 246, 0.9);
}

body.tds-theme .tds-select__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tds-theme .tds-select__value.is-placeholder {
  color: var(--tds-text-tertiary, #8b95a1);
  font-weight: 400;
}

body.tds-theme .tds-select__chevron {
  flex-shrink: 0;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 2px solid var(--tds-grey500, #6b7684);
  border-bottom: 2px solid var(--tds-grey500, #6b7684);
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s ease;
}

body.tds-theme .tds-select.is-open .tds-select__chevron {
  transform: rotate(225deg) translateY(-1px);
}

body.tds-theme .tds-select__menu {
  position: absolute;
  z-index: 5000;
  top: calc(100% + 0.35rem);
  left: 0;
  right: auto;
  width: max-content;
  min-width: 100%;
  max-width: min(100vw - 16px, 28rem);
  max-height: min(16rem, 50vh);
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: var(--tds-radius-lg, 1rem);
  border: 1px solid rgba(220, 222, 226, 0.45);
  background: var(--tds-glass-bg-strong, rgba(255, 255, 255, 0.92));
  -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
  backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
  box-shadow: var(--tds-glass-shadow);
  display: none;
  box-sizing: border-box;
}

/* Parents that used to clip menus (JS portals open menus to body) */
body.tds-theme .tds-panel:has(.tds-select.is-open),
body.tds-theme .dashboard-card:has(.tds-select.is-open),
body.tds-theme .card:has(.tds-select.is-open),
body.tds-theme .services-site-card:has(.tds-select.is-open),
body.tds-theme .client-list-card:has(.tds-select.is-open),
body.tds-theme .page-actions:has(.tds-select.is-open),
body.tds-theme .tds-filter-bar:has(.tds-select.is-open),
body.tds-theme .tds-filter-row:has(.tds-select.is-open),
body.tds-theme .filter-form:has(.tds-select.is-open) {
  overflow: visible !important;
}

/* Open state on wrap (in-tree) or on menu itself (portaled to body) */
body.tds-theme .tds-select.is-open .tds-select__menu,
body.tds-theme .tds-select__menu.is-open {
  display: block;
}

body.tds-theme .tds-select__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--tds-radius-md, 0.75rem);
  color: var(--tds-text-primary, #191f28);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
}

body.tds-theme .tds-select__option > span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.tds-theme .tds-select__option:hover,
body.tds-theme .tds-select__option.is-active {
  background: rgba(245, 245, 246, 0.9);
}

body.tds-theme .tds-select__option.is-selected {
  color: var(--tds-blue600, #2272eb);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
}

body.tds-theme .tds-select__option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body.tds-theme .tds-select--multiple .tds-select__menu {
  max-height: min(18rem, 55vh);
}

@media (max-width: 768px) {
  body.tds-theme .tds-select__menu {
    max-height: min(14rem, 45vh);
  }
}

/* Tiny viewports only: cap width and ellipsis instead of wrapping labels */
@media (max-width: 360px) {
  body.tds-theme .tds-select.tds-select--fit,
  body.tds-theme .page-actions .tds-select,
  body.tds-theme .tds-filter-bar .tds-select {
    max-width: 100%;
    min-width: 0 !important;
  }

  body.tds-theme .tds-select__option {
    white-space: nowrap;
  }
}

/* ── Dense forms: sectioned label / value / error / save hierarchy ── */
body.tds-theme .tds-form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

body.tds-theme .tds-form-section {
  margin: 0;
  padding: 0;
  border: 0;
}

body.tds-theme .tds-form-section__title {
  margin: 0 0 0.75rem;
  padding: 0 0 0.5rem;
  font-size: var(--tds-typo6-size, 0.9375rem);
  line-height: var(--tds-typo6-line, 1.40625rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tds-text-primary, #191f28);
  border-bottom: 1px solid rgba(220, 222, 226, 0.55);
}

body.tds-theme .tds-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.875rem 1rem;
}

body.tds-theme .tds-form-grid .form-group {
  margin-bottom: 0;
  min-width: 0;
}

body.tds-theme .form-control.form-control--readonly,
body.tds-theme .form-control[readonly] {
  background-color: rgba(245, 245, 246, 0.72);
  color: var(--tds-text-secondary, #6b7684);
  cursor: not-allowed;
  box-shadow: none;
}

body.tds-theme .tds-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

body.tds-theme .tds-form-footer__danger {
  margin-right: auto;
}

body.tds-theme .tds-form-footer__note {
  margin-right: auto;
  font-size: var(--tds-typo7-size, 0.8125rem);
  color: var(--tds-text-tertiary, #8b95a1);
}

body.tds-theme .tds-form-footer__actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

@media (max-width: 640px) {
  body.tds-theme .tds-form-grid {
    grid-template-columns: 1fr;
  }

  body.tds-theme .tds-form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  body.tds-theme .tds-form-footer__danger,
  body.tds-theme .tds-form-footer__note {
    margin-right: 0;
  }

  body.tds-theme .tds-form-footer__actions {
    margin-left: 0;
    width: 100%;
  }

  body.tds-theme .tds-form-footer__actions .btn {
    flex: 1 1 auto;
  }
}

/* Neutral row hover — no sky-blue wash (dashboard tables) */
body.tds-theme .dash-data-table tbody tr:nth-child(even) td,
body.tds-theme .dash-monthly-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.22) !important;
}

body.tds-theme .dash-data-table__row:hover td,
body.tds-theme .dash-monthly-table tbody tr:hover td {
  background: rgba(245, 245, 246, 0.72) !important;
}

/* Tabs / top chrome — glass sheet (fill alpha only; text stays opaque) */
body.tds-theme .tabs {
  background: var(--tds-glass-bg-panel, rgba(255, 255, 255, 0.48));
  border-bottom: 1px solid rgba(220, 222, 226, 0.45);
  box-shadow: var(--tds-glass-control-shadow, none);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.tds-theme .tabs {
    -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
    backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
  }
}

body.tds-theme .tab:hover {
  background: rgba(255, 255, 255, 0.45);
  color: var(--tds-blue700, #1b64da);
}

body.tds-theme .tab.active {
  background: rgba(255, 255, 255, 0.82);
  color: var(--tds-blue700, #1b64da);
  border-bottom-color: var(--tds-blue500, #3182f6);
}

/* Legacy soft-blue surfaces under TDS — neutralize without touching store grids */
body.tds-theme .saas-card,
body.tds-theme .info-box,
body.tds-theme .alert-info:not(.badge) {
  background-color: rgba(255, 255, 255, 0.42);
}

body.tds-theme .btn-outline:not(.btn-primary):not(.store-btn) {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(220, 222, 226, 0.85);
  color: var(--tds-blue700, #1b64da);
}

body.tds-theme .btn-outline:not(.btn-primary):not(.store-btn):hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--tds-blue200, #90c2ff);
}

/* -------------------------------------------------------------------------
   TDS date — custom single / range calendar (sitewide date / datetime replacement)
   ------------------------------------------------------------------------- */
body.tds-theme input.tds-date-native,
body.tds-theme .tds-date > input[type="date"].tds-date-native,
body.tds-theme .tds-date > input[type="datetime-local"].tds-date-native,
body.tds-theme .tds-date > input[type="month"].tds-date-native,
body.tds-theme .tds-date > input[type="week"].tds-date-native,
body.tds-theme .tds-date-range > input[type="date"].tds-date-native,
body.tds-theme .tds-date > input[type="hidden"],
body.tds-theme .tds-date-range > input[type="hidden"],
body.tds-theme .page-actions input[type="date"].tds-date-native,
body.tds-theme .page-actions input[type="datetime-local"].tds-date-native,
body.tds-theme .page-actions input[type="month"].tds-date-native,
body.tds-theme .page-actions input[type="week"].tds-date-native {
  position: absolute !important;
  width: 1px !important;
  min-width: 0 !important;
  max-width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  max-height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

body.tds-theme .tds-date,
body.tds-theme .tds-date-range {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  min-width: 9.5rem;
  max-width: 100%;
  vertical-align: middle;
  box-sizing: border-box;
}

body.tds-theme .tds-date.tds-date--range,
body.tds-theme .tds-date-range {
  min-width: 12.5rem;
}

body.tds-theme .tds-date.tds-date--week {
  min-width: 14rem;
  max-width: min(100%, 22rem);
}

body.tds-theme .tds-date.tds-date--datetime {
  min-width: 12.5rem;
}

body.tds-theme .tds-date.tds-date--block,
body.tds-theme .form-group > .tds-date,
body.tds-theme .form-group .tds-date,
body.tds-theme .modal-form-group > .tds-date,
body.tds-theme .modal-form-group .tds-date {
  display: flex;
  width: 100%;
  min-width: 0;
}

body.tds-theme .page-actions .tds-filter-row > .tds-date,
body.tds-theme .tds-filter-bar .tds-filter-row > .tds-date,
body.tds-theme .page-actions .tds-search-row > .tds-date,
body.tds-theme .page-actions .tds-filter-row > .tds-date-range,
body.tds-theme .tds-filter-bar .tds-filter-row > .tds-date-range,
body.tds-theme .page-actions .tds-search-row > .tds-date-range {
  flex: 0 1 auto !important;
  width: auto !important;
  min-width: 9.5rem;
}

body.tds-theme .page-actions .tds-filter-row > .tds-date--range,
body.tds-theme .page-actions .tds-filter-row > .tds-date-range {
  min-width: 12.5rem;
}

body.tds-theme .tds-date__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  height: var(--tds-filter-control-h, 2.25rem);
  min-height: var(--tds-filter-control-h, 2.25rem);
  max-height: var(--tds-filter-control-h, 2.25rem);
  padding: 0 0.75rem 0 0.875rem;
  border-radius: var(--tds-radius-md, 0.75rem);
  border: 1px solid var(--tds-glass-edge, rgba(220, 222, 226, 0.55));
  background: var(--tds-glass-bg-control, rgba(255, 255, 255, 0.55));
  color: var(--tds-text-primary, #191f28);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--tds-glass-control-shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

body.tds-theme .form-group .tds-date__trigger,
body.tds-theme .modal .tds-date__trigger,
body.tds-theme .tds-dialog .tds-date__trigger {
  height: auto;
  min-height: 2.5rem;
  max-height: none;
  padding: 0.625rem 0.875rem;
  background: var(--tds-bg-surface, #fff);
  border-color: var(--tds-border-default, #e5e8eb);
  box-shadow: none;
}

body.tds-theme .tds-date__trigger:hover {
  border-color: var(--tds-grey300, #d1d6db);
}

body.tds-theme .tds-date.is-open .tds-date__trigger,
body.tds-theme .tds-date__trigger:focus {
  outline: none;
  border-color: var(--tds-blue500, #3182f6);
  box-shadow: var(--tds-shadow-focus, 0 0 0 3px rgba(49, 130, 246, 0.15));
}

body.tds-theme .tds-date.is-disabled .tds-date__trigger {
  opacity: 0.55;
  cursor: not-allowed;
}

body.tds-theme .tds-date.is-invalid .tds-date__trigger {
  border-color: var(--tds-red500, #f04452);
  box-shadow: 0 0 0 3px rgba(240, 68, 82, 0.12);
}

body.tds-theme .tds-date__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

body.tds-theme .tds-date__value.is-placeholder {
  color: var(--tds-text-tertiary, #8b95a1);
  font-weight: 400;
}

body.tds-theme .tds-date__icon {
  flex-shrink: 0;
  display: inline-flex;
  color: var(--tds-grey500, #8b95a1);
}

body.tds-theme .tds-date__popover {
  display: none;
  box-sizing: border-box;
  width: 320px;
  padding: 0.75rem;
  border-radius: var(--tds-radius-lg, 1rem);
  border: 1px solid rgba(220, 222, 226, 0.45);
  background: var(--tds-glass-bg-strong, rgba(255, 255, 255, 0.96));
  -webkit-backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
  backdrop-filter: saturate(var(--tds-glass-saturate, 120%)) blur(var(--tds-glass-blur, 20px));
  box-shadow: var(--tds-glass-shadow);
  z-index: 6000;
}

body.tds-theme .tds-date.is-open .tds-date__popover,
body.tds-theme .tds-date__popover.is-open {
  display: block;
}

body.tds-theme .page-actions:has(.tds-date.is-open),
body.tds-theme .tds-filter-bar:has(.tds-date.is-open),
body.tds-theme .tds-filter-row:has(.tds-date.is-open),
body.tds-theme .filter-form:has(.tds-date.is-open),
body.tds-theme .form-group:has(.tds-date.is-open),
body.tds-theme .modal:has(.tds-date.is-open),
body.tds-theme .tds-dialog:has(.tds-date.is-open) {
  overflow: visible !important;
}

body.tds-theme .tds-date__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

body.tds-theme .tds-date__title {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.25rem 0.45rem;
  border: 0;
  border-radius: var(--tds-radius-sm, 0.5rem);
  background: transparent;
  text-align: center;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--tds-text-primary, #191f28);
  cursor: pointer;
}

body.tds-theme .tds-date__title:hover:not(.is-static) {
  background: var(--tds-grey100, #f2f4f6);
  color: var(--tds-blue600, #2272eb);
}

body.tds-theme .tds-date__title.is-static {
  cursor: default;
  pointer-events: none;
}

body.tds-theme .tds-date__title-caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  transform: translateY(1px);
}

body.tds-theme .tds-date__title.is-static .tds-date__title-caret {
  display: none;
}

body.tds-theme .tds-date__nav {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--tds-radius-md, 0.75rem);
  background: transparent;
  color: var(--tds-grey700, #4e5968);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

body.tds-theme .tds-date__nav:hover {
  background: var(--tds-grey100, #f2f4f6);
  color: var(--tds-text-primary, #191f28);
}

body.tds-theme .tds-date__hint {
  margin-bottom: 0.55rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--tds-text-tertiary, #8b95a1);
}

body.tds-theme .tds-date__weekdays,
body.tds-theme .tds-date__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
}

body.tds-theme .tds-date__weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--tds-text-tertiary, #8b95a1);
}

body.tds-theme .tds-date__weekday.is-sun,
body.tds-theme .tds-date__day.is-sun {
  color: var(--tds-red500, #f04452);
}

body.tds-theme .tds-date__day {
  position: relative;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tds-text-primary, #191f28);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  z-index: 1;
}

body.tds-theme .tds-date__day.is-empty {
  pointer-events: none;
  visibility: hidden;
}

body.tds-theme .tds-date__day:hover:not(.is-selected) {
  background: var(--tds-grey100, #f2f4f6);
}

body.tds-theme .tds-date__day.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px var(--tds-blue300, #64a8ff);
}

body.tds-theme .tds-date__day.is-in-range {
  background: var(--tds-blue50, #e8f3ff);
  border-radius: 0;
}

body.tds-theme .tds-date__day.is-selected {
  background: var(--tds-blue500, #3182f6);
  color: #fff;
  font-weight: 700;
}

body.tds-theme .tds-date__day.is-start.is-range-bound:not(.is-single) {
  border-radius: 999px 0 0 999px;
}

body.tds-theme .tds-date__day.is-end.is-range-bound:not(.is-single) {
  border-radius: 0 999px 999px 0;
}

body.tds-theme .tds-date__day.is-single {
  border-radius: 999px;
}

body.tds-theme .tds-date__time {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--tds-border-light, #f2f4f6);
}

body.tds-theme .tds-date__time-label {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tds-text-secondary, #6b7684);
  margin-right: 0.15rem;
}

body.tds-theme .tds-date__time-input {
  width: 2.75rem;
  height: 2rem;
  padding: 0 0.35rem;
  border: 1px solid var(--tds-glass-edge, rgba(220, 222, 226, 0.55));
  border-radius: var(--tds-radius-sm, 0.5rem);
  background: var(--tds-bg-surface, #fff);
  color: var(--tds-text-primary, #191f28);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  box-sizing: border-box;
  -moz-appearance: textfield;
  appearance: textfield;
}

body.tds-theme .tds-date__time-input::-webkit-outer-spin-button,
body.tds-theme .tds-date__time-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body.tds-theme .tds-date__time-input:focus {
  outline: none;
  border-color: var(--tds-blue500, #3182f6);
  box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.15);
}

body.tds-theme .tds-date__time-sep {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--tds-text-secondary, #6b7684);
}

body.tds-theme .tds-date__apply {
  margin-left: auto;
  height: 2rem;
  padding: 0 0.7rem;
  border: 0;
  border-radius: var(--tds-radius-sm, 0.5rem);
  background: var(--tds-blue500, #3182f6);
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

body.tds-theme .tds-date__apply:hover {
  background: var(--tds-blue600, #2272eb);
}

body.tds-theme .tds-date__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--tds-border-light, #f2f4f6);
}

body.tds-theme .tds-date__footer:has(.tds-date__presets),
body.tds-theme .tds-date__footer.has-presets {
  justify-content: flex-start;
}

body.tds-theme .tds-date__footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

body.tds-theme .tds-date__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-width: 0;
}

body.tds-theme .tds-date__today {
  border: 0;
  background: transparent;
  color: var(--tds-blue600, #2272eb);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: var(--tds-radius-sm, 0.5rem);
}

body.tds-theme .tds-date__today:hover {
  background: var(--tds-blue50, #e8f3ff);
  color: var(--tds-blue700, #1b64da);
}

body.tds-theme .tds-date__preset {
  border: 1px solid var(--tds-border, #e5e8eb);
  background: var(--tds-bg-surface, #fff);
  color: var(--tds-text-secondary, #6b7684);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.3rem 0.45rem;
  border-radius: var(--tds-radius-sm, 0.5rem);
  cursor: pointer;
  white-space: nowrap;
}

body.tds-theme .tds-date__preset:hover {
  color: var(--tds-blue600, #2272eb);
  border-color: var(--tds-blue200, #c9e2ff);
  background: var(--tds-blue50, #e8f3ff);
}

body.tds-theme .tds-date__preset.is-active {
  color: #fff;
  border-color: var(--tds-blue500, #3182f6);
  background: var(--tds-blue500, #3182f6);
}

body.tds-theme .tds-date__clear {
  border: 0;
  background: transparent;
  color: var(--tds-text-secondary, #6b7684);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.35rem;
  border-radius: var(--tds-radius-sm, 0.5rem);
}

body.tds-theme .tds-date__clear:hover {
  color: var(--tds-blue600, #2272eb);
  background: var(--tds-blue50, #e8f3ff);
}

body.tds-theme .tds-date__months,
body.tds-theme .tds-date__years {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

body.tds-theme .tds-date__years {
  grid-template-columns: repeat(4, 1fr);
}

body.tds-theme .tds-date__month,
body.tds-theme .tds-date__year {
  height: 2.75rem;
  border: 0;
  border-radius: var(--tds-radius-md, 0.75rem);
  background: transparent;
  color: var(--tds-text-primary, #191f28);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

body.tds-theme .tds-date__year {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
}

body.tds-theme .tds-date__month:hover:not(.is-selected),
body.tds-theme .tds-date__year:hover:not(.is-selected) {
  background: var(--tds-grey100, #f2f4f6);
}

body.tds-theme .tds-date__year.is-outside {
  color: var(--tds-text-tertiary, #8b95a1);
  font-weight: 500;
}

body.tds-theme .tds-date__month.is-today:not(.is-selected),
body.tds-theme .tds-date__year.is-today:not(.is-selected) {
  box-shadow: inset 0 0 0 1px var(--tds-blue300, #64a8ff);
}

body.tds-theme .tds-date__month.is-selected,
body.tds-theme .tds-date__year.is-selected {
  background: var(--tds-blue500, #3182f6);
  color: #fff;
}

/* ── Mobile glass (≤768px) ─────────────────────────────────────────────
   Root causes addressed here:
   1. Dozens of nested backdrop-filter layers (panels > filter bar > inputs, dialog inside a blurred
      overlay, sidebar over blurred cards) render blank/flickering or get clipped on iOS/Android WebView,
      and each one creates a stacking context + containing block that traps fixed/absolute descendants.
   2. Blur over an almost uniform page gradient adds no visual value on phones, only cost.
   Strategy: keep ONE blur layer where it matters (sticky page header, modal dim), make every other
   surface a slightly more opaque flat "glass" fill so the look stays consistent without backdrop-filter. */
@media (max-width: 768px) {
  body.tds-theme {
    --tds-glass-bg-panel: rgba(255, 255, 255, 0.78);
    --tds-glass-bg-control: rgba(255, 255, 255, 0.86);
    --tds-glass-bg-strong: rgba(255, 255, 255, 0.92);
    --tds-glass-bg-modal: rgba(255, 255, 255, 0.96);
    --tds-glass-bg-sidebar: rgba(255, 255, 255, 0.98);
    --tds-glass-blur: 0px;
    --tds-glass-saturate: 100%;
  }

  /* Flatten every in-flow / nested glass surface. Exceptions: sticky page header + overlay dims. */
  body.tds-theme *:not(.page-header-with-actions):not(.modal-overlay):not(.tds-dialog-overlay) {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* Sticky page header: the single remaining glass bar (lighter blur, denser fill) */
  body.tds-theme .page-header-with-actions {
    background-color: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: saturate(110%) blur(10px);
    backdrop-filter: saturate(110%) blur(10px);
    z-index: 90;
  }

  /* Drawer: opaque sheet, never translucent over the dimmed page */
  body.tds-theme .sidebar {
    background-color: var(--tds-glass-bg-sidebar, rgba(255, 255, 255, 0.98));
    border-right: 1px solid rgba(220, 222, 226, 0.6);
  }

  body.tds-theme .sidebar:not(.mobile-open) {
    box-shadow: none;
  }

  body.tds-theme .sidebar.mobile-open {
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.18);
  }

  /* Nested chips inside panels: no extra alpha stacking */
  body.tds-theme .tds-panel .tds-section:not(.tds-section--flat),
  body.tds-theme .tds-panel .tds-highlight,
  body.tds-theme .dash-kpi-card,
  body.tds-theme .dash-chart-card {
    background-color: rgba(255, 255, 255, 0.5) !important;
  }

  /* While the drawer is open, floating menus (portal z-index 5000/6000) must not poke through the dimmer */
  body.mobile-sidebar-open .tds-select__menu,
  body.mobile-sidebar-open .tds-date__popover,
  body.mobile-sidebar-open .header-dropdown-menu {
    display: none !important;
  }

  /* Lock background scroll while the drawer is open */
  body.mobile-sidebar-open {
    overflow: hidden;
  }
}

