*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --indigo: #4F46E5;
  --indigo-light: #6366F1;
  --indigo-bg: #EEF2FF;
  --green: #059669;
  --green-bg: #ECFDF5;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-700);
  background: var(--gray-50);
  min-height: 100vh;
}

/* ─── LOGIN ──────────────────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo svg { width: 56px; height: 56px; margin-bottom: 1rem; }
.login-card h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.subtitle { color: var(--gray-400); font-size: .9rem; margin: .25rem 0 1.75rem; }

.hint-box {
  margin-top: 1.75rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: .9rem 1rem;
  text-align: left;
  font-size: .82rem;
  color: var(--gray-600);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.hint-box strong { color: var(--gray-700); margin-bottom: .15rem; }
.hint-box code {
  font-family: 'Courier New', monospace;
  background: var(--gray-200);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .78rem;
}

/* ─── SHARED FIELDS ───────────────────────────────────────────────── */
.field { text-align: left; margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.field input {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .95rem;
  color: var(--gray-900);
  transition: border-color .15s;
  outline: none;
}
.field input:focus { border-color: var(--indigo-light); }

.label-hint { font-weight: 400; color: var(--gray-400); text-transform: none; letter-spacing: 0; }
.label-required { font-weight: 600; color: var(--red); text-transform: none; letter-spacing: 0; }

/* ─── BUTTONS ─────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: .7rem 1rem;
  background: var(--indigo);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  margin-top: .5rem;
}
.btn-primary:hover:not(:disabled) { background: #4338CA; }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-600);
  padding: .45rem .9rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: var(--gray-100); border-color: var(--gray-300); }
.btn-sm { padding: .3rem .7rem; font-size: .82rem; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: transparent;
  border: none;
  color: var(--gray-600);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  padding: .4rem .6rem;
  border-radius: 8px;
  transition: background .12s, color .12s;
}
.btn-back:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-back svg { width: 18px; height: 18px; }

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .75rem;
  background: var(--indigo-bg);
  color: var(--indigo);
  border-radius: 7px;
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.btn-download:hover { background: #C7D2FE; }

.btn-delete {
  background: transparent;
  border: none;
  color: var(--gray-400);
  font-size: 1rem;
  cursor: pointer;
  padding: .3rem .5rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
  line-height: 1;
}
.btn-delete:hover { color: var(--red); background: var(--red-bg); }

/* ─── TOPBAR ──────────────────────────────────────────────────────── */
.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gray-900);
}
.topbar-brand svg { width: 32px; height: 32px; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }

.badge {
  font-size: .78rem;
  font-weight: 700;
  padding: .25rem .65rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-prof { background: var(--indigo-bg); color: var(--indigo); }
.badge-stud { background: var(--green-bg); color: var(--green); }

/* ─── MAIN LAYOUT ─────────────────────────────────────────────────── */
.dashboard-page { display: flex; flex-direction: column; }

.dashboard-main {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* ─── CLASS SELECTION VIEW ────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.page-subtitle {
  margin-top: .35rem;
  color: var(--gray-400);
  font-size: .92rem;
}

/* Desktop: grid of cards */
.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 1rem;
}

.class-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s, box-shadow .18s;
  user-select: none;
}
.class-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
.class-card:active { transform: translateY(-1px); }

