/* 同心托管 — mobile-first PWA styles */
:root {
  --brand: #29A5C7;
  --brand-dark: #1E8AA8;
  --brand-deeper: #16708A;
  --brand-soft: #E6F6FB;
  --brand-softer: #F3FAFC;
  --bg: #F4F8FA;
  --surface: #FFFFFF;
  --text: #1A2B32;
  --text-secondary: #5A6F78;
  --text-muted: #8A9BA3;
  --border: #E2EBEE;
  --border-strong: #C9D7DD;
  --success: #2BA67A;
  --success-soft: #E6F7F0;
  --warning: #D9922B;
  --warning-soft: #FFF6E8;
  --danger: #D95353;
  --danger-soft: #FDECEC;
  --shadow-sm: 0 1px 2px rgba(26, 43, 50, 0.04);
  --shadow: 0 4px 16px rgba(26, 43, 50, 0.07);
  --shadow-lg: 0 12px 32px rgba(26, 43, 50, 0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --nav-h: 64px;
  --header-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
}

a {
  color: var(--brand);
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

ul {
  list-style: none;
}

/* App shell */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  box-shadow: 0 0 0 1px var(--border);
}

@media (min-width: 768px) {
  body {
    background: linear-gradient(160deg, #dff3f9 0%, #f4f8fa 40%, #eef6f8 100%);
  }
  #app {
    height: calc(100dvh - 48px);
    min-height: calc(100dvh - 48px);
    margin: 24px auto;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
  }
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  padding: calc(10px + var(--safe-t)) 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--header-h);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.app-header .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
}

.app-header .brand-text {
  min-width: 0;
}

.app-header .brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.app-header .brand-slogan {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: var(--brand-softer);
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.icon-btn:active {
  transform: scale(0.96);
}

.icon-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.main {
  flex: 1;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 20px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
}

.bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 8px 4px;
  transition: color 0.15s;
}

.bottom-nav button svg {
  width: 22px;
  height: 22px;
}

.bottom-nav button.active {
  color: var(--brand);
  font-weight: 600;
}


/* Campus chip */
.campus-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.campus-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}

.campus-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}

.campus-chip .chev {
  color: var(--text-muted);
  margin-left: 2px;
}

.year-chip {
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 600;
}

/* Search */
.search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 165, 199, 0.18);
}

.search-wrap input::placeholder {
  color: var(--text-muted);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.card + .card {
  margin-top: 12px;
}

.student-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  text-align: left;
  width: 100%;
  transition: transform 0.1s, box-shadow 0.15s, border-color 0.15s;
}

.student-card:active {
  transform: scale(0.99);
}

.student-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0;
  margin-top: 1px;
}

.student-meta {
  flex: 1;
  min-width: 0;
}

.student-meta .card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.student-meta .name {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-meta .card-top .tag {
  flex-shrink: 0;
  margin: 0;
}

.student-meta .sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.student-meta .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.miss-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.miss-prefix {
  font-size: 11px;
  font-weight: 700;
  color: var(--warning);
  margin-right: 1px;
}

.miss-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  color: var(--warning);
  background: var(--warning-soft);
  border: 1px solid rgba(217, 146, 43, 0.28);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
}

