/* Розділ «Користувачі» — стандарт /Users/Shared/fregat-ui-kit/users-admin/README.md (Артьом 19.11.2026; еталон — Атлас).
   Розмітка — js/views/users.js. Числа — табличні цифри Inter. Темна тема — html.dark. */

/* ── Шапка: назва + «N користувачів», праворуч головна кнопка ── */
.ua-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.ua-head-t { min-width: 0; }
.ua-add { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 12px; background: #7c3aed; color: #fff;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 16px -8px rgba(124, 58, 237, .7); transition: background .15s ease; }
.ua-add svg { width: 18px; height: 18px; }
.ua-add[hidden] { display: none; }
@media (hover: hover) { .ua-add:hover { background: #6d28d9; } }
.ua-add:focus-visible { outline: 2px solid #a855f7; outline-offset: 2px; }
.ua-tabs { margin-bottom: 16px; }

/* ── Рядок фільтрів: пошук · Роль · Сортувати · праворуч Картки/Список і лічильник ── */
.ua-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.ua-search { position: relative; display: block; width: 288px; max-width: 100%; }
.ua-search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: #9ca3af; pointer-events: none; }
.ua-f { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #6b7280; white-space: nowrap; }
html.dark .ua-f { color: #9ca3af; }
.ua-filters :is(input, select), .ua-jbar select { box-sizing: border-box; height: 40px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; color: #111827; font: inherit; font-size: 14px; }
.ua-filters input { width: 100%; padding: 0 12px 0 36px; }
.ua-filters select, .ua-jbar select { padding: 0 32px 0 12px; }
html.dark .ua-filters :is(input, select), html.dark .ua-jbar select { background: #1f2937; border-color: #374151; color: #f3f4f6; }
.ua-filters :is(input, select):focus, .ua-jbar select:focus { outline: none; border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168, 85, 247, .18); }
.ua-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ua-sw { box-sizing: border-box; display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 3px; border-radius: 12px;   /* на плитці з header-actions (поправка 19.11: доріжка на тлі сторінки — 4,46) */
  background: rgba(255, 255, 255, .7); border: 1px solid #f3e8ff; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
html.dark .ua-sw { background: rgba(31, 41, 55, .7); border-color: rgba(107, 33, 168, .5); }
.ua-sw button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #6b7280; cursor: pointer; transition: background .15s ease, color .15s ease; }
html.dark .ua-sw button { color: #9ca3af; }
.ua-sw button svg { width: 18px; height: 18px; }
.ua-sw button.is-on { background: #f3e8ff; color: #7e22ce; }
html.dark .ua-sw button.is-on { background: rgba(107, 33, 168, .4); color: #e9d5ff; }
.ua-total { font-size: 14px; color: #6b7280; font-variant-numeric: tabular-nums; white-space: nowrap; }
html.dark .ua-total { color: #9ca3af; }

/* ── Картки: 4 в ряд від 1280 px, 3 — від 1024, 2 — від 640, 1 — на телефоні ── */
.ua-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .ua-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .ua-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .ua-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ua-grid > .ts-empty, .ua-list > .ts-empty { grid-column: 1 / -1; }
.ua-card, .ua-row { min-width: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); transition: border-color .15s ease, box-shadow .15s ease; }
.ua-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
html.dark .ua-card, html.dark .ua-row { background: #1f2937; border-color: #374151; }
@media (hover: hover) {
  .ua-card:hover, .ua-row:hover { border-color: #d8b4fe; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1); }
  html.dark .ua-card:hover, html.dark .ua-row:hover { border-color: #7e22ce; }
}
/* деактивована: гаситься ВМІСТ, а рядок «Деактивовано» лишається чітким (поправка 19.11, розрахунок Академії) */
.ua-card.is-off > :not(.ua-off), .ua-row.is-off > :not(.ua-row-r), .ua-row.is-off .ua-row-r > :not(.ua-off) { opacity: .6; }
.ua-top { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.ua-av { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #f3e8ff; font-size: 20px; line-height: 1; }
html.dark .ua-av { background: rgba(88, 28, 135, .4); }
.ua-av-ini { font-size: 18px; font-weight: 700; color: #7e22ce; }
html.dark .ua-av-ini { color: #d8b4fe; }
.ua-av-s { width: 32px; height: 32px; border-radius: 8px; font-size: 16px; }
.ua-av-s.ua-av-ini { font-size: 13px; }
.ua-who { flex: 1 1 auto; min-width: 0; }
.ua-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ua-name b, .ua-row-m b { font-size: 14px; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.dark .ua-name b, html.dark .ua-row-m b { color: #fff; }
.ua-me { flex: none; font-style: normal; font-size: 10px; font-weight: 500; line-height: 1.5; padding: 0 6px; border-radius: 4px; background: #f3f4f6; color: #6b7280; }
html.dark .ua-me { background: #374151; color: #d1d5db; }
.ua-login { display: block; font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* #9ca3af на білому — 2,54 */
html.dark .ua-login { color: #9ca3af; }
.ua-pos { display: block; font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.dark .ua-pos { color: #9ca3af; }

/* ряд міток: роль словами (12 px / 500, поле 2 × 8, радіус 4) і праворуч «Редагувати» / «Видалити» */
.ua-marks { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ua-role { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; line-height: 1.4; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.ua-role[data-r="superadmin"] { background: #f3e8ff; color: #7e22ce; }
.ua-role[data-r="admin"] { background: #dbeafe; color: #1d4ed8; }
.ua-role[data-r="manager"] { background: #d1fae5; color: #047857; }
.ua-role[data-r="support"] { background: #ccfbf1; color: #0f766e; }          /* техпідтримка — своя роль Tariscope */
html.dark .ua-role[data-r="superadmin"] { background: rgba(88, 28, 135, .4); color: #d8b4fe; }
html.dark .ua-role[data-r="admin"] { background: rgba(30, 58, 138, .4); color: #93c5fd; }
html.dark .ua-role[data-r="manager"] { background: rgba(6, 78, 59, .4); color: #6ee7b7; }
html.dark .ua-role[data-r="support"] { background: rgba(19, 78, 74, .4); color: #5eead4; }
.ua-acts { margin-left: auto; display: inline-flex; gap: 2px; flex: none; }
.ua-ib { width: 26px; height: 26px; padding: 6px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #9ca3af; cursor: pointer; transition: background .15s ease, color .15s ease; }
.ua-ib svg { width: 14px; height: 14px; }
@media (hover: hover) {
  .ua-ib:hover { background: #f3f4f6; color: #4b5563; }
  html.dark .ua-ib:hover { background: #374151; color: #e5e7eb; }
  .ua-ib-del:hover, html.dark .ua-ib-del:hover { background: #fef2f2; color: #ef4444; }
  html.dark .ua-ib-del:hover { background: rgba(127, 29, 29, .2); }
}
.ua-ib:focus-visible { outline: 2px solid #a855f7; outline-offset: 1px; }
.ua-off { font-size: 12px; font-weight: 600; color: #b91c1c; white-space: nowrap; }
html.dark .ua-off { color: #f87171; }

/* розділи людини — назвами з меню (10 px, поле 2 × 6, радіус 4, зелені) */
.ua-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ua-chip { font-size: 10px; line-height: 1.5; padding: 1px 6px; border-radius: 4px; background: #ecfdf5; color: #047857; border: 1px solid #d1fae5; white-space: nowrap; }
html.dark .ua-chip { background: rgba(6, 78, 59, .2); color: #6ee7b7; border-color: rgba(6, 95, 70, .3); }
.ua-chip-more { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; cursor: default; }
html.dark .ua-chip-more { background: rgba(55, 65, 81, .6); color: #d1d5db; border-color: #4b5563; }
.ua-chip-none { background: transparent; color: #9ca3af; border: 1px dashed #d1d5db; }
html.dark .ua-chip-none { background: transparent; color: #6b7280; border-color: #4b5563; }

/* низ: «Додано» й давність світлофором */
.ua-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; font-size: 10px; color: #6b7280; font-variant-numeric: tabular-nums; }
.ua-life { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: #6b7280; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: default; }
html.dark .ua-foot, html.dark .ua-life { color: #9ca3af; }
.ua-life i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; }
.ua-life[data-l="today"] i { background: #10b981; }
.ua-life[data-l="week"] i { background: #a3e635; }
.ua-life[data-l="month"] i { background: #fbbf24; }
.ua-life[data-l="old"] i { background: #ef4444; }
.ua-life[data-l="old"] { color: #b91c1c; }
html.dark .ua-life[data-l="old"] { color: #f87171; }

/* ── Список: той самий зміст одним рядком ── */
.ua-list { display: grid; gap: 4px; }
.ua-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.ua-row-m { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; overflow: hidden; }
.ua-row-m .ua-login, .ua-row-m .ua-pos { display: inline; overflow: hidden; text-overflow: ellipsis; }
.ua-row-r { flex: none; display: flex; align-items: center; gap: 10px; }
.ua-row .ua-acts { margin-left: 0; }
.ua-sm, .ua-md { display: none !important; }
@media (min-width: 640px) { .ua-sm { display: inline !important; } }
@media (min-width: 768px) { .ua-md { display: inline-flex !important; } }

/* на телефоні вікно — на всю ширину з відступом 16 */
.tsm:has(> .ua-win) { padding: 16px !important; }

/* ── Вікно людини: оболонка — спільна (ts-ui.js: радіус 20, ✕, Esc, клік повз); ширина до 448, поле 24, до 90 % висоти ── */
.ua-win { box-sizing: border-box; width: 100%; max-width: 448px; max-height: 90vh; overflow-y: auto; overscroll-behavior: contain; padding: 24px; background: #fff; }
html.dark .ua-win { background: #1f2937; }
.ua-win h3 { margin: 0 0 16px; font-size: 20px; font-weight: 800; color: #111827; }
html.dark .ua-win h3 { color: #f9fafb; }
#ua-form { display: grid; gap: 14px; }
.ua-fld { display: grid; gap: 6px; min-width: 0; }
.ua-lbl { font-size: 13px; font-weight: 500; color: #374151; }
html.dark .ua-lbl { color: #d1d5db; }
.ua-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ua-win input:not([type="checkbox"]), .ua-win select { box-sizing: border-box; width: 100%; height: 40px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; color: #111827; font: inherit; font-size: 14px; }
html.dark .ua-win input:not([type="checkbox"]), html.dark .ua-win select { background: #111827; border-color: #4b5563; color: #f3f4f6; }
.ua-win input:not([type="checkbox"]):focus, .ua-win select:focus { outline: none; border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168, 85, 247, .2); }
.ua-win input:disabled { opacity: .5; cursor: not-allowed; }
.ua-emos { display: flex; flex-wrap: wrap; gap: 6px; max-height: 168px; overflow-y: auto; padding: 2px; }
.ua-emo { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: #f3f4f6; font-size: 19px; line-height: 1; cursor: pointer; transition: transform .12s ease; }
html.dark .ua-emo { background: rgba(55, 65, 81, .6); }
.ua-emo.is-on { box-shadow: 0 0 0 2px #a855f7; }
@media (hover: hover) { .ua-emo:hover { transform: scale(1.08); } }

/* «Доступ до модулів»: сітка галок будується з меню. Фірмові фіолетові в обох темах (Артьом 19.11: «в корпоративных цветах гайдбука»;
   у темній — «галки не зеленые а фиолетовые с подсветкой… чтобы в общем стиле были») */
.ua-perms { display: grid; gap: 10px; padding: 16px; border-radius: 12px; background: #f5f3ff; border: 1px solid #ddd6fe; }
html.dark .ua-perms { background: rgba(46, 16, 101, .3); border-color: rgba(109, 40, 217, .45); }
.ua-perms-t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6d28d9; }
html.dark .ua-perms-t { color: #c4b5fd; }
.ua-perms-l { font-size: 12px; font-weight: 500; color: #4b5563; }
html.dark .ua-perms-l { color: #9ca3af; }
.ua-note { margin: 0; padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; }
html.dark .ua-note { color: #fcd34d; background: rgba(120, 53, 15, .25); border-color: rgba(180, 83, 9, .4); }
.ua-mods { display: grid; gap: 8px; }
.ua-mod { padding: 10px; border-radius: 8px; border: 1px solid rgba(221, 214, 254, .6); background: rgba(255, 255, 255, .55); }   /* межа — у тон блоку */
html.dark .ua-mod { border-color: rgba(109, 40, 217, .3); background: rgba(17, 24, 39, .25); }
.ua-mod-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: #1f2937; cursor: pointer; }
html.dark .ua-mod-h { color: #f3f4f6; }
.ua-mod-items { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding-left: 24px; }
.ua-item { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.35; color: #4b5563; cursor: pointer; }
html.dark .ua-item { color: #d1d5db; }
.ua-solo { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 14px; font-weight: 500; color: #374151; cursor: pointer; }
html.dark .ua-solo { color: #e5e7eb; }
.ua-win input[type="checkbox"] { flex: none; margin: 0; cursor: pointer; }
/* галки розділів: #7c3aed · #8b5cf6 (стандарт); спільне правило вікон важить більше (там #main-content) — тому !important */
.ua-win :is(.ua-perm, .ua-master), .ua-perms input[type="checkbox"] { accent-color: #7c3aed !important; }
html.dark .ua-win :is(.ua-perm, .ua-master), html.dark .ua-perms input[type="checkbox"] { accent-color: #8b5cf6 !important; }
/* у темній відмічена галка світиться (Артьом 19.11: «фиолетовые с подсветкой… чтобы в общем стиле были») */
html.dark .ua-perms input[type="checkbox"]:checked { border-radius: 3px; box-shadow: 0 0 0 3px rgba(139, 92, 246, .3), 0 0 10px rgba(139, 92, 246, .55); }
/* наведення на підпис галки — #7c3aed · #c4b5fd */
@media (hover: hover) {
  .ua-perms label:hover > span, .ua-perms .ua-sp:hover b { color: #7c3aed; }
  html.dark .ua-perms label:hover > span, html.dark .ua-perms .ua-sp:hover b { color: #c4b5fd; }
}
.ua-win input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .55; }
.ua-win input[type="checkbox"]:disabled + span { opacity: .55; }
.ua-cb16 { width: 16px; height: 16px; }
.ua-cb14 { width: 14px; height: 14px; margin-top: 1px !important; }
.ua-sa { font-size: 10px; font-weight: 400; color: #6d28d9; white-space: nowrap; }   /* #8b5cf6 — 4,02 */
html.dark .ua-sa { color: #c4b5fd; }
.ua-sg { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid rgba(221, 214, 254, .6); }   /* розділювач — #ddd6fe на 60 % */
html.dark .ua-sg { border-top-color: rgba(109, 40, 217, .3); }
.ua-sg-t { font-size: 12px; font-weight: 500; color: #374151; }
html.dark .ua-sg-t { color: #d1d5db; }
.ua-sp { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.ua-sp input { margin-top: 2px !important; }
.ua-sp b { display: block; font-size: 13px; font-weight: 500; color: #1f2937; }
html.dark .ua-sp b { color: #f3f4f6; }
.ua-sp small { display: block; margin-top: 2px; font-size: 10px; line-height: 1.4; color: #6b7280; }
html.dark .ua-sp small { color: #9ca3af; }
.ua-active { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: #1f2937; cursor: pointer; }
html.dark .ua-active { color: #f3f4f6; }
.ua-win .ua-active input { accent-color: #9333ea !important; }
.ua-hint { margin: -8px 0 0; font-size: 11px; line-height: 1.4; color: #6b7280; }
html.dark .ua-hint { color: #9ca3af; }
.ua-err { margin: 0; font-size: 14px; color: #dc2626; }
html.dark .ua-err { color: #f87171; }
.ua-err[hidden] { display: none; }
/* кнопки — завжди під рукою внизу вікна */
.ua-btns { position: sticky; bottom: -24px; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 0 -24px -24px; padding: 12px 24px 24px;
  background: linear-gradient(to top, #fff 78%, rgba(255, 255, 255, 0)); }
html.dark .ua-btns { background: linear-gradient(to top, #1f2937 78%, rgba(31, 41, 55, 0)); }
.ua-cancel, .ua-save { height: 40px; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ua-cancel { border: 1px solid #d1d5db; background: #fff; color: #374151; }
html.dark .ua-cancel { border-color: #4b5563; background: #374151; color: #e5e7eb; }
.ua-save { border: 0; background: #7c3aed; color: #fff; box-shadow: 0 6px 16px -8px rgba(124, 58, 237, .7); }
.ua-save:disabled { opacity: .6; cursor: progress; }
@media (hover: hover) { .ua-save:not(:disabled):hover { background: #6d28d9; } .ua-cancel:hover { background: #f9fafb; } html.dark .ua-cancel:hover { background: #4b5563; } }

/* ── Журнал активності ── */
.ua-jbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.ua-jsec { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #374151; cursor: pointer; }
html.dark .ua-jsec { color: #d1d5db; }
.ua-jsec input { accent-color: #9333ea; }
.ua-jcard { border-radius: 12px; background: #fff; border: 1px solid #e5e7eb; overflow: hidden; }
html.dark .ua-jcard { background: #1f2937; border-color: #374151; }
.ua-jscroll { overflow-x: auto; }
.ua-jt { width: 100%; border-collapse: collapse; font-size: 14px; }
.ua-jt th { padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: #6b7280; background: #f9fafb; white-space: nowrap; }
html.dark .ua-jt th { color: #9ca3af; background: rgba(17, 24, 39, .3); }
.ua-jt td { padding: 10px 14px; border-top: 1px solid #f3f4f6; color: #1f2937; vertical-align: top; }
html.dark .ua-jt td { border-top-color: #374151; color: #e5e7eb; }
.ua-jtime { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ua-jdet { min-width: 220px; font-size: 12px; color: #6b7280 !important; }
html.dark .ua-jdet { color: #9ca3af !important; }
.ua-jt tr.is-warn td { background: rgba(254, 242, 242, .7); }
html.dark .ua-jt tr.is-warn td { background: rgba(127, 29, 29, .15); }
.ua-jmsg { padding: 24px 14px !important; text-align: center; color: #9ca3af !important; }

/* ── Телефон: картки в стовпець, фільтри переносяться ── */
@media (max-width: 640px) {
  .ua-search { width: 100%; }
  .ua-f { flex: 1 1 auto; } .ua-f select { flex: 1 1 auto; min-width: 0; }
  .ua-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .ua-add { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) { .ua-card, .ua-row, .ua-emo, .ua-ib { transition: none; } }
html.fx-off .ua-card, html.fx-off .ua-row, html.fx-off .ua-emo { transition: none; }
