/* Elementos base y componentes comunes. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; overflow: hidden; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--n0);
  color: var(--fg1);
  font: 400 13.5px/1.45 var(--body);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font: 600 14px/1.3 var(--body); text-wrap: balance; }
p, ul, ol, dl, dd, figure, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
small { font-size: 12.5px; }
[hidden] { display: none !important; }
[popover] { margin: 0; border: 0; padding: 0; background: none; color: inherit; inset: auto; overflow: visible; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: -.01em; word-spacing: -.28em; }
.muted { color: var(--fg3); }
.tnum { font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
.accent { color: var(--accent); }
.red { color: var(--red); }
.green { color: var(--green); }
.grow { flex: 1; }
@media (max-width: 759px) { .only-desk { display: none !important; } }
@media (hover: none) { .btn kbd { display: none; } }

.i { width: 16px; height: 16px; flex: none; }
.glyph { width: 14px; height: 14px; flex: none; color: var(--c); }

.logo { display: block; height: 40px; width: auto; flex: none; color: #fff; overflow: visible; }
.logo-sub { font: 500 34px var(--body); fill: #fff; }
.logo-mark { display: block; width: 28px; height: 28px; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--r-m);
  background: var(--n3); border: 1px solid var(--line-2); color: var(--fg1);
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: background-color .15s, border-color .15s, transform .16s var(--ease-out);
}
.btn:hover { background: var(--n4); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-accent { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-accent:hover { background: var(--accent-hi); }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: var(--r-s); }
.btn kbd { margin-left: 4px; background: rgba(10, 31, 61, .14); border-color: transparent; color: inherit; }
.btn:not(.btn-accent) kbd { background: var(--n4); border-color: var(--line); color: var(--fg2); }
.btn-count { min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; border-radius: 999px; background: rgba(10, 31, 61, .16); font-size: 11.5px; font-weight: 600; }

.ghost-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--r-m); color: var(--fg2);
  transition: background-color .15s, color .15s, transform .16s var(--ease-out);
}
.ghost-btn .i { width: 17px; height: 17px; }
.ghost-btn:hover { background: var(--n3); color: var(--fg1); }
.ghost-btn:active { transform: scale(.94); }
.ghost-btn:disabled { opacity: .35; cursor: not-allowed; }
.ghost-btn.on { color: var(--accent); }
.ghost-btn.xs { width: 24px; height: 24px; border-radius: var(--r-s); }
.ghost-btn.xs .i { width: 14px; height: 14px; }
.link-btn { color: var(--fg2); font-size: 12.5px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.link-btn:hover { color: var(--fg1); }

kbd {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 4px; border: 1px solid var(--line-2); background: var(--n3);
  font: 500 11px/1 var(--mono); color: var(--fg2);
}
.keys { display: inline-flex; gap: 3px; flex: none; }

/* Campos */
.input {
  width: 100%; min-height: 36px; padding: 8px 11px; border-radius: var(--r-m);
  background: var(--n1); border: 1px solid var(--line-2); color: var(--fg1); line-height: 1.45;
  transition: border-color .15s;
}
.input::placeholder { color: var(--fg3); }
.input:hover { border-color: rgba(150, 182, 228, .32); }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.input { resize: vertical; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--fg2); }
.select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  height: 26px; padding: 0 24px 0 9px; border-radius: var(--r-s);
  background: var(--n2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23a9bbd6' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 6px center / 13px;
  border: 1px solid var(--line-2); font-size: 12px; font-weight: 600; color: var(--fg2);
}
.check { display: inline-grid; cursor: pointer; position: relative; width: 16px; height: 16px; vertical-align: middle; }
.check input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.check span { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-2); background: var(--n1); color: transparent; transition: background-color .12s, border-color .12s; }
.check .i { width: 11px; height: 11px; }
.check:hover span { border-color: var(--fg3); }
.check input:checked + span, .check input:indeterminate + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Pastillas y chips */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px 0 6px;
  border-radius: 999px; white-space: nowrap; font-size: 12px; font-weight: 600;
  color: color-mix(in srgb, var(--c) 82%, #fff);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent);
}
.pill .i { width: 13px; height: 13px; }
.inv-dia.pill, .inv-pend.pill, .inv-venc.pill, .role-admin.pill, .role-com.pill, .role-part.pill { padding-left: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  background: var(--n3); box-shadow: inset 0 0 0 1px var(--line); font-size: 12px; font-weight: 500; color: var(--fg2); white-space: nowrap;
}
.chip .i { width: 13px; height: 13px; }
.delta {
  display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font: 600 11.5px/1.4 var(--mono); opacity: 0; white-space: nowrap;
}

