/* ES8 Control — trois zones fixes : liste | patch | modifications.
   Thème unique, sombre, d'après la pédale : acier noir brossé, sérigraphie
   blanche, LED bleues (loop allumée), afficheur 7 segments rouge, écran LCD à
   rétroéclairage bleu ; bleu acier de l'éditeur officiel pour les sélections.
   L'ambre est réservé à ce qui attend d'être écrit. */
:root {
  --bg: #0c0d0f;           /* fond, autour du boîtier */
  --surface: #141518;      /* creux, champs */
  --panel: #1b1c20;        /* boîtier */
  --raised: #24262b;       /* touches, cartes */
  --ink: #f1f2f4;          /* sérigraphie blanche */
  --muted: #8d939c;
  --line: #2e3036;
  --metal: #111214;        /* zones encastrées (chaîne, pédalier) */
  --led: #3d8bff;          /* LED bleue allumée */
  --led-glow: #73adff;
  --led-soft: #13233f;
  --accent: #4f8fe6;       /* sélection, boutons, liens */
  --accent-soft: #15233a;
  --on-accent: #ffffff;
  --steel: #5b8495;        /* bleu acier de l'éditeur officiel */
  --pending: #f2a93b;      /* modifications en attente */
  --pending-soft: #2e2311;
  --on-pending: #1a1205;
  --seg: #ff2d1f;          /* afficheur 7 segments */
  --lcd: #0b1d5c;          /* LCD rétroéclairé */
  --lcd-hi: #16308a;
  --lcd-ink: #dfe9ff;
  --ok: #4cc38a;
  --warn: #f2a93b;
  --bad: #ff5c52;
  --shadow: rgba(0, 0, 0, 0.6);
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-lcd: "VT323", "JetBrains Mono", ui-monospace, monospace;
  --r: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.45 var(--font-body); }
#root { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: var(--font-mono); font-size: 12.5px; }
code { background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.pad { padding: 24px; }
.error { color: var(--bad); }
.warn { color: var(--warn); margin: 0; }

h1, h2, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.1; }
h2 { font-size: 26px; }

