/* Administration of rights: screens 4b, 4c and 4d (templates/portal/rights), after docs/wireframes. */

.rights { width: 100%; max-width: 1060px; padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 16px; }
.rights--narrow { max-width: 880px; }
.rights-columns { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.rights-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.rights-text { margin: 0; color: var(--text-soft); line-height: 1.5; }
.rights-hint { font-size: 13px; color: var(--text-muted); margin: 0; }
.rights-empty { margin: 0; padding: 16px; border: 1px dashed var(--border-strong); border-radius: 12px; color: var(--text-soft); background: var(--surface); }
.rights-note { margin: 0; padding: 12px 16px; border-radius: 12px; background: var(--selected); font-size: 13px; color: var(--text-soft); line-height: 1.5; }
.rights-note ul { margin: 4px 0 0; padding-left: 18px; }

/* Groups column */
.rights-groups {
    flex: 1 1 220px; max-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px; display: flex; flex-direction: column; gap: 4px;
}
.rights-groups-title { padding: 4px 12px 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.rights-groups a {
    min-height: 44px; padding: 6px 12px; border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; gap: 8px;
    text-decoration: none; color: var(--text); font-size: 14px;
}
.rights-groups a:hover { background: var(--bg); }
.rights-groups a[aria-current="page"] { background: var(--selected); font-weight: 600; }
.rights-count { font-size: 12px; color: var(--text-muted); font-weight: 400; white-space: nowrap; }
.rights-groups-note { margin: 8px 12px 4px; font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Group header and the Droits / Membres switch */
.rights-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.rights-head h2 { margin: 0; font-size: 20px; }
.rights-head p { margin: 4px 0 0; font-size: 14px; color: var(--text-muted); }
/* Tokens only: the track and the chosen view follow the light and dark themes. */
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--selected); border-radius: 10px; }
.segmented a { padding: 8px 16px; border-radius: var(--radius); text-decoration: none; color: var(--text-soft); font-size: 14px; }
.segmented a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / 8%), 0 0 0 1px var(--border); }

/* Connector cards */
.rights-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.rights-card h3 { margin: 0; font-size: 16px; }
.rights-card-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.rights-card-head .connector-pill { width: 32px; height: 32px; font-size: 12px; }
.rights-form { display: flex; flex-direction: column; }
.rights-form-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 16px; }
.rights-form-foot .button, .rights-closed .button { border: none; cursor: pointer; font: inherit; font-weight: 600; }
/* app.css declares .button after .button--secondary: the secondary look is restated here. */
.rights .button--secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.rights .button--secondary:hover { background: var(--bg); color: var(--text); }

.rights-closed { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 16px 20px; background: var(--surface); }
.rights-closed summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; flex-wrap: wrap; }
.rights-closed summary::-webkit-details-marker { display: none; }
.rights-closed-text { display: flex; flex-direction: column; gap: 2px; }
.rights-closed-text span { font-size: 13px; color: var(--text-muted); }
.rights-closed[open] .rights-open { display: none; }
.rights-closed[open] > .rights-hint { margin-top: 12px; }

/* One action and its rule */
.rule { padding: 12px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.rule:last-of-type { border-bottom: none; }
.rule-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rule-label { font-size: 14px; display: flex; align-items: baseline; gap: 8px; }
.rule-kind { font-size: 12px; color: var(--text-muted); }
.rule select, .rule input, .exception select, .exception input, .exception-add select, .exception-add input {
    min-height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius);
    font: inherit; font-size: 14px; background: var(--surface); color: var(--text);
}
.rule-choice { min-width: 240px; font-weight: 600; }
.rule-panel { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 14px; background: var(--subtle); display: flex; flex-direction: column; gap: 12px; }
.rule-block { display: flex; flex-direction: column; gap: 8px; }
.rule-line, .rule-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-word { font-weight: 600; }
.rule-value { width: 120px; }
.rule-count { width: 56px; text-align: center; }
.rule-unit { min-width: 16px; color: var(--text-soft); }
.rule-rows { display: flex; flex-direction: column; gap: 8px; }
.rule-heading { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.rule-help { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.rule-otherwise { margin: 0; font-size: 14px; color: var(--text-soft); }
.rule-add {
    align-self: flex-start; padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
    background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text);
}
.rule-add:hover { background: var(--bg); }
.rule-remove {
    width: 32px; height: 32px; border: none; border-radius: var(--radius); background: none; font-size: 18px; line-height: 1;
    cursor: pointer; color: var(--text-soft);
}
.rule-remove:hover { background: var(--bg); color: var(--text); }
.rule-errors, .rule-warnings { margin: 0; padding: 8px 12px 8px 28px; border-radius: var(--radius); font-size: 13px; line-height: 1.5; }
.rule-errors { border: 1px solid var(--danger-border); background: var(--danger-bg); color: var(--danger); }
.rule-warnings { border: 1px solid var(--warning-border); background: var(--warning-bg); color: var(--warning); }
.rights [hidden] { display: none !important; }

/* Members (4c) */
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.member-text { display: flex; flex-direction: column; flex: 1 1 200px; min-width: 0; }
.member-name { font-weight: 600; color: var(--text); }
.member-email { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.member-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge--dashed { border-style: dashed; }
.member-status { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; min-width: 130px; }
.member-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3C8A55; }
.member-status--pending::before { background: #C99A2E; }
.member-status--disabled::before { background: var(--border-strong); }

/* Member (4d) */
.breadcrumb { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--text-soft); }
.member-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.member-head-text { flex: 1 1 300px; min-width: 0; }
.member-head h2 { margin: 0; font-size: 24px; }
.member-head p { margin: 4px 0 0; color: var(--text-soft); font-size: 14px; overflow-wrap: anywhere; }
.avatar--large { width: 56px; height: 56px; font-size: 18px; }
.exception { border-top: 1px solid var(--border); padding-top: 14px; }
.exception-form { display: flex; flex-direction: column; gap: 12px; }
.exception-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.exception-head h4 { margin: 2px 0 0; font-size: 15px; }
.exception-connector { font-size: 13px; color: var(--text-muted); }
.exception-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.exception-group { padding: 10px 12px; border-radius: var(--radius); background: var(--subtle); display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--text-soft); }
.exception-choice { display: flex; flex-direction: column; gap: 6px; }
.exception-choice select { width: 100%; }
.exception-reason { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.exception-reason input { font-weight: 400; }
.exception-add { border-top: 1px solid var(--border); padding-top: 14px; }
.exception-add summary { list-style: none; width: fit-content; }
.exception-add summary::-webkit-details-marker { display: none; }
.exception-add[open] summary { margin-bottom: 12px; }

@media (max-width: 820px) {
    .rights { padding: 16px; }
    .rights-groups { max-width: none; }
    .rule-choice { min-width: 0; width: 100%; }
}
