:root {
  color-scheme: light;
  --ink: #172921;
  --muted: #56665e;
  --surface: #fff;
  --canvas: #f4f6f2;
  --line: #dfe6dd;
  --dark: #132a21;
  --green: #225e42;
  --lime: #d4ef9e;
  --red: #a03939;
  --radius: 16px;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p, dl, ol, ul { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .table-wrap:focus-visible {
  outline: 2px solid #587d23;
  outline-offset: 3px;
}

.skip-link { position: fixed; z-index: 3; top: 0; left: 1rem; transform: translateY(-130%); background: white; padding: 10px; }
.skip-link:focus { transform: translateY(0); }
.brand { display: inline-flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; font-size: 1.25rem; font-weight: 725; letter-spacing: -.045em; }
.brand-accent { color: var(--lime); }
.brand-mark { display: inline-flex; align-items: end; justify-content: center; gap: 2px; width: 32px; height: 32px; padding-bottom: 8px; border-radius: 9px; background: var(--lime); }
.brand-mark i { width: 3px; background: var(--dark); border-radius: 1px; }
.brand-mark i:nth-child(1) { height: 7px; }
.brand-mark i:nth-child(2) { height: 11px; }
.brand-mark i:nth-child(3) { height: 16px; }

.app-layout { display: grid; grid-template-columns: 225px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; position: sticky; top: 0; height: 100dvh; flex-direction: column; align-self: start; padding: 28px 16px 19px; background: var(--dark); color: #ebf2eb; }
.sidebar .brand { margin: 0 10px 44px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a, .signout button { display: flex; align-items: center; gap: 11px; padding: 11px 13px; text-decoration: none; border-radius: 9px; color: #c7d8ce; font-size: .875rem; font-weight: 600; }
.sidebar nav a:hover, .signout button:hover { background: #244438; color: white; }
.sidebar nav a[aria-current="page"] { background: var(--lime); color: var(--dark); }
.sidebar :focus-visible, .login-identity :focus-visible { outline-color: #ecffc9; }
.nav-icon { width: 15px; height: 15px; display: inline-block; position: relative; flex: none; border: 1.4px solid currentColor; border-radius: 3px; }
.icon-grid::before, .icon-grid::after { position: absolute; content: ""; background: currentColor; }
.icon-grid::before { top: 50%; left: 0; width: 100%; height: 1px; }
.icon-grid::after { top: 0; left: 50%; width: 1px; height: 100%; }
.icon-ticket { height: 11px; }
.icon-ticket::after { position: absolute; content: ""; height: 100%; border-left: 1px dashed currentColor; right: 3px; }
.icon-attempts::before, .icon-attempts::after { position: absolute; content: ""; height: 1px; background: currentColor; width: 7px; left: 3px; }
.icon-attempts::before { top: 4px; }
.icon-attempts::after { top: 8px; }
.signout { margin-top: auto; padding-top: 15px; border-top: 1px solid #345045; }
.signout button { width: 100%; background: none; border: none; text-align: left; }
.signout button > span:first-child { font-size: 1.2rem; line-height: 1; }
.topbar { min-height: 65px; display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px clamp(18px, 3.4vw, 52px); font-size: .875rem; }
.source, .profile { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.source i, .dot { border-radius: 50%; width: 8px; height: 8px; flex: none; background: #529265; }
.avatar { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--green); background: #e3efe1; }
.profile { min-width: 0; overflow-wrap: anywhere; }
.main-content { max-width: 1520px; margin: 0 auto; padding: 38px clamp(18px, 3.4vw, 52px) 52px; }
.page-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 24px; align-items: end; margin-bottom: 25px; }
.page-heading h1 { font-size: clamp(2rem, 3.4vw, 3.05rem); line-height: 1.05; letter-spacing: -.06em; font-weight: 720; }
.page-heading p { margin-top: 8px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.filters { display: flex; align-items: end; flex-wrap: wrap; gap: 9px; }
.filters label, .login-form label { display: block; margin-bottom: 6px; font-size: .765rem; font-weight: 670; color: var(--muted); }
select, .button { min-height: 39px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: .84rem; }
select { background: var(--surface); color: var(--ink); max-width: 100%; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; font-weight: 670; text-decoration: none; }
.primary { background: var(--green); border-color: var(--green); color: #fff; }
.primary:hover { background: #194b34; }
.secondary { color: var(--green); background: var(--surface); }
.secondary:hover { background: #eef3ec; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 15px; }
.metric { padding: 19px 20px 17px; }
.metric h2 { color: var(--muted); font-size: .875rem; font-weight: 650; }
.metric-value, .metric-values { margin: 9px 0 7px; padding: 0; list-style: none; font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 695; line-height: 1.15; letter-spacing: -.05em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-values small { font-size: .74rem; font-weight: 650; color: var(--muted); letter-spacing: 0; }
.metric-note, .section-heading p { color: var(--muted); font-size: .79rem; line-height: 1.4; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.insight-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; margin-bottom: 15px; }
.section-heading { display: flex; gap: 9px; align-items: center; justify-content: space-between; padding: 19px 20px 15px; }
.section-heading h2, .notice h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.024em; }
.section-heading p { margin-top: 4px; }
.chart-total { color: var(--green); background: #eaf2e4; border-radius: 8px; padding: 5px 10px; font-size: .875rem; }
.chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; list-style: none; padding: 0 20px 16px; }
.chart li { display: grid; gap: 7px; justify-items: center; color: var(--muted); font-size: .72rem; white-space: nowrap; }
.bar-track { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 24px, #edf1ed 24px, #edf1ed 25px); }
.bar { width: 67%; max-width: 48px; height: var(--height); min-height: 4px; background: #628d59; border-radius: 5px 5px 1px 1px; }
.bar-empty { background: #d9e5d8; }
.result-list { padding: 0 20px 12px; }
.result-list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 0; border-top: 1px solid var(--line); }
.result-list dt { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.result-list dd { margin: 0; font-weight: 680; }
.dot.lost { background: #bc6660; }
.dot.open { background: #ac8140; }
.result-empty { padding: 0 20px 20px; color: var(--muted); font-size: .875rem; }

.history .section-heading { min-height: 58px; }
.text-link, .pagination a { color: var(--green); text-decoration: none; font-size: .82rem; font-weight: 675; }
.text-link:hover, .pagination a:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 638px; border-collapse: collapse; text-align: left; font-size: .845rem; }
thead { background: #f4f7f2; color: var(--muted); }
thead th { padding: 10px 12px; font-size: .73rem; font-weight: 680; white-space: nowrap; }
tbody :is(th, td) { padding: 11px 12px; border-top: 1px solid #e8ede6; vertical-align: top; }
tr > :first-child { padding-left: 20px; }
tr > :last-child { padding-right: 20px; }
.selection-cell { width: 34%; font-weight: 650; }
.selection-cell summary { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; }
.selection-cell summary::-webkit-details-marker { display: none; }
.selection-cell summary i { width: 6px; height: 6px; flex: none; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.selection-cell details[open] summary i { transform: translateY(2px) rotate(225deg); }
.match { color: var(--muted); font-size: .74rem; font-weight: 450; margin-top: 5px; }
.row-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 4px; }
.bookmaker, .sport-tag { border-radius: 5px; padding: 2px 5px; font-size: .68rem; font-weight: 650; }
.bookmaker { background: #eaf2e4; color: #265a3b; }
.bookmaker.betfury { background: #f0e9fa; color: #593582; }
.sport-tag { background: #eef0ed; color: #4e6055; }
.bet-detail { margin-top: 8px; color: var(--muted); font-size: .73rem; }
.bet-detail div { display: grid; grid-template-columns: max-content 1fr; gap: 9px; margin-bottom: 4px; }
.bet-detail dd { margin: 0; font-weight: 450; overflow-wrap: anywhere; }
td small { font-size: .7rem; color: var(--muted); font-weight: 550; }
td time { white-space: nowrap; }
td time small { display: block; }
.number { white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; border-radius: 20px; padding: 4px 8px; white-space: nowrap; background: #eef0ed; color: #4e6055; font-size: .72rem; font-weight: 650; }
.badge:is(.won, .confirmada) { background: #e3efe1; color: #265a3b; }
.badge:is(.lost, .error) { background: #f8e6e3; color: #943b34; }
.badge:is(.open, .incierta, .pendiente) { background: #f5eddb; color: #77541e; }
.empty { padding: 22px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.pagination { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.notice { padding: 22px; }
.notice p { margin: 8px 0 15px; color: var(--muted); }
.results-notice { background: #fcf6e7; color: #6b5124; border: 1px solid #eee0c0; border-radius: 8px; padding: 10px 14px; margin-bottom: 15px; font-size: .875rem; }

.login-layout { min-height: 100dvh; display: grid; grid-template-columns: 1.03fr 1fr; }
.login-identity { position: relative; display: flex; flex-direction: column; align-items: flex-start; isolation: isolate; overflow: hidden; justify-content: center; padding: clamp(28px, 6vw, 100px); background: var(--dark); color: #f6faef; }
.login-identity .brand { position: absolute; top: clamp(24px, 6vh, 64px); }
.login-cover h1 { font-size: clamp(3.1rem, 6.4vw, 7rem); font-weight: 650; line-height: .99; letter-spacing: -.078em; }
.login-rings { position: absolute; z-index: -1; bottom: -23%; right: -36%; width: min(68vw, 920px); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(ellipse at 55% 55%, #395b37, transparent 64%); transform: rotate(-24deg); }
.login-rings i { position: absolute; inset: 6% 18%; border: 1px solid #829d68; opacity: .42; border-radius: 50%; }
.login-rings i:nth-child(2) { inset: 11% 23%; }
.login-rings i:nth-child(3) { inset: 16% 28%; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.login-form { width: min(100%, 345px); }
.login-form h2 { font-size: clamp(1.9rem, 3.5vw, 2.7rem); font-weight: 720; letter-spacing: -.06em; }
.login-form > p { margin-top: 7px; color: var(--muted); font-size: .92rem; }
.login-form form { margin-top: 27px; }
.login-form input:not([type="hidden"]) { width: 100%; min-height: 45px; background: white; color: var(--ink); border: 1px solid #cbd7cb; border-radius: 8px; padding: 9px 12px; margin-bottom: 15px; }
.login-form .button { justify-content: space-between; width: 100%; min-height: 48px; margin-top: 4px; }
.form-error, .errorlist { color: var(--red); background: #fbe7e4; border-radius: 8px; padding: 9px 11px; margin-bottom: 15px; font-size: .85rem; }
.errorlist { list-style: none; }

@media (max-width: 900px) {
  .app-layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-flow: row wrap; align-items: center; justify-content: space-between; gap: 13px; padding: 12px 18px; }
  .sidebar .brand { margin: 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .signout { margin: 0; padding-top: 0; border: 0; }
  .main-content { padding-top: 25px; }
}

@media (max-width: 620px) {
  .sidebar nav { order: 3; flex-basis: 100%; }
  .sidebar nav a { padding: 8px 10px; font-size: .78rem; gap: 6px; }
  .signout-text { display: none; }
  .topbar { min-height: 45px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric:first-child { grid-column: 1 / -1; }
  .metric { padding: 13px 14px; }
  .insight-grid { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .chart { gap: 6px; }
  .login-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-identity { min-height: 215px; justify-content: flex-end; }
  .login-cover h1 { font-size: clamp(2.65rem, 10vw, 4rem); }
  .login-panel { align-items: start; }
}
