:root {
  --bg: #e9ecf1;
  --panel: #ffffff;
  --face: #f3f4f7;          /* fondo de las fichas (como el gris de Windows) */
  --line: #c8ced8;
  --line-soft: #dde2e9;
  --text: #1d2633;
  --muted: #5e6b7c;
  --accent: #1f5fae;        /* azul Darby */
  --accent-soft: #e3edf9;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --ok: #1e7a3c;
  --warn-bg: #fff4d6;
  --input: #ffffff;
  --input-ro: #eef0f4;
  --input-key: #fff9e8;     /* cajas de búsqueda sin color propio */
  --input-req: #ffe6f0;     /* rosa Darby (backColorCajaAjena): el valor tiene que existir en la tabla */
  --input-free: #fceecc;    /* crema Darby (backColorCajaAjenaCarn): texto libre o elegido de la tabla */
  --row-alt: #f7f9fc;
  --row-hover: #eaf2fd;
  --row-sel: #d3e4fa;
  --shadow: 0 1px 2px rgba(16,24,40,.08), 0 2px 6px rgba(16,24,40,.06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.35 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ------------------------------------------------------------ login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 360px; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 28px 28px 24px; }
.login h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.login .logo { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.login p { margin: 0 0 20px; color: var(--muted); }
.login label { display: block; font-weight: 600; margin: 12px 0 4px; }
.login input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; background: #fff; }
.login input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.login button { margin-top: 20px; width: 100%; height: 38px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-weight: 600; }
.login .err { color: var(--danger); margin-top: 12px; min-height: 18px; }

/* ------------------------------------------------------------ barra superior */
.top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 10px;
       background: #17375f; color: #fff; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-right: 10px; white-space: nowrap; }
.brand .logo { width: 24px; height: 24px; border-radius: 5px; background: #fff; color: #17375f; display: grid; place-items: center; font-size: 14px; }
.brand small { font-weight: 500; opacity: .7; }
.menu { position: relative; }
.menu > button { height: 32px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: #fff; font-weight: 600; }
.menu > button:hover, .menu.open > button { background: rgba(255,255,255,.14); }
.menu-list { display: none; position: absolute; top: 36px; left: 0; min-width: 330px; max-height: calc(100vh - 60px); overflow: auto;
             background: #fff; color: var(--text); border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.22); padding: 6px; }
.menu.open .menu-list { display: block; }
.menu-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 5px; }
.menu-list button:hover, .menu-list button:focus-visible { background: var(--accent-soft); outline: none; }
.menu-list hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 4px; }
.wintabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; align-self: flex-end; scrollbar-width: thin; }
.wintab { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 12px; border-radius: 7px 7px 0 0;
          background: rgba(255,255,255,.12); color: #e8eef7; white-space: nowrap; cursor: pointer; border: 0; }
.wintab.active { background: var(--bg); color: var(--text); font-weight: 600; }
.wintab .x { border: 0; background: none; width: 20px; height: 20px; border-radius: 4px; color: inherit; opacity: .7; line-height: 1; }
.wintab .x:hover { background: rgba(0,0,0,.12); opacity: 1; }
.wintab .dot { width: 7px; height: 7px; border-radius: 50%; background: #f0b429; }
.right { display: flex; align-items: center; gap: 8px; margin-left: 8px; white-space: nowrap; }
.right select { height: 30px; border-radius: 6px; border: 1px solid rgba(255,255,255,.3); background: #22497a; color: #fff; padding: 0 6px; max-width: 220px; }
.right .user { opacity: .85; }
.right button { height: 30px; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; background: transparent; color: #fff; padding: 0 10px; }

/* ------------------------------------------------------------ escritorio */
.desk { padding: 12px; }
.welcome { max-width: 760px; margin: 40px auto; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 28px; }
.welcome h2 { margin: 0 0 6px; }
.welcome p { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 18px; }
.tiles button { text-align: left; border: 1px solid var(--line-soft); background: #fff; border-radius: 8px; padding: 10px 12px; }
.tiles button:hover { border-color: var(--accent); background: var(--accent-soft); }

.win { display: none; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.win.active { display: block; }
.win-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); background: #fafbfc; }
.win-title { font-weight: 700; font-size: 14px; letter-spacing: .3px; margin-right: 6px; text-transform: uppercase; color: #22334a; }
.tb { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tb button { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; display: inline-flex; align-items: center; gap: 6px; }
.tb button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.tb button:disabled { opacity: .45; cursor: default; }
.tb button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb button.primary:hover:not(:disabled) { color: #fff; filter: brightness(1.08); }
.tb button.danger:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.tb .sep { width: 1px; height: 22px; background: var(--line-soft); margin: 0 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; height: 28px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.pos { color: var(--muted); min-width: 70px; text-align: center; }
.stamp { margin-left: auto; color: var(--muted); font-size: 12px; display: flex; gap: 14px; }
.stamp b { color: var(--text); font-weight: 600; }
.msg { padding: 7px 12px; border-bottom: 1px solid var(--line-soft); }
.msg.err { background: #fde8e7; color: var(--danger); }
.msg.ok { background: #e6f4ea; color: var(--ok); }
.msg.warn { background: var(--warn-bg); color: #6b4e00; }

/* ------------------------------------------------------------ listado */
.list { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 320px; }
.list-bar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; }
.search { position: relative; flex: 0 1 420px; }
.search input { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px 0 30px; }
.search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.search svg { position: absolute; left: 9px; top: 9px; opacity: .5; }
.count { color: var(--muted); }
.tablewrap { flex: 1; overflow: auto; border-top: 1px solid var(--line-soft); }
table.dl { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.dl th { position: sticky; top: 0; background: #f1f3f6; text-align: left; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line);
              border-right: 1px solid var(--line-soft); white-space: nowrap; cursor: pointer; user-select: none; z-index: 1; }
table.dl th .ar { opacity: .6; margin-left: 4px; }
table.dl td { padding: 4px 8px; border-bottom: 1px solid var(--line-soft); border-right: 1px solid #eef1f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 1px; }
table.dl tbody tr:nth-child(even) td { background: var(--row-alt); }
table.dl tbody tr:hover td { background: var(--row-hover); cursor: pointer; }
table.dl tbody tr.sel td { background: var(--row-sel); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.more { padding: 10px; text-align: center; }
.more button { border: 1px solid var(--line); background: #fff; border-radius: 6px; height: 30px; padding: 0 14px; }

/* ------------------------------------------------------------ ficha (posiciones de Darby) */
.record { overflow: auto; height: calc(100vh - 140px); min-height: 320px; background: var(--face); }
.canvas { position: relative; margin: 10px; }
.c { position: absolute; }
.c-label { font-size: 11.5px; color: #2c394b; white-space: nowrap; overflow: visible; line-height: 1.2; padding-top: 2px; }
.c-frame { border: 1px solid var(--line); border-radius: 5px; }
.c-frame.noborder { border-color: transparent; }
.c-frame > .cap { position: absolute; top: -9px; left: 8px; padding: 0 4px; background: var(--face); font-size: 12px; font-weight: 600; color: #34465f; white-space: nowrap; }
.c-sstab { border: 1px solid var(--line); border-radius: 0 5px 5px 5px; background: #f9fafb; }
.c-field { border: 1px solid var(--line); border-radius: 4px; background: var(--input); padding: 0 5px; font-size: 11.5px; min-height: 20px; }
.c-field:focus { outline: 2px solid rgba(31,95,174,.25); border-color: var(--accent); z-index: 5; }
.c-field[readonly] { background: var(--input-ro); color: #44505f; }
.c-field.num { text-align: right; font-variant-numeric: tabular-nums; }
.c-field.lk { background: var(--input-key); padding-right: 18px; }
.c-field.lk.req { background: var(--input-req); }
.c-field.lk.free { background: var(--input-free); }
.c-field.lk.plain { background: var(--input); }
.c-field.lk[readonly], .c-field.lk.locked { background: var(--input-ro); }
.c-field.narrow { padding: 0 2px; }
.c-field.tiny { padding: 0 1px; text-align: center; }
.c-label.golink { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; cursor: pointer; }
.c-label.golink:hover { text-decoration-style: solid; }
.retbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; background: #e8f1fc; border-bottom: 1px solid #c7dbf3; font-size: 12.5px; }
.retbar b { font-weight: 600; }
.retbar button { border: 1px solid var(--line); background: #fff; border-radius: 5px; padding: 2px 10px; }
.retbar button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.tbmenu { position: relative; display: inline-block; }
.tbmenu > .menu-list { display: none; position: absolute; top: 100%; left: 0; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.16); min-width: 240px; padding: 4px 0; margin-top: 2px; }
.tbmenu.open > .menu-list { display: block; }
.tbmenu .menu-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 14px; white-space: nowrap; font-size: 12.5px; color: var(--text); }
.tbmenu .menu-list button:hover:not(:disabled) { background: var(--accent-soft); }
.tbmenu .menu-list button:disabled { color: #9aa3b1; cursor: default; }
.tbmenu .menu-list button.on::before { content: "✓ "; }
.tbmenu .menu-list .grp { padding: 6px 14px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.tbmenu .menu-list hr { border: 0; border-top: 1px solid var(--line-soft); margin: 4px 0; }
.listfilter { margin-left: 8px; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 1px 4px 1px 9px; display: inline-flex; gap: 4px; align-items: center; }
.listfilter button { border: 0; background: none; color: var(--accent); padding: 0 4px; }
.c-field.changed { box-shadow: inset 3px 0 0 #f0b429; }
.c-field[type=date] { padding: 0 2px 0 4px; }
.c-memo { border: 1px solid var(--line); border-radius: 4px; background: #fff; padding: 4px 6px; resize: none; font-size: 12px; }
.c-check { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.c-check input { margin: 0; width: 15px; height: 15px; accent-color: var(--accent); }
.c-tabbtn { border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; background: #e6e9ee; font-size: 12px; padding: 0 6px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #34465f; }
.c-tabbtn.on { background: #f9fafb; color: var(--accent); font-weight: 700; box-shadow: inset 0 2px 0 var(--accent); }
.c-img { border: 1px dashed var(--line); border-radius: 4px; display: grid; place-items: center; color: var(--muted); font-size: 11px; background: #fff; }
.lkclear { position: absolute; width: 16px; height: 16px; border: 0; background: none; color: #8a94a3; font-size: 13px; line-height: 16px; padding: 0; z-index: 6; }
.lkclear:hover { color: var(--danger); }
.dropdown { position: fixed; z-index: 100; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
            max-height: 280px; overflow: auto; min-width: 260px; font-size: 12px; }
.dropdown .it { padding: 5px 9px; cursor: pointer; display: flex; gap: 10px; white-space: nowrap; }
.dropdown .it.on, .dropdown .it:hover { background: var(--accent-soft); }
.dropdown .it .k { color: var(--muted); min-width: 64px; }
.dropdown .empty { padding: 8px 10px; color: var(--muted); }

/* rejillas */
.c-grid { border: 1px solid var(--line); border-radius: 4px; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.c-grid .gscroll { overflow: auto; flex: 1; }
.c-grid table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 12px; }
.c-grid th { position: sticky; top: 0; background: #eef1f5; font-weight: 600; text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line);
             border-right: 1px solid var(--line-soft); white-space: nowrap; z-index: 1; }
.c-grid td { border-bottom: 1px solid #edf0f4; border-right: 1px solid #f1f3f6; padding: 0; height: 22px; white-space: nowrap; }
.c-grid td.ro { background: #f6f7f9; color: #3f4b5b; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; max-width: 1px; }
.c-grid td.lk input { background: var(--input-key); }
.c-grid td input { width: 100%; height: 21px; border: 0; padding: 0 6px; background: transparent; font-size: 12px; }
.c-grid td input:focus { outline: 2px solid rgba(31,95,174,.35); outline-offset: -2px; background: #fff; }
.c-grid td.num, .c-grid td.num input { text-align: right; font-variant-numeric: tabular-nums; }
.c-grid td.ck { text-align: center; }
.c-grid td.act { width: 22px; text-align: center; background: #fafbfc; }
.c-grid td.act button { border: 0; background: none; color: #9aa3b1; width: 20px; height: 20px; padding: 0; }
.c-grid td.act button:hover { color: var(--danger); }
.c-grid tfoot td { position: sticky; bottom: 0; background: #eef1f5; font-weight: 600; padding: 0 6px; border-top: 1px solid var(--line); }
.c-grid .gfoot { display: flex; align-items: center; gap: 8px; padding: 2px 6px; border-top: 1px solid var(--line-soft); background: #fafbfc; font-size: 11px; color: var(--muted); }
.c-grid .gfoot button { border: 1px solid var(--line); background: #fff; border-radius: 4px; height: 20px; font-size: 11px; padding: 0 8px; }
.c-grid .gerr { padding: 8px; color: var(--muted); font-size: 12px; }
.c-gridmissing { border: 1px dashed var(--line); border-radius: 4px; display: grid; place-items: center; color: var(--muted); font-size: 12px; background: #fff; text-align: center; padding: 6px; }

.loading { padding: 24px; color: var(--muted); }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 200; background: #22334a; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; }
.toast.err { background: var(--danger); }

@media (max-width: 760px) {
  .brand small, .right .user { display: none; }
  .stamp { display: none; }
}

/* ------------------------------------------------------------ menús y bienvenida */
.welcome h3 { margin: 18px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.c-budget { overflow: auto; padding: 8px; background: var(--panel); border: 1px solid var(--line-soft); }
.c-budget .tb { margin-bottom: 8px; }
.muted { color: var(--muted); }
.err { color: var(--danger); }

/* ------------------------------------------------------------ presupuesto en árbol (presupuesto.js) */
.budget .bw-ver { color: var(--muted); margin-right: 8px; }
.budget .tb select { height: 30px; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 280px; }
.budget .tb button.on { background: var(--accent-soft); color: var(--accent); }
.bw-body { padding: 0; }
.bw-empty { padding: 20px; color: var(--muted); }
.bw-totals { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); background: #fafbfc; }
.bw-totals .kv { display: flex; flex-direction: column; }
.bw-totals .kv span { font-size: 11px; color: var(--muted); }
.bw-totals .kv b { font-variant-numeric: tabular-nums; }
.bw-totals .kv.big b { font-size: 16px; color: var(--accent); }
.bw-split { display: grid; grid-template-columns: minmax(420px, 1.25fr) minmax(380px, 1fr); min-height: 60vh; }
@media (max-width: 1100px) { .bw-split { grid-template-columns: 1fr; } }
.bw-tree { border-right: 1px solid var(--line-soft); overflow: auto; max-height: calc(100vh - 230px); }
.bw-detail { overflow: auto; max-height: calc(100vh - 230px); background: var(--face); }
.bw-grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.bw-grid th { position: sticky; top: 0; background: #eef1f5; text-align: left; font-weight: 600; padding: 5px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.bw-grid td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.bw-grid .num { text-align: right; }
.bw-grid td.nm { white-space: normal; min-width: 180px; }
.bw-grid tr.cap td { background: #f4f6fa; font-weight: 600; cursor: pointer; }
.bw-grid tr.tag td { cursor: pointer; }
.bw-grid tr:hover td { background: var(--row-hover); }
.bw-grid tr.sel td { background: var(--row-sel); }
.bw-grid tr.auto td { color: var(--muted); font-style: italic; }
.bw-grid td.fija { color: #8a4b00; font-weight: 600; }
.bw-grid tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #fafbfc; }
.bw-grid input { width: 100%; min-width: 60px; height: 24px; border: 1px solid transparent; border-radius: 3px; background: transparent; padding: 0 4px; }
.bw-grid input:hover { border-color: var(--line); background: #fff; }
.bw-grid input:focus { border-color: var(--accent); background: #fff; outline: none; }
.bw-grid input.num { text-align: right; }
.bw-grid.small td, .bw-grid.small th { padding: 2px 4px; font-size: 12px; }
.bw-grid .tg { border: 0; background: none; width: 16px; padding: 0; color: var(--muted); }
.bw-grid td.act button { border: 0; background: none; color: #9aa3b1; width: 20px; height: 20px; padding: 0; }
.bw-grid td.act button:hover { color: var(--danger); }
.bw-add { padding: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bw-add button, .bw-btn { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.bw-add button:hover, .bw-btn:hover { border-color: var(--accent); color: var(--accent); }
.bw-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.warnx { color: #8a4b00; }
.bw-hint { padding: 24px; }
.bw-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.bw-card h3 { margin: 0; font-size: 14px; color: #22334a; }
.bw-card h4 { margin: 4px 0; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .3px; }
.bw-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
.bw-f { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.bw-f.grow { flex: 1; }
.bw-f input, .bw-f output { height: 26px; border: 1px solid var(--line); border-radius: 4px; background: var(--input); padding: 0 6px; font-size: 13px; color: var(--text); min-width: 90px; }
.bw-f output { display: inline-flex; align-items: center; justify-content: flex-end; background: var(--input-ro); }
.bw-f input.num { text-align: right; }
.bw-f input.ro, .bw-grid input.ro, input.ro { background: var(--input-ro); color: var(--muted); }
.bw-f input.lk, .bw-grid input.lk { background: var(--input-key); }
.bw-ck { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; height: 26px; }
.w6 { width: 70px; } .w8 { width: 90px; } .w10 { width: 120px; } .w30 { width: 320px; } .w40 { width: 100%; min-width: 260px; } .w100 { width: 100%; }
.bw-sub { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 6px; padding: 6px; }
.gscroll { overflow: auto; }
.bw-k { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); background: #fbfcfe; display: flex; flex-direction: column; gap: 8px; }
.bw-ktab { border-collapse: collapse; }
.bw-ktab th, .bw-ktab td { padding: 2px 6px; text-align: right; }
.bw-ktab th:first-child { text-align: left; font-weight: 600; }
.bw-ktab input { width: 90px; height: 24px; border: 1px solid var(--line); border-radius: 4px; text-align: right; padding: 0 4px; }
.bw-ktab td.num { font-variant-numeric: tabular-nums; min-width: 90px; }
.bw-modal { position: fixed; inset: 0; background: rgba(16,24,40,.35); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow: auto; }
.bw-dialog { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: min(560px, 100%); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.bw-dialog.wide { width: min(1100px, 100%); }
.bw-dialog > input[type=search] { height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; }
.bw-dh { display: flex; justify-content: space-between; align-items: center; }
.bw-dh button { border: 0; background: none; font-size: 20px; color: var(--muted); }
.bw-picklist { max-height: 55vh; overflow: auto; display: flex; flex-direction: column; }
.bw-picklist button { text-align: left; border: 0; border-bottom: 1px solid var(--line-soft); background: none; padding: 7px 6px; }
.bw-picklist button:hover { background: var(--accent-soft); }
.bw-meds { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow: auto; }
.bw-med { border: 1px solid var(--line-soft); border-radius: 6px; padding: 6px; }
.bw-med .bw-row input, .bw-med .bw-row select { height: 26px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.bw-med.ro { color: var(--muted); }
.bw-foot { border-top: 1px solid var(--line-soft); padding-top: 8px; }
.bw-grid.small td.nm { min-width: 130px; }
.bw-grid.small input { min-width: 46px; }
.bw-grid.small input.w100 { min-width: 110px; }
.bw-treebar { background: #fafbfc; border-bottom: 1px solid var(--line-soft); }
.bw-treebar button:disabled { opacity: .45; cursor: default; }
.bw-treebar .sep { width: 1px; height: 22px; background: var(--line-soft); }
.bw-rowact { display: none; margin-left: 8px; gap: 4px; }
.bw-grid tr.cap:hover .bw-rowact, .bw-grid tr.cap.sel .bw-rowact { display: inline-flex; }
.bw-rowact button { border: 1px solid var(--line); background: #fff; border-radius: 4px; font-size: 11px; font-weight: 400; padding: 0 6px; height: 20px; }
.bw-rowact button:hover { border-color: var(--accent); color: var(--accent); }
.bw-texto { width: 100%; min-height: 80px; border: 1px solid var(--line); border-radius: 4px; padding: 6px; font: 13px/1.4 var(--font); color: var(--text); resize: vertical; background: var(--input); }
.bw-texto[readonly] { background: var(--input-ro); }
.bw-col { display: flex; flex-direction: column; gap: 4px; }

/* ------------------------------------------------------------ diálogos de Opciones (opciones.js) */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.35); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 80; overflow: auto; }
.modal { background: var(--panel); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.25); width: min(640px, 100%); display: flex; flex-direction: column; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.modal-h .x { border: 0; background: none; font-size: 18px; color: var(--muted); }
.modal-b { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow: auto; }
.modal-b .row { display: flex; align-items: center; gap: 8px; }
.modal-b ol.cols { margin: 0; padding-left: 22px; columns: 2; font-size: 12px; color: #34465f; }
.modal-b .muted { color: var(--muted); margin: 0; }
.modal-b table.dl { width: 100%; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line-soft); }
.modal-f button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 14px; }
.modal-f button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.c-img.foto { background-size: cover; background-position: center; color: transparent; border-style: solid; }
