:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-darker: #0d47a1;
  --primary-light: #e8f0fe;
  --primary-lighter: #f4f8ff;
  --white: #ffffff;
  --border: #e3e8ef;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --danger: #d93025;
  --danger-light: #fce8e6;
  --success: #137333;
  --success-light: #e6f4ea;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(26,115,232,.06), 0 1px 3px rgba(26,115,232,.08);
  --shadow: 0 2px 6px rgba(26,115,232,.08), 0 4px 16px rgba(26,115,232,.08);
  --shadow-lg: 0 8px 24px rgba(26,115,232,.14), 0 2px 8px rgba(26,115,232,.10);
  --sidebar-w: 264px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Google Sans', 'Roboto', Arial, sans-serif;
  background: #f6f9ff;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
h1, h2, h3 { font-family: 'Google Sans', 'Roboto', Arial, sans-serif; }

::selection { background: var(--primary-light); color: var(--primary-darker); }

/* ============ APP SHELL ============ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.shell-body { display: flex; flex: 1; min-height: calc(100vh - var(--topbar-h)); }

/* ============ TOPBAR ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 300;
}
.topbar-left { display: flex; align-items: center; gap: 6px; }
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 500;
  color: var(--primary-darker);
  padding: 8px;
  border-radius: 8px;
}
.topbar .actions { display: flex; align-items: center; gap: 14px; }
.user-chip { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.role-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .4px;
}
.role-badge.role-teacher { background: #fef3e0; color: #b06000; }
.role-badge.role-student { background: var(--primary-light); color: var(--primary-dark); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 20px;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.btn-icon:hover { background: var(--primary-lighter); color: var(--primary); }
.sidebar-toggle { display: none; }

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--white);
  border-right: 1px solid var(--border); padding: 18px 10px;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto; z-index: 200;
  transition: transform .25s ease;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; border-radius: 24px; font-size: 14px; font-weight: 500;
  color: var(--text); transition: background .15s, color .15s;
}
.side-link svg { flex-shrink: 0; color: var(--text-secondary); }
.side-link:hover { background: var(--primary-lighter); }
.side-link.active { background: var(--primary-light); color: var(--primary-darker); font-weight: 700; }
.side-link.active svg { color: var(--primary); }
.side-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.side-link-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-divider {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); padding: 20px 16px 8px;
}
.side-empty { padding: 8px 16px; font-size: 13px; color: var(--text-muted); }
.side-nav-classes { max-height: 50vh; overflow-y: auto; }
.sidebar-overlay { display: none; }

/* ============ MAIN CONTENT ============ */
.main-content { flex: 1; min-width: 0; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: 24px; border: 1px solid transparent;
  cursor: pointer; font-size: 14px; font-weight: 500; font-family: inherit;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow); }
.btn-outline { background: #fff; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-lighter); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-text { background: none; color: var(--primary); padding: 9px 14px; border-radius: 20px; }
.btn-text:hover { background: var(--primary-lighter); }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: var(--danger-light); }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .65; cursor: not-allowed; }

