:root {
  --navy: #173a5e;
  --navy-2: #0f2944;
  --sky: #dcebf1;
  --teal: #2d7180;
  --gold: #d9a62e;
  --coral: #ce625b;
  --ink: #26323d;
  --muted: #667583;
  --line: #dbe3e8;
  --paper: #fffdf8;
  --white: #ffffff;
  --success: #28765a;
  --warning: #a06b10;
  --danger: #a53d3d;
  --shadow: 0 12px 36px rgba(23, 58, 94, .10);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "DM Sans", sans-serif; color: var(--ink); background: #f3f6f7; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
.loading-screen, .auth-shell { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.logo-mark { width: 54px; height: 54px; border-radius: 16px; background: var(--navy); color: white; display: grid; place-items: center; font-family: Lora, serif; font-weight: 600; box-shadow: var(--shadow); }
.auth-card { width: min(440px, 100%); background: white; border-radius: 24px; padding: 34px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-card .logo-mark { margin: 0 auto 20px; }
h1, h2, h3 { color: var(--navy); margin-top: 0; }
h1, .serif { font-family: Lora, serif; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--teal); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-2); }
.btn-secondary { background: var(--sky); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-danger { background: #f7e6e4; color: var(--danger); }
.btn-success { background: var(--success); color: white; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-wide { width: 100%; }
.google-icon { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(#4285f4 0 25%, #34a853 0 50%, #fbbc05 0 75%, #ea4335 0); border: 3px solid white; }
.app-shell { min-height: 100vh; }
.topbar { height: 70px; background: var(--navy); color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; font-family: Lora, serif; font-size: 19px; font-weight: 600; }
.brand .logo-mark { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.25); box-shadow: none; }
.user-chip { display: flex; align-items: center; gap: 12px; }
.role-pill, .status-pill { display: inline-flex; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; }
.role-pill { background: rgba(255,255,255,.15); color: white; }
.status-pill { background: var(--sky); color: var(--navy); }
.status-submitted { background: #fff1ce; color: #76520a; }
.status-revision_requested { background: #f8dfdc; color: #8b302c; }
.status-accepted, .status-classroom_submitted { background: #dcefe7; color: #1f684e; }
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 70px); }
.sidebar { background: white; border-right: 1px solid var(--line); padding: 18px 12px; }
.nav-btn { width: 100%; border: 0; background: transparent; text-align: left; padding: 11px 13px; border-radius: 10px; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.nav-btn:hover, .nav-btn.active { background: var(--sky); color: var(--navy); }
.content { padding: 28px; max-width: 1500px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-head h1 { margin-bottom: 6px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 5px 18px rgba(23,58,94,.05); }
.card h3 { margin-bottom: 8px; }
.card-row { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--navy); }
.input, .textarea, .select { width: 100%; border: 1px solid #cbd6dc; background: white; border-radius: 10px; padding: 10px 12px; color: var(--ink); }
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus, .editor:focus { outline: 3px solid rgba(45,113,128,.18); border-color: var(--teal); }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.check-row input { margin-top: 3px; accent-color: var(--teal); }
.level-card { border-top: 5px solid var(--teal); }
.level-card:nth-child(2) { border-top-color: var(--gold); }
.level-card:nth-child(3) { border-top-color: var(--coral); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.writing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.paper-panel { min-width: 0; }
.paper-title { font-family: Lora, serif; font-size: 22px; text-align: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 7px; background: #edf3f5; border: 1px solid var(--line); border-radius: 12px 12px 0 0; padding: 9px; position: sticky; top: 70px; z-index: 10; }
.tool-btn { border: 1px solid #cbd6dc; background: white; border-radius: 8px; padding: 7px 10px; color: var(--navy); font-weight: 700; font-size: 13px; }
.editor { min-height: 620px; background: var(--paper); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; padding: 54px 64px; line-height: 2; font-family: Georgia, serif; font-size: 16px; box-shadow: var(--shadow); white-space: pre-wrap; }
.editor p, .review-paper p { text-indent: 2em; margin: 0; }
.editor [data-iew-type], .review-paper [data-iew-type] { background: #fff4bd; border-radius: 3px; }
.checklist-panel { position: sticky; top: 88px; max-height: calc(100vh - 110px); overflow: auto; }
.check-section { margin-top: 16px; }
.check-section h4 { color: var(--navy); margin: 0 0 6px; font-size: 14px; }
.live-check { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid #edf1f3; font-size: 14px; }
.check-pass { color: var(--success); }
.check-fail { color: var(--danger); }
.check-review { color: var(--warning); }
.sticky-actions { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.comments { display: grid; gap: 10px; }
.comment { border-left: 4px solid var(--teal); background: #f6f9fa; padding: 11px 12px; border-radius: 8px; }
.comment blockquote { margin: 6px 0; color: var(--muted); font-style: italic; }
.review-paper { min-height: 420px; background: var(--paper); padding: 42px 54px; border: 1px solid var(--line); border-radius: 12px; line-height: 2; font-family: Georgia, serif; }
.vocab-card { display: grid; gap: 5px; }
.vocab-word { font-family: Lora, serif; font-size: 18px; color: var(--navy); }
.notice { padding: 12px 14px; border-radius: 10px; background: #fff4d6; color: #72520c; border: 1px solid #f0d68e; margin: 12px 0; }
.success-notice { background: #e4f2ec; color: #215f49; border-color: #add6c6; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: 360px; padding: 12px 16px; background: var(--navy-2); color: white; border-radius: 12px; box-shadow: var(--shadow); z-index: 100; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,41,68,.52); z-index: 40; display: grid; place-items: center; padding: 20px; }
.modal { width: min(720px, 100%); max-height: 90vh; overflow: auto; background: white; border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.hidden { display: none !important; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; position: sticky; top: 70px; z-index: 15; }
  .nav-btn { width: auto; white-space: nowrap; margin: 0 4px 0 0; }
  .writing-layout { grid-template-columns: 1fr; }
  .checklist-panel { position: static; max-height: none; order: -1; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .content { padding: 18px 12px; }
  .topbar { padding: 0 12px; }
  .brand span:last-child { display: none; }
  .user-chip .small { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .editor { padding: 30px 22px; min-height: 520px; }
  .review-paper { padding: 28px 22px; }
}
