:root {
  --purple-950: #24113d;
  --purple-800: #4b2378;
  --purple-650: #6e38a4;
  --purple-100: #f2ebfa;
  --ink: #201a29;
  --muted: #6f6879;
  --line: #e6e0eb;
  --surface: #ffffff;
  --background: #f7f5f9;
  --success: #177447;
  --danger: #a52b3a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); }
a { color: inherit; }
.site-header { height: 72px; padding: 0 32px; display: flex; align-items: center; gap: 36px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 210px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: white; font-weight: 800; background: linear-gradient(145deg, var(--purple-650), var(--purple-950)); }
.brand strong, .brand small { display: block; line-height: 1.05; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
nav { display: flex; gap: 24px; flex: 1; }
nav a { text-decoration: none; color: var(--muted); font-weight: 650; }
nav a:hover { color: var(--purple-650); }
.account { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.account form { margin: 0; }
.page-shell { max-width: 1220px; margin: 0 auto; padding: 42px 30px 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
h1 { margin: 5px 0 7px; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.035em; }
h2 { margin: 0; font-size: 18px; }
p { line-height: 1.55; }
.muted { color: var(--muted); margin: 0; }
.eyebrow { color: var(--purple-650); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.button { border: 0; border-radius: 9px; padding: 10px 16px; font: inherit; font-weight: 750; cursor: pointer; }
.button-primary { background: var(--purple-650); color: white; }
.button-primary:hover { background: var(--purple-800); }
.button-ghost { background: var(--purple-100); color: var(--purple-800); }
.button-full { width: 100%; margin-top: 12px; }
.login-layout { min-height: calc(100vh - 180px); display: grid; place-items: center; }
.login-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 38px; box-shadow: 0 22px 60px rgba(58, 28, 85, .1); }
.login-card h1 { font-size: 34px; }
label { display: block; margin: 21px 0 7px; font-weight: 700; font-size: 14px; }
input[type="email"], input[type="password"], input[type="text"], select { width: 100%; padding: 12px 13px; border: 1px solid #cec5d8; border-radius: 9px; font: inherit; background: white; }
input:focus { outline: 3px solid rgba(110, 56, 164, .17); border-color: var(--purple-650); }
.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.alert { padding: 12px 15px; border-radius: 9px; margin-bottom: 20px; }
.alert-error { background: #fdecef; color: #812130; border: 1px solid #f5cad1; }
.alert-success { background: #e2f5ea; color: var(--success); border: 1px solid #bde5cd; }
.app-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.app-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.app-card:hover { transform: translateY(-2px); border-color: #b99ad3; }
.app-card p { margin: 6px 0 0; color: var(--muted); }
.app-icon { font-size: 28px; }
.arrow { color: var(--purple-650); font-size: 25px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { padding: 21px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.metric span { display: block; color: var(--muted); font-size: 13px; font-weight: 650; }
.metric strong { display: block; margin-top: 10px; font-size: 30px; }
.metric-accent { background: var(--purple-950); border-color: var(--purple-950); color: white; }
.metric-accent span { color: #d7c2e8; }
.content-grid { display: grid; grid-template-columns: 1.45fr 1fr; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 23px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-heading span, .freshness span { color: var(--muted); font-size: 12px; }
.leaderboard { list-style-position: inside; padding: 0; margin: 0; }
.leaderboard li { padding: 15px 4px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.leaderboard li span { color: var(--muted); }
.legend { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 16px; color: var(--muted); font-size: 12px; }
.freshness { text-align: right; }
.freshness strong { display: block; margin-top: 5px; font-size: 13px; }
.sync-warning { display: block; margin-top: 7px; color: var(--danger) !important; font-weight: 700; }
.activity-panel { margin-top: 18px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; justify-content: space-between; gap: 20px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.activity-list span { color: var(--muted); font-size: 13px; text-align: right; }
.table-panel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.badge, .status { display: inline-block; padding: 5px 9px; border-radius: 999px; font-weight: 750; font-size: 11px; }
.badge { background: var(--purple-100); color: var(--purple-800); }
.status-active { background: #e2f5ea; color: var(--success); }
.status-inactive { background: #f4edf0; color: var(--muted); }
.empty-state { color: var(--muted); padding: 24px 0; }
.actions { white-space: nowrap; }
.actions a, .link-button { margin-right: 10px; color: var(--purple-650); font: inherit; font-size: 13px; font-weight: 700; }
.actions form { display: inline; }
.link-button { padding: 0; border: 0; background: none; cursor: pointer; text-decoration: underline; }
.form-panel { max-width: 680px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.position-panel { display: grid; grid-template-columns: 1fr minmax(280px, .6fr); gap: 30px; margin-top: 18px; }
.error-card { text-align: center; margin: 12vh auto; max-width: 500px; }
@media (max-width: 820px) {
  .site-header { height: auto; padding: 16px 20px; flex-wrap: wrap; gap: 16px; }
  nav { order: 3; width: 100%; }
  .account { margin-left: auto; }
  .page-shell { padding: 30px 18px 50px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid, .app-grid { grid-template-columns: 1fr; }
  .position-panel { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .freshness { text-align: left; }
}
