:root {
  --brand: #0f766e;
  --brand-dark: #134e4a;
  --brand-soft: #ccfbf1;
  --accent: #d97706;
  --accent-soft: #ffedd5;
  --surface: #eef6f4;
  --surface-2: #f7fbfa;
  --text: #134e4a;
  --muted: #5f7a74;
  --danger: #b42318;
  --card: #ffffff;
  --shadow: 0 16px 40px rgba(15, 70, 62, 0.12);
  --touch-min: 44px;
  --radius: 18px;
  --font-display: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html {
  min-height: 100%;
  background-color: var(--surface);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-display);
  color: var(--text);
  /* 勿用 height:100%：长页超出视口时背景会按视口高度重复，出现横向拼接缝 */
  background-color: var(--surface);
  background-image:
    radial-gradient(900px 420px at 8% -8%, rgba(15, 118, 110, 0.18), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(217, 119, 6, 0.12), transparent 50%),
    linear-gradient(180deg, #f4faf8 0%, var(--surface) 48%, #e7f2ef 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

body.page-login {
  background-color: #134e4a;
  background-image:
    radial-gradient(1200px 600px at 15% 10%, rgba(15, 118, 110, 0.28), transparent 55%),
    radial-gradient(900px 500px at 90% 85%, rgba(217, 119, 6, 0.18), transparent 50%),
    linear-gradient(145deg, #0f766e 0%, #134e4a 45%, #0b3f3b 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

body.page-login .navbar {
  display: none !important;
}

body.page-login .page-wrap {
  max-width: none;
  margin: 0;
  padding: 0;
}

body.page-login form {
  min-height: 100%;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.navbar {
  background: linear-gradient(90deg, var(--brand), var(--brand-dark)) !important;
  box-shadow: 0 4px 18px rgba(15, 70, 62, 0.18);
}

.navbar .nav-link,
.navbar .navbar-brand,
.navbar .navbar-toggler {
  color: #fff !important;
}

.navbar .nav-link:hover {
  opacity: 0.9;
}

.user-chip {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.9rem;
}

.page-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}

.card-panel {
  background: var(--card);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.btn-touch,
.form-control,
.form-select {
  min-height: var(--touch-min);
}

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.btn-brand:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-page::before,
.login-page::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.login-page::before {
  width: 280px;
  height: 280px;
  left: -60px;
  top: 12%;
  background: rgba(255, 255, 255, 0.08);
  animation: floatA 8s ease-in-out infinite;
}

.login-page::after {
  width: 360px;
  height: 360px;
  right: -80px;
  bottom: 5%;
  background: rgba(217, 119, 6, 0.12);
  animation: floatB 10s ease-in-out infinite;
}

@keyframes floatA {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(18px); }
}

@keyframes floatB {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-16px); }
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  padding: 2rem 1.75rem 1.75rem;
  position: relative;
  z-index: 1;
  animation: riseIn 0.55s ease both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand {
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--brand-dark);
  margin: 0 0 0.35rem;
  line-height: 1.1;
  animation: brandIn 0.7s ease both;
}

@keyframes brandIn {
  from { opacity: 0; letter-spacing: 0.2em; }
  to { opacity: 1; letter-spacing: 0.06em; }
}

.login-sub {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.login-card .form-label {
  font-weight: 600;
  color: var(--brand-dark);
}

.login-card .form-control {
  border-radius: 12px;
  border-color: #c5ddd8;
}

.login-card .form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(15, 118, 110, 0.18);
}

.login-card .btn-brand {
  border-radius: 12px;
  min-height: 48px;
}

.footer-note {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 1.5rem;
}

.alert-soft {
  background: var(--accent-soft);
  border: 1px solid #fdba74;
  color: #9a3412;
}

/* ===== Home ===== */
.home-hero {
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.95), rgba(19, 78, 74, 0.92)),
    radial-gradient(500px 200px at 90% 20%, rgba(217, 119, 6, 0.35), transparent 60%);
  color: #fff;
  border-radius: 22px;
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  animation: riseIn 0.45s ease both;
}

.home-hero h1 {
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 760;
  margin: 0 0 0.35rem;
}

