:root {
  color-scheme: light;
  --bg: #f8f7fb; --paper: #fff; --ink: #222035; --muted: #625e75;
  --line: #e7e2f0; --purple: #5a32c7; --lilac: #f0eaff; --danger: #ab253f;
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -.045em; }
h2 { font-size: 1.25rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
.muted, .subheading { color: var(--muted); }
.subheading { font-weight: 500; }
.error { color: var(--danger); }
.logo { display: block; width: 114px; height: auto; object-fit: contain; }
.access {
  display: grid;
  grid-template-columns: minmax(360px, .92fr) minmax(0, 1.08fr);
  min-height: 100svh;
  background: #fbfafd;
}
.login-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(100% - 84px, 510px);
  margin-inline: auto;
  padding-block: clamp(26px, 5vh, 54px);
}
.login-brand {
  display: flex;
  align-items: center;
  width: fit-content;
  gap: 10px;
  color: #241936;
  font-size: 1.25rem;
  font-weight: 770;
  letter-spacing: -.04em;
}
.login-brand img { object-fit: contain; }
.login-content { align-self: center; width: min(100%, 420px); padding-block: clamp(56px, 8vh, 100px); }
.login-heading h1 { color: #211631; font-size: clamp(2.1rem, 3.65vw, 3.45rem); letter-spacing: -.06em; }
.login-heading p { color: #615770; font-size: 1.05rem; max-width: 34ch; margin-top: 14px; }
.login-panel form { display: grid; gap: 17px; margin-top: 34px; }
.login-panel label { color: #312643; gap: 7px; font-size: .9rem; }
.login-panel input:not([type="checkbox"]) {
  min-height: 49px;
  border-color: #ddd6e8;
  border-radius: 10px;
  padding-inline: 13px;
}
.login-panel .primary {
  min-height: 49px;
  border-radius: 10px;
  margin-top: 4px;
  background: #5b36cc;
  box-shadow: 0 4px 10px #5b36cc25;
}
.login-panel .primary:hover { background: #4b27b2; }
.login-panel .error { font-size: .88rem; }
.login-panel .error:empty { display: none; }
.login-scope { color: #6b617a; font-size: .83rem; }
.brand-panel {
  min-height: 560px;
  margin: 14px 14px 14px 0;
  border-radius: 24px;
  background-color: #211434;
  background-image: url("contabilidad-hero.webp"), radial-gradient(ellipse at 63% 37%, #4b2a8a, #181027 72%);
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 0 1px #f5e8ff17;
}
#portal { display: grid; grid-template-columns: 224px minmax(0,1fr); }
.sidebar { background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  gap: 24px; height: 100svh; position: sticky; top: 0; padding: 28px 16px 20px; }
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 3px 8px 9px;
  font-size: 1.43rem; font-weight: 780; letter-spacing: -.05em; color: #221739;
}
.sidebar-brand img { object-fit: contain; }
nav { display: grid; gap: 5px; }
nav a { color: var(--muted); border-radius: 8px; padding: 10px; text-decoration: none; font-size: .91rem; font-weight: 590; }
nav a:hover, nav a[aria-current] { background: var(--lilac); color: var(--purple); }
.logout { margin-top: auto; }
.workspace { width: min(100%, 1640px); padding: clamp(16px, 3.2vw, 48px); display: grid; gap: 22px; }
.page-header, .section-heading { display: flex; gap: 14px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.page-header .muted { margin-top: 7px; }
.pill { color: #55349f; background: var(--lilac); border-radius: 30px; padding: 5px 11px; font-size: .82rem; font-weight: 690; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: clamp(14px, 2vw, 24px);
  box-shadow: 0 2px 5px #2c1a4b06; min-width: 0; scroll-margin-top: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-top: 15px; }
label { display: grid; gap: 4px; color: var(--muted); font-size: .84rem; font-weight: 620; }
label.check { display: flex; align-items: center; gap: 6px; min-height: 40px; }
input, select, button { font: inherit; color: inherit; }
input:not([type="checkbox"]), select, button { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 7px 11px; }
input[type="checkbox"] { accent-color: var(--purple); }
input[type="number"] { width: 120px; }
button { cursor: pointer; font-weight: 690; }
button.primary { color: white; background: var(--purple); border-color: var(--purple); }
button.primary:hover { background: #4922b1; }
button.secondary:hover { background: var(--lilac); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.status { margin: 10px 0; font-size: .86rem; }
.status:empty { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); gap: 10px; margin-top: 13px; }
.metric { border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
.metric.emphasis { background: var(--lilac); border-color: #e4d6ff; }
.metric-label { color: #584a76; font-size: .8rem; font-weight: 650; }
.metric-value { display: block; font-size: 1.25rem; font-weight: 750; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.metric-note { color: var(--muted); font-size: .77rem; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin: 12px 0; }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 650; color: var(--purple); }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: 10px; }
thead { background: #f3eff9; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); }
th { white-space: nowrap; color: #4c3c69; }
td.number { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.numeric-heading { text-align: right; }
td:nth-child(5) { overflow-wrap: anywhere; }
tr.total { font-weight: 700; background: var(--lilac); }
tr.child th { font-weight: 500; padding-left: 22px; }
tr.grandchild th { font-weight: 450; padding-left: 35px; }
.columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.pagination { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
@media (max-width: 900px) {
  #portal { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { grid-row: 2; grid-column: 1 / -1; display: flex; overflow: auto; white-space: nowrap; }
  .logout { grid-row: 1; grid-column: 2; }
  .columns { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .access { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .login-panel { width: min(100% - 48px, 430px); padding: 28px 0 22px; }
  .login-content { padding: 48px 0 35px; }
  .login-heading h1 { font-size: clamp(2rem, 8vw, 2.75rem); }
  .brand-panel {
    min-height: 165px;
    margin: 0 16px 16px;
    border-radius: 16px;
    background-position: 50% 53%;
  }
}


.report-panel h2 { color: #251b39; font-size: 1.34rem; }
.report-header {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding-bottom: 15px; border-bottom: 1px solid var(--line);
}
.report-header p { margin-top: 4px; font-size: .87rem; }
.report-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.report-filters label { min-width: 115px; }
.report-filters .secondary { color: var(--purple); }
.rate-note { margin: 15px 0 10px; color: #625078; font-size: .85rem; }
.report-kpis, .cash-totals {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
}
.report-kpis .metric, .cash-totals .metric { padding: 14px; background: #fcfbfe; }
.report-kpis .metric.emphasis, .cash-totals .metric.emphasis {
  border-color: #ddd0fa; background: #f1ebff;
}
.report-kpis .metric-value, .cash-totals .metric-value {
  font-size: clamp(1.16rem, 2vw, 1.54rem); margin-block: 4px; overflow-wrap: anywhere;
}
.report-kpis .metric-label, .cash-totals .metric-label { line-height: 1.35; }
.billing-breakdown {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 12px; margin-block: 18px;
}
.report-block { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.report-block h3, .report-history h3 { margin: 0; color: #322449; }
.report-block table { margin-top: 6px; }
.report-block th[scope="row"] { font-weight: 550; white-space: normal; }
.report-block tr:last-child > * { border-bottom: 0; }
.report-note { margin-top: 8px; font-size: .83rem; }
.report-history { margin-top: 18px; }
.report-history th[scope="row"] { font-weight: 600; }
.report-details { padding: 12px 0 0; border-top: 1px solid var(--line); margin-top: 16px; }
.report-details .table-scroll { margin-top: 9px; }
.cash-totals { grid-template-columns: repeat(2, minmax(0, 260px)); margin-block: 14px; }
.cash-table th { padding-block: 11px; }
.cash-table td:nth-child(2) { font-weight: 720; color: #30204e; }
.cash-table td:nth-child(3), .cash-table td:nth-child(5) { color: var(--muted); }
.cash-table tbody tr:hover, .report-history tbody tr:hover { background: #faf7ff; }
@media (max-width: 1180px) {
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .billing-breakdown { grid-template-columns: 1fr; }
}
@media (max-width: 390px) {
  .report-kpis .metric, .cash-totals .metric { padding: 10px; }
}
