/* AITA/Nexxus — Manager Panel
   Brand tokens are overridden at runtime from tenants.branding
   (--brand-primary, --brand-accent). */
:root {
  --brand-primary: #0B1F3A;
  --brand-primary-2: #13305A;
  --brand-accent: #C9A227;
  --brand-accent-soft: #F6EFD6;

  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: #E3E8EF;
  --text: #0F1B2D;
  --text-2: #4A5A70;
  --text-3: #7A889C;

  --ok: #127A4B;       --ok-bg: #E4F4EC;
  --warn: #9A6400;     --warn-bg: #FDF1D8;
  --bad: #B42318;      --bad-bg: #FDE7E5;
  --info: #1F5FAD;     --info-bg: #E5EEFA;
  --muted-bg: #EEF1F5;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 1px 1px rgba(15, 27, 45, .04);
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- boot / spinner ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; gap: 12px; justify-items: center; color: var(--text-2); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand-accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- auth screens ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--brand-primary); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; padding: 32px 28px; box-shadow: 0 20px 40px rgba(0,0,0,.25); }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .wordmark { font-size: 24px; font-weight: 700; letter-spacing: .12em; color: var(--brand-primary); }
.auth-brand .rule { width: 40px; height: 3px; background: var(--brand-accent); margin: 10px auto; border-radius: 2px; }
.auth-brand p { margin: 0; color: var(--text-2); font-size: 14px; }
.auth-card form { display: grid; gap: 14px; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 14px; }
.auth-foot button { background: none; border: 0; color: var(--info); cursor: pointer; padding: 6px; }

