:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e5e9f0;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --success: #0f9f6e;
  --success-soft: #e8f8f1;
  --warning: #c2740a;
  --warning-soft: #fff5e5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0369a1;
  --info-soft: #e8f5fd;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
.boot { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 20%, #e6ebff 0, transparent 35%),
              radial-gradient(circle at 85% 85%, #e6f6f1 0, transparent 35%), var(--bg);
  padding: 24px;
}
.login-card {
  width: 420px;
  max-width: 100%;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 36px;
  border: 1px solid var(--line);
}
.login-logo {
  width: 46px; height: 46px; border-radius: 13px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; letter-spacing: -1px; margin-bottom: 18px;
}
.login-card h1 { font-size: 22px; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 22px 0; font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 224px; flex-shrink: 0; background: #111827; color: #d1d5db;
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: white; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; background: #6366f1;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand-text { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.nav-group-label { padding: 6px 12px 4px; font-size: 11px; letter-spacing: .5px; color: #6b7280; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 9px; color: #cbd5e1; background: transparent; border: 0;
  text-align: left; width: 100%;
}
.nav-item:hover { background: #1f2937; color: white; }
.nav-item.active { background: #312e81; color: white; }
.nav-icon { width: 18px; text-align: center; opacity: .85; }
.sidebar-foot { padding: 12px 10px 0; border-top: 1px solid #1f2937; font-size: 12px; color: #9ca3af; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.topbar h2 { margin: 0; font-size: 17px; }
.userbox { display: flex; align-items: center; gap: 12px; }
.role-badge {
  padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
}
.role-badge.admin { background: #fef3c7; color: #92400e; }
.role-badge.viewer { background: #f1f5f9; color: #475569; }
.content { padding: 24px 28px 40px; flex: 1; }

/* ---------- Generic ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; }
.page-head p { margin: 0; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { padding: 18px 20px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 14px; }

.btn {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 8px 14px; border-radius: 9px; display: inline-flex; align-items: center;
  gap: 6px; font-weight: 500;
}
.btn:hover { border-color: #c7d2fe; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: #4338ca; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.input, .select, .textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  background: white; color: var(--text); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px var(--primary-soft); }
.input.search { min-width: 240px; }
.input[readonly] { background: #f8fafc; color: #64748b; cursor: default; }
.input[readonly]:focus { border-color: var(--line); box-shadow: none; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #374151; }
label.field .req { color: var(--danger); }
.field-hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.field-hint.ok { color: var(--primary); font-weight: 600; }

/* 孩子搜索候选 + 自动带出字段 */
.input.auto-filled { background: #f5f8ff; border-color: #dbe4ff; color: var(--text); }
.input.auto-filled:focus { background: white; }
.child-suggest { display: none; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: 0 10px 26px rgba(15,23,42,.10); overflow: hidden; }
.child-suggest.open { display: block; }
.suggest-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: var(--primary-soft); }
.suggest-item b { font-size: 13px; color: var(--text); font-weight: 600; }
.suggest-item span { font-size: 12px; color: var(--muted); }
.suggest-empty { padding: 10px 12px; font-size: 12px; color: var(--muted); }
.sub-line { font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.sub-line a { color: var(--info); text-decoration: none; }
.sub-line a:hover { text-decoration: underline; }

/* ---------- Table ---------- */
.table-wrap { overflow: auto; border-radius: var(--radius); border: 1px solid var(--line); background: white; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 600; color: #475569; background: var(--panel-soft);
  padding: 11px 14px; white-space: nowrap; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
.cell-name { font-weight: 600; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px;
  background: #f1f5f9; color: #475569;
}
.tag.green { background: var(--success-soft); color: var(--success); }
.tag.orange { background: var(--warning-soft); color: var(--warning); }
.tag.red { background: var(--danger-soft); color: var(--danger); }
.tag.blue { background: var(--info-soft); color: var(--info); }
.tag.purple { background: var(--primary-soft); color: var(--primary); }
button.tag.event-tag { border: 0; cursor: pointer; background: var(--info-soft); color: var(--info); transition: filter .15s, transform .15s; }
button.tag.event-tag:hover { filter: brightness(.95); transform: translateY(-1px); }
.row-actions { display: flex; gap: 6px; }
.empty { padding: 42px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; color: var(--muted); font-size: 13px; }
.link-btn { border: 0; background: none; color: var(--primary); padding: 0; font-weight: 600; }

/* ---------- Modal / drawer ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50;
}
.modal { background: white; border-radius: 16px; width: 720px; max-width: 100%; max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.18); }
.modal.small { width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.age-auto-hint { grid-column: 1 / -1; display: block; font-size: 12px; color: var(--primary); background: var(--primary-soft); border-radius: 8px; padding: 8px 10px; margin-top: -4px; }
.form-section { grid-column: 1 / -1; font-weight: 700; color: var(--primary); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 6px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 24px; }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-item .k { font-size: 12px; color: var(--muted); }
.detail-item .v { word-break: break-all; }
.detail-section { grid-column: 1 / -1; font-weight: 700; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-top: 8px; }
.close-x { border: 0; background: none; font-size: 20px; color: var(--muted); line-height: 1; }
.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 80; background: #111827; color: white;
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px;
}
.toast.error { background: #b91c1c; }

/* ---------- Bars ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; font-size: 12px; }
.bar-track { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }

/* ---------- Analytics dashboard ---------- */
.cross-table td, .cross-table th { text-align: center; }
.cross-table td.cell-name, .cross-table th:first-child { text-align: left; white-space: nowrap; }
.cross-table td.heat-1 { background: #eef2ff; }
.cross-table td.heat-2 { background: #e0e7ff; }
.cross-table td.heat-3 { background: #c7d2fe; color: #3730a3; font-weight: 600; }
.cross-table td.heat-4 { background: #a5b4fc; color: #312e81; font-weight: 700; }
.region-summary { display: flex; flex-direction: column; gap: 10px; }
.region-summary-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 9px; background: var(--primary-soft); font-size: 13px; }
.region-summary-row strong { color: var(--primary); }
.region-summary-row span { color: var(--muted); }

/* ---------- Analytics 经营概览 ---------- */
.an-tabs { margin: 0 0 16px; width: fit-content; }
.funnel { display: flex; flex-direction: column; gap: 14px; }
.funnel-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.funnel-rate { font-size: 12px; font-weight: 400; color: var(--muted); }
.funnel-track { position: relative; height: 24px; border-radius: 7px; background: #eef2f7; overflow: hidden; }
.funnel-fill { height: 100%; border-radius: 7px; }
.funnel-fill.blue { background: linear-gradient(90deg, #4f46e5, #818cf8); }
.funnel-fill.purple { background: linear-gradient(90deg, #8b5cf6, #c084fc); }
.funnel-fill.green { background: linear-gradient(90deg, #0f9f6e, #34d399); }
.funnel-num { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 700; color: var(--text); }
.readiness { display: flex; flex-direction: column; gap: 12px; }
.readiness-row { display: grid; grid-template-columns: 90px 1fr 140px; gap: 12px; align-items: center; font-size: 12px; }

/* ---------- Workbench / 工作台 ---------- */
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.todo-card.purple .todo-num { color: var(--primary); }
.todo-card.blue .todo-num { color: var(--info); }
.todo-card.teal .todo-num { color: #0d9488; }
.todo-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); text-align: left; transition: transform .15s, box-shadow .15s; }
.todo-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.todo-num { font-size: 28px; font-weight: 700; }
.todo-label { font-size: 13px; color: var(--muted); }
.todo-card.orange .todo-num { color: var(--warning); }
.todo-card.red .todo-num { color: var(--danger); }
.todo-card.green .todo-num { color: var(--success); }
.phase-list { display: flex; flex-direction: column; gap: 10px; }
.phase-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; }
.phase-main strong { font-size: 14px; }
.phase-main .muted { font-size: 12px; }

/* ---------- Session cards / 期次管理 ---------- */
.view-switch { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.view-switch .btn { border-radius: 0; border: 0; }
.view-switch .btn.active { background: var(--primary); color: white; }
.session-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.session-card { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.session-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(15,23,42,.1); }
.session-poster { width: 108px; flex: 0 0 108px; background: var(--primary-soft); }
.session-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.session-poster.empty { display: flex; align-items: center; justify-content: center; font-size: 34px; color: var(--primary); opacity: .5; }
.session-body { flex: 1; min-width: 0; padding: 14px 16px; }
.session-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.session-head h3 { margin: 0; font-size: 16px; }
.session-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.session-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.session-stats > div { display: flex; flex-direction: column; }
.session-stats b { font-size: 14px; }
.session-stats b:last-child { font-size: 11px; }
.session-stats span { font-size: 11px; color: var(--muted); }
.session-progress { height: 6px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.session-progress > div { height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
.session-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.link-btn.danger { color: var(--danger); }

/* ---------- Public registration ---------- */
.pub-wrap { min-height: 100vh; background: linear-gradient(160deg, #eef2ff 0, #f8fafc 45%, #ecfdf5 100%); padding: 32px 16px; }
.pub-container { max-width: 860px; margin: 0 auto; }
.pub-header { text-align: center; margin-bottom: 26px; }
.pub-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.pub-logo .brand-mark { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.pub-header h1 { font-size: 30px; margin: 18px 0 8px; }
.pub-header p { color: var(--muted); margin: 0; }
.pub-card { padding: 28px; margin-bottom: 18px; }
.event-banner { border-radius: 12px; padding: 20px; background: linear-gradient(135deg, #4f46e5, #7c3aed); color: white; margin-bottom: 20px; }
.event-banner h2 { margin: 0 0 8px; font-size: 24px; }
.event-meta { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; opacity: .92; }
.pub-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.pub-form .full { grid-column: 1 / -1; }
.agreement { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.pub-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 12px 0 30px; }
/* 备案信息：后台、登录页、家长报名页共用 */
.beian-foot { text-align: center; font-size: 12px; color: #9ca3af; padding: 14px 12px 18px; line-height: 1.9; }
.beian-foot a { color: inherit; text-decoration: none; }
.beian-foot a:hover { color: var(--primary, #4f46e5); text-decoration: underline; }
.beian-sep { margin: 0 8px; opacity: .6; }
.login-card .beian-foot { padding: 16px 0 0; margin-top: 20px; border-top: 1px solid var(--line); }
.beian-police::before {
  content: ''; display: inline-block; width: 14px; height: 16px; margin-right: 4px;
  vertical-align: -3px;
  background: url('https://www.beian.gov.cn/img/new/gongan.png') no-repeat center / contain;
}
.event-options { display: grid; gap: 12px; }
.event-option { display: flex; align-items: center; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; transition: box-shadow .15s, transform .15s; }
.event-option:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.event-option-poster { width: 76px; height: 76px; flex: 0 0 76px; border-radius: 8px; overflow: hidden; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; }
.event-option-poster img { width: 100%; height: 100%; object-fit: cover; }
.event-option-empty { font-size: 26px; color: var(--primary); }
.event-option-main { flex: 1; min-width: 0; }
.event-option-main strong { font-size: 15px; }
/* 海报落地页 */
.landing-card { padding: 0; overflow: hidden; }
.landing-poster { width: 100%; background: #f1f5f9; display: flex; justify-content: center; }
.landing-poster img { display: block; width: 100%; max-width: 100%; height: auto; max-height: 640px; object-fit: contain; }
.landing-no-poster { min-height: 220px; background: linear-gradient(135deg, #eef2ff, #faf5ff); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--primary); font-size: 20px; font-weight: 700; }
.landing-no-poster span { font-size: 44px; opacity: .8; }
.landing-body { padding: 26px 28px 30px; }
.landing-body h2 { margin: 0 0 12px; font-size: 24px; }
.landing-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); }
.landing-desc { margin-top: 14px; font-size: 14px; line-height: 1.8; color: #4b5563; white-space: pre-wrap; }
.landing-signup { display: block; width: 100%; max-width: 320px; margin: 24px auto 0; padding: 13px; font-size: 16px; }
.landing-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 12px; }
.form-event-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--muted); padding: 0 0 16px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.form-event-line strong { color: var(--text); }
/* 后台海报管理 */
.poster-thumb { border: 0; background: none; cursor: pointer; padding: 0; display: block; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.poster-thumb img { width: 100%; height: 100%; object-fit: cover; }
.poster-thumb:hover { box-shadow: 0 0 0 2px var(--primary-soft); }
.poster-edit-preview { max-width: 240px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.poster-edit-preview img { display: block; width: 100%; height: auto; }
.detail-poster { max-width: 240px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.detail-poster img { display: block; width: 100%; height: auto; }
.success-box { text-align: center; padding: 40px 20px; }
.success-mark { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: flex; align-items: center; justify-content: center; font-size: 30px; }
.notice { background: var(--warning-soft); color: #92400e; padding: 12px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 18px; }

@media (max-width: 900px) {
  .sidebar { width: 72px; padding: 18px 8px; }
  .brand-text, .nav-item span:not(.nav-icon), .sidebar-foot, .nav-group-label { display: none; }
  .nav-group { margin-bottom: 4px; }
  .nav-item { justify-content: center; }
  .content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .form-grid, .pub-form, .detail-grid, .analysis-grid { grid-template-columns: 1fr; }
  .child-hero { flex-wrap: wrap; }
  .hero-stats { width: 100%; justify-content: flex-start; }
  .todo-grid { grid-template-columns: 1fr; }
  .session-grid { grid-template-columns: 1fr; }
}

/* ---------- Warm interactions ---------- */
body { animation: page-in .28s ease-out; }
.btn { transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease; }
.btn:hover { box-shadow: 0 4px 12px rgba(79, 70, 229, .12); }
.btn:active { transform: scale(.97); }
.card, .kpi { transition: transform .18s ease, box-shadow .18s ease; }
.card:hover, .kpi:hover { box-shadow: 0 12px 30px rgba(15, 23, 42, .09); }
.nav-item { transition: background .18s ease, color .18s ease, padding-left .18s ease; }
.nav-item:hover { padding-left: 16px; }
.link-btn.danger { color: var(--danger); }
.toast { animation: toast-in .24s ease-out; }
.modal { animation: modal-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

.welcome-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(120deg, #eef2ff 0%, #f5f3ff 55%, #ecfdf5 100%);
  border: 1px solid #e0e7ff; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
}
.welcome-title { font-size: 17px; font-weight: 700; color: #312e81; }
.welcome-sub { color: #6b7280; font-size: 13px; margin-top: 4px; }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 12px; background: var(--primary-soft); color: var(--primary);
  font-size: 20px; margin-bottom: 10px;
}
.friendly-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 36px 20px; color: var(--muted); font-size: 13px; line-height: 1.7;
}
.attention-list { display: flex; flex-direction: column; }
.attention-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.attention-item:last-child { border-bottom: 0; }
.attention-dot { width: 8px; height: 8px; border-radius: 50%; background: #a5b4fc; flex-shrink: 0; }
.attention-dot.high { background: #f87171; }
.attention-dot.medium { background: #fbbf24; }
.attention-main { flex: 1; min-width: 0; }
.attention-main .muted { font-size: 12px; }
.mini-highlights { display: flex; flex-direction: column; gap: 10px; }
.mini-highlight { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.mini-highlight .muted { margin-left: auto; font-size: 12px; }

.child-hero {
  display: flex; align-items: center; gap: 18px; padding: 20px 22px; margin-bottom: 16px;
  background: linear-gradient(120deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.hero-avatar {
  width: 58px; height: 58px; border-radius: 18px; flex-shrink: 0; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700;
}
.hero-avatar.editable { cursor: pointer; box-shadow: 0 0 0 3px var(--primary-soft); transition: transform .18s ease; }
.hero-avatar.editable:hover { transform: scale(1.06); }
.hero-avatar.editable::after {
  content: "✎"; position: absolute; right: 0; bottom: 0; width: 20px; height: 20px;
  background: white; color: var(--primary); border-radius: 6px 0 0 0; font-size: 11px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 -1px 4px rgba(0,0,0,.12);
}
.hero-avatar img, .avatar-thumb img, .avatar-preview img {
  width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit;
}
.hero-main { flex: 1; min-width: 0; }
.hero-name { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.hero-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.hero-event { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.hero-event-label { color: var(--muted); }
.hero-event b { font-size: 13px; color: var(--text); font-weight: 600; }
.hero-event .event-tag { font-size: 12px; }
.hero-stats { display: flex; gap: 26px; }
.hero-stats div { text-align: center; }
.hero-stats b { display: block; font-size: 22px; color: var(--primary); }
.hero-stats span { font-size: 12px; color: var(--muted); }
.growth-toolbar { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.growth-tabs { display: flex; gap: 6px; background: #eef2f7; padding: 4px; border-radius: 11px; }
.growth-tab {
  border: 0; background: transparent; color: #475569; padding: 8px 14px; border-radius: 8px;
  font-weight: 600; display: flex; align-items: center; gap: 6px; transition: all .16s ease;
}
.growth-tab:hover { color: var(--primary); }
.growth-tab.active { background: white; color: var(--primary); box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.growth-tab em { font-style: normal; font-size: 11px; background: var(--primary-soft); color: var(--primary); border-radius: 99px; padding: 1px 7px; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: #e0e7ff; }
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-node {
  position: absolute; left: -21px; top: 20px; width: 12px; height: 12px; border-radius: 50%;
  background: white; border: 3px solid #818cf8; box-shadow: 0 0 0 3px #eef2ff;
}
.highlight-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.highlight-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.highlight-card h4 { margin: 10px 0 6px; font-size: 16px; }
.highlight-card p { margin: 0; color: #4b5563; font-size: 13px; white-space: pre-wrap; line-height: 1.7; }
.highlight-foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; font-size: 12px; }
.cheer-btn {
  border: 1px solid #c7d2fe; background: var(--primary-soft); color: var(--primary);
  border-radius: 99px; padding: 5px 13px; font-weight: 600; font-size: 12px;
}
.cheer-btn:hover { background: #e0e7ff; }
.cheer-btn.cheered { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.cheer-btn:active span { animation: pop .35s ease; }

.drop-zone {
  border: 2px dashed #c7d2fe; border-radius: 12px; padding: 22px; text-align: center;
  color: var(--muted); background: #fafaff; margin-bottom: 16px; cursor: pointer; transition: all .18s ease;
}
.drop-zone:hover, .drop-zone.over { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.photo-grid .friendly-empty { grid-column: 1 / -1; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
.loading-note { grid-column: 1 / -1; padding: 32px; text-align: center; color: var(--muted); }
.photo-tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: white; }
.photo-thumb { height: 150px; background: #f1f5f9; cursor: zoom-in; display: flex; align-items: center; justify-content: center; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.photo-thumb:hover img { transform: scale(1.05); }
.photo-missing { color: var(--muted); font-size: 12px; }
.photo-caption { padding: 9px 11px 2px; font-size: 13px; font-weight: 600; }
.photo-meta { padding: 2px 11px 10px; font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.lightbox { text-align: center; }
.lightbox img { max-width: 100%; max-height: 68vh; border-radius: 10px; }
.lightbox-cap { color: var(--muted); font-size: 13px; margin-top: 10px; }

.analysis-grid { align-items: start; }
.analysis-card { min-height: 320px; }
.analysis-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.analysis-note { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.risk-badge { padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--success-soft); color: var(--success); }
.risk-badge.medium { background: var(--warning-soft); color: var(--warning); }
.risk-badge.high { background: var(--danger-soft); color: var(--danger); }
.signal-list { display: flex; flex-direction: column; gap: 10px; }
.signal { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 9px; background: var(--panel-soft); }
.signal-mark { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: #e0e7ff; color: var(--primary); font-weight: 700; font-size: 12px; }
.signal.warning .signal-mark { background: var(--warning-soft); color: var(--warning); }
.signal.warning { background: #fffaf0; }
.signal.good .signal-mark { background: var(--success-soft); color: var(--success); }
.signal strong { font-size: 13px; }
.signal .muted { font-size: 12px; }
.sub-title { font-size: 14px; margin: 18px 0 10px; }
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.6; }
.action-num { width: 20px; height: 20px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.insight-block { margin-bottom: 14px; }
.insight-block h4 { font-size: 13px; margin: 0 0 6px; color: var(--primary); }
.insight-block p { margin: 0; font-size: 13px; line-height: 1.7; }
.insight-block.warn h4 { color: var(--warning); }
.insight-block.good h4 { color: var(--success); }
.insight-line { font-size: 13px; line-height: 1.7; margin-bottom: 4px; }
.analysis-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.analysis-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 320px; color: var(--text); }
.analysis-loading .muted { font-size: 12px; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #e0e7ff; border-top-color: var(--primary); animation: spin .8s linear infinite; }

/* ---------- Child avatars ---------- */
.avatar-thumb {
  width: 34px; height: 34px; border-radius: 11px; overflow: hidden; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: white;
  background: linear-gradient(135deg, #818cf8, #a78bfa); vertical-align: middle;
}
.avatar-thumb.editable { cursor: pointer; position: relative; box-shadow: 0 0 0 2px var(--primary-soft); transition: transform .16s ease; }
.avatar-thumb.editable:hover { transform: scale(1.08); }
.avatar-thumb.editable::after {
  content: "+"; position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 4px 0 0 0;
  background: white; color: var(--primary); font-size: 10px; line-height: 13px; text-align: center;
}
.photo-cell { white-space: nowrap; }
.list-photo-thumb {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover;
  display: inline-block; margin-right: 4px; vertical-align: middle;
  border: 1px solid var(--line); transition: transform .16s ease;
}
.list-photo-thumb:hover { transform: scale(1.12); }
.photo-more {
  display: inline-block; font-size: 11px; color: var(--primary); background: var(--primary-soft);
  border-radius: 99px; padding: 2px 6px; vertical-align: middle;
}
.avatar-editor { display: flex; gap: 22px; align-items: flex-start; }
.avatar-preview {
  width: 150px; height: 150px; flex-shrink: 0; border-radius: 22px; overflow: hidden;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white;
  display: flex; align-items: center; justify-content: center; font-size: 54px; font-weight: 700;
  box-shadow: var(--shadow);
}
.avatar-editor-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.avatar-editor-side .muted { font-size: 13px; line-height: 1.7; margin: 0; }
.avatar-note { font-size: 12px; }
@media (max-width: 560px) { .avatar-editor { flex-direction: column; align-items: center; } .avatar-editor-side { width: 100%; } }

