:root {
  color-scheme: light;
  --ink: #18302b;
  --muted: #697773;
  --paper: #f4f2ed;
  --card: #fffdfa;
  --line: #dedbd3;
  --green: #173b34;
  --green-soft: #dce9e4;
  --orange: #d87d4a;
  --danger: #a33b34;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--paper); min-height: 100%; }
body { margin: 0; min-height: 100%; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-shell { width: min(100%, 720px); min-height: 100vh; margin: 0 auto; padding: env(safe-area-inset-top) 20px calc(40px + env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; padding: 28px 2px 18px; }
.eyebrow { margin: 0 0 5px; color: var(--orange); font-size: 12px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(42px, 12vw, 62px); font-weight: 700; letter-spacing: -.05em; line-height: .95; }
h2 { margin-bottom: 8px; font-size: 24px; line-height: 1.18; }
.icon-button, .close-button { display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255,253,250,.8); }
.icon-button { width: 46px; height: 46px; border-radius: 50%; }
.icon-button svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.search-section { animation: rise .32s ease-out; }
.search-box { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px; border: 1px solid #d5d2ca; border-radius: 17px; background: var(--card); box-shadow: 0 9px 26px rgba(28,45,40,.06); }
.search-box:focus-within { border-color: #78978d; box-shadow: 0 0 0 3px rgba(73,119,105,.12); }
.search-box svg { width: 21px; flex: 0 0 auto; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 17px; }
.search-box input::placeholder { color: #87918e; }
.clear-button { border: 0; background: #e5e5e0; color: #5a6561; width: 24px; height: 24px; border-radius: 50%; font-size: 18px; line-height: 20px; }
.summary-row { display: flex; justify-content: space-between; padding: 14px 4px 9px; color: var(--muted); font-size: 13px; }
.results { display: grid; gap: 9px; }
.student-card { width: 100%; display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,253,250,.9); text-align: left; }
.student-card:active { transform: scale(.985); background: #f9f7f2; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; background: var(--green-soft); color: var(--green); font-family: "Songti SC", serif; font-size: 20px; font-weight: 700; }
.avatar.large { width: 56px; height: 56px; flex-basis: 56px; border-radius: 18px; font-size: 25px; background: var(--orange); color: white; }
.student-main { min-width: 0; flex: 1; }
.student-main strong { display: block; font-size: 17px; }
.student-main small { display: block; margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chevron { color: #8d9693; font-size: 27px; font-weight: 300; }
.empty-search { padding: 55px 20px; text-align: center; color: var(--muted); }
.empty-search h2 { color: var(--ink); font-size: 20px; }
.empty-mark { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 16px; border: 1px solid var(--line); border-radius: 50%; font-family: "Songti SC", serif; font-size: 22px; }

.welcome-card { margin-top: 16px; padding: 34px 24px 26px; border: 1px solid var(--line); border-radius: 28px; background: var(--card); box-shadow: 0 18px 45px rgba(28,45,40,.07); animation: rise .35s ease-out; }
.welcome-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
.welcome-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 26px; border-radius: 20px; background: var(--green); color: white; font-family: "Songti SC", serif; font-size: 28px; box-shadow: inset 0 -8px 0 rgba(216,125,74,.65); }
.primary-button, .secondary-button { min-height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 700; }
.primary-button { border: 0; background: var(--green); color: white; }
.primary-button:disabled { opacity: .45; }
.secondary-button { border: 1px solid var(--line); background: transparent; }
.welcome-card .primary-button { width: 100%; margin-top: 8px; }
.privacy-list { display: grid; gap: 8px; margin: 22px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); list-style: none; color: var(--muted); font-size: 13px; }
.privacy-list li::before { content: "✓"; margin-right: 9px; color: var(--orange); font-weight: 800; }

dialog { color: var(--ink); }
.sheet-dialog { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; }
.sheet-dialog::backdrop { background: rgba(14,28,24,.42); backdrop-filter: blur(3px); }
.sheet-card { position: fixed; inset: auto 0 0; width: min(100%, 720px); max-height: 90vh; margin: auto; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); overflow: auto; border-radius: 26px 26px 0 0; background: var(--card); box-shadow: 0 -20px 70px rgba(12,24,21,.22); animation: sheetUp .28s ease-out; }
.sheet-handle { width: 38px; height: 5px; margin: 0 auto 18px; border-radius: 999px; background: #d2d0c9; }
.sheet-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.close-button { width: 35px; height: 35px; flex: 0 0 auto; border-radius: 50%; font-size: 24px; font-weight: 300; line-height: 1; }
.muted { color: var(--muted); font-size: 13px; }
.form-grid, .mapping-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compact-grid { margin: 18px 0; }
.form-grid label, .mapping-fields label { color: var(--muted); font-size: 12px; font-weight: 650; }
select, input[type="number"] { width: 100%; height: 44px; margin-top: 6px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); font-size: 15px; }
.notice { margin-bottom: 16px; padding: 13px 14px; border-radius: 12px; background: #edf3f0; color: #45635a; font-size: 13px; line-height: 1.55; }
.advanced-fields { margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-fields summary { padding: 15px 0; color: var(--green); font-weight: 700; cursor: pointer; }
.advanced-fields .mapping-fields { padding-bottom: 16px; }
.preview-stats { min-height: 42px; padding: 17px 2px 8px; color: var(--muted); font-size: 13px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.8fr; gap: 10px; padding-top: 8px; }

.detail-heading { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; }
.detail-heading > div:nth-child(2) { min-width: 0; flex: 1; }
.detail-heading h2 { margin: 0; font-size: 27px; }
.detail-heading p:last-child { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.phone-list { display: grid; gap: 9px; margin: 3px 0 18px; }
.phone-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border-radius: 15px; background: var(--green); color: white; }
.phone-row small, .phone-row strong { display: block; }
.phone-row small { margin-bottom: 3px; color: #c5d6d1; font-size: 11px; }
.phone-actions { display: flex; gap: 7px; }
.phone-actions a, .phone-actions button { min-width: 52px; padding: 9px 10px; border: 0; border-radius: 10px; background: rgba(255,255,255,.14); color: white; text-align: center; text-decoration: none; font-size: 13px; font-weight: 700; }
.phone-actions a { background: var(--orange); }
.info-list { border-top: 1px solid var(--line); }
.info-row { position: relative; display: grid; grid-template-columns: minmax(80px, .75fr) 1.6fr auto; align-items: center; gap: 10px; min-height: 52px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.info-row small { color: var(--muted); }
.info-row strong { overflow-wrap: anywhere; font-size: 14px; text-align: right; }
.info-row button { padding: 5px 7px; border: 0; border-radius: 7px; background: var(--green-soft); color: var(--green); font-size: 12px; }

.settings-list { margin-top: 14px; border-top: 1px solid var(--line); }
.settings-row { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 17px 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.settings-row strong, .settings-row small { display: block; }
.settings-row small { margin-top: 4px; color: var(--muted); }
.settings-row b { color: #9ca4a1; font-size: 24px; font-weight: 300; }
.settings-row.danger strong { color: var(--danger); }
.local-note { margin-top: 22px; padding: 16px; border-radius: 14px; background: #f0eee8; color: var(--muted); font-size: 13px; line-height: 1.55; }
.local-note strong { color: var(--ink); }
.local-note p { margin: 5px 0 0; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); max-width: calc(100% - 40px); padding: 11px 16px; border-radius: 999px; background: rgba(23,59,52,.96); color: white; font-size: 13px; opacity: 0; transform: translate(-50%, 18px); transition: .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheetUp { from { transform: translateY(100%); } }
@media (max-width: 420px) {
  .app-shell { padding-left: 15px; padding-right: 15px; }
  .form-grid, .mapping-fields { grid-template-columns: 1fr; }
  .sheet-card { padding-left: 18px; padding-right: 18px; }
}
@media (min-width: 721px) {
  .sheet-card { left: 50%; right: auto; transform: translateX(-50%); border-radius: 26px 26px 0 0; }
  @keyframes sheetUp { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.demo-banner{margin:0 0 16px;padding:12px 14px;border:1px solid #d9d2c2;border-radius:12px;background:#faf7ef;color:#665e4f;font-size:12px;line-height:1.6}
.results{min-width:0;grid-template-columns:minmax(0,1fr)}.student-card{min-width:0}
