:root { --blue: #1b2cf0; --blue-light: #2f6bff; --yellow: #ffe600; --ink: #111318; --muted: #636878; --line: #e3e5eb; --bg: #f4f5f8; --green: #16a34a; --red: #dc2626;
  --font: "Montserrat", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.brand { font-weight: 900; font-size: 24px; color: var(--yellow); letter-spacing: -.5px; }
.brand i { font-style: normal; color: var(--blue-light); }
.brand small { color: #fff; font-weight: 600; font-size: 14px; margin-left: 6px; }

.login { min-height: 100vh; display: grid; place-items: center; background: #000; padding: 20px; }
.login-box { background: #111; padding: 30px; border-radius: 14px; width: min(380px, 100%); display: grid; gap: 14px; color: #fff; }
.login-box label { display: grid; gap: 6px; font-size: 13px; }
.login-box input { padding: 12px; border-radius: 8px; border: 1px solid #333; background: #1d1d1d; color: #fff; font-size: 16px; }
.hint { font-size: 13px; color: #aaa; margin: 0; }

.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.side { background: #000; color: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side nav { display: grid; gap: 4px; }
.side nav a { color: #ddd; text-decoration: none; padding: 11px 12px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.side nav a:hover { background: #1a1a1a; }
.side nav a.on { background: var(--blue); color: #fff; }
.pill { background: var(--yellow); color: #000; border-radius: 10px; font-size: 12px; padding: 1px 8px; font-weight: 800; }
.pill:empty { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 8px; font-size: 13px; color: #999; }
.side-foot a { color: var(--yellow); }
.link { background: none; border: 0; color: #bbb; text-align: left; padding: 0; text-decoration: underline; }
.main { padding: 26px; min-width: 0; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { margin: 0; font-size: 26px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tools input, .tools select { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }

.btn { border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 700; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.dark { background: #000; color: #fff; border-color: #000; }
.btn.danger { color: var(--red); border-color: #f3c4c4; }
.btn.wa { background: #25d366; color: #fff; border-color: #25d366; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: wait; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border-radius: 12px; padding: 16px; border: 1px solid var(--line); }
.stat small { color: var(--muted); font-weight: 600; }
.stat strong { display: block; font-size: 24px; margin-top: 4px; }

.table-wrap { background: #fff; border-radius: 12px; border: 1px solid var(--line); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #fafbfc; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #f7f8ff; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: #eee; }
.status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }
.off { opacity: .5; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(820px, 96vw); max-height: 92vh; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.5); }
.m-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; }
.m-head h2 { margin: 0; font-size: 20px; }
.m-close { background: none; border: 0; font-size: 28px; line-height: 1; }
.m-body { padding: 20px; }
.m-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; flex-wrap: wrap; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .full { grid-column: 1 / -1; }
.form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; align-content: start; }
.form input, .form select, .form textarea { padding: 10px 12px; border: 1px solid #cfd3dc; border-radius: 8px; font: inherit; font-weight: 400; background: #fff; }
.form textarea { resize: vertical; }
.form .check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.form .check input { width: 18px; height: 18px; accent-color: var(--blue); }
.form fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form legend { font-weight: 800; padding: 0 6px; }
.form small { color: var(--muted); font-weight: 400; }
.imgs { display: flex; gap: 10px; flex-wrap: wrap; }
.imgs .im { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #f3f3f3; }
.imgs .im img { width: 100%; height: 100%; object-fit: cover; }
.imgs .im button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.7); color: #fff; font-size: 14px; line-height: 1; }
.imgs .im .first { position: absolute; left: 0; bottom: 0; right: 0; font-size: 11px; text-align: center; background: var(--blue); color: #fff; }
.imgs .im .mv { position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 12px; }
.upload { width: 92px; height: 92px; border: 2px dashed #c3c7d2; border-radius: 10px; display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--muted); cursor: pointer; }
.upload input { display: none; }
.margin { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.margin.neg { background: #fef2f2; border-color: #fecaca; }

.o-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.box h3 { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.box p { margin: 3px 0; }
.items td, .items th { padding: 8px 10px; font-size: 14px; }
.copy-area { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.err-box { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 10px 12px; border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 160%); background: #111; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 100; transition: transform .3s, visibility .3s; visibility: hidden; font-weight: 600; }
.toast.show { transform: translate(-50%, 0); visibility: visible; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; }
  .side .brand { font-size: 20px; }
  .side nav { display: flex; overflow-x: auto; width: 100%; order: 3; }
  .side nav a { white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; display: flex; gap: 12px; align-items: center; }
  .side-foot #who { display: none; }
  .main { padding: 16px; }
  .form, .form fieldset, .o-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* ---- conexión / extras ---- */
.login-box.wide { width: min(540px, 100%); }
.login-box fieldset { border: 1px solid #333; border-radius: 10px; padding: 12px; display: grid; gap: 10px; }
.login-box legend { color: var(--yellow); font-weight: 700; padding: 0 6px; font-size: 13px; }
.btn.ghost-dark { background: transparent; color: #ddd; border-color: #444; }
.btn.danger-solid { background: var(--red); color: #fff; border-color: var(--red); }
dialog.small { width: min(420px, 92vw); }
.banner { background: #eef2ff; border: 1px solid #c7d2fe; color: #1e3a8a; padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.banner.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.saving { position: fixed; inset: 0; background: rgba(255,255,255,.6); z-index: 90; display: grid; place-items: center; font-weight: 700; }
