/* ==========================================================================
   Version A — services.css (F3)
   Styles for "My services" configuration dialog (Strict token adherence)
   ========================================================================== */

.dialog--services {
  --dialog-w: 600px;
}

.services-mgr {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.services-mgr__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.services-mgr__note {
  margin: 0;
  font-size: var(--fs-14);
  color: var(--text-2);
  line-height: 1.5;
}

.services-mgr__note strong {
  color: var(--text-1);
}

.services-mgr__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.services-mgr__search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.services-mgr__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input.services-mgr__search,
.services-mgr__search {
  padding-left: 32px;
  width: 100%;
}

.services-mgr__presets {
  display: flex;
  gap: var(--space-2);
}

.services-mgr__body {
  max-height: 380px;
  overflow-y: auto;
  padding-right: var(--space-1);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.services-mgr__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.services-mgr__heading {
  margin: 0;
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  font-weight: var(--fw-semibold);
  color: var(--text-3);
}

.services-mgr__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--space-2);
}

.services-mgr__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.services-mgr__item:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.services-mgr__item.is-selected {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.services-mgr__checkbox {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.services-mgr__checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.services-mgr__checkbox:checked::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid var(--on-accent);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.services-mgr__checkbox:focus-visible {
  box-shadow: var(--focus-ring);
}

.services-mgr__name {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--text-1);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.services-mgr__count {
  font-size: var(--fs-12);
  color: var(--text-3);
  flex-shrink: 0;
}

.services-mgr__empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-2);
  font-size: var(--fs-14);
}

@media (prefers-reduced-motion: reduce) {
  .services-mgr__item {
    transition: none;
  }
}

@media (max-width: 899px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  [data-dialog-close],
  button[data-dialog-close],
  .dialog__close,
  .sheet__close {
    width: var(--hit, 44px) !important;
    height: var(--hit, 44px) !important;
    min-width: var(--hit, 44px) !important;
    min-height: var(--hit, 44px) !important;
  }

  .services-mgr__search-wrap .services-mgr__search,
  .input.services-mgr__search {
    font-size: var(--fs-16, 16px) !important;
    min-height: var(--hit, 44px);
  }

  .services-mgr__presets .btn {
    min-height: var(--hit, 44px);
  }

  .services-mgr__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .services-mgr__item {
    min-height: var(--hit, 44px);
    box-sizing: border-box;
  }

  .services-mgr__checkbox {
    width: 20px;
    height: 20px;
  }

  .dialog--services .dialog__actions .btn,
  .sheet--services .sheet__actions .btn,
  .dialog--services footer .btn {
    min-height: var(--hit, 44px);
  }
}

@media (max-width: 399px) {
  .services-mgr__grid {
    grid-template-columns: 1fr;
  }
}
