/* GesCall Licencias — estilo alineado con Blaster v3: grises neutros, azul #1f5fd1, Inter, tablas compactas. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/inter-latin-600-normal.woff2) format('woff2'); }

:root {
  --brand: #1f5fd1; --brand-600: #1a51b3; --brand-50: #eef3fc;
  --bg: #f5f6f8; --surface: #ffffff; --border: #e3e6eb; --border-strong: #cfd4dc;
  --text: #1b1f24; --text-2: #4a525e; --muted: #6b7380;
  --ok: #1a7f4b; --ok-bg: #e7f5ee; --warn: #9a6400; --warn-bg: #fdf3e1; --bad: #b42318; --bad-bg: #fdecea;
  --info: #1f5fd1; --info-bg: #eef3fc;
  --radius: 8px; --shadow: 0 1px 2px rgba(16,24,40,.05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 14px; font-weight: 600; margin: 0; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin: 18px 0 8px; }
code, pre, .mono { font-family: var(--mono); }
pre { background: #f0f2f5; border: 1px solid var(--border); border-radius: 6px; padding: 12px; overflow-x: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.muted { color: var(--muted); } .small { font-size: 12px; } .strong { font-weight: 600; } .break { word-break: break-all; } .mt { margin-top: 14px; }

/* shell */
body.has-shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #d1d5db; display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 7px; background: var(--brand); color: #fff; font-weight: 600; font-size: 13px; display: grid; place-items: center; flex: none; }
.brand-name { font-weight: 600; color: #fff; } .brand-sub { font-size: 12px; color: #9ca3af; }
.auth .brand-name { color: var(--text); } .auth .brand-sub { color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: #d1d5db; margin-bottom: 2px; }
.nav-item:hover { background: #1f2937; text-decoration: none; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #1f2937; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-foot .who { font-size: 13px; color: #e5e7eb; }
.sidebar .btn-ghost { color: #d1d5db; border-color: #374151; background: transparent; }
.main { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.narrow { max-width: 640px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head.pad { padding: 14px 16px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; } .grid-2, .grid-3 { margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { margin: 0; padding: 14px; color: inherit; } a.kpi:hover { border-color: var(--brand); text-decoration: none; }
.kpi-label { font-size: 12px; color: var(--muted); } .kpi-value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.tone-ok { color: var(--ok); } .tone-warn { color: var(--warn); } .tone-bad { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.stats dt { font-size: 12px; color: var(--muted); } .stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: 12.5px; } .kv dd { margin: 0; }

/* tablas */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--border); padding: 8px 12px; white-space: nowrap; }
.table td { border-bottom: 1px solid var(--border); padding: 8px 12px; vertical-align: top; }
.table tbody tr:hover { background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.table .empty { text-align: center; color: var(--muted); padding: 20px; }
.table td.bars { min-width: 220px; }
.table.compact td, .table.compact th { padding: 6px 8px; }

/* badges */
.badge { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); } .badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: #eef0f3; color: var(--text-2); }

/* barras de uso */
.ubar { display: grid; grid-template-columns: 78px 1fr auto; gap: 8px; align-items: center; font-size: 11.5px; margin: 2px 0 6px; }
.ubar-label { color: var(--muted); } .ubar-val { white-space: nowrap; color: var(--text-2); }
.ubar-track { height: 6px; background: #eceff3; border-radius: 3px; overflow: hidden; }
.ubar-fill { height: 100%; border-radius: 3px; }
.ubar-ok { background: var(--brand); } .ubar-warn { background: #d18a00; } .ubar-bad { background: var(--bad); }
.w0{width:0}.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}.w25{width:25%}.w30{width:30%}.w35{width:35%}.w40{width:40%}.w45{width:45%}.w50{width:50%}
.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}.w75{width:75%}.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}.w100{width:100%}

/* formularios */
.form label, label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 10px; }
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border-strong); border-radius: 6px; padding: 7px 10px; min-height: 34px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,95,209,.25); border-color: var(--brand); }
input[type=checkbox] { width: auto; min-height: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
.switches { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
label.switch { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--text); margin: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.inline-form { display: flex; gap: 6px; align-items: center; } .inline-form input { width: 180px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; } .toolbar input[type=search] { max-width: 460px; } .toolbar select { max-width: 220px; }
.otp { font-family: var(--mono); font-size: 20px; letter-spacing: .3em; text-align: center; }
.step { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
details.preset { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
details.preset summary { cursor: pointer; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 12px; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; font-size: 13px; padding: 7px 14px; min-height: 34px; border-radius: 6px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; width: auto; }
.btn:hover { background: #f6f7f9; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-600); }
.btn-danger { color: var(--bad); border-color: #f1b8b2; } .btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 4px 10px; min-height: 28px; font-size: 12.5px; }
.btn-block { width: 100%; } .btn-link { background: none; border: 0; color: var(--brand); padding: 0; cursor: pointer; font: inherit; }
.btn-ghost { background: transparent; }

/* alertas */
.alert { border-radius: 6px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #bfe3cf; }
.alert-bad { background: var(--bad-bg); color: var(--bad); border-color: #f5c2bd; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #f1d7a6; }

/* autenticación */
body.is-auth { min-height: 100vh; display: grid; place-items: center; }
.auth { width: 100%; max-width: 420px; padding: 24px 16px; }
.auth-card { padding: 28px; }
.auth-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.auth-card h1 { margin-bottom: 6px; font-size: 18px; }
.auth-card p.muted { margin: 0 0 16px; }
.qr-wrap { display: flex; justify-content: center; margin: 14px 0; } .qr-wrap img { border: 1px solid var(--border); border-radius: 6px; }
.secret-row { display: flex; gap: 8px; align-items: center; justify-content: center; margin-bottom: 14px; }
.secret-row code { font-size: 12.5px; background: #f0f2f5; padding: 4px 8px; border-radius: 4px; }
.steps-list { padding-left: 18px; font-size: 13px; color: var(--text-2); }
.keybox { display: flex; gap: 10px; align-items: center; margin: 14px 0; }
.keybox code { font-size: 20px; font-weight: 600; letter-spacing: .04em; background: var(--brand-50); color: var(--brand-600); border: 1px dashed var(--brand); padding: 10px 14px; border-radius: 6px; }

@media (max-width: 1000px) {
  body.has-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; } .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; gap: 8px; }
  .brand { padding: 0 8px 0 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .toolbar { flex-wrap: wrap; }
}
