/* ===== Tokens ===== */
:root {
  --bg: #fdf8f6;
  --sidebar: #fdfaf7;
  --card: #fefbfb;
  --border: #EFE8DD;
  --border-strong: #E5DCCD;

  --ink: #1F1B16;
  --ink-2: #4A4339;
  --muted: #8A8278;
  --muted-2: #B5ADA1;

  --primary: #EF6A48;
  --primary-hover: #E25A38;
  --primary-soft: #FDE5DA;
  --primary-softer: #FEEFE8;

  --orange-tile: #FCE2D2;
  --pink-tile:   #FCDDD8;
  --yellow-tile: #FBE7C6;
  --purple-tile: #ECE3F6;
  --green-tile:  #DCEEDA;

  --chart-1: #E94B3C;
  --chart-2: #F4A47C;

  --green-700: #2F7A3E;
  --green-50:  #E4F2DD;
  --orange-700: #B45A1E;
  --orange-50:  #FBE7C6;
  --purple-700: #6B49B8;
  --purple-50:  #ECE3F6;
  --blue-700:  #2C5BB0;
  --blue-50:   #DEE8F8;
  --yellow-700: #8A6A14;
  --yellow-50:  #FBE7C6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 2px 8px rgba(31,27,22,0.07), 0 1px 2px rgba(31,27,22,0.04);

  --serif: 'Fraunces', 'Recoleta', Georgia, serif;
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body { background: var(--bg); }
body {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ===== Fluid stage — fills viewport ===== */
.stage {
  width: 100%;
  min-height: 100vh;
  background: var(--bg);
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ===== App shell ===== */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 24px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-footer {
  position: sticky;
  bottom: 24px;
  background: var(--sidebar);
  padding-top: 12px;
  width: 100%;
  align-self: stretch;
}
.user-card-fixed {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 216px;
  z-index: 50;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 22px;
}
.brand-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}
.brand-tag {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(239,106,72,0.08); color: var(--ink); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}
.nav-item.active svg { color: var(--primary); }
.nav-item svg { color: var(--ink-2); flex-shrink: 0; }
.nav-item .badge-count {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

.sidebar-spacer { height: 20px; }

.btn-new-class {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  border: 0;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
  transition: background 0.15s;
}
.btn-new-class:hover { background: var(--primary-hover); }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
}
.user-card:hover { background: rgba(0,0,0,0.03); }
.user-card--open { background: rgba(0,0,0,0.03); }
.user-initials {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--pink-tile);
  color: #B83C5E;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 13px;
}
.user-name { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.user-role { font-size: 12px; color: var(--muted); }
.user-card .chev { margin-left: auto; color: var(--muted); }

/* User dropdown (opens upward) */
.user-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: 0 -4px 16px rgba(31,27,22,0.08), 0 2px 8px rgba(31,27,22,0.04);
  z-index: 40;
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--ink-2);
  text-align: left;
  transition: background 0.12s;
  cursor: pointer;
}
.user-dropdown-item:hover { background: var(--primary-softer); color: var(--primary); }
.user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px;
}

/* ===== Main ===== */
.main {
  padding: 28px 40px 48px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}
.greeting {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 6px;
}
.greeting .wave { display: inline-block; transform-origin: 70% 70%; }
.greeting:hover .wave { animation: wave 1.4s ease 1; }
@keyframes wave {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(14deg); }
  40% { transform: rotate(-8deg); }
  60% { transform: rotate(14deg); }
  80% { transform: rotate(-4deg); }
}
.greeting-sub { color: var(--muted); font-size: 14px; margin: 0; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.btn-soft {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
}
.btn-soft:hover { border-color: var(--muted-2); }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  position: relative;
  color: var(--ink-2);
  transition: border-color 0.15s;
}
.icon-btn:hover { border-color: var(--muted-2); }
.icon-btn .dot {
  position: absolute;
  top: 9px; right: 9px;
  width: 7px; height: 7px;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--card);
}

/* ===== Stat cards ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s, transform 0.15s;
}
.stat:hover { border-color: var(--border-strong); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat-icon.orange { background: var(--orange-tile); color: #C5532A; }
.stat-icon.coral  { background: var(--pink-tile);   color: #B83C5E; }
.stat-icon.peach  { background: var(--orange-tile); color: #C5532A; }
.stat-icon.purple { background: var(--purple-tile); color: #6B49B8; }
.stat-icon.gold   { background: var(--yellow-tile); color: #8A6A14; }

.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 4px;
  line-height: 1.1;
}
.stat-foot {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex; align-items: center; gap: 4px;
}
.stat-foot.up { color: #2F7A3E; }
.stat-foot a { color: var(--primary); font-weight: 500; }
.stat-foot a:hover { text-decoration: underline; }

/* ===== Grid 2-col below stats ===== */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

