:root {
  --ink: #172133;
  --muted: #667085;
  --line: #dce4ee;
  --paper: #ffffff;
  --soft: #f5f7fb;
  --brand: #f04438;
  --brand-dark: #bb241a;
  --green: #14a06f;
  --blue: #2673e8;
  --radius: 8px;
  --shadow: 0 20px 48px rgba(23, 33, 51, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  background: #f7f9fc;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 800;
  background: var(--brand);
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 80% 10%, rgba(240, 68, 56, 0.14), transparent 30%),
    linear-gradient(135deg, #fff, #f3f7ff);
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.login-card h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

.login-card p:not(.eyebrow) {
  color: var(--muted);
}

.login-card form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-card label span {
  display: block;
  margin-bottom: 6px;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.login-card input,
.toolbar select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
}

.login-card button {
  min-height: 48px;
}

.form-error {
  min-height: 24px;
  margin: 0;
  color: var(--brand-dark);
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  color: #fff;
  background: #101828;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 20px;
}

.brand span {
  margin-top: 4px;
  color: #98a2b3;
}

.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 36px;
}

.sidebar a {
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #d0d5dd;
  text-decoration: none;
}

.sidebar a:hover,
.sidebar a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar select {
  width: 140px;
}

.toolbar button {
  min-height: 46px;
  padding: 10px 16px;
}

.toolbar button:last-child {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 34px rgba(23, 33, 51, 0.06);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0;
  font-size: 24px;
}

.panel-head span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  padding: 18px;
  border: 1px solid #eef2f7;
  border-radius: var(--radius);
  background: #fbfcff;
}

.metric-card strong,
.metric-card span {
  display: block;
}

.metric-card strong {
  color: var(--brand);
  font-size: 34px;
  line-height: 1.1;
}

.metric-card span {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.trend-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 12px;
  min-height: 220px;
  align-items: end;
}

.trend-day {
  display: grid;
  gap: 6px;
  align-items: end;
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  height: 150px;
  align-items: end;
}

.trend-bars span {
  min-height: 4px;
  border-radius: 4px 4px 0 0;
}

.trend-bars .pv {
  background: var(--brand);
}

.trend-bars .uv {
  background: var(--blue);
}

.trend-bars .events {
  background: var(--green);
}

.trend-day small {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
}

th {
  color: #475467;
  font-size: 13px;
  white-space: nowrap;
}

td {
  color: #344054;
}

.skill-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.skill-stats-grid article {
  padding: 18px;
  border: 1px solid #eef2f7;
  border-radius: var(--radius);
  background: #fbfcff;
}

.skill-stats-grid h3 {
  margin: 0 0 12px;
}

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.rank-item span {
  color: #344054;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-item strong {
  color: var(--brand);
}

.empty {
  color: var(--muted);
}

@media (max-width: 900px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
  }

  .sidebar a {
    flex: 0 0 auto;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .skill-stats-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }
}
