/* OVERMANAGING — panel de ajustes de equilibrio (modo desarrollador, F9). */
.owd, .owd-badge {
  --owd-bg: #150e2c;
  --owd-card: #1d1440;
  --owd-card2: #241a4f;
  --owd-line: rgba(255, 255, 255, 0.11);
  --owd-text: #ece7ff;
  --owd-muted: #a99fd0;
  --owd-accent: #ffd23f;
  --owd-live: #7cff9b;
  --owd-rst: #9fc4ff;
  --owd-bad: #ff5d73;
  --owd-mod: rgba(255, 210, 63, 0.13);
  --owd-font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --owd-mono: ui-monospace, "SF Mono", Consolas, "DejaVu Sans Mono", monospace;
  font-family: var(--owd-font);
  color: var(--owd-text);
}
html.owd-lock, html.owd-lock body { overflow: hidden; }
.owd[hidden], .owd-badge[hidden], .owd [hidden], .owd-badge [hidden] { display: none !important; }
.owd { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.owd-backdrop { position: absolute; inset: 0; background: rgba(6, 3, 16, 0.62); backdrop-filter: blur(2px); }
.owd-panel {
  position: relative;
  display: flex; flex-direction: column;
  width: min(1180px, calc(100vw - 24px));
  height: min(800px, calc(100vh - 24px));
  background: var(--owd-bg);
  border: 1px solid rgba(160, 120, 255, 0.35);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 13px; line-height: 1.35;
  outline: none;
  overflow: hidden;
}

/* cabecera */
.owd-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px 6px; }
.owd-title { font-size: 17px; font-weight: 700; letter-spacing: 0.01em; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owd-gear { color: var(--owd-accent); }
.owd-title .owd-sub { font-size: 12px; font-weight: 500; color: var(--owd-muted); margin-left: 6px; }
.owd-counter { font-size: 12px; color: var(--owd-muted); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--owd-line); white-space: nowrap; }
.owd-counter.on { color: #1a1033; background: var(--owd-accent); border-color: var(--owd-accent); font-weight: 700; }
.owd-x { all: unset; cursor: pointer; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--owd-muted); font-size: 16px; }
.owd-x:hover, .owd-x:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; }
.owd-note { margin: 0; padding: 0 16px 10px; color: var(--owd-muted); font-size: 12px; }
.owd-tag { display: inline-block; font-size: 11px; font-weight: 700; }
.owd-tag.live { color: var(--owd-live); }
.owd-tag.rst { color: var(--owd-rst); }

