:root {
  --ink: #132019;
  --ink-soft: #55645c;
  --paper: #f4f5ef;
  --panel: #ffffff;
  --line: #dde2da;
  --navy: #102a23;
  --navy-light: #183b31;
  --mint: #82e6b0;
  --mint-soft: #ddf7e8;
  --amber: #f2b84b;
  --amber-soft: #fff1d4;
  --blue: #82aee6;
  --blue-soft: #e6eefb;
  --red: #cc594d;
  --red-soft: #fae7e4;
  --shadow: 0 12px 34px rgba(20, 38, 29, 0.07);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input { font: inherit; }
a { color: inherit; }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 22px; background: var(--navy); color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--mint); color: var(--navy); font-size: 13px; font-weight: 900; letter-spacing: -0.04em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.brand span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 15px; letter-spacing: -0.01em; }
.brand small { color: #9bb1a8; font-size: 11px; }
.nav-list { display: grid; gap: 8px; margin-top: 52px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: #b8c8c1; text-decoration: none; font-size: 14px; font-weight: 650; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: var(--mint); color: var(--navy); }
.nav-icon { width: 20px; text-align: center; font-size: 18px; }
.sidebar-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); }
.owner-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.owner-chip > span:last-child { display: grid; min-width: 0; }
.owner-chip strong { font-size: 13px; }
.owner-chip small { overflow: hidden; color: #9bb1a8; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #284b41; color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.avatar.soft { background: var(--mint-soft); color: #23603f; }
.text-button { margin: 14px 0 0 48px; padding: 0; border: 0; background: none; color: #a8bbb3; cursor: pointer; font-size: 12px; }
.text-button:hover { color: #fff; }

.main-content { width: min(100%, 1500px); padding: 42px 48px 68px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header h1 { margin: 3px 0 4px; font-size: clamp(28px, 3vw, 42px); line-height: 1.1; letter-spacing: -0.045em; }
.eyebrow { margin: 0; color: #557067; font-size: 10px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.light { color: var(--mint); }
.muted { margin: 0; color: var(--ink-soft); font-size: 13px; }
.period-picker { display: flex; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #e9ece5; }
.period-picker a { padding: 8px 12px; border-radius: 8px; color: #647169; text-decoration: none; font-size: 12px; font-weight: 700; }
.period-picker a.active { background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(20,38,29,.08); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { position: relative; min-height: 180px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 8px 20px rgba(30,45,35,.035); }
.metric-card.featured { background: var(--navy); color: #fff; border-color: var(--navy); }
.metric-card.featured::after { position: absolute; right: -30px; bottom: -55px; width: 130px; height: 130px; border: 28px solid rgba(130,230,176,.12); border-radius: 50%; content: ""; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: #627068; font-size: 12px; font-weight: 700; }
.featured .metric-top { color: #a9bdb4; }
.metric-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--mint-soft); color: #276143; font-size: 15px; }
.metric-icon.mint { background: var(--mint-soft); }
.metric-icon.amber { background: var(--amber-soft); color: #8b5a00; }
.metric-icon.blue { background: var(--blue-soft); color: #345f92; }
.metric-value { display: block; margin: 22px 0 8px; font-size: 40px; line-height: 1; letter-spacing: -.05em; }
.metric-card p { margin: 0; color: #65736b; font-size: 11px; line-height: 1.5; }
.metric-card small { display: block; margin-top: 5px; color: #849188; font-size: 10px; }
.featured p, .featured small { color: #a7bbb2; }
.trend { display: inline-block; padding: 2px 5px; border-radius: 6px; font-weight: 800; }
.trend.positive { background: var(--mint-soft); color: #256542; }
.trend.negative { background: var(--red-soft); color: #a13f36; }
.trend.neutral { background: #ebeee9; color: #68756e; }
.featured .trend.positive { background: rgba(130,230,176,.16); color: var(--mint); }
.positive { color: #28764b; }
.negative { color: var(--red); }
.neutral { color: var(--ink-soft); }

.content-grid { display: grid; gap: 14px; margin-top: 14px; }
.content-grid.wide-left { grid-template-columns: minmax(0, 1.8fr) minmax(280px, .8fr); }
.content-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.content-grid.wide-right { grid-template-columns: minmax(300px, .8fr) minmax(0, 1.25fr); }
.panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.025em; }
.panel-link { color: #3d6a58; font-size: 11px; font-weight: 750; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; color: #68756e; font-size: 10px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 7px; height: 7px; border-radius: 2px; }
.user-color { background: var(--navy); }
.listing-color { background: var(--mint); }
.trade-color { background: var(--amber); }

.bar-chart { display: flex; align-items: stretch; gap: clamp(2px, .45vw, 7px); height: 190px; margin-top: 25px; padding: 8px 4px 24px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 39px, #eef0eb 40px); }
.bar-day { position: relative; display: flex; flex: 1 1 0; min-width: 2px; align-items: flex-end; height: 100%; }
.bar-stack { display: flex; align-items: flex-end; justify-content: center; gap: 1px; width: 100%; height: 100%; }
.bar { display: block; width: 30%; max-width: 7px; min-height: 3px; border-radius: 3px 3px 1px 1px; }
.bar.users { background: var(--navy); }
.bar.listings { background: var(--mint); }
.bar.trades { background: var(--amber); }
.bar-day small { position: absolute; top: calc(100% + 8px); left: 50%; color: #8a958f; font-size: 8px; white-space: nowrap; transform: translateX(-50%); }
.chart-summary { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 20px; }
.chart-summary > div { display: grid; padding: 0 16px; border-right: 1px solid var(--line); }
.chart-summary > div:first-child { padding-left: 0; }
.chart-summary > div:last-child { padding-right: 0; border: 0; }
.chart-summary span, .chart-summary small { color: #7a877f; font-size: 9px; }
.chart-summary strong { margin: 4px 0 2px; font-size: 22px; letter-spacing: -.04em; }

.attention-panel { background: #fffbf2; }
.attention-list { display: grid; gap: 8px; margin-top: 18px; }
.attention-item { display: flex; gap: 10px; padding: 12px; border: 1px solid #e6e8e2; border-radius: 12px; background: rgba(255,255,255,.68); }
.attention-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.attention-item.warning .attention-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.attention-item.good .attention-dot { background: #55a875; box-shadow: 0 0 0 4px var(--mint-soft); }
.attention-item strong { font-size: 12px; }
.attention-item p { margin: 3px 0 0; color: #77827b; font-size: 10px; line-height: 1.4; }
.panel-note { margin: 16px 0 0; padding-top: 13px; border-top: 1px solid #ebe7db; color: #899088; font-size: 9px; text-align: center; }

.people-list, .listing-list, .report-list, .category-list { margin-top: 16px; }
.person-row, .listing-row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-top: 1px solid #edf0eb; }
.person-row:first-child, .listing-row:first-child { border-top: 0; }
.person-main { display: grid; min-width: 0; }
.person-main strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.person-main small { overflow: hidden; margin-top: 3px; color: #7d8982; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.person-meta { display: grid; justify-items: end; margin-left: auto; text-align: right; }
.person-meta strong { font-size: 10px; }
.person-meta small { margin-top: 4px; color: #8b958f; font-size: 8px; }
.listing-mark { display: grid; flex: 0 0 auto; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--amber-soft); color: #96630a; font-size: 18px; }
.status { padding: 3px 7px; border-radius: 20px; background: #edf0ec; color: #5e6963; font-size: 8px; font-weight: 750; }
.status.active { background: var(--mint-soft); color: #266844; }
.status.traded { background: var(--blue-soft); color: #355f8b; }
.report-row { display: flex; gap: 11px; padding: 12px 0; border-top: 1px solid var(--line); }
.report-row:first-child { border-top: 0; }
.report-icon { display: grid; flex: 0 0 auto; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-weight: 900; }
.report-row strong { font-size: 11px; }
.report-row p { margin: 3px 0; font-size: 11px; }
.report-row small { color: #7d8882; font-size: 9px; }
.count-badge { min-width: 26px; padding: 5px 8px; border-radius: 20px; background: var(--red-soft); color: var(--red); font-size: 10px; font-weight: 800; text-align: center; }
.category-row { display: grid; grid-template-columns: 32px minmax(100px, 1fr) 80px 120px; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.category-row:first-child { border-top: 0; }
.category-row .rank { color: #a0aaa4; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.category-row strong { font-size: 12px; }
.category-row span:not(.rank) { color: #52625a; font-size: 10px; font-weight: 700; }
.category-row small { color: #808b84; font-size: 9px; text-align: right; }
.empty-state { padding: 32px 10px; color: #7b8880; font-size: 12px; text-align: center; }
.empty-state.success { display: grid; justify-items: center; gap: 5px; }
.empty-state.success span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--mint-soft); color: #2a714b; font-weight: 900; }
.empty-state.success p { margin: 0; font-size: 10px; }

.users-header { align-items: flex-start; }
.directory-panel { padding: 0; overflow: hidden; }
.directory-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px; border-bottom: 1px solid var(--line); }
.directory-toolbar h2 { margin: 0 0 4px; }
.search-form { display: flex; gap: 8px; width: min(100%, 460px); }
.search-form input { min-width: 0; flex: 1; padding: 10px 13px; border: 1px solid #cfd6ce; border-radius: 10px; outline: none; background: #fafbf8; font-size: 12px; }
.search-form input:focus { border-color: #5f9878; box-shadow: 0 0 0 3px rgba(95,152,120,.15); }
.search-form button { padding: 10px 16px; border: 0; border-radius: 10px; background: var(--navy); color: #fff; cursor: pointer; font-size: 11px; font-weight: 750; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; background: #f6f7f3; color: #78837c; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 14px 18px; border-top: 1px solid #edf0eb; color: #47564e; font-size: 11px; white-space: nowrap; }
.table-user { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.table-user > span:last-child { display: grid; }
.table-user strong { color: var(--ink); font-size: 11px; }
.table-user small { margin-top: 2px; color: #7a867f; font-size: 9px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.login-page { background: var(--paper); }
.login-shell { display: grid; min-height: 100vh; padding: 24px; place-items: center; }
.login-card { width: min(100%, 390px); padding: 36px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 18px 45px rgba(20,38,29,.08); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; font-size: 14px; }
.login-brand .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 11px; }
.login-card h1 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.login-form { display: grid; margin-top: 28px; }
.login-form label { margin: 15px 0 7px; color: #435249; font-size: 11px; font-weight: 750; }
.login-form input { width: 100%; padding: 13px 14px; border: 1px solid #ccd4cc; border-radius: 11px; outline: none; background: #fafbf8; }
.login-form input:focus { border-color: #548b6d; box-shadow: 0 0 0 3px rgba(84,139,109,.16); }
.primary-button { margin-top: 24px; padding: 14px 18px; border: 0; border-radius: 11px; background: var(--navy); color: #fff; cursor: pointer; font-size: 12px; font-weight: 800; }
.primary-button:hover { background: var(--navy-light); }
.form-error { margin-top: 20px; padding: 11px 13px; border: 1px solid #efcac5; border-radius: 10px; background: var(--red-soft); color: #963d34; font-size: 11px; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid.wide-left, .content-grid.wide-right { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 20px; padding: 16px 20px; }
  .brand small { display: none; }
  .nav-list { display: flex; margin: 0 0 0 auto; }
  .nav-link { padding: 9px 11px; }
  .nav-icon { display: none; }
  .sidebar-foot { display: none; }
  .main-content { padding: 28px 20px 48px; }
  .content-grid.equal { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .brand strong { font-size: 13px; }
  .nav-link { font-size: 12px; }
  .page-header { display: grid; align-items: start; }
  .period-picker { width: max-content; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 160px; }
  .legend { display: none; }
  .bar-chart { height: 155px; }
  .bar-day small { display: none; }
  .chart-summary { grid-template-columns: 1fr; gap: 12px; }
  .chart-summary > div { padding: 0 0 10px; border: 0; border-bottom: 1px solid var(--line); }
  .category-row { grid-template-columns: 28px 1fr 80px; }
  .category-row small { display: none; }
  .directory-toolbar { display: grid; }
  .search-form { width: 100%; }
  .login-shell { padding: 16px; }
  .login-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
