:root {
  --ink: #18232d;
  --navy: #112c43;
  --navy-deep: #0b1d2d;
  --copper: #c16436;
  --copper-dark: #9b4526;
  --sage: #4d8374;
  --paper: #f3f5f1;
  --card: #fbfcf9;
  --fog: #e5ebe7;
  --line: #cbd6d3;
  --muted: #6b7a7d;
  --success: #28715d;
  --danger: #b14e3b;
  --control-radius: 11px;
  --pico-primary: var(--copper);
  --pico-primary-background: var(--copper);
  --pico-primary-hover: var(--copper-dark);
  --pico-primary-hover-background: var(--copper-dark);
  --pico-form-element-active-border-color: var(--copper);
  --pico-form-element-focus-color: rgba(193,100,54,.18);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
body::before { position: fixed; z-index: -1; inset: 0; pointer-events: none; content: ""; opacity: .34; background: radial-gradient(circle at 15% 14%, rgba(193,100,54,.13), transparent 24rem), radial-gradient(circle at 89% 5%, rgba(77,131,116,.1), transparent 22rem); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.page-shell { position: relative; width: min(100% - 32px, 760px); margin: 0 auto; padding: 28px 0 48px; }
.page-shell.wide { width: min(100% - 48px, 1280px); }
.ambient-grid { position: fixed; z-index: -1; top: 0; right: max(calc((100vw - 760px) / 2 - 140px), 10px); width: 220px; height: 220px; opacity: .34; background-image: linear-gradient(rgba(17,44,67,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(17,44,67,.12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(135deg, black, transparent 78%); }

/* Student page */
.sitebar { display: flex; align-items: center; justify-content: flex-start; gap: 14px; padding: 0 0 22px; border-bottom: 1px solid var(--line); color: var(--navy); font-size: 12px; letter-spacing: .04em; }
.brand-lockup { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.school-logo { position: relative; display: block; isolation: isolate; width: min(250px, 58vw); aspect-ratio: 1540 / 444; }
.school-logo img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: left center; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font-size: 11px; letter-spacing: -.08em; }
.hero { display: block; max-width: 735px; padding: 62px 0 54px; animation: rise-in .7s ease both; }
.eyebrow { margin: 0 0 12px; color: var(--copper); font-size: 11px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 18px; color: var(--navy); font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif; font-size: clamp(42px, 8vw, 74px); font-weight: 600; line-height: .99; letter-spacing: -.075em; }
h1 em { color: var(--copper); font-style: normal; }
h2 { margin-bottom: 5px; color: var(--navy); font-size: 19px; letter-spacing: -.02em; }
p { line-height: 1.68; }
.hero-copy > p:not(.eyebrow) { max-width: 100%; margin-bottom: 22px; color: var(--muted); font-size: 15px; text-wrap: pretty; }
.hero-note { display: inline-flex; align-items: center; gap: 9px; color: var(--navy); font-size: 12px; font-weight: 750; }
.signal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 5px rgba(77,131,116,.13); }
.card { border: 1px solid var(--line); border-radius: 3px; background: rgba(251,252,249,.95); box-shadow: 0 20px 55px rgba(17,44,67,.08); }
.form-card { position: relative; overflow: hidden; padding: clamp(22px, 5vw, 39px); animation: rise-in .7s .1s ease both; }
.form-card::before { position: absolute; top: 0; left: 0; width: 5px; height: 100%; content: ""; background: linear-gradient(var(--copper), var(--sage)); }
.section-heading { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 22px; }
.section-heading p { max-width: 430px; margin-bottom: 0; color: var(--muted); font-size: 13px; }
.step { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.field-grid { display: grid; gap: 16px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: grid; gap: 8px; color: var(--navy); font-size: 13px; font-weight: 800; }
input, textarea, select { width: 100%; border: 1px solid rgba(17,44,67,.18); border-radius: var(--control-radius); background: rgba(255,255,255,.78); color: var(--ink); padding: 12px 13px; outline: none; box-shadow: 0 2px 8px rgba(17,44,67,.04); transition: border-color .18s, background .18s, box-shadow .18s, transform .18s; }
input:hover, textarea:hover, select:hover { border-color: rgba(17,44,67,.32); background: #fff; }
input:focus, textarea:focus, select:focus { border-color: var(--copper); background: #fff; box-shadow: 0 0 0 4px rgba(193,100,54,.13), 0 8px 18px rgba(17,44,67,.07); }
input::placeholder, textarea::placeholder { color: #98a5a5; }
textarea { min-height: 128px; resize: vertical; line-height: 1.65; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0; transition: opacity .25s, filter .25s; }
fieldset:disabled { opacity: .46; filter: saturate(.55); }
.verify-status { display: flex; align-items: center; gap: 9px; min-height: 32px; margin-top: 14px; padding: 7px 10px; border-left: 2px solid var(--line); background: #f0f4f0; }
.verify-status p { margin: 0; color: var(--muted); font-size: 12px; }
.verify-light { width: 7px; height: 7px; border-radius: 50%; background: #a9b6b3; }
.verify-light.pending { background: var(--copper); box-shadow: 0 0 0 4px rgba(193,100,54,.12); animation: pulse 1.2s ease infinite; }
.verify-light.success { background: var(--success); box-shadow: 0 0 0 4px rgba(40,113,93,.12); }
.verify-light.error { background: var(--danger); }
.divider { height: 1px; margin: 30px 0; background: var(--line); }
.field-hint, .file-note { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.5; }
.file-note { display: block; margin-top: -4px; }
.required { color: var(--copper); font-size: 12px; }
input[type="file"] { padding: 8px; font-size: 12px; }
input[type="file"]::file-selector-button { margin-right: 8px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--navy); padding: 5px 10px 5px 3px; cursor: pointer; font-weight: 800; }
.checkbox-row { grid-template-columns: 19px 1fr; align-items: start; gap: 9px; margin-top: 22px; color: var(--muted); font-weight: 400; line-height: 1.5; }
.checkbox-row input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--copper); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; border: 1px solid transparent; border-radius: var(--control-radius); padding: 10px 17px; cursor: pointer; font-weight: 850; text-decoration: none; white-space: nowrap; transition: transform .18s, background .18s, border-color .18s, color .18s, box-shadow .18s; }
.button:hover:not(:disabled) { transform: translate(-2px, -2px); }
.button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(193,100,54,.35); outline-offset: 2px; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button.primary { width: 100%; margin-top: 23px; background: var(--copper); color: #fff; box-shadow: 0 8px 18px rgba(193,100,54,.22); }
.button.primary:hover:not(:disabled) { background: var(--copper-dark); }
.button-arrow { margin-left: auto; font-size: 18px; line-height: 1; }
.button.secondary { border-color: var(--line); background: var(--fog); color: var(--navy); box-shadow: 0 4px 12px rgba(17,44,67,.05); }
.button.ghost { border-color: var(--line); background: rgba(255,255,255,.46); color: var(--navy); }
.notice { margin: 0 0 16px; border-radius: var(--control-radius); padding: 12px 14px; border-left: 3px solid; font-size: 14px; line-height: 1.5; }
.notice.error { border-color: var(--danger); background: #fff2ed; color: #8d382a; }
.notice.success { border-color: var(--success); background: #e8f3ed; color: var(--success); }
.hidden { display: none !important; }
.error-text { color: var(--danger) !important; }
.success-text { color: var(--success) !important; }
.success-card { position: relative; overflow: hidden; padding: 46px 25px; border-color: var(--navy); background: var(--navy); color: #eaf0eb; text-align: center; }
.success-card::after { position: absolute; right: -34px; bottom: -60px; width: 170px; height: 170px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; content: ""; box-shadow: 0 0 0 16px rgba(255,255,255,.06), 0 0 0 32px rgba(255,255,255,.04); }
.success-card h2 { color: #fff; }
.success-card p:not(.eyebrow) { color: #bac8c5; }
.success-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 18px; border: 1px solid #96c7b5; border-radius: 50%; color: #bce2d2; font-size: 29px; font-weight: 900; }
.success-card .eyebrow { color: #e18a62; }
.case-number { display: grid; gap: 5px; width: min(100%, 340px); margin: 24px auto; padding: 16px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.13); }
.case-number span { color: #9eb2af; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.case-number strong { color: #fff; font-size: 22px; letter-spacing: .06em; }
.success-card .button.secondary { position: relative; z-index: 1; border-color: rgba(255,255,255,.28); background: transparent; color: #fff; }
/* Admin */
.admin-body { background: #edf1ee; }
.admin-body::before { background: linear-gradient(120deg, rgba(17,44,67,.08), transparent 35%), radial-gradient(circle at 92% 4%, rgba(193,100,54,.14), transparent 24rem); }
.admin-body .page-shell { padding-top: 22px; padding-bottom: 56px; }
.admin-body .sitebar { justify-content: space-between; padding-bottom: 16px; }
.admin-body .sitebar-note { color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.login-card { width: min(100%, 470px); margin: 9vh auto 0; padding: 34px; border-top: 5px solid var(--copper); }
.login-card h1 { font-size: clamp(34px, 6vw, 53px); }
.muted { color: var(--muted); }
#login-form { display: grid; gap: 16px; margin-top: 26px; }
code { padding: 2px 5px; background: var(--fog); color: var(--navy); }
.admin-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 38px 0 28px; }
.admin-header h1 { margin: 0; color: var(--navy); font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: clamp(30px, 5vw, 44px); font-weight: 800; letter-spacing: -.06em; }
.admin-header .eyebrow { margin-bottom: 8px; }
.query-card, .import-panel { margin-bottom: 14px; box-shadow: 0 12px 30px rgba(17,44,67,.05); }
.toolbar-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 26px 17px; border-bottom: 1px solid var(--line); }
.toolbar-heading .eyebrow { margin-bottom: 6px; }
.toolbar-heading h2 { margin: 0; font-size: 18px; }
.toolbar-caption { margin: 0; color: var(--muted); font-size: 12px; }
.query-panel { display: grid; grid-template-columns: minmax(0, 1fr) 190px 92px 132px; align-items: end; gap: 12px; padding: 20px 26px 24px; }
.toolbar-field { display: grid; gap: 7px; min-width: 0; margin: 0; color: var(--navy); font-size: 12px; font-weight: 850; }
.toolbar-field > span, .toolbar-label { color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.toolbar-field input, .toolbar-field select { margin: 0; }
.query-panel > .button { min-height: 48px; }
.query-panel > .button.secondary:first-of-type { background: var(--navy); color: #fff; }
.query-panel > .button.secondary:first-of-type:hover:not(:disabled) { background: var(--navy-deep); }
.import-panel { display: grid; grid-template-columns: 190px minmax(240px, 1fr) auto auto; align-items: center; gap: 12px; padding: 17px 26px 20px; }
.import-copy { display: grid; align-content: start; gap: 3px; }
.import-copy .eyebrow { margin: 0 0 2px; font-size: 10px; }
.import-copy strong { color: var(--navy); font-size: 15px; }
.file-picker { position: relative; display: flex; align-items: center; min-width: 0; min-height: 48px; margin: 0; overflow: hidden; border: 1px solid rgba(17,44,67,.18); border-radius: 5px; background: #fff; color: var(--ink); cursor: pointer; }
.file-picker:hover { border-color: rgba(17,44,67,.32); }
.file-picker-button { flex: 0 0 auto; padding: 13px 15px; border-right: 1px solid var(--line); color: var(--navy); font-size: 12px; font-weight: 850; }
.file-picker-name { min-width: 0; overflow: hidden; padding: 0 13px; color: var(--muted); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.import-panel > .button { min-height: 48px; }
.import-hint { grid-column: 2 / -1; margin-top: -2px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat-card { position: relative; overflow: hidden; padding: 15px 17px 16px; border-top: 3px solid var(--sage); box-shadow: 0 8px 20px rgba(17,44,67,.04); }
.stat-card:nth-child(2n) { border-top-color: var(--copper); }
.stat-card .label { color: var(--muted); font-size: 11px; letter-spacing: .03em; }
.stat-card .value { margin-top: 4px; color: var(--navy); font-size: 25px; font-weight: 900; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .85fr); gap: 14px; align-items: start; }
.table-card, .detail-card { overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.table-head h2 { margin: 0; }
.table-scroll { overflow: auto; }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e4ebe7; text-align: left; vertical-align: top; font-size: 13px; }
th { background: #f3f6f2; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .04em; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover, tbody tr.selected { background: #f5f8f4; }
.case-link { color: var(--copper-dark); font-weight: 850; }
.status-pill { display: inline-flex; padding: 4px 8px; border: 1px solid #c6d5d0; border-radius: 99px; background: #eaf2ee; color: var(--navy); font-size: 11px; font-weight: 850; white-space: nowrap; }
.detail-card { min-height: 440px; padding: 20px; }
.empty-state { display: grid; place-items: center; min-height: 380px; color: var(--muted); font-size: 13px; text-align: center; }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.detail-title h2 { margin-bottom: 5px; font-size: 18px; }
.detail-meta { display: grid; gap: 12px; margin: 0 0 20px; }
.detail-meta div { display: grid; gap: 3px; }
.detail-meta dt { color: var(--muted); font-size: 11px; }
.detail-meta dd { margin: 0; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 20px; }
.attachment-list a { color: var(--copper-dark); font-size: 12px; }
.detail-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 12px; color: var(--navy); font-size: 14px; }
.status-form { display: grid; gap: 9px; }
.status-help { margin: -2px 0 2px; padding-left: 2px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.followup { padding: 10px 0; border-top: 1px solid #e4ebe7; }
.followup small { color: var(--muted); }
.followup p { margin: 4px 0 0; font-size: 13px; white-space: pre-wrap; }

@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 50% { opacity: .45; transform: scale(.76); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } }
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .query-panel { grid-template-columns: minmax(0, 1fr) 160px auto auto; }
  .import-panel { grid-template-columns: 150px minmax(170px, 1fr) auto; }
  .import-panel > a.button, .import-hint { grid-column: 2 / -1; }
}
@media (max-width: 720px) {
  .query-panel { grid-template-columns: minmax(0, 1fr) 1fr; }
  .toolbar-search { grid-column: 1 / -1; }
  .query-panel > .button { width: 100%; }
  .import-panel { grid-template-columns: 1fr 1fr; }
  .import-copy, .file-picker, .import-hint { grid-column: 1 / -1; }
  .import-panel > .button { width: 100%; }
  .import-panel > a.button { grid-column: auto; }
}
@media (max-width: 620px) {
  .page-shell, .page-shell.wide { width: min(100% - 24px, 760px); padding-top: 20px; }
  .school-logo { width: min(220px, 68vw); }
  .hero { padding: 48px 0 36px; }
  h1 { font-size: clamp(42px, 15vw, 64px); }
  .field-grid.two, .stats-grid { grid-template-columns: 1fr; }
  .toolbar { padding: 18px; }
  .toolbar-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .query-panel, .import-panel { grid-template-columns: 1fr; max-width: none; }
  .toolbar-search, .import-copy, .file-picker, .import-hint, .import-panel > a.button { grid-column: auto; }
  .query-panel > .button, .import-panel > .button { width: 100%; }
  .import-panel { padding: 14px; }
  .import-panel > a.button, .import-hint { grid-column: auto; }
  .admin-header { align-items: flex-start; }
  .admin-header .button { min-height: 38px; padding: 8px 11px; }
  footer { display: block; }
  footer span { display: block; margin-bottom: 5px; }
}
