:root{
  --bg:#0b1020;
  --panel:#101a33;
  --panel-2:#0f1830;
  --text:#e7ecff;
  --muted:#b9c2ee;
  --border:rgba(255,255,255,.10);
  --shadow:0 10px 30px rgba(0,0,0,.35);
  --primary:#6aa6ff;
  --primary-2:#3d7dff;
  --danger:#ff5a6a;
  --ok:#4ade80;
  --warn:#fbbf24;
  --bad:#fb7185;
  --radius:16px;
}
*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background: radial-gradient(1000px 500px at 15% 0%, rgba(106,166,255,.25), transparent 60%),
              radial-gradient(900px 500px at 85% 0%, rgba(251,191,36,.18), transparent 60%),
              var(--bg);
  min-height:100vh;
}
a{ color:var(--primary); }
.container{ max-width:1100px; margin:0 auto; padding:20px; }
header{
  position:sticky; top:0; z-index:10;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(11,16,32,.9), rgba(11,16,32,.55));
  border-bottom:1px solid var(--border);
}
.header-row{ display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 0; }
.brand{ display:flex; flex-direction:column; gap:2px; min-width:180px; }
.brand h1{ font-size:18px; margin:0; letter-spacing:.2px; }
.brand p{ margin:0; color:var(--muted); font-size:13px; }
.nav-links{ display:flex; gap:18px; align-items:center; }
.nav-links a{
  color:var(--muted); text-decoration:none; font-size:14px; font-weight:500;
  transition:color .15s;
}
.nav-links a:hover, .nav-links a.active{ color:var(--text); }
.actions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.pill{
  display:inline-flex; align-items:center; gap:8px;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius:999px;
  background: rgba(16,26,51,.6);
  color: var(--muted);
  font-size: 13px;
}
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  padding:10px 14px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(16,26,51,.7);
  color: var(--text);
  cursor:pointer;
  font-weight:600;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  user-select:none;
}
.btn:hover{ background: rgba(16,26,51,.95); border-color: rgba(255,255,255,.18); }
.btn:active{ transform: translateY(1px); }
.btn:disabled{ opacity:.6; cursor:not-allowed; transform:none; }
.btn.primary{
  background: linear-gradient(180deg, rgba(106,166,255,.20), rgba(61,125,255,.12));
  border-color: rgba(106,166,255,.35);
}
.btn.danger{
  background: linear-gradient(180deg, rgba(255,90,106,.18), rgba(255,90,106,.08));
  border-color: rgba(255,90,106,.35);
}
.card{
  background: linear-gradient(180deg, rgba(16,26,51,.85), rgba(15,24,48,.75));
  border:1px solid var(--border);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
}
.card h3{ margin:0 0 10px; font-size:16px; }
.subtle{ color: var(--muted); font-size: 13px; }
.kv{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.badge{
  display:inline-flex; align-items:center; gap:8px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  padding:8px 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
}
.dot{
  width:10px; height:10px; border-radius: 50%; display:inline-block;
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}
.dot.good{ background: var(--ok); }
.dot.ok{ background: var(--warn); }
.dot.bad{ background: var(--bad); }

main{ padding: 18px 0 40px; }
.section-header{ display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin: 18px 0 12px; }
.section-header h2{ margin:0; font-size: 16px; letter-spacing:.2px; }
.section-actions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.grid{ display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 940px){ .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px){
  .grid{ grid-template-columns: 1fr; }
  .header-row{ flex-direction:column; align-items:stretch; }
  .nav-links{ gap:14px; }
  .actions{ justify-content:flex-start; }
}
.hidden{ display:none !important; }
.empty{ padding:18px; border:1px dashed rgba(255,255,255,.18); border-radius: var(--radius); color: var(--muted); }

.controls-row{ display:flex; gap:12px; align-items:flex-end; flex-wrap:wrap; }
label{ font-size: 13px; color: var(--muted); display:block; margin-bottom:6px; }
input[type="date"]{
  height:40px; padding: 0 10px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(16,26,51,.6);
  color: var(--text);
}

.spinner{
  width:16px; height:16px;
  border-radius:50%;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: rgba(255,255,255,.85);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast{
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: rgba(16,26,51,.92);
  border: 1px solid rgba(255,255,255,.18);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-width: min(680px, calc(100vw - 22px));
  font-size: 14px;
}

.auth-panel{ display:flex; gap:16px; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; }
.auth-panel .card{ flex: 1 1 360px; }
.muted-block{ margin-top: 10px; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* Course filter pills */
.course-pills{
  display:flex; gap:8px; flex-wrap:wrap;
  margin-bottom:16px;
}
.course-pill{
  padding:7px 14px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(16,26,51,.6);
  color:var(--muted);
  cursor:pointer;
  font-size:13px;
  font-weight:500;
  transition: background .15s, border-color .15s, color .15s;
}
.course-pill:hover{
  background:rgba(16,26,51,.95);
  border-color:rgba(255,255,255,.18);
  color:var(--text);
}
.course-pill.active{
  background:linear-gradient(180deg, rgba(106,166,255,.22), rgba(61,125,255,.14));
  border-color:rgba(106,166,255,.4);
  color:var(--text);
}

/* Date group header */
.date-group-header{
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  padding:14px 0 6px;
  margin-top:4px;
  border-bottom:1px solid var(--border);
  margin-bottom:8px;
  letter-spacing:.2px;
}
.date-group-header:first-child{ margin-top:0; padding-top:0; }

/* Assignment rows */
.assignment-row{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 14px;
  border-radius:10px;
  background:linear-gradient(180deg, rgba(16,26,51,.6), rgba(15,24,48,.5));
  border:1px solid transparent;
  margin-bottom:6px;
  transition: background .12s;
}
.assignment-row:hover{ background:rgba(16,26,51,.85); }
.assignment-row.status-overdue{ border-color:rgba(251,113,133,.22); }
.assignment-row .dot{
  width:8px; height:8px; flex-shrink:0;
  box-shadow:none;
}
.assignment-info{ flex:1; min-width:0; }
.assignment-name{ font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.assignment-meta{ font-size:12px; color:var(--muted); margin-top:2px; }
.meta-sep{ color:rgba(255,255,255,.2); }
.assignment-score{ flex-shrink:0; text-align:right; }
.score-badge{ font-size:12px; padding:5px 9px; }

@media (max-width: 620px){
  .assignment-name{ white-space:normal; }
}
