:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0b63f6;
  --primary-strong: #0957d9;
  --blue: #0b63f6;
  --amber: #b45309;
  --rose: #e11d48;
  --success: #059669;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --shadow-lift: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
  --ease: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Kanit", "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.08), transparent 32rem),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: var(--ink);
  letter-spacing: 0;
  line-height: 1.55;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
}

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

button,
.button,
input,
select,
textarea,
.pill,
.status,
td,
th {
  overflow-wrap: anywhere;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, #0f172a 0%, #111827 62%, #0f172a 100%);
  color: #e5e7eb;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #bfdbfe, #0b63f6);
  color: #1e1b4b;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.22);
}

.brand strong,
.sidebar-account strong {
  display: block;
}

.brand strong {
  color: #f8fafc;
  font-size: 17px;
}

.brand small,
.sidebar-account small {
  color: #94a3b8;
}

.main-nav {
  display: grid;
  gap: 6px;
}

.main-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  transition: var(--ease);
}

.main-nav a.active,
.main-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.main-nav a:hover {
  transform: translateX(2px);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #64748b;
}

.main-nav a.active .nav-dot {
  background: #c7d2fe;
  box-shadow: 0 0 0 4px rgba(199, 210, 254, 0.16);
}

.sidebar-account {
  margin-top: auto;
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.text-link {
  width: fit-content;
  color: #a5f3fc;
  text-decoration: none;
  font-weight: 500;
}

.main-panel {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-title {
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 2.5vw, 32px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 16px;
  font-size: 20px;
  font-weight: 600;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  font-weight: 600;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.35fr);
}

.grid.stats {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.panel,
.stat-card,
.assignment-item,
.login-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel {
  padding: 28px 30px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 22px 24px;
  transition: var(--ease);
}

.stat-card::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(14, 165, 233, 0.08)),
    url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 25V18M19 25V12M28 25V16' stroke='%234F46E5' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M8 28H30' stroke='%230F172A' stroke-opacity='.35' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.stat-card:hover,
.assignment-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.stat-card strong {
  display: block;
  margin-top: 7px;
  font-size: 34px;
  line-height: 1;
}

.stat-card span,
.muted {
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.toolbar-between {
  justify-content: space-between;
}

.toolbar > div,
.toolbar-between > div,
.assignment-head > div,
.modal-header > div {
  min-width: 0;
}

.toolbar > button,
.toolbar > .button,
.row-actions > button,
.row-actions > .button {
  min-height: 40px;
  min-width: 96px;
  flex-shrink: 0;
}

.toolbar > label.field-wide + .button,
.toolbar > label.field-wide + button {
  align-self: end;
}

.section-stack {
  margin-top: 26px;
}

.pre-wrap {
  margin-top: 10px;
  white-space: pre-wrap;
}

.stacked-link {
  display: inline-block;
  margin-top: 12px;
}

.stacked-link.loose {
  margin-top: 14px;
}

.field-wide {
  min-width: 280px;
}

.form-grid {
  display: grid;
  gap: 18px;
}

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

label {
  display: grid;
  gap: 9px;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  line-height: 1.45;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 16px;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
  transition: var(--ease);
}

textarea {
  min-height: 118px;
  line-height: 1.6;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(79, 70, 229, 0.16);
  border-color: var(--primary);
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: var(--ease);
}

.button:hover,
button:hover {
  background: var(--primary-strong);
  box-shadow: 0 14px 24px rgba(79, 70, 229, 0.18);
  transform: translateY(-1px);
}

.button.secondary,
button.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button.secondary:hover,
button.secondary:hover {
  background: #f8fafc;
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.08);
}

.google-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #1f2937;
}

.google-button:hover {
  background: #f8fafc;
}

.google-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #d1d5db;
  border-radius: 50%;
  color: #2563eb;
  font-weight: 900;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.button.danger,
button.danger {
  background: var(--rose);
}

.button.blue,
button.blue {
  background: var(--blue);
}

.button[disabled],
button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

th {
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
}

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

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.status.done {
  background: #d1fae5;
  color: #065f46;
}

.status.pending {
  background: #fef3c7;
  color: #92400e;
}

.status.missing {
  background: #ffe4e6;
  color: #9f1239;
}

.status.open {
  background: #dbeafe;
  color: #1e40af;
}

.assignment-list,
.display-list,
.account-list,
.api-key-list {
  display: grid;
  gap: 16px;
}

.assignment-item {
  padding: 22px 24px;
  transition: var(--ease);
}

.assignment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.assignment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

details {
  margin-top: 12px;
}

summary {
  cursor: pointer;
  color: var(--primary-strong);
  font-weight: 500;
}

.flash {
  margin-bottom: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 14px 18px;
  background: #eff6ff;
  color: #1e3a8a;
}

