@font-face {
  font-family: Geist;
  src: url("./assets/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --background: #101514;
  --sidebar: #141a18;
  --card: #171d1b;
  --input: #121715;
  --border: #2b3530;
  --text: #eef3ef;
  --muted: #a3b2aa;
  --primary: #52d9a5;
  --primary-hover: #7ae4bb;
  --mint: #61dcb1;
  --slate: #80bcce;
  --amber: #eec084;
  --danger: #ffb2a9;
  --radius: 0.75rem;
  font: 400 14px/1.5 Geist, system-ui, sans-serif;
  background: var(--background);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none; }
body { margin: 0; min-width: 0; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.65; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  z-index: 10;
  inset: 0.5rem auto auto 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border-radius: var(--radius);
}

.muted { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 0.72rem; }
.brand-mark { display: block; flex-shrink: 0; border-radius: 0.55rem; }
.wordmark { display: flex; flex-direction: column; gap: 0.1rem; }
.wordmark strong { line-height: 1.25; letter-spacing: -0.025em; white-space: nowrap; }
.wordmark strong span { color: var(--primary); }
.wordmark small { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }
.text-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--primary); font-weight: 550; }
.text-link:hover { color: var(--primary-hover); text-decoration: underline; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text);
  font-weight: 550;
  white-space: nowrap;
}

