:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2433;
  --ink-2: #5b6475;
  --line: #e3e6eb;
  --brand: #0f5c8c;
  --brand-2: #0b4870;
  --brand-soft: #e7f0f7;
  --ok: #1d7a46;  --ok-bg: #e5f4ec;
  --warn: #9a6200; --warn-bg: #fdf3e1;
  --err: #b4232f; --err-bg: #fbe9ea;
  --side: #14213a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: #f0f2f5; padding: 1px 5px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.45rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
h4 { font-size: .95rem; }

/* Estructura */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 248px, var(--bg) 248px); }
.side { background: var(--side); color: #c9d2e3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: .7rem; align-items: center; padding: 1.2rem 1.1rem 1rem; }
.brand strong { display: block; color: #fff; font-size: .95rem; }
.brand small { display: block; color: #8d9ab3; font-size: .78rem; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand.big strong { color: var(--ink); font-size: 1.05rem; }
.brand.big small { color: var(--ink-2); }
.brand.big { padding: 0 0 1rem; }
.logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(135deg, #1b7bbd, #0f5c8c); color: #fff; font-weight: 800; font-size: .72rem; letter-spacing: .04em; flex: none; }
.side nav { display: flex; flex-direction: column; padding: .4rem .6rem; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: .65rem; color: #c9d2e3; padding: .55rem .7rem; border-radius: 8px; font-size: .92rem; }
.side nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.side nav a.on { background: rgba(80, 160, 230, .18); color: #fff; }
.side nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { border-top: 1px solid rgba(255,255,255,.08); padding: .8rem; }
.me { display: flex; gap: .6rem; align-items: center; color: #e6ebf4; font-size: .88rem; }
.me small { display: block; color: #8d9ab3; font-size: .75rem; }
.me:hover { text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #2c3d5e; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.side-foot form { margin-top: .5rem; }
.link { background: none; border: 0; color: #8d9ab3; cursor: pointer; padding: 0; font: inherit; font-size: .84rem; }
.link:hover { color: #fff; }

.main { padding: 1.6rem 2rem 3rem; min-width: 0; max-width: 1280px; }
.top { margin-bottom: 1rem; }

/* Tarjetas */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.card.narrow { max-width: 410px; width: 100%; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.grid2.wide-left { grid-template-columns: 1.4fr 1fr; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.grid2, .grid3 { margin-bottom: 1.1rem; }
.actions-card .btn + .btn { margin-top: .5rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.stats.compact { margin: .8rem 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stats.compact .stat { background: #fafbfc; }
.stat span { display: block; color: var(--ink-2); font-size: .8rem; }
.stat strong { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.stat.ok strong { color: var(--ok); }
.stat.warn { border-color: #f1d9a8; background: var(--warn-bg); }
.stat.warn strong { color: var(--warn); }
.big-num { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: .4rem; }
.big-num small { font-size: .9rem; color: var(--ink-2); font-weight: 500; }

/* Barras */
.bar { height: 8px; background: #edf0f4; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }
.bar.hot i { background: var(--err); }
.bar.big { height: 12px; flex: 1; }
.bar.mixed i { background: linear-gradient(90deg, var(--brand), #3d8bc4); }
.progress { display: flex; align-items: center; gap: .8rem; margin: .4rem 0; }
.progress span { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }

/* Tablas */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .6rem .6rem; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
.tbl tbody tr:hover { background: #fafbfd; }
.tbl.mini { font-size: .84rem; }
.tbl.mini td, .tbl.mini th { padding: .4rem .5rem; }
.r { text-align: right; } .c { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.block { display: block; }
.dl { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--brand-soft); font-weight: 700; }
.dl:hover { background: var(--brand); color: #fff; text-decoration: none; }
.dot { display: inline-block; min-width: 22px; font-weight: 700; }
.dot.ok { color: var(--ok); } .dot.warn { color: var(--warn); } .dot.err { color: var(--err); } .dot.muted { color: #a0a8b6; }

/* Etiquetas y alertas */
.tag { display: inline-block; font-size: .76rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: #eef0f3; color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.err { background: var(--err-bg); color: var(--err); }
.alert { border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid transparent; font-size: .92rem; }
.alert.ok { background: var(--ok-bg); border-color: #bfe3cf; color: #145c34; }
.alert.err { background: var(--err-bg); border-color: #f2c4c8; color: #8a1a24; }
.alert.warn { background: var(--warn-bg); border-color: #f1d9a8; color: #7a4d00; }
.alert.small { font-size: .84rem; padding: .5rem .7rem; }
.err-text { color: var(--err); }
.muted { color: var(--ink-2); }
.small { font-size: .84rem; }
.mt { margin-top: 1rem; }
.empty { color: var(--ink-2); padding: 1.2rem 0; text-align: center; }
.banner-soporte { display: flex; align-items: center; gap: 1rem; justify-content: space-between; background: #fff7e0; border: 1px solid #f0d78a; color: #6d5000; padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }

/* Formularios */
label { display: block; font-size: .85rem; font-weight: 600; color: #3a4354; margin-bottom: .8rem; }
input, select { display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #ccd2da; border-radius: 7px; }
input:focus, select:focus { outline: 2px solid rgba(15, 92, 140, .25); border-color: var(--brand); }
input:disabled { background: #f3f4f6; color: var(--ink-2); }
input.upper { text-transform: uppercase; }
input[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 .4rem 0 0; vertical-align: -2px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.row4 { display: grid; grid-template-columns: 1.4fr 1.6fr .8fr .9fr; gap: 0 1rem; }
.form-card h3 + * { margin-top: .4rem; }
.form-card h3:not(:first-of-type) { margin-top: 1.2rem; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; margin-top: .6rem; }
.actions .muted { margin-right: auto; }
.inline { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline input, .inline select { width: auto; margin: 0; }
.checks { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .8rem; }
.checks .lbl { font-size: .85rem; font-weight: 600; color: #3a4354; margin-bottom: .2rem; }
.chk { font-weight: 400; margin: 0; display: flex; align-items: baseline; gap: .1rem; }
.formatos { border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem .4rem; margin: .4rem 0 1rem; }
.formatos legend { font-size: .85rem; font-weight: 600; padding: 0 .3rem; color: #3a4354; }
.formatos .chk { padding: .3rem 0; }
.formatos .chk small { color: var(--ink-2); margin-left: .35rem; }
.formatos .chk.off { color: #a0a8b6; }
.copy { display: flex; gap: .5rem; margin-top: .5rem; }
.copy input { margin: 0; font-size: .85rem; background: #fff; }
.drop { position: relative; display: grid; place-items: center; border: 2px dashed #c3ccd8; border-radius: 10px; padding: 2.2rem 1rem; text-align: center; font-weight: 400; color: var(--ink-2); background: #fafbfc; cursor: pointer; }
.drop:hover, .drop.has { border-color: var(--brand); background: var(--brand-soft); color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }
.toolbar form { margin: 0; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-size: .9rem; font-weight: 600; padding: .55rem 1rem; border-radius: 7px; border: 1px solid #c9d0da; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f4f6f9; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: .4rem .8rem; font-size: .84rem; }
.btn.xs { padding: .22rem .55rem; font-size: .78rem; font-weight: 500; }
.btn.block { display: flex; width: 100%; }

.tabs { display: flex; gap: .3rem; }
.tabs a { padding: .3rem .8rem; border-radius: 99px; font-size: .85rem; color: var(--ink-2); }
.tabs a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.pager { display: flex; gap: .3rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.pager a { padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }
.pager a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
details summary { cursor: pointer; font-weight: 600; font-size: .9rem; margin-bottom: .5rem; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: .4rem .8rem; margin: 0; }
.kv dt { color: var(--ink-2); font-size: .88rem; }
.kv dd { margin: 0; }

.guide { background: #fbfcfe; }
.steps { padding-left: 1.2rem; margin: 0 0 .8rem; }
.steps li { margin-bottom: .7rem; font-size: .9rem; }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth .btn.block { margin-top: .4rem; }

@media (max-width: 980px) {
  .shell { background: var(--bg); }
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .main { padding: 1rem; }
  .grid2, .grid2.wide-left, .grid3, .row2, .row3, .row4 { grid-template-columns: 1fr; }
  .tbl { display: block; overflow-x: auto; }
}