select, input:not([type]), input[type="number"], input[type="search"], textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 8px; min-width: 0;
}
input[type="number"] { width: 76px; font-family: var(--font-mono); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 13px; cursor: pointer;
  font-weight: 600; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel);
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--panel); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn small { font-weight: 400; opacity: 0.8; }
.link { border: 0; background: none; padding: 0 2px; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link:disabled { opacity: 0.45; cursor: default; }
.link.danger { color: var(--bad); }
.dirty { --dirty: 1; }

/* ---------------------------------------------------------------- squelette */
.app { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.body { display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; min-height: 0; }
.center { overflow: auto; min-width: 0; }

.splash { height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.splash .logo { font-size: 34px; color: var(--ink); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- barre du haut */
.top { display: flex; align-items: center; gap: 16px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo { font: 700 21px/1 var(--font-display); letter-spacing: 0.02em; }
.tabs { display: flex; gap: 2px; padding: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.tabs button {
  border: 0; background: none; cursor: pointer; padding: 7px 14px; border-radius: 5px; color: var(--muted);
  font: 600 14px/1 var(--font-display); letter-spacing: 0.05em; text-transform: uppercase;
}
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.busy { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.busy progress, .progress progress { accent-color: var(--accent); width: 160px; }

.conn { position: relative; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; max-width: 460px; white-space: nowrap;
}
.pill .src { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.on .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 330px; padding: 14px; display: grid; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px var(--shadow);
}
.pop label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.pop label select { color: var(--ink); }
.pop p { margin: 0; }
.row2 { display: flex; flex-wrap: wrap; gap: 8px; }
.backups { display: grid; gap: 4px; justify-items: start; border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------------------------------------------------------------- liste des patchs */
.side { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.side .search { padding: 10px; border-bottom: 1px solid var(--line); }
.side .search input { width: 100%; }
.list { overflow: auto; padding: 4px 0 16px; }
.bank-h {
  display: flex; align-items: baseline; justify-content: space-between; padding: 10px 12px 3px;
  font: 600 12px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.bank-h .link { font: 500 12px var(--font-body); text-transform: none; letter-spacing: 0; text-decoration: none; }
.p-row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 10px; align-items: center; gap: 6px; width: 100%;
  padding: 4px 12px; border: 0; background: none; text-align: left; cursor: pointer; font-weight: 500;
}
.p-row:hover { background: var(--surface); }
.p-row .n { font: 400 11px var(--font-mono); color: var(--muted); }
.p-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-row.unnamed .nm { color: var(--muted); font-weight: 400; }
.p-row.stale .nm { font-style: italic; }
.p-row[aria-current="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.p-row .mark { width: 7px; height: 7px; border-radius: 50%; }
.p-row.dirty .mark { background: var(--pending); }
.p-row .cur { color: var(--ok); font-size: 10px; }
.fold {
  display: block; width: calc(100% - 20px); margin: 6px 10px; padding: 6px 10px; text-align: left; cursor: pointer;
  border: 1px dashed var(--line); border-radius: var(--r); background: none; color: var(--muted); font-size: 12px;
}
.fold:hover { border-color: var(--muted); }

/* ---------------------------------------------------------------- accueil */
.welcome { max-width: 620px; margin: 8vh auto; padding: 0 24px; display: grid; gap: 14px; }
.welcome h1 { font-size: 36px; }
.welcome ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.welcome p { margin: 0; }

/* ---------------------------------------------------------------- patch */
.patch, .library, .system { padding: 18px 22px 40px; display: grid; gap: 22px; align-content: start; }
.p-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px; }
.p-head .num { font: 600 15px var(--font-mono); color: var(--muted); padding-bottom: 7px; }
.p-name {
  width: 11.6em; max-width: 100%; padding: 2px 6px; margin-left: -6px; border: 1px solid transparent; border-radius: var(--r); background: none;
  font: 600 30px/1.1 var(--font-display); letter-spacing: 0.02em;
}
.p-name:hover, .p-name:focus { border-color: var(--line); background: var(--panel); }
.mini { display: grid; gap: 2px; font: 600 11px var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.mini input { font-size: 16px; font-weight: 600; color: var(--ink); }
.fresh { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); padding-bottom: 8px; }
.badge { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); font-weight: 600; }
.p-name.dirty, .mini.dirty input, .pick.dirty select, .pick.dirty input, .kv.dirty select, .kv.dirty input,
.editor label.dirty select, .editor label.dirty input { border-color: var(--pending); box-shadow: 0 0 0 2px var(--pending-soft); }

.sect { display: grid; gap: 10px; min-width: 0; align-content: start; }
.sect-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.sect-h h4 { font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sect-h .hint { font-size: 12px; color: var(--muted); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; align-items: start; }

/* chaîne */
.chain { display: flex; align-items: center; padding: 14px; background: var(--metal); border-radius: 8px; overflow-x: auto; }
.chain.dirty { box-shadow: inset 0 0 0 2px var(--pending); }
.wire { position: relative; flex: none; align-self: center; width: 14px; height: 2px; background: var(--muted); }
.pair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 18px; height: 18px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--muted); font-size: 11px; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity 0.12s;
}
.wire:hover .pair, .pair:focus-visible { opacity: 1; }
.jack {
  display: grid; gap: 1px; justify-items: start; min-width: 78px; padding: 7px 10px; cursor: pointer; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); font-size: 11px; color: var(--muted);
}
.jack b { font: 700 14px var(--font-display); letter-spacing: 0.08em; color: var(--ink); }
.jack.open, .jack:hover { border-color: var(--muted); }
.jack.drop { box-shadow: -3px 0 0 var(--accent); }
.loop {
  position: relative; flex: none; display: grid; justify-items: center; gap: 5px; width: 50px; padding: 7px 3px 5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); cursor: grab; user-select: none;
}
.loop .lbl { font: 700 18px/1 var(--font-display); color: var(--muted); }
.loop .led { width: 12px; height: 12px; border-radius: 50%; background: var(--line); border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); }
.loop.on { border-color: var(--led); }
.loop.on .lbl { color: var(--ink); }
.loop.on .led { background: var(--led-glow); border-color: var(--led); box-shadow: 0 0 10px 1px var(--led-glow); }
.loop .co { padding: 2px 4px; border: 1px solid var(--line); border-radius: 3px; background: none; color: var(--muted); font: 600 9px/1 var(--font-mono); cursor: pointer; }
.loop .co.on { color: var(--led); border-color: var(--led); }
.loop.dirty::after {
  content: ""; position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--pending); border: 2px solid var(--metal);
}
.loop.drop-l { box-shadow: -4px 0 0 var(--accent); }
.loop.drop-r { box-shadow: 4px 0 0 var(--accent); }
.par { position: relative; display: grid; gap: 6px; padding: 8px 8px 8px 12px; border: 1px dashed var(--muted); border-radius: 8px; }
.lane { display: flex; align-items: center; }
.unpar {
  position: absolute; top: -9px; right: -9px; width: 18px; height: 18px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12px; line-height: 1;
}
.notation { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.notation form { display: flex; gap: 8px; align-items: center; }
.notation input { width: 18ch; }
.io-edit { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.pick { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.pick select, .pick input { color: var(--ink); }

/* pédalier */
.board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 14px; background: var(--metal); border-radius: 8px; }
.board .sep { grid-column: 1 / -1; font: 600 11px var(--font-display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.sw {
  display: grid; gap: 4px; align-content: start; min-height: 74px; padding: 8px 9px; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0;
}
.sw:hover { border-color: var(--muted); }
.sw[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.sw.dirty { box-shadow: inset 0 0 0 2px var(--pending); }
.sw .slot { display: flex; align-items: center; gap: 6px; font: 600 11px/1 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.sw .fn { font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.sw .fn.default { color: var(--muted); font-weight: 500; }
.sw .tag { padding: 3px 5px; border-radius: 4px; background: var(--led-soft); font-size: 11px; line-height: 1.25; }
.custom { width: 6px; height: 6px; border-radius: 50%; background: var(--led); }
.sw-detail { display: grid; gap: 8px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.path { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.path i { font-style: normal; color: var(--muted); }

/* listes compactes : assigns, MIDI */
.rows { display: grid; gap: 6px; align-content: start; }
.item { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.item.dirty { border-color: var(--pending); }
.item-h { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; cursor: pointer; }
.item-h .k { font: 600 12px var(--font-mono); color: var(--muted); white-space: nowrap; }
.item-h .muted { margin-left: auto; font-size: 12px; }
.editor { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 4px 10px 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.editor label { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.editor select, .editor input { color: var(--ink); width: 100%; }
.editor .link { justify-self: start; align-self: end; font-size: 13px; }
.pair-in { display: flex; gap: 6px; }
.add { padding: 7px 10px; text-align: left; cursor: pointer; border: 1px dashed var(--line); border-radius: var(--r); background: none; color: var(--accent); }
.add:hover { border-color: var(--accent); }

details.adv summary { cursor: pointer; color: var(--muted); }
details.adv[open] { gap: 12px; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); font-size: 12px; }
.toggle.dirty { border-color: var(--pending); }
.raw { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.raw label { display: grid; gap: 4px; flex: 1; min-width: 260px; font-size: 12px; color: var(--muted); }
.raw textarea { font-family: var(--font-mono); font-size: 12px; color: var(--ink); }
pre { max-height: 320px; overflow: auto; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); font-size: 11px; }

/* ---------------------------------------------------------------- bibliothèque */
.selbar {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; background: var(--accent-soft); border-radius: 8px;
}
.selbar input.short { width: 7ch; }
.selbar input.wide { width: 28ch; font-family: var(--font-mono); font-size: 12px; }
.lib { display: grid; gap: 4px; }
.lib-row { display: grid; grid-template-columns: 34px repeat(8, minmax(0, 1fr)); gap: 4px; }
.lib-row .bn { border: 0; background: none; cursor: pointer; text-align: right; padding-right: 6px; font: 400 12px var(--font-mono); color: var(--muted); }
.lib-row .bn:hover { color: var(--accent); }
.cell {
  display: grid; gap: 1px; padding: 4px 6px; min-width: 0; text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
}
.cell .n { font: 400 10px var(--font-mono); color: var(--muted); }
.cell .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 500; }
.cell.unnamed { background: transparent; border-style: dashed; }
.cell.unnamed .nm { color: var(--muted); font-weight: 400; }
.cell.stale .nm { font-style: italic; }
.cell.dirty { box-shadow: inset 3px 0 0 var(--pending); }
.cell[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.cell.drop { outline: 2px solid var(--accent); }
.library .fold { width: 100%; margin: 2px 0; }

/* ---------------------------------------------------------------- système */
.sys { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.card { display: grid; gap: 4px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.card h4 { font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dotted var(--line); }
.kv span { color: var(--muted); }
.system > .muted { margin: 0; }

/* ---------------------------------------------------------------- modifications */
.tray { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.tray-h { display: grid; gap: 2px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); }
.tray-h h4 { font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase; }
.tray-h small { color: var(--muted); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px;
  background: var(--pending-soft); color: var(--pending); font: 600 12px/1 var(--font-mono); letter-spacing: 0; vertical-align: 2px;
}
.tray-list { overflow: auto; padding: 8px 10px; display: grid; gap: 12px; align-content: start; }
.tray-list .empty { margin: 4px; color: var(--muted); }
.t-group { display: grid; gap: 4px; }
.gh { justify-self: start; border: 0; background: none; padding: 0; cursor: pointer; font: 600 12px var(--font-mono); color: var(--muted); text-align: left; }
button.gh:hover { color: var(--accent); }
.t-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; padding: 6px 8px; border-radius: 4px; background: var(--pending-soft); font-size: 12px; }
.t-item .what { font-weight: 600; }
.t-item .diff { grid-column: 1; color: var(--muted); font-family: var(--font-mono); font-size: 11px; overflow-wrap: anywhere; }
.t-item .diff b { color: var(--ink); font-weight: 600; }
.t-item button { grid-row: 1 / 3; grid-column: 2; align-self: center; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; }
.t-item button:hover { color: var(--accent); }
.tray-f { display: grid; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.tray-f .btn { width: 100%; }
.tray-f small { font-size: 12px; }
.tray-f .link { justify-self: start; font-size: 13px; }
.tray-f .note { margin: 0; font-size: 12px; color: var(--muted); }
.progress { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.progress progress { width: 100%; }

/* ---------------------------------------------------------------- messages */
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; max-width: min(640px, calc(100% - 32px));
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border-radius: 8px;
  background: var(--ink); color: var(--panel); box-shadow: 0 10px 30px var(--shadow);
}
.toast.ok { background: var(--ok); }
.toast.warn { background: var(--warn); }
.toast.error { background: var(--bad); }
.toast .x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; }

/* ---------------------------------------------------------------- écrans étroits */
@media (max-width: 1100px) {
  .tray-list .empty, .tray-h small { display: none; }
  .body { grid-template-columns: 210px minmax(0, 1fr); }
  .tray { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: 40vh; }
  .app { grid-template-rows: auto minmax(0, 1fr); }
  .body { grid-template-rows: minmax(0, 1fr) auto; }
}
@media (max-width: 720px) {
  .body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto; }
  .side { max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top { flex-wrap: wrap; }
  .pill { max-width: 100%; }
  .lib-row { grid-template-columns: 26px repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .pair { transition: none; }
}

/* ---------------------------------------------------------------- ajouts : chaîne dessinée entrée à gauche, blocs, système */
.chain { flex-direction: row-reverse; justify-content: flex-end; }
.lane { flex-direction: row-reverse; justify-content: flex-end; min-height: 52px; }
.par { padding-top: 16px; }
.par .kind { position: absolute; top: 2px; left: 10px; font: 600 9px/1 var(--font-mono); letter-spacing: 0.08em; color: var(--muted); }
.par.separate { border-color: var(--led); }
.dry {
  display: grid; place-items: center; min-width: 50px; min-height: 48px; padding: 0 8px; border: 1px dashed var(--line);
  border-radius: var(--r); color: var(--muted); font-size: 11px;
}
.dry.drop { border-color: var(--accent); color: var(--accent); }
.mixers { font: 600 12px var(--font-mono); color: var(--muted); padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; }
.mixers.full { color: var(--led); border-color: var(--led); }
.loop-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.loop-menu .link { text-decoration: none; }
.sw.sys .fn { color: var(--ink); }
.sys-tag { font: 600 9px/1 var(--font-mono); font-style: normal; padding: 2px 4px; border-radius: 3px; background: var(--metal); color: var(--muted); letter-spacing: 0.06em; }
.note { margin: 0; font-size: 13px; color: var(--muted); }
.pill.idle .dot { background: var(--led); }
.files { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.p-row.missing .nm, .cell.missing .nm { color: var(--muted); }
.p-row.drop-before, .cell.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.p-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.cell.drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.cell.drop-after { box-shadow: inset -3px 0 0 var(--accent); }
.p-row.drop-swap, .cell.drop-swap { outline: 2px solid var(--accent); outline-offset: -2px; }
.subtabs { display: flex; gap: 2px; padding: 2px; margin-left: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.subtabs button { border: 0; background: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; color: var(--muted); font-weight: 600; }
.subtabs button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px var(--shadow); }
.ctl-table { border-collapse: collapse; width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.ctl-table th, .ctl-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
.ctl-table th { font: 600 12px var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ctl-table td.dirty select { border-color: var(--pending); box-shadow: 0 0 0 2px var(--pending-soft); }
.ctl-table select:disabled { opacity: 0.45; }
.pcmap { display: grid; gap: 12px; }
.pcmap .row2 label { display: flex; align-items: center; gap: 6px; }
.pc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 4px 10px; }
.pc { display: flex; align-items: center; justify-content: space-between; gap: 6px; font: 400 12px var(--font-mono); color: var(--muted); }
.pc input { width: 8ch; padding: 3px 6px; font-family: var(--font-mono); color: var(--ink); }
.pc.dirty input { border-color: var(--pending); box-shadow: 0 0 0 2px var(--pending-soft); }
.t-more { justify-self: start; border: 0; background: none; padding: 2px 0; color: var(--accent); cursor: pointer; font-size: 12px; }

/* ---------------------------------------------------------------- matière : la pédale */
.top, .side, .tray {
  background: linear-gradient(180deg, #1f2024 0%, var(--panel) 60%);
  border-color: #000;
}
.top { box-shadow: 0 1px 0 #2a2c31 inset, 0 1px 0 #000; }
.logo { font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.center { background:
  repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px),
  var(--bg); }
.btn { background: linear-gradient(180deg, #2d3035, var(--raised)); border-color: #000; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: linear-gradient(180deg, #5c9bf0, var(--accent)); border-color: #1b3f74; }
select, input:not([type]), input[type="number"], input[type="search"], textarea { background: var(--surface); border-color: var(--line); }
.tabs, .subtabs { background: #0e0f11; border-color: #000; }
.tabs button[aria-selected="true"], .subtabs button[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07) inset; }
.sect-h h4, .bank-h, .board .sep, .card h4, .ctl-table th { color: #c9cdd3; font-weight: 700; }

/* Chaîne et pédalier : zones encastrées, touches en relief, LED bleues */
.chain, .board { background: var(--metal); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), inset 0 0 0 1px #000; }
.loop, .jack, .sw {
  background: linear-gradient(180deg, #2b2d32, var(--raised));
  border-color: #000;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.07) inset, 0 2px 3px rgba(0, 0, 0, 0.5);
}
.loop.on { border-color: #1d4f9c; }
.loop .led { background: #0b1220; border-color: #000; }
.loop.on .led { background: var(--led-glow); border-color: var(--led); box-shadow: 0 0 6px 1px var(--led), 0 0 16px 2px rgba(61, 139, 255, 0.45); }
.loop .co.on { color: var(--led-glow); border-color: var(--led); }
.loop.dirty::after { border-color: var(--metal); }
.sw .tag { background: var(--led-soft); color: #cfe0ff; }
.custom { background: var(--led); box-shadow: 0 0 5px var(--led); }
.sys-tag { background: #2a3a46; color: #b9d2de; }
.par { border-color: #3a3d44; }
.par.separate { border-color: var(--steel); }
.mixers { border-color: var(--line); }
.mixers.full { color: var(--pending); border-color: var(--pending); }
.badge { background: rgba(76, 195, 138, 0.14); }
.pill.on .dot { box-shadow: 0 0 6px var(--ok); }
.pill.idle .dot { background: var(--pending); }

/* Afficheur de la pédale : numéro en 7 segments rouges, nom et tempo sur LCD bleu */
.display {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 8px;
  background: #050506; box-shadow: inset 0 0 0 1px #000, inset 0 3px 10px rgba(0, 0, 0, 0.9), 0 1px 0 #2a2c31;
}
.seg {
  min-width: 3.4ch; font: 700 38px/1 var(--font-mono); letter-spacing: 0.04em; color: var(--seg);
  text-shadow: 0 0 6px rgba(255, 45, 31, 0.75), 0 0 18px rgba(255, 45, 31, 0.35);
}
.lcd {
  display: grid; grid-template-columns: auto auto; align-items: center; gap: 0 18px; padding: 4px 12px; border-radius: 3px;
  background: linear-gradient(180deg, var(--lcd-hi), var(--lcd)); color: var(--lcd-ink);
  box-shadow: inset 0 0 12px rgba(0, 0, 20, 0.7);
  font-family: var(--font-lcd);
}
.lcd .p-name {
  width: calc(16ch + 16 * 0.04em + 16px); margin: 0; padding: 0 6px; /* 16 caractères + leur espacement */ border: 1px solid transparent; border-radius: 2px; background: none;
  color: var(--lcd-ink); font: 400 36px/1.1 var(--font-lcd); letter-spacing: 0.04em; text-transform: none;
  text-shadow: 0 0 4px rgba(200, 220, 255, 0.45);
}
.lcd .p-name:hover, .lcd .p-name:focus { border-color: rgba(223, 233, 255, 0.35); background: rgba(255, 255, 255, 0.04); }
.lcd .p-name.dirty { border-color: var(--pending); box-shadow: none; }
.lcd .tempo { display: flex; align-items: baseline; gap: 2px; font-size: 30px; text-shadow: 0 0 4px rgba(200, 220, 255, 0.45); }
.lcd .tempo input {
  width: 3.4ch; padding: 0 2px; border: 1px solid transparent; border-radius: 2px; background: none; color: var(--lcd-ink);
  font: 400 30px/1 var(--font-lcd); -moz-appearance: textfield;
}
.lcd .tempo input::-webkit-inner-spin-button { display: none; }
.lcd .tempo input:hover, .lcd .tempo input:focus { border-color: rgba(223, 233, 255, 0.35); }
.lcd .tempo.dirty input { border-color: var(--pending); }
.small { font-size: 12px; }
.pop a, .welcome a { color: var(--accent); }

/* ---------------------------------------------------------------- tailles : rien ne déborde de son conteneur */
.sw { grid-template-columns: minmax(0, 1fr); }
.sw > * { min-width: 0; }
.sw .tag, .sw .fn, .sw .slot { overflow-wrap: anywhere; }
.sw .slot { flex-wrap: wrap; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.display { flex-wrap: wrap; max-width: 100%; }
.lcd { min-width: 0; max-width: 100%; }
.patch > *, .library > *, .system > * { min-width: 0; }
@media (max-width: 720px) {
  .patch, .library, .system { padding: 14px 12px 32px; }
  .seg { font-size: 30px; }
  .lcd { grid-template-columns: minmax(0, 1fr); }
  .lcd .p-name { font-size: 26px; width: calc(16ch + 16 * 0.04em + 16px); max-width: 100%; }
  .lcd .tempo, .lcd .tempo input { font-size: 24px; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .sys { grid-template-columns: minmax(0, 1fr); }
  .selbar { position: static; }
}
.lcd .tempo input { width: calc(3ch + 10px); }
