/* HOP Finance Dashboard — tema House of Pubs (crimson + azul, look limpio).
   Solo estilos: la estructura HTML/JS no cambia. El logo se inyecta por CSS. */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --panel2: #f4f2f6; --line: #e7e3ec;
  --txt: #2a2233; --muted: #6b7280;
  --brand: #c0185b;          /* HoP crimson/magenta */
  --brand-dark: #9d1149;
  --brand2: #2541e0;         /* azul (Xeworks / acentos secundarios) */
  --violet: #7c3aed;         /* Attekmi */
  --green: #16a34a; --red: #dc2626; --amber: #d97706;
  --grad: linear-gradient(120deg, #1b34d6 0%, #6a2bd0 50%, #c0185b 100%);
  --shadow: 0 1px 3px rgba(20,16,40,.07), 0 1px 2px rgba(20,16,40,.04);
  --shadow-md: 0 6px 20px rgba(20,16,40,.10);
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--txt); font-size: 14px; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
h1 { font-size: 22px; letter-spacing: -.01em; } h2 { font-size: 18px; margin-top: 28px; } h3 { font-size: 15px; } h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Layout con sidebar */
.app { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar { width: 232px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  box-shadow: var(--shadow); position: sticky; top: 0; align-self: flex-start; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 14px; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 0; padding: 6px 8px 14px; }   /* oculta el texto "HOP" */
.brand::before { content: ""; width: 116px; height: 34px; flex: none; background: url("1-logo-header.svg") left center / contain no-repeat; }
.brand span { font-size: 11px; color: var(--muted); font-weight: 600; padding-left: 10px; border-left: 1px solid var(--line); letter-spacing: .02em; }
.sidebar nav { display: flex; flex-direction: column; gap: 14px; flex: 1; overflow-y: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group h4 { margin: 6px 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: var(--txt); padding: 9px 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px; transition: .15s; border-left: 3px solid transparent; }
.sidebar nav a svg { width: 17px; height: 17px; flex: none; opacity: .7; }
.sidebar nav a:hover { color: var(--brand); background: #fbeef4; }
.sidebar nav a.active { color: var(--brand); background: #fbeef4; border-left-color: var(--brand); }
.sidebar nav a.active svg { opacity: 1; }
/* Toggle responsive */
.nav-toggle { display: none; }
.nav-overlay { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: translateX(0); }
  .nav-overlay { display: block; position: fixed; inset: 0; background: rgba(20,16,40,.35); z-index: 30; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; position: fixed; top: 14px; left: 14px; z-index: 50; width: 40px; height: 40px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 18px; }
  .content { padding-top: 64px; }
}
.userbox { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 14px; }
.userbox-name { font-size: 12px; color: var(--txt); }
.logout { color: var(--brand); font-weight: 600; padding: 6px 14px; border: 1px solid var(--brand); border-radius: 999px; transition: .15s; }
.logout:hover { background: var(--brand); color: #fff; }

.content { padding: 24px; flex: 1; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.year-nav { display: flex; align-items: center; gap: 14px; }

/* Role badges */
.role-badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-weight: 700; letter-spacing: .02em; }
.role-admin { color: var(--brand); background: #fbeef4; border-color: #f1cfe0; }
.role-operations { color: var(--green); background: #e9f7ee; border-color: #c5ebd2; }
.role-finance { color: var(--amber); background: #fdf3e7; border-color: #f6dcb8; }
.role-viewer { color: var(--muted); }

/* KPIs */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 18px 0; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.kpi-label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi-val { display: block; font-size: 26px; font-weight: 800; margin-top: 8px; color: var(--txt); letter-spacing: -.02em; }
.cost-breakdown { color: var(--muted); font-size: 13px; margin: 6px 0; }

/* Month cards */
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.month-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .18s; box-shadow: var(--shadow); }
.month-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.month-card.empty { opacity: .55; cursor: default; box-shadow: none; }
.mc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.mc-head strong { font-size: 15px; }
.mc-row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); font-size: 13px; }
.mc-row b { color: var(--txt); }
.mc-empty { color: var(--muted); font-size: 13px; }
.alert-dot { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.status { font-size: 11px; padding: 2px 9px; border-radius: 999px; margin-left: auto; font-weight: 700; }
.status-open { background: #e9f7ee; color: var(--green); }
.status-closed { background: #fdeaea; color: var(--red); }

/* Subtabs / toggles — segmented control */
.subtabs, .view-toggle, .recon-toggle { display: inline-flex; gap: 4px; margin: 20px 0; flex-wrap: wrap; align-items: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.subtab, .vt, .rt { background: none; border: none; color: var(--muted); padding: 7px 14px; cursor: pointer; border-radius: 8px; font-size: 13px; font-weight: 600; transition: .15s; }
.subtab:hover, .vt:hover, .rt:hover { color: var(--txt); }
.subtab.active, .vt.active, .rt.active { color: var(--brand); background: var(--panel); box-shadow: var(--shadow); }
/* view-toggle con buscador (Demand/Supply): fila plana, no pill */
.view-toggle:has(input[type=search]) { display: flex; width: 100%; background: none; border: none; padding: 0; border-radius: 0; gap: 6px; }
.view-toggle input[type=search] { margin-left: auto; }

/* Tables */
.table-wrap { overflow: auto; max-height: calc(100vh - 200px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { background: var(--panel2); text-align: left; padding: 9px 12px; color: var(--muted); font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .03em; font-size: 10.5px; position: sticky; top: 0; z-index: 2; }
table.grid td { padding: 8px 12px; border-top: 1px solid var(--line); }
table.grid tbody tr:hover { background: #faf7fb; }
table.grid th.num, table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }
/* Indicador de partner registrado (nombre o alias) */
.pn { white-space: nowrap; }
.pn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.pn-ok { background: var(--green); } .pn-miss { background: #cbd5e1; }
/* Estado de conexión Xero (página Finance) */
.xero-conn { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.xero-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.xero-on { background: var(--green); } .xero-off { background: #cbd5e1; }
/* Ciclo de facturación (badges + lock) */
.cyc { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.cyc-sent { background: #e3f0ff; color: #1d4ed8; }
.cyc-lock { background: #fde8ef; color: var(--brand); }
.cyc-wait { background: #fde8e8; color: #c0392b; }   /* esperando confirmación (rojo) */
.cyc-ok { background: #d8f3e0; color: #1c8a48; }      /* respondido (verde) */
tr.row-locked td { background: #fcf5f8; }
.fin-card.fin-locked { border-color: #f3c6d8; }
/* Guías (docs provisorias) */
.doc { max-width: 980px; line-height: 1.6; }
.doc h1, .doc h2, .doc h3, .doc h4 { line-height: 1.3; }
.doc h2 { margin-top: 1.8em; padding-bottom: .3em; border-bottom: 1px solid var(--line); }
.doc h3 { margin-top: 1.4em; }
.doc p, .doc li { color: var(--text); }
.doc ul, .doc ol { padding-left: 1.4em; }
.doc li { margin: .25em 0; }
.doc li.doc-task { list-style: none; margin-left: -1.2em; }
.doc li.doc-task input { margin-right: .5em; }
.doc code { background: var(--panel2); padding: .1em .4em; border-radius: 4px; font-size: .9em; }
.doc pre { background: var(--panel2); padding: 12px 14px; border-radius: 8px; overflow: auto; }
.doc pre code { background: none; padding: 0; }
.doc blockquote { margin: 1em 0; padding: .6em 1em; border-left: 3px solid var(--accent); background: var(--panel2); border-radius: 0 8px 8px 0; }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 2em 0; }
.doc table.doc-table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.doc table.doc-table th, .doc table.doc-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc table.doc-table th { background: var(--panel2); }
table.grid tfoot tr.row-total td { background: var(--panel2); border-top: 2px solid var(--line); position: sticky; bottom: 0; }
.diff-high { color: var(--red); font-weight: 700; }
/* Fila confirmada (Status = Confirmed) → verde pastel suave (vista operativa) */
table.grid tbody tr.row-confirmed { background: #eefaf1; }
table.grid tbody tr.row-confirmed:hover { background: #e3f6e9; }
table.grid tbody tr.row-confirmed .cell-edit { background: #fbfffc; }
/* Fila pagada (Billing Status = Paid) → verde pastel suave */
table.grid tbody tr.row-paid { background: #eefaf1; }
table.grid tbody tr.row-paid:hover { background: #e3f6e9; }
table.grid tbody tr.row-paid .cell-edit { background: #fbfffc; }
/* Partial Paid → ámbar pastel suave */
table.grid tbody tr.row-partial { background: #fdf6ea; }
table.grid tbody tr.row-partial:hover { background: #fbeed6; }
table.grid tbody tr.row-partial .cell-edit { background: #fffdf8; }
/* Finance — tarjetas de facturación por advertiser */
.fin-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.fin-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 10px 14px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.fin-head .fin-adv { font-size: 15px; }
.fin-head label { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.fin-head .fin-kpi { font-size: 12px; color: var(--muted); }
.fin-head input.money-cell, .fin-head select { width: 130px; }
.fin-pubs { margin: 0; }
/* Dashboard */
.dash-h { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi-val { font-size: 20px; font-weight: 700; }
.kpi.pos .kpi-val { color: #1a8a4f; } .kpi.neg .kpi-val { color: var(--red); }
.dash-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.bars { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 130px; align-items: center; gap: 10px; font-size: 12px; }
.bar-lbl { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #f0eef2; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bar-val { text-align: right; font-weight: 600; }
.bar-val small { color: var(--muted); font-weight: 400; }
.inv-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 18px; padding: 12px 14px; }
.inv-meta > div { display: flex; flex-direction: column; font-size: 13px; }
.inv-meta span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.partner-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; max-width: 900px; margin-bottom: 18px; }
.partner-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.partner-form .chk-row { flex-direction: row; gap: 16px; }
.fin-pubs th { font-size: 10px; }
.cell-edit { width: 100%; min-width: 70px; background: #fff; border: 1px solid var(--line); color: var(--txt); border-radius: 7px; padding: 5px 7px; }
.cell-edit:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(192,24,91,.14); }
.cell-edit.saved { border-color: var(--green); } .cell-edit.err { border-color: var(--red); }

/* Inputs / buttons */
input, select { background: #fff; border: 1px solid var(--line); color: var(--txt); border-radius: 8px; padding: 8px 10px; font-family: inherit; }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(192,24,91,.14); }
button { cursor: pointer; font-family: inherit; }
.btn-sm { background: #fff; border: 1px solid var(--line); color: var(--txt); border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 600; transition: .15s; }
.btn-sm:hover { border-color: var(--brand); color: var(--brand); background: #fbeef4; }
.btn-primary { background: var(--brand); color: #fff; border: none; border-radius: 999px; padding: 9px 18px; font-weight: 700; transition: .15s; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; border: 1px solid var(--line); color: var(--txt); border-radius: 999px; padding: 9px 16px; font-weight: 600; }
.btn-ghost { background: none; border: none; color: var(--brand); font-weight: 600; padding: 6px 10px; border-radius: 8px; }
.btn-ghost:hover { background: #fbeef4; }
.btn-primary:active, .btn-sm:active { transform: translateY(1px); }
.btn-primary:disabled, .btn-sm:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary:focus-visible, .btn-sm:focus-visible, .btn-secondary:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(192,24,91,.22); }
/* Skeleton de carga */
.skeleton, .table-wrap:empty { min-height: 120px; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--panel2) 25%, #ece9f0 37%, var(--panel2) 63%);
  background-size: 400% 100%; animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.add-row { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; }
.io-bar { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; align-items: center; }
.io-import { cursor: pointer; }
.split-bar label { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--muted); }

/* Alerts */
.alerts { list-style: none; padding: 0; }
.alerts li { padding: 10px 14px; border-radius: 10px; margin-bottom: 7px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); }
.alerts li.sev-high { border-left-color: var(--red); background: #fef6f6; }
.alerts li.sev-info { border-left-color: var(--brand2); background: #f3f5ff; }
.alerts li.ok { border-left-color: var(--green); color: var(--muted); }
.alert { background: #fdf0f4; color: var(--brand-dark); border: 1px solid #f3cfe0; padding: 12px 16px; border-radius: 10px; }

/* Reconciliation */
.recon-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h3 { margin-top: 0; }
.panel select { width: 100%; margin-bottom: 12px; }
.kpi-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; gap: 8px; }
.kpi-row input { width: 130px; }
.chain { padding: 11px 14px; border-radius: 10px; margin: 12px 0; font-weight: 700; border: 1px solid transparent; }
.chain-green { background: #e9f7ee; color: #15803d; border-color: #c5ebd2; }
.chain-red { background: #fdeaea; color: #b42318; border-color: #fbd5d5; }
.chain-amber { background: #fdf3e7; color: #b45309; border-color: #f6dcb8; }
.linked { list-style: none; padding: 0; }
.linked li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.linked li b { margin-left: auto; }
.lk-amt-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: 4px; }
.linked .lk-name { font-weight: 700; }
.linked .lk-note { flex-basis: 100%; }
.linked .lk-note input { width: 100%; font-size: 12px; }
.recon-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.recon-filters select, .recon-filters input { font-size: 12px; padding: 5px 7px; }
.recon-filters .rf-q { flex: 1; min-width: 90px; }
button.badge { border: none; cursor: pointer; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.badge-paid { background: #e9f7ee; color: #15803d; } .badge-pending { background: #fdf3e7; color: #b45309; }
.badge-urgent { background: #fdeaea; color: #b42318; }
.badge-partial { background: #fdf3e7; color: #b45309; }
.lk-cb { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-right: 8px; }
.lk-cb input { width: 90px; }
.plat { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--panel2); font-weight: 700; }
.plat-xeworks { color: var(--brand2); background: #eaeefe; } .plat-attekmi { color: var(--violet); background: #f3effe; } .plat-external { color: var(--muted); background: #eef0f3; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--grad); }
.login-card { background: var(--panel); border-radius: 18px; padding: 36px 32px; width: 360px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 50px rgba(20,16,40,.28); }
.login-card h1 { font-size: 0; text-align: center; margin: 0 0 12px; }
.login-card h1::before { content: ""; display: block; width: 168px; height: 50px; margin: 0 auto 4px; background: url("1-logo-header.svg") center / contain no-repeat; }
.login-card h1 span { font-size: 13px; color: var(--muted); font-weight: 600; display: block; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
.login-card button { background: var(--brand); color: #fff; border: none; border-radius: 999px; padding: 12px; font-weight: 700; margin-top: 10px; transition: .15s; }
.login-card button:hover { background: var(--brand-dark); }

/* Dialog */
dialog { background: var(--panel); color: var(--txt); border: none; border-radius: var(--radius); padding: 26px; width: 400px; box-shadow: 0 20px 50px rgba(20,16,40,.3); }
dialog::backdrop { background: rgba(30,20,45,.45); }
#user-form, #ld-form { display: flex; flex-direction: column; gap: 12px; }
#user-form label, #ld-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
#user-form label.chk { flex-direction: row; align-items: center; }
#ld-dialog { width: 440px; max-width: 92vw; }
#ld-form input { width: 100%; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 13px 20px; border-radius: 10px; transition: opacity .3s; z-index: 100; color: #fff; box-shadow: var(--shadow-md); font-weight: 600; }
.toast.ok { background: var(--green); } .toast.err { background: var(--red); }

/* Lotus Demand grid */
.nowrap { white-space: nowrap; }
.ld-trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ld-wrap { max-height: 70vh; overflow: auto; }
.ld-table { font-size: 12px; }
.ld-table th, .ld-table td { white-space: nowrap; }
.ld-table th.ld-day { text-align: right; min-width: 86px; padding: 9px 10px; }
.ld-table td.ld-cell { padding: 4px 6px; text-align: right; min-width: 86px; }
.ld-table th.ld-total, .ld-table td.ld-total { background: var(--panel2); min-width: 110px; border-left: 2px solid var(--line); }
.ld-input { width: 92px; text-align: right; background: transparent; border: 1px solid transparent; padding: 6px 7px; font-size: 13px; border-radius: 5px; }
.ld-input:hover { border-color: var(--line); background: #fff; }
.ld-input:focus { border-color: var(--brand); background: #fff; }
.ld-cell.cell-manual { background: #fdf3e7; }
.ld-cell.cell-manual .ld-input { font-weight: 700; color: #b45309; }
/* OJO: nada de `opacity` en la fila — crea stacking context y vuelve translúcidas las celdas
   sticky (las celdas de días se verían a través al scrollear). Se atenúa con color + fondo. */
.row-inactive { background: #f4f2f6; }
.row-inactive td { color: var(--muted); }
.row-inactive td.ld-sticky { background: #f4f2f6; }
.row-inactive .ld-input { color: var(--muted); }
/* Endpoint prendido este mes → fila en verde pastel tenue */
.row-active { background: #effaf2; }
.row-active td.ld-sticky { background: #effaf2; }
.row-active:hover, .row-active:hover td.ld-sticky { background: #e3f6e9; }
.ld-act { width: 64px; text-align: center; }
.ld-actwrap { display: inline-flex; align-items: center; gap: 6px; }
.ld-toggle { padding: 2px 8px; border-radius: 999px; }
.ld-toggle.on { background: #d8f3e0; border-color: #9bdcb0; color: #1c8a48; font-weight: 700; }
.ld-toggle.off { color: var(--muted); }
.ld-bulkbar { position: sticky; left: 0; }
/* Columnas fijas SIEMPRE por encima de las celdas de días al scrollear (los headers .grid th
   ya usan z-index:2, así que acá vamos más alto para ganar el empate). */
.ld-sticky { position: sticky; background: var(--panel); z-index: 4; }
thead .ld-sticky, .ld-table th.ld-sticky { z-index: 6; background: var(--panel2); }
/* Las columnas fijas DEBEN tener ancho fijo: si crecen con el contenido, los offsets `left`
   de abajo dejan de coincidir y la grilla se desalinea (recorte con ellipsis; el valor completo
   queda en el title). Los `width` suman exactamente las distancias entre offsets. */
.ld-table th.ld-sticky, .ld-table td.ld-sticky {
  box-sizing: border-box; overflow: hidden; text-overflow: ellipsis;
}
/* min-width + max-width (NO `width`): en tablas auto-layout el `width` no se respeta cuando la
   celda está vacía (la columna se encoge al contenido); min/max iguales fuerzan el ancho exacto
   aunque la columna esté vacía → los offsets `left` coinciden y no hay huecos ni solapamientos. */
.ld-table .ld-act { left: 0; min-width: 64px; max-width: 64px; }
.ld-table .ld-c0 { left: 64px; min-width: 100px; max-width: 100px; }
.ld-table .ld-c1 { left: 164px; min-width: 110px; max-width: 110px; }
.ld-table .ld-c2 { left: 274px; min-width: 70px; max-width: 70px; }
.ld-table .ld-c3 { left: 344px; min-width: 60px; max-width: 60px; }
.ld-table .ld-c4 { left: 404px; min-width: 160px; max-width: 160px; }
.ld-table .ld-c5 { left: 564px; min-width: 100px; max-width: 100px; }
.ld-table .ld-c6 { left: 664px; min-width: 90px; max-width: 90px; box-shadow: 2px 0 4px rgba(20,16,40,.06); }
