@font-face { font-family: 'Figtree'; font-weight: 400; src: url(/fonts/figtree-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 500; src: url(/fonts/figtree-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; src: url(/fonts/figtree-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; src: url(/fonts/figtree-latin-700-normal.woff2) format('woff2'); }

:root {
  --navy: #0B1F4B; --navy-2: #13306B; --blue: #1F5FBF; --teal: #14B8A6; --teal-d: #0F8F82;
  --bg: #F3F5F9; --card: #FFFFFF; --line: #E2E6EE; --text: #1B2440; --muted: #5B6478;
  --ok: #15803D; --ok-bg: #E8F6EC; --warn: #B45309; --warn-bg: #FEF3E2; --err: #B42318; --err-bg: #FDECEA;
  --radius: 8px; --shadow: 0 1px 2px rgba(11, 31, 75, .06), 0 2px 8px rgba(11, 31, 75, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Figtree', Arial, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
h1 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 14px; margin: 18px 0 8px; color: var(--navy); }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- acceso */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #0B1F4B 0%, #13306B 60%, #0F8F82 140%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .6px; color: var(--navy); font-size: 18px; margin-bottom: 22px; }
.brand img { width: 30px; height: 30px; }
.brand small { display: block; font-weight: 500; letter-spacing: 0; color: var(--muted); font-size: 12.5px; }
.qr { display: block; margin: 8px auto 6px; border: 1px solid var(--line); border-radius: 8px; }
.secret { text-align: center; word-break: break-all; background: var(--bg); padding: 6px; border-radius: 6px; }

/* ---------- estructura */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.side { background: var(--navy); color: #C9D3EA; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.side .brand { color: #fff; padding: 0 8px; }
.side .brand small { color: #9FB0D6; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: #C9D3EA; text-decoration: none; cursor: pointer; border: 0; background: none; font: inherit; text-align: left; width: 100%; }
.nav:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav.active { background: rgba(45, 212, 191, .16); color: #fff; box-shadow: inset 3px 0 0 var(--teal); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .sep { height: 1px; background: rgba(255, 255, 255, .1); margin: 10px 6px; }
.side .foot { margin-top: auto; font-size: 11.5px; color: #8091B8; padding: 8px 12px; }
.main { min-width: 0; }
.top { height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 24px; position: sticky; top: 0; z-index: 5; }
.demo-pill { margin-right: auto; background: var(--warn-bg); color: var(--warn); border-radius: 20px; padding: 4px 10px; font-size: 12px; font-weight: 600; }
.content { padding: 24px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }

/* ---------- componentes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; color: var(--navy); font-weight: 600; }
.stat span { color: var(--muted); font-size: 13px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 6px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; background: var(--navy); color: #fff; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.teal { background: var(--teal-d); }
.btn.teal:hover { background: #0B7A6F; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: #fff; color: var(--err); border-color: #F3C3BE; }
.btn.danger:hover { background: var(--err-bg); }
.btn.sm { padding: 5px 9px; font-size: 12.5px; }
.btn.icon { padding: 6px; }
.btn svg { width: 16px; height: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-weight: 600; font-size: 12.5px; color: var(--navy); margin-bottom: 4px; }
input, select, textarea { font: inherit; color: var(--text); border: 1px solid #CDD3DF; border-radius: 6px; padding: 8px 10px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(20, 184, 166, .35); border-color: var(--teal); }
input[type=checkbox] { width: auto; accent-color: var(--teal-d); }
textarea { min-height: 150px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
table.t { width: 100%; border-collapse: collapse; background: #fff; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); background: #FAFBFD; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); background: #fff; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: #E8EFFC; color: var(--blue); }
.alert { border-radius: var(--radius); padding: 11px 14px; margin-bottom: 14px; border: 1px solid; }
.alert.warn { background: var(--warn-bg); border-color: #F5D7A8; color: #7A3E06; }
.alert.err { background: var(--err-bg); border-color: #F3C3BE; color: var(--err); }
.alert.ok { background: var(--ok-bg); border-color: #BFE3C9; color: var(--ok); }
.alert.info { background: #EEF4FD; border-color: #C9DAF5; color: var(--navy-2); }
.logo-thumb { width: 64px; height: 30px; object-fit: contain; display: block; }
.logo-box { display: flex; align-items: center; gap: 14px; border: 1px dashed #CDD3DF; border-radius: 8px; padding: 12px; }
.logo-box img { max-width: 220px; max-height: 70px; object-fit: contain; }
.list-edit .item { display: grid; gap: 8px; align-items: center; margin-bottom: 8px; }
.list-edit .ws { grid-template-columns: 1fr 120px 36px; }
.list-edit .rc { grid-template-columns: 1.4fr 1fr 110px 36px; }
.pick { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.pick label { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid #F0F2F6; }
.pick label:last-child { border-bottom: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 11px; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--navy); }
.chip:hover, .chip.on { border-color: var(--teal); background: #E7F8F5; }
.progress { height: 8px; background: #E6EAF2; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--blue)); width: 0; transition: width .4s; }
.log { background: #0E1730; color: #D5DEF5; border-radius: 6px; padding: 10px 12px; max-height: 300px; overflow: auto; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; }
.log .warn { color: #FCD34D; }
.log .error { color: #FCA5A5; }
.group-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #F6F8FC; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--navy); cursor: pointer; }
.group-h img { height: 22px; max-width: 70px; object-fit: contain; }
.group-h .count { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; border-radius: 9px; background: var(--err); color: #fff; font-size: 10.5px; display: grid; place-items: center; padding: 0 4px; }
.pop { position: absolute; right: 24px; top: 54px; width: 380px; max-height: 460px; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(11, 31, 75, .18); z-index: 20; }
.pop .n { padding: 11px 14px; border-bottom: 1px solid var(--line); }
.pop .n.unread { background: #F2FBF9; }
.pop .n b { display: block; color: var(--navy); font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--navy); font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--teal-d); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ---------- modal */
.modal-bg { position: fixed; inset: 0; background: rgba(11, 31, 75, .45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 720px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 1100px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h2 { margin: 0; }
.modal-b { padding: 18px 20px; overflow: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.preview-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 6px; }

#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side .foot, .side .sep { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
.card-gap { margin-bottom: 16px; }
select.narrow { width: auto; min-width: 280px; }
textarea.short { min-height: 70px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #FAFBFD; }
.ico { display: inline-flex; }
.ico svg { width: 18px; height: 18px; }
.btn .ico svg { width: 16px; height: 16px; }
