:root { --bg:#0b0c10; --card:#13151c; --muted:#9aa3b2; --text:#e8ebf2; --line:#23273a; --accent:#4f7cff; }
* { box-sizing: border-box; }
body { margin:0; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); padding: 16px; }
.brand { font-weight: 700; margin-bottom: 12px; }
.nav a { display:block; padding: 10px 10px; border-radius: 10px; color: var(--muted); }
.nav a.active { background: rgba(79,124,255,.12); color: var(--text); border: 1px solid rgba(79,124,255,.35); }
.main { padding: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.row { display:flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); }
.h1 { font-size: 18px; font-weight: 700; margin: 0 0 10px; }
.sep { height: 1px; background: var(--line); margin: 12px 0; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; }
.badge { display:inline-block; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.badge.ok { color: #b6ffd2; border-color: rgba(182,255,210,.35); }
.badge.warn { color: #ffe1a6; border-color: rgba(255,225,166,.35); }

.btn { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.btn.primary { background: rgba(79,124,255,.18); border-color: rgba(79,124,255,.45); }
.btn.danger { background: rgba(255,90,90,.12); border-color: rgba(255,90,90,.35); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.field { display:flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0f1117;
  color: var(--text);
}
.field textarea { min-height: 86px; resize: vertical; }

.toast { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; }
.toast .t { background: #11131a; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
/* UX accesible */
body { font-size: 16px; }
.field label { font-size: 13px; }
.help { font-size: 12px; color: var(--muted); }
.req { color: #ffe1a6; font-weight: 700; margin-left: 6px; font-size: 12px; }
.opt { color: var(--muted); margin-left: 6px; font-size: 12px; }

.chips { display:flex; gap:8px; flex-wrap: wrap; }
.chip {
  display:inline-flex; gap:8px; align-items:center;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #0f1117; color: var(--text);
}
.chip button { border: none; background: transparent; color: var(--muted); cursor: pointer; }

.bigbtn { padding: 12px 14px; border-radius: 12px; }


/* Modal overlay */
.modal-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 9999;
}

/* Modal panel */
.modal{
  width: min(980px, 100%);
  max-height: calc(100vh - 32px);
  background: #0b0d12;
  border: 1px solid #232736;
  border-radius: 16px;
  overflow: hidden; /* header/footer fijos dentro */
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* Header */
.modal-header{
  padding: 14px 16px;
  border-bottom: 1px solid #232736;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}

/* Body scroll */
.modal-body{
  padding: 16px;
  overflow: auto;            /* <-- el scroll real */
  -webkit-overflow-scrolling: touch;
}

/* Footer */
.modal-footer{
  padding: 14px 16px;
  border-top: 1px solid #232736;
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Evita scroll del fondo cuando modal está abierto */
body.modal-open{
  overflow: hidden;
}
