/* Pinxel Clientes — paleta corporativa */
:root {
  --night: #03071e;
  --night-2: #0c1233;
  --red: #dd1e4b;
  --red-soft: #fde8ee;
  --bg: #edeeef;
  --card: #ffffff;
  --text: #54595f;
  --ink: #03071e;
  --muted: #8a8f95;
  --line: #dfe1e3;
  --ok: #138a52;
  --ok-soft: #e3f5ec;
  --warn: #b26a00;
  --warn-soft: #fff3df;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(3,7,30,.06), 0 4px 16px rgba(3,7,30,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.5 "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg);
}
h1, h2, h3, .brandfont { font-family: "Poppins", "Roboto", sans-serif; color: var(--ink); margin: 0; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: #fff; color: var(--text); border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
}
.side .logo { padding: 4px 10px 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.side .logo img { height: 40px; display: block; }
.side .logo span { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.side a.nav {
  display: flex; align-items: center; gap: 10px; color: var(--text); padding: 9px 12px; border-radius: 8px; font-weight: 500;
}
.side a.nav:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.side a.nav.active { background: var(--night); color: #fff; box-shadow: inset 3px 0 0 var(--red); }
.side a.nav svg { width: 18px; height: 18px; flex: none; }
.side .bottom { margin-top: auto; font-size: 12px; padding: 10px; color: var(--muted); }

.main { padding: 26px 30px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar .sub { color: var(--muted); margin-top: 2px; }
.curswitch { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.curswitch a { padding: 5px 14px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: 12px; }
.curswitch a.on { background: var(--night); color: #fff; }
.curswitch a:hover { text-decoration: none; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 18px; }
.grid > .card, .grid > form.card { margin-top: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: 1fr 1fr; }
.g21 { grid-template-columns: 2fr 1fr; }
.kpi { position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.kpi .value { font: 600 26px "Poppins", sans-serif; color: var(--ink); margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi.hero { background: var(--night); }
.kpi.hero .value { color: #fff; }
.kpi.hero .label, .kpi.hero .foot { color: #9ea2b8; }
.kpi.hero::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--red); opacity: .9; }
.kpi.hero > * { position: relative; z-index: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #f0f1f2; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafafb; }
td .dom { color: var(--ink); font-weight: 500; }
tr.dim td { opacity: .55; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--bg); color: var(--text); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-night { background: var(--night); color: #fff; }
.b-line { background: transparent; border: 1px solid var(--line); }

/* ---------- forms & buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; padding: 8px 14px; font: 600 13px "Roboto", sans-serif; cursor: pointer; background: var(--red); color: #fff; white-space: nowrap; }
.btn:hover { filter: brightness(.94); text-decoration: none; }
.btn.dark { background: var(--night); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.link { background: none; color: var(--red); padding: 0; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--red-soft); }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline; margin: 0; }

label { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
label .req { color: var(--red); }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(221,30,75,.25); border-color: var(--red); }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg label { margin: 0; padding: 8px 14px; cursor: pointer; font-weight: 500; color: var(--text); border-right: 1px solid var(--line); }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg input:checked + span { color: var(--red); font-weight: 700; }
.countries { display: flex; flex-wrap: wrap; gap: 8px; }
.countries label { margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.countries input { display: none; }
.countries label:has(input:checked) { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 6px 0 12px; padding-top: 6px; border-top: 1px solid var(--line); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; padding: 7px 10px; }

/* ---------- misc ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--red-soft); color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
.alert { border-left: 4px solid var(--red); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }
.site-block { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.site-block .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; cursor: pointer; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu .pop { position: absolute; right: 0; z-index: 20; background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(3,7,30,.18); padding: 6px; min-width: 210px; margin-top: 4px; }
details.menu .pop button, details.menu .pop a { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: 500 13px "Roboto", sans-serif; color: var(--ink); cursor: pointer; }
details.menu .pop button:hover, details.menu .pop a:hover { background: var(--bg); text-decoration: none; }
details.menu .pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.tpl { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.preview { background: var(--bg); border-radius: 8px; padding: 14px; white-space: pre-wrap; font-size: 13px; color: var(--ink); }
.preview .subj { font-weight: 700; margin-bottom: 8px; }
code { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--night); padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-card .top { background: #fff; border-bottom-color: var(--red); margin: -30px -30px 24px; padding: 26px 30px; border-radius: 16px 16px 0 0; border-bottom: 4px solid var(--red); text-align:center; }
.login-card img { height: 46px; }

.menu-toggle { display: none; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g21, .tpl-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .side { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 18px 16px 50px; }
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
  .kpi .value { font-size: 22px; }
}

/* ---------- filas agrupadas por dominio ---------- */
table.grouped tbody.grp { border-bottom: 1px solid #f0f1f2; }
table.grouped tbody.grp:last-child { border-bottom: 0; }
table.grouped tbody.grp td { border-bottom: 0; }
table.grouped tr.grp-row.multi { cursor: pointer; }
table.grouped .caret { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 4px; transition: transform .15s; }
table.grouped tbody.grp[data-open="1"] .caret { transform: rotate(90deg); color: var(--red); }
table.grouped tbody.grp[data-open="1"] tr.grp-row { background: #fafafb; }
table.grouped tr.sub-row td { padding-top: 6px; padding-bottom: 6px; background: #fafafb; }
table.grouped tr.sub-row:last-child td { padding-bottom: 12px; }
table.grouped .sub-name { color: var(--ink); padding-left: 18px; }
tbody.grp:hover { background: transparent; }
table.grouped .chips { flex-wrap: nowrap; }
