/* ============================================================
   УКСИВТ.ID — компонентный слой поверх Remos.
   Стилизует прикладные классы (таблицы, бейджи, формы,
   детали) под дизайн-токены Remos (--Main, Inter, radius 12).
   Подключается ПОСЛЕ css/style.css Remos.
   ============================================================ */

:root {
    --hd-main:    #2275fc;
    --hd-title:   #111111;
    --hd-body:    #575864;
    --hd-muted:   #858B93;
    --hd-border:  #ECF0F4;
    --hd-bg:      #f6f8fb;
    --hd-white:   #ffffff;
    --hd-divider: #f1f5f9;
    --hd-radius:  12px;

    --hd-green:  #15803d; --hd-green-bg:  #dcfce7;
    --hd-blue:   #1d4ed8; --hd-blue-bg:   #e0edff;
    --hd-yellow: #b45309; --hd-yellow-bg: #fef3c7;
    --hd-orange: #c2410c; --hd-orange-bg: #ffedd5;
    --hd-red:    #b91c1c; --hd-red-bg:    #fee2e2;
    --hd-purple: #6d28d9; --hd-purple-bg: #ede9fe;
    --hd-gray:   #475569; --hd-gray-bg:   #f1f5f9;
}

/* ── Заголовок страницы ── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 22px;
}
.page-header h1, .page-header h5 { margin: 0; font-size: 20px; color: var(--hd-title); font-weight: 700; }

/* ── Бейджи ── */
.hd-badge {
    display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 20px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
    font-family: "Inter", sans-serif;
}
.hd-badge-blue   { background: var(--hd-blue-bg);   color: var(--hd-blue); }
.hd-badge-green  { background: var(--hd-green-bg);  color: var(--hd-green); }
.hd-badge-yellow { background: var(--hd-yellow-bg); color: var(--hd-yellow); }
.hd-badge-orange { background: var(--hd-orange-bg); color: var(--hd-orange); }
.hd-badge-red    { background: var(--hd-red-bg);    color: var(--hd-red); }
.hd-badge-purple { background: var(--hd-purple-bg); color: var(--hd-purple); }
.hd-badge-gray   { background: var(--hd-gray-bg);   color: var(--hd-gray); }