.tag.tier {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.tag.paid {
  background: var(--success-soft);
  color: var(--success);
}

.tag.partial {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag.unpaid {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag.special {
  background: #F0EEFF;
  color: #6B5CC9;
}

.chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 10px;
  opacity: 0.7;
}

/* Section headers */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.section-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.section-head .count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty .illus {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 24px;
  background: var(--brand-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
}

.empty .illus svg {
  width: 36px;
  height: 36px;
}

.empty h3 {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 6px;
}

.empty p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-secondary {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}

.fab {
  position: fixed;
  right: max(16px, calc(50% - 240px + 16px));
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(41, 165, 199, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 45;
  transition: transform 0.15s;
}

.fab:active {
  transform: scale(0.94);
}

.fab svg {
  width: 26px;
  height: 26px;
}

@media (min-width: 768px) {
  .fab {
    position: absolute;
  }
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 165, 199, 0.18);
}

textarea.form-control {
  height: auto;
  min-height: 88px;
  padding: 12px 14px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.seg.two {
  grid-template-columns: 1fr 1fr;
}

.seg.four {
  grid-template-columns: repeat(2, 1fr);
}

.seg-btn {
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
  padding: 0 8px;
  text-align: center;
  line-height: 1.2;
}

.seg-btn.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  box-shadow: 0 0 0 1px var(--brand);
}

.seg-btn.tall {
  height: auto;
  min-height: 52px;
  padding: 10px 8px;
}

/* Month grid */
.month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.month-chip {
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 650;
  color: var(--text-secondary);
  transition: all 0.15s;
  position: relative;
}

.month-chip.paid {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.month-chip.paid::after {
  content: "✓";
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 11px;
  font-weight: 700;
}

.month-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* Detail page */
.back-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 8px 0 2px;
  color: var(--brand);
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.detail-hero .avatar {
  width: 56px;
  height: 56px;
  font-size: 22px;
  border-radius: 16px;
}

.detail-hero .name {
  font-size: 20px;
  font-weight: 700;
}

.detail-hero .sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}

.info-item {
  background: var(--brand-softer);
  border-radius: 12px;
  padding: 10px 12px;
}

.info-item .label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.info-item .value {
  font-size: 14px;
  font-weight: 650;
  margin-top: 2px;
  word-break: break-all;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 10px;
  box-shadow: var(--shadow-sm);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.panel-title h3 {
  font-size: 15px;
  font-weight: 700;
}

.panel-title .year-select {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--brand-softer);
  font-size: 13px;
  font-weight: 650;
  color: var(--brand-dark);
}

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

.stat {
  text-align: center;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--brand-softer);
}

.stat .num {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.2;
}

.stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Campus list */
.campus-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.campus-item.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm);
}

.campus-item .rank {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.campus-item .body {
  flex: 1;
  min-width: 0;
}

.campus-item .body .name {
  font-weight: 650;
  font-size: 16px;
}

.campus-item .body .sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.campus-item .actions {
  display: flex;
  gap: 4px;
}

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.settings-item .ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-item .ico svg {
  width: 20px;
  height: 20px;
}

.settings-item .ico.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.settings-item .txt {
  flex: 1;
  text-align: left;
}

.settings-item .txt .t {
  font-weight: 650;
  font-size: 15px;
}

.settings-item .txt .d {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.brand-block {
  text-align: center;
  padding: 28px 16px 8px;
}

.brand-block img {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 16px;
}

.brand-block h1 {
  font-size: 20px;
  color: var(--brand-dark);
  font-weight: 700;
}

.brand-block p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Modal / sheet */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 43, 50, 0.4);
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 0;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .overlay {
    align-items: center;
    padding: 24px;
  }
}

.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  border-radius: 24px 24px 0 0;
  padding: 12px 20px calc(20px + var(--safe-b));
  max-height: min(92dvh, 720px);
  overflow-y: auto;
  transform: translateY(24px);
  transition: transform 0.22s ease;
  box-shadow: var(--shadow-lg);
}

.overlay.show .sheet {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .sheet {
    border-radius: 24px;
    transform: translateY(12px) scale(0.98);
  }
  .overlay.show .sheet {
    transform: none;
  }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 4px;
  margin: 4px auto 14px;
}

.sheet-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
}

.sheet-actions .btn {
  flex: 1;
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  text-align: left;
  width: 100%;
  font-weight: 600;
}

.picker-item.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.picker-item .check {
  margin-left: auto;
  color: var(--brand);
}

/* Toast */
.toast-wrap {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  background: #1A2B32;
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: toast-in 0.25s ease;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Confirm */
.confirm-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

/* Overview cards on home */
.overview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.overview .o-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.overview .o-card.span {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border: none;
  color: #fff;
}

.overview .o-card .lbl {
  font-size: 12px;
  opacity: 0.85;
  font-weight: 500;
}

.overview .o-card.span .lbl {
  opacity: 0.9;
}

.overview .o-card .num {
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
  line-height: 1.1;
}

.overview .o-card .hint {
  font-size: 12px;
  margin-top: 6px;
  opacity: 0.85;
}

.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.filter-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}


/* Detail confirm CTA */
.confirm-bar {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  margin-top: 16px;
  padding: 12px 0 4px;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 28%);
  z-index: 20;
}