.button.outline { border-color: var(--border); }
.button.outline:hover, .button.icon-button:hover { background: #24312b; }
.button.primary { background: var(--primary); color: #071d14; }
.button.primary:hover { background: var(--primary-hover); }
.icon-button { width: 2.65rem; padding: 0.35rem; }

input, select {
  min-width: 0;
  min-height: 2.65rem;
  border: 1px solid #35423b;
  border-radius: 0.5rem;
  padding: 0.55rem 0.7rem;
  background: var(--input);
  color: var(--text);
}

.session-loading {
  display: grid;
  place-content: center;
  justify-items: center;
  min-height: 100svh;
  padding: 1.5rem;
  gap: 1.1rem;
  color: var(--muted);
}

.login {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3.5rem;
  padding: clamp(2rem, 5vw, 5.25rem);
  background:
    radial-gradient(ellipse at 8% 40%, #1f3228 2%, transparent 66%),
    radial-gradient(ellipse at 95% 90%, #33261d 1%, transparent 55%),
    #151c19;
  border-right: 1px solid var(--border);
}

.login-brand .wordmark strong, .login-mobile-brand .wordmark strong { font-size: 1.2rem; }
.login-intro { max-width: 31rem; }
.login-intro h1 { font-size: clamp(2.35rem, 4.15vw, 4.65rem); letter-spacing: -0.05em; line-height: 1.02; }
.login-intro p { margin-top: 1.25rem; color: var(--muted); font-size: 1.12rem; max-width: 26rem; }
.login-home { align-self: flex-start; }
.login-access { display: grid; align-content: center; justify-items: center; padding: 2rem; }
.login-mobile-brand { display: none; }
.login-card { width: min(100%, 29rem); padding: clamp(1.4rem, 4vw, 2.5rem); }
.login-card h2 { font-size: 1.85rem; letter-spacing: -0.04em; }
.login-card .muted { margin: 0.5rem 0 1.75rem; }
.login-card form { display: grid; gap: 0.65rem; }
.login-card label { font-weight: 600; }
.login-card input { width: 100%; margin-bottom: 0.55rem; }
.login-card .primary { margin-top: 0.45rem; min-height: 2.95rem; }
.password-field { position: relative; }
.password-field input { padding-right: 3rem; }
.password-field .icon-button { position: absolute; inset: 0.14rem 0.15rem auto auto; min-height: 2.35rem; color: var(--muted); }
.form-error, .session-error { color: var(--danger); padding: 0.75rem 0.9rem; border-radius: 0.5rem; border: 1px solid #784741; background: #3b2926; }
.session-error { margin-bottom: 1.5rem; }

.shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100svh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); }
.sidebar > .brand { min-height: 4rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); }
.navigation { display: grid; gap: 0.3rem; padding: 1rem 0.7rem; }
.navigation a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-weight: 550;
  padding: 0.65rem 0.8rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
}
.navigation a:hover { color: var(--text); background: #233029; }
.navigation a[aria-current] { background: #1e362b; color: var(--primary); }
.navigation a[aria-current]::before {
  position: absolute;
  content: "";
  inset: 25% auto 25% 0;
  width: 2px;
  border-radius: 8px;
  background: var(--primary);
}

.topbar {
  min-height: 4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 0.55rem clamp(0.9rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--border);
}

.topbar-context { margin-right: auto; display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.topbar-context strong { color: var(--text); }
.topbar-separator { color: #84948b; }
.account-name { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.logout { font-size: 0.9rem; }
.content { max-width: 121rem; margin: 0 auto; padding: clamp(1rem, 3vw, 2.7rem); }
.content:focus, .login:focus { outline: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.15rem; margin-bottom: 1.65rem; }
.page-heading h1 { font-size: clamp(2rem, 3.5vw, 2.85rem); font-weight: 650; letter-spacing: -0.05em; }
.page-heading p { margin-top: 0.45rem; color: var(--muted); }
.controls { display: flex; align-items: center; gap: 0.55rem; }
.controls label { color: var(--muted); font-size: 0.86rem; font-weight: 550; }
.page-body { display: grid; gap: 1.15rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.75rem), 1fr)); gap: 0.85rem; }
.stat { padding: 1rem 1.1rem 1.15rem; }
.stat-heading { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.stat-heading h2 { font-size: 0.92rem; font-weight: 550; color: var(--muted); }
.stat strong { display: block; margin: 0.75rem 0 0.16rem; font-size: clamp(1.65rem, 3vw, 2.1rem); font-weight: 650; letter-spacing: -0.05em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat p { color: var(--muted); font-size: 0.82rem; }
.metric-icon { display: grid; place-items: center; height: 2.42rem; width: 2.42rem; flex-shrink: 0; border-radius: 0.55rem; }
.metric-icon.mint { color: var(--mint); background: #224137; }
.metric-icon.slate { color: var(--slate); background: #21343a; }
.metric-icon.amber { color: var(--amber); background: #41352a; }

.link-card { padding: 1.2rem 1.25rem; background: linear-gradient(100deg, #1a2721, var(--card) 72%); }
.link-heading { display: flex; align-items: flex-start; gap: 0.75rem; }
.link-heading h2, .section-heading h2, .terms h2 { font-size: 1.1rem; font-weight: 630; letter-spacing: -0.018em; }
.link-heading p, .section-heading p, .terms p { margin-top: 0.35rem; color: var(--muted); }
.link-controls { display: flex; gap: 0.55rem; max-width: 43rem; margin-top: 1rem; }
.link-field { flex: 1; width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 0.91rem; }
.copy-feedback { margin-top: 0.6rem; color: var(--primary); }

.panel { padding: 1.25rem; }
.panel-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.45rem 0.75rem; }
.section-heading > .text-link { font-size: 0.87rem; }
.graph { display: block; width: 100%; margin: 0.9rem auto 0.25rem; max-height: 19rem; overflow: visible; }
.graph .graph-grid { stroke: var(--border); stroke-dasharray: 3 3; }
.graph text { fill: var(--muted); font-family: inherit; font-size: 11px; }
.graph polyline { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.graph-mint { stroke: var(--mint); }
.graph-slate { stroke: var(--slate); }
.graph-amber { stroke: var(--amber); }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem 1.05rem; margin-bottom: 0.9rem; color: var(--muted); font-size: 0.85rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend i { height: 0.52rem; width: 0.52rem; border-radius: 50%; }
.legend-mint { background: var(--mint); }
.legend-slate { background: var(--slate); }
.legend-amber { background: var(--amber); }
.daily-detail { padding-top: 0.75rem; border-top: 1px solid var(--border); }
.daily-detail summary { cursor: pointer; color: var(--muted); font-size: 0.88rem; }
.recent-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 1.15rem; }
.terms { display: flex; gap: 0.75rem; }
.table-wrap { max-height: 26rem; overflow: auto; margin-top: 0.9rem; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 0.65rem; white-space: nowrap; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { color: var(--muted); font-size: 0.85rem; font-weight: 560; }
tbody th { font-weight: 550; }
tbody tr:last-child > * { border-bottom: 0; }
.numeric { font-variant-numeric: tabular-nums; text-align: right; }
.earned { color: var(--amber); font-weight: 650; }
.plan-name { text-transform: capitalize; }
.cell-label { display: none; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 7.6rem;
  margin-top: 0.9rem;
  padding: 0.8rem;
  border: 1px dashed var(--border);
  border-radius: 0.6rem;
  color: var(--muted);
  text-align: center;
}
.chart-empty { min-height: 9.2rem; }
.loading-state, .error-state { padding: 2rem; color: var(--muted); }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 0.75rem; min-height: 11rem; }
.loading-indicator {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--border);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.updating svg { animation: spin 0.9s linear infinite; }
.error-state h2 { color: var(--text); font-size: 1.27rem; }
.error-state p { margin: 0.65rem 0 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1150px) {
  .recent-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 780px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-access { padding: 2.35rem 1.15rem; }
  .login-mobile-brand { display: flex; margin-bottom: 1.6rem; }
  .shell { display: block; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar > .brand { min-height: 3.35rem; padding: 0.5rem 1rem; }
  .navigation { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0.45rem 0.5rem; gap: 0.2rem; }
  .navigation a { justify-content: center; padding: 0.45rem 0.25rem; gap: 0.35rem; font-size: 0.91rem; }
  .navigation a svg { width: 1.15rem; flex-shrink: 0; }
  .navigation a[aria-current]::before { inset: auto 20% 0; height: 2px; width: auto; }
  .topbar { min-height: 3.7rem; }
  .topbar-context { display: none; }
  .account-name { margin-right: auto; }
}

@media (max-width: 530px) {
  .page-heading { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .link-controls { flex-direction: column; }
  .link-controls .button { align-self: flex-start; }
  .logout > span { display: none; }
  .logout { min-width: 2.65rem; }
  .panel { padding: 0.9rem; }
  .panel-heading { align-items: flex-start; }
  .metric-icon { width: 2.1rem; height: 2.1rem; }
  .graph text { font-size: 17px; }
  .commission-table, .commission-table tbody { display: block; }
  .commission-table thead { position: absolute; clip-path: inset(50%); }
  .commission-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 0.9rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
  }
  .commission-table tbody tr:first-child { padding-top: 0; }
  .commission-table tbody tr:last-child { border: 0; padding-bottom: 0; }
  .commission-table tbody th { grid-column: 1 / -1; color: var(--text); }
  .commission-table tbody th, .commission-table tbody td {
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .cell-label { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 500; }
  .stat { padding: 0.8rem 0.85rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
}
@media (max-width: 345px) {
  .navigation a { font-size: 0.83rem; }
  .navigation a svg { width: 0.95rem; }
  .stats { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .loading-indicator, .updating svg { animation: none; }
}

