:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d9dee8;
  --panel: #ffffff;
  --canvas: #f5f7f4;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --amber: #b7791f;
  --rose: #b42318;
  --blue: #2563eb;
  --sidebar: #263238;
  --sidebar-soft: #33434a;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar);
  color: #f8fafc;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #e7f7f3;
  color: var(--accent-strong);
  font-weight: 800;
  border-radius: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.brand p {
  margin: 2px 0 0;
  color: #b9c4ca;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #d8e2e7;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: var(--sidebar-soft);
  color: #ffffff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  font-weight: 700;
}

.device-box {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  color: #c7d1d6;
  font-size: 12px;
}

.device-box strong {
  color: #ffffff;
  font-size: 14px;
}

.teacher-mode .device-box {
  display: none;
}

.workspace {
  padding: 28px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-header h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-grid,
.teacher-grid {
  display: grid;
  gap: 18px;
}

.student-grid {
  grid-template-columns: minmax(320px, 560px) minmax(320px, 1fr);
}

.teacher-grid {
  grid-template-columns: 360px minmax(520px, 1fr);
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.wide-panel {
  min-width: 0;
}

.preview-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 17px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.compact-form {
  gap: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 650;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd6e1;
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 42px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.task-details {
  border: 1px solid #d7eadf;
  background: #f2fbf6;
  color: #25584d;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.task-details.empty {
  border-color: #e1e6ef;
  background: #f8fafc;
  color: var(--muted);
}

.resource-list {
  display: grid;
  gap: 8px;
}

.resource-panel .resource-list {
  min-height: 210px;
}

.resource-item {
  display: grid;
  gap: 6px;
  border: 1px solid #e1e6ef;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.resource-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.resource-panel .file-link {
  font-size: 15px;
}

.drop-zone {
  position: relative;
  min-height: 132px;
  border: 1.5px dashed #9ab9b2;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 22px;
  background: #f7fbf9;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.compact-drop {
  min-height: 96px;
  padding: 16px;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: #e8f7f2;
}

.drop-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-main {
  font-weight: 800;
  color: var(--accent-strong);
}

.drop-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  max-width: 420px;
}

.selected-files,
.submission-list {
  display: grid;
  gap: 10px;
}

.file-pill,
.submission-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #ffffff;
}

.file-pill {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.submission-item {
  display: grid;
  gap: 8px;
}

.submission-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.file-link,
.secondary-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.file-link:hover,
.secondary-link:hover {
  text-decoration: underline;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
  padding: 0 15px;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button {
  background: #eef2f6;
  color: var(--ink);
  padding: 0 14px;
}

.danger-button {
  background: #fee4e2;
  color: var(--rose);
  padding: 0 14px;
}

.danger-button:hover {
  background: #fecdca;
}

.table-danger {
  min-height: 32px;
  padding: 0 10px;
}

.icon-button {
  width: 40px;
  background: #eef2f6;
  color: var(--ink);
  font-size: 18px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.message.error {
  color: var(--rose);
}

.message.success {
  color: var(--accent-strong);
}

.login-panel {
  min-height: 54vh;
  display: grid;
  place-items: center;
}

.login-box {
  width: min(420px, 100%);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.login-box h3 {
  margin: 0;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-strip div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
}

.switch-row {
  display: grid;
  gap: 8px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
}

.switch input {
  display: none;
}

.switch span {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  flex: 0 0 auto;
}

.switch span::after {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.16s ease;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.filters {
  display: grid;
  grid-template-columns: 160px 1fr minmax(180px, 280px);
  gap: 10px;
  margin-bottom: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  background: #ffffff;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e6ebf2;
  padding: 11px 12px;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 800;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #475467;
  font-weight: 800;
  font-size: 12px;
}

.badge.late {
  background: #fff3e0;
  color: var(--amber);
}

.badge.ok {
  background: #e7f7f3;
  color: var(--accent-strong);
}

.preview-area {
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.preview-area img,
.preview-area video {
  max-width: 100%;
  max-height: 620px;
  display: block;
  margin: auto;
}

.preview-area iframe {
  width: 100%;
  height: 620px;
  border: 0;
  background: #ffffff;
}

.preview-area audio {
  width: calc(100% - 32px);
  margin: 32px 16px;
}

.preview-area pre {
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
}

.empty-state {
  min-height: 130px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .student-grid,
  .teacher-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 14px;
  }

  .brand,
  .device-box {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 18px;
  }

  .page-header {
    align-items: flex-start;
  }

  .page-header h2 {
    font-size: 24px;
  }

  .two-col,
  .filters,
  .summary-strip {
    grid-template-columns: 1fr;
  }
}