.confirm-bar .btn {
  height: 50px;
  font-size: 16px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(41, 165, 199, 0.35);
}

.confirm-hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}


/* Paid months on student list cards */
.paid-months {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.paid-months-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--success);
  line-height: 1.3;
}

.month-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.month-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(43, 166, 122, 0.25);
}

.seg.four {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 380px) {
  .seg.four {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* Required months bar */
.required-bar {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px dashed var(--brand);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.required-bar .rb-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-dark);
}
.required-bar .rb-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.term-hint {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--brand-softer);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 0 12px;
  line-height: 1.5;
}
.term-hint.warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.month-chip.required:not(.paid) {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(41,165,199,0.25);
}
.month-chip.required i {
  font-style: normal;
  font-size: 10px;
  opacity: 0.75;
  margin-left: 1px;
}

.miss-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--warning);
  margin-top: 2px;
}

/* Unpaid-by-month view */
.month-picker-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.month-picker-row::-webkit-scrollbar { display: none; }
.month-pick {
  flex-shrink: 0;
  min-width: 48px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}
.month-pick.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.month-pick.has-unpaid:not(.active) {
  border-color: var(--danger);
  color: var(--danger);
}
.unpaid-count-banner {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 12px;
}
.unpaid-count-banner.zero {
  background: var(--success-soft);
  color: var(--success);
}


.month-chip.special-item {
  grid-column: span 2;
  background: #F0EEFF;
  border-color: #C5BDF0;
  color: #6B5CC9;
}
.month-chip.special-item.paid {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}
.grade-chips {
  margin-bottom: 8px;
}


.month-pick.special-pick {
  min-width: 64px;
  padding: 0 10px;
}
.month-pick.special-pick:not(.active) {
  border-color: #C5BDF0;
  color: #6B5CC9;
  background: #F7F5FF;
}


.home-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin: -4px 0 12px;
  font-weight: 500;
}

.service-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.service-stats.service-stats-row {
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.service-stat {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.service-stats-row .service-stat {
  padding: 8px 4px;
  text-align: center;
  border-radius: 12px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.service-stat:active {
  transform: scale(0.98);
}

.service-stat.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 1px var(--brand);
}

.service-stat .ss-label {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-secondary);
}

.service-stat.active .ss-label {
  color: var(--brand-dark);
}

.service-stat .ss-num {
  font-size: 28px;
  font-weight: 750;
  color: var(--brand-dark);
  line-height: 1.15;
  margin-top: 4px;
}

.service-stats-row .service-stat .ss-label {
  font-size: 11px;
}

.service-stats-row .service-stat .ss-num {
  font-size: 18px;
  margin-top: 0;
}

.service-stat .ss-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.filter-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  align-self: center;
  padding: 6px 4px;
}


.guardian-list .guardian-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--brand-softer);
  border-radius: 12px;
  margin-bottom: 6px;
}
.guardian-list .g-name {
  font-size: 14px;
  font-weight: 650;
}
.guardian-list .g-phone {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-dark);
}
.guardian-edit {
  padding: 8px 0 4px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 6px;
}
.guardian-edit:last-child {
  border-bottom: none;
}
.detail-hero {
  align-items: center;
}


/* —— 0.4.0 孩子档案 —— */
.archive-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 4px 0;
}
.archive-hero .avatar,
.archive-hero .avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  object-fit: cover;
}
.archive-hero .avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}
.archive-hero-text {
  min-width: 0;
  flex: 1;
}
.archive-hero .name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.archive-hero .name {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}
.archive-hero .sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.archive-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 8px;
  box-shadow: var(--shadow-sm);
}
.archive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.archive-head h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}
.archive-head .count-soft {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 650;
  padding: 6px 4px;
  min-height: 32px;
  cursor: pointer;
  font-family: inherit;
}
.link-btn.danger {
  color: var(--danger, #d64545);
}
.link-btn:active {
  opacity: 0.7;
}

.kv-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kv-list.tight .kv-row {
  padding: 6px 0;
}
.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  min-height: 36px;
}
.kv-row:last-child {
  border-bottom: none;
}
.kv-k {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}
.kv-v {
  font-size: 14px;
  font-weight: 650;
  text-align: right;
  word-break: break-all;
}
.kv-v.muted {
  color: var(--text-muted);
  font-weight: 500;
}
.kv-v.link {
  color: var(--brand-dark);
  text-decoration: none;
}