.class-card-header {
  background: var(--card-color, var(--indigo));
  display: flex;
  align-items: center;
  justify-content: center;
  height: 92px;
}
.class-label {
  font-size: 1.75rem;
  font-weight: 800;
  color: rgba(255,255,255,.95);
  letter-spacing: -.02em;
}
.class-card-body {
  padding: .75rem 1rem .5rem;
  flex: 1;
}
.class-year {
  font-size: .72rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.class-files {
  font-size: .88rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-top: .2rem;
}
.class-card-arrow {
  padding: .4rem 1rem .6rem;
  text-align: right;
  color: var(--gray-300);
  font-size: 1.3rem;
  line-height: 1;
}

/* Mobile: list of rows */
@media (max-width: 540px) {
  .class-grid {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
  .class-card {
    flex-direction: row;
    align-items: center;
  }
  .class-card:hover { transform: none; box-shadow: none; }
  .class-card:active { background: var(--gray-50); }
  .class-card-header {
    width: 68px;
    min-width: 68px;
    height: 68px;
    border-radius: 0;
  }
  .class-label { font-size: 1.5rem; }
  .class-card-body { padding: .6rem .9rem; }
  .class-card-arrow {
    padding: .5rem .9rem;
    font-size: 1.1rem;
    color: var(--gray-300);
  }
}

/* ─── DETAIL VIEW ─────────────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.detail-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* ─── CARDS ───────────────────────────────────────────────────────── */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.1rem;
}

/* ─── FILE LIST ───────────────────────────────────────────────────── */
.files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.files-header h2 { margin-bottom: 0; }

.file-list { display: flex; flex-direction: column; gap: .45rem; }

.file-row {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem .8rem;
  border: 1px solid var(--gray-200);
  border-radius: 9px;
  transition: background .12s;
}
.file-row:hover { background: var(--gray-50); }

.file-icon { font-size: 1.3rem; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-display-name {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta {
  display: block;
  font-size: .75rem;
  color: var(--gray-400);
  margin-top: .15rem;
}
.file-actions { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }

.empty, .loading {
  text-align: center;
  padding: 2rem 0;
  color: var(--gray-400);
  font-size: .88rem;
}

/* ─── SECTION DIVIDER WITH ACTION ────────────────────────────────── */
.section-divider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--gray-200);
  padding-top: .9rem;
  margin-top: .75rem;
  margin-bottom: .5rem;
}
.section-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-400);
}

.btn-zip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .28rem .65rem;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-zip:hover { background: var(--gray-200); border-color: var(--gray-300); color: var(--gray-900); }

/* ─── UPLOAD SUCCESS STATE ────────────────────────────────────────── */
.upload-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.75rem 1rem 1.25rem;
  gap: .65rem;
}

.success-icon {
  width: 56px;
  height: 56px;
  background: var(--green-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
}
.success-icon svg { width: 26px; height: 26px; }

.success-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.success-filename {
  font-size: .88rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  padding: .35rem .85rem;
  border-radius: 7px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-another {
  margin-top: .25rem;
  background: transparent;
  border: 1.5px solid var(--gray-200);
  color: var(--gray-600);
  padding: .5rem 1.1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-another:hover { background: var(--indigo-bg); border-color: var(--indigo-light); color: var(--indigo); }

/* ─── DROP ZONE ───────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--indigo-light);
  background: var(--indigo-bg);
}
.drop-zone svg { width: 40px; height: 40px; margin-bottom: .4rem; }
.drop-zone p { font-size: .88rem; color: var(--gray-600); }
.file-label { color: var(--indigo); font-weight: 600; cursor: pointer; text-decoration: underline; }
.file-name {
  display: block;
  margin-top: .4rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--indigo);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── PROGRESS ────────────────────────────────────────────────────── */
.progress-bar {
  margin: .75rem 0;
  height: 5px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--indigo);
  border-radius: 99px;
  width: 0;
  transition: width .2s;
}

/* ─── UPLOAD MSG ──────────────────────────────────────────────────── */
.upload-msg {
  font-size: .88rem;
  font-weight: 500;
  padding: .5rem .75rem;
  border-radius: 7px;
  margin-bottom: .4rem;
}
.upload-msg.success { background: var(--green-bg); color: var(--green); }
.upload-msg.error   { background: var(--red-bg); color: var(--red); }

/* ─── UTILS ───────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.error-msg {
  background: var(--red-bg);
  color: var(--red);
  font-size: .88rem;
  font-weight: 500;
  padding: .5rem .75rem;
  border-radius: 7px;
  margin-bottom: .5rem;
  text-align: left;
}