.flash.success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}

.flash.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #78350f;
}

.flash.error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #9f1239;
}

.flash.info {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #0c4a6e;
}

.progress-track {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #0b63f6, #22c55e);
  transition: width 180ms ease;
}

.batch-log {
  min-height: 42px;
  margin-top: 10px;
  color: var(--muted);
}

.pagination-bar {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 12px;
  justify-content: space-between;
  margin-top: 16px;
}

.pagination-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 20% 20%, rgba(79, 70, 229, 0.12), transparent 30rem),
    linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
}

.login-card {
  width: min(1000px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 0.72fr);
  overflow: hidden;
}

.login-visual {
  display: grid;
  align-content: end;
  gap: 18px;
  min-height: 540px;
  padding: 42px 44px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.12), rgba(15, 23, 42, 0.92)),
    url("../img/myclass-pattern.svg");
  background-size: cover;
  color: #ffffff;
}

.login-visual h1 {
  font-size: clamp(32px, 5vw, 48px);
}

.login-form {
  display: grid;
  align-content: center;
  gap: 20px;
  padding: 42px 44px;
  background: rgba(255, 255, 255, 0.96);
}

.account-hints {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.google-profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.google-profile-preview img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

.google-profile-preview strong,
.google-profile-preview span {
  display: block;
}

.google-profile-preview span {
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.row-actions,
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.row-actions > .status {
  align-self: center;
}

.score-input {
  width: 112px;
}

.feedback-input {
  min-width: 280px;
  min-height: 92px;
}

td .row-actions {
  min-width: max-content;
}

td .row-actions > button,
td .row-actions > .button {
  min-height: 42px;
  padding-inline: 20px;
}

.grade-one-button {
  min-width: 132px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 38px 42px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 250, 252, 0.9)),
    radial-gradient(circle at top, rgba(79, 70, 229, 0.08), transparent 18rem);
  color: var(--muted);
  text-align: center;
}

.empty-state::before {
  content: "";
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.14), rgba(14, 165, 233, 0.12)),
    url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 23.5C20 20.4624 22.4624 18 25.5 18H46.5C49.5376 18 52 20.4624 52 23.5V48.5C52 51.5376 49.5376 54 46.5 54H25.5C22.4624 54 20 51.5376 20 48.5V23.5Z' stroke='%234F46E5' stroke-width='2'/%3E%3Cpath d='M27 29H45M27 36H45M27 43H38' stroke='%230F172A' stroke-opacity='.48' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: var(--shadow);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  width: min(720px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--shadow-lift);
}