.fee-summary-compact {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--brand-softer);
  border-radius: 10px;
  margin-bottom: 6px;
}
.fee-paid-num {
  font-size: 22px;
  font-weight: 750;
  color: var(--brand-dark);
  line-height: 1.1;
}
.fee-paid-lbl {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.miss-inline {
  font-size: 12px;
  color: var(--warning, #c47a00);
  font-weight: 600;
  margin-left: auto;
}
.miss-warn {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--warning, #c47a00);
  font-weight: 600;
  line-height: 1.4;
}

.empty-line {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 0 2px;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.note-item {
  background: var(--brand-softer);
  border-radius: 10px;
  padding: 10px 12px;
}
.note-text {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.note-actions {
  display: flex;
  gap: 8px;
}
.note-actions .link-btn {
  min-height: 28px;
  padding: 2px 4px;
  font-size: 12px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.photo-thumb {
  aspect-ratio: 1;
  border: none;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--brand-softer);
  cursor: pointer;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-preview {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
  margin-bottom: 12px;
}

.info-grid.compact {
  gap: 6px;
}
.info-item.compact {
  padding: 8px 10px;
}


/* 0.4.1 compact gender + photo action sheet */
.form-row.form-row-3 {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 8px;
}
@media (max-width: 360px) {
  .form-row.form-row-3 {
    grid-template-columns: 1fr 1fr;
  }
  .form-row.form-row-3 .form-group:first-child {
    grid-column: 1 / -1;
  }
}
.gender-seg.seg {
  gap: 6px;
}
.gender-seg .seg-btn {
  height: 38px;
  min-height: 38px;
  border-radius: 10px;
  font-size: 13px;
  padding: 0 6px;
}
.action-sheet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.action-sheet-item {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--brand-softer);
  color: var(--brand-dark);
  font-size: 15px;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
}
.action-sheet-item:active {
  opacity: 0.85;
  background: var(--brand-soft);
}


/* 0.4.4 services on same row as grade/class */
.sub-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  min-width: 0;
}
.sub-line .sub {
  margin-top: 0;
  flex: 0 1 auto;
  min-width: 0;
}
.svc-inline {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: center;
  margin-left: auto;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}
.svc-inline.muted .svc-chip.empty {
  color: var(--text-muted);
  background: transparent;
  border-color: var(--border);
  font-weight: 500;
}
.svc-chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  color: var(--brand-dark);
  background: var(--brand-softer);
  border: 1px solid rgba(41, 165, 199, 0.28);
  white-space: nowrap;
  flex-shrink: 0;
}


/* 0.4.6 compact service multi-select in profile / fee */
.label-hint {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 12px;
}
.service-seg-compact.seg {
  gap: 6px;
}
.service-seg-compact .seg-btn {
  height: 36px;
  min-height: 36px;
  border-radius: 10px;
  font-size: 13px;
  padding: 0 6px;
}


/* 0.4.7 grade + gender dropdowns */
.filter-select-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 8px;
}
.filter-select {
  display: block;
  min-width: 0;
}
.filter-select-ctrl {
  width: 100%;
  height: 40px;
  min-height: 40px;
  padding: 0 32px 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%2929A5C7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
.filter-select-ctrl:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 165, 199, 0.18);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Login gate (password whitelist) ---------- */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(165deg, #e6f6fb 0%, #f4f8fa 45%, #ffffff 100%);
}
.login-gate[hidden] {
  display: none !important;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  padding: 28px 22px 22px;
  text-align: center;
}
.login-logo {
  margin: 0 auto 12px;
  border-radius: 16px;
}
.login-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.login-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.login-label {
  display: block;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.login-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--brand-softer);
  outline: none;
}
.login-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(41, 165, 199, 0.2);
}
.login-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  text-align: left;
}
.login-btn {
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  margin-top: 4px;
}
.login-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.login-btn:not(:disabled):active {
  background: var(--brand-dark);
}
.login-hint {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}