/* Loading spinner state for forms */
.js-loading-submit.is-loading button[type="submit"] {
  pointer-events: none; opacity: .75;
}
.js-loading-submit.is-loading button[type="submit"]::after {
  content: ''; width: 14px; height: 14px; margin-left: 8px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; display: inline-block; animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ LAYOUT ============ */
.container { max-width: 900px; margin: 0 auto; padding: 28px 24px 60px; }
.container-wide { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-title { font-size: 26px; margin: 0 0 4px; }
.page-sub { color: var(--text-secondary); margin: 0; font-size: 14px; }

/* ============ AUTH ============ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #eaf1ff 0%, #ffffff 55%);
  padding: 24px;
}
.auth-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 40px; width: 100%; max-width: 420px;
  animation: fadeUp .35s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.auth-logo { display: flex; justify-content: center; margin-bottom: 12px; }
.auth-card h1 { color: var(--primary-darker); text-align: center; font-size: 24px; margin: 0 0 4px; }
.auth-card p.sub { text-align: center; color: var(--text-secondary); margin-bottom: 26px; font-size: 14px; }
.form-group { margin-bottom: 16px; flex: 1; }
.form-row { display: flex; gap: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.form-control {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; font-family: inherit; transition: border-color .15s, box-shadow .15s;
  background: #fbfcff;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); background: #fff; }
textarea.form-control { resize: vertical; font-family: inherit; }
.auth-footer { text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-secondary); }
.auth-footer a { color: var(--primary); font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

.role-picker { display: flex; gap: 12px; }
.role-option { flex: 1; cursor: pointer; }
.role-option input { display: none; }
.role-option-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 1.5px solid var(--border); border-radius: 10px; padding: 14px 8px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary); transition: all .15s;
}
.role-option input:checked + .role-option-card {
  border-color: var(--primary); background: var(--primary-light); color: var(--primary-darker);
}

.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.alert-error { background: var(--danger-light); color: var(--danger); }
.alert-success { background: var(--success-light); color: var(--success); }

/* ============ TOASTS ============ */
#toast-container {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  min-width: 260px; max-width: 90vw; padding: 13px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn .25s ease;
  pointer-events: auto;
}
.toast.hide { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px) scale(.96); } }
.toast-success { background: #1e8e3e; color: #fff; }
.toast-error { background: #d93025; color: #fff; }

/* ============ CLASS CARDS (dashboard) ============ */
.class-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}
.class-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s;
  display: flex; flex-direction: column;
}
.class-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.class-card-header { padding: 18px 16px; color: #fff; position: relative; overflow: hidden; min-height: 92px; }
.class-card-pattern {
  position: absolute; inset: 0; opacity: .15;
  background-image: radial-gradient(circle at 90% 10%, #fff 0, transparent 45%), radial-gradient(circle at 10% 100%, #fff 0, transparent 35%);
}
.class-card-header h3 { margin: 0 0 4px; font-size: 18px; position: relative; }
.class-card-header p { margin: 0; font-size: 13px; opacity: .9; position: relative; }
.class-card-avatar {
  position: absolute; bottom: -22px; right: 16px;
  width: 56px; height: 56px; border-radius: 50%;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.class-card-body { padding: 32px 16px 10px; flex: 1; }
.class-card-meta {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--text-secondary); margin-bottom: 6px;
}
.class-card-meta svg { flex-shrink: 0; color: var(--text-muted); }
.class-card-footer { padding: 6px 16px 14px; display: flex; justify-content: flex-end; }
.class-card-arrow { font-size: 13px; font-weight: 600; color: var(--primary); }

.empty-state { text-align: center; padding: 70px 20px; color: var(--text-secondary); }
.empty-state svg { margin-bottom: 12px; }
.empty-state h2 { color: var(--text); margin-bottom: 6px; }
.empty-state p { max-width: 380px; margin: 0 auto; }

.fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer; display: none; align-items: center; justify-content: center;
  transition: background .15s, transform .15s;
  z-index: 150;
}
.fab:hover { background: var(--primary-dark); transform: scale(1.06); }

/* ============ MODAL ============ */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(20,30,50,.45);
  align-items: center; justify-content: center; z-index: 500;
  backdrop-filter: blur(1px);
}
.modal-overlay.active { display: flex; animation: overlayIn .18s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: var(--radius); padding: 26px; width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn .22s cubic-bezier(.2,.9,.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; color: var(--primary-darker); font-size: 20px; }
.modal-close {
  background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted);
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--primary-lighter); color: var(--text); }
.modal-hint { font-size: 13px; color: var(--text-secondary); margin: -8px 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.color-swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch-label { display: contents; }
.color-swatch {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(0,0,0,.06);
  transition: transform .15s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--text); }

/* ============ CLASS PAGE BANNER + TABS ============ */
.class-banner {
  padding: 46px 28px 34px; color: #fff; position: relative; overflow: hidden;
}
.class-banner-pattern {
  position: absolute; inset: 0; opacity: .12;
  background-image: radial-gradient(circle at 85% 20%, #fff 0, transparent 40%), radial-gradient(circle at 15% 110%, #fff 0, transparent 45%);
}
.class-banner-inner { position: relative; max-width: 1180px; margin: 0 auto; }
.class-banner h1 { margin: 0 0 6px; font-size: 30px; }
.class-banner p { margin: 2px 0; opacity: .92; font-size: 14px; }
.code-box {
  position: absolute; bottom: -22px; right: 28px;
  background: #fff; color: var(--text); border-radius: 10px;
  padding: 10px 16px; box-shadow: var(--shadow-lg); font-size: 12px;
}
.code-box-label { color: var(--text-secondary); margin-bottom: 2px; }
.code-box-value { display: flex; align-items: center; gap: 8px; }
.code-box-value strong { font-size: 17px; letter-spacing: 1.5px; color: var(--primary); }
.copy-btn {
  background: var(--primary-lighter); border: none; border-radius: 6px; width: 26px; height: 26px;
  color: var(--primary); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.copy-btn:hover { background: var(--primary-light); }

.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin: 40px 0 0; padding: 0 24px; background: #fff; overflow-x: auto;
  position: sticky; top: var(--topbar-h); z-index: 90;
}
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 15px 16px; font-size: 14px; font-weight: 500; color: var(--text-secondary);
  border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap;
  transition: color .15s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-color: var(--primary); font-weight: 700; }

