/* Avisos apilados y cuadros de dialogo (ver js/ui/notify.js) */

#nt-stack {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 1200;
  display: flex; flex-direction: column; gap: 0.5rem; width: min(380px, calc(100vw - 2rem)); pointer-events: none;
}
.nt {
  --c: #34d399;
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.7rem; align-items: start; pointer-events: auto;
  background: rgba(17, 22, 30, 0.97); color: #eef2f7;
  border: 1px solid rgba(255, 255, 255, 0.1); border-left: 4px solid var(--c); border-radius: 10px;
  padding: 0.7rem 0.6rem 0.7rem 0.8rem; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  animation: nt-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.nt-info { --c: #38bdf8; }
.nt-warn { --c: #fbbf24; }
.nt-error { --c: #f87171; }
.nt-progress { --c: #ff9d1f; }
.nt.is-leaving { opacity: 0; transform: translateX(16px); transition: opacity 0.25s, transform 0.25s; }
.nt-ico { width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nt-spinner { width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2.5px solid rgba(255, 157, 31, 0.25); border-top-color: var(--c); animation: nt-spin 0.8s linear infinite; }
.nt-text { display: grid; gap: 0.15rem; min-width: 0; }
.nt-text strong { font-size: 0.86rem; font-weight: 700; line-height: 1.3; }
.nt-text span { font-size: 0.78rem; color: #9aa8ba; line-height: 1.4; overflow-wrap: anywhere; }
.nt-close { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: #7c8aa0; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.nt-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
@keyframes nt-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes nt-spin { to { transform: rotate(360deg); } }
@media (max-width: 700px) { #nt-stack { right: 0.75rem; left: 0.75rem; bottom: 0.75rem; width: auto; } }

.dlg-backdrop {
  position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; padding: 1rem;
  background: rgba(5, 7, 11, 0.72); backdrop-filter: blur(3px); animation: dlg-fade 0.16s ease both;
}
.dlg-backdrop.is-leaving { opacity: 0; transition: opacity 0.16s; }
.dlg {
  width: min(520px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto;
  background: linear-gradient(180deg, #171d27, #10151c); color: #eef2f7;
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px; box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
  animation: dlg-pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.dlg-head { display: flex; align-items: center; gap: 0.7rem; padding: 1.1rem 1.25rem 0.4rem; --c: #38bdf8; }
.dlg-head h2 { font-size: 1.08rem; line-height: 1.25; font-weight: 800; letter-spacing: -0.01em; }
.dlg-head .nt-ico { width: 24px; height: 24px; stroke: var(--c); flex: none; margin: 0; }
.dlg-error { --c: #f87171; }
.dlg-warn, .dlg-danger { --c: #fbbf24; }
.dlg-success { --c: #34d399; }
.dlg-body { padding: 0.4rem 1.25rem 0.9rem; display: grid; gap: 0.7rem; color: #b6c2d1; font-size: 0.9rem; line-height: 1.55; }
.dlg-body p { margin: 0; }
.dlg-items { margin: 0; padding: 0.6rem 0.8rem 0.6rem 1.7rem; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 8px; display: grid; gap: 0.25rem; font-size: 0.84rem; color: #d7dfea; }
.dlg-details { border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 8px; background: rgba(0, 0, 0, 0.22); }
.dlg-details summary { cursor: pointer; padding: 0.5rem 0.8rem; font-size: 0.78rem; font-weight: 700; color: #8b9ab0; }
.dlg-details pre { margin: 0; padding: 0 0.8rem 0.7rem; font: 0.74rem/1.5 Consolas, "Courier New", monospace; color: #9aa8ba; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; }
.dlg-field { padding: 0 1.25rem 0.9rem; display: grid; gap: 0.35rem; }
.dlg-field label { font-size: 0.78rem; font-weight: 700; color: #94a3b8; }
.dlg-field input { min-height: 42px; background: #0a0d12; color: #eef2f7; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 8px; padding: 0 0.8rem; font: inherit; }
.dlg-field input:focus { outline: 2px solid #38bdf8; outline-offset: 1px; }
.dlg-counter { font-size: 0.7rem; color: #6b7a8e; text-align: right; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.9rem 1.25rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.dlg-btn { min-height: 38px; padding: 0 1.1rem; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05); color: #eef2f7; font: inherit; font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.dlg-btn:hover:not(:disabled) { border-color: #ff9d1f; }
.dlg-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.dlg-primary { background: linear-gradient(135deg, #ffae3d, #f07a00); color: #1a1005; border-color: transparent; }
.dlg-danger { background: linear-gradient(135deg, #f87171, #dc2626); color: #fff; border-color: transparent; }
.dlg-btn:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
@keyframes dlg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlg-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .nt, .dlg, .dlg-backdrop, .nt-spinner { animation: none !important; } }
@media (pointer: coarse) { .dlg-btn { min-height: 44px; } }

/* Ayudas al pasar el cursor (js/ui/tooltips.js) y luz de actividad MIDI */
#ui-tip {
  position: fixed; z-index: 1400; max-width: 260px; padding: 0.45rem 0.65rem; pointer-events: none;
  background: #0b0f15; color: #dbe4f0; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px;
  font-size: 0.75rem; line-height: 1.4; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  opacity: 0; transform: translateY(3px); transition: opacity 0.12s, transform 0.12s;
}
#ui-tip.show { opacity: 1; transform: none; }

.midi-led {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0 0.5rem; height: 30px; cursor: default;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; color: var(--text-muted, #7c8aa0);
}
.midi-led i {
  width: 9px; height: 9px; border-radius: 50%; background: #2a3342; transition: background 0.08s, box-shadow 0.08s;
}
.midi-led.out i { background: #ff9d1f; box-shadow: 0 0 8px 1px #ff9d1f; }
.midi-led.in i { background: #38bdf8; box-shadow: 0 0 8px 1px #38bdf8; }

.dlg-choices { padding: 0 1.25rem 0.9rem; display: grid; gap: 0.4rem; max-height: 280px; overflow-y: auto; }
.dlg-choice { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.6rem 0.75rem; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 9px; cursor: pointer; }
.dlg-choice:hover { border-color: #ff9d1f; }
.dlg-choice:has(input:checked) { border-color: #ff9d1f; background: rgba(255, 157, 31, 0.08); }
.dlg-choice input { margin-top: 0.25rem; accent-color: #ff9d1f; }
.dlg-choice strong { display: block; font-size: 0.88rem; color: #eef2f7; }
.dlg-choice small { color: #8b9ab0; font-size: 0.76rem; }
.dlg-body a { color: #38bdf8; font-weight: 700; }
.dlg { overflow-x: hidden; scrollbar-color: #3a4558 transparent; scrollbar-width: thin; }
.dlg-body { overflow-wrap: anywhere; }

/* Barra para instalar la app (PWA) */
#pwa-bar {
  position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; gap: 0.8rem; padding: 0.55rem 1rem;
  background: linear-gradient(90deg, rgba(255, 157, 31, 0.16), rgba(34, 211, 238, 0.1)), #10151c;
  border-bottom: 1px solid rgba(255, 157, 31, 0.4); color: #eef2f7;
  transform: translateY(-100%); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease;
}
#pwa-bar.show { transform: none; opacity: 1; }
#pwa-bar .pwa-ico { color: #ffb23f; display: grid; place-items: center; flex: none; }
#pwa-bar .pwa-text { display: grid; gap: 0.1rem; flex: 1; min-width: 0; font-size: 0.8rem; }
#pwa-bar .pwa-text strong { font-size: 0.86rem; }
#pwa-bar .pwa-text span { color: #9aa8ba; }
#pwa-bar .pwa-actions { display: flex; gap: 0.5rem; flex: none; }
#pwa-bar button { min-height: 34px; padding: 0 1rem; border-radius: 8px; font: inherit; font-size: 0.8rem; font-weight: 800; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06); color: #eef2f7; }
#pwa-bar .pwa-install { background: linear-gradient(135deg, #ffae3d, #f07a00); color: #1a1005; border-color: transparent; }
#pwa-bar button:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
@media (max-width: 640px) { #pwa-bar { flex-wrap: wrap; } #pwa-bar .pwa-actions { width: 100%; justify-content: flex-end; } }
@media (display-mode: standalone) { #pwa-bar { display: none; } }

.dlg-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dlg-links a { padding: 0.4rem 0.8rem; border-radius: 999px; background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.4); text-decoration: none; font-size: 0.82rem; }
.dlg-links a:hover { background: rgba(56, 189, 248, 0.22); }

/* ---- Cabinas propias (User IR) ---- */
.irm { max-width: 760px; width: calc(100vw - 2rem); }
.irm-body { display: grid; gap: 0.9rem; max-height: calc(100vh - 150px); overflow-y: auto; }
.irm-nam { padding: 0.7rem 0.9rem; border-radius: 12px; background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.4); font-size: 0.82rem; color: #d8c28a; }
.irm-nam strong { display: flex; align-items: center; gap: 0.4rem; color: #fcd34d; margin-bottom: 0.25rem; }
.irm-nam p { margin: 0; line-height: 1.5; } .irm-nam b { color: #fff; }
.irm-warn { margin: 0; padding: 0.55rem 0.8rem; border-radius: 10px; background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.4); color: #fecaca; font-size: 0.82rem; }
.irm-sec { display: grid; gap: 0.6rem; }
.irm-bar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.irm-bar input[type=search] { flex: 1; min-width: 150px; min-height: 36px; padding: 0 0.7rem; border-radius: 8px; border: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.35); color: var(--text-main); font: inherit; font-size: 0.82rem; }
.irm-btn { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 36px; padding: 0 0.9rem; border-radius: 9px; border: 1px solid var(--border-subtle); background: rgba(255, 255, 255, 0.05); color: var(--text-main); font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.irm-btn:hover:not(:disabled) { border-color: rgba(255, 157, 31, 0.6); }
.irm-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.irm-primary { background: linear-gradient(135deg, #ffae3d, #f07a00); color: #1a1005; border-color: transparent; }
.irm-chk { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; color: var(--text-muted); cursor: pointer; }
.irm-progress { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.irm-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #a3e635, #22d3ee, #818cf8); transition: width 0.15s ease; }
.irm-table-wrap { max-height: 230px; overflow: auto; border: 1px solid var(--border-subtle); border-radius: 10px; }
.irm-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.irm-table th { position: sticky; top: 0; background: #131923; text-align: left; padding: 0.4rem 0.6rem; font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.irm-table td { padding: 0.35rem 0.6rem; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.irm-none { color: var(--text-dim); }
.irm-del { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer; }
.irm-del:hover:not(:disabled) { color: #f87171; border-color: rgba(248, 113, 113, 0.5); }
.irm-col { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.3rem 0.6rem; max-height: 260px; overflow: auto; }
.irm-col-row { display: grid; grid-template-columns: 2rem 1fr auto; align-items: center; gap: 0.4rem; padding: 0.25rem 0.5rem; border-radius: 8px; background: rgba(255, 255, 255, 0.03); font-size: 0.8rem; min-height: 32px; }
.irm-col-row b { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.irm-col-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irm-view { padding: 0.2rem 0.55rem; border-radius: 7px; border: 1px solid var(--border-subtle); background: transparent; color: var(--text-muted); font-size: 0.72rem; cursor: pointer; }
.irm-view:hover:not(:disabled) { color: #22d3ee; border-color: rgba(34, 211, 238, 0.5); }
.irm-resp { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border-subtle); }
.irm-nam-out { width: 100%; box-sizing: border-box; resize: vertical; padding: 0.5rem; border-radius: 10px; border: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.3); color: var(--text-muted); font: 0.68rem/1.4 ui-monospace, Consolas, monospace; }
.irm-hint { margin: 0; font-size: 0.75rem; color: var(--text-dim); min-height: 1em; }
.irm-drop { display: grid; gap: 0.25rem; place-items: center; text-align: center; padding: 1.1rem; border-radius: 12px; border: 1.5px dashed rgba(255, 157, 31, 0.45); background: rgba(0, 0, 0, 0.25); cursor: pointer; color: var(--text-main); }
.irm-drop:hover, .irm-drop:focus-visible { border-color: #ffae3d; background: rgba(255, 157, 31, 0.06); outline: none; }
.irm-drop b { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.88rem; }
.irm-drop small { color: var(--text-dim); }
#irm-canvas { width: 100%; height: 72px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); }
.irm-notes { margin: 0; padding-left: 1.1rem; font-size: 0.76rem; color: var(--text-muted); display: grid; gap: 0.15rem; }
.irm-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.7rem; }
.irm-form label { display: grid; gap: 0.3rem; font-size: 0.78rem; font-weight: 700; color: var(--text-muted); }
.irm-form small { font-weight: 400; color: var(--text-dim); }
.irm-form input, .irm-form select { min-height: 36px; padding: 0 0.6rem; border-radius: 8px; border: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.35); color: var(--text-main); font: inherit; font-size: 0.82rem; }
.irm-opts { display: flex; gap: 1rem; flex-wrap: wrap; }
.irm-actions { display: flex; justify-content: flex-end; }
