/* ============================================================================
 * ACCOUNT CLEANUP STYLES (assets/css/account-cleanup.css)
 * Fully aligned with CRM design tokens & light/dark modes.
 * Zero hardcoded colors. Zero inline CSS. Fully responsive.
 * ========================================================================== */

.ac-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-8) var(--sp-16);
  color: var(--text);
}

.ac-page *,
.ac-page *::before,
.ac-page *::after {
  box-sizing: border-box;
}
.ac-page .fk-pill__x svg {
  width: 18px;
  height: 18px
}
/* ------------------------------------------------------------- Head & Tabs */
.ac-head {
  margin-bottom: var(--sp-4);
}

.ac-title {
  margin: 0 0 var(--sp-4);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
}

.ac-tabs {
  display: flex;
  gap: var(--sp-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-5);
}

.ac-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: var(--sp-3) var(--sp-5);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--fast) var(--ease);
}

.ac-tab:hover {
  color: var(--text);
}

.ac-tab.is-active,
.ac-tab[aria-selected="true"] {
  color: var(--text);
}

.ac-tab.is-active::after,
.ac-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--sp-2);
  right: var(--sp-2);
  bottom: -1px;
  height: 3px;
  background: var(--text);
  border-radius: 2px 2px 0 0;
}

.ac-subheading {
  margin: 0 0 var(--sp-6);
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ------------------------------------------------------------- Promo Banner */
.ac-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: var(--sp-6) var(--sp-7, 28px);
  margin-bottom: var(--sp-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.ac-banner__left {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}

.ac-banner__icon {
  flex: none;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ac-banner__icon svg {
  width: 100%;
  height: 100%;
}

.ac-banner-illus {
  width: 100%;
  height: 100%;
}

.ac-illus-paper {
  fill: var(--surface);
  stroke: var(--brand);
  stroke-width: 3;
}

.ac-illus-clip {
  fill: var(--surface);
  stroke: var(--text);
  stroke-width: 3;
}

.ac-illus-line-dark {
  stroke: var(--text);
  stroke-width: 3;
  stroke-linecap: round;
}

.ac-illus-line-accent {
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linecap: round;
}

.ac-illus-pencil {
  fill: var(--brand-soft);
  stroke: var(--brand-hover);
  stroke-width: 3;
  stroke-linejoin: round;
}

.ac-banner__info {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.ac-banner__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.ac-banner__desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.ac-banner__btn {
  flex: none;
}

/* ----------------------------------------------------------- Type Selector */
.ac-type-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.ac-type-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

/* Custom Select styling alignment */
.ac-custom-select {
  position: relative;
  min-width: 200px;
}

.ac-custom-select .custom-select__trigger {
  min-height: 40px;
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  cursor: pointer;
  width: 100%;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.ac-custom-select .custom-select__trigger:hover,
.ac-custom-select.is-open .custom-select__trigger {
  border-color: var(--brand);
}

.ac-custom-select.is-open .custom-select__trigger {
  box-shadow: var(--focus-ring);
}

.ac-custom-select .custom-select__value {
  font-size: 14px;
  color: var(--text);
}

.ac-custom-select .custom-select__icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform var(--fast) var(--ease);
  flex: none;
}

.ac-custom-select.is-open .custom-select__icon {
  transform: rotate(180deg);
}

.ac-custom-select .custom-select__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  display: none;
  overflow: hidden;
}

.ac-custom-select.is-open .custom-select__dropdown {
  display: block;
}

.ac-custom-select .custom-select__options {
  max-height: 260px;
  overflow-y: auto;
  padding: var(--sp-1) 0;
  list-style: none;
  margin: 0;
}

.ac-custom-select .custom-select__option {
  display: flex;
  align-items: center;
  padding: var(--sp-2) var(--sp-4);
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--fast) var(--ease);
}

.ac-custom-select .custom-select__option:hover {
  background-color: var(--surface-hover);
}

.ac-custom-select .custom-select__option.is-selected {
  background-color: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

/* ------------------------------------------------------------- Asset Table */
.ac-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--sp-10);
  box-shadow: var(--shadow-sm);
}

.ac-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, auto) auto auto;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--fast) var(--ease);
}

.ac-row:last-child {
  border-bottom: 0;
}

.ac-row:hover {
  background: var(--surface-hover);
}

.ac-row__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.ac-row__status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 14px;
  color: var(--text-muted);
}

.ac-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-subtle);
  flex: none;
}

.ac-dot--active {
  background: var(--success);
}

.ac-row__badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 var(--sp-3);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-3);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.ac-row__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  justify-self: end;
}

/* --------------------------------- Other Ways to Organize Your Account */
.ac-other {
  margin-top: var(--sp-12);
}

.ac-other__heading {
  margin: 0 0 var(--sp-5);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.ac-other__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--sp-5);
}

