:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f5f7fb; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
.card { background: #fff; border: 1px solid #e3e8f2; border-radius: 18px; box-shadow: 0 8px 28px rgba(31,45,74,.06); }
.eyebrow { margin: 0 0 7px; font-weight: 800; letter-spacing: .12em; font-size: 12px; color: #58719c; }
.muted { color: #6c7890; }
.primary, .secondary, .danger, .link-button { border: 0; border-radius: 11px; padding: 10px 15px; font-weight: 750; }
.primary { background: #2959c7; color: #fff; }
.primary:hover { background: #214bab; }
.secondary { background: #eef3fb; color: #254373; }
.secondary:hover { background: #e3ebf8; }
.danger { background: #fff0f0; color: #a22f2f; }
.link-button { background: transparent; color: #2959c7; padding-inline: 4px; }
.field { display: grid; gap: 7px; }
.field label { font-weight: 700; font-size: 14px; }
input, select { width: 100%; border: 1px solid #cfd7e6; border-radius: 10px; padding: 10px 11px; background: #fff; color: #172033; }
input:focus, select:focus { outline: 3px solid rgba(41,89,199,.12); border-color: #6385d4; }
.status { min-height: 22px; color: #486386; }
.status.error { color: #a32f2f; }
.status.success { color: #197448; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; background: #edf3ff; color: #36588e; font-size: 12px; font-weight: 700; }

.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.landing-card { width: min(720px, 100%); padding: 34px; }
.landing-card h1 { margin: 0; font-size: clamp(32px, 6vw, 52px); line-height: 1.05; }
.landing-copy { margin: 16px 0 26px; font-size: 18px; line-height: 1.6; color: #5d6980; }
.landing-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.landing-note { margin-top: 24px; padding-top: 20px; border-top: 1px solid #e6ebf3; color: #6c7890; font-size: 14px; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 34px; }
.top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.identity { font-size: 13px; color: #68758b; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

.tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0; }
.tab { border: 1px solid #dbe3ef; background: #fff; border-radius: 11px; padding: 10px 14px; font-weight: 750; color: #52637f; }
.tab.active { background: #2959c7; color: #fff; border-color: #2959c7; }
.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-grid .wide { grid-column: span 2; }
.toolbar { display: flex; gap: 9px; align-items: end; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: #728099; padding: 10px; border-bottom: 1px solid #e4e9f1; }
td { padding: 11px 10px; border-bottom: 1px solid #edf0f5; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.small { font-size: 12px; color: #778398; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { padding: 17px; }
.stat strong { display: block; font-size: 28px; margin-top: 6px; }

.file-browser { display: grid; grid-template-columns: 260px 1fr; min-height: 460px; border: 1px solid #e1e6ef; border-radius: 14px; overflow: hidden; background: #fff; }
.file-sidebar { padding: 16px; background: #f8faff; border-right: 1px solid #e1e6ef; }
.file-sidebar h3 { margin: 0 0 12px; }
.file-main { padding: 18px; min-width: 0; }
.breadcrumbs { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; }
.breadcrumbs button { border: 0; background: transparent; color: #2959c7; padding: 3px 5px; font-weight: 700; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 11px; }
.file-tile { border: 1px solid #e0e6f0; background: #fff; border-radius: 12px; padding: 14px; text-align: left; min-height: 110px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.file-tile:hover { border-color: #9eb3df; box-shadow: 0 5px 17px rgba(45,72,123,.08); }
.file-icon { font-size: 24px; }
.file-name { font-weight: 750; word-break: break-word; }
.file-meta { font-size: 12px; color: #7a879a; }
.folder-link { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 6px; border-radius: 8px; color: #455976; }
.folder-link:hover { background: #edf3ff; }
.homework-tile { border-color: #c8d7f5; background: #f9fbff; }

.login-panel { padding: 28px; display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.login-panel h2 { margin-top: 0; }

.dialog { border: 0; border-radius: 18px; width: min(820px, calc(100% - 30px)); max-height: 85vh; box-shadow: 0 22px 80px rgba(0,0,0,.2); padding: 0; }
.dialog::backdrop { background: rgba(17,27,45,.48); }
.dialog-inner { padding: 22px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.dialog-head h2 { margin: 0; }
.answer-row { padding: 13px 0; border-top: 1px solid #e5eaf2; }
.answer-row strong { display: block; margin-top: 5px; }
.correct { color: #177348; }
.incorrect { color: #9e3434; }

.student-shell { width: min(1200px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 50px; }
.student-hero { padding: 24px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.student-hero h1 { margin: 0; }
.google-login { padding: 28px; display: grid; place-items: center; text-align: center; min-height: 240px; }
.google-login h2 { margin-bottom: 6px; }
.portal-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.portal-header h2 { margin: 0; }

@media (max-width: 820px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .file-browser { grid-template-columns: 1fr; }
  .file-sidebar { border-right: 0; border-bottom: 1px solid #e1e6ef; }
  .topbar, .student-hero, .login-panel { flex-direction: column; }
  .top-actions { justify-content: flex-start; }
}