/* ===== Card ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-card);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 4px;
}
.card-sub { font-size: 13px; color: var(--muted); margin: 0; }
.link-cta {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
  background: none; border: 0; padding: 0;
  display: inline-flex; align-items: center; gap: 4px;
}
.link-cta:hover { text-decoration: underline; }
.btn-ghost {
  font-size: 12.5px; font-weight: 500;
  color: var(--ink-2);
  border: 1px solid var(--border-strong);
  background: var(--card);
  padding: 6px 11px;
  border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-ghost:hover { border-color: var(--muted-2); }

/* ===== Chart legend & axes ===== */
.legend { display: flex; gap: 16px; align-items: center; margin: 6px 0 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

.chart-wrap { position: relative; }

/* ===== Student list ===== */
.list { display: flex; flex-direction: column; }
.list-row {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }
.list-row .avatar {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  background: var(--pink-tile);
}
.list-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.list-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.list-right { text-align: right; }

/* ===== Pills / badges ===== */
.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.pill.warn   { background: var(--orange-50); color: var(--orange-700); }
.pill.danger { background: #FBE2DB; color: #B73B25; }
.pill.purple { background: var(--purple-50); color: var(--purple-700); }
.pill.green  { background: var(--green-50);  color: var(--green-700); }
.pill.yellow { background: var(--yellow-50); color: var(--yellow-700); }
.pill.blue   { background: var(--blue-50);   color: var(--blue-700); }
.pill.coral  { background: #FBE2DB; color: #B73B25; }

.tag-level {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  min-width: 28px;
  text-align: center;
  letter-spacing: 0.02em;
}
.tag-A1 { background: var(--orange-50); color: var(--orange-700); }
.tag-A2 { background: var(--green-50);  color: var(--green-700); }
.tag-B1 { background: var(--blue-50);   color: var(--blue-700); }
.tag-B2 { background: var(--purple-50); color: var(--purple-700); }
.tag-C1 { background: var(--yellow-50); color: var(--yellow-700); }

/* ===== Table ===== */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 10px;
  font-size: 13.5px;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }

.bar {
  position: relative;
  height: 6px;
  background: #F1EAE0;
  border-radius: 999px;
  overflow: hidden;
  width: 110px;
}
.bar-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--primary);
  border-radius: 999px;
}
.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-row span { font-size: 13px; color: var(--ink); min-width: 32px; }

/* ===== Recent assignments ===== */
.assign-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.assign-row:last-child { border-bottom: 0; }
.assign-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.assign-icon.coral  { background: var(--pink-tile);   color: #B83C5E; }
.assign-icon.green  { background: var(--green-50);    color: var(--green-700); }
.assign-icon.orange { background: var(--orange-50);   color: var(--orange-700); }
.assign-icon.peach  { background: var(--orange-tile); color: #C5532A; }
.assign-title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.assign-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.assign-date { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ===== AI Banner ===== */
.ai-banner {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-card);
}
.ai-banner-left { display: flex; align-items: center; gap: 16px; }
.ai-emoji {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--primary-softer);
  display: grid; place-items: center;
  font-size: 28px;
}
.ai-banner h3 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.ai-banner p { margin: 0; font-size: 13.5px; color: var(--muted); }
.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.btn-outline:hover { background: var(--primary-softer); }

/* ===== Date range dropdown ===== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: 0 8px 24px rgba(31,27,22,0.08);
  z-index: 20;
}
.dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--ink-2);
  border-radius: 6px;
}
.dropdown-menu button:hover { background: var(--primary-softer); color: var(--primary); }
.dropdown-menu button.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
  display: flex; align-items: center; gap: 10px;
  z-index: 100;
  animation: slideUp 0.25s ease both;
}
@keyframes slideUp {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Notification panel ===== */
.notif-panel {
  position: absolute;
  top: 48px; right: 0;
  width: 340px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: 0 12px 32px rgba(31,27,22,0.1);
  z-index: 30;
}
.notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.notif-head h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
}
.notif-head span { font-size: 11.5px; color: var(--muted); }
.notif-row {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
  display: flex; gap: 10px;
}
.notif-row:hover { background: var(--primary-softer); }
.notif-row .nbullet {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  margin-top: 6px; flex-shrink: 0;
}
.notif-row.read .nbullet { background: var(--muted-2); }
.notif-row .ntime { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ===== Misc ===== */
.dot-3 { display: inline-block; vertical-align: middle; }


