:root{
  --bg:#f6f7fb;
  --surface:#ffffff;
  --surface-2:#f1f4f9;
  --text:#1e293b;
  --muted:#64748b;

  --primary:#d7261c;
  --primary-dark:#b61f17;

  --border:#e5e7eb;
  --shadow:0 10px 30px rgba(15,23,42,.08);
  --radius:18px;
}

/* RESET */
*{box-sizing:border-box}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  background:var(--bg);
  color:var(--text)
}
button,input,select{font:inherit}

/* LAYOUT */
.page{
  min-height:100vh;
  display:flex;
}

/* SIDEBAR */
.sidebar{
  width:270px;
  background:#fff;
  border-right:1px solid var(--border);
  padding:22px 18px;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:28px;
}

.brand-badge{
  width:44px;
  height:44px;
  border-radius:14px;
  background:linear-gradient(135deg,var(--primary),#f05a4f);
}

.brand h1{
  font-size:18px;
  line-height:1.1;
  margin:0;
}
.brand p{
  margin:2px 0 0;
  color:var(--muted);
  font-size:12px;
}

.nav{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.nav button{
  border:0;
  background:transparent;
  padding:14px 16px;
  text-align:left;
  border-radius:14px;
  color:#334155;
  cursor:pointer;
}

.nav button.active{
  background:var(--primary);
  color:#fff;
  font-weight:600;
}

/* MAIN */
.main{
  flex:1;
  padding:26px;
}

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

.topbar h2{
  margin:0;
  font-size:30px;
}

.avatar{
  width:42px;
  height:42px;
  border-radius:999px;
  background:var(--primary);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
}

/* CARD */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

/* HERO */
.hero{
  background:linear-gradient(135deg,#c81e16,#ef5b4e);
  color:#fff;
  padding:28px;
  border-radius:var(--radius);
  margin-bottom:20px;
}

.hero h3{
  margin:0 0 8px;
  font-size:28px;
}

.hero p{
  margin:0;
  opacity:.9;
}

/* GRID STATS */
.grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:18px;
  margin-top:16px;
}

.stat{
  padding:20px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-height:110px;
}

.stat .label{
  color:var(--muted);
  font-size:14px;
}

.stat .value{
  font-size:32px;
  font-weight:800;
  margin-top:8px;
}

.stat .meta{
  font-size:13px;
  margin-top:6px;
  color:var(--muted);
}

/* CHARTS */
.charts{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-top:20px;
}

.chart-card{
  padding:20px;
}

.chart-card canvas{
  width:100% !important;
  height:300px !important;
}

/* SECTION */
.section{
  margin-top:22px;
  padding:20px;
}

.section h3{
  margin:0 0 18px;
  font-size:22px;
}

/* TABLE */
.table-wrap{overflow:auto}
table{
  width:100%;
  border-collapse:collapse;
}
th,td{
  text-align:left;
  padding:14px;
  border-bottom:1px solid var(--border);
  font-size:14px;
}
th{
  color:var(--muted);
  font-weight:600;
}

/* BADGES */
.badge{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}

.badge.admin{background:#fee2e2;color:#991b1b}
.badge.federation{background:#dbeafe;color:#1d4ed8}
.badge.user{background:#e2e8f0;color:#334155}

/* BUTTONS */
.btn{
  border:0;
  border-radius:12px;
  padding:12px 16px;
  cursor:pointer;
  font-weight:700;
}

.btn-primary{
  background:var(--primary);
  color:#fff;
}
.btn-primary:hover{
  background:var(--primary-dark);
}

.btn-secondary{
  background:#e2e8f0;
  color:#0f172a;
}

.btn-danger{
  background:#fee2e2;
  color:#991b1b;
}

/* LOGIN */
.login-shell{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:linear-gradient(180deg,#fff,#f5f6fb);
}

.login-card{
  width:100%;
  max-width:420px;
  padding:28px;
}

.login-card h2{
  margin:0 0 8px;
  font-size:28px;
}

.login-card p{
  margin:0 0 20px;
  color:var(--muted);
}

.form-grid{
  display:grid;
  gap:14px;
}

.notice{
  padding:12px 14px;
  border-radius:12px;
  font-size:14px;
}

.notice.error{
  background:#fee2e2;
  color:#991b1b;
}

.notice.success{
  background:#dcfce7;
  color:#166534;
}

/* RESPONSIVE */
@media (max-width:1100px){
  .grid{grid-template-columns:repeat(2,1fr)}
}

@media (max-width:860px){
  .page{display:block}
  .sidebar{
    width:auto;
    border-right:0;
    border-bottom:1px solid var(--border)
  }
  .charts{grid-template-columns:1fr}
}

@media (max-width:640px){
  .main{padding:16px}
  .grid{grid-template-columns:1fr}
}