.cos-portal {
  --cos-primary: #1e3a8a;
  --cos-accent: #0f6b63;
  --cos-ink: #1c1916;
  --cos-muted: #6b645b;
  --cos-card: #fffcf7;
  --cos-line: #e6ddd0;
  --cos-bg: #f3eee4;
  --cos-ok: #067647;
  --cos-warn: #b54708;
  --cos-danger: #b42318;
  --cos-shadow: 0 1px 0 rgba(28,25,22,.04), 0 14px 36px rgba(28,25,22,.07);
  --cos-font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --cos-display: Fraunces, "Iowan Old Style", Georgia, serif;
  --cos-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --cos-radius: 20px;
  max-width: 920px;
  margin: 0 auto;
  font-family: var(--cos-font);
  color: var(--cos-ink);
  padding: 8px 4px 32px;
  line-height: 1.5;
}
.cos-portal h1, .cos-portal h2, .cos-portal h3 {
  font-family: var(--cos-display);
  font-weight: 550;
  letter-spacing: -0.02em;
}
.cos-portal-app { max-width: 980px; padding-bottom: 28px; }

.cos-portal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 4px 14px;
  border-bottom: 1px solid var(--cos-line);
  position: sticky;
  top: 0;
  z-index: 8;
  background: color-mix(in oklab, var(--cos-bg) 88%, white);
  backdrop-filter: blur(10px);
}
.cos-portal-top .who {
  display: flex; gap: 10px; align-items: center;
}
.cos-mini-av {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--cos-primary); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.cos-portal-top span { display: block; color: var(--cos-muted); font-size: 13px; }
.cos-portal-top strong { font-family: var(--cos-display); font-size: 17px; }
.cos-signout, .cos-lang-link {
  background: #fff;
  border: 1px solid var(--cos-line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--cos-ink) !important;
  font-weight: 700;
  text-decoration: none;
  min-height: 40px;
  display: inline-flex; align-items: center;
}
.cos-top-actions { display: flex; gap: 8px; align-items: center; }