.home-hero p {
  margin: 0;
  opacity: 0.9;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

.home-tile {
  grid-column: span 12;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 20px;
  padding: 1.35rem 1.25rem;
  min-height: 132px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.home-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 44px rgba(15, 70, 62, 0.16);
  color: inherit;
}

.home-tile::after {
  content: "";
  position: absolute;
  right: -20px;
  bottom: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.home-tile .title {
  font-size: 1.15rem;
  font-weight: 750;
  margin-bottom: 0.35rem;
}

.home-tile .desc {
  font-size: 0.92rem;
  opacity: 0.88;
  max-width: 28ch;
}

.home-tile.t-assess { background: linear-gradient(145deg, #0f766e, #0d9488); color: #fff; }
.home-tile.t-students { background: linear-gradient(145deg, #0e7490, #155e75); color: #fff; }
.home-tile.t-eval { background: linear-gradient(145deg, #b45309, #d97706); color: #fff; }
.home-tile.t-bill { background: linear-gradient(145deg, #115e59, #134e4a); color: #fff; }
.home-tile.t-pwd { background: linear-gradient(145deg, #334155, #475569); color: #fff; }

@media (min-width: 768px) {
  .home-tile { grid-column: span 6; }
}

@media (min-width: 992px) {
  .home-tile.t-assess { grid-column: span 7; }
  .home-tile.t-students { grid-column: span 5; }
  .home-tile.t-eval,
  .home-tile.t-bill,
  .home-tile.t-pwd { grid-column: span 4; }
}

.goal-list td,
.goal-check-all {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.4rem;
  border: 1px solid #d9e5e1;
  border-radius: 8px;
  background: #fff;
  min-height: var(--touch-min);
  line-height: 1.45;
}

.goal-list input[type="checkbox"],
.goal-check-all input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0.2rem 0 0;
}

.goal-list label,
.goal-check-all label {
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  min-height: 0;
  flex: 1 1 auto;
  cursor: pointer;
}

.sticky-bottom {
  position: sticky;
  bottom: 0;
  z-index: 5;
}

@media (max-width: 767.98px) {
  .page-wrap {
    padding: 0.75rem 0.75rem 2rem;
  }

  .card-panel {
    border-radius: 14px;
    padding: 1rem;
  }
}

/* ===== Milestones board (Win-like) ===== */
.ms-page {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem 1rem 1.25rem;
}

.ms-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  align-items: flex-start;
}

.ms-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 992px) {
  .ms-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
  }
}

.ms-board-scroll {
  overflow: auto;
  border: 1px solid #cfe2dc;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #f8fbfa 0%, #eef6f4 100%);
  max-height: min(72vh, 760px);
  -webkit-overflow-scrolling: touch;
}

.ms-board {
  position: relative;
  min-width: 960px;
  min-height: 720px;
}

.ms-header {
  position: absolute;
  height: 18px;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  color: #1f2937;
  border-radius: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}

.ms-header.lvl1 { background: #ffcc99; }
.ms-header.lvl2 { background: #99cc00; }
.ms-header.lvl3 { background: #99ccff; }

.ms-cell {
  position: absolute;
  padding: 0;
  border: 1px solid #4b5563;
  background: #fff;
  display: block;
  cursor: pointer;
  box-sizing: border-box;
  overflow: hidden;
}

.ms-cell.attempt {
  border-style: none;
  background: transparent;
}

.ms-face {
  display: flex;
  width: 100%;
  height: 100%;
  background: #fff;
}

.ms-face.dual {
  flex-direction: column;
}

.ms-face.single {
  background: #fff;
}

.ms-face.single.r1 { background: #F79646; }
.ms-face.single.r2 { background: #92D050; }
.ms-face.single.r3 { background: #4BACC6; }
.ms-face.single.r4 { background: #FF0000; }

.ms-half {
  flex: 1 1 50%;
  background: #fff;
  min-height: 0;
}

.ms-half.r1 { background: #F79646; }
.ms-half.r2 { background: #92D050; }
.ms-half.r3 { background: #4BACC6; }
.ms-half.r4 { background: #FF0000; }

.ms-dash {
  flex: 0 0 0;
  height: 0;
  border-top: 1px dashed #111;
  margin: 0;
  position: relative;
  z-index: 1;
}

.ms-attempt-row {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
  height: 100%;
  gap: 2px;
}

.ms-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid #334155;
  background: transparent;
  box-sizing: border-box;
}

.ms-dot.on.r1 { background: #F79646; border-color: #F79646; }
.ms-dot.on.r2 { background: #92D050; border-color: #92D050; }
.ms-dot.on.r3 { background: #4BACC6; border-color: #4BACC6; }
.ms-dot.on.r4 { background: #FF0000; border-color: #FF0000; }

.ms-cell.selected {
  outline: 2px solid var(--accent);
  z-index: 2;
}

.ms-cell.dirty {
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.45);
}

.ms-cell.locked {
  opacity: 0.78;
  cursor: default;
}

.ms-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.ms-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -1px;
}

.ms-legend .r1 { background: #F79646; }
.ms-legend .r2 { background: #92D050; }
.ms-legend .r3 { background: #4BACC6; }
.ms-legend .r4 { background: #FF0000; }

/* Barriers: each score on its own row; radio + text stay inline */
.barrier-scores td {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  margin-bottom: 0.2rem;
  border-radius: 8px;
  min-height: var(--touch-min);
  line-height: 1.45;
  cursor: pointer;
}

.barrier-scores td:hover {
  background: var(--brand-soft);
}

.barrier-scores input[type="radio"] {
  flex: 0 0 auto;
  margin: 0.2rem 0 0;
}

.barrier-scores label {
  display: inline;
  margin: 0;
  cursor: pointer;
  flex: 1 1 auto;
}

.ms-score-badge {
  font-weight: 700;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 0.2rem 0.75rem;
  font-size: 0.9rem;
}

.list-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #d9e5e1;
}

.list-pager-info {
  color: var(--muted);
  font-size: 0.92rem;
  min-width: 8rem;
  text-align: center;
}

/* Assessment list */
.assess-table-wrap {
  border: 1px solid #d9e5e1;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.assess-table {
  margin-bottom: 0;
}

.assess-table thead th {
  background: #eef6f4;
  color: var(--brand-dark);
  font-weight: 650;
  border-bottom: 1px solid #d9e5e1;
  white-space: nowrap;
}

.assess-table tbody td {
  border-bottom: 1px solid #eef2f1;
  vertical-align: middle;
}

.assess-table tbody tr:last-child td {
  border-bottom: 0;
}

.assess-open-btn {
  min-width: 4.5rem;
}

.assess-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  margin-bottom: 0.65rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid #d9e5e1;
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(15, 70, 62, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.assess-row:hover,
.assess-row:focus {
  color: inherit;
  border-color: #99c9c1;
  box-shadow: 0 10px 24px rgba(15, 70, 62, 0.1);
  transform: translateY(-1px);
}

.assess-row-main {
  min-width: 0;
  flex: 1 1 auto;
}

.assess-row-name {
  font-weight: 750;
  font-size: 1.05rem;
  color: var(--brand-dark);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assess-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.assess-row-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.25rem;
  min-height: var(--touch-min);
  padding: 0 0.9rem;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 650;
  font-size: 0.9rem;
}

/* IEP generation progress (Win-like) */
.iep-prog {
  background: #fff;
  border: 1px solid #cfe2dc;
  border-radius: 14px;
  padding: 1rem 1.1rem 0.85rem;
}

.iep-prog-title {
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--brand);
  padding-bottom: 0.35rem;
  margin-bottom: 0.25rem;
}

.iep-prog-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.iep-prog-bar {
  background: #d9ebe7;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.45rem;
}

.iep-prog-fill {
  background: linear-gradient(90deg, var(--brand), #0d9488);
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.iep-prog-meta {
  font-size: 0.9rem;
  color: var(--brand-dark);
  font-weight: 650;
  margin-bottom: 0.85rem;
}

.iep-prog-table {
  width: 100%;
  border-collapse: collapse;
}

.iep-prog-table tr {
  border-bottom: 1px solid #e8eef4;
}

.iep-prog-table td {
  padding: 0.55rem 0.45rem;
  vertical-align: middle;
}

.iep-prog-table tr.done { background: #f0fdf4; }
.iep-prog-table tr.failed { background: #fff1f2; }
.iep-prog-table tr.active { background: #fffbeb; }
.iep-prog-table tr.wait { background: #f9fafb; }

.iep-prog-table .num {
  width: 2.2rem;
  text-align: center;
  font-weight: 700;
  color: var(--brand);
}

.iep-prog-table tr.done .num { color: #16a34a; }
.iep-prog-table tr.failed .num { color: #dc2626; }
.iep-prog-table tr.active .num { color: #d97706; }
.iep-prog-table tr.wait .num { color: #94a3b8; }

.iep-prog-table .name {
  font-size: 0.95rem;
}

.iep-prog-table .name small {
  color: #64748b;
  margin-left: 0.35rem;
}

.iep-prog-table tr.active .name small { color: #b45309; }

.iep-prog-table .tagcell {
  width: 7.5rem;
  text-align: right;
  white-space: nowrap;
}

.iep-prog-table .tag {
  display: inline-block;
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 650;
}

.iep-prog-table .tag.done { background: #dcfce7; color: #15803d; }
.iep-prog-table .tag.failed { background: #fee2e2; color: #b91c1c; }
.iep-prog-table .tag.active { background: #fef9c3; color: #b45309; }
.iep-prog-table .tag.think { background: #ede9fe; color: #7c3aed; }
.iep-prog-table .tag.wait { background: #e2e8f0; color: #64748b; }

.iep-prog-foot {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid #d9e5e1;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
}

/* Pre-interview */
.pre-fold-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pre-fold-header .h5 {
  margin-bottom: 0;
}

.pre-fold-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0;
  padding: 0;
  border: 1px solid #c5d5cf;
  border-radius: 4px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  line-height: 1;
}

.pre-fold-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* 展开显示减号，折叠显示加号 */
.pre-fold-icon::before {
  content: "−";
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.pre-fold-btn[aria-expanded="false"] .pre-fold-icon::before {
  content: "+";
}

.pre-fold-body {
  padding-top: 0;
}

.pre-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--brand-soft);
  border-radius: 12px;
}

.pre-meta .k {
  display: inline-block;
  min-width: 4.5rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-right: 0.35rem;
}

.pre-qr {
  border: 1px solid #d9e5e1;
  border-radius: 12px;
  background: #fff;
  padding: 0.5rem;
}

.pre-interview .form-label {
  font-weight: 600;
}

.ms-detail {
  border: 1px solid #cfe2dc;
  border-radius: 14px;
  background: #fff;
  padding: 1rem;
  min-height: 280px;
  position: sticky;
  top: 0.5rem;
}

.ms-detail-title {
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 0.75rem;
}

.ms-detail-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.ms-k {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand);
  margin-top: 0.65rem;
}

.ms-v {
  font-size: 0.9rem;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
}

.ms-score {
  margin-top: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
}
