/* Organigramme — feuille de style unique, sans dépendance. */
:root {
  --bg: #f4f5f7; --card: #ffffff; --ink: #1f2430; --muted: #6b7280; --line: #e3e6eb;
  --accent: #2f5fa8; --accent-ink: #ffffff; --danger: #b42318; --ok: #1d7a46; --warn: #9a6700;
  --is: #dbe8ff; --is-ink: #1e4b9b; --ir: #dcf3e2; --ir-ink: #1c6b3a; --other: #eceef1; --person: #fff4d6;
  --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .6rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
code { font-size: .85em; background: #f0f2f5; padding: 0 .25em; border-radius: 3px; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.num { text-align: right; }
.req { color: var(--danger); }
.warn-text { color: var(--warn); font-weight: 600; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .55rem 1.25rem; background: #1f2937; color: #e5e7eb; flex-wrap: wrap; }
.topbar a { color: #e5e7eb; }
.brand { font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; }
.mainnav { display: flex; gap: 1.1rem; flex: 1; flex-wrap: wrap; }
.userbox { display: flex; gap: 1rem; align-items: center; font-size: .92em; flex-wrap: wrap; }
.userbox .who small { color: #9ca3af; }
.linklike { background: none; border: 0; color: #e5e7eb; cursor: pointer; font: inherit; padding: 0; }
.linklike:hover { text-decoration: underline; }
.pill { display: inline-block; font-size: .75em; padding: .05em .5em; border-radius: 999px; background: #374151; }
.pill.warn { background: #b45309; color: #fff; }
.pill.lock { background: #fde68a; color: #7c2d12; }

.container { max-width: 980px; margin: 1.25rem auto 2rem; padding: 0 1.25rem; }
.container.wide { max-width: 1320px; }
.foot { text-align: center; color: var(--muted); font-size: .8em; padding: 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card.narrow { max-width: 720px; }
.card.login { max-width: 420px; margin: 3rem auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-head h1, .card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .3rem 0; border-bottom: 1px dashed var(--line); }
ul.plain li:last-child { border-bottom: 0; }

.flash { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; background: #e8f0fe; border: 1px solid #c7d7f7; }
.flash.success { background: #e6f6ec; border-color: #b7e3c6; }
.flash.error { background: #fdecea; border-color: #f5c2bd; color: var(--danger); }
.flash.warn { background: #fff7e0; border-color: #f2dc9b; }
.flash ul { margin: .3rem 0 0 1.2rem; }

.btn { display: inline-block; padding: .45rem .9rem; border: 1px solid #c9cfd8; border-radius: 6px; background: #fff; color: var(--ink); font: inherit; cursor: pointer; line-height: 1.2; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #274f8c; }
.btn.danger { color: var(--danger); border-color: #e7b1ab; }
.btn.danger:hover { background: #fdecea; }
.btn.small { padding: .25rem .6rem; font-size: .85em; }
.btn[disabled] { opacity: .5; cursor: default; }
form.inline { display: inline; }
.row-form { display: inline-flex; gap: .3rem; align-items: center; flex-wrap: wrap; }
.actions { margin-top: 1rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.actions-cell { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.actions-cell form.inline { display: block; }

.field { margin-bottom: .8rem; }
.field label { display: block; font-weight: 600; margin-bottom: .2rem; font-size: .93em; }
.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=date], .field select, .field textarea, .row-form input[type=text], .row-form select, .row-form input[type=number], .page-head select {
  width: 100%; padding: .45rem .55rem; border: 1px solid #c9cfd8; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
.row-form input[type=text], .row-form select { width: auto; min-width: 8rem; }
.row-form input.tiny, input.tiny { width: 4.5rem; }
.table input[type=text], .table input[type=number] { padding: .3rem .45rem; border: 1px solid #c9cfd8; border-radius: 6px; font: inherit; width: 100%; }
.table input.tiny { width: 4.5rem; }
.page-head select { width: auto; }
.field textarea { resize: vertical; }
.field .help { display: block; color: var(--muted); margin-top: .2rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }

.table { width: 100%; border-collapse: collapse; font-size: .93em; }
.table th, .table td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.table th { background: #f7f8fa; font-weight: 600; font-size: .9em; }
.table th.num, .table td.num { text-align: right; }
.table.compact th, .table.compact td { padding: .3rem .4rem; font-size: .9em; }
.table tr.ended td { color: var(--muted); }
.table tr.ended td a { color: #7a8bb0; }
.table.params tr.param-stale td, .table.params tr.param-empty td { background: #fffbea; }
dl.props { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1.25rem; margin: 0; }
dl.props dt { color: var(--muted); font-weight: 600; }
dl.props dd { margin: 0; }
details summary { cursor: pointer; color: var(--accent); margin: .5rem 0; }
.archived-list { margin-top: 1rem; }

.badge { display: inline-block; font-size: .75em; font-weight: 600; padding: .1em .55em; border-radius: 999px; background: var(--other); color: #374151; vertical-align: middle; }
.badge.regime.is { background: var(--is); color: var(--is-ink); }
.badge.regime.ir { background: var(--ir); color: var(--ir-ink); }
.badge.status.projet { background: #fef3c7; color: #92400e; }
.badge.status.dissoute { background: #e5e7eb; color: #6b7280; }
.badge.status.active { background: var(--ir); color: var(--ir-ink); }
.badge.ok { background: var(--ir); color: var(--ir-ink); }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.grey { background: #e5e7eb; color: #4b5563; }
.badge.demo { background: #ede9fe; color: #5b21b6; }

.group-head { margin-bottom: 1rem; }
.group-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.group-title h1 { margin: 0; }
.group-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; align-items: center; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin: .5rem 0; }
.tabs a { padding: .4rem .9rem; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; color: var(--muted); }
.tabs a.active { background: var(--card); border-color: var(--line); color: var(--ink); font-weight: 600; margin-bottom: -1px; }
.banner { padding: .6rem .9rem; border-radius: var(--radius); display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin: .5rem 0; }
.banner.reading { background: #eef1f5; }
.banner.editing { background: #e6f6ec; border: 1px solid #b7e3c6; }
.banner.locked { background: #fff7e0; border: 1px solid #f2dc9b; }
.banner.archived { background: #ececec; }

.orgchart-wrap { display: flex; gap: 1rem; align-items: flex-start; }
.orgchart-scroll { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fbfbfc; min-height: 200px; }
.orgchart-scroll svg { display: block; }
.org-panel { width: 340px; flex: none; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; background: #fff; max-height: 600px; overflow: auto; }
.org-panel h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.org-panel h4 { margin: .8rem 0 .3rem; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.org-panel ul { padding-left: 1.1rem; margin: 0; }
.org-panel .close { float: right; }
@media (max-width: 900px) { .orgchart-wrap { flex-direction: column; } .org-panel { width: 100%; } }

.node { cursor: pointer; }
.node rect { stroke: #5b6b85; stroke-width: 1; }
.node.person rect { fill: var(--person); }
.node.entity rect { fill: var(--other); }
.node.entity.is rect { fill: var(--is); }
.node.entity.ir rect { fill: var(--ir); }
.node.entity.projet rect { stroke-dasharray: 5 3; fill: #fff; }
.node.entity.dissoute rect { fill: #f3f4f6; stroke: #c0c4cc; }
.node.entity.dissoute text { fill: #8a8f99; }
.node.selected rect { stroke: var(--accent); stroke-width: 2.5; }
.node text { font-family: var(--font); pointer-events: none; }
.node .name { font-size: 13px; font-weight: 600; fill: var(--ink); }
.node .sub { font-size: 11px; fill: var(--muted); }
.edge { stroke: #5b6b85; stroke-width: 1.3; fill: none; }
.edge.usufruit { stroke-dasharray: 6 3; }
.edge.nue { stroke-dasharray: 2 3; }
.edge-label { font-size: 11px; font-family: var(--font); fill: var(--ink); }
.edge-label-bg { fill: #fbfbfc; }
