/* Sổ học phí: one light palette, the same as the approved mockups in Docs/flow.html. The slip is always white. */
:root {
  --bg: #f6f5fb; --card: #ffffff; --ink: #1f1b2e; --muted: #676281; --line: #e2deef;
  --v: #5a3db5; --vs: #ede8fc; --red: #cf3439; --rs: #fde9ea; --warn: #fff4d9; --warn-line: #ecd28c;
  --f-display: "Bricolage Grotesque", "Be Vietnam Pro", system-ui, sans-serif;
  --f-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabbar: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--f-body); min-height: 100dvh; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
h1, h2, p { margin: 0; }
h1 { font: 800 26px/1.15 var(--f-display); letter-spacing: -.01em; text-wrap: balance; }
h2 { font: 700 17px/1.3 var(--f-display); }
:focus-visible { outline: 2px solid var(--v); outline-offset: 2px; }

.main {
  max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
  display: flex; flex-direction: column; gap: 12px;
}
body.notabs .main { padding-bottom: calc(env(safe-area-inset-bottom) + 20px); }
.sp { flex: 1; min-height: 8px; }
.eb { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sec { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.hint { font-size: 14px; color: var(--muted); }
.hint.center, .center { text-align: center; }
.hint.foot { margin-top: 4px; }
.err { font-size: 14px; color: var(--red); }
.back { align-self: flex-start; background: none; border: 0; padding: 4px 0; color: var(--v); font-weight: 600; font-size: 16px; }
.link { background: none; border: 0; padding: 0; color: var(--v); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link.red { color: var(--red); }

/* Cards and rows */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cnt { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.more { display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; }

/* Attendance: a whole row is the tap target */
.stu { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 48px; text-align: left; border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--card); font-size: 17px; transition: background .15s; }
.pill { font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 99px; background: var(--vs); color: var(--v); white-space: nowrap; }
.stu.off { background: var(--rs); border-color: transparent; }
.stu.off span:first-child { text-decoration: line-through; color: var(--muted); }
.stu.off .pill { background: var(--card); color: var(--red); }

/* Buttons */
.btn { display: block; width: 100%; min-height: 46px; border-radius: 12px; padding: 10px 12px; text-align: center; font-weight: 600; background: var(--v); color: #fff; border: 1.5px solid var(--v); }
.btn:disabled { opacity: .4; }
.btn.g { background: transparent; color: var(--v); }
.btn.q { background: transparent; border-color: var(--line); color: var(--muted); font-weight: 500; }
.btn.q.white { background: #fff; }
.btn.r { background: var(--red); border-color: var(--red); }
.btn.rt { background: transparent; border-color: transparent; color: var(--red); }
.btn.small { width: auto; flex: none; padding-inline: 18px; }
.btns { display: flex; gap: 8px; }
.btns > .btn { flex: 1; }
.btns.wrap { flex-wrap: wrap; width: 100%; }
.btns.wrap > .btn { flex: 1 1 40%; }

/* Forms */
.f { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-weight: 600; font-size: 15px; }
.in { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 0 12px; min-height: 48px; font-variant-numeric: tabular-nums; }
.in.grow { flex: 1; }
.in:focus-within { border-color: var(--v); box-shadow: 0 0 0 3px var(--vs); }
.in.er { border-color: var(--red); box-shadow: 0 0 0 3px var(--rs); }
.in input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 17px; padding: 10px 0; -webkit-appearance: none; appearance: none; }
.in input[type="date"] { min-height: 44px; text-align: left; }
.in input::-webkit-date-and-time-value { text-align: left; }
.in input::placeholder { color: #a8a3bd; }
.u { color: var(--muted); }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.days button { border: 1.5px solid var(--line); border-radius: 10px; text-align: center; min-height: 44px; font-weight: 600; font-size: 15px; background: var(--card); padding: 0; }
.days .on { background: var(--v); border-color: var(--v); color: #fff; }
.steps { display: flex; gap: 6px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--v); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border: 0; border-radius: 99px; padding: 6px 10px 6px 13px; background: var(--vs); color: var(--v); font-weight: 600; font-size: 15px; }
.tag span { color: var(--muted); font-weight: 500; margin-left: 6px; }
.li { display: flex; gap: 10px; align-items: flex-start; }
.num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--vs); color: var(--v); font-weight: 700; font-size: 13px; flex: none; }
.share-ic { color: #2f6fe0; font-weight: 700; }

/* Messages */
.confirm { background: var(--rs); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.warn { background: var(--warn); border: 1px solid var(--warn-line); border-radius: 12px; padding: 12px; font-size: 15px; display: flex; flex-direction: column; gap: 10px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px); max-width: 528px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 12px; padding: 11px 14px; text-align: center; font-size: 15px; z-index: 20; box-shadow: 0 10px 30px -12px rgba(20, 10, 60, .6); }
body.notabs .toast { bottom: calc(env(safe-area-inset-bottom) + 20px); }

/* Lists (settings) */
.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.list > button, .list > div, .list > label { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.list > :last-child { border-bottom: 0; }
.list > button::after { content: "›"; color: var(--muted); font-size: 20px; line-height: 1; }
.list small { color: var(--muted); font-size: 14px; margin-left: auto; text-align: right; }
.list .dim span { color: var(--muted); }
.row-in input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; text-align: right; color: var(--muted); font-size: 15px; }
.row-in input:focus { color: var(--ink); }

/* Calendar */
.nav { display: flex; justify-content: space-between; align-items: center; }
.nav button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 20px; display: grid; place-items: center; padding: 0 0 2px; }
.nav button:disabled { opacity: .3; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.cal b { font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal button { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; position: relative; border: 1.5px solid transparent; background: none; font-size: 15px; padding: 0; }
.cal .h { background: var(--vs); color: var(--v); font-weight: 700; }
.cal .p { border: 1.5px dashed var(--line); }
.cal .t { text-decoration: underline; text-underline-offset: 3px; }
.cal .s { border: 2px solid var(--v); }
.cal .a::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend i.h { background: var(--vs); }
.legend i.p { border: 1.5px dashed var(--muted); }
.legend i.a { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* Slips */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1.5px solid var(--line); border-radius: 99px; padding: 6px 14px; background: var(--card); font-size: 15px; }
.chips .on { background: var(--v); border-color: var(--v); color: #fff; font-weight: 600; }
.slip { background: #fff; color: #1f1b2e; border: 1px solid var(--line); border-radius: 10px; padding: 16px 16px 16px 34px; position: relative; box-shadow: 0 12px 26px -18px rgba(30, 20, 70, .5); }
.slip::before { content: ""; position: absolute; top: 0; bottom: 0; left: 20px; width: 1px; background: var(--red); opacity: .55; }
.slip .se { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--v); }
.slip .sn { font: 800 24px/1.2 var(--f-display); margin: 2px 0 10px; }
.slip table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.slip th { text-align: left; font-size: 11px; color: var(--muted); border-bottom: 1.5px solid #1f1b2e; padding: 4px 0; font-weight: 600; }
.slip td { border-bottom: 1px solid rgba(90, 61, 181, .16); padding: 5px 0; }
.slip .r { text-align: right; }
.slip td.r { color: var(--muted); }
.slip .none { color: var(--muted); text-align: center; padding: 10px 0; }
.slip .off { font-size: 13px; color: var(--muted); margin-top: 8px; }
.slip .tot { display: flex; justify-content: space-between; align-items: baseline; border-top: 1.5px solid #1f1b2e; margin-top: 10px; padding-top: 8px; gap: 10px; }
.slip .tot span { font-size: 14px; color: var(--muted); }
.slip .tot b { font: 800 24px var(--f-display); white-space: nowrap; }

/* Hướng dẫn sử dụng */
.guide { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.guide summary { list-style: none; cursor: pointer; padding: 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 10px; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: "›"; color: var(--muted); font-size: 20px; line-height: 1; transition: transform .15s; }
.guide[open] summary::after { transform: rotate(90deg); }
.guide > div { padding: 0 14px 14px; font-size: 15px; display: flex; flex-direction: column; gap: 8px; }
.guide ol, .guide ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* Tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); }
.tabbar button { background: none; border: 0; display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; min-height: 48px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar .on { color: var(--v); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
