:root {
  color-scheme: light;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial,
    sans-serif;
  --bg: #eef2ef;
  --ink: #18211d;
  --muted: #6c756f;
  --line: #d8ded8;
  --surface: #ffffff;
  --soft: #f6f8f6;
  --green: #21845d;
  --green-soft: #e6f3ec;
  --amber: #b46b13;
  --amber-soft: #fff1d8;
  --red: #c44035;
  --red-soft: #fae8e5;
  --teal: #0d7280;
  --blue: #3568a8;
  --shadow: 0 22px 60px rgba(34, 44, 38, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.85), transparent 30%),
    linear-gradient(135deg, #edf4f0 0%, #f5f0e7 45%, #e9f0f2 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 14px;
}

.phone {
  position: relative;
  width: min(100%, 420px);
  min-height: 820px;
  max-height: calc(100vh - 56px);
  overflow: auto;
  border: 1px solid rgba(24, 33, 29, 0.1);
  border-radius: 28px;
  background: #fbfcfb;
  box-shadow: var(--shadow);
  padding: 18px;
  scrollbar-width: none;
}

.phone::-webkit-scrollbar {
  display: none;
}

.topbar,
.section-head,
.panel-title,
.student-hero,
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 6px 2px 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 23px;
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  letter-spacing: 0;
}

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bell-dot {
  position: absolute;
  right: 9px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
  border: 2px solid var(--surface);
}

.role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 8px;
  background: #edf1ec;
  margin-bottom: 18px;
}

.tab,
.chip,
.text-btn,
.primary-btn,
.secondary-btn,
.quick-btn {
  border: 0;
  border-radius: 8px;
}

.tab {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  font-weight: 680;
}

.tab.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 4px 18px rgba(44, 56, 49, 0.08);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.metric {
  min-height: 82px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 28px;
}

.metric.ok {
  border-color: #b9dac9;
  background: var(--green-soft);
}

.metric.warn {
  border-color: #efd1a3;
  background: var(--amber-soft);
}

.metric.danger {
  border-color: #efc3bd;
  background: var(--red-soft);
}

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-bottom: 12px;
}

.chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 13px;
  background: #edf1ec;
  color: var(--muted);
}

.chip.active {
  background: #183228;
  color: #fff;
}

.notice-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border-radius: 8px;
  background: var(--red-soft);
  color: #893129;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.ocr-pipeline {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.ocr-pipeline.visible {
  display: grid;
}

.ocr-pipeline div {
  position: relative;
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #9aa39d;
  background: var(--soft);
  transition: 220ms ease;
}

.ocr-pipeline span,
.ocr-pipeline strong {
  display: block;
}

.ocr-pipeline span {
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 9px;
}

.ocr-pipeline strong {
  font-size: 11px;
}

.ocr-pipeline div.active {
  color: var(--ink);
  border-color: #84c9a7;
  background: var(--green-soft);
  transform: translateY(-2px);
}

.ocr-pipeline div.done::after {
  position: absolute;
  right: 8px;
  top: 7px;
  color: var(--green);
  content: "✓";
  font-weight: 800;
}

.recognition-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  border-color: #a9d6c0 !important;
  background: var(--green-soft) !important;
}

.recognition-summary strong {
  color: var(--green);
  font-size: 20px !important;
}

.recognition-summary small {
  grid-column: 1 / -1;
  color: var(--amber);
  font-size: 10px;
}

.schedule-result em {
  margin-left: 4px;
  color: var(--teal);
  font-size: 10px;
  font-style: normal;
  font-weight: 650;
}

.notice-strip svg {
  flex: 0 0 auto;
}

.student-list {
  display: grid;
  gap: 9px;
}

.student-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.student-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 13px;
}

.student-main {
  min-width: 0;
}

.student-main strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
}

.student-main span,
.student-meta {
  color: var(--muted);
  font-size: 12px;
}

.student-meta {
  text-align: right;
  line-height: 1.5;
}

.status-pill,
.mini-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.status-pill.present {
  color: #176444;
  background: var(--green-soft);
}

.status-pill.night {
  color: #86500d;
  background: var(--amber-soft);
}

.status-pill.danger {
  color: #9d3028;
  background: var(--red-soft);
}

.status-pill.neutral,
.mini-tag {
  color: #315f69;
  background: #e5f3f5;
}

.panel {
  padding: 14px;
  margin-top: 14px;
}

.text-btn {
  padding: 8px 10px;
  background: #e9f0ee;
  color: var(--teal);
  font-weight: 700;
}

.summary {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.summary dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 0;
}

.summary dl div {
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
}

.summary dt,
.summary dd {
  margin: 0;
}

.summary dt {
  color: var(--muted);
  font-size: 12px;
}

.summary dd {
  color: var(--ink);
  font-weight: 760;
  margin-top: 4px;
}

.student-hero {
  min-height: 96px;
  padding: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e6f3ec, #fff6e7);
  border: 1px solid #c9ddd1;
}

.upload-box {
  display: grid;
  place-items: center;
  gap: 9px;
  min-height: 116px;
  margin-top: 12px;
  border: 1px dashed #aab8b0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  text-align: center;
}

.upload-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-box svg {
  width: 30px;
  height: 30px;
  color: var(--teal);
}

.primary-btn,
.secondary-btn {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  font-weight: 760;
}

.primary-btn {
  background: #183228;
  color: #fff;
}

.primary-btn.disabled,
.primary-btn:disabled {
  background: #bdc8c0;
  color: #fff;
  cursor: not-allowed;
}

.secondary-btn {
  background: #e9f0ee;
  color: #173c36;
}

.schedule-result {
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.schedule-result.visible {
  display: grid;
}

.schedule-result div {
  min-height: 64px;
  display: grid;
  place-items: center;
  gap: 3px;
  border-radius: 8px;
  background: #f2f5f1;
}

.schedule-result span {
  color: var(--muted);
  font-size: 12px;
}

.schedule-result strong {
  font-size: 13px;
}

.location-card {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.location-card svg {
  width: 30px;
  height: 30px;
  color: var(--red);
}

.location-card.in svg {
  color: var(--green);
}

.location-card strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.location-card span {
  color: var(--muted);
  font-size: 12px;
}

.action-row .secondary-btn,
.action-row .primary-btn {
  margin-top: 10px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.quick-btn {
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: #304139;
  font-weight: 700;
}

.toast {
  position: sticky;
  bottom: 12px;
  left: 18px;
  right: 18px;
  display: none;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(24, 50, 40, 0.94);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(20, 35, 28, 0.2);
}

.toast.visible {
  display: block;
}

@media (max-width: 460px) {
  .shell {
    padding: 0;
    align-items: stretch;
  }

  .phone {
    width: 100%;
    min-height: 100vh;
    max-height: none;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
}