/* ============ STREAM / POST CARDS ============ */
.post-composer {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 22px; display: flex; align-items: center;
  gap: 14px; box-shadow: var(--shadow-sm); cursor: pointer; color: var(--text-secondary);
  transition: box-shadow .15s;
}
.post-composer:hover { box-shadow: var(--shadow); }
.post-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 18px; box-shadow: var(--shadow-sm); transition: box-shadow .15s;
}
.post-card:hover { box-shadow: var(--shadow); }
.post-card-header {
  display: flex; align-items: center; gap: 12px; padding: 18px 20px 8px;
}
.post-card-header .meta { flex: 1; }
.post-card-header .meta .name { font-weight: 600; font-size: 14px; }
.post-card-header .meta .time { font-size: 12px; color: var(--text-muted); }
.post-card-actions { display: flex; gap: 2px; margin-left: 6px; }
.post-badge {
  font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 12px;
  text-transform: uppercase; letter-spacing: .3px;
}
.badge-announcement { background: var(--primary-light); color: var(--primary-dark); }
.badge-assignment { background: #fef3e0; color: #b06000; }
.badge-material { background: #e6f4ea; color: var(--success); }
.post-card-body { padding: 6px 20px 18px; }
.post-card-body h3 { margin: 4px 0 8px; font-size: 17px; }
.post-content { font-size: 14px; line-height: 1.6; color: var(--text); }
.post-assignment-meta {
  display: flex; gap: 18px; font-size: 13px; color: var(--text-secondary);
  margin-top: 12px; flex-wrap: wrap;
}
.due-overdue { color: var(--danger); font-weight: 600; }
.turned-in-tag { color: var(--success); font-weight: 600; }
.late-tag {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  background: var(--danger-light); color: var(--danger); padding: 3px 10px; border-radius: 10px;
  margin-left: 4px;
}

.attached-files-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 2px; background: var(--primary-lighter);
  border: 1px solid var(--border); border-radius: 16px; padding: 5px 6px 5px 14px; font-size: 12.5px;
}
.file-chip a { color: var(--primary-dark); text-decoration: none; }
.file-chip a:hover { text-decoration: underline; }
.file-chip form { display: inline-flex; margin: 0; }
.file-chip-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 15px;
  width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.file-chip-remove:hover { background: var(--danger-light); color: var(--danger); }
.answer-box {
  background: var(--primary-lighter); border-radius: var(--radius-sm); padding: 12px 14px;
  margin-top: 4px;
}

/* ============ TRACKING PUBLIK ============ */
.tracking-box { margin-bottom: 20px; }
.tracking-link-box {
  display: flex; gap: 6px; align-items: center; background: var(--primary-lighter);
  border: 1px solid var(--border); border-radius: 24px; padding: 6px 6px 6px 16px;
}
.tracking-link-box input {
  flex: 1; border: none; background: transparent; font-size: 13px; color: var(--text);
  outline: none; min-width: 0;
}

/* ============ SEARCH BAR ============ */
.search-bar {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border);
  border-radius: 24px; padding: 10px 16px; margin-bottom: 18px; color: var(--text-muted);
}
.search-bar input[type="text"] {
  flex: 1; border: none; outline: none; font-size: 14px; font-family: inherit; background: transparent; color: var(--text);
}
.search-clear {
  font-size: 18px; color: var(--text-muted); width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.search-clear:hover { background: var(--primary-lighter); color: var(--text); }

/* ============ PAGINATION ============ */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pager-btn {
  font-size: 13px; font-weight: 600; color: var(--primary); padding: 8px 14px; border-radius: 18px;
  border: 1px solid var(--border);
}
.pager-btn:hover { background: var(--primary-lighter); }
.pager-btn.disabled { color: var(--text-muted); pointer-events: none; opacity: .5; }
.pager-info { font-size: 12.5px; color: var(--text-muted); }

.comment-box { border-top: 1px solid #f0f3fa; padding: 12px 20px 14px; }
.comment-item { font-size: 13px; margin-bottom: 10px; display: flex; gap: 10px; align-items: flex-start; }
.comment-avatar {
  width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px;
}
.comment-item strong { color: var(--text); margin-right: 4px; }
.comment-form { display: flex; gap: 8px; margin-top: 6px; align-items: center; }
.comment-form input {
  flex: 1; border: none; border-bottom: 1.5px solid var(--border); padding: 8px 2px; font-size: 13px;
  outline: none; background: transparent; transition: border-color .15s;
}
.comment-form input:focus { border-color: var(--primary); }

/* ============ ASSIGNMENT LIST ============ */
.assignment-list-item {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; margin-bottom: 10px; transition: box-shadow .15s, border-color .15s;
}
.assignment-list-item:hover { box-shadow: var(--shadow-sm); border-color: var(--primary); }
.assignment-list-link { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; color: inherit; }
.assignment-list-icon {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.assignment-list-info { flex: 1; min-width: 0; }
.assignment-list-title { font-weight: 600; font-size: 14.5px; }
.assignment-list-meta { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
.assignment-list-actions { display: flex; gap: 2px; flex-shrink: 0; margin-left: 6px; }

/* ============ PEOPLE ============ */
.people-section { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.people-section h3 {
  padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--border); color: var(--primary-darker);
  font-size: 15px; display: flex; align-items: center; gap: 8px;
}
.people-row { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid #f4f6fb; font-size: 14px; }
.people-row:last-child { border-bottom: none; }

.danger-zone { margin-top: 30px; text-align: right; border-top: 1px solid var(--border); padding-top: 16px; }

/* ============ ASSIGNMENT DETAIL ============ */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
  color: var(--primary); margin-bottom: 14px; padding: 6px 10px; border-radius: 16px;
}
.back-link:hover { background: var(--primary-lighter); }
.assignment-detail { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.assignment-detail p { line-height: 1.6; }
.submission-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-top: 18px; box-shadow: var(--shadow-sm); }
.grade-pill { background: var(--primary-light); color: var(--primary-dark); padding: 4px 12px; border-radius: 12px; font-weight: 700; font-size: 13px; }

.file-drop {
  display: flex; align-items: center; gap: 10px; border: 1.5px dashed var(--border); border-radius: 8px;
  padding: 14px; cursor: pointer; color: var(--text-secondary); font-size: 13px; transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--primary); background: var(--primary-lighter); }
.file-drop input { display: none; }

table.students-table { width: 100%; border-collapse: collapse; }
table.students-table th, table.students-table td {
  text-align: left; padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px;
}
table.students-table th { color: var(--text-secondary); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; }
table.students-table tr:hover td { background: var(--primary-lighter); }
.grade-input { width: 70px; padding: 7px; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; }
.grade-input:focus { outline: none; border-color: var(--primary); }

.field-hint { font-size: 12.5px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.5; }
.field-hint code { background: var(--primary-lighter); padding: 1px 6px; border-radius: 4px; color: var(--primary-dark); }
table.students-table code { background: var(--primary-lighter); padding: 2px 8px; border-radius: 4px; color: var(--primary-dark); font-weight: 600; letter-spacing: .3px; }

.status-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700;
  margin-right: 4px;
}
.status-berhasil { background: var(--success-light); color: var(--success); }
.status-info { background: var(--primary-light); color: var(--primary-dark); }
.status-gagal { background: var(--danger-light); color: var(--danger); }

.import-method-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start;
}
@media (max-width: 800px) {
  .import-method-grid { grid-template-columns: 1fr; }
}

.manual-submission-toggle {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  color: var(--primary); cursor: pointer; margin-top: 10px;
}
.manual-submission-box {
  display: none; margin-top: 14px; padding: 16px; border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm); background: var(--primary-lighter);
}
.manual-submission-box.active { display: block; }