.ac-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.ac-card__body {
  margin-bottom: var(--sp-6);
}

.ac-card__title {
  margin: 0 0 var(--sp-2);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.ac-card__desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.ac-card__btn {
  align-self: flex-start;
}

/* ----------------------------------------------------------- Criteria Page */
.ac-criteria {
  max-width: 1040px;
}

.ac-back {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  cursor: pointer;
}

.ac-back:hover {
  text-decoration: underline;
}

.ac-back svg {
  width: 16px;
  height: 16px;
}

.ac-criteria__head {
  margin-bottom: var(--sp-6);
}

.ac-criteria__title {
  margin: 0 0 var(--sp-2);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.ac-criteria__sub {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-muted);
}

.ac-active-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-6);
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 14px;
  line-height: 1.5;
}

.ac-active-banner strong {
  display: block;
  font-size: 15px;
  color: var(--success);
  margin-bottom: 2px;
}

.ac-active-banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.ac-rules {
  margin-bottom: var(--sp-6);
  font-size: 14px;
  color: var(--text);
}

.ac-rules__intro {
  margin: 0 0 var(--sp-2);
  font-weight: 600;
}

.ac-rules__list {
  margin: 0;
  padding-left: var(--sp-5);
  color: var(--text-muted);
  line-height: 1.6;
}

.ac-period-label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* -------------------------------------------------------- Additional Filters */
.ac-filters {
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-8);
}

.ac-filters__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.ac-filters__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.ac-discard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 8px);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--fast), border-color var(--fast);
}

.ac-discard-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.ac-filters__empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.ac-page .fk-add {
  white-space: nowrap !important;
}

.fk-pick__tbtn {
  white-space: nowrap !important;
  flex-shrink: 0;
}

.fk-pick__tbtn span {
  white-space: nowrap !important;
}

.custom-select-wrapper.is-dropup .custom-select__dropdown {
  top: auto;
  bottom: calc(100% + 4px);
}

.ac-group {
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-3);
}

.ac-filter-error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin-bottom: var(--sp-4);
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius-lg);
  color: var(--danger);
  font-size: 14px;
}

.ac-filter-error-banner__left {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.ac-filter-error-banner .ac-error-icon {
  width: 18px;
  height: 18px;
  color: var(--danger);
  flex-shrink: 0;
}

.ac-error-info-icon {
  font-size: 14px;
  color: var(--danger);
  cursor: help;
  margin-left: 2px;
}

.ac-error-show-me {
  margin-left: var(--sp-3);
  background: none;
  border: 0;
  padding: 0;
  color: var(--teal);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.ac-error-show-me:hover {
  color: var(--brand);
}

.ac-cond--error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--danger);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-2);
  gap: var(--sp-3);
  cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast), box-shadow var(--fast);
}

.ac-cond--error:hover {
  background: var(--danger-bg);
}

@keyframes ac-error-pulse {
  0%, 100% { transform: scale(1); box-shadow: none; }
  50% { transform: scale(1.01); box-shadow: 0 0 0 3px var(--danger); }
}

.ac-cond--error.is-highlighted {
  animation: ac-error-pulse 0.6s ease 2;
}

.ac-cond--error__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.ac-cond--error__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.ac-cond--error__msg {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--danger);
}

.fk-group__add {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  margin-top: var(--sp-2);
}

.fk-and-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.fk-group__tools {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.fk-group__tools .lp-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--fast), color var(--fast);
}

.fk-group__tools .lp-icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.lp-icon-btn--circle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast);
}

.lp-icon-btn--circle:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--text-muted);
}

.ac-cond {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-2);
  padding: 4px 0;
}

.ac-cond .ac-dd-btn {
  flex: 1 1 180px;
  min-width: 140px;
}

.ac-cond .lp-icon-btn--circle,
.ac-cond .fk-pill__x {
  flex: 0 0 36px;
}

/* All field types menu styling */
.fk-pick__menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 100;
  width: 260px;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
}

.fk-pick__menu::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 28px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  border-top: 1px solid var(--border-strong);
  transform: rotate(45deg);
}

.fk-pick__menu--right {
  left: auto;
  right: 0;
}

.fk-pick__menu--right::before {
  left: auto;
  right: 28px;
}

.fk-pick__menu-search {
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.fk-pick__menu-search .fk-search input {
  height: 36px;
  border-radius: var(--radius-pill) !important;
  font-size: 13.5px;
  padding-left: 14px;
  padding-right: 36px;
}

.fk-pick__menu-search .fk-search .lp-i {
  right: 12px;
  width: 16px;
  height: 16px;
}

.fk-pick__menu-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fk-pick__menu .lp-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--fast);
}

.fk-pick__menu .lp-opt:hover {
  background: var(--surface-hover);
}