/* ── Иконочные кнопки (действия в строках) ── */
.row-actions { display: inline-flex; gap: 6px; align-items: center; }
.ref-icon-btn {
    width: 34px; height: 34px; border-radius: 9px; border: 1px solid;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
    box-sizing: border-box; background: none; font-size: 15px; text-decoration: none !important;
    transition: all .2s ease;
}
.ref-btn-save { background: #eff6ff; border-color: #bfdbfe; color: #2563eb; }
.ref-btn-save:hover { background: #2563eb; color: #fff; }
.ref-btn-del  { background: #fff1f2; border-color: #fecdd3; color: #e11d48; }
.ref-btn-del:hover { background: #e11d48; color: #fff; }

/* ── Фильтры ── */
.hd-filters {
    display: flex; gap: 10px; align-items: stretch; flex-wrap: nowrap;
    overflow-x: auto; margin-bottom: 22px;
}

/* ── Таблицы ── */
.hd-table-wrap { border: 1px solid var(--hd-border); border-radius: var(--hd-radius); overflow: hidden; }
.my-table, .info-table {
    table-layout: auto; width: 100%; border-collapse: separate; border-spacing: 0; border: none !important;
    background: var(--hd-white); margin: 0; font-family: "Inter", sans-serif;
}
.my-table th, .my-table td, .info-table th, .info-table td {
    padding: 13px 16px; vertical-align: middle; text-align: left;
    border-bottom: 1px solid var(--hd-border) !important;
    border-top: none !important; border-left: none !important; border-right: none !important;
    color: var(--hd-body); font-size: 14px;
}
.my-table thead th, .info-table thead th {
    background: var(--hd-bg); color: var(--hd-title); font-size: 12px; font-weight: 700;
    letter-spacing: .02em; border-bottom: 1px solid var(--hd-border) !important;
}
.my-table tbody tr:hover td { background: #f9fbfd; }
.my-table tbody tr:last-child td, .info-table tbody tr:last-child td { border-bottom: none !important; }
.my-table td .cell-title { font-weight: 600; color: var(--hd-title); }
.my-table td .cell-sub { font-size: 12px; color: var(--hd-muted); margin-top: 2px; }

/* ── info-row (детали) ── */
.info-row { display: flex; gap: 12px; margin-bottom: 13px; align-items: flex-start; }
.info-row:last-child { margin-bottom: 0; }
.info-label { color: var(--hd-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; min-width: 190px; padding-top: 2px; flex-shrink: 0; }
.info-value { font-size: 14px; color: var(--hd-title); word-break: break-word; }

/* ── Формы ── */
.tf-field { display: block; margin-bottom: 16px; }
.tf-label {
    display: block; font-size: 13px; font-weight: 700; color: var(--hd-title);
    margin-bottom: 8px; font-family: "Inter", sans-serif;
}
.tf-input, .tf-select {
    width: 100%; box-sizing: border-box; padding: 0 16px; height: 50px;
    border: 1px solid var(--hd-border); border-radius: var(--hd-radius); background: var(--hd-white);
    font-size: 14px; color: var(--hd-title); outline: none; font-family: "Inter", sans-serif;
    transition: border-color .2s, box-shadow .2s;
}
textarea.tf-input { height: auto; min-height: 110px; padding: 12px 16px; resize: vertical; }
.tf-input:focus, .tf-select:focus { border-color: var(--hd-main); box-shadow: 0 0 0 3px rgba(34,117,252,.12); }
.tf-input::placeholder { color: var(--hd-muted); }

.tf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tf-chip input { position: absolute; opacity: 0; pointer-events: none; }
.tf-chip span {
    display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 20px;
    border: 1px solid var(--hd-border); background: var(--hd-white); color: var(--hd-body);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s; user-select: none;
}
.tf-chip span:hover { border-color: var(--hd-main); }
.tf-chip input:checked + span { background: var(--hd-main); border-color: var(--hd-main); color: #fff; }
.tf-switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--hd-body); cursor: pointer; }
.tf-switch input { width: 18px; height: 18px; accent-color: var(--hd-main); }

/* ── Двухколоночный layout ── */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }

/* ── Пагинация ── */
.hd-pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 20px; }
.hd-pagination a, .hd-pagination > span {
    min-width: 38px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--hd-border);
    background: var(--hd-white); color: var(--hd-body); display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; text-decoration: none;
}
.hd-pagination a:hover { background: var(--hd-main); border-color: var(--hd-main); color: #fff; }
.hd-pagination .active span { background: var(--hd-main); border-color: var(--hd-main); color: #fff; }
.hd-pagination .disabled span { opacity: .45; }
.hd-meta { color: var(--hd-muted); font-size: 13px; margin-top: 12px; }
.hd-empty { text-align: center; padding: 44px 20px; color: var(--hd-muted); }

/* ── Карточки-ссылки дашборда ── */
.hd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.hd-card { display: flex; flex-direction: column; gap: 6px; transition: box-shadow .2s, transform .2s; text-decoration: none !important; }
.hd-card:hover { box-shadow: 0 10px 28px rgba(17,17,17,.08); transform: translateY(-2px); }
.hd-card-icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 6px; }
.hd-card-title { font-weight: 700; color: var(--hd-title); font-size: 16px; }
.hd-card-sub { color: var(--hd-muted); font-size: 13px; }

/* ── Утилиты (дополняют Remos) ── */
.gap6{gap:6px}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap16{gap:16px}
.flex-col{display:flex;flex-direction:column}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.small { font-size: 12.5px; }
.text-muted { color: var(--hd-muted) !important; }
.status-ok { color: var(--hd-green); }
.status-no { color: var(--hd-muted); }
.mt-8{margin-top:8px}.mt-10{margin-top:10px}.mt-16{margin-top:16px}.mt-20{margin-top:20px}.mt-24{margin-top:24px}
.mb-8{margin-bottom:8px}.mb-10{margin-bottom:10px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-20{margin-bottom:20px}.mb-24{margin-bottom:24px}

.hd-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 18px; }

/* ── Адаптив ── */
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    .page-header { flex-direction: column !important; align-items: stretch !important; }
    .page-header > div { flex-direction: column !important; gap: 8px !important; display: flex; }
    .page-header .tf-button { width: 100% !important; }

    .hd-filters { flex-direction: column !important; flex-wrap: wrap !important; overflow-x: visible !important; }
    .hd-filters > * { width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
    .hd-filters .tf-button, .hd-filters a { width: 100% !important; text-align: center; }

    .info-label { min-width: 130px; }

    .my-table, .my-table tbody { display: block !important; }
    .my-table thead { display: none !important; }
    .my-table tbody tr {
        display: block !important; border: 1px solid var(--hd-border); border-radius: var(--hd-radius);
        margin-bottom: 10px; padding: 12px; background: var(--hd-white);
    }
    .my-table tbody tr:hover td { background: transparent; }
    .my-table tbody td {
        display: flex !important; align-items: center; gap: 8px;
        border: none !important; padding: 4px 0 !important; font-size: 13px; width: 100%; box-sizing: border-box;
    }
    .my-table tbody td::before {
        content: attr(data-label); font-size: 11px; font-weight: 700; color: var(--hd-muted);
        text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; flex: 0 0 96px;
    }
    .my-table tbody td[data-label="Наименование"],
    .my-table tbody td[data-label="Пользователь"],
    .my-table tbody td[data-label="Операция"],
    .my-table tbody td[data-label="Название"] {
        flex-direction: column; align-items: flex-start;
        padding-bottom: 8px !important; border-bottom: 1px solid var(--hd-divider) !important; margin-bottom: 4px;
    }
    .my-table tbody td[data-label="Наименование"]::before,
    .my-table tbody td[data-label="Пользователь"]::before,
    .my-table tbody td[data-label="Операция"]::before,
    .my-table tbody td[data-label="Название"]::before { display: none; }
    .my-table tbody td[data-label="Управление"] { justify-content: flex-end; }
    .hd-table-wrap { border: none !important; background: transparent; overflow: visible !important; }
}

/* ── Логотип УКСИВТ (официальный) + подпись системы ── */
.hd-logo { display: inline-flex; align-items: center; text-decoration: none !important; }
.hd-logo-img { display: block; height: auto; width: auto; }
.hd-logo-sub {
    font-family: "Inter", sans-serif; font-weight: 700; font-size: 10px;
    letter-spacing: .16em; text-transform: uppercase; color: var(--hd-muted); white-space: nowrap;
}
.hd-logo-stacked { flex-direction: column; align-items: flex-start; gap: 3px; }
.section-menu-left .box-logo .hd-logo-img { max-width: 190px; max-height: 48px; }
.section-menu-left .box-logo .hd-logo-sub { padding-left: 2px; }
.hd-logo-mobile { display: none; }
.hd-logo-mobile .hd-logo-img { max-height: 34px; }
.hd-logo-guest { flex-direction: column; align-items: center; gap: 8px; }
.hd-logo-guest .hd-logo-img { max-width: 220px; margin: 0 auto; }
.hd-logo-guest .hd-logo-sub { font-size: 12px; letter-spacing: .2em; }
@media (max-width: 768px) {
    .hd-logo-mobile { display: inline-flex; }
}

/* ── Кнопки: доопределяем варианты под смысловую систему приложения ──
   Remos: обычная .tf-button — залитая синим (primary), .style-1 — контур,
   .style-2 — нейтральная. Переопределяем .style-1 в primary (залитая),
   добавляем .style-3 (danger) и компактный размер .small. */
.tf-button.style-1 { background-color: var(--hd-main); color: #fff; border-color: var(--hd-main); }
.tf-button.style-1:hover { background-color: #1a63e0; border-color: #1a63e0; color: #fff; }
.tf-button.style-3 { background-color: #fff; color: var(--hd-red); border-color: #fecaca; }
.tf-button.style-3:hover { background-color: var(--hd-red); border-color: var(--hd-red); color: #fff; }
.tf-button.small { height: 40px; padding: 0 16px; font-size: 13px; border-radius: 10px; }
.tf-button i { font-size: 15px; }

/* Пустой пункт меню «нет доступных систем» */
.menu-item.hd-menu-empty { pointer-events: none; }
.menu-item.hd-menu-empty .text-tiny { display: block; padding: 6px 16px; color: var(--hd-muted); }

/* ── Имя пользователя в шапке ──
   Remos ограничивает .wg-user шириной 170px (под короткие англ. имена).
   Для русских ФИО расширяем блок по содержимому, а очень длинные —
   аккуратно усекаем многоточием вместо жёсткой обрезки. */
.header-dashboard .header-user.wg-user { width: auto; max-width: 260px; }
.header-dashboard .header-user .flex.flex-column { min-width: 0; }
.header-dashboard .header-user .body-title,
.header-dashboard .header-user .text-tiny {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

/* ── Минималистичный подвал (без панели-блока) ── */
.hd-minifooter {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px;
    padding: 20px 24px 24px; font-family: "Inter", sans-serif; font-size: 12.5px;
    color: var(--hd-muted); letter-spacing: .01em; text-align: center;
}
.hd-minifooter a { color: var(--hd-muted); transition: color .15s ease; }
.hd-minifooter a:hover { color: var(--hd-main); text-decoration: none; }
.hd-minifooter-sep { opacity: .45; }

/* На узком экране — не в два столбца, а строками друг под другом */
@media (max-width: 560px) {
    .hd-minifooter { flex-direction: column; gap: 6px; }
    .hd-minifooter-sep { display: none; }
}

/* ============================================================
   Уведомления (тосты) в стиле Remos
   ============================================================ */
.hd-toasts {
    position: fixed; bottom: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column-reverse; gap: 12px;
    width: 380px; max-width: calc(100vw - 32px); pointer-events: none;
}
.hd-toast {
    position: relative; pointer-events: auto;
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: 12px;
    background: #fff; border: 1px solid var(--hd-border);
    border-left: 3px solid var(--hd-muted);
    box-shadow: 0 10px 34px rgba(17, 25, 40, .13);
    font-family: "Inter", sans-serif;
    transform: translateX(120%); opacity: 0;
    transition: transform .38s cubic-bezier(.22, 1, .36, 1), opacity .38s;
}
.hd-toast.show { transform: translateX(0); opacity: 1; }
.hd-toast.hide { transform: translateX(120%); opacity: 0; }
.hd-toast-icon {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
}
.hd-toast-body { flex: 1; min-width: 0; padding-top: 3px; }
.hd-toast-msg { font-size: 14px; font-weight: 600; color: var(--hd-title); line-height: 1.4; word-break: break-word; }
.hd-toast-close {
    flex-shrink: 0; cursor: pointer; color: var(--hd-muted); font-size: 20px; line-height: 1;
    background: none; border: none; padding: 2px 2px 0; transition: color .15s;
}
.hd-toast-close:hover { color: var(--hd-title); }

.hd-toast.success { border-left-color: #22c55e; }
.hd-toast.success .hd-toast-icon { background: #dcfce7; color: #15803d; }
.hd-toast.error   { border-left-color: #ef4444; }
.hd-toast.error   .hd-toast-icon { background: #fee2e2; color: #ef4444; }
.hd-toast.warning { border-left-color: #FF5200; }
.hd-toast.warning .hd-toast-icon { background: #FFF2ED; color: #FF5200; }
.hd-toast.info    { border-left-color: var(--hd-main); }
.hd-toast.info    .hd-toast-icon { background: #EAF4FF; color: var(--hd-main); }
.hd-toast.clickable { cursor: pointer; }
.hd-toast.clickable:hover { box-shadow: 0 14px 40px rgba(17, 25, 40, .18); }

@media (max-width: 640px) {
    .hd-toasts { bottom: 12px; right: 12px; left: 12px; width: auto; }
}
