/* ==========================================================================
   People & access — Zespół, Moje konto, Zespół projektu, uprawnienia w UI
   ========================================================================== */

/* App is hidden until the session is confirmed (avoids a flash of private data). */
html.auth-pending .app-shell { visibility: hidden; }
.auth-fatal { max-width: 520px; margin: 18vh auto; padding: 0 16px; color: var(--ink-700); }
.auth-fatal h1 { color: var(--ink-950); }

/* Rendered controls hidden without the permission (the server enforces it anyway). */
html.no-tasks-edit [data-task-edit] { display: none !important; }
html.no-tasks-edit [data-task-check],
html.no-tasks-edit [data-project-task-check] { pointer-events: none; }
html.no-knowledge-edit [data-hub-add-link],
html.no-knowledge-edit [data-hub-drop],
html.no-knowledge-edit [data-hub-file-services],
html.no-knowledge-edit [data-hub-edit-material] { display: none !important; }
html.no-users-manage [data-user-edit],
html.no-users-manage [data-user-password],
html.no-users-manage [data-user-delete] { display: none !important; }
html.no-teams-manage [data-team-edit],
html.no-teams-manage [data-team-delete] { display: none !important; }
html.no-projects-edit [data-service-config],
html.no-projects-edit [data-project-service-toggle] { pointer-events: none; }

.people-status { margin: 0 0 12px; font-size: 0.875rem; color: #027a48; min-height: 1em; }
.people-status:empty { display: none; }
.people-status.is-error { color: var(--danger); }

.people-panel { margin-top: 14px; }
.people-panel .management-panel-head { flex-wrap: wrap; gap: 12px; }
.people-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.people-filters input, .people-filters select { min-height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); background: #fff; font: inherit; font-size: 0.875rem; }
.people-filters input { min-width: 220px; }
.people-columns { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }

.people-list { display: grid; }
.people-row {
    display: grid;
    grid-template-columns: 40px minmax(180px, 1.6fr) minmax(130px, 1fr) minmax(120px, 1fr) minmax(130px, .9fr) auto;
    align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line);
}
.people-row:last-child { border-bottom: 0; }
.people-row.is-inactive { background: #fafafa; }
.people-row.is-inactive .people-main strong { color: var(--ink-500); }
.people-main strong, .people-main span, .people-main small,
.people-access small, .people-state small { display: block; }
.people-main strong { color: var(--ink-900); font-size: 0.9286rem; }
.people-main strong em { color: var(--ink-500); font-style: normal; font-weight: 600; }
.people-main span { color: var(--ink-600); font-size: 0.875rem; margin-top: 2px; overflow-wrap: anywhere; }
.people-main small, .people-access small, .people-state small, .people-tags small { color: var(--ink-500); font-size: 0.8125rem; margin-top: 4px; }
.people-state small.is-warning { color: #b54708; font-weight: 600; }
.people-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.people-actions { display: flex; gap: 10px; justify-content: flex-end; white-space: nowrap; }

.people-role { display: inline-flex; padding: 3px 8px; font-size: 0.8125rem; font-weight: 700; background: #f2f4f7; color: var(--ink-700); }
.people-role.is-admin { background: #fef3f2; color: #b42318; }
.people-role.is-manager { background: var(--accent-soft); color: var(--accent-dark); }
.people-role.is-specialist { background: #ecfdf3; color: #027a48; }
.people-role.is-viewer { background: #f2f4f7; color: var(--ink-600); }

.people-team-list, .people-role-list { display: grid; }
.people-team, .people-role-card { display: flex; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.people-team:last-child, .people-role-card:last-child { border-bottom: 0; }
.people-team strong { color: var(--ink-900); }
.people-team p, .people-role-card p { margin: 4px 0 0; color: var(--ink-600); font-size: 0.875rem; }
.people-role-card { display: block; }
.people-role-card > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.people-role-card small { color: var(--ink-500); font-size: 0.8125rem; }
.people-avatars { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.people-avatars span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #e9ebff; color: var(--accent-dark); font-size: 0.75rem; font-weight: 800; }
.people-avatars small { color: var(--ink-500); font-size: 0.8125rem; }
.people-empty-note { margin: 0; padding: 14px 18px; color: var(--ink-500); font-size: 0.875rem; }

/* Editors (drawer cards above the lists) */
.people-drawer { margin-bottom: 14px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--accent); }
.people-form { padding: 18px; }
.people-form h3 { margin: 0; color: var(--ink-950); font-size: 1.0714rem; }
.people-form-head { display: flex; justify-content: space-between; gap: 16px; }
.people-form-head p { margin: 4px 0 0; color: var(--ink-500); font-size: 0.875rem; }
.people-close { width: 32px; height: 32px; padding: 0; background: transparent; color: var(--ink-500); border: 1px solid var(--line); font-size: 1.2857rem; line-height: 1; }
.people-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.people-form-grid label { display: flex; flex-direction: column; gap: 6px; color: var(--ink-600); font-size: 0.875rem; font-weight: 700; }
.people-form-grid label small { font-weight: 400; color: var(--ink-500); }
.people-form-grid input, .people-form-grid select { width: 100%; min-height: 39px; padding: 0 11px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-900); font: inherit; font-size: 0.875rem; font-weight: 400; }
.people-form-grid input:focus, .people-form-grid select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(89, 100, 242, .1); }
.people-password-field { display: flex; gap: 6px; }
.people-password-field input { font-family: Consolas, monospace; }
.people-fieldset { margin: 16px 0 0; padding: 0; border: 0; }
.people-fieldset legend { margin-bottom: 8px; color: var(--ink-600); font-size: 0.875rem; font-weight: 700; }
.people-fieldset .people-empty-note { padding: 0 0 8px; }
.people-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.people-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); background: #fff; font-size: 0.875rem; cursor: pointer; }
.people-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.people-form-message { min-height: 16px; margin: 12px 0 0; color: var(--danger); font-size: 0.875rem; }
.people-form-message.is-success { color: #027a48; }
.people-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Settings → Moje konto */
.account-panel .people-form { border-top: 1px solid var(--line); }
.account-password-form { max-width: 860px; }

/* Project detail → Zespół projektu */
.project-members-card { margin-top: 14px; }
.project-members-card .section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.project-members-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.project-members-list .people-empty-note { padding: 0; width: 100%; }
.people-member { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 10px 12px; border: 1px solid var(--line); }
.people-member strong, .people-member small { display: block; }
.people-member strong { color: var(--ink-900); font-size: 0.875rem; }
.people-member small { color: var(--ink-500); font-size: 0.8125rem; }
.project-members-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 1100px) {
    .people-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
    .people-access, .people-tags, .people-state { grid-column: 2 / -1; }
    .people-actions { grid-column: 2 / -1; justify-content: flex-start; }
    .people-columns { grid-template-columns: 1fr; }
}

/* Text-style action buttons (Edytuj / Hasło / Usuń) */
.people-actions .link-button {
    min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none;
    color: var(--accent-dark); font: inherit; font-size: 0.875rem; font-weight: 700; cursor: pointer;
}
.people-actions .link-button:hover { color: var(--ink-950); text-decoration: underline; background: transparent; }
.people-actions .link-button.is-danger { color: #b42318; }
.people-filters input, .people-filters select { width: auto; flex: 0 1 auto; }
.people-filters input { flex: 1 1 220px; }
.people-panel > .management-panel-head > div:first-child { flex: 0 0 auto; }
.people-filters { flex: 1 1 520px; justify-content: flex-end; }