.fk-pick__menu .lp-opt input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  accent-color: var(--brand);
  cursor: pointer;
}

.fk-pick__menu .lp-opt__txt {
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  user-select: none;
}

/* Multi-select values dropdown popover */
.fk-vlist {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xl);
}

.fk-vlist .lp-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--fast);
}

.fk-vlist .lp-opt:hover {
  background: var(--surface-hover);
}

.fk-vlist .lp-opt.is-checked {
  background: var(--brand-soft);
  color: var(--brand);
}

.fk-vlist .lp-opt input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  accent-color: var(--brand);
  cursor: pointer;
  flex: none;
}

.fk-vlist .lp-opt__txt {
  font-size: 14px;
  font-weight: 400;
  color: inherit;
  user-select: none;
}

.ac-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.ac-group__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.ac-group__acts {
  display: flex;
  gap: var(--sp-1);
}

.ac-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--fast), color var(--fast);
}

.ac-icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.ac-icon-btn svg {
  width: 16px;
  height: 16px;
}

.ac-dd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 var(--sp-3);
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.ac-dd-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-dd-btn svg {
  flex: none;
  width: 15px;
  height: 15px;
}

.ac-dd-btn:hover,
.ac-dd-btn[aria-expanded="true"] {
  border-color: var(--brand);
}

.ac-and-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.ac-and-label {
  font-weight: 600;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
}

.ac-or-divider {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-3) 0 var(--sp-3) var(--sp-6);
  padding: var(--sp-2) 0;
}

.ac-or-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 1px;
  background: var(--border-strong);
}

.ac-or-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 30px;
  padding: 0 var(--sp-2);
  font-size: 13.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
}

/* ------------------------------------------------------------- Criteria Table */
.ac-preview {
  margin-top: var(--sp-8);
}

.ac-preview__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}

.ac-preview__count {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.ac-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 320px;
  max-width: 100%;
}

.ac-search-box input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 var(--sp-3);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.ac-search-box input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

.ac-search-box svg {
  position: absolute;
  right: var(--sp-3);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.ac-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin-bottom: var(--sp-6);
}

.ac-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.ac-data-table th {
  padding: var(--sp-3) var(--sp-5);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.ac-data-table td {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.ac-data-table tr:last-child td {
  border-bottom: 0;
}

.ac-data-table tr:hover td {
  background: var(--surface-hover);
}

.ac-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.ac-link:hover {
  text-decoration: underline;
}

.ac-link svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.ac-empty-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: var(--sp-8) var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.ac-empty-box svg,
.ac-empty-illus {
  display: block;
  width: 120px;
  height: 96px;
  margin: 0 auto;
}

/* ------------------------------------------------------ Sticky / Action Footer */
.ac-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
}

/* ----------------------------------------------------------------- Filing Tab */
.ac-filing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ac-filing-header {
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.ac-filing-row {
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--fast);
}

.ac-filing-row:last-child {
  border-bottom: 0;
}

.ac-filing-row:hover {
  background: var(--surface-hover);
}

.ac-filing-header > :last-child,
.ac-filing-row > :last-child {
  display: flex;
  justify-content: flex-end;
}

.ac-filing-row__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.ac-unfiled-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 var(--sp-3);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm, 8px);
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.ac-analyze-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 var(--sp-4);
  background: var(--brand);
  color: var(--brand-contrast);
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm, 8px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--fast), border-color var(--fast);
  text-decoration: none;
  white-space: nowrap;
}

.ac-analyze-btn:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.ac-organize-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 var(--sp-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm, 8px);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--fast), border-color var(--fast);
  text-decoration: none;
  white-space: nowrap;
}

.ac-organize-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

/* ---------------------------------------------------- Filing Agent Side Drawer */
.ac-drawer {
  width: min(720px, 100vw) !important;
  max-width: 100vw !important;
  display: flex;
  flex-direction: column;
}

.ac-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
}

.ac-drawer__title-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.ac-drawer__title-wrap svg {
  color: var(--brand);
  width: 20px;
  height: 20px;
}

.ac-drawer__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.ac-drawer__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-6);
}

.ac-drawer__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 340px;
  gap: var(--sp-4);
  color: var(--text);
}

.ac-drawer__sparkle-icon {
  width: 44px;
  height: 44px;
  color: var(--brand);
  animation: acPulse 1.6s ease-in-out infinite;
}

@keyframes acPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}

.ac-drawer__loading-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.ac-drawer__loading-desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.ac-drawer__summary {
  margin: 0 0 var(--sp-5);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}

