:root {
  --fond: #f4f6f9; --panneau: #ffffff; --bord: #d9dee5; --texte: #1d2530; --doux: #66717f;
  --accent: #c2410c; --accent-clair: #fff1e8; --alerte: #b42318;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--texte);
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; display: flex; flex-direction: column; background: var(--fond); }
header { display: flex; align-items: center; gap: 16px; padding: 8px 16px; background: #1d2530; color: #fff; }
.logo { font-weight: 800; font-size: 20px; letter-spacing: .5px; color: #fb923c; }
.nom-projet { background: transparent; border: 1px solid transparent; color: #fff; font-size: 15px; padding: 4px 6px; border-radius: 4px; min-width: 200px; }
.nom-projet:hover, .nom-projet:focus { border-color: #4b5563; outline: none; }
.actions { margin-left: auto; display: flex; gap: 8px; }
button { font: inherit; padding: 6px 12px; border-radius: 5px; border: 1px solid var(--bord); background: #fff; color: var(--texte); cursor: pointer; }
header button { background: #2d3746; border-color: #4b5563; color: #fff; }
button.primaire { background: var(--accent); border-color: var(--accent); color: #fff; }
button:hover { filter: brightness(1.08); }
button.petit { padding: 2px 8px; font-size: 12px; }

main { flex: 1; display: grid; grid-template-columns: 210px 1fr 320px; min-height: 0; }
aside { background: var(--panneau); overflow-y: auto; padding: 12px; }
.gauche { border-right: 1px solid var(--bord); }
.droite { border-left: 1px solid var(--bord); }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--doux); margin: 4px 0 8px; }
h3 { font-size: 13px; margin: 14px 0 6px; }

.bibliotheque { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; }
.famille { border: 1px solid var(--bord); border-radius: 6px; padding: 8px 4px; text-align: center; font-size: 12px; background: #fff; cursor: pointer; }
.famille svg { width: 40px; height: 32px; display: block; margin: 0 auto 4px; }
.famille:hover { border-color: var(--accent); background: var(--accent-clair); }
.famille[disabled] { opacity: .45; cursor: not-allowed; background: #fafafa; }
.reperes { list-style: none; margin: 0; padding: 0; }
.reperes li { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 5px; cursor: pointer; }
.reperes li.actif { background: var(--accent-clair); outline: 1px solid var(--accent); }
.reperes .rep { font-weight: 700; min-width: 28px; }
.reperes .suppr { margin-left: auto; border: none; background: none; color: var(--doux); padding: 0 4px; }

.centre { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.onglets { display: flex; align-items: flex-end; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--bord); overflow-x: auto; flex: none; }
.onglet { display: flex; align-items: center; gap: 6px; padding: 7px 8px 7px 12px; border: 1px solid var(--bord); border-bottom: none; border-radius: 6px 6px 0 0; background: #e9edf2; color: var(--doux); cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.onglet:hover { background: #f3f5f8; }
.onglet.actif { background: var(--fond); color: var(--texte); border-color: var(--bord); border-top: 2px solid var(--accent); padding-top: 6px; }
.onglet .rep { font-weight: 700; color: var(--texte); }
.onglet .fermer { border: none; background: none; padding: 0 4px; color: var(--doux); line-height: 1; }
.onglet .fermer:hover { color: var(--alerte); }
.onglet-plus { position: relative; }
.onglet-plus > button { border: 1px dashed var(--bord); border-bottom: none; border-radius: 6px 6px 0 0; background: transparent; padding: 6px 12px; color: var(--doux); margin-bottom: -1px; }
.menu { position: fixed; z-index: 10; background: #fff; border: 1px solid var(--bord); border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.12); padding: 4px; min-width: 180px; }
.menu button { display: block; width: 100%; text-align: left; border: none; padding: 6px 10px; }
.menu button:hover:not([disabled]) { background: var(--accent-clair); }
.menu button[disabled] { color: #a0a8b3; cursor: not-allowed; }
.onglets .vide { padding: 8px; }
.vues { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; min-width: 0; min-height: 0; }
.vue { background: var(--panneau); border: 1px solid var(--bord); border-radius: 6px; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.vue-titre { font-size: 12px; color: var(--doux); padding: 6px 10px; border-bottom: 1px solid var(--bord); }
.vue-corps { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.vue-corps canvas { position: absolute; inset: 0; }
.vue2d { background: #fff; display: flex; }
.vue2d svg { width: 100%; height: 100%; }
.vue2d .contour { fill: #eef2f6; stroke: #1d2530; stroke-width: var(--trait); vector-effect: non-scaling-stroke; stroke-width: 1.6px; }
.vue2d .trou { fill: #fff; stroke: #1d2530; stroke-width: 1.3px; vector-effect: non-scaling-stroke; }
.vue2d .axe { stroke: #c2410c; stroke-width: .8px; vector-effect: non-scaling-stroke; stroke-dasharray: 6 2 1 2; fill: none; }
.vue2d .ligne-cote { stroke: #2563eb; stroke-width: .8px; vector-effect: non-scaling-stroke; fill: none; }
.vue2d .cote { fill: #2563eb; font-family: system-ui, sans-serif; }
.vue2d .titre { fill: var(--doux); font-family: system-ui, sans-serif; }

.champ { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: 8px; margin: 5px 0; }
.champ label { color: var(--doux); }
.champ input, .champ select, .table input, .table select { font: inherit; padding: 4px 6px; border: 1px solid var(--bord); border-radius: 4px; width: 100%; background: #fff; }
.champ input:focus, .champ select:focus { outline: 2px solid #fdba74; border-color: var(--accent); }
.champ.case { grid-template-columns: 1fr auto; }
.champ.case input { width: auto; }
.bloc { border: 1px solid var(--bord); border-radius: 6px; padding: 6px 10px; margin: 8px 0; background: #fbfcfd; }
.bloc-tete { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { color: var(--doux); font-weight: 500; text-align: left; }
.table td { padding: 2px; }
.vide { color: var(--doux); }
#alertes .alerte { color: var(--alerte); background: #fef3f2; border: 1px solid #fecdca; padding: 6px 8px; border-radius: 5px; margin: 6px 0; font-size: 13px; }
#infos table { width: 100%; margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 6px; }
#infos td { padding: 2px 0; } #infos td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.note { color: var(--doux); font-size: 12px; margin: 6px 0; line-height: 1.4; }
.vue2d .note-plan { fill: var(--texte); font-family: system-ui, sans-serif; }
.vue2d.empile { flex-direction: column; }
.vue2d.empile .plan-section { flex: 2; min-height: 0; display: flex; border-bottom: 1px solid var(--bord); }
.vue2d.empile .plan-barre { flex: 3; min-height: 0; display: flex; }
.vue2d .cache { stroke: #1d2530; stroke-width: .8px; vector-effect: non-scaling-stroke; stroke-dasharray: 5 3; fill: none; }
.vue2d .arete { stroke: #1d2530; stroke-width: 1.2px; vector-effect: non-scaling-stroke; fill: none; }
.vue2d .fond-barre { fill: #eef2f6; stroke: none; }
.vue2d .nom-vue { fill: var(--doux); font-family: system-ui, sans-serif; }
.vue2d .usinage { fill: #fff; stroke: #1d2530; stroke-width: 1.1px; vector-effect: non-scaling-stroke; }
.vue2d .usinage.cache { fill: none; stroke-dasharray: 5 3; stroke-width: .8px; }
.vue2d .masque { fill: #fff; stroke: none; }
.boutons { display: flex; gap: 6px; flex-wrap: wrap; }
.onglet-nomenclature { margin-left: auto; }
.nomenclature { flex: 1; overflow: auto; padding: 12px 16px; }
.nomenclature[hidden], .vues[hidden] { display: none; }
.nomen-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.nomen-tete h2 { font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--texte); margin: 0; }
table.nomen { width: 100%; border-collapse: collapse; background: var(--panneau); border: 1px solid var(--bord); font-variant-numeric: tabular-nums; }
.nomen th { text-align: left; font-weight: 600; font-size: 12px; color: var(--doux); padding: 8px; border-bottom: 2px solid var(--bord); background: #f8fafc; }
.nomen td { padding: 7px 8px; border-bottom: 1px solid var(--bord); }
.nomen tbody tr { cursor: pointer; }
.nomen tbody tr:hover { background: var(--accent-clair); }
.nomen .num { text-align: right; }
.nomen .rep { font-weight: 700; white-space: nowrap; }
.nomen tfoot td { font-weight: 700; border-top: 2px solid var(--bord); }
.pastille { display: inline-block; margin-left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--alerte); color: #fff; font-size: 11px; text-align: center; line-height: 16px; }
