.table-panel { overflow: visible; }
.table-scroll { overflow-x: auto; border-radius: 16px; }
.table-panel table { margin: 0; }
.table-panel th, .table-panel td { padding: 8px; border: 1px solid var(--border); vertical-align: middle; }
.table-panel th { background: var(--bg-secondary); color: var(--text); font-size: inherit; font-weight: 700; letter-spacing: normal; text-align: center; text-transform: none; }
.table-panel td { text-align: left; }
.table-panel td strong, .table-panel td small { display: block; }
.table-panel td small { margin-top: 0.2rem; color: var(--portal-muted); }
.actions-column, .selection-column { width: 1%; }
.selection-column { text-align: center !important; }
/* Floor for the auto table layout: the widest status badge ("Connected" /
«Подключён» / "Disabled" / «Отключён») fills ~7rem, so the Status column
renders at the same width in both portals regardless of the badges shown. */
.status-column { min-width: 7rem; }
.selection-checkbox { width: 1rem; height: 1rem; margin: 0; accent-color: var(--portal-accent); cursor: pointer; }

dialog { width: min(92vw, 520px); max-height: min(88vh, 760px); padding: 0; overflow: auto; border: 1px solid #e4e7ec; border-radius: 16px; box-shadow: 0 24px 80px rgba(16, 24, 40, 0.3); }
dialog::backdrop { background: rgba(16, 24, 40, 0.55); }
.dialog-form { display: grid; gap: 1.15rem; padding: 1.75rem; }
.dialog-form h2 { margin: 0; }
.dialog-subtitle { margin: 0.25rem 0 0; color: var(--portal-muted); }
.dialog-form .form-field { margin: 0; }
.dialog-form label { display: block; margin-bottom: 0.45rem; font-size: 0.92rem; font-weight: 700; }
.dialog-input { box-sizing: border-box; width: 100%; min-height: 46px; padding: 0.75rem 0.85rem; border: 1px solid #98a2b3; border-radius: 10px; background: var(--input-bg); color: var(--text); font: inherit; }
.dialog-input:focus { border-color: #2e90fa; outline: 0; box-shadow: 0 0 0 4px rgba(46, 144, 250, 0.18); }
.file-input { padding: 0.45rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }
.confirm-dialog-content { min-width: min(28rem, calc(92vw - 3.5rem)); }
.confirm-dialog-content .dialog-subtitle { line-height: 1.55; }

.management-popover { position: fixed; inset: 0 auto auto 0; width: 190px; margin: 0; padding: 0.4rem; border: 1px solid #d0d5dd; border-radius: 10px; background: white; color: #344054; box-shadow: 0 14px 34px rgba(16, 24, 40, 0.2); }
.management-popover form { margin: 0; }
.management-popover button { width: 100%; padding: 0.6rem 0.7rem; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.management-popover button:hover, .management-popover button:focus-visible { background: #f2f4f7; outline: 0; }
.management-popover button:disabled { opacity: 0.5; cursor: not-allowed; }
.danger-text { color: var(--portal-danger) !important; }

/* Group management (shared Groups component): inline table actions plus the
   staged membership tag editor (membership-editor.js drives it; the same
   styles serve the read-only group tags in the users table). The radius is
   hardcoded because the regional presentation layers flatten the shared
   radius tokens — tags stay rounded in every region. */
.group-actions { display: flex; align-items: center; gap: 0.5rem; }
.group-actions form { margin: 0; }
.tag-list { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tag { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.35rem 0.2rem 0.7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-secondary); font-size: 0.9rem; }
.tag-remove { display: inline-flex; align-items: center; justify-content: center; width: 1.35rem; height: 1.35rem; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--portal-muted); font: inherit; font-weight: 700; line-height: 1; cursor: pointer; }
.tag-remove:hover, .tag-remove:focus-visible { background: rgba(16, 24, 40, 0.08); color: var(--portal-danger); outline: 0; }
.tag-add-row { display: flex; gap: 0.6rem; }
.tag-add-row .dialog-input { flex: 1 1 auto; }
.tag-empty-hint { margin: 0; color: var(--portal-muted); }

/* Page-header selection layout shared by the user-management pages: the
subtext swaps to "N selected. [Cancel]" and the default actions swap in place
with the bulk actions instead of pushing the table down. */
.user-heading { display: block; }
.user-summary, .header-actions { display: flex; align-items: center; gap: 0.75rem; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.cancel-selection-link { padding: 0; border: 0; background: transparent; color: var(--portal-accent); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 0.16em; cursor: pointer; }

/* Course-materials management: Training and Training Operations render the
   same materials table, folder picker, and move dialog, so the component
   lives here instead of being copied into both portals. */
.material-name { font-weight: 700; }
.material-icon { display: inline-block; width: 1.4rem; text-align: center; }
.materials-type-column { width: 7rem; }
.materials-size-column { width: 8rem; }
.materials-modified-column { width: 10.5rem; }
.materials-actions-column { width: 6.5rem; text-align: center !important; }
.folder-picker { max-height: 20rem; margin: 0; padding: 0.5rem; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.folder-picker legend { padding: 0 0.35rem; font-weight: 700; }
.folder-picker-option { display: flex !important; align-items: center; gap: 0.55rem; margin: 0; padding: 0.55rem 0.65rem 0.55rem calc(0.65rem + var(--folder-depth) * 1.25rem); border-radius: 7px; font-weight: 600 !important; cursor: pointer; }
.folder-picker-option:hover, .folder-picker-option:has(input:focus-visible) { background: var(--bg-secondary); }
.folder-picker-option:has(input:checked) { background: rgba(var(--portal-accent-rgb), 0.12); color: var(--portal-accent); }
.folder-picker-option input { flex: 0 0 auto; width: 1rem; height: 1rem; margin: 0; accent-color: var(--portal-accent); }
.folder-picker-option-disabled { opacity: 0.45; cursor: not-allowed; }
.move-new-folder-panel { display: grid; gap: 0.75rem; padding: 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-secondary); }
.move-new-folder-actions { display: flex; justify-content: flex-end; gap: 0.65rem; }
.move-dialog-actions { width: 100%; align-items: center; }
.dialog-action-spacer { flex: 1 1 auto; }

@media (max-width: 768px) {
    .table-panel td { border: 0; border-bottom: 1px solid var(--border); }
    .table-panel td:last-child { border-bottom: 0; }
    .table-panel .selection-column { width: auto; text-align: left !important; }
    .materials-type-column, .materials-size-column, .materials-modified-column, .materials-actions-column { width: auto; }
    .materials-actions-column { text-align: left !important; }
}
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } .header-actions { justify-content: flex-start; } }
@media (prefers-color-scheme: dark) {
    dialog { border-color: #344054; background: #182232; color: #e5e7eb; }
    .dialog-input { background: #111827; color: #fff; }
    .management-popover { border-color: #344054; background: #182232; color: #e5e7eb; }
    .management-popover button:hover, .management-popover button:focus-visible { background: #263244; }
    .tag { background: #111827; }
    .tag-remove:hover, .tag-remove:focus-visible { background: #263244; }
    .cancel-selection-link { color: var(--accent-soft); }
}