/* Drawer Accordion & Table */
.ac-folder-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.ac-folder-table__head {
  display: grid;
  grid-template-columns: 36px 1fr 110px 80px;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.ac-folder-group {
  border-bottom: 1px solid var(--border);
}

.ac-folder-group:last-child {
  border-bottom: 0;
}

.ac-folder-row {
  display: grid;
  grid-template-columns: 36px 1fr 110px 80px;
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  cursor: pointer;
  transition: background-color var(--fast);
}

.ac-folder-row:hover {
  background: var(--surface-hover);
}

.ac-folder-title-col {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.ac-caret {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform var(--fast);
  flex: none;
}

.ac-caret.is-open {
  transform: rotate(90deg);
}

.ac-folder-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex: none;
}

.ac-folder-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-folder-rename-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.ac-folder-rename-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}

.ac-folder-rename-btn svg {
  width: 14px;
  height: 14px;
}

.ac-badge-folder {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: 12.5px;
  font-weight: 500;
}

.ac-badge-folder--new {
  color: var(--success);
}

.ac-badge-folder--existing {
  color: var(--text-muted);
}

.ac-badge-folder__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.ac-badge-folder--new .ac-badge-folder__dot {
  background: var(--success);
}

.ac-badge-folder--existing .ac-badge-folder__dot {
  background: var(--text-subtle);
}

.ac-folder-count {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: right;
}

/* Nested Items */
.ac-nested-wrap {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-4) var(--sp-3) var(--sp-12);
}

.ac-nested-head {
  display: grid;
  grid-template-columns: 32px 1fr 160px;
  padding: var(--sp-2) var(--sp-3);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.ac-nested-row {
  display: grid;
  grid-template-columns: 32px 1fr 160px;
  align-items: center;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-top: var(--sp-1);
}

.ac-nested-row:hover {
  background: var(--surface-hover);
}

.ac-nested-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-reassign-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-1);
  height: 32px;
  padding: 0 var(--sp-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.ac-reassign-btn:hover {
  border-color: var(--brand);
}

.ac-reassign-btn svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.ac-drawer__foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ------------------------------------------------------------- Edit Values Modal */
.ac-edit-values-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.ac-textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  resize: none;
}

.ac-textarea:focus {
  outline: none;
  border-color: var(--brand);
}

.ac-values-preview {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Dropdown popups inside modals & triggers */
.ac-pop-dropdown {
  position: static;
  display: block;
  border: 0;
  box-shadow: none;
  width: 100%;
}

.ac-pop-options {
  max-height: 260px;
}

.ac-pop-options--sm {
  max-height: 220px;
}

/* ----------------------------------------------------------- Responsive Styles */
@media (max-width: 1024px) {
  .ac-other__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .ac-page {
    padding: var(--sp-4) var(--sp-4) var(--sp-12);
  }

  .ac-banner {
    flex-direction: column;
    align-items: stretch;
    padding: var(--sp-5);
  }

  .ac-banner__left {
    align-items: flex-start;
  }

  .ac-banner__btn {
    width: 100%;
  }

  .ac-type-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .ac-custom-select {
    width: 100%;
  }

  .ac-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: var(--sp-2) var(--sp-3);
  }

  .ac-row__name {
    grid-column: 1;
    grid-row: 1;
  }

  .ac-row__actions {
    grid-column: 2;
    grid-row: 1;
  }

  .ac-row__status {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .ac-other__grid {
    grid-template-columns: 1fr;
  }

  .ac-cond .ac-dd-btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .ac-preview__header {
    flex-direction: column;
    align-items: stretch;
  }

  .ac-search-box {
    width: 100%;
  }

  .ac-foot {
    flex-direction: column;
  }

  .ac-foot button,
  .ac-foot a {
    width: 100%;
  }

  .ac-nested-wrap {
    padding-left: var(--sp-4);
  }

  .ac-folder-table__head,
  .ac-folder-row {
    grid-template-columns: 32px 1fr auto;
  }

  .ac-folder-table__head > :nth-child(3),
  .ac-folder-row > :nth-child(3) {
    display: none;
  }

  .ac-nested-head,
  .ac-nested-row {
    grid-template-columns: 30px 1fr auto;
  }

  .ac-filing-header {
    display: none;
  }

  .ac-filing-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    row-gap: var(--sp-3);
  }

  .ac-filing-row__name {
    grid-column: 1;
    grid-row: 1;
  }

  .ac-filing-row > :nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .ac-filing-row > :nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .ac-analyze-btn,
  .ac-organize-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .ac-nested-row {
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto;
    row-gap: var(--sp-2);
  }

  .ac-nested-head {
    grid-template-columns: 28px 1fr;
  }

  .ac-nested-head > :last-child {
    display: none;
  }

  .ac-reassign-btn {
    grid-column: 2;
    justify-self: start;
    width: 100%;
  }

  .ac-folder-row__left {
    gap: var(--sp-2);
  }

  .ac-folder-title {
    font-size: 13.5px;
  }
}

/* Filing: nothing unfiled (Settings audit). */
.ac-analyze-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
