/* Lopio — 2 trang đăng nhập: giáo viên (/dang-nhap) và học sinh, phụ huynh (/hoc-sinh).
   Khung bên trái yên tĩnh; màu và chi tiết dồn vào trang giấy bên phải. Dùng kèm style.css. */
:root {
  --desk: #EEF1EE;
  --paper: #FFFDF7;
  --paper-ink: #1F2937;
  --paper-muted: #7B8494;
  --rule: rgba(46, 98, 170, .18);
  --grid: rgba(124, 92, 200, .09);
  --grid-strong: rgba(124, 92, 200, .2);
  --margin: rgba(214, 64, 69, .5);
  --ink-blue: #2747A6;
  --ink-red: #C8332F;
  --paper-shadow: 0 1px 1px rgba(15, 23, 42, .06), 0 12px 28px -8px rgba(15, 23, 42, .16), 0 32px 64px -28px rgba(15, 23, 42, .22);
  --hand: "Patrick Hand", "Segoe Print", "Bradley Hand", cursive;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --desk: #121A29; --paper: #ECE9DF; --paper-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 16px 36px -8px rgba(0, 0, 0, .55), 0 40px 80px -28px rgba(0, 0, 0, .6); }
}
:root[data-theme="dark"] { --desk: #121A29; --paper: #ECE9DF; --paper-shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 16px 36px -8px rgba(0, 0, 0, .55), 0 40px 80px -28px rgba(0, 0, 0, .6); }

body.auth-page { background: var(--surface); }
.auth ol, .auth ul { margin: 0; padding: 0; list-style: none; }
.auth figure, .auth p { margin: 0; }
.auth .brand { padding: 0; gap: 8px; font-size: 18px; font-weight: 600; letter-spacing: 0; color: var(--ink); }
.auth .brand .logo { width: 28px; height: 28px; }
.auth .icon-btn { border: 1px solid var(--line); }
.auth h1 { font-size: 28px; }
.auth .sub { margin-top: 8px; color: var(--muted); text-wrap: pretty; }
.auth .input { height: 44px; min-height: 44px; font-size: 16px; }
.auth .btn-primary { width: 100%; height: 44px; font-size: 15px; }
.auth .btn-primary .i { width: 16px; height: 16px; }
.link { color: var(--primary-2); font: inherit; font-weight: 500; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth .field > span:first-child { display: flex; justify-content: space-between; gap: 8px; }
.auth .field .hint { font-size: 13px; }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.err { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.4; color: var(--danger); }
.err .i { width: 14px; height: 14px; }
.form-msg:empty { display: none; }
.form-msg { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---------- khung ---------- */
.auth { display: grid; grid-template-columns: minmax(440px, 1fr) minmax(0, 1.25fr); min-height: 100vh; min-height: 100dvh; }
.auth-main { display: flex; flex-direction: column; padding: 24px 48px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.auth-body { flex: 1; display: flex; align-items: center; padding: 40px 0; }
.form-wrap { width: 100%; max-width: 360px; margin-inline: auto; animation: rise .32s var(--ease) both; }
.auth-foot { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.auth-foot a { text-decoration: none; }
.auth-foot a:hover { color: var(--ink); }

/* ---------- form ---------- */
.auth .notice { display: flex; gap: 8px; align-items: flex-start; padding: 12px; margin-bottom: 24px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.auth .notice .i { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }
.auth form { margin-top: 28px; display: grid; gap: 16px; }
.auth form .btn-primary { margin-top: 8px; }
.pw { position: relative; display: block; }
.pw .input { padding-right: 48px; }
.pw button { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: color .15s var(--ease), background-color .15s var(--ease); }
.pw button:hover { color: var(--ink); background: var(--surface-2); }
.auth .switch { margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth .other { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.auth .help { text-wrap: pretty; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.auth .help b { font-weight: 500; color: var(--ink-2); }
.auth .who { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: var(--ink-2); }
.auth .who .i { width: 16px; height: 16px; color: var(--muted); }

/* ---------- bàn làm việc (bên phải) ---------- */
.desk { margin: 16px 16px 16px 0; border-radius: 20px; background: var(--desk); display: flex; flex-direction: column; align-items: center;
  padding: 48px 40px 32px; gap: 40px; overflow: hidden; }
.desk-stage { flex: 1; width: 100%; display: grid; place-items: center; }
.desk-notes { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; width: 100%; max-width: 640px; }
.desk-notes li { display: flex; gap: 10px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.desk-notes .i { width: 16px; height: 16px; margin-top: 1px; color: var(--muted); }
.desk-notes b { display: block; font-weight: 500; color: var(--ink); }

/* ---------- trang giấy ---------- */
.sheet { position: relative; width: min(460px, 100%); }
.paper { position: relative; background: var(--paper); color: var(--paper-ink); border-radius: 4px; box-shadow: var(--paper-shadow); transform: rotate(-1.5deg); }
.paper::before { content: ""; position: absolute; top: 0; bottom: 0; left: 48px; width: 1px; background: var(--margin); box-shadow: 3px 0 0 var(--margin); opacity: .9; }
.hand { font-family: var(--hand); font-weight: 400; letter-spacing: .01em; }
.blue { color: var(--ink-blue); }
.red { color: var(--ink-red); }
svg.ink { position: absolute; overflow: visible; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
svg.ink path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .5s var(--ease) forwards; animation-delay: calc(.5s + var(--d, 0) * 140ms); }
svg.ink.b { stroke: var(--ink-blue); }
svg.ink.r { stroke: var(--ink-red); }

/* sổ điểm danh (giáo viên) */
.register { padding: 24px 24px 20px 64px; }
.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--rule); }
.p-head small { display: block; font-size: 12px; color: var(--paper-muted); font-variant-numeric: tabular-nums; }
.p-head b { display: block; margin-top: 2px; font-size: 17px; font-weight: 600; }
.p-head .count { font-size: 12px; color: var(--paper-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-cols, .p-row { display: grid; grid-template-columns: minmax(0, 1fr) 64px 64px; align-items: center; }
.p-cols { height: 28px; font-size: 11px; color: var(--paper-muted); }
.p-cols span:not(:first-child), .p-row > :not(.name) { text-align: center; justify-self: center; }
.p-rows { list-style: none; }
.p-row { position: relative; height: 40px; border-bottom: 1px solid var(--rule); }
.p-row .no { position: absolute; left: -44px; width: 28px; text-align: right; font-size: 16px; color: var(--paper-muted); }
.p-row .name { font-size: 21px; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-row .mark { position: relative; width: 28px; height: 22px; }
.p-row .mark svg { inset: 0; width: 28px; height: 22px; }
.p-row .score { font-size: 21px; line-height: 1; }
.p-row .absent { font-size: 16px; color: var(--paper-muted); white-space: nowrap; }
.p-foot { display: flex; align-items: baseline; justify-content: space-between; padding-top: 16px; font-size: 13px; color: var(--paper-muted); }
.p-foot .paid { position: relative; font-size: 22px; line-height: 1; }
.p-foot .paid svg { left: -4px; right: -4px; bottom: -8px; width: calc(100% + 8px); height: 8px; }

/* bút chì (màu theo logo) */
.pencil { position: absolute; width: 300px; right: -40px; bottom: -64px; transform: rotate(26deg); filter: drop-shadow(-6px 10px 8px rgba(15, 23, 42, .2)); pointer-events: none; }

/* tờ giấy lót phía sau */
.sheet.stack::before { content: ""; position: absolute; inset: 0; background: var(--paper); border-radius: 4px; box-shadow: var(--paper-shadow);
  transform: rotate(2deg) translate(8px, 6px); filter: brightness(.97); }

/* vở ô li (học sinh) */
.oli { padding: 24px 24px 28px 64px;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid-strong) 1px, transparent 1px), linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px), linear-gradient(var(--grid) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 100% 6px; background-position: 0 0, 16px 0, 0 0; }
.oli-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.oli-head .who-wrote { font-size: 20px; line-height: 24px; }
.oli-head .who-wrote small { display: block; font-size: 16px; color: var(--paper-muted); }
.grade { position: relative; flex: none; width: 76px; height: 56px; display: grid; place-items: center; font-size: 34px; line-height: 1; transform: rotate(-6deg); }
.grade svg { inset: 0; width: 100%; height: 100%; }
.work { margin-top: 12px; }
.work p { position: relative; font-size: 22px; line-height: 48px; height: 48px; white-space: nowrap; }
.work sub, .work sup { font-size: .6em; line-height: 0; }
.work sub { vertical-align: -.25em; }
.work sup { vertical-align: .7em; }
.work svg.tick { position: relative; display: inline-block; vertical-align: -2px; margin-left: 16px; width: 28px; height: 22px; }
.work svg.caret { left: -32px; top: 16px; width: 16px; height: 16px; }
.sheet .note { position: relative; margin-top: 4px; font-size: 21px; line-height: 32px; transform: rotate(-1.5deg); transform-origin: left; }
.sheet .note svg { left: 0; bottom: -6px; width: 100%; height: 8px; }

/* ---------- chuyển động ---------- */
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .form-wrap { animation: none; }
  svg.ink path { animation: none; stroke-dashoffset: 0; }
}

/* ---------- màn nhỏ ---------- */
@media (max-width: 1100px) {
  .auth { grid-template-columns: minmax(400px, 1fr) minmax(0, 1.2fr); }
  .auth-main { padding: 24px 32px; }
  .desk { padding: 40px 28px 28px; }
  .desk-notes { gap: 16px; }
}
@media (max-width: 959px) {
  .auth { grid-template-columns: 1fr; }
  .auth-main { padding: 16px; }
  .auth-body { align-items: flex-start; padding: 40px 0 32px; }
  .form-wrap { max-width: 420px; }
  h1 { font-size: 24px; }
  .auth-foot { display: none; }
  .desk { margin: 0 16px 16px; padding: 40px 16px 24px; gap: 32px; }
  .desk-notes { grid-template-columns: 1fr; gap: 12px; max-width: 420px; }
  .sheet { width: min(420px, 100%); }
  .register { padding: 20px 16px 16px 52px; }
  .paper::before { left: 40px; }
  .p-row .no { left: -40px; width: 24px; }
  .p-cols, .p-row { grid-template-columns: minmax(0, 1fr) 52px 52px; }
  .oli { padding: 20px 16px 24px 52px; }
  .work p { font-size: 20px; }
  .pencil { width: 220px; right: -64px; bottom: -60px; }
  .p-head .count { display: none; }
}
@media (max-width: 380px) {
  .p-row .name { font-size: 19px; }
  .work p { font-size: 18px; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.auth .p-row .no { left: -56px; }
@media (max-width: 959px) { .auth .p-row .no { left: -46px; } }

/* dòng đồng ý điều khoản dưới nút Tạo tài khoản */
.terms { margin-top: 12px; font-size: 12.5px; line-height: 1.5; color: var(--muted); text-align: center; text-wrap: pretty; }
.terms a { font-weight: 500; }