.modal-dialog.wide {
  width: min(980px, 100%);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.modal-header h2 {
  margin-bottom: 4px;
}

.modal-body {
  padding: 26px 28px;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.icon-button:hover {
  background: #f8fafc;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.summary-item {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

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

.summary-item strong {
  font-size: 20px;
}

.account-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) repeat(4, minmax(150px, 1fr)) minmax(160px, 1fr) minmax(150px, 1fr) minmax(150px, 0.9fr) minmax(130px, 0.7fr);
  gap: 16px;
  align-items: end;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.api-key-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(180px, 1fr) minmax(130px, 0.7fr) minmax(90px, 0.4fr) minmax(150px, 0.8fr) minmax(140px, 0.8fr);
  gap: 16px;
  align-items: end;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

.danger-zone {
  margin-top: 22px;
  padding: 22px 24px;
  border: 1px solid #fecdd3;
  border-radius: 16px;
  background: #fff1f2;
}

.danger-zone .muted {
  color: #9f1239;
}

.action-menu {
  position: relative;
  display: inline-grid;
  align-self: stretch;
  margin-top: 0;
  min-height: 40px;
}

.action-menu summary {
  display: grid;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  font-size: 20px;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  transition: var(--ease);
}

.action-menu summary::-webkit-details-marker {
  display: none;
}

.action-menu summary:hover {
  background: #f8fafc;
  color: var(--primary);
  transform: translateY(-1px);
}

.action-menu[open] summary {
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.action-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 8px;
  min-width: 190px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow-lift);
}

.action-menu-panel .button,
.action-menu-panel button {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
  padding-inline: 20px;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(10px);
}

.confirm-dialog {
  width: min(440px, 100%);
  border: 1px solid #fecdd3;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}

.confirm-dialog header {
  padding: 24px 28px 10px;
}

.confirm-dialog header h2 {
  margin-bottom: 6px;
  color: #9f1239;
}

.confirm-dialog .confirm-body {
  display: grid;
  gap: 16px;
  padding: 0 28px 26px;
}

.confirm-dialog .confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 28px 26px;
  background: #fff1f2;
}

body input,
body select,
body textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 16px;
  line-height: 1.45;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

body textarea {
  min-height: 118px;
  line-height: 1.6;
}

body input::placeholder,
body textarea::placeholder {
  color: #94a3b8;
}

body button,
body .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

body button[type="button"],
body button[type="submit"],
body button[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  background-image: none;
  color: #ffffff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
}

body button.secondary,
body .button.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

body .google-button {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #1f2937;
}

body button.danger,
body .button.danger {
  background: var(--rose);
  color: #ffffff;
}

body button.blue,
body .button.blue {
  background: var(--blue);
  color: #ffffff;
}

body button.icon-button,
body .icon-button {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

body .checkbox-label input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

body .action-menu summary {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  background: #ffffff;
  color: #475569;
}

body .action-menu-panel button,
body .action-menu-panel .button {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
  padding-inline: 20px;
}

/* myClass dashboard theme */
body {
  background: #f8fafc;
}

.app-shell {
  grid-template-columns: 260px minmax(0, 1fr);
  background: #f8fafc;
}

.sidebar {
  gap: 24px;
  padding: 24px;
  border-right: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
  color: #334155;
  box-shadow: 12px 0 30px rgba(15, 23, 42, 0.03);
}

.brand {
  gap: 12px;
  padding: 0 4px 22px;
  border-bottom: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #0b63f6;
  color: #ffffff;
  font-size: 0;
  font-weight: 900;
  box-shadow: 0 16px 30px rgba(11, 99, 246, 0.18);
}

.brand-mark::before {
  content: "";
  width: 30px;
  height: 30px;
  background: url("data:image/svg+xml,%3Csvg width='34' height='34' viewBox='0 0 34 34' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 7.5C6 6.12 7.12 5 8.5 5H15.5C16.33 5 17 5.67 17 6.5V28C17 26.34 15.66 25 14 25H8.5C7.12 25 6 23.88 6 22.5V7.5Z' stroke='white' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M28 7.5C28 6.12 26.88 5 25.5 5H18.5C17.67 5 17 5.67 17 6.5V28C17 26.34 18.34 25 20 25H25.5C26.88 25 28 23.88 28 22.5V7.5Z' stroke='white' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M10 11H13M21 11H24M21 16H24' stroke='white' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.brand strong {
  color: #0b63f6;
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.brand small {
  color: #475569;
  font-size: 13px;
}

.main-nav {
  gap: 8px;
}

.main-nav a {
  min-height: 44px;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 10px;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
}

.main-nav a.active,
.main-nav a:hover {
  background: #eaf2ff;
  color: #0b63f6;
  transform: none;
}

.nav-dot {
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 8px;
  background: transparent;
  opacity: 0.8;
}

.main-nav a.active .nav-dot {
  background: #0b63f6;
  border-color: #0b63f6;
  box-shadow: 0 8px 18px rgba(11, 99, 246, 0.2);
}

.sidebar-account {
  gap: 8px;
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  color: #334155;
}

.sidebar-account strong {
  color: #0f172a;
}

.sidebar-account .text-link {
  color: #0b63f6;
}

.main-panel {
  padding: 0;
  background: #f8fafc;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 0.82fr);
  align-items: center;
  gap: 20px;
  margin-bottom: 0;
  padding: 24px;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.topbar-title h1 {
  font-size: clamp(24px, 2vw, 32px);
  font-weight: 500;
  line-height: 1.18;
}

.topbar-title .eyebrow {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.global-search {
  position: relative;
  flex: 1;
  max-width: 420px;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-weight: 400;
}

.global-search span {
  position: absolute;
  left: 15px;
  z-index: 1;
  font-size: 18px;
  line-height: 1;
}

body .global-search input {
  min-height: 44px;
  padding-left: 44px;
  border-color: #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  color: #64748b;
  cursor: default;
}

.notification-button {
  position: relative;
}

body .notification-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  border: 1px solid transparent;
  background: #ffffff;
  color: #475569;
}

.notification-button::before {
  content: "";
  width: 16px;
  height: 18px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 4px 4px;
}

.notification-button span {
  position: absolute;
  top: 5px;
  right: 6px;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.user-avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #0b63f6;
  font-size: 16px;
  font-weight: 600;
}

.user-chip strong,
.user-chip small {
  display: block;
  line-height: 1.25;
}

.user-chip strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
}

.user-chip small {
  color: #64748b;
  font-size: 12px;
}

.content-area {
  padding: 24px;
}

.panel,
.stat-card,
.assignment-item,
.login-card,
.table-wrap,
.summary-item,
.account-row,
.api-key-row {
  border-color: #dbe3ef;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.panel {
  padding: 24px;
}

.grid.stats {
  gap: 20px;
}

.stat-card {
  min-height: 118px;
  padding: 24px 22px 20px 86px;
  border-radius: 12px;
}

.stat-card::after {
  top: 24px;
  left: 22px;
  right: auto;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(11, 99, 246, 0.12), rgba(11, 99, 246, 0.05)),
    url("data:image/svg+xml,%3Csvg width='38' height='38' viewBox='0 0 38 38' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 25V17M19 25V12M27 25V15' stroke='%230B63F6' stroke-width='2.5' stroke-linecap='round'/%3E%3Cpath d='M9 28H29' stroke='%230B63F6' stroke-opacity='.55' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.stat-card strong {
  color: #0b63f6;
  font-size: 32px;
  font-weight: 600;
}

.stat-card span {
  color: #334155;
  font-size: 14px;
  font-weight: 500;
}

.table-wrap {
  border-radius: 14px;
}

table {
  min-width: 900px;
}

th,
td {
  padding: 14px 16px;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
}

td {
  color: #334155;
}

.feedback-cell {
  width: 260px;
  max-width: 260px;
}

.feedback-value {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-history-list {
  display: grid;
  gap: 12px;
}

.version-history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
}

.version-history-item p {
  margin: 8px 0 0;
}

@media (max-width: 640px) {
  .version-history-item {
    align-items: stretch;
    flex-direction: column;
  }

  .version-history-item > .button {
    width: 100%;
  }
}

.assignment-item {
  border-radius: 14px;
}

body button,
body .button,
body button[type="button"],
body button[type="submit"],
body button[type="reset"] {
  min-height: 40px;
  border-radius: 8px;
  background: #0b63f6;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 14px rgba(11, 99, 246, 0.12);
}

body button.secondary,
body .button.secondary,
body .google-button {
  background: #ffffff;
  color: #0b63f6;
  box-shadow: none;
}

body button.danger,
body .button.danger {
  background: #ef4444;
  box-shadow: 0 8px 18px rgba(239, 68, 68, 0.14);
}

body button.blue,
body .button.blue {
  background: #0b63f6;
}

.status.done,
.pill.done {
  background: #dcfce7;
  color: #15803d;
}

.status.pending {
  background: #ffedd5;
  color: #c2410c;
}

.status.missing {
  background: #fee2e2;
  color: #dc2626;
}

.status.open {
  background: #dbeafe;
  color: #0b63f6;
}

.pill {
  border-color: #dbe3ef;
  background: #f8fafc;
}

.modal {
  background: rgba(15, 23, 42, 0.28);
}

.modal-dialog {
  border-radius: 24px;
}

.modal-header {
  border-bottom-color: #dbe3ef;
}

.danger-zone {
  border-color: #fecaca;
  background: #fff1f2;
}

.login-page {
  padding: 0;
  background: #f8fbff;
}

.login-card {
  width: 100%;
  min-height: 100vh;
  grid-template-columns: minmax(460px, 1fr) minmax(420px, 0.78fr);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.login-visual {
  min-height: 100vh;
  align-content: center;
  padding: 64px 72px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(219, 234, 254, 0.55)),
    url("../img/myclass-pattern.svg");
  color: #0f172a;
}

.login-visual .eyebrow {
  color: #0b63f6;
}

.login-visual h1 {
  color: #0b63f6;
}

.login-form {
  align-content: center;
  margin: auto;
  width: min(640px, calc(100% - 64px));
  padding: 42px 44px;
  border: 1px solid #dbe3ef;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.10);
}

.teacher-empty-dashboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.teacher-class-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.class-switcher {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.class-switcher-label {
  color: #334155;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.class-select-card {
  position: relative;
  display: flex;
  width: min(520px, 54vw);
  min-width: 340px;
  min-height: 64px;
  align-items: center;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 11px 48px 11px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
}

.class-select-card::after {
  content: "v";
  position: absolute;
  right: 18px;
  color: #475569;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
}

.class-select-card select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.class-select-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: #0b63f6;
  box-shadow: 0 14px 24px rgba(11, 99, 246, 0.18);
}

.class-select-icon::before {
  content: "";
  width: 24px;
  height: 24px;
  background: url("data:image/svg+xml,%3Csvg width='28' height='28' viewBox='0 0 28 28' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 7.5C6 6.67 6.67 6 7.5 6H13.5C14.05 6 14.5 6.45 14.5 7V23C14.5 21.9 13.6 21 12.5 21H7.5C6.67 21 6 20.33 6 19.5V7.5Z' stroke='white' stroke-width='2'/%3E%3Cpath d='M22 7.5C22 6.67 21.33 6 20.5 6H14.5V23C14.5 21.9 15.4 21 16.5 21H20.5C21.33 21 22 20.33 22 19.5V7.5Z' stroke='white' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.class-select-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.class-select-copy strong,
.class-select-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.class-select-copy strong {
  color: #0f172a;
  font-size: 15px;
  font-weight: 600;
}

.class-select-copy small {
  color: #64748b;
  font-size: 13px;
}

.teacher-stat-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.stat-card-deadline small {
  display: block;
  margin-top: 8px;
  color: #64748b;
  font-weight: 400;
  line-height: 1.4;
}

.teacher-dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 20px;
  align-items: start;
}

.teacher-main-panel {
  min-width: 0;
}

.teacher-assignment-table table {
  min-width: 980px;
}

.assignment-name-cell {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.assignment-name-cell strong,
.assignment-name-cell small {
  display: block;
}

.assignment-name-cell small {
  margin-top: 3px;
  color: #64748b;
}

.assignment-file-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(11, 99, 246, 0.12), rgba(11, 99, 246, 0.06)),
    url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 3H14L19 8V21H7V3Z' stroke='%230B63F6' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M14 3V8H19' stroke='%230B63F6' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.compact-actions {
  flex-wrap: nowrap;
  gap: 8px;
}

.compact-actions .button {
  min-width: 92px;
  min-height: 38px;
  padding: 8px 14px;
}

.center-link {
  display: flex;
  width: fit-content;
  margin: 18px auto 0;
  color: #0b63f6;
  font-weight: 500;
  text-decoration: none;
}

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

.teacher-side-card {
  padding: 20px;
}

.side-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.side-card-head h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.side-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.side-metrics span {
  display: grid;
  gap: 2px;
  min-height: 64px;
  align-content: center;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
}

.side-metrics strong {
  color: #0b63f6;
  font-size: 20px;
}

.side-actions {
  display: grid;
}

.student-mini-list,
.recent-submission-list {
  display: grid;
  gap: 12px;
}

.student-mini-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eaf2ff;
  color: #0b63f6;
  font-weight: 500;
}

.student-mini-row strong,
.student-mini-row small,
.recent-submission-item strong,
.recent-submission-item span,
.recent-submission-item small {
  display: block;
}

.student-mini-row strong,
.recent-submission-item strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 500;
}

.student-mini-row small,
.recent-submission-item span {
  color: #64748b;
  font-size: 12px;
}

.recent-submission-item {
  padding: 13px 14px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.recent-submission-item small {
  margin-top: 6px;
  color: #0b63f6;
  font-size: 12px;
  font-weight: 500;
}

/* HTML reference tuning from gemini-code-1781595522346.html */
:root {
  --bg: #f7fafc;
  --surface: #ffffff;
  --surface-soft: #edf2f7;
  --ink: #2d3748;
  --muted: #718096;
  --line: #e2e8f0;
  --primary: #3182ce;
  --primary-strong: #2b6cb0;
  --blue: #3182ce;
  --shadow: none;
  --shadow-lift: 0 12px 28px rgba(45, 55, 72, 0.08);
}

body {
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.app-shell {
  grid-template-columns: 250px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
}

.brand {
  gap: 12px;
  padding: 0 0 32px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  box-shadow: none;
}

.brand-mark::before {
  width: 26px;
  height: 26px;
}

.brand strong {
  color: var(--primary);
  font-size: 20px;
  font-weight: 600;
}

.brand small {
  color: #4a5568;
  font-size: 12px;
  font-weight: 300;
}

.main-nav {
  gap: 16px;
}

.main-nav a {
  min-height: 42px;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.main-nav a.active,
.main-nav a:hover {
  background: #ebf8ff;
  color: var(--primary);
  font-weight: 500;
}

.nav-dot {
  width: 20px;
  height: 20px;
  border-color: currentColor;
  border-radius: 7px;
}

.main-nav a.active .nav-dot {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: none;
}

.sidebar-account {
  padding: 20px;
  border: 1px solid #bee3f8;
  border-radius: 12px;
  background: #edf2f7;
}

.sidebar-account strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.sidebar-account .text-link {
  color: var(--primary);
}

.topbar {
  position: static;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 24px;
  padding: 24px 24px 0;
  border-bottom: 0;
  background: var(--bg);
  backdrop-filter: none;
}

.topbar-title h1 {
  color: #1a202c;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.topbar-title .eyebrow {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.topbar-actions {
  gap: 16px;
}

.global-search {
  max-width: 360px;
  min-width: 280px;
}

body .global-search input {
  min-height: 42px;
  padding: 10px 16px 10px 40px;
  border-color: var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 14px;
}

.global-search span {
  left: 14px;
  color: var(--muted);
  font-size: 16px;
}

body .notification-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.user-chip {
  gap: 12px;
  min-width: 0;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: #e2e8f0;
  color: var(--muted);
  font-size: 14px;
}

.user-chip strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.user-chip small {
  color: var(--muted);
  font-size: 12px;
}

.content-area {
  padding: 24px;
}

.panel,
.stat-card,
.assignment-item,
.login-card,
.table-wrap,
.summary-item,
.account-row,
.api-key-row,
.teacher-side-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}

.panel {
  padding: 24px;
}

.grid.stats {
  gap: 20px;
}

.stat-card {
  min-height: 116px;
  padding: 24px 20px 20px 86px;
  border-radius: 12px;
}

.stat-card::after {
  top: 24px;
  left: 24px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background-color: #ebf8ff;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.stat-card strong {
  color: var(--primary);
  font-size: 32px;
  font-weight: 600;
}

th,
td {
  padding: 16px;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 500;
}

body input,
body select,
body textarea {
  min-height: 42px;
  padding: 10px 16px;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
}

body button,
body .button,
body button[type="button"],
body button[type="submit"],
body button[type="reset"] {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

body button.secondary,
body .button.secondary,
body .google-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary);
}

.teacher-class-bar {
  align-items: center;
  gap: 20px;
}

.class-switcher-label {
  color: var(--ink);
  font-size: 16px;
  font-weight: 500;
}

.class-select-card {
  width: min(520px, 54vw);
  min-height: 64px;
  padding: 11px 48px 11px 14px;
  border-color: var(--line);
  border-radius: 12px;
  box-shadow: none;
}

.class-select-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  box-shadow: none;
}

.class-select-copy strong {
  color: #1a202c;
  font-size: 15px;
  font-weight: 600;
}

.class-select-copy small {
  color: var(--muted);
  font-size: 13px;
}

.teacher-dashboard-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
}

.teacher-assignment-table table {
  min-width: 880px;
}

.assignment-name-cell strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.assignment-name-cell small {
  color: var(--muted);
  font-size: 12px;
}

.assignment-file-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.compact-actions .button {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

.side-card-head h2 {
  color: #1a202c;
  font-size: 16px;
  font-weight: 500;
}

.side-metrics span {
  min-height: 64px;
  border-color: var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.side-metrics strong {
  color: var(--primary);
  font-size: 20px;
  font-weight: 600;
}

.recent-submission-item {
  border-color: #bee3f8;
  border-radius: 8px;
  background: #ebf8ff;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 24px;
  }

  .topbar-actions {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .global-search {
    max-width: none;
    min-width: 100%;
  }

  .content-area {
    padding: 24px;
  }

  .teacher-class-bar,
  .class-switcher,
  .teacher-empty-dashboard {
    align-items: stretch;
    flex-direction: column;
  }

  .class-select-card {
    width: 100%;
    min-width: 0;
  }

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

  .teacher-dashboard-layout {
    grid-template-columns: 1fr;
  }

  .grid.two,
  .grid.stats,
  .login-card {
    grid-template-columns: 1fr;
  }

  .account-row,
  .api-key-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-visual {
    min-height: 320px;
  }
}

@media (min-width: 981px) {
  .grid.stats .stat-card:first-child:nth-last-child(n + 4) {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .login-form,
  .login-visual {
    padding: 18px;
  }

  .main-panel {
    padding: 0;
  }

  .topbar,
  .content-area {
    padding: 18px;
  }

  .topbar-actions {
    gap: 12px;
  }

  .user-chip {
    min-width: 0;
  }

  .user-chip strong,
  .user-chip small {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar,
  .assignment-head {
    display: grid;
  }

  .grid.stats.teacher-stat-grid {
    grid-template-columns: 1fr;
  }

  .side-metrics {
    grid-template-columns: 1fr;
  }

  .compact-actions {
    flex-wrap: wrap;
  }

  .toolbar,
  .row-actions,
  .account-actions,
  .confirm-dialog .confirm-actions {
    align-items: stretch;
  }

  .toolbar > *,
  .row-actions > *,
  .account-actions > *,
  .confirm-dialog .confirm-actions > * {
    width: 100%;
  }

  .row-actions > .action-menu,
  .row-actions > .status,
  .row-actions > .icon-button {
    width: auto;
    min-width: auto;
  }

  .row-actions > .action-menu {
    align-self: flex-start;
  }

  .toolbar > label.field-wide + .button,
  .toolbar > label.field-wide + button {
    align-self: stretch;
  }

  body .button,
  body button {
    min-height: 40px;
    padding-inline: 16px;
  }

  .form-grid.two,
  .account-row,
  .api-key-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 30px;
  }
}

/* ── Exercise Creator (ex- prefix) ── */
.ex-workspace { display: flex; flex-direction: column; gap: var(--spacing-5); }

.ex-header-card {
  padding: var(--spacing-5); border: 1px solid var(--ui-line); border-radius: 16px;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.ex-header-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--spacing-3); margin-bottom: var(--spacing-4); }
.ex-header-title { display: flex; align-items: center; gap: var(--spacing-2); color: var(--ui-primary); }
.ex-header-title h2 { margin: 0; font-size: 1.25rem; }
.ex-header-tools { display: flex; gap: var(--spacing-2); flex-wrap: wrap; }
.ex-header-form { display: flex; flex-direction: column; gap: var(--spacing-3); }
.ex-form-title-row { display: grid; grid-template-columns: 1fr auto; gap: var(--spacing-3); }
.ex-score-label { min-width: 120px; }
.ex-score-label input { text-align: center; font-weight: 600; color: var(--ui-primary); background: var(--ui-surface); }

.ex-label { display: block; font-size: .875rem; font-weight: 600; color: var(--ui-text); margin-bottom: .25rem; }
.ex-label input, .ex-label textarea { display: block; width: 100%; padding: .5rem .75rem; border: 1px solid var(--ui-line); border-radius: 8px; font-size: .875rem; }

.ex-questions-section { display: flex; flex-direction: column; gap: var(--spacing-3); }
.ex-section-title { display: flex; align-items: center; gap: var(--spacing-2); font-size: 1.1rem; margin: 0; }
.ex-questions-list { display: flex; flex-direction: column; gap: var(--spacing-3); }

.ex-question-card {
  padding: var(--spacing-4); border: 1px solid var(--ui-line); border-radius: 12px;
  background: #fff; transition: border-color .2s;
}
.ex-question-card:hover { border-color: var(--ui-border-hover, #cbd5e1); }
.ex-question-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--spacing-3); margin-bottom: .5rem; }
.ex-question-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--spacing-2); }
.ex-question-num { font-size: .75rem; font-weight: 700; color: var(--ui-muted); text-transform: uppercase; }
.ex-type-badge { display: inline-flex; align-items: center; gap: .25rem; padding: .25rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.ex-score-badge { font-size: .75rem; font-weight: 500; padding: .25rem .5rem; border-radius: 6px; background: var(--ui-surface); color: var(--ui-muted); }
.ex-question-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.ex-icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--ui-line); border-radius: 8px; background: #fff; cursor: pointer; color: var(--ui-muted); transition: all .15s; }
.ex-icon-btn:hover { color: var(--ui-primary); border-color: var(--ui-primary); }
.ex-icon-btn.ex-danger:hover { color: #dc2626; border-color: #dc2626; }
.ex-question-text { margin: .5rem 0; font-size: 1rem; line-height: 1.5; }
.ex-question-image { display: flex; justify-content: center; margin: .5rem 0; }
.ex-question-image img { max-height: 160px; max-width: 100%; border-radius: 8px; border: 1px solid var(--ui-line); }
.ex-question-link { display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; color: var(--ui-primary); background: rgba(29,115,201,.08); padding: .25rem .5rem; border-radius: 6px; margin-top: .25rem; }
.ex-question-link a { color: inherit; font-weight: 600; text-decoration: underline; }

.ex-answers-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-top: .5rem; }
.ex-option { font-size: .75rem; padding: .375rem .625rem; border-radius: 8px; border: 1px solid var(--ui-line); background: var(--ui-surface); color: var(--ui-muted); }
.ex-option.ex-correct { background: rgba(29,115,201,.08); border-color: rgba(29,115,201,.3); color: var(--ui-primary); font-weight: 600; }
.ex-tf-row { display: flex; gap: .5rem; margin-top: .5rem; }
.ex-tf-pill { font-size: .75rem; padding: .375rem .625rem; border-radius: 8px; border: 1px solid var(--ui-line); background: var(--ui-surface); color: var(--ui-muted); }
.ex-tf-pill.ex-correct { background: rgba(29,115,201,.08); border-color: rgba(29,115,201,.3); color: var(--ui-primary); font-weight: 600; }
.ex-text-answer { font-size: .75rem; padding: .5rem; border-radius: 8px; border: 1px solid var(--ui-line); background: var(--ui-surface); margin-top: .5rem; }
.ex-correct-text { color: var(--ui-primary); font-weight: 600; }
.ex-matching-list { display: flex; flex-direction: column; gap: .375rem; margin-top: .5rem; }
.ex-match-pair { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .75rem; padding: .375rem .625rem; border-radius: 8px; border: 1px solid var(--ui-line); background: var(--ui-surface); }
.ex-hint { display: flex; align-items: flex-start; gap: .375rem; font-size: .75rem; padding: .5rem; border-radius: 8px; background: rgba(245,158,11,.08); color: #92400e; margin-top: .5rem; }

.ex-empty-state { text-align: center; padding: var(--spacing-6); border: 2px dashed var(--ui-line); border-radius: 12px; color: var(--ui-muted); }
.ex-empty-state i { font-size: 2rem; margin-bottom: .5rem; display: block; }
.ex-empty-state h4 { margin: 0 0 .25rem; font-size: 1rem; color: var(--ui-text); }
.ex-empty-state p { margin: 0; font-size: .875rem; }

.ex-creator-panel {
  padding: var(--spacing-5); border-radius: 16px;
  background: linear-gradient(135deg, #1e3a8a, #1e1b4b); color: #fff;
}
.ex-creator-panel-title { display: flex; align-items: center; gap: .5rem; font-size: 1rem; font-weight: 600; margin-bottom: .25rem; }
.ex-creator-panel-hint { font-size: .75rem; color: rgba(255,255,255,.7); margin: 0 0 var(--spacing-3); }
.ex-type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .625rem; }
.ex-type-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .375rem;
  padding: .875rem .5rem; border: 1px solid rgba(255,255,255,.2); border-radius: 10px;
  background: rgba(255,255,255,.1); color: #fff; cursor: pointer; transition: background .15s; font-size: .75rem; font-weight: 600;
}
.ex-type-btn:hover { background: rgba(255,255,255,.2); }
.ex-type-btn i { font-size: 1.25rem; }

@media (max-width: 640px) {
  .ex-form-title-row { grid-template-columns: 1fr; }
  .ex-answers-grid { grid-template-columns: 1fr; }
  .ex-type-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Exercise Modal */
.ex-modal .modal-dialog { max-width: 560px; }
.ex-modal-header { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-4) var(--spacing-5); color: #fff; border-radius: 16px 16px 0 0; }
.ex-modal-header-left { display: flex; align-items: center; gap: .5rem; }
.ex-modal-header h2 { margin: 0; font-size: 1.1rem; color: #fff; }
.ex-modal-header .icon-button { color: #fff; background: rgba(255,255,255,.15); }
.ex-modal-header .icon-button:hover { background: rgba(255,255,255,.25); }

.ex-image-section, .ex-link-section { padding: var(--spacing-3); border: 1px solid var(--ui-line); border-radius: 10px; background: var(--ui-surface); }
.ex-image-section { margin-bottom: var(--spacing-3); }
.ex-image-section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.ex-image-actions { display: flex; gap: .5rem; }
.ex-image-preview-container { margin-top: .5rem; border-radius: 10px; overflow: hidden; border: 1px solid var(--ui-line); max-height: 12rem; display: flex; justify-content: center; background: rgba(0,0,0,.03); }
.ex-image-preview-container img { max-height: 12rem; width: 100%; object-fit: contain; }
.ex-upload-status { font-size: .75rem; }
.ex-upload-status.processing { color: #d97706; font-weight: 600; }
.ex-upload-status.success { color: #059669; font-weight: 600; }
.ex-danger-btn { color: #dc2626; }

.ex-link-section { margin-bottom: var(--spacing-3); }
.ex-link-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ex-link-row input { padding: .5rem .625rem; border: 1px solid var(--ui-line); border-radius: 8px; font-size: .75rem; }

.ex-form-section { margin-bottom: var(--spacing-3); }
.ex-choice-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .375rem; }
.ex-choice-row input[type="radio"] { width: 1rem; height: 1rem; accent-color: var(--ui-primary); }
.ex-choice-row input[type="text"] { flex: 1; padding: .375rem .625rem; border: 1px solid var(--ui-line); border-radius: 8px; font-size: .75rem; }
.ex-tf-options { display: flex; gap: .625rem; }
.ex-tf-option { flex: 1; display: flex; align-items: center; justify-content: center; gap: .375rem; padding: .625rem; border: 1px solid var(--ui-line); border-radius: 8px; cursor: pointer; background: var(--ui-surface); font-size: .875rem; font-weight: 600; }
.ex-tf-option:hover { background: rgba(0,0,0,.03); }
.ex-match-row { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .375rem; }
.ex-match-row input { padding: .375rem .625rem; border: 1px solid var(--ui-line); border-radius: 8px; font-size: .75rem; }
.ex-help { display: block; font-size: .75rem; color: var(--ui-muted); margin-top: .25rem; }

.ex-score-hint-row { display: grid; grid-template-columns: auto 1fr; gap: var(--spacing-3); margin-bottom: var(--spacing-3); }
.ex-score-hint-row .ex-label input { width: 100%; }

@media (max-width: 640px) {
  .ex-link-row { grid-template-columns: 1fr; }
  .ex-match-row { grid-template-columns: 1fr; }
  .ex-score-hint-row { grid-template-columns: 1fr; }
}
