:root {
  --ink: #17213a;
  --muted: #68738c;
  --paper: #f7f9ff;
  --card: #ffffff;
  --navy: #164da8;
  --navy-2: #1769e0;
  --teal: #1769e0;
  --gold: #f9a8d4;
  --rose: #ec4899;
  --pink-deep: #d93686;
  --pink-soft: #fff0f7;
  --blue-soft: #edf5ff;
  --line: #dce6f5;
  --soft: #eef4ff;
  --success: #23855a;
  --warning: #a56518;
  --danger: #c13c68;
  --shadow: 0 16px 42px rgba(23, 105, 224, 0.12);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 3%, rgba(23, 105, 224, 0.13), transparent 28rem),
    radial-gradient(circle at 94% 8%, rgba(236, 72, 153, 0.12), transparent 26rem),
    linear-gradient(180deg, #ffffff 0%, var(--paper) 100%);
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
a { color: var(--navy-2); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
  padding: 0.75rem clamp(1rem, 4vw, 3rem);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(23, 105, 224, 0.13);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 0;
  background: transparent;
  color: var(--navy);
  text-align: left;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--navy-2), #4f8cf2 68%, var(--rose));
  border-radius: 14px;
  font-family: Georgia, serif;
  font-size: 1.45rem;
  box-shadow: 0 9px 24px rgba(23, 105, 224, 0.25);
}
.brand-copy { display: grid; align-items: center; }
.brand strong { display: block; font-size: 0.82rem; letter-spacing: 0.14em; font-weight: 900; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; justify-content: flex-end; }