/* Personas */
.av {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none;
  font: 700 9.5px/1 var(--body); letter-spacing: .02em; color: var(--accent-ink);
}
.av.lg { width: 32px; height: 32px; font-size: 11.5px; }
.av-javier, .av-viewer { background: #6DB9FF; }
.av-nuria { background: #8db9ff; }
.av-oscar { background: #6fe0d8; }
.av-hugo { background: #f3b49a; }
.person { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

/* Paneles */
.panel {
  background: var(--n2); border: 1px solid var(--line); border-radius: var(--r-l); min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}
.panel.pad { padding: 16px; }
.panel.flush { overflow: hidden; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.panel-m { font-size: 12.5px; color: var(--fg3); white-space: nowrap; }
.panel-t { font-size: 14px; }
.panel-sub { margin-top: 3px; font-size: 12.5px; color: var(--fg3); }
.figure { font: 850 28px/1.1 var(--display); font-stretch: 108%; letter-spacing: -.015em; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.figure.light { color: var(--fg1); }
.empty { padding: 20px 16px; color: var(--fg2); }

/* Pestañas con indicador deslizante */
.tabs { position: relative; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; flex: none;
  font-size: 13px; font-weight: 600; color: var(--fg3); white-space: nowrap; transition: color .15s;
}
.tab-btn .num { font-size: 11.5px; color: var(--fg3); }
.tab-btn:hover { color: var(--fg1); }
.tab-btn[aria-selected="true"] { color: var(--fg1); }
.tab-ind {
  position: absolute; left: 0; bottom: 0; width: 1px; height: 2px; background: var(--accent);
  transform-origin: left; transition: transform .24s var(--ease-drawer); pointer-events: none;
}

/* Tablas */
.table-wrap { overflow-x: auto; }
.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data th {
  padding: 0 12px; height: 34px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 600; color: var(--fg3); border-bottom: 1px solid var(--line-2);
}
.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.data tbody tr:last-child td { border-bottom: 0; }
.data .r { text-align: right; }
.panel .data th:first-child, .panel .data td:first-child { padding-left: 16px; }
.panel .data th:last-child, .panel .data td:last-child { padding-right: 16px; }
.data tfoot td { border-top: 1px solid var(--line-2); border-bottom: 0; color: var(--fg2); font-weight: 600; }
.num .muted { font-family: var(--body); font-size: 12.5px; word-spacing: normal; }
.data.compact td { padding: 7px 12px; }
.data tbody tr[data-act] { cursor: pointer; transition: background-color .12s; }
.data tbody tr[data-act]:hover { background: rgba(255, 255, 255, .025); }
.data tr:focus-visible { outline-offset: -2px; }
.row-name { text-align: left; font-weight: 600; color: var(--fg1); }
.row-name small { display: block; font-weight: 400; color: var(--fg3); }
.cell-sub { display: block; font-size: 12px; color: var(--fg3); }
.yes { color: var(--green); font-weight: 600; }
.own { color: var(--teal); font-weight: 600; }

/* Datos clave-valor */
.facts { display: grid; gap: 8px; margin-top: 12px; }
.facts > div { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: baseline; }
@media (max-width: 479px) { .facts > div { grid-template-columns: 96px minmax(0, 1fr); } }
.facts dt { color: var(--fg3); font-size: 12.5px; }
.facts dd { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Anillos: dos medias coronas que giran */
.ring { --sz: 56px; --th: 6px; position: relative; width: var(--sz); height: var(--sz); flex: none; }
.ring::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: var(--th) solid var(--n4); }
.ring-fill, .rh { position: absolute; inset: 0; }
.rh.r { clip-path: inset(0 0 0 50%); }
.rh.l { clip-path: inset(0 50% 0 0); }
.rh i { position: absolute; inset: 0; border-radius: 50%; border: var(--th) solid var(--accent); opacity: 0; }
.rh.r i { clip-path: inset(0 50% 0 0); }
.rh.l i { clip-path: inset(0 0 0 50%); }
.cap { position: absolute; inset: 0; opacity: 0; }
.cap::before { content: ""; position: absolute; left: 50%; top: 0; width: var(--th); height: var(--th); margin-left: calc(var(--th) / -2); border-radius: 50%; background: var(--accent); }
.ring-v { position: absolute; inset: 0; display: grid; place-items: center; font: 600 13px/1 var(--mono); font-variant-numeric: tabular-nums; }
.ring-v b { font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-delay: 0s !important; }
}