/* ---------- form controls ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: 2px solid var(--brand-accent); outline-offset: 1px; border-color: transparent; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--bad); font-size: 14px; min-height: 1em; margin: 0; }
.hint { font-size: 13px; color: var(--text-3); margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-2); }
.btn-accent { background: var(--brand-accent); border-color: var(--brand-accent); color: var(--brand-primary); }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand-primary); color: #D6DEEA;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sb-brand { padding: 22px 22px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sb-brand .wordmark { color: #fff; font-weight: 700; letter-spacing: .12em; font-size: 18px; }
.sb-brand .sub { color: var(--brand-accent); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: grid; gap: 2px; align-content: start; }
.sb-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px;
  border-radius: var(--radius-sm); color: #D6DEEA; text-decoration: none; font-weight: 500;
}
.sb-link svg { width: 20px; height: 20px; flex: none; opacity: .85; }
.sb-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sb-link[aria-current="page"] { background: rgba(201,162,39,.16); color: #fff; box-shadow: inset 3px 0 0 var(--brand-accent); }
.sb-link .soon { margin-left: auto; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #93A3BA; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 2px 7px; }
.sb-sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 6px; }
.sb-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sb-user { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sb-role { color: #93A3BA; text-transform: capitalize; }
.sb-foot .btn { margin-top: 10px; width: 100%; background: transparent; color: #D6DEEA; border-color: rgba(255,255,255,.2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .titles { min-width: 0; }
.topbar .t-brand { font-weight: 700; letter-spacing: .1em; font-size: 15px; color: var(--brand-primary); }
.topbar .t-sub { font-size: 13px; color: var(--text-2); }
.topbar .date { margin-left: auto; font-size: 14px; color: var(--text-2); text-align: right; }
.topbar .tenant-select { margin-left: 12px; max-width: 220px; min-height: 38px; }
.menu-btn { display: none; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.content { padding: 24px 28px 48px; display: grid; gap: 20px; align-content: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.scrim { display: none; }

/* ---------- cards / sections ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.card-body { padding: 16px 20px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-size: 30px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .meta { font-size: 13px; color: var(--text-3); margin-top: 2px; min-height: 1.2em; }
.kpi.accent { border-top: 3px solid var(--brand-accent); }

.stats { display: grid; gap: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 16px 20px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat .label { font-size: 13px; color: var(--text-2); }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .meta { font-size: 13px; color: var(--text-3); }
.stats.cols-3 .stat:nth-child(3n) { border-right: 0; }

/* ---------- timeline / lists ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 64px 32px 1fr; gap: 10px; align-items: start; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .time { font-size: 13px; color: var(--text-3); padding-top: 6px; font-variant-numeric: tabular-nums; }
.timeline .ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--muted-bg); color: var(--text-2); }
.timeline .ico svg { width: 16px; height: 16px; }
.timeline .t-title { font-weight: 600; }
.timeline .t-detail { font-size: 14px; color: var(--text-2); }

.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: 0; }
.alert-item .bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--info); flex: none; }
.alert-item.critical .bar { background: var(--bad); }
.alert-item.warning .bar { background: var(--brand-accent); }
.alert-item .a-body { flex: 1; min-width: 0; }
.alert-item .a-title { font-weight: 600; }
.alert-item .a-detail { font-size: 14px; color: var(--text-2); }
.alert-item .a-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.empty { padding: 28px 20px; text-align: center; color: var(--text-3); font-size: 14px; }
.error-box { padding: 16px 20px; color: var(--bad); background: var(--bad-bg); border-radius: var(--radius-sm); font-size: 14px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--muted-bg); color: var(--text-2); text-transform: capitalize; }
.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.gold { background: var(--brand-accent-soft); color: #7A5E0A; }

/* ---------- toolbar / tabs ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1; min-width: 200px; }
.tabs { display: inline-flex; background: var(--muted-bg); border-radius: 10px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; min-height: 36px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--text-2); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- tables (become cards on mobile) ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; }
.muted { color: var(--text-3); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- detail ---------- */
.detail-grid { display: grid; gap: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-grid .dt { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.detail-grid .dt .k { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.detail-grid .dt .v { margin-top: 2px; font-weight: 500; word-break: break-word; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.summary-text { font-size: 15px; line-height: 1.6; margin: 0; white-space: pre-wrap; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11,31,58,.45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 16px; box-shadow: 0 24px 48px rgba(0,0,0,.25); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--muted-bg); }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; width: min(92vw, 420px); }
.toast { background: var(--brand-primary); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.2); font-size: 14px; }
.toast.error { background: var(--bad); }

/* ---------- coming soon ---------- */
.soon-card { padding: 48px 24px; text-align: center; }
.soon-card .pill { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #7A5E0A; background: var(--brand-accent-soft); padding: 4px 12px; border-radius: 999px; }
.soon-card h1 { margin-top: 14px; font-size: 24px; }
.soon-card p { color: var(--text-2); max-width: 460px; margin: 10px auto 0; }

/* ---------- utilidades (sin estilos inline: la CSP no los permite) ---------- */
.stack { display: grid; gap: 20px; align-content: start; }
.small { font-size: 13px; }
.m0 { margin: 0; }
.mt6 { margin-top: 6px; }
.center { text-align: center; }
.spinner-inline { margin: 0 auto 8px; }
.detail-grid.cols-2 { grid-template-columns: 1fr 1fr; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(11,31,58,.4); z-index: 25; }
  .menu-btn { display: grid; place-items: center; }
  .grid-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar .date { font-size: 12px; }
  .topbar .tenant-select { display: none; }
  .content { padding: 16px 16px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .value { font-size: 26px; }
  .stats, .stats.cols-3 { grid-template-columns: 1fr 1fr; }
  .stats .stat:nth-child(odd) { border-right: 1px solid var(--border); }
  .stats .stat:nth-child(even) { border-right: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 52px 28px 1fr; padding: 10px 14px; }
  .card-head, .card-body, .toolbar { padding-left: 14px; padding-right: 14px; }

  /* tables -> stacked cards */
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.data td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.data td::before { content: attr(data-label); color: var(--text-3); font-size: 13px; text-align: left; flex: none; }
  table.data td.num { text-align: right; }
  table.data td.primary-cell { font-size: 16px; }
  table.data td.primary-cell::before { content: none; }
  table.data td.primary-cell { justify-content: flex-start; text-align: left; }
  .row-actions { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Member portal: QR */
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.qr-img { width: 240px; max-width: 100%; height: auto; image-rendering: pixelated; margin: 0 auto; display: block; background: #fff; }
@media print {
  body.printing-qr * { visibility: hidden; }
  body.printing-qr .qr-print, body.printing-qr .qr-print * { visibility: visible; }
  body.printing-qr .qr-print { position: fixed; inset: 0; padding-top: 40px; }
  body.printing-qr .qr-print input { display: none; }
}

/* Progress & evaluations / SMS */
.stack-tight > * + * { margin-top: 2px; }
.badge.gold { background: #F6EFD6; color: #7A5E0B; margin-left: 6px; }
.check.full, .form-grid .full { grid-column: 1 / -1; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
h3.m0 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-top: 8px; }
.doc-view img { display: block; max-width: 100%; height: auto; border: 1px solid var(--border, #E3E8EF); border-radius: 8px; }
.topbar .site-link { margin-left: 12px; }

/* ---------- Contabilidad ---------- */
.acc-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 14px 20px; }
.acc-date { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.acc-date .input { min-height: 40px; width: 170px; }
.acc-range .btn-row { margin-left: auto; }
.kpis.acc-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi.negative .value { color: var(--bad); }
.acc-type { font-weight: 600; }
.acc-type.income, .acc-amt.income { color: var(--ok); }
.acc-type.expense { color: var(--text-2); }
.acc-amt { font-weight: 600; }
.strike { text-decoration: line-through; }
.acc-late { color: var(--bad); font-weight: 700; }
.acc-chart { width: 100%; height: auto; display: block; }
.acc-chart .axis { stroke: var(--border); stroke-width: 1; }
.acc-chart .lbl { fill: var(--text-3); font-size: 12px; font-family: var(--font); }
.acc-chart .bar.income, .acc-catbar .bar.income, .acc-legend .dot.income { fill: var(--brand-accent); background: var(--brand-accent); }
.acc-chart .bar.expense, .acc-catbar .bar.expense, .acc-legend .dot.expense { fill: var(--brand-primary); background: var(--brand-primary); }
.acc-legend { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin-top: 8px; }
.acc-legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.acc-legend .dot.expense { margin-left: 10px; }
.acc-cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.acc-catrow { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 4px; }
.acc-catbar { width: 100%; height: 8px; display: block; }
.acc-catbar .track { fill: var(--muted-bg); }
.cat-list { list-style: none; margin: 6px 0 12px; padding: 0; }
.cat-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cat-list li > span:first-child { flex: 1; }
@media (max-width: 1280px) { .kpis.acc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .kpis.acc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.acc-kpis .kpi.accent { grid-column: 1 / -1; }
  .acc-range { padding: 12px 14px; }
  .acc-date { flex: 1 1 140px; }
  .acc-date .input { width: 100%; }
  .acc-range .btn-row { margin-left: 0; }
  .page-head .btn-row { width: 100%; }
  .page-head .btn-row .btn { flex: 1 1 auto; }
}

/* ---------- plan de entrenamiento (ficha del socio) ---------- */
.modal.modal-wide { max-width: 920px; }
.tp-week { display: grid; gap: 12px; }
.tp-day-h { font-weight: 700; margin-bottom: 6px; }
.tp-ex-list { display: grid; gap: 8px; }
.tp-ex { display: grid; grid-template-columns: 64px 1fr minmax(160px, 240px); gap: 12px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.tp-ex img { width: 64px; height: 48px; border-radius: 6px; background: #111; }
.tp-ex-main { display: grid; gap: 2px; min-width: 0; }
.exc { width: 100%; height: auto; display: block; }
.exc-axis { stroke: var(--border); stroke-width: 1; }
.exc-bar { fill: #d8c48a; }
.exc-last .exc-bar { fill: var(--brand-accent); }
.exc-val { font: 700 10px var(--font); fill: var(--text-2); }
.exc-lbl { font: 500 9px var(--font); fill: var(--text-3); }
.tp-list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tp-list-head select { width: auto; }
.tp-rows { display: grid; gap: 12px; }
.tp-row { display: grid; grid-template-columns: 76px 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.tp-row-img { position: relative; background: #111; border-radius: 8px; padding: 4px; }
.tp-row-img img { display: block; width: 100%; height: auto; }
.tp-n { position: absolute; top: -8px; left: -8px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-accent); color: #000; font-size: 12px; font-weight: 700; }
.tp-row-fields { display: grid; gap: 10px; min-width: 0; }
.tp-line { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.tp-row-actions { display: grid; gap: 2px; }
.tp-row-actions .icon-btn { width: 32px; height: 32px; }
.tp-row-actions .icon-btn:disabled { opacity: .3; cursor: default; }
@media (max-width: 640px) {
  .tp-ex { grid-template-columns: 64px 1fr; }
  .tp-ex-chart { grid-column: 1 / -1; }
  .tp-row { grid-template-columns: 56px 1fr; }
  .tp-row-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
}

/* ---------- Nexxus Manager: identidad de plataforma + empresa activa ---------- */
.nx-mark { flex: none; display: block; }
.nx-mark .nx-hex { fill: var(--brand-primary); stroke: var(--brand-accent); stroke-width: 2.2; stroke-linejoin: round; }
.nx-mark .nx-n { fill: none; stroke: var(--brand-accent); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.auth-mark { display: flex; justify-content: center; margin-bottom: 10px; }
.auth-brand .wordmark { font-size: 20px; }

.sb-brand { display: grid; gap: 14px; }
.nx-brand { display: flex; align-items: center; gap: 10px; }
.nx-brand .wordmark { font-size: 15px; letter-spacing: .16em; line-height: 1.1; }
.nx-brand .wordmark span { display: block; color: var(--brand-accent); font-size: 11px; letter-spacing: .22em; font-weight: 600; }
.sb-company { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: rgba(255,255,255,.05); border: 1px solid rgba(201,162,39,.25); }
.co-logo { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; }
.co-initials { display: grid; place-items: center; background: var(--brand-accent); color: var(--brand-primary); font-weight: 700; font-size: 13px; letter-spacing: .04em; }
.co-text { min-width: 0; }
.co-name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.25; }
.co-meta { color: #93A3BA; font-size: 12px; margin-top: 2px; }

.topbar .t-brand { display: flex; align-items: center; gap: 8px; letter-spacing: .06em; }
.topbar .t-sub { color: #7A5E0A; font-weight: 600; }
.sys-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.sys-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.sys-status.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.sys-status.degraded .dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.sys-status.offline .dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.topbar .lang-select { width: auto; min-height: 36px; padding: 4px 8px; }
.tb-user { display: grid; text-align: right; line-height: 1.2; min-width: 0; max-width: 200px; }
.tb-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-role { font-size: 12px; color: var(--text-3); }
.topbar .site-link { margin-left: 0; }
@media (max-width: 1280px) { .topbar .date { display: none; } .topbar .sys-status { margin-left: auto; } }
@media (max-width: 1024px) { .tb-user, .tb-signout { display: none; } }
@media (max-width: 720px) {
  .topbar .t-brand span { font-size: 13px; }
  .topbar .t-sub { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46vw; }
  .sys-status .label { display: none; }
  .topbar .site-link { display: none; }
}
/* "Volver al sitio web": mismo aspecto que un enlace del menú, separado de los módulos. */
.sb-exit { padding: 8px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.sb-website { width: 100%; }
.sb-website:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.auth-site { display: inline-flex; align-items: center; gap: 6px; color: var(--info); text-decoration: none; }
.auth-site svg { width: 16px; height: 16px; }
.auth-site:hover span { text-decoration: underline; }

/* Selector de empresa dentro del menú lateral: solo en móvil (el del encabezado se oculta ahí). */
.sb-tenant { display: none; }
.sidebar select.input.sb-tenant { width: 100%; min-height: 40px; background: rgba(255,255,255,.08); color: #fff; border-color: rgba(201,162,39,.35); }
.sidebar .sb-tenant option { color: #0F1B2D; background: #fff; }
@media (max-width: 720px) { .sb-tenant { display: block; } }

/* ---------- AITA Marketing ---------- */
.mk-notice { margin-bottom: 8px; }
.mk-body { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.kpis.mk-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mk-usage { margin-top: 12px; }
.mk-usage-head { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-2); }
.mk-meter { height: 8px; border-radius: 4px; background: var(--muted-bg); overflow: hidden; margin-top: 6px; }
.mk-meter > span { display: block; height: 100%; background: var(--brand-accent); }
.mk-meter.full > span { background: var(--bad); }
.badge.mk-s-idea, .badge.mk-s-draft, .badge.mk-s-archived { background: var(--muted-bg); color: var(--text-2); }
.badge.mk-s-generating, .badge.mk-s-scheduled, .badge.mk-s-publishing { background: var(--info-bg); color: var(--info); }
.badge.mk-s-review { background: var(--warn-bg); color: var(--warn); }
.badge.mk-s-approved, .badge.mk-s-published { background: var(--ok-bg); color: var(--ok); }
.badge.mk-s-rejected, .badge.mk-s-failed { background: var(--bad-bg); color: var(--bad); }
.mk-checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.mk-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.mk-swatch { display: flex; gap: 8px; align-items: center; }
.mk-color { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.mk-logo { display: flex; align-items: center; gap: 10px; }
.mk-logo img { max-height: 48px; max-width: 160px; object-fit: contain; }
.mk-inherited { background: var(--brand-accent-soft); padding: 8px 12px; border-radius: var(--radius-sm); }
.mk-detail { display: grid; gap: 12px; }
.mk-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mk-detail-head h3 { margin: 0; flex: 1 1 auto; }
.mk-rows { display: grid; gap: 6px; }
.mk-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; font-size: 14px; white-space: pre-wrap; }
.mk-k { color: var(--text-3); }
.mk-actions { display: grid; gap: 10px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.mk-history { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.mk-comment { color: var(--text-2); font-style: italic; }
.mk-cal .mk-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mk-wd { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; padding: 4px; }
.mk-day { min-height: 96px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); }
.mk-day.out { background: var(--surface-2); opacity: .6; }
.mk-day.today { border-color: var(--brand-accent); box-shadow: inset 0 0 0 1px var(--brand-accent); }
.mk-num { font-size: 12px; color: var(--text-3); }
.mk-chip { text-align: left; border: 0; border-left: 3px solid var(--text-3); border-radius: 6px; background: var(--muted-bg); padding: 4px 6px; cursor: pointer; display: grid; gap: 1px; font: inherit; }
.mk-chip:focus-visible { outline: 2px solid var(--brand-accent); }
.mk-chip-title { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-chip-meta { font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-chip.mk-s-review { border-left-color: var(--warn); }
.mk-chip.mk-s-approved, .mk-chip.mk-s-published { border-left-color: var(--ok); }
.mk-chip.mk-s-scheduled, .mk-chip.mk-s-publishing { border-left-color: var(--info); }
.mk-chip.mk-s-rejected, .mk-chip.mk-s-failed { border-left-color: var(--bad); }
@media (max-width: 1280px) { .kpis.mk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .kpis.mk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-row { grid-template-columns: 1fr; gap: 2px; }
  /* En el teléfono el calendario se lee como lista: solo días con contenido. */
  .mk-cal .mk-grid { grid-template-columns: 1fr; }
  .mk-wd, .mk-day.empty-day, .mk-day.out { display: none; }
  .mk-day { min-height: 0; }
}
.mk-body .card-head select.input { width: auto; max-width: 220px; }