.app-shell { width: min(1280px, 100%); margin: 0 auto; padding: clamp(1.2rem, 4vw, 3.2rem); }
.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: clamp(1.3rem, 4vw, 3rem);
  align-items: center;
  min-height: calc(100vh - 150px);
  position: relative;
}
.hero-copy h1, .page-heading h1 {
  margin: 0 0 1rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--navy);
  line-height: 1.08;
}
.hero-copy h1 {
  font-size: clamp(2.75rem, 6.5vw, 5.65rem);
  max-width: 10ch;
  letter-spacing: -0.055em;
  font-weight: 950;
  background: linear-gradient(105deg, var(--navy) 0%, var(--navy-2) 55%, var(--rose) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-copy p { max-width: 62ch; color: var(--muted); line-height: 1.7; }
.hero-subtitle {
  margin: -0.15rem 0 0.75rem;
  color: var(--pink-deep) !important;
  font-size: clamp(1.18rem, 2vw, 1.55rem) !important;
  font-weight: 850;
  letter-spacing: -0.015em;
}
.hero-description { margin: 0; font-size: clamp(1rem, 1.7vw, 1.13rem); }
.eyebrow { margin: 0 0 0.8rem; color: var(--rose); text-transform: uppercase; font-weight: 900; letter-spacing: 0.16em; font-size: 0.76rem; }
.hero-process { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; margin-top: 1.2rem; }
.hero-process span { padding: 0.42rem 0.72rem; border-radius: 999px; background: var(--blue-soft); color: var(--navy); font-size: 0.78rem; font-weight: 850; }
.hero-process span:nth-of-type(even) { background: var(--pink-soft); color: var(--pink-deep); }
.hero-process i { color: var(--rose); font-style: normal; font-weight: 900; }
.hero-panel, .card, .panel, .assignment-card, .status-card, .feedback-card {
  background: var(--card);
  border: 1px solid rgba(23, 105, 224, 0.11);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-panel { padding: clamp(1.1rem, 3vw, 2rem); }
.action-stack { display: grid; gap: 0.85rem; }
.action-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, #ffffff, #fbfdff);
  text-align: left;
  transition: 160ms ease;
}
.action-card:hover { transform: translateY(-3px); border-color: var(--rose); box-shadow: 0 10px 26px rgba(236,72,153,.12); }
.action-card:nth-child(odd) .action-icon { background: var(--blue-soft); color: var(--navy-2); }
.action-card:nth-child(even) .action-icon { background: var(--pink-soft); color: var(--pink-deep); }
.action-icon { width: 46px; height: 46px; display: grid; place-items: center; background: var(--soft); border-radius: 14px; font-size: 1.35rem; }
.action-card strong { display: block; color: var(--navy); margin-bottom: 0.25rem; }
.action-card small { color: var(--muted); line-height: 1.4; }
.action-arrow { color: var(--rose); font-size: 1.2rem; }

.page-heading { margin-bottom: 1.6rem; }
.page-heading h1 { font-size: clamp(2rem, 4vw, 3.4rem); }
.page-heading p { color: var(--muted); max-width: 70ch; line-height: 1.65; }
.toolbar { display: flex; gap: 0.7rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 1rem 0 1.5rem; }
.toolbar-group { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.assignments-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.assignment-card { overflow: hidden; display: flex; flex-direction: column; }
.assignment-thumb { aspect-ratio: 16 / 9; object-fit: contain; background: #f8fafb; width: 100%; border-bottom: 1px solid var(--line); }
.assignment-body { padding: 1.15rem; display: grid; gap: 0.75rem; flex: 1; }
.assignment-body h3 { margin: 0; color: var(--navy); font-family: Georgia, serif; font-size: 1.3rem; }
.assignment-body p { margin: 0; color: var(--muted); line-height: 1.55; }
.meta-row { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.pill, .badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: var(--soft);
  color: var(--navy);
  font-weight: 700;
  font-size: 0.76rem;
}
.badge.published, .badge.completed, .badge.feedback_available { background: #e6f5ed; color: var(--success); }
.badge.draft, .badge.awaiting_feedback { background: #fff3d9; color: var(--warning); }
.badge.closed, .badge.archived { background: #edf0f2; color: #5b6670; }
.badge.feedback_in_progress { background: #e7effb; color: #285a92; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 800;
  transition: 150ms ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--navy), var(--navy-2)); box-shadow: 0 7px 18px rgba(23,105,224,.16); }
.btn-secondary { color: var(--navy); background: #fff; border-color: var(--line); }
.btn-teal { color: #fff; background: linear-gradient(135deg, var(--rose), var(--pink-deep)); box-shadow: 0 7px 18px rgba(236,72,153,.16); }
.btn-gold { color: #8e2b61; background: var(--pink-soft); border-color: #f7bfda; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-ghost { background: transparent; color: var(--navy); border-color: transparent; }
.btn-small { min-height: 34px; padding: 0.42rem 0.7rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.panel, .card, .feedback-card, .status-card { padding: clamp(1rem, 3vw, 1.6rem); }
.panel h2, .panel h3, .card h2, .card h3, .feedback-card h3 { color: var(--navy); margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.field { display: grid; gap: 0.42rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 800; color: var(--navy); font-size: 0.92rem; }
.field small, .help { color: var(--muted); line-height: 1.45; }
input, textarea, select {
  width: 100%;
  border: 1px solid #cfd7de;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  padding: 0.75rem 0.85rem;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(23,105,224,.13); }
textarea { min-height: 130px; resize: vertical; line-height: 1.6; }
textarea.editor { min-height: 520px; font-family: Georgia, serif; font-size: 1.08rem; }
textarea.code-editor { min-height: 360px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem; }
.input-row { display: flex; gap: 0.6rem; align-items: center; }
.input-row > * { flex: 1; }

.writing-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.sticky-panel { position: sticky; top: 92px; }
.prompt-text { line-height: 1.65; white-space: pre-wrap; }
.chart-frame { padding: 0.7rem; border: 1px solid var(--line); border-radius: 14px; background: #fff; margin: 1rem 0; }
.editor-meta { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; color: var(--muted); font-size: 0.88rem; }
.word-count { font-weight: 800; color: var(--navy); }
.notice { padding: 0.85rem 1rem; border-radius: 12px; background: var(--blue-soft); color: #174f9f; border: 1px solid #cfe0fb; line-height: 1.5; }
.notice.warning { background: #fff6e3; color: #77531e; border-color: #efd7a7; }
.notice.danger { background: #fff0f1; color: #843740; border-color: #efc9cd; }

.tabs { display: flex; gap: 0.35rem; padding: 0.35rem; background: #e9eef1; border-radius: 13px; width: fit-content; flex-wrap: wrap; }
.tab { border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 0.65rem 0.95rem; font-weight: 800; }
.tab.active { background: #fff; color: var(--navy); box-shadow: 0 3px 12px rgba(23,50,77,.1); }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 0.85rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--navy); background: #f5f7f8; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:last-child td { border-bottom: 0; }

.route-card { border: 1px solid var(--line); border-radius: 15px; padding: 1rem; background: #fbfcfc; }
.route-card + .route-card { margin-top: 0.9rem; }
.route-head { display: flex; justify-content: space-between; gap: 0.7rem; align-items: center; margin-bottom: 0.75rem; }
.route-head h4 { margin: 0; color: var(--navy); }
.builder-section { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px dashed #cbd4da; }
.builder-section > h3 { margin-bottom: 0.8rem; }

.feedback-steps { display: grid; gap: 1rem; }
.step-header { display: flex; align-items: flex-start; gap: 0.8rem; }
.step-number { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 900; }
.feedback-card.locked { opacity: 0.55; pointer-events: none; }
.choice-list { display: grid; gap: 0.55rem; }
.choice { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.75rem; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.choice input { width: auto; margin-top: 0.2rem; }
.reveal { margin-top: 0.8rem; padding: 0.85rem; background: linear-gradient(90deg, var(--blue-soft), #fff8fc); border-left: 4px solid var(--rose); border-radius: 0 10px 10px 0; line-height: 1.55; }
.sentence-box { font-family: Georgia, serif; font-size: 1.07rem; line-height: 1.6; padding: 1rem; background: #fbfdff; border-radius: 12px; border: 1px solid #dce8f8; }
.sample-paragraph { padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.sample-paragraph + .sample-paragraph { margin-top: 0.8rem; }
.sample-paragraph h4 { margin: 0 0 0.5rem; color: var(--navy); }
.typing-status { font-weight: 800; }
.typing-status.ok { color: var(--success); }
.typing-status.bad { color: var(--danger); }

.code-box { padding: 1rem; border-radius: 14px; background: var(--navy); color: #fff; text-align: center; }
.code-box strong { display: block; font-size: clamp(1.6rem, 5vw, 2.6rem); letter-spacing: 0.08em; margin: 0.3rem 0; }
.status-timeline { display: grid; gap: 0.7rem; margin-top: 1rem; }
.timeline-item { display: flex; gap: 0.7rem; align-items: center; color: var(--muted); }
.timeline-dot { width: 14px; height: 14px; border-radius: 50%; background: #cbd5dc; }
.timeline-item.done { color: var(--success); font-weight: 700; }
.timeline-item.done .timeline-dot { background: var(--success); }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.loading { display: grid; place-items: center; min-height: 260px; color: var(--muted); }
.spinner { width: 36px; height: 36px; border: 4px solid #dce6f5; border-top-color: var(--rose); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 0.8rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 80; max-width: min(420px, calc(100vw - 2rem)); padding: 0.9rem 1rem; border-radius: 12px; color: #fff; background: var(--navy); box-shadow: var(--shadow); opacity: 0; transform: translateY(16px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

pre.json-preview { white-space: pre-wrap; word-break: break-word; background: #162637; color: #dcecf4; padding: 1rem; border-radius: 12px; max-height: 520px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.3rem 0; }
.hidden { display: none !important; }

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--navy-2), var(--rose), var(--navy-2));
  opacity: .72;
}
.hero-panel { position: relative; overflow: hidden; }
.hero-panel::before {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -55px;
  top: -55px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(236,72,153,.14), transparent 68%);
  pointer-events: none;
}
.pill { background: var(--blue-soft); color: var(--navy); }
.assignment-card:nth-child(even) .pill { background: var(--pink-soft); color: var(--pink-deep); }
.step-number { background: linear-gradient(145deg, var(--navy-2), var(--rose)); }
.code-box { background: linear-gradient(135deg, var(--navy), var(--navy-2) 65%, var(--pink-deep)); }

@media (max-width: 900px) {
  .hero, .writing-layout, .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .sticky-panel { position: static; }
  textarea.editor { min-height: 430px; }
  .field.full { grid-column: auto; }
}

@media (max-width: 600px) {
  .topbar { align-items: flex-start; }
  .app-shell { padding: 1rem; }
  .hero-copy h1 { font-size: 2.65rem; }
  .action-card { grid-template-columns: auto 1fr; }
  .action-arrow { display: none; }
  .btn { width: 100%; }
  .toolbar-group { width: 100%; }
  .toolbar-group .btn { flex: 1; }
  .top-actions .btn { width: auto; }
}

@media print {
  .topbar, .no-print, .toast, button, input[type="button"] { display: none !important; }
  body { background: #fff; }
  .app-shell { width: 100%; max-width: none; padding: 0; }
  .card, .panel, .feedback-card, .status-card { box-shadow: none; break-inside: avoid; }
}

.badge.submitted_for_review { background: #fff0d9; color: #8a5a14; }
.badge.accepted { background: #e2f4ea; color: #1f6b43; }
.status-check { color: var(--success); font-weight: 800; font-size: .82rem; }
.status-wait { color: var(--muted); font-size: .82rem; }
.status-review { color: var(--warning); font-weight: 800; font-size: .82rem; }

.saved-submissions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.saved-submission-card {
  display: grid;
  gap: .3rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.saved-submission-card:hover { border-color: var(--rose); box-shadow: 0 7px 18px rgba(236,72,153,.12); }
.saved-submission-card strong { color: var(--navy); }
.saved-submission-card span { color: var(--muted); font-size: .82rem; }

.submission-folders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}
.submission-folder {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .2rem .65rem;
  align-items: center;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}
.submission-folder > span { grid-row: 1 / 3; font-size: 1.35rem; }
.submission-folder strong { color: var(--navy); line-height: 1.25; }
.submission-folder small { color: var(--muted); }
.submission-folder.active { border-color: var(--rose); background: linear-gradient(135deg, var(--blue-soft), var(--pink-soft)); box-shadow: 0 7px 18px rgba(236,72,153,.12); }

.workflow-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}
.workflow-summary > div {
  display: grid;
  gap: .25rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.workflow-summary small { color: var(--muted); }
.workflow-summary strong { color: var(--navy); }

@media (max-width: 900px) {
  .workflow-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* V2 Assignment Builder */
.assignment-type-card { position: relative; overflow: hidden; }
.assignment-type-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  right: -60px;
  bottom: -70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(236,72,153,.13), transparent 68%);
  pointer-events: none;
}
.type-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  margin-bottom: .8rem;
  font-size: 1.65rem;
  background: linear-gradient(145deg, var(--blue-soft), var(--pink-soft));
}
.builder-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .9rem 1rem;
  margin: -.3rem 0 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue-soft), #fff 55%, var(--pink-soft));
}
.builder-toolbar > div:first-child { display: grid; gap: .2rem; }
.builder-toolbar strong { color: var(--navy); }
.builder-toolbar small { color: var(--muted); }
.import-box {
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px dashed var(--rose);
  border-radius: 14px;
  background: var(--pink-soft);
}
.data-table-editor {
  min-height: 210px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}
.route-card, .mini-task-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 1rem;
  margin-top: 1rem;
  box-shadow: 0 8px 24px rgba(23,105,224,.06);
}
.route-card.task2-plan { border-top: 4px solid var(--rose); }
.route-card:not(.task2-plan) { border-top: 4px solid var(--navy-2); }
.route-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.route-head h4 { margin: .15rem 0 0; color: var(--navy); }
.route-kicker {
  color: var(--rose);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .12em;
}
.argument-map-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.argument-map-card {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--blue-soft));
}
.argument-map-card:nth-child(2) { background: linear-gradient(180deg, #fff, var(--pink-soft)); }
.argument-map-card h5 { margin: 0 0 .8rem; color: var(--navy); font-size: 1rem; }
.argument-map-card .field + .field { margin-top: .75rem; }
.sample-builder {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.sample-builder h5 { color: var(--navy); margin: 0 0 .8rem; }
.sample-builder-row {
  display: grid;
  grid-template-columns: 115px minmax(0, 1.5fr) minmax(0, .75fr) minmax(0, .75fr);
  gap: .75rem;
  align-items: start;
  padding: .8rem 0;
  border-top: 1px dashed var(--line);
}
.sample-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: .5rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--navy-2), var(--rose));
  color: #fff;
  font-weight: 850;
  text-align: center;
}
.sample-builder-row textarea { min-height: 120px; }
.mini-task-card { background: linear-gradient(180deg, #fff, #fbfdff); }

@media (max-width: 1050px) {
  .sample-builder-row { grid-template-columns: 100px 1fr; }
  .sample-builder-row .field:nth-of-type(2),
  .sample-builder-row .field:nth-of-type(3) { grid-column: 2; }
}

@media (max-width: 800px) {
  .argument-map-grid { grid-template-columns: 1fr; }
  .builder-toolbar { align-items: flex-start; flex-direction: column; }
  .sample-builder-row { grid-template-columns: 1fr; }
  .sample-builder-row .field:nth-of-type(2),
  .sample-builder-row .field:nth-of-type(3) { grid-column: auto; }
  .sample-label { justify-self: start; }
}

/* V2.1 ZIP-first assignment importer */
.zip-import-layout { align-items: stretch; }
.zip-drop-panel { display: flex; flex-direction: column; }
.zip-drop-zone {
  min-height: 220px;
  margin-top: 1rem;
  border: 2px dashed var(--navy-2);
  border-radius: 20px;
  background: linear-gradient(145deg, var(--blue-soft), #fff 58%, var(--pink-soft));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: 1.4rem;
  text-align: center;
  cursor: pointer;
  transition: .2s ease;
}
.zip-drop-zone:hover,
.zip-drop-zone.dragging {
  transform: translateY(-2px);
  border-color: var(--rose);
  box-shadow: 0 16px 36px rgba(23,105,224,.12);
}
.zip-drop-zone strong { color: var(--navy); font-size: 1.05rem; }
.zip-drop-zone span { color: var(--rose); font-weight: 800; word-break: break-word; }
.zip-drop-zone small { color: var(--muted); }
.package-checklist { display: grid; gap: .8rem; margin-top: 1rem; }
.package-checklist > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: .8rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.package-checklist strong { color: var(--navy); }
.package-checklist span { color: var(--muted); line-height: 1.55; }
.import-summary-card { max-width: 980px; margin-inline: auto; }
@media (max-width: 700px) {
  .package-checklist > div { grid-template-columns: 1fr; }
}

/* V2.2 – ZIP-first assignment creation */
.assignment-toolbar {
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(23, 105, 224, .16);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(23,105,224,.07), rgba(240,81,146,.08));
}
.assignment-toolbar small { color: var(--muted); }
.zip-primary-notice {
  margin-bottom: 1rem;
  border-left: 5px solid var(--pink, #f05192);
  background: linear-gradient(90deg, rgba(240,81,146,.09), rgba(23,105,224,.06));
}
.btn-zip-import {
  min-height: 52px;
  font-size: 1rem;
  box-shadow: 0 12px 28px rgba(23,105,224,.2);
}
.zip-drop-zone {
  min-height: 220px;
}
@media (max-width: 720px) {
  .assignment-toolbar { align-items: stretch; }
  .assignment-toolbar .toolbar-group { width: 100%; }
  .assignment-toolbar .toolbar-group .btn { flex: 1 1 100%; }
}

/* V2.3 detailed sentence-by-sentence feedback */
.assessment-block{margin-top:1.4rem;padding-top:1.1rem;border-top:1px solid var(--border)}
.assessment-heading,.criterion-top,.sentence-navigator,.sentence-stage-header,.sentence-workspace-actions{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.criterion-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;margin-top:1rem}
.criterion-card,.paragraph-analysis-card,.argument-map-card{border:1px solid var(--border);border-radius:18px;padding:1rem;background:linear-gradient(145deg,#fff,#f8fbff)}
.criterion-top strong{color:var(--blue-700)}
.criterion-top span{font-weight:800;color:var(--pink-700);font-size:1.1rem}
.evidence-list blockquote{margin:.55rem 0;padding:.7rem .85rem;border-left:4px solid var(--pink-400);background:#fff5fa;border-radius:0 12px 12px 0;font-style:italic}
.next-step{margin-top:.75rem;padding:.75rem .9rem;border-radius:12px;background:#edf6ff;border:1px solid #cae3ff}
.analysis-details{margin-top:1rem;border:1px solid var(--border);border-radius:16px;background:#fff;overflow:hidden}
.analysis-details>summary{cursor:pointer;padding:1rem;font-weight:800;color:var(--blue-700);background:linear-gradient(90deg,#eef7ff,#fff1f7)}
.paragraph-analysis-list,.argument-map-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem;padding:1rem}
.table-wrap{overflow:auto;padding:1rem}
.data-table{width:100%;border-collapse:collapse}
.data-table th,.data-table td{padding:.75rem;border:1px solid var(--border);vertical-align:top;text-align:left}
.data-table th{background:#eef7ff;color:var(--blue-700)}
.bad-example{color:#a22b57;margin-bottom:.35rem}
.sentence-workspace{margin-top:1rem;border:1px solid #cfe3f7;border-radius:20px;padding:1.1rem;background:linear-gradient(145deg,#f8fcff,#fff7fb)}
.sentence-navigator>div{display:flex;flex-direction:column;gap:.25rem}
.sentence-navigator select{min-width:min(100%,520px);max-width:100%;padding:.75rem;border:1px solid var(--border);border-radius:12px;background:white}
.sentence-stage-header{margin:1rem 0 .75rem}
.sentence-progress-mini{font-weight:700;color:var(--pink-700)}
.token-instruction{margin:.75rem 0;padding:.7rem .85rem;border-radius:12px;background:#eef7ff;color:#31526f}
.interactive-token-area{font-size:1.15rem;line-height:2.25;padding:1rem;border-radius:16px;background:#fff;border:1px solid var(--border);min-height:90px}
.feedback-token{display:inline;border:0;background:transparent;padding:.12rem .18rem;border-radius:6px;font:inherit;color:inherit;cursor:pointer}
.feedback-token:hover{background:#eaf4ff}
.feedback-token.selected{background:#dceeff;box-shadow:0 0 0 2px #6db6f5 inset}
.feedback-token.correct-selected{background:#dff7e8;box-shadow:0 0 0 2px #42a56a inset}
.feedback-token.wrong-selected{background:#ffe3e7;box-shadow:0 0 0 2px #e06c7a inset;text-decoration:line-through}
.feedback-token.missed-target{background:#fff0f6;box-shadow:0 -3px 0 #eb5a9a inset}
.no-error-choice{display:flex;align-items:center;gap:.55rem;margin:.8rem 0 1rem;font-weight:650}
.sentence-feedback-result,.sentence-reflection-block,.deep-analysis{margin-top:1rem;padding:1rem;border-radius:16px;border:1px solid var(--border);background:#fff}
.language-feedback-list{display:grid;gap:.75rem;margin-top:.75rem}
.language-feedback-list article{padding:.85rem;border-radius:14px;background:#f8fbff;border:1px solid #d9e9f7}
.feedback-type{display:inline-block;padding:.25rem .55rem;border-radius:999px;background:#ffe3f0;color:#9f275e;font-weight:800;font-size:.84rem}
.reflection-result{margin-top:.75rem;padding:.85rem;border-radius:12px;background:#f0f8ff}
.deep-analysis h4{color:var(--pink-700)}
.improved-sentence{margin-top:1rem;padding:1rem;border-radius:14px;background:linear-gradient(135deg,#eaf6ff,#fff0f7);border:1px solid #cfe2f2}
.improved-sentence span{font-weight:800;color:var(--blue-700)}
.improved-sentence p{font-size:1.05rem;font-weight:650;margin:.55rem 0 0}
.rewrite-prompt{margin-top:.8rem;padding:.75rem .9rem;border-left:4px solid var(--pink-500);background:#fff7fb}
.sentence-workspace-actions{margin-top:1rem}
.sentence-finish-all{margin-top:1rem}
.severity-major{background:#ffe2e8!important;color:#9a2448!important}
.severity-minor{background:#fff3d8!important;color:#825d13!important}
.severity-strength{background:#e2f7e9!important;color:#2d7446!important}
@media(max-width:850px){.criterion-grid,.paragraph-analysis-list,.argument-map-grid{grid-template-columns:1fr}.sentence-navigator select{width:100%;min-width:0}.interactive-token-area{font-size:1.05rem}}


/* V2.3.1 — old-style detailed sentence review */
.sentence-review-layout{display:grid;grid-template-columns:270px minmax(0,1fr);gap:18px;align-items:start}
.sentence-review-sidebar{position:sticky;top:86px;max-height:72vh;overflow:auto;padding:12px;border-radius:16px;background:linear-gradient(180deg,#0b4e8a,#1769e0);color:#fff}
.sentence-side-summary{display:flex;flex-direction:column;gap:4px;padding:6px 7px 12px}.sentence-side-summary span{font-size:.78rem;color:#dcedff}
.sentence-side-list{display:grid;gap:7px}.sentence-side-btn{width:100%;border:1px solid transparent;background:rgba(255,255,255,.1);color:#fff;border-radius:11px;padding:9px 10px;text-align:left;cursor:pointer}.sentence-side-btn span{display:block;font-weight:850}.sentence-side-btn small{display:block;margin-top:3px;opacity:.83;line-height:1.3}.sentence-side-btn:hover{background:rgba(255,255,255,.18)}.sentence-side-btn.active{background:#fff;color:#103f70;border-color:#ffc3d9}.sentence-side-btn.done::before{content:"✓ ";color:#70e3ad;font-weight:900}.sentence-side-btn.active.done::before{color:#1c8b60}
.legacy-step-strip{display:flex;gap:7px;flex-wrap:wrap;margin-bottom:16px}.legacy-step{padding:6px 10px;border-radius:999px;background:#e7edf4;color:#667788;font-size:.76rem;font-weight:850}.legacy-step.active{background:#ea6c9f;color:#fff}
.good-note{background:#e9f8f0;border-left:5px solid #2b8b61;padding:13px 15px;border-radius:11px;margin-bottom:14px}.good-note p{margin:.35rem 0 0;line-height:1.55}
.issue-bullet-box{background:#fff5dc;border-left:5px solid #c18a18;padding:16px 18px;border-radius:11px}.issue-bullet-box h4{margin:0 0 8px}.issue-bullet-box li{margin:.45rem 0;line-height:1.5}
.reason-box{background:#fff5dc;border-left:5px solid #c18a18;padding:17px 18px;border-radius:11px;margin-top:15px}.reason-box h4{margin:0 0 8px}.reason-box p{margin:0;line-height:1.68}
.original-essay-box{white-space:pre-wrap;font-family:Georgia,serif;font-size:1.05rem;line-height:1.72;padding:16px;background:#fff;border:1px solid #dce5ed;border-radius:13px;margin-top:12px}
.feedback-preview-sentences{display:grid;gap:8px;margin-top:10px}.feedback-preview-sentences article{border:1px solid #dce5ed;border-radius:12px;padding:11px;background:#fff}.feedback-preview-sentences p{margin:.35rem 0 0;color:#667788;font-size:.87rem}
.mobile-only{display:none}
@media(max-width:900px){.sentence-review-layout{grid-template-columns:1fr}.sentence-review-sidebar{display:none}.mobile-only{display:block}}

/* V3.0 — per-submission feedback HTML workflow */
.feedback-upload-zone{border:2px dashed #9fc7ee;border-radius:18px;padding:1.1rem;background:linear-gradient(135deg,#eff8ff,#fff3f8);margin:1rem 0}
.feedback-upload-zone input{width:100%;padding:.8rem;background:#fff;border:1px solid var(--border);border-radius:12px}
.feedback-upload-zone p{margin:.7rem 0 0;color:var(--muted);font-size:.9rem;line-height:1.5}
.html-feedback-preview-wrap{margin-top:1rem}
.html-feedback-preview{width:100%;min-height:900px;border:1px solid var(--border);border-radius:18px;background:#fff}
.html-feedback-flow{display:grid;gap:1rem}
.html-feedback-host-card{padding:1rem}
.html-feedback-frame{display:block;width:100%;min-height:900px;border:1px solid #cfe1f2;border-radius:20px;background:#fff;box-shadow:0 15px 40px rgba(23,105,224,.09)}
.sample-source{margin:.8rem 0;padding:1rem;border-left:5px solid var(--pink-500);border-radius:12px;background:#fff5fa;font-family:Georgia,serif;font-size:1.03rem;line-height:1.7;white-space:pre-wrap}
@media(max-width:720px){.html-feedback-frame,.html-feedback-preview{min-height:760px;border-radius:12px}.html-feedback-host-card{padding:.5rem}}

.build-version-badge{position:fixed;right:12px;bottom:12px;z-index:99999;background:#102a56;color:#fff;border:2px solid #ff72b6;border-radius:999px;padding:8px 12px;font:700 12px/1.2 system-ui;box-shadow:0 8px 24px rgba(16,42,86,.25)}

.new-site-notice {
  border: 2px solid rgba(236,72,153,.28);
  background: linear-gradient(100deg, #edf5ff, #fff0f7);
}
body::after {
  content: "CỔNG MỚI";
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 100;
  padding: .42rem .7rem;
  border-radius: 999px;
  background: #173f8f;
  color: white;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .12em;
  box-shadow: 0 8px 24px rgba(23,63,143,.22);
  pointer-events: none;
}


/* CLEAN-1.2 — search, filters, writing timer and richer home */
.home-hero {
  isolation: isolate;
  overflow: hidden;
  border-radius: 34px;
  padding: clamp(1rem, 3vw, 2.2rem);
  background:
    linear-gradient(135deg, rgba(237,245,255,.82), rgba(255,255,255,.9) 48%, rgba(255,240,247,.86));
  border: 1px solid rgba(23,105,224,.11);
  box-shadow: 0 28px 70px rgba(23,105,224,.10);
}
.hero-shapes { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.shape { position: absolute; display: block; opacity: .78; filter: saturate(1.08); }
.shape-a { width: 190px; height: 190px; border-radius: 46px; background: linear-gradient(145deg, rgba(23,105,224,.22), rgba(79,140,242,.08)); top: -70px; left: -55px; transform: rotate(23deg); }
.shape-b { width: 125px; height: 125px; border-radius: 50%; border: 24px solid rgba(236,72,153,.16); right: 34%; top: 3%; }
.shape-c { width: 170px; height: 42px; border-radius: 999px; background: rgba(249,168,212,.24); left: 28%; bottom: 10%; transform: rotate(-18deg); }
.shape-d { width: 78px; height: 78px; border-radius: 22px; background: rgba(23,105,224,.12); left: 47%; top: 24%; transform: rotate(45deg); }
.shape-e { width: 230px; height: 230px; border-radius: 50%; background: radial-gradient(circle, rgba(236,72,153,.13), rgba(236,72,153,0) 68%); right: -80px; bottom: -70px; }
.shape-f { width: 18px; height: 18px; border-radius: 50%; background: var(--rose); box-shadow: 42px 28px 0 rgba(23,105,224,.35), 84px -4px 0 rgba(249,168,212,.8), 125px 42px 0 rgba(23,105,224,.22); left: 46%; bottom: 18%; }

.home-feature-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: .65rem;
  margin-top: 1.35rem;
  max-width: 760px;
}
.home-feature-ribbon article {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: .16rem;
  min-height: 100px;
  padding: .8rem;
  border: 1px solid rgba(23,105,224,.12);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(8px);
}
.home-feature-ribbon article:nth-child(even) { background: rgba(255,240,247,.8); }
.home-feature-ribbon b { color: var(--rose); font-size: .72rem; letter-spacing: .1em; }
.home-feature-ribbon span { color: var(--navy); font-weight: 900; }
.home-feature-ribbon small { color: var(--muted); line-height: 1.3; }

.home-action-panel { position: relative; padding-top: 6.4rem; }
.home-orbit {
  position: absolute;
  width: 150px;
  height: 150px;
  top: -45px;
  left: 50%;
  transform: translateX(-50%);
  border: 1px dashed rgba(23,105,224,.35);
  border-radius: 50%;
}
.orbit-core {
  position: absolute;
  inset: 40px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(145deg,var(--navy-2),var(--rose));
  color: white;
  font-family: Georgia,serif;
  font-weight: 900;
  font-size: 2rem;
  box-shadow: 0 14px 30px rgba(23,105,224,.22);
}
.orbit-dot { position:absolute; width:16px; height:16px; border-radius:50%; background:var(--rose); }
.dot-1 { top: 8px; left: 68px; }
.dot-2 { right: 8px; bottom: 38px; background: var(--navy-2); }
.dot-3 { left: 7px; bottom: 34px; background: #f9a8d4; }

.filter-bar, .teacher-filter-panel {
  margin-bottom: 1rem;
  border: 1px solid rgba(23,105,224,.14);
  border-radius: 18px;
  background: linear-gradient(120deg, rgba(237,245,255,.92), #fff 50%, rgba(255,240,247,.86));
  box-shadow: 0 10px 28px rgba(23,105,224,.06);
}
.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(170px, .75fr) auto;
  align-items: end;
  gap: .8rem;
  padding: 1rem;
}
.compact-filter-bar { grid-template-columns: minmax(240px,2fr) minmax(150px,.7fr); }
.filter-search input { min-width: 0; }
.filter-result {
  min-width: 86px;
  display: grid;
  place-items: center;
  gap: .1rem;
  padding: .75rem 1rem;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
}
.filter-result small { color: var(--muted); }
.filter-result strong { color: var(--rose); font-size: 1.35rem; }
.filter-grid {
  display: grid;
  grid-template-columns: minmax(220px,1.4fr) repeat(4,minmax(150px,.8fr)) auto;
  gap: .75rem;
  align-items: end;
  padding: 1rem;
}
.teacher-filter-summary {
  display: grid;
  grid-template-columns: repeat(3,minmax(120px,.55fr)) minmax(120px,auto);
  gap: .7rem;
  align-items: stretch;
  padding: 1rem 1rem 0;
}
.teacher-filter-summary > div {
  display: grid;
  gap: .12rem;
  padding: .7rem .85rem;
  border-radius: 13px;
  background: #fff;
  border: 1px solid var(--line);
}
.teacher-filter-summary small { color: var(--muted); }
.teacher-filter-summary strong { color: var(--navy); font-size: 1.25rem; }
.filter-actions { display:flex; align-items:end; padding-bottom:.05rem; }

.task-pill.task1 { background:#e8f2ff; color:#1559b2; }
.task-pill.task2 { background:#fff0f7; color:#b52f70; }
.assignment-placeholder {
  display:grid;
  place-items:center;
  background:
    linear-gradient(135deg,rgba(23,105,224,.12),rgba(255,255,255,.8) 48%,rgba(236,72,153,.13));
}
.assignment-placeholder span {
  display:grid;
  place-items:center;
  width:82px;
  height:82px;
  border-radius:26px;
  background:linear-gradient(145deg,var(--navy-2),var(--rose));
  color:white;
  font-size:1.6rem;
  font-weight:950;
  transform:rotate(-6deg);
  box-shadow:0 14px 28px rgba(23,105,224,.18);
}

.writing-timer-card {
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:.75rem;
  align-items:center;
  margin-bottom:1rem;
  padding:.8rem .9rem;
  border:1px solid rgba(236,72,153,.18);
  border-radius:16px;
  background:linear-gradient(110deg,var(--blue-soft),#fff 48%,var(--pink-soft));
}
.timer-icon { font-size:1.4rem; }
.writing-timer-card small { display:block; color:var(--muted); }
.writing-timer-card strong { display:block; color:var(--navy); font-size:1.55rem; font-variant-numeric:tabular-nums; }
.writing-timer-card strong.timer-over { color:var(--rose); }
.writing-timer-card > span { color:var(--pink-deep); font-size:.8rem; font-weight:850; padding:.35rem .55rem; background:white; border-radius:999px; border:1px solid #f5d1e3; }

.saved-submission-card small { color:var(--muted); font-size:.75rem; }

@media (max-width: 1100px) {
  .filter-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .filter-actions { align-self:end; }
  .home-feature-ribbon { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .home-hero { padding:1rem; border-radius:22px; }
  .home-feature-ribbon { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-bar, .compact-filter-bar, .filter-grid, .teacher-filter-summary { grid-template-columns:1fr; }
  .filter-actions .btn { width:100%; }
  .writing-timer-card { grid-template-columns:auto 1fr; }
  .writing-timer-card > span { grid-column:1/-1; justify-self:start; }
}


/* CLEAN-1.3 — sample typing diagnostics */
.sample-typing-feedback {
  margin-top:.75rem;
  border:1px solid #d9e5f7;
  border-radius:16px;
  overflow:hidden;
  background:#fff;
}
.sample-typing-feedback.accepted { border-color:#b9e6cf; }
.sample-typing-feedback.needs-fix { border-color:#f3c3d7; }
.sample-feedback-summary {
  display:flex;
  justify-content:space-between;
  gap:.75rem;
  align-items:flex-start;
  padding:.8rem .9rem;
  background:linear-gradient(100deg,#f5f9ff,#fff8fc);
  border-bottom:1px solid #e6edf7;
}
.sample-typing-feedback.accepted .sample-feedback-summary { background:linear-gradient(100deg,#f0fbf5,#f8fffb); }
.sample-feedback-summary strong { color:var(--navy); font-size:.9rem; }
.sample-feedback-summary span { color:var(--muted); font-size:.75rem; text-align:right; max-width:340px; }
.sample-minor-note {
  padding:.55rem .9rem;
  background:#fff9e9;
  color:#765f16;
  border-bottom:1px solid #f5e7b9;
  font-size:.8rem;
  font-weight:700;
}
.sample-sentence-feedback-list { display:grid; gap:.65rem; padding:.75rem; }
.sample-sentence-feedback {
  border:1px solid #e2e9f4;
  border-radius:13px;
  padding:.7rem .75rem;
  background:#fbfdff;
}
.sample-sentence-feedback.sentence-ok { border-color:#c9e9d8; background:#f7fdf9; }
.sample-sentence-feedback.sentence-fix { border-color:#f2c6d8; background:#fff9fb; }
.sample-sentence-head {
  display:flex;
  justify-content:space-between;
  gap:.7rem;
  align-items:center;
  margin-bottom:.45rem;
}
.sample-sentence-head strong { color:var(--navy); }
.sample-sentence-head span {
  font-size:.72rem;
  font-weight:850;
  color:var(--muted);
  background:white;
  border:1px solid #e3e9f2;
  border-radius:999px;
  padding:.25rem .5rem;
}
.sample-reference-sentence {
  color:#34445f;
  font-size:.84rem;
  line-height:1.55;
  padding:.48rem .58rem;
  background:white;
  border-left:3px solid #8db8f5;
  border-radius:8px;
}
.sample-issue-list {
  margin:.55rem 0 0 1.1rem;
  padding:0;
  display:grid;
  gap:.32rem;
  font-size:.82rem;
  line-height:1.45;
}
.sample-issue-list .word-issue { color:#a82b5b; }
.sample-issue-list .punctuation-issue { color:#8a6610; }
.sample-issue-list em { color:#7c6b3a; font-size:.75rem; }
.sample-clean-line { margin-top:.5rem; color:#1f8053; font-size:.82rem; font-weight:800; }

@media (max-width: 760px) {
  .sample-feedback-summary, .sample-sentence-head { flex-direction:column; align-items:flex-start; }
  .sample-feedback-summary span { text-align:left; max-width:none; }
}