.cos-portal-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0;
}
.cos-portal-menu a {
  display: inline-flex;
  align-items: center;
  background: var(--cos-card);
  color: var(--cos-primary) !important;
  border: 1px solid var(--cos-line);
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 13px;
  font-weight: 650;
  font-size: 13.5px;
  min-height: 40px;
}
.cos-portal-menu a.on,
.cos-portal-menu a:hover { background: var(--cos-ink); color: #fff !important; border-color: var(--cos-ink); }

.cos-hero-card {
  background: #14110e;
  color: #fff;
  border-radius: 24px;
  padding: 20px 22px;
  margin: 8px 0 16px;
  display: flex; gap: 14px; align-items: center;
  box-shadow: var(--cos-shadow);
}
.cos-hero-card .cos-avatar {
  width: 56px; height: 56px; flex: 0 0 56px;
  border-radius: 18px; background: #fff; color: var(--cos-primary);
  display: grid; place-items: center; font-weight: 750; font-size: 22px;
}
.who-staff .cos-hero-card { background: #10221f; }
.who-parent .cos-hero-card { background: #14182a; }
.who-student .cos-hero-card { background: #10221f; }
.cos-hero-card h2 { margin: 0 0 4px; font-size: 26px; color: #fff; }
.cos-hero-card p { margin: 0; opacity: .88; }

.cos-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.cos-stat {
  background: var(--cos-card);
  border: 1px solid var(--cos-line);
  border-radius: 18px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit !important;
  box-shadow: var(--cos-shadow);
}
.cos-stat b { display: block; font-size: 24px; color: var(--cos-primary); font-variant-numeric: tabular-nums; font-family: var(--cos-display); font-weight: 550; }
.cos-stat span { color: var(--cos-muted); font-size: 13px; }

.cos-tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.cos-tile {
  background: var(--cos-card);
  border: 1px solid var(--cos-line);
  border-radius: 18px;
  padding: 16px;
  text-decoration: none;
  color: inherit !important;
  min-height: 84px;
  box-shadow: var(--cos-shadow);
  transition: transform .16s var(--cos-ease);
}
.cos-tile:hover { transform: translateY(-2px); }
.cos-tile strong { display: block; font-size: 16px; }
.cos-tile span { color: var(--cos-primary); font-size: 13px; font-weight: 700; }

.cos-panel {
  background: var(--cos-card);
  border: 1px solid var(--cos-line);
  border-radius: 20px;
  padding: 16px 18px;
  margin: 16px 0;
  box-shadow: var(--cos-shadow);
}
.cos-list { margin: 0; padding-left: 18px; }
.cos-list li { margin: 6px 0; }
.cos-apply { display: grid; gap: 10px; }
.cos-apply label { display: grid; gap: 4px; font-weight: 600; }
.cos-apply input, .cos-apply textarea, .cos-apply select,
.cos-child-switch select {
  padding: 10px 12px;
  border: 1px solid var(--cos-line);
  border-radius: 12px;
  font-size: 16px;
  min-height: 44px;
  background: #fff;
}
.cos-apply button {
  background: var(--cos-primary);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  min-height: 46px;
}
.cos-apply-ok, .cos-status-card {
  background: var(--cos-card);
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  padding: 18px 20px;
  margin: 12px 0;
}
.cos-app-no { font-size: 22px; }
.cos-chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 700; background: #e2e8f0; }
.cos-chip.st-applied { background: #dbeafe; color: #1e3a8a; }
.cos-chip.st-test { background: #fef3c7; color: #92400e; }
.cos-chip.st-offered { background: #dcfce7; color: #166534; }
.cos-chip.st-waitlist { background: #ede9fe; color: #5b21b6; }
.cos-chip.st-admitted { background: #1d4ed8; color: #fff; }
.cos-chip.st-rejected { background: #fee2e2; color: #991b1b; }
.cos-warn { background: #fff7ed; color: #9a3412; padding: 10px 12px; border-radius: 12px; }
.cos-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cos-primary);
  color: #fff !important;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  margin-right: 8px;
  border: 0;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
}
.cos-kv { width: 100%; border-collapse: collapse; }
.cos-kv th { text-align: left; width: 140px; padding: 6px 8px 6px 0; color: var(--cos-muted); }
.cos-kv td { padding: 6px 0; }
.cos-big { font-size: 28px; font-weight: 550; margin: 0 0 12px; font-family: var(--cos-display); }
.cos-portal-foot { color: #94a3b8; font-size: 12px; margin: 24px 0 8px; }
.cos-login {
  max-width: 440px;
  padding: 28px 24px;
  border: 1px solid var(--cos-line);
  border-radius: 28px;
  background: var(--cos-card);
  box-shadow: var(--cos-shadow);
  margin: 24px auto;
}
.cos-login .cos-crest {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--cos-primary) url("../img/logo.svg") center / 30px no-repeat;
  margin-bottom: 12px;
}
.cos-login h2 { margin: 0 0 8px; font-size: 28px; }
.ok { background: #ecfdf5; color: #065f46; padding: 10px 12px; border-radius: 12px; }
.cos-err { background: #fef2f2; color: #991b1b; padding: 10px 12px; border-radius: 12px; }
.cos-child-switch { margin: 12px 0 0; }
.cos-child-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.cos-child-chips a {
  border: 1px solid var(--cos-line); background: #fff; color: var(--cos-ink) !important;
  border-radius: 999px; padding: 8px 12px; text-decoration: none; font-weight: 650; min-height: 40px;
  display: inline-flex; align-items: center;
}
.cos-child-chips a.on { background: var(--cos-ink); color: #fff !important; border-color: var(--cos-ink); }
.cos-alerts { display: grid; gap: 8px; margin: 0 0 14px; }
.cos-alert {
  display: block;
  background: #eff6ff;
  color: #1e3a8a !important;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  text-decoration: none;
}
.cos-alert.warn { background: #fff7ed; color: #9a3412 !important; }
.cos-alert.due { background: #fef2f2; color: #991b1b !important; }
.cos-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cos-cal i, .cos-cal b {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 700;
}
.cos-cal b.dp { background: #dcfce7; color: #166534; }
.cos-cal b.da { background: #fecaca; color: #991b1b; }
.cos-cal b.dl { background: #fef3c7; color: #92400e; }
.cos-legend { font-size: 13px; color: var(--cos-muted); }
.cos-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 10px; }
.cos-legend .dot.p { background: #16a34a; }
.cos-legend .dot.a { background: #dc2626; }
.cos-legend .dot.l { background: #d97706; }
.cos-cards { display: grid; gap: 10px; }
.cos-note { background: #f8fafc; border-radius: 12px; padding: 12px 14px; }
.cos-note span { display: block; color: var(--cos-muted); font-size: 13px; }
.cos-note.late { background: #fff7ed; }
.cos-table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; }
.cos-table th, .cos-table td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--cos-line); }
.cos-table input[type=number] { width: 88px; }

.cos-result-card {
  background: #f7f2ea;
  border-radius: 16px;
  padding: 14px 16px;
  margin: 0 0 12px;
  border: 1px solid var(--cos-line);
}
.cos-result-card header { display: flex; justify-content: space-between; gap: 8px; }
.cos-result-card .cos-big { font-size: 32px; margin: 8px 0 12px; }
.cos-result-card .cos-big small { font-size: 16px; color: var(--cos-muted); }
.cos-bars { display: grid; gap: 8px; }
.cos-bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.cos-bar-row i { display: block; height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.cos-bar-row i b { display: block; height: 100%; background: var(--cos-primary); }

.cos-lang-link, .cos-lang { font-weight: 700; font-size: 13px; }
.cos-hints { color: var(--cos-muted); font-size: 14px; padding-left: 18px; }
.cos-check { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.cos-today { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.cos-today-pill {
  background: var(--cos-card);
  border: 1px solid var(--cos-line);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 14px;
}
.cos-today-pill.ok { background: #dcfce7; color: #166534; border-color: #86efac; }
.cos-today-pill.bad { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.cos-att-sum { font-weight: 700; }
.cos-att-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cos-att-wrap { overflow: auto; }
.cos-att-table td { text-align: center; }
.cos-att-table td:nth-child(2) { text-align: left; }
.cos-radio { display: grid; place-items: center; }
.cos-radio input { position: absolute; opacity: 0; }
.cos-radio span {
  display: grid; place-items: center;
  min-width: 40px; min-height: 40px; border-radius: 12px;
  border: 1px solid var(--cos-line); background: #fff; font-weight: 750; font-size: 12px;
}
.cos-radio input:checked + span { background: var(--cos-ink); color: #fff; border-color: var(--cos-ink); }
.cos-btn-lite { background: #fff; color: var(--cos-primary) !important; border: 1px solid #bfdbfe; }
.cos-note.done { background: #ecfdf5; }
.cos-inline { margin: 8px 0 0; }
.cos-legend .dot.od { background: #2563eb; }
.cos-legend .dot.ml { background: #7c3aed; }
.cos-cal b.dod { background: #dbeafe; color: #1e3a8a; }
.cos-cal b.dml { background: #ede9fe; color: #5b21b6; }
.cos-id-card {
  background: #14110e;
  color: #fff;
  border-radius: 24px;
  padding: 18px 20px 16px;
  max-width: 420px;
  box-shadow: var(--cos-shadow);
}
.cos-id-school { letter-spacing: .12em; text-transform: uppercase; font-size: 11px; opacity: .8; margin: 0 0 10px; }
.cos-id-body { display: grid; grid-template-columns: 72px 1fr 72px; gap: 12px; align-items: center; }
.cos-id-photo {
  width: 72px; height: 72px; border-radius: 16px;
  background: #fff; color: var(--cos-primary); display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
}
.cos-id-card h3 { margin: 0 0 4px; }
.cos-id-card p { margin: 0; font-size: 13px; opacity: .92; }
.cos-qr { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; width: 72px; }
.cos-qr i { display: block; aspect-ratio: 1; background: transparent; border-radius: 1px; }
.cos-qr i.on { background: #fff; }
.cos-id-note { margin: 12px 0 0; font-size: 12px; opacity: .8; }

.cos-dock {
  display: none;
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
  background: #14110e; color: #fff; border-radius: 22px;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 6px;
  z-index: 40;
  box-shadow: 0 16px 40px rgba(20,17,14,.3);
}
.cos-dock a {
  color: #d9d0c4 !important; text-decoration: none; text-align: center;
  font-size: 11px; font-weight: 700; padding: 8px 4px; border-radius: 14px;
}
.cos-dock a.on { background: var(--cos-primary); color: #fff !important; }
.cos-sheet { display: grid; gap: 8px; }
.cos-sheet a {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--cos-card); border: 1px solid var(--cos-line);
  border-radius: 16px; padding: 14px 16px; text-decoration: none; color: inherit !important;
  min-height: 52px; font-weight: 650;
}

@media (max-width: 720px) {
  .cos-portal { padding: 0 8px 96px; }
  .cos-portal-app { padding-bottom: 88px; }
  .cos-portal-top { flex-wrap: wrap; }
  .cos-stat-row, .cos-tile-grid { grid-template-columns: 1fr 1fr; }
  .cos-table { font-size: 14px; }
  .cos-portal-menu { display: none; }
  .cos-dock { display: grid; }
  .cos-bar-row { grid-template-columns: 1fr; }
  .cos-id-body { grid-template-columns: 64px 1fr; }
  .cos-qr { display: none; }
  .cos-att-actions .cos-btn { min-height: 44px; }
  .cos-hero-card h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .cos-portal * { transition: none !important; }
}