/* pestañas */
.owd-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--owd-line); }
.owd-tab {
  all: unset; cursor: pointer; padding: 8px 14px 9px; border-radius: 9px 9px 0 0;
  color: var(--owd-muted); font-weight: 600; font-size: 13px; border: 1px solid transparent; border-bottom: none; margin-bottom: -1px;
}
.owd-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.owd-tab:focus-visible { outline: 2px solid var(--owd-accent); outline-offset: -2px; }
.owd-tab.on { color: #fff; background: var(--owd-card); border-color: var(--owd-line); box-shadow: inset 0 2px 0 var(--owd-accent); }

/* cuerpo con scroll interno */
.owd-body { flex: 1; overflow: auto; padding: 14px 16px 16px; background: linear-gradient(180deg, var(--owd-card) 0, var(--owd-bg) 260px); overscroll-behavior: contain; }
.owd-body::-webkit-scrollbar { width: 10px; height: 10px; }
.owd-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.owd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(500px, 1fr)); gap: 12px; align-items: start; }
.owd-card { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--owd-line); border-radius: 12px; padding: 10px 12px 6px; }
.owd-card h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--owd-accent); }
.owd-row {
  display: grid; grid-template-columns: 1fr auto 52px; align-items: center; gap: 4px 10px;
  padding: 6px 8px; margin: 0 -8px; border-radius: 8px; border-left: 3px solid transparent;
}
.owd-row + .owd-row { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.owd-row:hover { background: rgba(255, 255, 255, 0.03); }
.owd-row.mod, .owd-table td.mod { background: var(--owd-mod); border-left-color: var(--owd-accent); }
.owd-labtop { display: flex; align-items: baseline; gap: 6px; }
.owd-name { font-weight: 600; color: #fff; }
.owd-help { color: var(--owd-muted); font-size: 11.5px; margin-top: 1px; }
.owd-unit { color: var(--owd-muted); font-family: var(--owd-mono); font-size: 11.5px; }

/* editores */
.owd-ed { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.owd-in {
  width: 78px; box-sizing: border-box; padding: 5px 7px; border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16); background: #0d081d; color: #fff;
  font: 600 13px/1.2 var(--owd-mono); text-align: right; outline: none;
}
.owd-in:focus { border-color: var(--owd-accent); box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.18); }
.owd-in:disabled { opacity: 0.35; }
.owd-in.bad { border-color: var(--owd-bad); box-shadow: 0 0 0 3px rgba(255, 93, 115, 0.22); color: #ffc2cb; }
.mod > .owd-ed .owd-in, .mod .owd-ed .owd-in { color: var(--owd-accent); }
.owd-text { width: 100%; text-align: left; font-family: var(--owd-font); font-weight: 500; }
.owd-ed.owd-t-text { justify-content: stretch; }
.owd-t-tuple .owd-in { width: 62px; }
.owd-sub { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.owd-sublbl { font-size: 10px; color: var(--owd-muted); line-height: 1; }
.owd-reset {
  all: unset; cursor: pointer; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px;
  color: var(--owd-accent); font-size: 14px; visibility: hidden;
}
.mod > .owd-ed > .owd-reset, .mod .owd-ed > .owd-reset { visibility: visible; }
.owd-reset:hover { background: rgba(255, 210, 63, 0.18); }
.owd-color { width: 44px; height: 26px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 6px; background: none; cursor: pointer; }
.owd-switch { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; }
.owd-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.owd-knob { position: absolute; inset: 0; border-radius: 999px; background: #3a3160; transition: background 0.15s; pointer-events: none; }
.owd-knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #cfc6ef; transition: transform 0.15s; }
.owd-switch input:checked + .owd-knob { background: #2f9e5a; }
.owd-switch input:checked + .owd-knob::after { transform: translateX(16px); background: #fff; }
.owd-switch input:focus-visible + .owd-knob { outline: 2px solid var(--owd-accent); outline-offset: 2px; }

/* tablas de dificultades y niveles */
.owd-tablewrap { overflow: visible; }
.owd-table { font-size: 13px; width: 100%; min-width: 1040px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.owd-table th, .owd-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; text-align: right; }
.owd-table thead th { position: sticky; top: -14px; z-index: 2; background: #1f1645; font-weight: 700; color: #fff; font-size: 12.5px; border-bottom: 1px solid var(--owd-line); }
.owd-table .owd-corner, .owd-table .owd-rowhead { text-align: left; width: 230px; }
.owd-table .owd-corner { color: var(--owd-muted); font-weight: 600; }
.owd-table .owd-rowhead { font-weight: normal; }
.owd-table .owd-rowhead .owd-unit { margin-left: auto; }
.owd-table tbody tr:hover > * { background-color: rgba(255, 255, 255, 0.025); }
.owd-table td { position: relative; border-left: 3px solid transparent; padding-right: 20px; }
.owd-table td .owd-reset { position: absolute; right: 1px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; font-size: 13px; }
.owd-table td .owd-t-tuple .owd-in { width: 52px; }
.owd-table td .owd-t-tuple { gap: 4px; }
.owd-table td .owd-ed { justify-content: flex-end; flex-wrap: nowrap; }
.owd-table td .owd-ed.owd-t-text { justify-content: stretch; }
.owd-colhead { line-height: 1.25; vertical-align: bottom !important; }
.owd-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3); }
.owd-num { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px; border-radius: 50%; background: var(--owd-accent); color: #1a1033; font-size: 11px; }
.owd-cur { display: block; width: fit-content; margin: 3px 0 0 auto; padding: 1px 6px; border-radius: 999px; background: rgba(124, 255, 155, 0.16); color: var(--owd-live); font-size: 10px; font-weight: 700; vertical-align: 1px; }
.owd-ed.owd-t-tasks { flex-direction: column; align-items: stretch; gap: 2px; position: relative; padding-right: 0; }
.owd-rec { display: flex; align-items: center; gap: 5px; font-size: 11.5px; cursor: pointer; color: #e6e0ff; }
.owd-rec .owd-cb { margin: 0; accent-color: #7cff9b; }
.owd-recname { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owd-lanes { display: inline-flex; gap: 1px; width: 20px; flex: none; }
.owd-lanes i { width: 6px; height: 10px; border-radius: 2px; }
.owd-lanes .ln-budget { background: #ffb02e; }
.owd-lanes .ln-plan { background: #4da3ff; }
.owd-lanes .ln-report { background: #3ddc84; }
.owd-lanes .ln-call { background: #ff7aa2; }
.owd-lanes .ln-one2one { background: #c49bff; }
.owd-in.owd-w { width: 34px; padding: 2px 5px; font-size: 12px; }

/* exportar / importar */
.owd-io { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.owd-iohead { display: flex; align-items: center; gap: 12px; }
.owd-iohead h3 { margin: 0; font-size: 15px; color: #fff; }
.owd-iointro { margin: 0; color: var(--owd-muted); }
.owd-iointro code, .owd-note code { font-family: var(--owd-mono); color: #fff; }
.owd-ta {
  flex: 1; min-height: 260px; resize: none; box-sizing: border-box; width: 100%; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--owd-line); background: #0b0718; color: #d7ffe0;
  font: 12px/1.5 var(--owd-mono); white-space: pre; outline: none; tab-size: 2;
}
.owd-ta:focus { border-color: var(--owd-accent); }
.owd-iobar { display: flex; gap: 8px; }

/* pie */
.owd-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--owd-line); background: #120b26; flex-wrap: wrap; }
.owd-spacer { flex: 1; }
.owd-btn {
  all: unset; cursor: pointer; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.12); color: #fff; white-space: nowrap;
}
.owd-btn:hover { background: rgba(255, 255, 255, 0.13); }
.owd-btn:focus-visible { outline: 2px solid var(--owd-accent); outline-offset: 2px; }
.owd-btn.primary { background: linear-gradient(180deg, #ffd23f, #f0b400); color: #1a1033; border-color: #ffd23f; }
.owd-btn.primary:hover { filter: brightness(1.08); }
.owd-btn.danger { color: #ffb3be; border-color: rgba(255, 93, 115, 0.45); background: rgba(255, 93, 115, 0.08); }
.owd-btn.danger:hover { background: rgba(255, 93, 115, 0.2); }
.owd-btn.ghost { background: none; border-color: transparent; color: var(--owd-muted); padding-left: 4px; }
.owd-msg { font-size: 12px; color: var(--owd-live); opacity: 0; transition: opacity 0.2s; }
.owd-msg.show { opacity: 1; }
.owd-msg.bad { color: var(--owd-bad); }

/* insignia de esquina */
.owd-badge { position: absolute; left: 10px; bottom: 10px; z-index: 20; display: flex; gap: 6px; pointer-events: none; }
.owd-badge.fixed { position: fixed; }
.owd-chip {
  all: unset; pointer-events: auto; cursor: pointer; padding: 3px 9px; border-radius: 999px; font: 700 11px/1.4 var(--owd-font);
  background: rgba(20, 12, 40, 0.82); border: 1px solid rgba(255, 255, 255, 0.22); color: #fff; letter-spacing: 0.02em;
}
.owd-chip.mod { color: #1a1033; background: rgba(255, 210, 63, 0.92); border-color: #ffd23f; }
.owd-chip:hover { filter: brightness(1.12); }
.owd-chip:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

@media (max-width: 760px) {
  .owd-grid { grid-template-columns: 1fr; }
  .owd-help { display: none; }
  .owd-note { display: none; }
}