/* ============ GROUPS (Tugas Kolaborasi) ============ */
.group-tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700;
  background: #f3e8fd; color: #8e24aa; padding: 4px 11px; border-radius: 12px;
}
.group-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.group-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.group-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.group-card-head h3 { margin: 0; font-size: 15px; color: var(--primary-darker); }
.group-members { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.group-member-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.group-remove-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px;
  width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.group-remove-btn:hover { background: var(--danger-light); color: var(--danger); }
.group-add-form { display: flex; gap: 6px; border-top: 1px solid #f0f3fa; padding-top: 10px; }
.group-add-form select { flex: 1; padding: 7px 8px; font-size: 13px; }
.group-member-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.group-chip {
  background: var(--primary-lighter); color: var(--primary-dark); font-size: 12.5px; font-weight: 500;
  padding: 5px 12px; border-radius: 12px;
}

/* ============ ATTITUDE (Penilaian Sikap) ============ */
.attitude-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.attitude-option { cursor: pointer; }
.attitude-option input { display: none; }
.attitude-badge {
  display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700;
  padding: 6px 14px; border-radius: 14px; border: 1.5px solid transparent;
}
.attitude-option input:checked + .attitude-badge { border-color: currentColor; }
.attitude-sb { background: #e6f4ea; color: #137333; }
.attitude-b  { background: var(--primary-light); color: var(--primary-dark); }
.attitude-c  { background: #fef3e0; color: #b06000; }
.attitude-k  { background: var(--danger-light); color: var(--danger); }
.attitude-timeline { display: flex; flex-direction: column; gap: 12px; }
.attitude-timeline-item {
  display: flex; gap: 14px; align-items: flex-start; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.attitude-timeline-body p { margin: 6px 0 0; font-size: 13.5px; color: var(--text); line-height: 1.5; }
.attitude-timeline-date { font-size: 12.5px; color: var(--text-muted); }

/* ============ GRADEBOOK (Rekap Nilai) ============ */
.gradebook-table { min-width: 600px; }
.gradebook-table th, .gradebook-table td { white-space: nowrap; }
.avg-badge {
  display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700;
  background: var(--primary-light); color: var(--primary-dark); padding: 4px 12px; border-radius: 12px;
}
.grade-summary-card {
  display: flex; gap: 32px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.grade-summary-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.grade-summary-value { font-size: 26px; font-weight: 700; color: var(--primary-darker); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.35); z-index: 190;
  }
  .sidebar-overlay.active { display: block; }
  .user-chip { display: none; }
  .fab { display: flex; }
}

@media (max-width: 640px) {
  .container, .container-wide { padding: 18px 14px 60px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .code-box { position: static; margin-top: 16px; display: inline-block; }
  .tabs { top: var(--topbar-h); }
  .form-row { flex-direction: column; gap: 0; }
  .class-banner { padding: 32px 18px 26px; }
}

@media (min-width: 641px) {
  .fab { display: none; }
}

/* ============ RICH TEXT EDITOR ============ */
.rte-wrap { border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.rte-toolbar {
  display: flex; gap: 2px; padding: 6px; background: #f6f9ff; border-bottom: 1px solid var(--border);
}
.rte-toolbar button {
  width: 30px; height: 30px; border: none; background: none; border-radius: 6px; cursor: pointer;
  color: var(--text-secondary); font-size: 14px; font-family: inherit;
}
.rte-toolbar button:hover { background: var(--primary-light); color: var(--primary-dark); }
.rte-editable {
  min-height: 100px; max-height: 320px; overflow-y: auto; padding: 12px 14px; font-size: 14px;
  outline: none; line-height: 1.6;
}
.rte-editable:empty::before { content: attr(data-placeholder); color: var(--text-muted); }
.rte-editable ul, .rte-editable ol { padding-left: 22px; margin: 6px 0; }
.rte-editable a { color: var(--primary); text-decoration: underline; }
.rte-content { font-size: 14px; line-height: 1.6; color: var(--text); }
.rte-content ul, .rte-content ol { padding-left: 22px; margin: 6px 0; }
.rte-content a { color: var(--primary); text-decoration: underline; }
.rte-content p { margin: 0 0 8px; }

/* ============ ARCHIVE ============ */
.archived-banner {
  background: #fef7e0; color: #7a5c00; padding: 12px 24px; font-size: 13.5px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.archived-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 16px;
}
.archived-link:hover { color: var(--primary); }

/* ============ CALENDAR ============ */
.calendar-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.calendar-nav { display: flex; align-items: center; gap: 10px; }
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
}
.calendar-dow {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; padding-bottom: 6px;
}
.calendar-cell {
  min-height: 90px; border: 1px solid var(--border); border-radius: 8px; padding: 6px;
  background: #fff; font-size: 12px;
}
.calendar-cell.empty { background: transparent; border: none; }
.calendar-cell.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.calendar-day-num { font-weight: 600; margin-bottom: 4px; color: var(--text-secondary); }
.calendar-cell.today .calendar-day-num { color: var(--primary); }
.calendar-chip {
  display: block; font-size: 10.5px; padding: 2px 6px; border-radius: 6px; margin-bottom: 3px;
  color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calendar-more { font-size: 10.5px; color: var(--text-muted); }
@media (max-width: 700px) {
  .calendar-grid { gap: 3px; }
  .calendar-cell { min-height: 60px; padding: 3px; font-size: 10px; }
  .calendar-dow { font-size: 9px; }
}
