:root{
  --bg:#0b0f17;
  --card:#121827;
  --text:#e7ecf5;
  --muted:#8b93a7;
  --border:rgba(255,255,255,0.08);
  --accent:#4b8dff;
  --thead:#11182a;
  --hover:rgba(255,255,255,0.04);
}

body[data-theme="light"]{
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#5b6478;
  --border:rgba(0,0,0,0.08);
  --accent:#2f6bff;
  --thead:#eef1f6;
  --hover:rgba(0,0,0,0.04);
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Inter,system-ui,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 20px;
  border-bottom:1px solid var(--border);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.dot{
  width:10px;
  height:10px;
  background:var(--accent);
  border-radius:50%;
}

.title{
  font-weight:700;
}

.subtitle{
  font-size:12px;
  color:var(--muted);
}

.top-actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.btn{
  background:var(--accent);
  border:none;
  color:white;
  padding:8px 12px;
  border-radius:6px;
  cursor:pointer;
  text-decoration:none;
}

.btn-outline{
  background:transparent;
  border:1px solid var(--border);
  color:var(--text);
}

.btn-small{
  padding:6px 10px;
  font-size:12px;
}

.layout{
  display:grid;
  grid-template-columns:460px 1fr;
  height:calc(100vh - 60px);
}

.card{
  background:var(--card);
  border-right:1px solid var(--border);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.card-header{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
}

.card-title{
  font-weight:700;
}

.card-subtitle{
  font-size:12px;
  color:var(--muted);
}

.filters{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}

.chip{
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 8px;
  border:1px solid var(--border);
  border-radius:6px;
  font-size:12px;
}

.chip-grow{
  min-width:180px;
}

.chip select,
.chip input{
  background:transparent;
  border:none;
  color:var(--text);
  outline:none;
  font-size:12px;
  width:100%;
}

.search-preview{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,0.01);
}

.search-preview-title{
  font-weight:700;
  margin-bottom:6px;
}

.search-preview-body{
  font-size:13px;
  line-height:1.5;
}

.table-wrap{
  overflow:auto;
  flex:1;
}

.table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}

.table thead{
  background:var(--thead);
}

.table th{
  text-align:left;
  padding:8px 10px;
  font-weight:600;
  border-bottom:1px solid var(--border);
  white-space:nowrap;
}

.table td{
  padding:8px 10px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}

.row:hover{
  background:var(--hover);
  cursor:pointer;
}

.row.selected{
  outline:1px solid var(--accent);
  outline-offset:-1px;
}

.badge{
  padding:2px 6px;
  border-radius:4px;
  font-size:11px;
  background:var(--border);
  display:inline-block;
}

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

.grade-Aplus{background:#16a34a;color:white;}
.grade-A{background:#22c55e;color:white;}
.grade-B{background:#84cc16;color:black;}
.grade-C{background:#facc15;color:black;}
.grade-D{background:#f97316;color:white;}
.grade-F{background:#ef4444;color:white;}

.icon-btn{
  border:1px solid var(--border);
  background:transparent;
  color:var(--text);
  border-radius:6px;
  padding:6px 10px;
  cursor:pointer;
}

.chart{
  display:flex;
  flex-direction:column;
}

.chart-actions{
  display:flex;
  gap:6px;
  margin-top:6px;
}

.chart-container{
  flex:1;
  min-height:420px;
}

.card-footer{
  padding:10px;
  border-top:1px solid var(--border);
  font-size:13px;
  color:var(--muted);
  line-height:1.5;
}

@media (max-width: 1100px){
  .layout{
    grid-template-columns:1fr;
    height:auto;
  }

  .chart-container{
    min-height:520px;
  }
}
